diff --git a/video-gen-app/dist/assets/index-D088jE8K.js b/video-gen-app/dist/assets/index-C_heyhPf.js similarity index 95% rename from video-gen-app/dist/assets/index-D088jE8K.js rename to video-gen-app/dist/assets/index-C_heyhPf.js index 6ca9515c..0cc6ad85 100644 --- a/video-gen-app/dist/assets/index-D088jE8K.js +++ b/video-gen-app/dist/assets/index-C_heyhPf.js @@ -403,7 +403,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho 0% { opacity: 0; transform: translateY(20px) scale(0.96); } 100% { opacity: 1; transform: translateY(0) scale(1); } } - `})]})},n7=`dismissed_activity_banner_version`,xse=({onVisibilityChange:e})=>{let[t,n]=(0,S.useState)(``),[r,i]=(0,S.useState)(0),[a,o]=(0,S.useState)(!0);return(0,S.useEffect)(()=>{h5().then(t=>{let r=t.siteBanner||``,a=t.siteBannerVersion||0;if(i(a),r){let t=Number(localStorage.getItem(n7)||0){o(!0),e?.(!1)})},[]),a||!t?null:(0,$.jsx)(`div`,{style:{width:`100%`,position:`relative`,background:`linear-gradient(135deg, #f3e8ff 0%, #ede9fe 50%, #e0e7ff 100%)`,borderBottom:`1px solid rgba(139, 92, 246, 0.15)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`8px 40px 8px 16px`,maxWidth:1400,margin:`0 auto`,width:`100%`,boxSizing:`border-box`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:8,background:`rgba(139, 92, 246, 0.12)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(g6,{style:{color:`#7c3aed`,fontSize:14}})}),(0,$.jsx)(`div`,{style:{color:`#5b21b6`,fontSize:14,fontWeight:500,lineHeight:1.5,textAlign:`center`},dangerouslySetInnerHTML:{__html:t}})]}),(0,$.jsx)(`button`,{onClick:()=>{localStorage.setItem(n7,String(r)),o(!0),e?.(!1)},style:{position:`absolute`,right:8,top:`50%`,transform:`translateY(-50%)`,width:26,height:26,borderRadius:`50%`,background:`rgba(139, 92, 246, 0.1)`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,transition:`all 0.2s ease`,outline:`none`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.2)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.1)`},children:(0,$.jsx)(ju,{style:{color:`#7c3aed`,fontSize:11}})})]})})},r7=({data:e})=>{if(!e)return null;let t=(e.limitUnit||`GB`).toUpperCase(),n=t===`GB`?1024**3:t===`MB`?1024**2:1024,r=Number(e.usagePercent)||0,i=Math.min(100,Math.max(0,r)),a=e.limitValue?parseFloat(e.limitValue):e.totalBytes/n,o=a*r/100;a-o;let s=e.exceeded||r>=100,c=1024**2,l=1024**3,u=1024**4,d=(e=>{let t=Number(e)||0;return t>=u?{val:(t/u).toFixed(2),unit:`TB`}:t>=l?{val:(t/l).toFixed(2),unit:`GB`}:t>=c?{val:(t/c).toFixed(2),unit:`MB`}:{val:(t/1024).toFixed(2),unit:`KB`}})(e.usedBytes);return(0,$.jsxs)(`div`,{style:{marginBottom:12,padding:`0 12px`,paddingTop:6,borderRadius:10,background:`linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)`,boxShadow:`0 2px 12px rgba(0, 0, 0, 0.04)`},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:6,fontSize:12,color:`#475569`},children:e.enabled?(0,$.jsx)($.Fragment,{}):(0,$.jsxs)(`span`,{style:{fontWeight:500,color:`#1e293b`},children:[(0,$.jsx)(S4,{style:{fontSize:12,color:s?`#ef4444`:`#6366f1`,marginRight:4}}),`当前使用 `,d.val,` `,d.unit]})}),e.enabled&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{marginTop:4,display:`flex`,justifyContent:`space-between`,fontSize:11,color:s?`#ef4444`:`#94a3b8`},children:(0,$.jsxs)(`div`,{style:{height:`100%`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:6,fontSize:12,color:`#000000ff`,padding:`0 8px`},children:[(0,$.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(S4,{style:{fontSize:12,color:`#000000ff`}}),r.toFixed(1),`%`]}),e.enabled?(0,$.jsxs)(`span`,{style:{fontWeight:500,color:`#000000ff`},children:[o.toFixed(2),` / `,a.toFixed(2),` `,t]}):(0,$.jsxs)(`span`,{style:{fontWeight:500,color:`#1e293b`},children:[`当前使用 `,d.val,` `,d.unit]})]})}),(0,$.jsx)(`div`,{style:{width:`100%`,height:6,background:`#e2e8f0`,borderRadius:50,overflow:`hidden`,position:`relative`},children:(0,$.jsx)(`div`,{style:{width:`${i}%`,height:`100%`,background:r<50?`linear-gradient(90deg, #279951, #b7fad0)`:r<85?`linear-gradient(90deg, #ffd759, #fff6d4)`:`linear-gradient(90deg, #ef4444, #dc2626)`,borderRadius:2,transition:`width 0.4s ease`}})})]})]})},i7={HomeOutlined:(0,$.jsx)(y3,{}),DashboardOutlined:(0,$.jsx)(y4,{}),CodeOutlined:(0,$.jsx)(t4,{}),PlayCircleOutlined:(0,$.jsx)(K6,{}),WalletOutlined:(0,$.jsx)(V8,{}),SettingOutlined:(0,$.jsx)(l8,{}),BellOutlined:(0,$.jsx)(g2,{}),UserOutlined:(0,$.jsx)(L8,{}),AppstoreOutlined:(0,$.jsx)(V0,{}),FileTextOutlined:(0,$.jsx)(kV,{}),StarOutlined:(0,$.jsx)(x8,{}),HeartOutlined:(0,$.jsx)(u3,{}),CameraOutlined:(0,$.jsx)(j2,{}),RobotOutlined:(0,$.jsx)($6,{}),CalculatorOutlined:(0,$.jsx)(O2,{}),DollarOutlined:(0,$.jsx)(T4,{}),GiftOutlined:(0,$.jsx)(i3,{}),ThunderboltOutlined:(0,$.jsx)(D8,{}),FireOutlined:(0,$.jsx)(B4,{}),CloudOutlined:(0,$.jsx)(K2,{}),SmileOutlined:(0,$.jsx)(g8,{}),TrophyOutlined:(0,$.jsx)(j8,{}),RocketOutlined:(0,$.jsx)(t8,{}),BulbOutlined:(0,$.jsx)(T2,{}),PictureOutlined:(0,$.jsx)(L6,{}),VideoCameraOutlined:(0,$.jsx)(z8,{}),AudioOutlined:(0,$.jsx)(n2,{}),MailOutlined:(0,$.jsx)(Q3,{}),PhoneOutlined:(0,$.jsx)(j6,{}),GlobalOutlined:(0,$.jsx)(s3,{}),ShoppingCartOutlined:(0,$.jsx)(d8,{}),TeamOutlined:(0,$.jsx)(T8,{}),BarChartOutlined:(0,$.jsx)(p2,{}),PieChartOutlined:(0,$.jsx)(B6,{}),LineChartOutlined:(0,$.jsx)(B3,{}),SecurityScanOutlined:(0,$.jsx)(kie,{}),ApiOutlined:(0,$.jsx)(R0,{}),DatabaseOutlined:(0,$.jsx)(S4,{}),CloudServerOutlined:(0,$.jsx)(Y2,{})},Sse=240,a7=[{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(YK,{})},{gradient:`linear-gradient(135deg, #4a5568, #2d3748)`,shadow:`rgba(74,85,104,0.25)`,icon:(0,$.jsx)(L4,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(p4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(s2,{})}],o7=[{gradient:`linear-gradient(135deg, #94a3b8, #64748b)`,shadow:`rgba(148,163,184,0.25)`,icon:(0,$.jsx)(YK,{})},{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(YK,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(p4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(s2,{})}],s7=[`每日赠送积分 当日清零`,`可充值更多积分`,`基础加速通道`,`作品去除水印`,`可使用网页版和APP上全部AI功能`,`高分辨率`,`批量创作 更多同时生成任务`],c7=[{tier:`基础会员`,desc:`开启创作之旅`,monthlyPrice:79,monthlyCredits:1e3,onlyMonthly:!0,features:s7.map(e=>e.replace(`基础加速通道`,`基础加速通道`)),speedLabel:`基础加速通道`},{tier:`标准会员`,desc:`畅享基础创作权益`,monthlyPrice:154,monthlyCredits:2e3,quarterlyPrice:1029,quarterlyCredits:5e3,yearlyPrice:7308,yearlyCredits:1e4,features:s7,speedLabel:`标准加速通道`},{tier:`高级会员`,desc:`解锁高级创作权益`,monthlyPrice:221,monthlyCredits:3e3,quarterlyPrice:1197,quarterlyCredits:6e3,yearlyPrice:10710,yearlyCredits:15e3,features:s7,speedLabel:`高级加速通道`},{tier:`超级会员`,desc:`释放无限创作生产力`,monthlyPrice:280,monthlyCredits:4e3,quarterlyPrice:1367,quarterlyCredits:7e3,yearlyPrice:13440,yearlyCredits:2e4,features:s7,speedLabel:`高级加速通道`,hot:!0}],Cse=()=>{let e=Ye(),t=Ke(),{user:n,logout:r,refreshUser:i,setOptimizeHoldCredits:a}=e7(),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(!1),[f]=vH.useForm(),[p]=vH.useForm(),[m,h]=(0,S.useState)(null),[g,_]=(0,S.useState)([]),[v,y]=(0,S.useState)([]),[b,x]=(0,S.useState)(!1),[C,w]=(0,S.useState)(null),[T,E]=(0,S.useState)(`monthly`),[D,O]=(0,S.useState)(0),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(!1),[N]=vH.useForm(),[P,F]=(0,S.useState)(!1),[I,L]=(0,S.useState)(()=>({x:24,y:window.innerHeight*.75})),[R,z]=(0,S.useState)(!1),B=(0,S.useRef)(!1),V=(0,S.useRef)({x:0,y:0}),[H,U]=(0,S.useState)({}),[W,G]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteName||``;return t&&(document.title=t),t}),[K,ee]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteLogo||``;if(t){let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=t,e.type=`image/png`}return t}),[te,ne]=(0,S.useState)(!localStorage.getItem(`siteInfo`)),[re,ie]=(0,S.useState)(!1),[ae,q]=(0,S.useState)(null),[oe,se]=(0,S.useState)(`alipay`),[ce,le]=(0,S.useState)(!1),[ue,de]=(0,S.useState)(180),fe=(0,S.useRef)(null),pe=(0,S.useRef)(null),me=(0,S.useRef)(null),[he,ge]=(0,S.useState)({alipay:!1,wechat:!1}),[_e,ve]=(0,S.useState)(!1),[ye,be]=(0,S.useState)(null),[xe,Se]=(0,S.useState)(!1),[Ce,we]=(0,S.useState)(``),Te=`pending_payment_order`;(0,S.useEffect)(()=>{h5().then(e=>{let t=e.siteName||`智创`,n=e.siteLogo||``;if(t!==W&&(G(t),document.title=t),n&&n!==K){ee(n);let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e));let t=n.startsWith(`http`)||n.startsWith(`data:`)?n:`https://ceshi.apiforeign.minzhongzc.com${n.startsWith(`/`)?``:`/`}${n}`;e.href=t,e.type=`image/png`}e.operationManual&&we(e.operationManual),e.optimizeHoldCredits!==void 0&&a(e.optimizeHoldCredits),localStorage.setItem(`siteInfo`,JSON.stringify({siteName:t,siteLogo:n}))}).catch(e=>{}),a5().then(e=>{let t=e?.resourceCapacity;t&&be({enabled:!!t.enabled,usedBytes:Number(t.usedBytes)||0,totalBytes:Number(t.totalBytes)||0,availableBytes:Number(t.availableBytes)||0,usagePercent:Number(t.usagePercent)||0,exceeded:!!t.exceeded,limitValue:t.limitValue??``,limitUnit:t.limitUnit||`GB`})}).catch(e=>{})},[]),(0,S.useEffect)(()=>{let e=()=>Se(window.innerWidth<=767);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let Ee=e=>{e.button===0&&(z(!0),B.current=!1,V.current={x:e.clientX,y:e.clientY})},De=e=>{if(!R)return;let t=Math.abs(e.clientX-V.current.x),n=Math.abs(e.clientY-V.current.y);(t>5||n>5)&&(B.current=!0);let r=Math.max(60,Math.min(window.innerHeight-60,e.clientY-(V.current.y-I.y)));L(e=>({x:e.x,y:r}))},Oe=()=>{let e=B.current;z(!1),B.current=!1,e||d(!0)};(0,S.useEffect)(()=>{if(R)return document.addEventListener(`mousemove`,De),document.addEventListener(`mouseup`,Oe),()=>{document.removeEventListener(`mousemove`,De),document.removeEventListener(`mouseup`,Oe)}},[R]);let ke=()=>{v5().then(e=>{O(e)}).catch(()=>{})};(0,S.useEffect)(()=>{(async()=>{let e=localStorage.getItem(Te);if(e)try{let t=JSON.parse(e),n=await C5(t.orderNo);if(n.status===`pending`){q({price:t.price,credits:t.credits,qrCode:t.qrCode,method:t.method}),me.current=t.orderNo;let e=Date.now(),n=new Date(t.createdAt).getTime(),r=t.timeoutSeconds||180,i=Math.floor((e-n)/1e3),a=Math.max(0,r-i);a>0?(ie(!0),He(t.orderNo,a)):localStorage.removeItem(Te)}else n.status===`paid`?(Z.success(`支付成功!积分已到账`),e7.getState().refreshUser(),localStorage.removeItem(Te)):localStorage.removeItem(Te)}catch{localStorage.removeItem(Te)}})()},[]),(0,S.useEffect)(()=>{Gae().then(e=>{_(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),Kae().then(e=>{y(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),qae().then(e=>{ge(e),e.alipay?se(`alipay`):e.wechat&&se(`wechat`)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{n&&ke()},[n?.id,n?.credits]);let Ae=t.pathname.startsWith(`/records`)?`/records`:t.pathname,je=Sse,Me={};g.forEach(e=>{let t=e.parent_id??e.parentId;t&&(Me[t]||(Me[t]=[]),Me[t].push(e))});let Ne=g.filter(e=>!(e.parent_id??e.parentId));Ne.sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0)),Object.keys(Me).forEach(e=>{Me[e].sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0))});let Pe=t=>{let n=t.menu_type??t.menuType,r=Me[t.id]&&Me[t.id].length>0;n===`group`||r?U(e=>({...e,[t.id]:!e[t.id]})):t.path&&(e(t.path),A(!1))},Fe=[{key:`profile`,icon:(0,$.jsx)(L8,{}),label:`账号: ${n?.username}`,disabled:!0},{key:`credits`,icon:(0,$.jsx)(V8,{style:{color:`#c9a96e`}}),label:`积分: ${n?.credits??0}`,disabled:!0},{type:`divider`},...n?.isTeamManager?[{key:`teamManagement`,icon:(0,$.jsx)(T8,{style:{color:`#6366f1`}}),label:`团队管理`}]:[],{key:`myCredits`,icon:(0,$.jsx)(V8,{}),label:`积分明细`},{key:`orderRecords`,icon:(0,$.jsx)(kV,{}),label:`订单记录`},{key:`invoice`,icon:(0,$.jsx)(hie,{}),label:`申请开票`},{key:`messages`,icon:(0,$.jsx)(g2,{}),label:`消息中心${D>0?`(${D})`:``}`},...Ce?[{key:`manual`,icon:(0,$.jsx)(kV,{}),label:`操作手册`}]:[],{type:`divider`},{key:`changePwd`,icon:(0,$.jsx)(U3,{}),label:`个人信息`},{type:`divider`},{key:`logout`,icon:(0,$.jsx)(Y3,{}),label:`退出登录`,danger:!0}],Ie=({key:t})=>{t===`logout`?(r(),e(`/login`)):t===`changePwd`?s(!0):t===`messages`?e(`/messages`):t===`recharge`?l(!0):t===`teamManagement`?e(`/team-management`):t===`myCredits`?e(`/user-center?tab=credits`):t===`orderRecords`?e(`/user-center?tab=orders`):t===`invoice`?e(`/invoice`):t===`manual`&&window.open(Ce,`_blank`)},Le=async()=>{try{let e=await f.validateFields();await o5(e.oldPwd,e.newPwd),Z.success(`密码修改成功`),s(!1),f.resetFields()}catch(e){e?.response?.data?.detail?Z.error(e.response.data.detail):e?.message&&Z.error(e.message)}},Re=async()=>{try{let e=await Dae((await p.validateFields()).username);Z.success(e.message||`操作成功`),await i(),a5().then(e=>{let t=e?.resourceCapacity;t&&be({enabled:!!t.enabled,usedBytes:Number(t.usedBytes)||0,totalBytes:Number(t.totalBytes)||0,availableBytes:Number(t.availableBytes)||0,usagePercent:Number(t.usagePercent)||0,exceeded:!!t.exceeded,limitValue:t.limitValue??``,limitUnit:t.limitUnit||`GB`})}).catch(()=>{}),s(!1),p.resetFields()}catch(e){e?.response?.data?.message?Z.error(e.response.data.message):e?.response?.data?.detail?Z.error(e.response.data.detail):e?.message&&Z.error(e.message)}},ze=()=>{r(),e(`/login`)},Be=async()=>{if(!n){Z.warning(`请先登录`);return}try{let e=await N.validateFields();F(!0),await zoe({phone:e.phone,company_name:e.companyName,industry:e.industry,name:e.name,message:e.message}),Z.success(`提交成功,我们会尽快与您联系`),d(!1),N.resetFields()}catch(e){Z.error(e?.message||`提交失败`)}finally{F(!1)}},Ve=(0,S.useCallback)(()=>{fe.current&&=(clearInterval(fe.current),null),pe.current&&=(clearInterval(pe.current),null)},[]),He=(0,S.useCallback)((e,t=180)=>{Ve(),de(t),fe.current=setInterval(async()=>{try{let t=await C5(e);t.status===`paid`?(Ve(),me.current=null,localStorage.removeItem(Te),Z.success(`支付成功!积分已到账`),e7.getState().refreshUser(),ie(!1),q(null),h(null)):t.status===`cancelled`&&(Ve(),me.current=null,localStorage.removeItem(Te))}catch{}},2e3),pe.current=setInterval(()=>{de(e=>e<=1?(Ve(),me.current&&=(w5(me.current).catch(()=>{}),null),localStorage.removeItem(Te),Z.warning(`订单已超时,请重新充值`),ie(!1),q(null),h(null),0):e-1)},1e3)},[Ve]),Ue=(t,n=0)=>{let r=t.path===Ae,i=i7[t.icon]||(0,$.jsx)(y3,{}),a=Me[t.id]&&Me[t.id].length>0,o=(t.menu_type??t.menuType)===`group`;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{onClick:()=>{!(o||a)&&t.path&&e(t.path)},style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:10,padding:n>0?`6px 12px 6px 32px`:`6px 14px`,borderRadius:12,margin:`1px 4px`,cursor:o||a?`default`:`pointer`,fontSize:n>0?13:14,fontWeight:r?600:400,color:r?`#4f46e5`:o?`#94a3b8`:`#475569`,background:r?`linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%)`:`transparent`,transition:`all 0.2s ease`},onMouseEnter:e=>{!o&&!r&&!(o||a)&&(e.currentTarget.style.background=`rgba(99, 102, 241, 0.05)`)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:[!o&&(0,$.jsx)(`span`,{style:{fontSize:n>0?14:16,flexShrink:0,color:r?`#6366f1`:`#64748b`},children:i}),(0,$.jsx)(`span`,{style:{whiteSpace:`nowrap`,flex:1,textAlign:`left`,fontWeight:o||r?600:400,fontSize:o?12:n>0?13:14,textTransform:o?`uppercase`:`none`,letterSpacing:o?.5:0},children:t.label})]}),(o||a)&&(0,$.jsx)(`div`,{style:{overflow:`hidden`},children:(Me[t.id]||[]).map(e=>Ue(e,n+1))})]},t.id)};return(0,$.jsxs)(cW,{style:{minHeight:`100vh`},children:[(0,$.jsx)(xse,{onVisibilityChange:e=>ve(e)}),(0,$.jsxs)(`div`,{style:{display:`flex`,position:`relative`,padding:4,gap:12,minHeight:`calc(100vh - 8px)`},children:[(0,$.jsxs)(`div`,{className:`desktop-sidebar`,style:{width:je,position:`sticky`,top:4,alignSelf:`flex-start`,zIndex:100,height:`calc(100vh - 8px)`,background:`linear-gradient(180deg, #ffffff 0%, #f8fafc 100%)`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,display:`flex`,flexDirection:`column`,transition:`width 0.25s ease`,overflow:`hidden`,border:`1px solid rgba(0, 0, 0, 0.06)`},children:[(0,$.jsx)(`div`,{style:{height:80,display:`flex`,alignItems:`center`,justifyContent:`flex-start`,padding:`0 20px`,flexShrink:0,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,cursor:`pointer`},onClick:()=>{e(`/home`)},children:[(0,$.jsx)(`div`,{style:{width:42,height:42,borderRadius:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.35)`,overflow:`hidden`},children:K?(0,$.jsx)(`img`,{src:K,alt:`logo`,style:{width:36,height:36,objectFit:`contain`}}):(0,$.jsx)(D8,{style:{fontSize:20,color:`#ffffff`}})}),(0,$.jsx)(`span`,{style:{color:`#1e293b`,fontSize:17,fontWeight:700,letterSpacing:-.02,whiteSpace:`nowrap`,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:W})]})}),(0,$.jsx)(`div`,{style:{flex:1,padding:`8px 8px`,overflow:`auto`},children:Ne.map(e=>Ue(e))}),(0,$.jsxs)(`div`,{onClick:()=>l(!0),style:{margin:`8px 12px`,padding:`12px 20px`,borderRadius:14,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:8,color:`#ffffff`,fontSize:14,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.4)`,transition:`all 0.3s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%)`,e.currentTarget.style.transform=`translateY(-1px)`,e.currentTarget.style.boxShadow=`0 6px 20px rgba(99, 102, 241, 0.5)`},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,e.currentTarget.style.transform=`translateY(0)`,e.currentTarget.style.boxShadow=`0 4px 16px rgba(99, 102, 241, 0.4)`},children:[(0,$.jsx)(jI,{style:{fontSize:16}}),(0,$.jsx)(`span`,{children:`充值积分`})]}),(0,$.jsx)(r7,{data:ye}),(0,$.jsx)(`div`,{style:{padding:`16px 16px`,flexShrink:0,paddingTop:0},children:(0,$.jsx)(EV,{menu:{items:Fe,onClick:Ie},placement:`topRight`,arrow:!0,children:(0,$.jsxs)(`div`,{className:`user-card-container`,style:{padding:`10px 14px`,display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:12,borderRadius:14,cursor:`pointer`,transition:`all 0.35s cubic-bezier(0.4,0,0.2,1)`,background:`linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%)`,boxShadow:`0 2px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255,255,255,0.8)`,position:`relative`,border:`1px solid rgba(99, 102, 241, 0.15)`,animation:`cardBreath 3s ease-in-out infinite`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #ffffff 0%, #f8fafc 100%)`,e.currentTarget.style.boxShadow=`0 8px 24px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255,255,255,0.9)`,e.currentTarget.style.transform=`translateY(-3px) scale(1.01)`,e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.4)`,e.currentTarget.style.animation=`none`,e.currentTarget.querySelector(`.user-card-arrow`)?.classList.add(`arrow-hover`)},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%)`,e.currentTarget.style.boxShadow=`0 2px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255,255,255,0.8)`,e.currentTarget.style.transform=`translateY(0) scale(1)`,e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.15)`,e.currentTarget.style.animation=`cardBreath 3s ease-in-out infinite`,e.currentTarget.querySelector(`.user-card-arrow`)?.classList.remove(`arrow-hover`)},children:[(0,$.jsx)(`div`,{className:`user-card-glow`,style:{position:`absolute`,inset:-4,borderRadius:18,background:`linear-gradient(90deg, transparent 0%, rgba(99,102,241,0.15) 25%, rgba(139,92,246,0.15) 50%, rgba(99,102,241,0.15) 75%, transparent 100%)`,backgroundSize:`200% 100%`,opacity:.8,animation:`borderShimmer 2.5s linear infinite`,pointerEvents:`none`}}),(0,$.jsx)(Bw,{size:36,icon:(0,$.jsx)(L8,{}),style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`,transition:`all 0.35s cubic-bezier(0.4,0,0.2,1)`,position:`relative`,zIndex:1,animation:`avatarPulse 2s ease-in-out infinite`}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0,position:`relative`,zIndex:1},children:[(0,$.jsx)(`div`,{style:{color:`#1e293b`,fontSize:16,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,letterSpacing:-.01},children:n?.username}),(0,$.jsxs)(`div`,{style:{color:`#6366f1`,fontSize:16,fontWeight:500,letterSpacing:0,borderRadius:6,display:`inline-block`,animation:`creditGlow 1.5s ease-in-out infinite`},children:[`积分: `,n?.credits||0]})]}),(0,$.jsx)(`div`,{className:`user-card-arrow`,style:{fontSize:12,color:`#6366f1`,flexShrink:0,position:`relative`,zIndex:1},children:(0,$.jsx)(i6,{})}),(0,$.jsx)(`style`,{children:` + `})]})},n7=`dismissed_activity_banner_version`,xse=({onVisibilityChange:e})=>{let[t,n]=(0,S.useState)(``),[r,i]=(0,S.useState)(0),[a,o]=(0,S.useState)(!0);return(0,S.useEffect)(()=>{h5().then(t=>{let r=t.siteBanner||``,a=t.siteBannerVersion||0;if(i(a),r){let t=Number(localStorage.getItem(n7)||0){o(!0),e?.(!1)})},[]),a||!t?null:(0,$.jsx)(`div`,{style:{width:`100%`,position:`relative`,background:`linear-gradient(135deg, #f3e8ff 0%, #ede9fe 50%, #e0e7ff 100%)`,borderBottom:`1px solid rgba(139, 92, 246, 0.15)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`8px 40px 8px 16px`,maxWidth:1400,margin:`0 auto`,width:`100%`,boxSizing:`border-box`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:8,background:`rgba(139, 92, 246, 0.12)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(g6,{style:{color:`#7c3aed`,fontSize:14}})}),(0,$.jsx)(`div`,{style:{color:`#5b21b6`,fontSize:14,fontWeight:500,lineHeight:1.5,textAlign:`center`},dangerouslySetInnerHTML:{__html:t}})]}),(0,$.jsx)(`button`,{onClick:()=>{localStorage.setItem(n7,String(r)),o(!0),e?.(!1)},style:{position:`absolute`,right:8,top:`50%`,transform:`translateY(-50%)`,width:26,height:26,borderRadius:`50%`,background:`rgba(139, 92, 246, 0.1)`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,transition:`all 0.2s ease`,outline:`none`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.2)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.1)`},children:(0,$.jsx)(ju,{style:{color:`#7c3aed`,fontSize:11}})})]})})},r7=({data:e})=>{if(!e)return null;let t=(e.limitUnit||`GB`).toUpperCase(),n=t===`GB`?1024**3:t===`MB`?1024**2:1024,r=Number(e.usagePercent)||0,i=Math.min(100,Math.max(0,r)),a=e.limitValue?parseFloat(e.limitValue):e.totalBytes/n,o=a*r/100;a-o;let s=e.exceeded||r>=100,c=1024**2,l=1024**3,u=1024**4,d=(e=>{let t=Number(e)||0;return t>=u?{val:(t/u).toFixed(2),unit:`TB`}:t>=l?{val:(t/l).toFixed(2),unit:`GB`}:t>=c?{val:(t/c).toFixed(2),unit:`MB`}:{val:(t/1024).toFixed(2),unit:`KB`}})(e.usedBytes);return(0,$.jsxs)(`div`,{style:{marginBottom:12,padding:`0 12px`,paddingTop:6,borderRadius:10,background:`linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)`,boxShadow:`0 2px 12px rgba(0, 0, 0, 0.04)`},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:6,fontSize:12,color:`#475569`},children:e.enabled?(0,$.jsx)($.Fragment,{}):(0,$.jsxs)(`span`,{style:{fontWeight:500,color:`#1e293b`},children:[(0,$.jsx)(S4,{style:{fontSize:12,color:s?`#ef4444`:`#6366f1`,marginRight:4}}),`当前使用 `,d.val,` `,d.unit]})}),e.enabled&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{marginTop:4,display:`flex`,justifyContent:`space-between`,fontSize:11,color:s?`#ef4444`:`#94a3b8`},children:(0,$.jsxs)(`div`,{style:{height:`100%`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:6,fontSize:12,color:`#000000ff`,padding:`0 8px`},children:[(0,$.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(S4,{style:{fontSize:12,color:`#000000ff`}}),r.toFixed(1),`%`]}),e.enabled?(0,$.jsxs)(`span`,{style:{fontWeight:500,color:`#000000ff`},children:[o.toFixed(2),` / `,a.toFixed(2),` `,t]}):(0,$.jsxs)(`span`,{style:{fontWeight:500,color:`#1e293b`},children:[`当前使用 `,d.val,` `,d.unit]})]})}),(0,$.jsx)(`div`,{style:{width:`100%`,height:6,background:`#e2e8f0`,borderRadius:50,overflow:`hidden`,position:`relative`},children:(0,$.jsx)(`div`,{style:{width:`${i}%`,height:`100%`,background:r<50?`linear-gradient(90deg, #279951, #b7fad0)`:r<85?`linear-gradient(90deg, #ffd759, #fff6d4)`:`linear-gradient(90deg, #ef4444, #dc2626)`,borderRadius:2,transition:`width 0.4s ease`}})})]})]})},i7={HomeOutlined:(0,$.jsx)(y3,{}),DashboardOutlined:(0,$.jsx)(y4,{}),CodeOutlined:(0,$.jsx)(t4,{}),PlayCircleOutlined:(0,$.jsx)(K6,{}),WalletOutlined:(0,$.jsx)(V8,{}),SettingOutlined:(0,$.jsx)(l8,{}),BellOutlined:(0,$.jsx)(g2,{}),UserOutlined:(0,$.jsx)(L8,{}),AppstoreOutlined:(0,$.jsx)(V0,{}),FileTextOutlined:(0,$.jsx)(kV,{}),StarOutlined:(0,$.jsx)(x8,{}),HeartOutlined:(0,$.jsx)(u3,{}),CameraOutlined:(0,$.jsx)(j2,{}),RobotOutlined:(0,$.jsx)($6,{}),CalculatorOutlined:(0,$.jsx)(O2,{}),DollarOutlined:(0,$.jsx)(T4,{}),GiftOutlined:(0,$.jsx)(i3,{}),ThunderboltOutlined:(0,$.jsx)(D8,{}),FireOutlined:(0,$.jsx)(B4,{}),CloudOutlined:(0,$.jsx)(K2,{}),SmileOutlined:(0,$.jsx)(g8,{}),TrophyOutlined:(0,$.jsx)(j8,{}),RocketOutlined:(0,$.jsx)(t8,{}),BulbOutlined:(0,$.jsx)(T2,{}),PictureOutlined:(0,$.jsx)(L6,{}),VideoCameraOutlined:(0,$.jsx)(z8,{}),AudioOutlined:(0,$.jsx)(n2,{}),MailOutlined:(0,$.jsx)(Q3,{}),PhoneOutlined:(0,$.jsx)(j6,{}),GlobalOutlined:(0,$.jsx)(s3,{}),ShoppingCartOutlined:(0,$.jsx)(d8,{}),TeamOutlined:(0,$.jsx)(T8,{}),BarChartOutlined:(0,$.jsx)(p2,{}),PieChartOutlined:(0,$.jsx)(B6,{}),LineChartOutlined:(0,$.jsx)(B3,{}),SecurityScanOutlined:(0,$.jsx)(kie,{}),ApiOutlined:(0,$.jsx)(R0,{}),DatabaseOutlined:(0,$.jsx)(S4,{}),CloudServerOutlined:(0,$.jsx)(Y2,{})},Sse=240,a7=[{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(YK,{})},{gradient:`linear-gradient(135deg, #4a5568, #2d3748)`,shadow:`rgba(74,85,104,0.25)`,icon:(0,$.jsx)(L4,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(p4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(s2,{})}],o7=[{gradient:`linear-gradient(135deg, #94a3b8, #64748b)`,shadow:`rgba(148,163,184,0.25)`,icon:(0,$.jsx)(YK,{})},{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(YK,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(p4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(s2,{})}],s7=[`每日赠送积分 当日清零`,`可充值更多积分`,`基础加速通道`,`作品去除水印`,`可使用网页版和APP上全部AI功能`,`高分辨率`,`批量创作 更多同时生成任务`],c7=[{tier:`基础会员`,desc:`开启创作之旅`,monthlyPrice:79,monthlyCredits:1e3,onlyMonthly:!0,features:s7.map(e=>e.replace(`基础加速通道`,`基础加速通道`)),speedLabel:`基础加速通道`},{tier:`标准会员`,desc:`畅享基础创作权益`,monthlyPrice:154,monthlyCredits:2e3,quarterlyPrice:1029,quarterlyCredits:5e3,yearlyPrice:7308,yearlyCredits:1e4,features:s7,speedLabel:`标准加速通道`},{tier:`高级会员`,desc:`解锁高级创作权益`,monthlyPrice:221,monthlyCredits:3e3,quarterlyPrice:1197,quarterlyCredits:6e3,yearlyPrice:10710,yearlyCredits:15e3,features:s7,speedLabel:`高级加速通道`},{tier:`超级会员`,desc:`释放无限创作生产力`,monthlyPrice:280,monthlyCredits:4e3,quarterlyPrice:1367,quarterlyCredits:7e3,yearlyPrice:13440,yearlyCredits:2e4,features:s7,speedLabel:`高级加速通道`,hot:!0}],Cse=()=>{let e=Ye(),t=Ke(),{user:n,logout:r,refreshUser:i,setOptimizeHoldCredits:a}=e7(),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(!1),[f]=vH.useForm(),[p]=vH.useForm(),[m,h]=(0,S.useState)(null),[g,_]=(0,S.useState)([]),[v,y]=(0,S.useState)([]),[b,x]=(0,S.useState)(!1),[C,w]=(0,S.useState)(null),[T,E]=(0,S.useState)(`monthly`),[D,O]=(0,S.useState)(0),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(!1),[N]=vH.useForm(),[P,F]=(0,S.useState)(!1),[I,L]=(0,S.useState)(()=>({x:24,y:window.innerHeight*.75})),[R,z]=(0,S.useState)(!1),B=(0,S.useRef)(!1),V=(0,S.useRef)({x:0,y:0}),[H,U]=(0,S.useState)({}),[W,G]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteName||``;return t&&(document.title=t),t}),[K,ee]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteLogo||``;if(t){let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=t,e.type=`image/png`}return t}),[te,ne]=(0,S.useState)(!localStorage.getItem(`siteInfo`)),[re,ie]=(0,S.useState)(!1),[ae,q]=(0,S.useState)(null),[oe,se]=(0,S.useState)(`alipay`),[ce,le]=(0,S.useState)(!1),[ue,de]=(0,S.useState)(180),fe=(0,S.useRef)(null),pe=(0,S.useRef)(null),me=(0,S.useRef)(null),[he,ge]=(0,S.useState)({alipay:!1,wechat:!1}),[_e,ve]=(0,S.useState)(!1),[ye,be]=(0,S.useState)(null),[xe,Se]=(0,S.useState)(!1),[Ce,we]=(0,S.useState)(``),Te=`pending_payment_order`;(0,S.useEffect)(()=>{h5().then(e=>{let t=e.siteName||`智创`,n=e.siteLogo||``;if(t!==W&&(G(t),document.title=t),n&&n!==K){ee(n);let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e));let t=n.startsWith(`http`)||n.startsWith(`data:`)?n:`https://ceshi.apiforeign.minzhongzc.com${n.startsWith(`/`)?``:`/`}${n}`;e.href=t,e.type=`image/png`}e.operationManual&&we(e.operationManual),e.optimizeHoldCredits!==void 0&&a(e.optimizeHoldCredits),localStorage.setItem(`siteInfo`,JSON.stringify({siteName:t,siteLogo:n}))}).catch(e=>{}),a5().then(e=>{let t=e?.resourceCapacity;t&&be({enabled:!!t.enabled,usedBytes:Number(t.usedBytes)||0,totalBytes:Number(t.totalBytes)||0,availableBytes:Number(t.availableBytes)||0,usagePercent:Number(t.usagePercent)||0,exceeded:!!t.exceeded,limitValue:t.limitValue??``,limitUnit:t.limitUnit||`GB`})}).catch(e=>{})},[]),(0,S.useEffect)(()=>{let e=()=>Se(window.innerWidth<=767);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let Ee=e=>{e.button===0&&(z(!0),B.current=!1,V.current={x:e.clientX,y:e.clientY})},De=e=>{if(!R)return;let t=Math.abs(e.clientX-V.current.x),n=Math.abs(e.clientY-V.current.y);(t>5||n>5)&&(B.current=!0);let r=Math.max(60,Math.min(window.innerHeight-60,e.clientY-(V.current.y-I.y)));L(e=>({x:e.x,y:r}))},Oe=()=>{let e=B.current;z(!1),B.current=!1,e||d(!0)};(0,S.useEffect)(()=>{if(R)return document.addEventListener(`mousemove`,De),document.addEventListener(`mouseup`,Oe),()=>{document.removeEventListener(`mousemove`,De),document.removeEventListener(`mouseup`,Oe)}},[R]);let ke=()=>{v5().then(e=>{O(e)}).catch(()=>{})};(0,S.useEffect)(()=>{(async()=>{let e=localStorage.getItem(Te);if(e)try{let t=JSON.parse(e),n=await C5(t.orderNo);if(n.status===`pending`){q({price:t.price,credits:t.credits,qrCode:t.qrCode,method:t.method}),me.current=t.orderNo;let e=Date.now(),n=new Date(t.createdAt).getTime(),r=t.timeoutSeconds||180,i=Math.floor((e-n)/1e3),a=Math.max(0,r-i);a>0?(ie(!0),He(t.orderNo,a)):localStorage.removeItem(Te)}else n.status===`paid`?(Z.success(`支付成功!积分已到账`),e7.getState().refreshUser(),localStorage.removeItem(Te)):localStorage.removeItem(Te)}catch{localStorage.removeItem(Te)}})()},[]),(0,S.useEffect)(()=>{Gae().then(e=>{_(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),Kae().then(e=>{y(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),qae().then(e=>{ge(e),e.alipay?se(`alipay`):e.wechat&&se(`wechat`)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{n&&ke()},[n?.id,n?.credits]);let Ae=t.pathname.startsWith(`/records`)?`/records`:t.pathname,je=Sse,Me={};g.forEach(e=>{let t=e.parent_id??e.parentId;t&&(Me[t]||(Me[t]=[]),Me[t].push(e))});let Ne=g.filter(e=>!(e.parent_id??e.parentId));Ne.sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0)),Object.keys(Me).forEach(e=>{Me[e].sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0))});let Pe=t=>{let n=t.menu_type??t.menuType,r=Me[t.id]&&Me[t.id].length>0;n===`group`||r?U(e=>({...e,[t.id]:!e[t.id]})):t.path&&(e(t.path),A(!1))},Fe=[{key:`profile`,icon:(0,$.jsx)(L8,{}),label:`账号: ${n?.username}`,disabled:!0},{key:`credits`,icon:(0,$.jsx)(V8,{style:{color:`#c9a96e`}}),label:`积分: ${n?.credits??0}`,disabled:!0},{type:`divider`},...n?.isTeamManager?[{key:`teamManagement`,icon:(0,$.jsx)(T8,{style:{color:`#6366f1`}}),label:`团队管理`}]:[],{key:`myCredits`,icon:(0,$.jsx)(V8,{}),label:`积分明细`},{key:`orderRecords`,icon:(0,$.jsx)(kV,{}),label:`订单记录`},{key:`invoice`,icon:(0,$.jsx)(hie,{}),label:`申请开票`},{key:`messages`,icon:(0,$.jsx)(g2,{}),label:`消息中心${D>0?`(${D})`:``}`},...Ce?[{key:`manual`,icon:(0,$.jsx)(kV,{}),label:`操作手册`}]:[],{type:`divider`},{key:`changePwd`,icon:(0,$.jsx)(U3,{}),label:`个人信息`},{type:`divider`},{key:`logout`,icon:(0,$.jsx)(Y3,{}),label:`退出登录`,danger:!0}],Ie=({key:t})=>{t===`logout`?(r(),e(`/login`)):t===`changePwd`?s(!0):t===`messages`?e(`/messages`):t===`recharge`?l(!0):t===`teamManagement`?e(`/team-management`):t===`myCredits`?e(`/user-center?tab=credits`):t===`orderRecords`?e(`/user-center?tab=orders`):t===`invoice`?e(`/invoice`):t===`manual`&&window.open(Ce,`_blank`)},Le=async()=>{try{let e=await f.validateFields();await o5(e.oldPwd,e.newPwd),Z.success(`密码修改成功`),s(!1),f.resetFields()}catch(e){e?.response?.data?.detail?Z.error(e.response.data.detail):e?.message&&Z.error(e.message)}},Re=async()=>{try{let e=await Dae((await p.validateFields()).username);Z.success(e.message||`操作成功`),await i(),a5().then(e=>{let t=e?.resourceCapacity;t&&be({enabled:!!t.enabled,usedBytes:Number(t.usedBytes)||0,totalBytes:Number(t.totalBytes)||0,availableBytes:Number(t.availableBytes)||0,usagePercent:Number(t.usagePercent)||0,exceeded:!!t.exceeded,limitValue:t.limitValue??``,limitUnit:t.limitUnit||`GB`})}).catch(()=>{}),s(!1),p.resetFields()}catch(e){e?.response?.data?.message?Z.error(e.response.data.message):e?.response?.data?.detail?Z.error(e.response.data.detail):e?.message&&Z.error(e.message)}},ze=()=>{r(),e(`/login`)},Be=async()=>{if(!n){Z.warning(`请先登录`);return}try{let e=await N.validateFields();F(!0),await zoe({phone:e.phone,company_name:e.companyName,industry:e.industry,name:e.name,message:e.message}),Z.success(`提交成功,我们会尽快与您联系`),d(!1),N.resetFields()}catch(e){Z.error(e?.message||`提交失败`)}finally{F(!1)}},Ve=(0,S.useCallback)(()=>{fe.current&&=(clearInterval(fe.current),null),pe.current&&=(clearInterval(pe.current),null)},[]),He=(0,S.useCallback)((e,t=180)=>{Ve(),de(t),fe.current=setInterval(async()=>{try{let t=await C5(e);t.status===`paid`?(Ve(),me.current=null,localStorage.removeItem(Te),Z.success(`支付成功!积分已到账`),e7.getState().refreshUser(),ie(!1),q(null),h(null)):t.status===`cancelled`&&(Ve(),me.current=null,localStorage.removeItem(Te))}catch{}},2e3),pe.current=setInterval(()=>{de(e=>e<=1?(Ve(),me.current&&=(w5(me.current).catch(()=>{}),null),localStorage.removeItem(Te),Z.warning(`订单已超时,请重新充值`),ie(!1),q(null),h(null),0):e-1)},1e3)},[Ve]),Ue=(t,n=0)=>{let r=t.path===Ae,i=i7[t.icon]||(0,$.jsx)(y3,{}),a=Me[t.id]&&Me[t.id].length>0,o=(t.menu_type??t.menuType)===`group`;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{onClick:()=>{!(o||a)&&t.path&&e(t.path)},style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:10,padding:n>0?`6px 12px 6px 32px`:`6px 14px`,borderRadius:12,margin:`1px 4px`,cursor:o||a?`default`:`pointer`,fontSize:n>0?13:14,fontWeight:r?600:400,color:r?`#4f46e5`:o?`#94a3b8`:`#475569`,background:r?`linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%)`:`transparent`,transition:`all 0.2s ease`},onMouseEnter:e=>{!o&&!r&&!(o||a)&&(e.currentTarget.style.background=`rgba(99, 102, 241, 0.05)`)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:[!o&&(0,$.jsx)(`span`,{style:{fontSize:n>0?14:16,flexShrink:0,color:r?`#6366f1`:`#64748b`},children:i}),(0,$.jsx)(`span`,{style:{whiteSpace:`nowrap`,flex:1,textAlign:`left`,fontWeight:o||r?600:400,fontSize:o?12:n>0?13:14,textTransform:o?`uppercase`:`none`,letterSpacing:o?.5:0},children:t.label})]}),(o||a)&&(0,$.jsx)(`div`,{style:{overflow:`hidden`},children:(Me[t.id]||[]).map(e=>Ue(e,n+1))})]},t.id)};return(0,$.jsxs)(cW,{style:{height:`100vh`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,$.jsx)(xse,{onVisibilityChange:e=>ve(e)}),(0,$.jsxs)(`div`,{style:{display:`flex`,position:`relative`,padding:4,gap:12,flex:1,minHeight:0,overflow:`hidden`},children:[(0,$.jsxs)(`div`,{className:`desktop-sidebar`,style:{width:je,position:`sticky`,top:4,alignSelf:`flex-start`,zIndex:100,height:`100%`,background:`linear-gradient(180deg, #ffffff 0%, #f8fafc 100%)`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,display:`flex`,flexDirection:`column`,transition:`width 0.25s ease`,overflow:`hidden`,border:`1px solid rgba(0, 0, 0, 0.06)`},children:[(0,$.jsx)(`div`,{style:{height:80,display:`flex`,alignItems:`center`,justifyContent:`flex-start`,padding:`0 20px`,flexShrink:0,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,cursor:`pointer`},onClick:()=>{e(`/home`)},children:[(0,$.jsx)(`div`,{style:{width:42,height:42,borderRadius:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.35)`,overflow:`hidden`},children:K?(0,$.jsx)(`img`,{src:K,alt:`logo`,style:{width:36,height:36,objectFit:`contain`}}):(0,$.jsx)(D8,{style:{fontSize:20,color:`#ffffff`}})}),(0,$.jsx)(`span`,{style:{color:`#1e293b`,fontSize:17,fontWeight:700,letterSpacing:-.02,whiteSpace:`nowrap`,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:W})]})}),(0,$.jsx)(`div`,{style:{flex:1,padding:`8px 8px`,overflow:`auto`},children:Ne.map(e=>Ue(e))}),(0,$.jsxs)(`div`,{onClick:()=>l(!0),style:{margin:`8px 12px`,padding:`12px 20px`,borderRadius:14,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:8,color:`#ffffff`,fontSize:14,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.4)`,transition:`all 0.3s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%)`,e.currentTarget.style.transform=`translateY(-1px)`,e.currentTarget.style.boxShadow=`0 6px 20px rgba(99, 102, 241, 0.5)`},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,e.currentTarget.style.transform=`translateY(0)`,e.currentTarget.style.boxShadow=`0 4px 16px rgba(99, 102, 241, 0.4)`},children:[(0,$.jsx)(jI,{style:{fontSize:16}}),(0,$.jsx)(`span`,{children:`充值积分`})]}),(0,$.jsx)(r7,{data:ye}),(0,$.jsx)(`div`,{style:{padding:`16px 16px`,flexShrink:0,paddingTop:0},children:(0,$.jsx)(EV,{menu:{items:Fe,onClick:Ie},placement:`topRight`,arrow:!0,children:(0,$.jsxs)(`div`,{className:`user-card-container`,style:{padding:`10px 14px`,display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:12,borderRadius:14,cursor:`pointer`,transition:`all 0.35s cubic-bezier(0.4,0,0.2,1)`,background:`linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%)`,boxShadow:`0 2px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255,255,255,0.8)`,position:`relative`,border:`1px solid rgba(99, 102, 241, 0.15)`,animation:`cardBreath 3s ease-in-out infinite`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #ffffff 0%, #f8fafc 100%)`,e.currentTarget.style.boxShadow=`0 8px 24px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255,255,255,0.9)`,e.currentTarget.style.transform=`translateY(-3px) scale(1.01)`,e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.4)`,e.currentTarget.style.animation=`none`,e.currentTarget.querySelector(`.user-card-arrow`)?.classList.add(`arrow-hover`)},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%)`,e.currentTarget.style.boxShadow=`0 2px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255,255,255,0.8)`,e.currentTarget.style.transform=`translateY(0) scale(1)`,e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.15)`,e.currentTarget.style.animation=`cardBreath 3s ease-in-out infinite`,e.currentTarget.querySelector(`.user-card-arrow`)?.classList.remove(`arrow-hover`)},children:[(0,$.jsx)(`div`,{className:`user-card-glow`,style:{position:`absolute`,inset:-4,borderRadius:18,background:`linear-gradient(90deg, transparent 0%, rgba(99,102,241,0.15) 25%, rgba(139,92,246,0.15) 50%, rgba(99,102,241,0.15) 75%, transparent 100%)`,backgroundSize:`200% 100%`,opacity:.8,animation:`borderShimmer 2.5s linear infinite`,pointerEvents:`none`}}),(0,$.jsx)(Bw,{size:36,icon:(0,$.jsx)(L8,{}),style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`,transition:`all 0.35s cubic-bezier(0.4,0,0.2,1)`,position:`relative`,zIndex:1,animation:`avatarPulse 2s ease-in-out infinite`}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0,position:`relative`,zIndex:1},children:[(0,$.jsx)(`div`,{style:{color:`#1e293b`,fontSize:16,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,letterSpacing:-.01},children:n?.username}),(0,$.jsxs)(`div`,{style:{color:`#6366f1`,fontSize:16,fontWeight:500,letterSpacing:0,borderRadius:6,display:`inline-block`,animation:`creditGlow 1.5s ease-in-out infinite`},children:[`积分: `,n?.credits||0]})]}),(0,$.jsx)(`div`,{className:`user-card-arrow`,style:{fontSize:12,color:`#6366f1`,flexShrink:0,position:`relative`,zIndex:1},children:(0,$.jsx)(i6,{})}),(0,$.jsx)(`style`,{children:` @keyframes arrowFlash { 0%, 100% { transform: translateY(0) scale(1); @@ -454,7 +454,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho animation: none !important; filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.8)) !important; } - `})]})})})]}),(0,$.jsx)(`div`,{className:`desktop-content`,style:{flex:1,background:`#f1f2f3`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,padding:`24px 32px 32px`,border:`1px solid rgba(0, 0, 0, 0.06)`,overflow:`hidden`},children:!xe&&(0,$.jsx)(wt,{})})]}),(0,$.jsx)(`div`,{className:`mobile-header`,children:(0,$.jsxs)(`div`,{className:`mobile-header-content`,children:[(0,$.jsx)(`div`,{className:`mobile-menu-btn`,onClick:()=>A(!0),children:(0,$.jsx)(i6,{style:{fontSize:20}})}),(0,$.jsx)(`div`,{className:`mobile-header-title`,children:W}),(0,$.jsx)(`div`,{className:`mobile-header-right`,children:(0,$.jsxs)(`div`,{className:`mobile-credits-badge`,onClick:()=>l(!0),children:[(0,$.jsx)(V8,{}),(0,$.jsx)(`span`,{children:n?.credits||0})]})})]})}),(0,$.jsx)(`div`,{className:`mobile-content`,children:xe&&(0,$.jsx)(wt,{})}),(0,$.jsxs)(hV,{title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:36,height:36,borderRadius:10,flexShrink:0,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.35)`},children:K?(0,$.jsx)(`img`,{src:K,alt:`logo`,style:{width:24,height:24,objectFit:`contain`}}):(0,$.jsx)(D8,{style:{fontSize:18,color:`#ffffff`}})}),(0,$.jsx)(`span`,{style:{fontWeight:700,fontSize:16,color:`#1e293b`},children:W})]}),placement:`left`,onClose:()=>A(!1),open:k,size:280,closable:!0,className:`mobile-menu-drawer`,styles:{header:{borderBottom:`1px solid #f1f5f9`,padding:`16px 20px`},body:{padding:`12px 8px`,display:`flex`,flexDirection:`column`}},children:[(0,$.jsxs)(`div`,{style:{flex:1,overflow:`auto`,paddingBottom:12},children:[(0,$.jsx)(`div`,{style:{padding:`12px 8px 16px`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16},children:[(0,$.jsx)(Bw,{size:44,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0},children:(0,$.jsx)(L8,{})}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,$.jsx)(`div`,{style:{fontSize:15,fontWeight:600,color:`#1e293b`,marginBottom:2},children:n?.username||`用户`}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`},children:[(0,$.jsx)(V8,{style:{color:`#f59e0b`,marginRight:4}}),`积分: `,(0,$.jsx)(`span`,{style:{color:`#f59e0b`,fontWeight:600},children:n?.credits??0})]})]})]})}),(0,$.jsx)(r7,{data:ye}),Ne.map(e=>{let t=e.menu_type??e.menuType,n=Me[e.id]&&Me[e.id].length>0,r=e.path===Ae,i=H[e.id],a=i7[e.icon]||(0,$.jsx)(y3,{});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item ${r&&!n?`mobile-menu-item-active`:``} ${t===`group`?`mobile-menu-group`:``}`,onClick:()=>Pe(e),children:[t!==`group`&&(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:r?`#6366f1`:`#64748b`},children:a}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{paddingLeft:0,color:t===`group`?`#94a3b8`:r?`#4f46e5`:`#475569`,fontWeight:t===`group`||r?600:400,fontSize:t===`group`?12:15,textTransform:t===`group`?`uppercase`:`none`,letterSpacing:t===`group`?.5:0},children:e.label}),(t===`group`||n)&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#cbd5e1`,transition:`transform 0.2s ease`,transform:i?`rotate(90deg)`:`rotate(0deg)`},children:(0,$.jsx)(Vg,{})})]}),(t===`group`||n)&&i&&(0,$.jsx)(`div`,{className:`mobile-submenu`,children:(Me[e.id]||[]).map(e=>{let t=e.path===Ae,n=i7[e.icon]||(0,$.jsx)(y3,{});return(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-submenu-item ${t?`mobile-menu-item-active`:``}`,onClick:()=>Pe(e),children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:t?`#6366f1`:`#94a3b8`},children:n}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:t?`#4f46e5`:`#64748b`,fontWeight:t?600:400,fontSize:14},children:e.label})]},e.id)})})]},e.id)})]}),(0,$.jsxs)(`div`,{style:{padding:`8px 0`,borderTop:`1px solid #f1f5f9`},children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=credits`),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#f59e0b`},children:(0,$.jsx)(V8,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`积分明细`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=orders`),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#6366f1`},children:(0,$.jsx)(kV,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`订单记录`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/messages`),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#8b5cf6`},children:(0,$.jsx)(g2,{})}),(0,$.jsxs)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:[`消息中心`,D>0&&(0,$.jsx)(SQ,{color:`red`,style:{marginLeft:8,fontSize:11},children:D})]})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{s(!0),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#0ea5e9`},children:(0,$.jsx)(U3,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`个人信息`})]}),(0,$.jsx)(`div`,{style:{height:8}}),(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-recharge-item`,onClick:()=>{l(!0),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#fff`},children:(0,$.jsx)(jI,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#fff`,fontWeight:600},children:`充值积分`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{ze(),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#ef4444`},children:(0,$.jsx)(Y3,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#ef4444`},children:`退出登录`})]})]})]}),(0,$.jsx)(jG,{title:(0,$.jsxs)(wV,{children:[(0,$.jsx)(l8,{}),`账号设置`]}),open:o,onCancel:()=>{s(!1),f.resetFields(),p.resetFields()},width:440,footer:null,children:(0,$.jsxs)(sL,{defaultActiveKey:`profile`,children:[(0,$.jsx)(sL.TabPane,{tab:`个人信息`,children:(0,$.jsxs)(vH,{form:p,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(vH.Item,{name:`username`,label:`用户名`,rules:[{required:!0,message:`请输入用户名`},{min:3,message:`用户名至少3位`}],children:(0,$.jsx)($U,{placeholder:`请输入用户名`,size:`large`,prefix:(0,$.jsx)(L8,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(vH.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Re,style:{width:`100%`},children:`确认修改`})})]})},`profile`),(0,$.jsx)(sL.TabPane,{tab:`修改密码`,children:(0,$.jsxs)(vH,{form:f,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(vH.Item,{name:`oldPwd`,label:`原密码`,rules:[{required:!0,message:`请输入原密码`}],children:(0,$.jsx)($U.Password,{placeholder:`请输入原密码`,size:`large`,prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(vH.Item,{name:`newPwd`,label:`新密码`,rules:[{required:!0,message:`请输入新密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)($U.Password,{placeholder:`请输入新密码(至少6位)`,size:`large`,prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(vH.Item,{name:`confirmPwd`,label:`确认新密码`,rules:[{required:!0,message:`请再次输入新密码`},({getFieldValue:e})=>({validator(t,n){return!n||e(`newPwd`)===n?Promise.resolve():Promise.reject(Error(`两次密码不一致`))}})],children:(0,$.jsx)($U.Password,{placeholder:`请再次输入新密码`,size:`large`,prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(vH.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Le,style:{width:`100%`},children:`确认修改`})})]})},`password`)]})}),(0,$.jsx)(hV,{title:null,placement:`bottom`,open:c,onClose:()=>{l(!1),h(null),w(null)},height:`95vh`,className:`recharge-drawer`,styles:{header:{display:`none`},body:{padding:`20px 24px 0`,overflowY:`auto`,position:`relative`}},footer:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`12px 0`,borderTop:`1px solid #f0f0f0`},children:[(0,$.jsxs)(wV,{children:[(0,$.jsx)(V8,{style:{color:`#6366f1`}}),(0,$.jsx)(Q.Text,{style:{color:`#64748b`},children:`当前积分余额`}),(0,$.jsx)(Q.Text,{strong:!0,style:{color:`#6366f1`,fontSize:18},children:n?.credits??0})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{l(!1),h(null),w(null)},style:{borderRadius:10},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,disabled:!m&&C===null,loading:ce,onClick:async()=>{if(m){let e=v.find(e=>e.id===m);if(!e)return;let t=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);try{le(!0);let n=await x5(e.id,oe),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url;(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(q({price:e.price,credits:t,qrCode:r,method:n.paymentMethod}),l(!1),ie(!0),me.current=n.orderNo,localStorage.setItem(Te,JSON.stringify({orderNo:n.orderNo,price:e.price,credits:t,qrCode:r,method:n.paymentMethod,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),He(n.orderNo)):(Z.success(`充值成功!积分已到账`),e7.getState().refreshUser(),l(!1),h(null))}catch(e){Z.error(e?.message||`创建订单失败,请重试`)}finally{le(!1)}}},style:{borderRadius:10,fontWeight:600,background:m?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#d1d5db`,border:`none`,boxShadow:m?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:`确认充值`})]})]}),children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:16,zIndex:10},children:(0,$.jsx)(ju,{style:{fontSize:18,color:`#94a3b8`,cursor:`pointer`,padding:8,borderRadius:`50%`,transition:`color 0.2s`},onClick:()=>{l(!1),h(null),w(null)},onMouseEnter:e=>{e.target.style.color=`#6366f1`},onMouseLeave:e=>{e.target.style.color=`#94a3b8`}})}),(0,$.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:20,marginTop:16},children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0,fontSize:20,fontWeight:700,color:`#1a1a2e`},children:`选择合适的计划,助力业务提升`}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,alignItems:`center`,gap:12,marginTop:12},children:(0,$.jsx)(`div`,{style:{display:`inline-flex`,background:`#f5f5fa`,borderRadius:10,padding:4,gap:4},children:[{key:`yearly`,label:`连续包年 8折`},{key:`quarterly`,label:`连续包季 8折`},{key:`monthly`,label:`连续包月`}].map(e=>(0,$.jsx)(`div`,{onClick:()=>{let t=e.key;E(t),t!==`monthly`&&C!==null&&c7[C]?.onlyMonthly&&w(null)},style:{padding:`6px 16px`,borderRadius:8,cursor:`pointer`,fontSize:13,fontWeight:500,background:T===e.key?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:T===e.key?`#fff`:`#64748b`,transition:`all 0.2s`,whiteSpace:`nowrap`},children:e.label},e.key))})})]}),(0,$.jsx)(`div`,{style:{position:`absolute`,top:12,right:48,zIndex:10},children:(0,$.jsxs)(`div`,{onClick:()=>x(!0),style:{display:`flex`,alignItems:`center`,gap:6,cursor:`pointer`,padding:`6px 14px`,borderRadius:20,background:`linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08))`,border:`1px solid rgba(99,102,241,0.2)`,transition:`all 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15))`,e.currentTarget.style.borderColor=`rgba(99,102,241,0.4)`},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08))`,e.currentTarget.style.borderColor=`rgba(99,102,241,0.2)`},children:[(0,$.jsx)(V8,{style:{color:`#6366f1`,fontSize:14}}),(0,$.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:`#6366f1`},children:`积分充值`})]})}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:12,marginBottom:20},children:c7.map((e,t)=>({plan:e,idx:t})).filter(({plan:e})=>T===`monthly`||!e.onlyMonthly).map(({plan:e,idx:t})=>{let n=o7[t%o7.length],r=T===`monthly`?e.monthlyPrice:T===`quarterly`?e.quarterlyPrice:e.yearlyPrice,i=T===`monthly`?e.monthlyCredits:T===`quarterly`?e.quarterlyCredits:e.yearlyCredits,a=Math.round(i/r*10),o=C===t,s=e.hot;return(0,$.jsxs)(`div`,{onClick:()=>w(t),style:{flex:1,borderRadius:16,padding:`20px 16px 16px`,background:s?`linear-gradient(180deg, #f0edff 0%, #fafbff 30%)`:`#fafbff`,border:o?`2px solid #6366f1`:s?`2px solid #8b5cf6`:`1px solid #f0f0f5`,cursor:`pointer`,position:`relative`,transition:`all 0.2s`,display:`flex`,flexDirection:`column`,alignItems:`stretch`},children:[s&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:-10,right:12,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,color:`#fff`,fontSize:11,padding:`3px 10px`,borderRadius:8,fontWeight:600},children:`最热销`}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,color:`#1a1a2e`},children:e.tier}),(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:e.desc})]}),(0,$.jsxs)(`div`,{style:{marginTop:8,marginBottom:4},children:[(0,$.jsxs)(`span`,{style:{fontSize:28,fontWeight:800,background:n.gradient,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`},children:[`¥`,r]}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#94a3b8`,marginLeft:4},children:`/月`})]}),(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,marginBottom:8},children:`自动续订,可随时取消。`}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:12,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{fontSize:11,color:`#6366f1`,background:`rgba(99,102,241,0.08)`,padding:`3px 8px`,borderRadius:6,fontWeight:600},children:[`每月 `,i.toLocaleString(),` 积分`]}),(0,$.jsxs)(`div`,{style:{fontSize:11,color:`#94a3b8`,background:`#f5f5fa`,padding:`3px 8px`,borderRadius:6},children:[`¥10 = `,a,` 积分`]})]}),(0,$.jsxs)(X,{block:!0,size:`small`,onClick:e=>{e.stopPropagation(),w(t)},style:{borderRadius:10,marginBottom:12,fontWeight:600,height:36,background:o||s?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#1a1a2e`,border:`none`,color:`#fff`,fontSize:13},children:[`订阅月卡`,e.tier]}),(0,$.jsxs)(`div`,{style:{borderTop:`1px solid #f0f0f5`,paddingTop:10,display:`flex`,flexDirection:`column`,gap:6},children:[e.features.map((e,t)=>(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:6},children:[(0,$.jsx)(Tu,{style:{fontSize:12,color:`#6366f1`,flexShrink:0,marginTop:2}}),(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#64748b`,lineHeight:1.5},children:e})]},t)),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:6},children:[(0,$.jsx)(Tu,{style:{fontSize:12,color:`#6366f1`,flexShrink:0,marginTop:2}}),(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#64748b`,lineHeight:1.5},children:`解锁抢先购`})]})]})]},t)})}),!he.alipay&&!he.wechat?(0,$.jsx)(`div`,{style:{marginBottom:16,padding:16,background:`#fef2f2`,borderRadius:12,border:`1px solid #fecaca`},children:(0,$.jsx)(Q.Text,{style:{color:`#dc2626`,fontSize:13},children:`⚠️ 暂无可用的支付方式,请联系管理员开启支付功能`})}):(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{color:`#64748b`,fontSize:13,marginBottom:8,display:`block`},children:`选择支付方式`}),(0,$.jsxs)(LF.Group,{value:oe,onChange:e=>se(e.target.value),style:{display:`flex`,gap:12},children:[he.alipay&&(0,$.jsxs)(LF.Button,{value:`alipay`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:oe===`alipay`?`#1677ff`:void 0,color:oe===`alipay`?`#1677ff`:void 0},children:[(0,$.jsx)(F0,{style:{fontSize:16,marginRight:6}}),`支付宝`]}),he.wechat&&(0,$.jsxs)(LF.Button,{value:`wechat`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:oe===`wechat`?`#07c160`:void 0,color:oe===`wechat`?`#07c160`:void 0},children:[(0,$.jsx)(W8,{style:{fontSize:16,marginRight:6}}),`微信支付`]})]})]}),(0,$.jsxs)(`div`,{style:{padding:`12px 16px`,background:`rgba(99, 102, 241, 0.06)`,borderRadius:10,marginBottom:16,display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(O3,{style:{color:`#6366f1`,fontSize:14}}),(0,$.jsxs)(Q.Text,{style:{color:`#64748b`,fontSize:13},children:[`当前平台仅支持支付宝/微信扫码充值,如需转账支付请`,(0,$.jsx)(Q.Text,{style:{color:`#ff0000ff`,cursor:`pointer`,textDecoration:`underline`},onClick:()=>{l(!1),d(!0)},children:`联系我们`})]})]})]})}),(0,$.jsx)(jG,{title:(0,$.jsxs)(wV,{children:[(0,$.jsx)(V8,{style:{color:`#6366f1`}}),`积分充值`]}),open:b,onCancel:()=>{x(!1),h(null)},width:560,footer:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,padding:`12px 0 0`,borderTop:`1px solid #f0f0f0`},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{x(!1),h(null)},style:{borderRadius:10,marginRight:12},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,disabled:!m||!he.alipay&&!he.wechat,loading:ce,onClick:async()=>{let e=v.find(e=>e.id===m);if(!e)return;let t=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);try{le(!0);let n=await x5(e.id,oe),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url;(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(q({price:e.price,credits:t,qrCode:r,method:n.paymentMethod}),x(!1),ie(!0),me.current=n.orderNo,localStorage.setItem(Te,JSON.stringify({orderNo:n.orderNo,price:e.price,credits:t,qrCode:r,method:n.paymentMethod,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),He(n.orderNo)):(Z.success(`充值成功!积分已到账`),e7.getState().refreshUser(),x(!1),h(null))}catch(e){Z.error(e?.message||`创建订单失败,请重试`)}finally{le(!1)}},style:{borderRadius:10,fontWeight:600,background:m?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#d1d5db`,border:`none`,boxShadow:m?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:`确认充值`})]}),children:(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsxs)(wV,{style:{marginBottom:16},children:[(0,$.jsx)(V8,{style:{color:`#6366f1`}}),(0,$.jsx)(Q.Text,{style:{color:`#64748b`,letterSpacing:0},children:`当前积分余额`}),(0,$.jsx)(Q.Text,{strong:!0,style:{color:`#6366f1`,fontSize:20,fontWeight:600},children:n?.credits??0})]}),!he.alipay&&!he.wechat?(0,$.jsx)(`div`,{style:{marginBottom:16,padding:16,background:`#fef2f2`,borderRadius:12,border:`1px solid #fecaca`},children:(0,$.jsx)(Q.Text,{style:{color:`#dc2626`,fontSize:13},children:`⚠️ 暂无可用的支付方式,请联系管理员开启支付功能`})}):(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{color:`#64748b`,fontSize:13,marginBottom:8,display:`block`},children:`选择支付方式`}),(0,$.jsxs)(LF.Group,{value:oe,onChange:e=>se(e.target.value),style:{display:`flex`,gap:12},children:[he.alipay&&(0,$.jsxs)(LF.Button,{value:`alipay`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:oe===`alipay`?`#1677ff`:void 0,color:oe===`alipay`?`#1677ff`:void 0},children:[(0,$.jsx)(F0,{style:{fontSize:16,marginRight:6}}),`支付宝`]}),he.wechat&&(0,$.jsxs)(LF.Button,{value:`wechat`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:oe===`wechat`?`#07c160`:void 0,color:oe===`wechat`?`#07c160`:void 0},children:[(0,$.jsx)(W8,{style:{fontSize:16,marginRight:6}}),`微信支付`]})]})]}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:v.map((e,t)=>{let n=a7[t%a7.length],r=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);return(0,$.jsxs)(`div`,{onClick:()=>h(e.id),style:{flex:`1 1 45%`,minWidth:180,borderRadius:16,padding:`18px 14px`,background:m===e.id?`rgba(99,102,241,0.04)`:`#fafbff`,border:m===e.id?`2px solid #6366f1`:`1px solid #f0f0f5`,cursor:`pointer`,position:`relative`,transition:`all 0.2s`},children:[e.description&&(0,$.jsx)(SQ,{color:`purple`,style:{position:`absolute`,top:-10,left:`50%`,transform:`translateX(-50%)`,borderRadius:8,fontSize:11},children:e.description}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:40,height:40,borderRadius:12,flexShrink:0,background:n.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:16,color:`#fff`,boxShadow:`0 6px 16px ${n.shadow}`},children:n.icon}),(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6},children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14},children:e.name}),(0,$.jsxs)(Q.Text,{style:{fontSize:13,fontWeight:600,color:`#6366f1`},children:[r.toLocaleString(),` 积分`]})]}),(0,$.jsxs)(`div`,{style:{fontSize:20,fontWeight:800,marginTop:2,background:n.gradient,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`},children:[`¥`,e.price]})]})]})]},e.id)})})]})}),(0,$.jsx)(jG,{open:re,onCancel:async()=>{if(Ve(),me.current){try{await w5(me.current)}catch{}me.current=null}localStorage.removeItem(Te),ie(!1),q(null)},footer:null,width:400,closable:!1,styles:{body:{padding:0,borderRadius:16,overflow:`hidden`}},children:(0,$.jsxs)(`div`,{style:{padding:`24px`},children:[(0,$.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:24},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,background:ae?.method===`alipay`?`linear-gradient(135deg, #1677ff, #0958d9)`:`linear-gradient(135deg, #07c160, #06ae56)`,borderRadius:16,display:`flex`,alignItems:`center`,justifyContent:`center`,margin:`0 auto 12px`},children:ae?.method===`alipay`?(0,$.jsx)(F0,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(W8,{style:{fontSize:24,color:`#fff`}})}),(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:ae?.method===`alipay`?`支付宝支付`:`微信支付`}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:ae?.method===`alipay`?`请使用支付宝扫描二维码完成支付`:`请使用微信扫描二维码完成支付`})]}),(0,$.jsxs)(`div`,{style:{background:`#fff`,borderRadius:16,padding:20,display:`flex`,flexDirection:`column`,alignItems:`center`,boxShadow:`0 4px 20px rgba(0,0,0,0.08)`},children:[(0,$.jsx)(`div`,{style:{width:180,height:180,borderRadius:12,overflow:`hidden`,background:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:ae&&(0,$.jsx)(M0,{value:ae.qrCode,size:160,level:`M`,includeMargin:!1})}),(0,$.jsxs)(`div`,{style:{marginTop:16,textAlign:`center`},children:[(0,$.jsxs)(`div`,{style:{fontSize:28,fontWeight:700,color:`#1a1a2e`},children:[`¥`,ae?.price||0]}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`,marginTop:4},children:[`购买 `,ae?.credits||0,` 积分`]}),(0,$.jsx)(`div`,{style:{marginTop:12,padding:`8px 16px`,background:ue<=30?`#fef2f2`:`#f0f9ff`,borderRadius:8,border:ue<=30?`1px solid #fecaca`:`1px solid #bae6fd`,display:`inline-block`},children:(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:ue<=30?`#dc2626`:`#0284c7`},children:[`订单将在 `,(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:800},children:ue}),` 秒后关闭`]})})]})]}),(0,$.jsx)(`div`,{style:{marginTop:20,padding:16,background:`#fef3c7`,borderRadius:12},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8},children:[(0,$.jsx)(`div`,{style:{fontSize:16,marginTop:-2},children:`💡`}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#92400e`},children:[(0,$.jsx)(`div`,{style:{fontWeight:500,marginBottom:4},children:`支付提示`}),(0,$.jsxs)(`ul`,{style:{margin:0,paddingLeft:16},children:[(0,$.jsx)(`li`,{style:{marginBottom:2},children:`请在支付后等待页面自动跳转`}),(0,$.jsx)(`li`,{children:`如支付成功但未到账,请联系客服`})]})]})]})}),(0,$.jsx)(`div`,{style:{marginTop:20},children:(0,$.jsx)(X,{size:`large`,block:!0,onClick:async()=>{if(Ve(),me.current){try{await w5(me.current)}catch{}me.current=null}localStorage.removeItem(Te),ie(!1),q(null),h(null)},style:{borderRadius:10},children:`取消支付`})})]})}),(0,$.jsx)(bse,{}),(0,$.jsx)(`div`,{className:`contact-button-wrapper`,style:{right:`${I.x}px`,bottom:`${window.innerHeight-I.y}px`},children:(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(`div`,{className:`contact-tooltip`,style:{opacity:+!!j},children:`联系我们`}),(0,$.jsx)(`button`,{className:`contact-button ${R?`dragging`:``}`,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),onMouseDown:Ee,onMouseUp:Oe,children:(0,$.jsx)(s6,{style:{fontSize:20}})})]})}),(0,$.jsx)(jG,{title:(0,$.jsxs)(wV,{children:[(0,$.jsx)(s6,{}),`联系我们`]}),open:u,onCancel:()=>{d(!1),N.resetFields()},footer:null,width:480,className:`contact-modal`,children:(0,$.jsxs)(`div`,{style:{marginTop:8},children:[(0,$.jsxs)(vH,{form:N,layout:`vertical`,children:[(0,$.jsx)(vH.Item,{name:`name`,label:`姓名`,rules:[{required:!0,message:`请输入姓名`}],children:(0,$.jsx)($U,{placeholder:`请输入您的姓名`,size:`large`})}),(0,$.jsx)(vH.Item,{name:`phone`,label:`手机号`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1[3-9]\d{9}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)($U,{placeholder:`请输入您的手机号`,size:`large`})}),(0,$.jsx)(vH.Item,{name:`companyName`,label:`公司名称`,rules:[{required:!0,message:`请输入公司名称`}],children:(0,$.jsx)($U,{placeholder:`请输入公司名称`,size:`large`})}),(0,$.jsx)(vH.Item,{name:`industry`,label:`您的行业`,rules:[{required:!0,message:`请输入您的行业`}],children:(0,$.jsx)($U,{placeholder:`请输入您的行业`,size:`large`})}),(0,$.jsx)(vH.Item,{name:`message`,label:`留言(选填)`,children:(0,$.jsx)($U.TextArea,{placeholder:`请输入您的需求或问题`,rows:3,style:{borderRadius:10}})})]}),(0,$.jsxs)(`div`,{style:{marginTop:16,display:`flex`,gap:12},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{d(!1),N.resetFields()},style:{borderRadius:10,flex:1},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Be,loading:P,style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,flex:1},children:`提交`})]})]})})]})},wse=`http://localhost:8000/api`,Tse=()=>{let{checkAuth:e}=e7(),[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(`password`),[a,o]=(0,S.useState)(`password`),[s]=On(),c=s.get(`redirect`),l=s.get(`tab`),[u,d]=(0,S.useState)(0),[f,p]=(0,S.useState)(0),[m,h]=(0,S.useState)(!1),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(!1),[C,w]=(0,S.useState)(0),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),j=(()=>{try{let e=localStorage.getItem(`siteInfo`);if(e){let t=JSON.parse(e);return{siteName:t.siteName||`智创`,siteLogo:t.siteLogo||``}}}catch{}return{siteName:`智创`,siteLogo:``}})(),[M,N]=(0,S.useState)(j.siteName),[P,F]=(0,S.useState)(j.siteLogo),[I,L]=(0,S.useState)(``),[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(``),[H,U]=(0,S.useState)(``),W=Ye(),{login:G}=e7(),[K]=vH.useForm(),[ee]=vH.useForm(),[te]=vH.useForm();(0,S.useEffect)(()=>{h5().then(e=>{N(e.siteName),F(e.siteLogo),L(e.loginBgVideo||``),V(e.userAgreementPrivacyUrl),U(e.siteCopyright)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{l===`register`&&i(`register`)},[l]);let ne=()=>{if(c)try{W(decodeURIComponent(c));return}catch{}W(`/home`)},re=()=>m?!0:(Z.warning(`请先阅读并同意用户协议及隐私政策`),!1),ie=async()=>{if(re())try{let t=await K.validateFields();await G(t.phone,t.password,void 0,t.rememberMe),Z.success(`登录成功,欢迎回来`),await e(),ne()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}},ae=async()=>{if(re())try{let t=ee.getFieldsValue();if(!t.phone||!t.code){Z.error(`请填写手机号和验证码`);return}n(!0),await wae(t.phone,t.code),Z.success(`登录成功,欢迎回来`),await e(),ne()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}finally{n(!1)}},q=async()=>{if(re())try{let t=await te.validateFields();n(!0),await Tae(t.phone,t.regCode,t.password),Z.success(`注册成功`),await e(),ne()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`注册失败`;Z.error(t)}finally{n(!1)}},oe=(e,t)=>{e(60);let n=setInterval(()=>{e(e=>e<=1?(clearInterval(n),_(!1),t?O(!0):A(!0),0):e-1)},1e3)};(0,S.useEffect)(()=>{u===0&&r===`phone`&&x(!1)},[u,r]);let se=async(e,t)=>{try{if(!e||!/^1\d{10}$/.test(e)){Z.error(`请输入正确的手机号`);return}if(t){_(!0),y(!1);return}if(!b){_(!0),x(!1);return}let n=``;n=r===`register`?`register`:`login`,await g5(e,n),oe(t?p:d),Z.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t),r===`register`?(y(!1),p(0)):(x(!1),d(0)),w(e=>e+1)}},ce=async(e=!1)=>{let t=r===`register`?te.getFieldValue(`phone`):ee.getFieldValue(`phone`);try{let e=``;e=r===`register`?`register`:`login`,await g5(t,e),r===`register`?(y(!0),oe(p,!0)):(x(!0),oe(d,!1)),Z.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t),r===`register`?(y(!1),p(0),O(!0)):(x(!1),d(0),A(!0)),w(e=>e+1)}},le=e=>{o(e),i(e),d(0),p(0),x(!1),y(!1),_(!1),O(!1),A(!1),w(e=>e+1),e===`password`?K.resetFields():ee.resetFields()},ue={background:`#fff`,border:`1.5px solid #e2e8f0`,color:`#1e293b`,borderRadius:10,fontSize:14},de=e=>{if(!e){Z.warning(`暂未上传协议文件`);return}e.startsWith(`http://`)||e.startsWith(`https://`)?window.open(e,`_blank`):window.open(`${wse.replace(/\/api$/,``)}${e}`,`_blank`)};return(0,$.jsxs)(`div`,{className:`login-page`,children:[(0,$.jsx)(Ese,{src:I,onReady:()=>z(!0)}),(0,$.jsx)(`div`,{className:`login-bg-overlay`,style:{opacity:+!!R}}),(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,opacity:+!!R,transition:`opacity 0.5s ease`,pointerEvents:R?`auto`:`none`},children:[(0,$.jsx)(`div`,{className:`login-slogan`,children:(0,$.jsx)(`span`,{className:`login-slogan-text`,children:`AI赋能创意,素材触手可及`})}),(0,$.jsx)(`div`,{className:`login-center`,children:(0,$.jsxs)(lL,{className:`login-card`,styles:{body:{padding:`32px 32px`}},children:[(0,$.jsx)(`div`,{className:`login-card-header`,children:(0,$.jsxs)(`div`,{className:`login-logo-row`,children:[P?(0,$.jsx)(`img`,{src:P,alt:`logo`,className:`login-logo-img`}):(0,$.jsx)(`div`,{className:`login-logo-placeholder`,children:(0,$.jsx)(D8,{style:{fontSize:20,color:`#fff`}})}),(0,$.jsx)(`span`,{className:`login-site-name`,children:M})]})}),(0,$.jsx)(Q.Text,{className:`login-card-subtitle`,children:r===`register`?`注册新账号,开始创作视频`:`登录您的账号,开始创作`}),r!==`register`&&(0,$.jsx)(`div`,{className:`login-tabs`,children:[`password`,`phone`].map(e=>(0,$.jsx)(`div`,{onClick:()=>le(e),className:`login-tab ${a===e?`login-tab-active`:``}`,children:e===`password`?`密码登录`:`验证码登录`},e))}),r===`password`&&(0,$.jsxs)(vH,{form:K,size:`large`,layout:`vertical`,onFinish:ie,children:[(0,$.jsx)(vH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)($U,{prefix:(0,$.jsx)(u6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,style:ue})}),(0,$.jsx)(vH.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,$.jsx)($U.Password,{prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入密码`,style:ue})}),(0,$.jsx)(vH.Item,{name:`rememberMe`,valuePropName:`checked`,style:{marginBottom:12},children:(0,$.jsx)(aR,{children:`记住我的登录状态`})}),(0,$.jsx)(vH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,htmlType:`submit`,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`phone`&&(0,$.jsxs)(vH,{form:ee,size:`large`,layout:`vertical`,children:[(0,$.jsx)(vH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)($U,{prefix:(0,$.jsx)(u6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:ue})}),(0,$.jsx)(vH.Item,{name:`code`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(wV.Compact,{style:{width:`100%`},children:[(0,$.jsx)($U,{prefix:(0,$.jsx)(r8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!b,style:{...ue,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:u>0,style:{fontSize:14,fontWeight:400},onClick:()=>{k?(x(!1),_(!0),w(e=>e+1)):g&&!b?(E(!0),setTimeout(()=>E(!1),500)):se(ee.getFieldValue(`phone`))},className:`login-code-btn`,children:u>0?`${u}s`:k?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(vH.Item,{style:{marginBottom:12},children:(0,$.jsx)(l7,{onSuccess:ce,isVerified:b,shake:T})},C),(0,$.jsx)(vH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:ae,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`register`&&(0,$.jsxs)(vH,{form:te,size:`large`,layout:`vertical`,children:[(0,$.jsx)(vH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)($U,{prefix:(0,$.jsx)(u6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:ue})}),(0,$.jsx)(vH.Item,{name:`regCode`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(wV.Compact,{style:{width:`100%`},children:[(0,$.jsx)($U,{prefix:(0,$.jsx)(r8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!v,style:{...ue,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:f>0,style:{fontSize:14,fontWeight:400},onClick:()=>{D?(y(!1),_(!0),w(e=>e+1)):g&&!v?(E(!0),setTimeout(()=>E(!1),500)):se(te.getFieldValue(`phone`),!0)},className:`login-code-btn`,children:f>0?`${f}s`:D?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(vH.Item,{style:{marginBottom:12},children:(0,$.jsx)(l7,{onSuccess:ce,isVerified:v,shake:T})},C),(0,$.jsx)(vH.Item,{name:`password`,rules:[{required:!0,message:`请设置密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)($U.Password,{prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请设置密码(至少6位)`,style:ue})}),(0,$.jsx)(vH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:q,loading:t,block:!0,className:`login-submit-btn`,children:`注 册`})})]}),(0,$.jsx)(`div`,{className:`login-agreement`,children:(0,$.jsx)(aR,{checked:m,onChange:e=>h(e.target.checked),children:(0,$.jsxs)(`span`,{className:`login-agreement-text`,children:[`我已阅读并同意`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),de(B)},className:`login-link`,children:`《用户协议及隐私政策》`})]})})}),(0,$.jsx)(`div`,{className:`login-footer`,children:r===`register`?(0,$.jsx)(Q.Text,{className:`login-switch-btn`,onClick:()=>{i(`password`),o(`password`),O(!1),A(!1),y(!1),_(!1),w(e=>e+1),te.resetFields()},children:`已有账号?去登录`}):(0,$.jsx)(Q.Text,{className:`login-switch-btn`,onClick:()=>{i(`register`),O(!1),A(!1),y(!1),_(!1),w(e=>e+1)},children:`没有账号?立即注册`})})]})}),H&&(0,$.jsx)(`div`,{className:`login-copyright-wrapper`,children:(0,$.jsx)(`div`,{className:`login-copyright`,children:H})})]})]})},Ese=({src:e,onReady:t})=>{let[n,r]=(0,S.useState)(!1),i=S.useRef(null),a=()=>{n||(r(!0),i.current?.play().catch(()=>{}),t())};if(!e)return t(),null;let o=e.toLowerCase().endsWith(`.gif`),s=e.toLowerCase().endsWith(`.webp`);return o||s?(0,$.jsx)(`img`,{className:`login-bg-video`,src:e,alt:``,onLoad:a,onError:a}):(0,$.jsxs)($.Fragment,{children:[!n&&(0,$.jsx)(`div`,{className:`login-bg-video login-bg-placeholder`}),(0,$.jsx)(`video`,{ref:i,className:`login-bg-video`,style:{opacity:+!!n},autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:`auto`,onCanPlayThrough:a,onCanPlay:a,onError:a,children:(0,$.jsx)(`source`,{src:e,type:e.endsWith(`.webm`)?`video/webm`:e.endsWith(`.mov`)?`video/quicktime`:`video/mp4`})})]})},l7=({onSuccess:e,isVerified:t,shake:n})=>{let r=S.useRef(null),i=S.useRef(null),a=S.useRef(null),o=S.useRef(0),s=S.useRef(!1),[c,l]=S.useState(360),u=c-50;S.useEffect(()=>{let e=()=>{if(r.current){let e=r.current.offsetWidth;e>0&&l(e)}};e();let t=new ResizeObserver(e);return r.current&&t.observe(r.current),window.addEventListener(`resize`,e),()=>{t.disconnect(),window.removeEventListener(`resize`,e)}},[]);let d=n=>{if(s.current||t)return;let r=Math.max(0,Math.min(n,u));o.current=r,i.current&&(i.current.style.left=`${r}px`),a.current&&(a.current.style.width=`${r+50}px`),r>=u-5&&(s.current=!0,i.current&&(i.current.style.background=`#22c55e`,i.current.innerHTML=``),a.current&&(a.current.style.width=`${c}px`,a.current.style.background=`#dcfce7`),e())};return(0,$.jsxs)(`div`,{ref:r,onMouseDown:e=>{if(e.preventDefault(),s.current||t)return;let n=r.current;if(!n)return;let c=n.getBoundingClientRect(),l=e=>{d(e.clientX-c.left-50/2)},f=()=>{document.removeEventListener(`mousemove`,l),document.removeEventListener(`mouseup`,f),!s.current&&o.current{if(s.current||t)return;e.preventDefault();let n=r.current;if(!n)return;let c=n.getBoundingClientRect();d(e.touches[0].clientX-c.left-50/2);let l=e=>{d(e.touches[0].clientX-c.left-50/2)},f=()=>{document.removeEventListener(`touchmove`,l),document.removeEventListener(`touchend`,f),!s.current&&o.current({page:1,pageSize:10,total:0,items:[]}),u7=J8((e,t)=>({projects:[],records:Dse(),loading:!1,mediaType:`video`,countType:`请选择`,generationCount:1,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`9:16`,videoResolution:`720p`,engineOptions:{ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`480p`,`720p`,`1080p`],durations:[5,8,10,12,15]},enginesele:[],inputValue:``,currentMedia:[],fetchProjects:async()=>{e({loading:!0});try{e({projects:await Oae(),loading:!1})}catch{e({loading:!1})}},createProject:async(n,r)=>{let i=await kae(n,r);return e({projects:[i,...t().projects]}),i},deleteProject:async n=>{await Aae(n),e({projects:t().projects.filter(e=>e.id!==n)})},fetchRecords:async(t={})=>{e({loading:!0});try{e({records:await s5(t),loading:!1})}catch{e({loading:!1})}},optimizePrompt:async(n,r)=>{let i=await jae(n,r);try{await e7.getState().checkAuth()}catch{}let a=t().records,o=a.items.findIndex(e=>e.id===i.record.id),s=o>=0?a.items.map(e=>e.id===i.record.id?i.record:e):[i.record,...a.items];return e({records:{...a,total:o>=0?a.total:a.total+1,items:s}}),i},generateVideo:async n=>{let r=await Vae(n);try{await e7.getState().checkAuth()}catch{}let i=t().records;return e({records:{...i,items:i.items.map(e=>e.id===n?r:e)}}),r},retryGeneration:async n=>{let r=await Hae(n);try{await e7.getState().checkAuth()}catch{}let i=t().records;return e({records:{...i,items:i.items.map(e=>e.id===n?r:e)}}),r},updateRecordReferences:(n,r)=>{let i=t().records;e({records:{...i,items:i.items.map(e=>e.id===n?{...e,references:r}:e)}})},setMediaType:t=>e({mediaType:t}),setCountType:t=>e({countType:t}),setGenerationCount:t=>e({generationCount:t}),setImageSettings:(t,n,r,i)=>e({selectedRatio:t,selectedResolution:n,width:r,height:i}),setVideoSettings:(t,n,r)=>e({videoDuration:t,videoAspectRatio:n,videoResolution:r}),setEngineOptions:t=>e({engineOptions:t}),setSelectedRatio:t=>e({selectedRatio:t}),setSelectedResolution:t=>e({selectedResolution:t}),setWidth:t=>e({width:t}),setHeight:t=>e({height:t}),setVideoDuration:t=>e({videoDuration:t}),setVideoAspectRatio:t=>e({videoAspectRatio:t}),setVideoResolution:t=>e({videoResolution:t}),setEnginesele:t=>e({enginesele:t}),setInputValue:t=>e({inputValue:t}),setCurrentMedia:t=>e({currentMedia:t}),resetGenerationConfig:()=>e({mediaType:`image`,countType:`请选择`,generationCount:1,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`9:16`,videoResolution:`720p`,engineOptions:{ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`480p`,`720p`,`1080p`],durations:[5,8,10,12,15]},enginesele:[],inputValue:``,currentMedia:[]})})),d7=480;function f7(e){if(!e)return`-`;let t=e.trim();if(!t)return`-`;let n=t.match(/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(Z|[+-]\d{2}:?\d{2})?$/);if(!n)return t.slice(0,16).replace(`T`,` `);let[,r,i,a,o,s,c,l]=n,u=Date.UTC(+r,i-1,+a,+o,+s,+c);if(l&&l!==`Z`){let e=l[0]===`+`?1:-1,[t,n]=l.slice(1).split(`:`),r=u-e*(t*60+ +n)*6e4+d7*6e4,i=new Date(r);return`${i.getUTCFullYear()}-${p7(i.getUTCMonth()+1)}-${p7(i.getUTCDate())} ${p7(i.getUTCHours())}:${p7(i.getUTCMinutes())}`}let d=l===`Z`?u+d7*6e4:u,f=new Date(d);return`${f.getUTCFullYear()}-${p7(f.getUTCMonth()+1)}-${p7(f.getUTCDate())} ${p7(f.getUTCHours())}:${p7(f.getUTCMinutes())}`}function p7(e){return e<10?`0${e}`:String(e)}var m7=[`#f97316`,`#3b82f6`,`#8b5cf6`,`#10b981`,`#eab308`,`#6366f1`,`#ef4444`,`#06b6d4`,`#64748b`,`#78716c`],h7={ShoppingCartOutlined:(0,$.jsx)(d8,{}),BookOutlined:(0,$.jsx)(y2,{}),HomeOutlined:(0,$.jsx)(y3,{}),FireOutlined:(0,$.jsx)(B4,{}),RocketOutlined:(0,$.jsx)(t8,{}),SkinOutlined:(0,$.jsx)(Lie,{}),CompassOutlined:(0,$.jsx)(u4,{}),HeartOutlined:(0,$.jsx)(u3,{}),CarOutlined:(0,$.jsx)(P2,{}),CameraOutlined:(0,$.jsx)(j2,{}),CloudOutlined:(0,$.jsx)(K2,{}),StarOutlined:(0,$.jsx)(x8,{}),TrophyOutlined:(0,$.jsx)(j8,{}),ThunderboltOutlined:(0,$.jsx)(D8,{}),BulbOutlined:(0,$.jsx)(T2,{}),CoffeeOutlined:(0,$.jsx)(i4,{}),CrownOutlined:(0,$.jsx)(g4,{}),DashboardOutlined:(0,$.jsx)(y4,{}),FlagOutlined:(0,$.jsx)(U4,{}),GlobalOutlined:(0,$.jsx)(s3,{}),GiftOutlined:(0,$.jsx)(i3,{}),LaptopOutlined:(0,$.jsx)(j3,{}),MobileOutlined:(0,$.jsx)(u6,{}),MonitorOutlined:(0,$.jsx)(p6,{}),PayCircleOutlined:(0,$.jsx)(O6,{}),PictureOutlined:(0,$.jsx)(L6,{}),PlayCircleOutlined:(0,$.jsx)(K6,{}),SafetyOutlined:(0,$.jsx)(r8,{}),ShoppingOutlined:(0,$.jsx)(Nie,{}),SmileOutlined:(0,$.jsx)(g8,{}),SoundOutlined:(0,$.jsx)(y8,{}),TagOutlined:(0,$.jsx)(Kie,{}),TeamOutlined:(0,$.jsx)(T8,{}),ToolOutlined:(0,$.jsx)(Xie,{}),TruckOutlined:(0,$.jsx)(tae,{}),VideoCameraOutlined:(0,$.jsx)(z8,{}),WalletOutlined:(0,$.jsx)(V8,{}),BankOutlined:(0,$.jsx)(u2,{}),BuildOutlined:(0,$.jsx)(S2,{}),ExperimentOutlined:(0,$.jsx)(O4,{}),HighlightOutlined:(0,$.jsx)(p3,{}),IdcardOutlined:(0,$.jsx)(S3,{}),MedicineBoxOutlined:(0,$.jsx)(t6,{}),ReadOutlined:(0,$.jsx)(_ie,{}),RestOutlined:(0,$.jsx)(yie,{}),SketchOutlined:(0,$.jsx)(Fie,{}),SolutionOutlined:(0,$.jsx)(Bie,{})},Ose=()=>{let[e,t]=(0,S.useState)(!1),[n]=vH.useForm(),r=Ye(),{projects:i,fetchProjects:a,createProject:o,deleteProject:s}=u7(),[c,l]=(0,S.useState)([]);(0,S.useEffect)(()=>{a(),b5().then(l).catch(()=>{})},[]);let u=Object.fromEntries(c.map((e,t)=>[e.key,{label:e.label,color:m7[t%m7.length],icon:e.icon||`AppstoreOutlined`}]));return(0,$.jsxs)(`div`,{className:`content_box`,children:[(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:24,padding:`16px 24px`,borderRadius:16,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(99, 102, 241, 0.08)`,position:`relative`,overflow:`hidden`,flexWrap:`wrap`,gap:12},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`垂直行业提示词智能优化(新手专属,一键生成标准素材)`}),(0,$.jsxs)(`p`,{style:{fontSize:13,color:`#64748b`,margin:`4px 0 0 0`},children:[`共 `,i.length,` 个项目 · 按行业分类管理`]})]})}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[(0,$.jsx)(X,{icon:(0,$.jsx)(kV,{}),onClick:()=>r(`/records`),size:`large`,style:{background:`rgba(99, 102, 241, 0.1)`,border:`1px solid rgba(99, 102, 241, 0.2)`,color:`#6366f1`,fontWeight:600,borderRadius:10,height:42},children:`项目记录`}),(0,$.jsx)(X,{icon:(0,$.jsx)(jI,{}),onClick:()=>t(!0),size:`large`,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,color:`#fff`,fontWeight:600,borderRadius:10,height:42,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.35)`},children:`新建项目`})]})]}),i.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`还没有项目,创建您的第一个视频项目`,style:{padding:`60px 0`},children:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(jI,{}),onClick:()=>t(!0),size:`large`,children:`创建第一个项目`})}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},className:`stagger-children`,children:i.map((e,t)=>(0,$.jsxs)(`div`,{className:`project-card project-item animate-slideInCard`,onClick:()=>r(`/projects/${e.id}/generate`),style:{display:`flex`,alignItems:`center`,padding:`18px 22px`,borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,cursor:`pointer`,animationDelay:`${t*.06}s`},children:[(0,$.jsx)(`div`,{style:{width:50,height:50,borderRadius:14,flexShrink:0,background:`${u[e.industry]?.color||`#64748b`}12`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:24,marginRight:16,color:u[e.industry]?.color||`#64748b`},children:h7[u[e.industry]?.icon]||(0,$.jsx)(V0,{})}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:4,flexWrap:`wrap`},children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,color:`#1a1a2e`},children:e.name}),(0,$.jsx)(SQ,{color:u[e.industry]?.color||`#64748b`,style:{borderRadius:6,margin:0},children:u[e.industry]?.label||e.industry})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(SB,{style:{fontSize:12,color:`#94a3b8`}}),(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`创建于 `,f7(e.createdAt)]})]})]}),(0,$.jsxs)(`div`,{className:`project-actions`,style:{display:`flex`,alignItems:`center`,gap:8,marginLeft:16},children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(K6,{}),onClick:t=>{t.stopPropagation(),r(`/projects/${e.id}/generate`)},style:{background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`,borderRadius:10,fontWeight:600,height:36,boxShadow:`0 4px 12px rgba(99,102,241,0.25)`},children:`生成`}),(0,$.jsx)(FG,{title:`确定删除该项目?`,description:`项目下的生成记录将一并删除`,onConfirm:async t=>{t?.stopPropagation(),await s(e.id),Z.success(`项目已删除`)},onCancel:e=>e?.stopPropagation(),children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(IQ,{}),onClick:e=>e.stopPropagation(),style:{borderRadius:10,height:36,background:`rgba(239,68,68,0.06)`,border:`1px solid rgba(239,68,68,0.15)`,color:`#ef4444`}})}),(0,$.jsx)(Vg,{className:`mobile-hide`,style:{color:`#cbd5e1`,fontSize:12}})]})]},e.id))}),(0,$.jsx)(jG,{title:(0,$.jsxs)(wV,{children:[(0,$.jsx)(V0,{}),`新建项目`]}),open:e,onOk:async()=>{try{let e=await n.validateFields(),i=await o(e.name,e.industry);Z.success(`项目创建成功`),t(!1),n.resetFields(),r(`/projects/${i.id}/generate`)}catch{}},onCancel:()=>{t(!1),n.resetFields()},okText:`创建`,cancelText:`取消`,width:480,children:(0,$.jsxs)(vH,{form:n,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(vH.Item,{name:`name`,label:`项目名称`,rules:[{required:!0,message:`请输入项目名称`}],children:(0,$.jsx)($U,{placeholder:`例如:618电商大促宣传片`,prefix:(0,$.jsx)(vX,{}),size:`large`})}),(0,$.jsx)(vH.Item,{name:`industry`,label:`所属行业`,rules:[{required:!0,message:`请选择行业`}],children:(0,$.jsx)(zC,{placeholder:`选择项目所属行业`,size:`large`,children:c.map((e,t)=>(0,$.jsx)(zC.Option,{value:e.key,children:(0,$.jsxs)(wV,{children:[h7[e.icon]||(0,$.jsx)(V0,{}),` `,e.label]})},e.key))})})]})})]})};async function g7(e){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)return await navigator.clipboard.writeText(e),!0;let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}var{Text:_7}=Q,kse={real_person:{title:`选择真人素材库`,empty:`暂无可选 Active 真人素材`,projectError:`加载真人素材项目失败`,assetError:`加载真人素材失败`,fallbackName:`真人素材`},aigc_virtual:{title:`选择虚拟素材库`,empty:`暂无可选 Active 虚拟素材`,projectError:`加载虚拟素材项目失败`,assetError:`加载虚拟素材失败`,fallbackName:`虚拟素材`}},v7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`https://ceshi.apiforeign.minzhongzc.com`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,Ase=e=>e.assetType===`Video`?v7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.providerUrl):v7(`static`+(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.providerUrl)+`?w=300&q=50`),jse=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},y7=({open:e,libraryType:t=`real_person`,selectedIds:n=[],maxCount:r=20,onClose:i,onSelect:a,maxImageCount:o,maxVideoCount:s,usedImageCount:c,usedVideoCount:l,usedVideoDuration:u,maxVideoDuration:d,accept:f})=>{let p=kse[t],[m,h]=(0,S.useState)([]),[g,_]=(0,S.useState)(),[v,y]=(0,S.useState)(``),[b,x]=(0,S.useState)(f===`image/*`?`Image`:void 0),[C,w]=(0,S.useState)([]),[T,E]=(0,S.useState)(new Map),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),j=(0,S.useMemo)(()=>new Set(T.keys()),[T]),M=async()=>{O(!0);try{let e=(await(t===`aigc_virtual`?$5:Z5)({page:1,pageSize:100,status:`active`})).items||[];h(e),_(t=>t&&e.some(e=>e.id===t)?t:e[0]?.id)}catch(e){Z.error(e?.message||p.projectError)}finally{O(!1)}},N=async()=>{A(!0);try{w((await(t===`aigc_virtual`?ose:ese)({projectId:g,keyword:v.trim()||void 0,assetType:b,page:1,pageSize:100})).items||[])}catch(e){Z.error(e?.message||p.assetError)}finally{A(!1)}};(0,S.useEffect)(()=>{e&&setTimeout(()=>{E(new Map),y(``),x(void 0),_(void 0),w([]),M()},0)},[e,t]),(0,S.useEffect)(()=>{g&&setTimeout(()=>{N()},0)},[g,b]);let P=e=>{if(n.includes(e.id)){Z.info(`该素材已添加`);return}if(f===`image/*`&&e.assetType===`Video`){Z.warning(`当前仅支持选择图片素材`);return}E(t=>{let n=new Map(t);return n.has(e.id)?(n.delete(e.id),n):n.size>=r?(Z.warning(`最多选择 ${r} 个参考素材`),t):(n.set(e.id,e),n)})},F=(0,S.useMemo)(()=>{let e=Array.from(T.values()).filter(e=>e.assetType===`Image`).length,t=Array.from(T.values()).filter(e=>e.assetType===`Video`).length,n=Array.from(T.values()).filter(e=>e.assetType===`Video`).reduce((e,t)=>e+(t.videoDuration||0),0),r=o!==void 0&&c!==void 0?o-c:1/0,i=s!==void 0&&l!==void 0?s-l:1/0,a=d!==void 0&&u!==void 0?d-u:1/0;return e>r||t>i||n>a},[T,o,c,s,l,d,u]);return(0,$.jsxs)(jG,{title:`${p.title}`,open:e,onCancel:i,width:920,destroyOnHidden:!0,footer:[(0,$.jsx)(X,{onClick:i,children:`取消`},`cancel`),(0,$.jsxs)(X,{type:`primary`,onClick:()=>{let e=Array.from(T.values()).filter(e=>!n.includes(e.id));if(!e.length){Z.warning(`请选择至少一个${t===`aigc_virtual`?`虚拟`:`真人`}素材`);return}a(e),i()},disabled:F,style:{background:F?`#94a3b8`:`#8b5cf6`,opacity:F?.6:1,cursor:F?`not-allowed`:`pointer`},children:[`添加选中素材(`,T.size,`)`]},`ok`)],children:[f!==`image/*`&&(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:20,marginBottom:16,padding:`12px 16px`,background:`#fafafa`,borderRadius:8},children:(()=>{let e=Array.from(T.values()).filter(e=>e.assetType===`Image`).length,t=Array.from(T.values()).filter(e=>e.assetType===`Video`).length,n=Array.from(T.values()).filter(e=>e.assetType===`Video`).reduce((e,t)=>e+(t.videoDuration||0),0),r=o!==void 0&&c!==void 0?o-c:1/0,i=s!==void 0&&l!==void 0?s-l:1/0,a=d!==void 0&&u!==void 0?d-u:1/0,f=e>r,p=t>i,m=n>a;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:f?`#ef4444`:`#64748b`,fontWeight:f?600:400},children:[`还可选取图片 `,e,`/`,o!==void 0&&c!==void 0?o-c:`-`,` 张`]}),(0,$.jsxs)(`span`,{style:{fontSize:13,color:p||m?`#ef4444`:`#64748b`,fontWeight:p||m?600:400},children:[`视频还可选取 `,t,`/`,s!==void 0&&l!==void 0?s-l:`-`,` 个(`,n.toFixed(1),`/`,d!==void 0&&u!==void 0?(d-u).toFixed(1):`-`,`秒)`]})]})})()}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`240px 1fr`,gap:16,height:500},children:[(0,$.jsxs)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,background:`#fafafa`,overflowY:`auto`,height:`100%`},children:[(0,$.jsxs)(wV,{style:{width:`100%`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(_7,{strong:!0,children:`项目组`}),(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(VK,{}),onClick:M,loading:D})]}),(0,$.jsx)(oG,{spinning:D,children:m.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`暂无项目组`}):(0,$.jsx)(`div`,{children:m.map(e=>(0,$.jsx)(`div`,{onClick:()=>_(e.id),style:{cursor:`pointer`,padding:`10px 12px`,borderRadius:10,marginBottom:6,border:g===e.id?`1px solid #8b5cf6`:`1px solid transparent`,background:g===e.id?`#f5f3ff`:`#fff`},children:(0,$.jsxs)(`div`,{style:{width:`100%`},children:[(0,$.jsx)(_7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),(0,$.jsx)(_7,{type:`secondary`,style:{fontSize:12},children:typeof e.activeImageAssetCount==`number`||typeof e.activeVideoAssetCount==`number`?` 图 ${e.activeImageAssetCount||0} / 视 ${e.activeVideoAssetCount||0}`:``})]})},e.id))})})]}),(0,$.jsxs)(`div`,{style:{overflowY:`auto`,height:`100%`},children:[(0,$.jsxs)(wV,{style:{width:`100%`,marginBottom:12},children:[(0,$.jsx)($U,{allowClear:!0,prefix:(0,$.jsx)(PC,{}),placeholder:`搜索素材名称`,value:v,onChange:e=>y(e.target.value),onPressEnter:N}),(0,$.jsx)(zC,{allowClear:f!==`image/*`,placeholder:`素材类型`,value:b,onChange:x,style:{width:116},options:f===`image/*`?[{value:`Image`,label:`图片`}]:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{icon:(0,$.jsx)(VK,{}),onClick:N,loading:k,children:`刷新`})]}),(0,$.jsx)(oG,{spinning:k,children:C.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:p.empty,style:{marginTop:120}}):(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(140px, 1fr))`,gap:12,maxHeight:420,overflowY:`auto`,paddingRight:4},children:C.filter(e=>f!==`image/*`||e.assetType===`Image`).map(e=>{let t=j.has(e.id)||n.includes(e.id),r=n.includes(e.id),i=Ase(e),a=e.assetType===`Video`;return(0,$.jsxs)(`div`,{onClick:()=>P(e),style:{cursor:r?`not-allowed`:`pointer`,border:t?`2px solid #8b5cf6`:`1px solid #edf0f5`,borderRadius:12,overflow:`hidden`,background:`#fff`,boxShadow:t?`0 8px 20px rgba(139,92,246,0.18)`:`0 4px 12px rgba(15,23,42,0.04)`,opacity:r?.62:1,position:`relative`},children:[(0,$.jsxs)(`div`,{style:{aspectRatio:`1 / 1`,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[i?a?(0,$.jsx)(`video`,{src:i,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:i,alt:e.name||p.fallbackName,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):a?(0,$.jsx)(z8,{style:{fontSize:32,color:`#94a3b8`}}):(0,$.jsx)(L6,{style:{fontSize:32,color:`#94a3b8`}}),a&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:8,bottom:8,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:jse(e.videoDuration)})]}),t&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,width:24,height:24,borderRadius:12,background:`#8b5cf6`,color:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(OC,{})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsx)(_7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name||`未命名素材`}),(0,$.jsxs)(wV,{wrap:!0,size:4,style:{marginTop:6},children:[(0,$.jsx)(SQ,{color:a?`blue`:`default`,children:a?`视频`:`图片`}),(0,$.jsx)(SQ,{children:e.projectName})]})]})]},e.id)})})})]})]})]})},b7=({src:e,size:t=`normal`})=>{let n=(0,S.useRef)(null),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(0),[s,c]=(0,S.useState)(0),[l,u]=(0,S.useState)(1),[d,f]=(0,S.useState)(!1),p=e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`,m=(0,S.useCallback)(()=>{n.current&&(r?n.current.pause():n.current.play(),i(!r))},[r]),h=(0,S.useCallback)(()=>{n.current&&o(n.current.currentTime)},[]),g=(0,S.useCallback)(()=>{n.current&&c(n.current.duration)},[]),_=(0,S.useCallback)(()=>{i(!1),o(0)},[]),v=(0,S.useCallback)(e=>{if(!n.current||s===0)return;let t=e.currentTarget.getBoundingClientRect(),r=(e.clientX-t.left)/t.width*s;n.current.currentTime=r,o(r)},[s]),y=(0,S.useCallback)(e=>{if(!n.current)return;let t=parseFloat(e.target.value);n.current.volume=t,u(t),f(t===0)},[]),b=(0,S.useCallback)(()=>{n.current&&(d?(n.current.volume=l||.5,f(!1)):(n.current.volume=0,f(!0)))},[d,l]);(0,S.useEffect)(()=>{let e=n.current;if(e)return e.addEventListener(`timeupdate`,h),e.addEventListener(`loadedmetadata`,g),e.addEventListener(`ended`,_),()=>{e.removeEventListener(`timeupdate`,h),e.removeEventListener(`loadedmetadata`,g),e.removeEventListener(`ended`,_)}},[h,g,_]);let x=s>0?a/s*100:0;return(0,$.jsxs)(`div`,{style:{width:`100%`,height:t===`small`?130:112,background:`#f1f5f9`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:t===`small`?`16px 16px`:`12px 16px`},children:[(0,$.jsx)(`audio`,{ref:n,src:e}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16,width:`100%`},children:[(0,$.jsx)(`button`,{onClick:m,style:{width:48,height:48,borderRadius:`50%`,background:`linear-gradient(135deg, #8b5cf6, #a78bfa)`,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,flexShrink:0},children:r?(0,$.jsx)(S6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(K6,{style:{fontSize:24,color:`#fff`,marginLeft:2}})}),(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:8},children:[(0,$.jsxs)(`div`,{onClick:v,style:{height:5,background:`#e2e8f0`,borderRadius:10,cursor:`pointer`,overflow:`visible`,position:`relative`},children:[(0,$.jsx)(`div`,{style:{height:`100%`,width:`${x}%`,background:`linear-gradient(90deg, #8b5cf6, #a78bfa)`,borderRadius:10,transition:`width 0.1s linear`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,left:`${x}%`,top:`50%`,transform:`translate(-50%, -50%)`,width:t===`small`?12:14,height:t===`small`?12:14,background:`#fff`,borderRadius:`50%`,boxShadow:`0 2px 6px rgba(0,0,0,0.15)`,opacity:+(x>0),transition:`opacity 0.2s`}})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{fontSize:t===`small`?11:12,color:`#64748b`},children:p(a)}),(0,$.jsx)(`span`,{style:{fontSize:t===`small`?11:12,color:`#64748b`},children:p(s)})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flexShrink:0},children:[(0,$.jsx)(`button`,{onClick:b,style:{border:`none`,background:`transparent`,cursor:`pointer`,padding:0},children:d?(0,$.jsx)(U2,{style:{fontSize:t===`small`?14:16,color:`#94a3b8`}}):(0,$.jsx)(y8,{style:{fontSize:t===`small`?14:16,color:`#94a3b8`}})}),(0,$.jsx)(`input`,{type:`range`,min:`0`,max:`1`,step:`0.1`,value:d?0:l,onChange:y,style:{width:t===`small`?40:50,height:4,borderRadius:2,appearance:`none`,background:`#e2e8f0`,cursor:`pointer`}})]})]})]})},{Text:x7}=Q,S7=e=>{if(!e)return``;if(/^data:|blob:/i.test(e))return e;if(/^https?:\/\//i.test(e)){let t=new URL(e);return t.pathname.startsWith(`/uploads`)?t.pathname+t.search:e}return`${`https://ceshi.apiforeign.minzhongzc.com`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`},C7=(e,t)=>{if(e<300||e>6e3)return`图片宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`图片高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;return n<.4||n>2.5?`图片宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`:null},w7=(e,t)=>{if(e<300||e>6e3)return`视频宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`视频高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;if(n<.4||n>2.5)return`视频宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`;let r=e*t;return r<409600?`视频总像素数过小(${e}×${t}=${r}),需 ≥ 640×640=409600`:r>8295044?`视频总像素数过大(${e}×${t}=${r}),需 ≤ 3326×2494=8295044`:null},Mse=e=>{let t=e,n=t.width||t.videoWidth||t.imageWidth||0,r=t.height||t.videoHeight||t.imageHeight||0;if(e.resourceType===`image`){if(n>0&&r>0)return C7(n,r)}else if(e.resourceType===`video`&&n>0&&r>0)return w7(n,r);return null},Nse=e=>new Promise(t=>{let n=new Image;n.onload=()=>{t({width:n.width,height:n.height})},n.onerror=()=>{t({width:0,height:0})},n.src=e}),Pse=e=>e===`video`?(0,$.jsx)(z8,{}):e===`audio`?(0,$.jsx)(n2,{}):(0,$.jsx)(L6,{}),Fse=e=>e===`video`?`视频`:e===`audio`?`音频`:`图片`,Ise=({open:e,onClose:t,onSelect:n,allowedTypes:r,selectedIds:i=[],title:a=`选择历史上传素材`,maxImageCount:o,maxVideoCount:s,usedImageCount:c,usedVideoCount:l,maxVideoDuration:u,usedVideoDuration:d,maxAudioCount:f,usedAudioCount:p,maxAudioDuration:m,usedAudioDuration:h,hideLimitHint:g,defaultResourceType:_})=>{let[v,y]=(0,S.useState)(_||``),[b,x]=(0,S.useState)(``),[C,w]=(0,S.useState)(1),[T,E]=(0,S.useState)(10),[D,O]=(0,S.useState)(1),[k,A]=(0,S.useState)(8),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)([]),[L,R]=(0,S.useState)(0),[z,B]=(0,S.useState)(``),[V,H]=(0,S.useState)([]),[U,W]=(0,S.useState)(0),[G,K]=(0,S.useState)(new Map),ee=(0,S.useMemo)(()=>new Set(i),[i]),te=(0,S.useMemo)(()=>new Set(r||[`image`,`video`,`audio`]),[JSON.stringify(r)]),ne=(0,S.useMemo)(()=>Array.from(G.values()).filter(e=>e.resourceType===`image`).length,[G]),re=(0,S.useMemo)(()=>Array.from(G.values()).filter(e=>e.resourceType===`video`).length,[G]),ie=(0,S.useMemo)(()=>Array.from(G.values()).filter(e=>e.resourceType===`video`).reduce((e,t)=>e+(t.durationSeconds||0),0),[G]),ae=(0,S.useMemo)(()=>Array.from(G.values()).filter(e=>e.resourceType===`audio`).length,[G]),q=(0,S.useMemo)(()=>Array.from(G.values()).filter(e=>e.resourceType===`audio`).reduce((e,t)=>e+(t.durationSeconds||0),0),[G]),oe=(0,S.useMemo)(()=>o!==void 0&&c!==void 0?o-c:1/0,[o,c]),se=(0,S.useMemo)(()=>s!==void 0&&l!==void 0?s-l:1/0,[s,l]),ce=(0,S.useMemo)(()=>u!==void 0&&d!==void 0?u-d:1/0,[u,d]),le=(0,S.useMemo)(()=>f!==void 0&&p!==void 0?f-p:1/0,[f,p]),ue=(0,S.useMemo)(()=>m!==void 0&&h!==void 0?m-h:1/0,[m,h]),de=(0,S.useMemo)(()=>ne>oe,[ne,oe]),fe=(0,S.useMemo)(()=>re>se,[re,se]),pe=(0,S.useMemo)(()=>ie>ce,[ie,ce]),me=(0,S.useMemo)(()=>ae>le,[ae,le]),he=(0,S.useMemo)(()=>q>ue,[q,ue]),ge=(0,S.useCallback)(async()=>{if(e){P(!0);try{let e=await J5({resourceType:v||void 0,keyword:b||void 0,page:C,pageSize:T,scene:`picker`});I(C===1?e.groups||[]:t=>[...t,...e.groups||[]]),R(e.totalDays||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),C===1&&I([]),R(0)}finally{P(!1)}}},[te,b,e,C,T,v]),_e=(0,S.useCallback)(async e=>{M(!0);try{let t=await Y5(e,{resourceType:v||void 0,keyword:b||void 0,page:D,pageSize:8,scene:`picker`});H((t.items||[]).filter(e=>te.has(e.resourceType))),W(t.total||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),H([]),W(0)}finally{M(!1)}},[te,b,D,k,v]);(0,S.useEffect)(()=>{e&&ge()},[e,C,ge]),(0,S.useEffect)(()=>{z&&O(1)},[z]),(0,S.useEffect)(()=>{z&&_e(z)},[z,D,_e]),(0,S.useEffect)(()=>{e&&K(new Map)},[e]),(0,S.useEffect)(()=>{e&&(y(_||``),w(1))},[e,_]);let ve=async e=>{if(ee.has(e.id)){Z.warning(`该素材已经在参考内容中`);return}let t=e,n=t.width||t.videoWidth||t.imageWidth||0,r=t.height||t.videoHeight||t.imageHeight||0;if(e.resourceType===`image`){if(n<=0||r<=0){let t=S7(e.previewUrl||e.displayUrl||e.resourceUrl);if(t){let e=await Nse(t);n=e.width,r=e.height}}if(n>0&&r>0){let t=C7(n,r);if(t){Z.error(`${e.fileName||`图片`}:${t}`);return}}}else if(e.resourceType===`video`&&n>0&&r>0){let t=w7(n,r);if(t){Z.error(`${e.fileName||`视频`}:${t}`);return}}K(t=>{let n=new Map(t);return n.has(e.id)?n.delete(e.id):n.set(e.id,e),n})},ye=()=>{let e=Array.from(G.values());if(e.length===0){Z.warning(`请先选择历史素材`);return}n(e),K(new Map),t()},be=(0,S.useMemo)(()=>[{label:`全部`,value:``},{label:`图片`,value:`image`},{label:`视频`,value:`video`},{label:`音频`,value:`audio`}].filter(e=>!e.value||te.has(e.value)),[te]);return(0,$.jsxs)(jG,{title:a,open:e,onCancel:t,width:1e3,centered:!0,destroyOnHidden:!0,footer:[(0,$.jsx)(X,{onClick:t,children:`取消`},`cancel`),(0,$.jsxs)(X,{type:`primary`,onClick:ye,style:{background:`#8b5cf6`},disabled:de||fe||pe||me||he,children:[`应用选择 (`,G.size,`)`]},`ok`)],children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsxs)(wV,{wrap:!0,children:[(0,$.jsx)(zC,{value:v,options:be,style:{width:120},onChange:e=>{y(e),w(1)}}),(0,$.jsx)($U,{allowClear:!0,value:b,prefix:(0,$.jsx)(PC,{}),placeholder:`搜索文件名`,style:{width:220},onChange:e=>x(e.target.value),onPressEnter:()=>{w(1),ge()}}),(0,$.jsx)(X,{icon:(0,$.jsx)(VK,{}),onClick:ge,children:`刷新`})]}),!g&&(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginTop:12,flexWrap:`wrap`},children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:de?`#ef4444`:`#64748b`,fontWeight:de?600:400},children:[`还可选取图片 `,ne,`/`,o!==void 0&&c!==void 0?o-c:`-`,` 张`]}),(0,$.jsxs)(`span`,{style:{fontSize:13,color:fe||pe?`#ef4444`:`#64748b`,fontWeight:fe||pe?600:400},children:[`视频还可选取 `,re,`/`,s!==void 0&&l!==void 0?s-l:`-`,` 个(`,ie.toFixed(1),`/`,u!==void 0&&d!==void 0?(u-d).toFixed(1):`-`,`秒)`]}),f!==void 0&&(0,$.jsxs)(`span`,{style:{fontSize:13,color:me||he?`#ef4444`:`#64748b`,fontWeight:me||he?600:400},children:[`音频还可选取 `,ae,`/`,f!==void 0&&p!==void 0?f-p:`-`,` 个(`,q.toFixed(1),`/`,m!==void 0&&h!==void 0?(m-h).toFixed(1):`-`,`秒)`]})]})]}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`240px 1fr`,gap:16,height:500},children:[(0,$.jsxs)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,background:`#fafafa`,overflowY:`auto`},children:[(0,$.jsx)(x7,{strong:!0,style:{fontSize:14},children:`日期列表`}),(0,$.jsx)(oG,{spinning:N,children:F.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`暂无日期`,style:{padding:`40px 0`}}):(0,$.jsxs)(`div`,{style:{marginTop:12},children:[F.map(e=>(0,$.jsxs)(`div`,{onClick:()=>B(e.generatedDate),style:{padding:`10px 12px`,borderRadius:10,marginBottom:6,cursor:`pointer`,border:z===e.generatedDate?`1px solid #8b5cf6`:`1px solid transparent`,background:z===e.generatedDate?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(`div`,{style:{fontSize:13,fontWeight:500,color:`#334155`},children:e.generatedDate}),(0,$.jsxs)(`div`,{style:{fontSize:12,color:`#94a3b8`,marginTop:4},children:[`共 `,e.total,` 个素材`]})]},e.generatedDate)),L>F.length&&(0,$.jsx)(`div`,{style:{marginTop:12,textAlign:`center`},children:(0,$.jsx)(X,{size:`small`,onClick:()=>w(C+1),children:`加载更多`})})]})})]}),(0,$.jsx)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,overflowY:`auto`},children:(0,$.jsx)(oG,{spinning:j,children:z?V.length===0?(0,$.jsx)(lC,{description:`该日期暂无可复用的历史上传素材`,style:{padding:`48px 0`}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(150px, 1fr))`,gap:14},children:V.map(e=>{let t=G.has(e.id),n=ee.has(e.id),r=Mse(e),i=n||!!r,a=e.previewUrl||e.displayUrl||e.resourceUrl,o=S7(e.resourceType===`image`?`static`+a+`?w=300&q=50`:a);return(0,$.jsxs)(`div`,{onClick:()=>!i&&ve(e),style:{position:`relative`,borderRadius:14,border:t?`2px solid #8b5cf6`:`1px solid #e2e8f0`,background:i?`#f8fafc`:`#fff`,opacity:i?.55:1,cursor:i?`not-allowed`:`pointer`,overflow:`hidden`,boxShadow:t?`0 10px 24px rgba(139, 92, 246, 0.18)`:`0 6px 18px rgba(15,23,42,0.06)`},title:r||void 0,children:[(0,$.jsx)(`div`,{style:{background:`#f1f5f9`},children:e.resourceType===`image`?(0,$.jsx)(`img`,{src:o,alt:e.fileName||e.id,style:{width:`100%`,height:130,objectFit:`cover`}}):e.resourceType===`video`?(0,$.jsx)(`video`,{src:o,muted:!0,style:{width:`100%`,height:130,objectFit:`cover`}}):(0,$.jsx)(b7,{src:o,size:`small`})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsxs)(wV,{size:6,style:{marginBottom:6},children:[(0,$.jsx)(SQ,{color:`purple`,icon:Pse(e.resourceType),style:{margin:0},children:Fse(e.resourceType)}),e.durationSeconds?(0,$.jsxs)(SQ,{style:{margin:0},children:[Number(e.durationSeconds).toFixed(1),`s`]}):null,r&&(0,$.jsx)(SQ,{color:`red`,style:{margin:0},children:`尺寸不符`})]}),(0,$.jsx)(x7,{ellipsis:!0,style:{display:`block`,fontSize:13,color:`#334155`},title:e.fileName||e.id,children:e.fileName||e.id}),(0,$.jsx)(x7,{type:`secondary`,style:{fontSize:12},children:e.moduleLabel||`普通上传`})]}),t&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,width:24,height:24,borderRadius:12,background:`#8b5cf6`,color:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(OC,{})}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8},children:(0,$.jsx)(SQ,{children:`已选`})}),r&&(0,$.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,background:`rgba(239, 68, 68, 0.9)`,color:`#fff`,padding:`4px 8px`,fontSize:11,textAlign:`center`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:r})]},e.id)})}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:16,paddingBottom:8},children:(0,$.jsx)(zW,{current:D,pageSize:k,total:U,showSizeChanger:!0,pageSizeOptions:[8],onChange:(e,t)=>{O(e),A(t)}})})]}):(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`请选择日期`,style:{padding:`80px 0`}})})})]})]})},T7=({children:e,accept:t=`image/*,video/*`,multiple:n=!0,onLocalSelect:r,onHistorySelect:i,onPortraitSelect:a,onPortraitLibrarySelect:o,uploading:s,tooltipTitle:c,maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,usedVideoDuration:p,maxVideoDuration:m,maxAudioCount:h,usedAudioCount:g,maxAudioDuration:_,usedAudioDuration:v,hideLimitHint:y,mediaType:b})=>{let x=(0,S.useRef)(null),[C,w]=(0,S.useState)(!1),[T,E]=(0,S.useState)(`real_person`),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(!1),N=()=>{A(!1),x.current?.click()},P=e=>{let t=e.target.files;t&&r&&r(Array.from(t)),x.current&&(x.current.value=``)},F=e=>{if(A(!1),a){E(e),w(!0);return}if(o){o(e);return}E(e),w(!0)},I=(0,$.jsxs)(`div`,{style:{padding:`4px 0`,minWidth:180},children:[(0,$.jsxs)(`div`,{onClick:()=>{N()},style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(vX,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`本地上传`})]}),(0,$.jsxs)(`div`,{onClick:()=>{A(!1),O(!0)},style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(S4,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`从资产中选择`})]}),b!==`image`&&(0,$.jsxs)(`div`,{onClick:()=>F(`real_person`),style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(L8,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`真人素材库`})]}),b!==`image`&&(0,$.jsxs)(`div`,{onClick:()=>F(`aigc_virtual`),style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(T8,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`虚拟素材库`})]})]});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:x,type:`file`,accept:t,multiple:n,onChange:P,style:{display:`none`}}),c?(0,$.jsx)(kw,{title:c,children:(0,$.jsx)(Lw,{content:I,open:k,onOpenChange:A,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})})}):(0,$.jsx)(Lw,{content:I,open:k,onOpenChange:A,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})}),(0,$.jsx)(Ise,{open:D,onClose:()=>O(!1),onSelect:e=>{i?.(e),O(!1)},allowedTypes:t.includes(`audio`)?[`image`,`video`,`audio`]:[`image`,`video`],maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,maxVideoDuration:m,usedVideoDuration:p,maxAudioCount:h,usedAudioCount:g,maxAudioDuration:_,usedAudioDuration:v,hideLimitHint:y,defaultResourceType:b===`image`?`image`:``}),(0,$.jsx)(y7,{open:C,libraryType:T,onClose:()=>w(!1),onSelect:e=>{a?.(e),w(!1)},accept:t,maxCount:t===`image/*`&&!n?1:void 0,maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,usedVideoDuration:p,maxVideoDuration:m})]})};function Lse(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}return`${Date.now().toString(16).padStart(12,`0`)}-${Math.random().toString(16).slice(2,10).padStart(8,`0`)}-4xxx-yxxx-${Math.random().toString(16).slice(2,12)}`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var Rse={prompt_processing:`optimizing`,ready:`prompt_optimized`,generating:`generating`,success:`completed`,failure:`failed`},zse=new Set([`pending`,`optimizing`,`generating`]),E7=new Set([`queued`,`preparing`,`creating_provider_task`,`provider_result_staged`,`waiting_remote`,`polling`,`result_ready`,`download_queued`,`downloading`,`retry_waiting`,`recovery_inconsistent`,`upscale_queued`,`upscale_processing`,`upscale_polling`,`upscale_downloading`,`upscale_finalizing`,`upscale_retry_waiting`]),D7=new Set([`completed`,`done`]),O7=new Set([`failed`,`timeout`,`download_failed`,`upscale_failed`]),Bse=new Set([...D7,...O7,`deleted`]),Vse={pending:`待处理`,optimizing:`提词处理中`,prompt_optimized:`待生成`,generating:`生成中`,queued:`生成中`,preparing:`生成中`,creating_provider_task:`生成中`,provider_result_staged:`生成中`,waiting_remote:`生成中`,polling:`生成中`,result_ready:`生成中`,download_queued:`生成中`,downloading:`生成中`,retry_waiting:`生成中`,recovery_inconsistent:`生成中`,upscale_queued:`生成中`,upscale_processing:`生成中`,upscale_polling:`生成中`,upscale_downloading:`生成中`,upscale_finalizing:`生成中`,upscale_retry_waiting:`生成中`,completed:`成功`,done:`成功`,timeout:`失败`,download_failed:`失败`,upscale_failed:`失败`,failed:`失败`,deleted:`已删除`},Hse={pending:`default`,optimizing:`processing`,prompt_optimized:`blue`,generating:`processing`,queued:`processing`,preparing:`processing`,creating_provider_task:`processing`,provider_result_staged:`processing`,waiting_remote:`processing`,polling:`processing`,result_ready:`processing`,download_queued:`processing`,downloading:`processing`,retry_waiting:`orange`,recovery_inconsistent:`orange`,upscale_queued:`purple`,upscale_processing:`purple`,upscale_polling:`purple`,upscale_downloading:`purple`,upscale_finalizing:`purple`,upscale_retry_waiting:`orange`,completed:`success`,done:`success`,failed:`error`,timeout:`error`,download_failed:`error`,upscale_failed:`error`,deleted:`default`},k7=e=>String(e||``).trim().toLowerCase(),Use=e=>{let t=k7(e);return Vse[t]||t||`未知状态`},Wse=e=>Hse[k7(e)]||`default`,A7=e=>{let t=k7(e.status),n=k7(e.displayStatus),r=k7(e.pipelineStage),i=Rse[k7(e.clientStatus)]||``,a=i||n||t||r||`pending`;O7.has(r)||O7.has(t)||O7.has(n)?a=O7.has(r)?r:O7.has(t)?t:n:D7.has(t)||D7.has(n)?a=D7.has(t)?t:n:!i&&r&&E7.has(r)&&(a=r);let o=O7.has(a),s=D7.has(a),c=typeof e.shouldPoll==`boolean`?e.shouldPoll:!o&&!s&&(zse.has(t)||E7.has(r)),l=c;return{status:t,displayStatus:n,pipelineStage:r,effectiveKey:a,label:Use(a),color:Wse(a),isActive:l,isSuccess:s,isFailure:o,isTerminal:Bse.has(a),canGenerate:typeof e.canGenerate==`boolean`?e.canGenerate:t===`prompt_optimized`,canRetry:typeof e.canRetry==`boolean`?e.canRetry:o,shouldPoll:c}},j7=({label:e,value:t,options:n,suffix:r,expanded:i,onToggle:a,onSelect:o,onClose:s})=>{let c=(0,S.useRef)(null),l=(0,S.useRef)(null),u=(0,S.useRef)(i),[d,f]=(0,S.useState)(null);return u.current=i,(0,S.useEffect)(()=>{if(i&&c.current){let e=c.current.getBoundingClientRect();f({bottom:window.innerHeight-e.top+4,left:e.left,width:Math.max(e.width,100)})}else f(null)},[i]),(0,S.useEffect)(()=>{if(!i)return;let e=e=>{c.current?.contains(e.target)||l.current?.contains(e.target)||u.current&&s()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i,s]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:c,onClick:a,translate:`no`,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,cursor:`pointer`,userSelect:`none`,transition:`background 0.2s, border-color 0.2s`,background:`#fff`,border:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:`#374151`,fontWeight:500,lineHeight:`18px`},children:[t,r]}),(0,$.jsx)(xZ,{style:{fontSize:9,color:`#94a3b8`,transition:`transform 0.2s`,transform:i?`rotate(180deg)`:`rotate(0deg)`}})]}),d&&(0,Vi.createPortal)((0,$.jsxs)(`div`,{ref:l,style:{position:`fixed`,bottom:d.bottom,left:d.left,minWidth:d.width,maxHeight:200,overflowY:`auto`,background:`#fff`,borderRadius:12,padding:6,zIndex:99999,boxShadow:`0 8px 30px rgba(0,0,0,0.12)`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:10,color:`#94a3b8`,display:`block`,padding:`2px 6px 4px`},children:e}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:n.map((e,n)=>{let r=t===e;return(0,$.jsx)(`div`,{onClick:()=>{o(e),s()},style:{padding:`6px 10px`,borderRadius:8,fontSize:13,cursor:`pointer`,transition:`all 0.15s`,background:r?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:r?`#fff`:`#1a1a2e`,fontWeight:r?600:400},onMouseEnter:e=>{r||(e.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:e},n)})})]}),document.body)]})},Gse=({group:e,groupName:t,selected:n,expanded:r,onToggle:i,onSelect:a,onClose:o})=>{let s=(0,S.useRef)(null),c=(0,S.useRef)(null),l=(0,S.useRef)(r),[u,d]=(0,S.useState)(null);return l.current=r,(0,S.useEffect)(()=>{if(r&&s.current){let e=s.current.getBoundingClientRect();d({bottom:window.innerHeight-e.top+4,left:e.left})}else d(null)},[r]),(0,S.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||c.current?.contains(e.target)||l.current&&o()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r,o]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:s,onClick:()=>i(t),style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,cursor:`pointer`,userSelect:`none`,transition:`background 0.2s, border-color 0.2s`,background:`#ffffffff`,border:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#374151`,fontWeight:500,lineHeight:`18px`},children:n||e.name}),(0,$.jsx)(xZ,{style:{fontSize:9,color:`#94a3b8`,transition:`transform 0.2s`,transform:r?`rotate(180deg)`:`rotate(0deg)`}})]}),u&&(0,Vi.createPortal)((0,$.jsxs)(`div`,{ref:c,style:{position:`fixed`,bottom:u.bottom,left:u.left,background:`#fff`,borderRadius:12,padding:8,minWidth:160,zIndex:99999,boxShadow:`0 8px 30px rgba(0,0,0,0.12)`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:10,color:`#94a3b8`,display:`block`,padding:`2px 6px 4px`},children:e.name}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:e.options.map((e,r)=>{let i=n===e;return(0,$.jsx)(`div`,{onClick:()=>{a(e,t),o()},style:{padding:`6px 10px`,borderRadius:8,fontSize:13,cursor:`pointer`,transition:`all 0.15s`,background:i?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:i?`#fff`:`#1a1a2e`,fontWeight:i?600:400},onMouseEnter:e=>{i||(e.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:e=>{i||(e.currentTarget.style.background=`transparent`)},children:e},r)})})]}),document.body)]})},M7=({src:e,width:t=48,height:n=48})=>{let[r,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(null);return(0,S.useEffect)(()=>{let r=document.createElement(`video`);r.muted=!0,r.preload=`metadata`,r.crossOrigin=`anonymous`;let a=()=>{o(r.duration),r.currentTime=Math.min(1,r.duration*.1)},s=()=>{try{let e=document.createElement(`canvas`);e.width=t*2,e.height=n*2;let a=e.getContext(`2d`);a&&(a.drawImage(r,0,0,e.width,e.height),i(e.toDataURL(`image/jpeg`,.7)))}catch{}};return r.addEventListener(`loadedmetadata`,a),r.addEventListener(`seeked`,s),r.src=e,()=>{r.removeEventListener(`loadedmetadata`,a),r.removeEventListener(`seeked`,s)}},[e,t,n]),(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,position:`relative`,background:`#1a1a2e`},children:[r?(0,$.jsx)(`img`,{src:r,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(K6,{style:{color:`#fff`,fontSize:18}})}),a!=null&&(0,$.jsx)(`span`,{style:{position:`absolute`,bottom:2,right:2,fontSize:9,color:`#fff`,background:`rgba(0,0,0,0.6)`,borderRadius:4,padding:`1px 4px`,lineHeight:1.3},children:(e=>`${Math.round(e)}s`)(a)})]})},Kse=()=>{let{projectId:e}=$e(),t=Ye(),[n]=vH.useForm(),{projects:r,records:i,fetchProjects:a,fetchRecords:o,optimizePrompt:s,generateVideo:c,retryGeneration:l}=u7(),u=i.items,{user:d,optimizeHoldCredits:f}=e7(),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(!1),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(``),[x,C]=(0,S.useState)(!1),[w,T]=(0,S.useState)({}),[E,D]=(0,S.useState)({}),[O,k]=(0,S.useState)({}),[A,j]=(0,S.useState)({}),[M,N]=(0,S.useState)({}),P=(0,S.useRef)(null),F=(0,S.useCallback)(e=>{if(!e)return 0;let t=new Date(e).getTime(),n=(Date.now()-t)/1e3;return n>=180?99:Math.min(99,n*.6)},[]);(0,S.useEffect)(()=>{let e=Object.entries(E).filter(([,e])=>e===`generating`).map(([e])=>e);if(e.length===0){P.current&&=(clearInterval(P.current),null);return}let t=()=>{e.forEach(e=>{let t=u7.getState().records.items.find(t=>t.id===e);if(t?.createdAt){let n=F(t.createdAt);k(t=>({...t,[e]:n})),j(t=>({...t,[e]:n}))}})};return t(),P.current=window.setInterval(t,1e3),()=>{P.current&&=(clearInterval(P.current),null)}},[E,F]),(0,S.useEffect)(()=>{Object.entries(E).forEach(([e,t])=>{if(t===`done`&&!M[e]){N(t=>({...t,[e]:!0}));let t=A[e]||0,n=Date.now(),r=()=>{let i=Date.now()-n,a=Math.min(i/800,1),o=1-(1-a)**3,s=t+(100-t)*o;j(t=>({...t,[e]:s})),a<1&&requestAnimationFrame(r)};requestAnimationFrame(r)}})},[E]),(0,S.useEffect)(()=>{Object.entries(E).forEach(([e,t])=>{if(t===`generating`){let t=u7.getState().records.items.find(t=>t.id===e);if(t?.createdAt){let n=F(t.createdAt);k(t=>({...t,[e]:n})),j(t=>({...t,[e]:n}))}}})},[_]);let[I,L]=(0,S.useState)({}),[R,z]=(0,S.useState)(null),[B,V]=(0,S.useState)(null),[H,U]=(0,S.useState)([]),[W,G]=(0,S.useState)(!1),[K,ee]=(0,S.useState)(``),[te,ne]=(0,S.useState)(!1),[re,ie]=(0,S.useState)(``),ae=(0,S.useRef)(null),[q,oe]=(0,S.useState)({}),[se,ce]=(0,S.useState)({}),[le,ue]=(0,S.useState)({}),[de,fe]=(0,S.useState)(null),[pe,me]=(0,S.useState)(null),[he,ge]=(0,S.useState)(5),[_e,ve]=(0,S.useState)(`9:16`),[ye,be]=(0,S.useState)(`720p`),[xe,Se]=(0,S.useState)([]),[Ce,we]=(0,S.useState)([]),[Te,Ee]=(0,S.useState)(``),[De,Oe]=(0,S.useState)(!1),[ke,Ae]=(0,S.useState)(null),[je,Me]=(0,S.useState)(!1),[Ne,Pe]=(0,S.useState)({ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`720p`,`1080p`],durations:[5,8,10,12,15]});(0,S.useMemo)(()=>Ne.durations.map(e=>`${e}`),[Ne.durations]),(0,S.useCallback)(()=>{Ae(e=>e===`duration`?null:`duration`)},[]),(0,S.useCallback)(()=>{Ae(null)},[]);let Fe=(0,S.useCallback)(e=>{fe(t=>t===e?null:e)},[]),Ie=(0,S.useCallback)(()=>{fe(null)},[]);(0,S.useCallback)(e=>{ge(parseInt(e))},[]);let Le=(0,S.useCallback)((e,t)=>{ue(n=>{let r={...n};return r[t]===e?delete r[t]:r[t]=e,r})},[]),[Re,ze]=(0,S.useState)(0),[Be,Ve]=(0,S.useState)(0),[He,Ue]=(0,S.useState)(`video`),[We,Ge]=(0,S.useState)(`1:1`),[Ke,qe]=(0,S.useState)(`2K`),[Je,Xe]=(0,S.useState)(2048),[Ze,Qe]=(0,S.useState)(2048),[et,tt]=(0,S.useState)(!1),[nt,rt]=(0,S.useState)([]),[it,at]=(0,S.useState)([]),[ot,st]=(0,S.useState)([]),ct=(e,t)=>{if(e<300||e>6e3)return`图片宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`图片高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;return n<.4||n>2.5?`图片宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`:null},lt=(e,t)=>{if(e<300||e>6e3)return`视频宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`视频高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;if(n<.4||n>2.5)return`视频宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`;let r=e*t;return r<409600?`视频总像素数过小(${e}×${t}=${r}),需 ≥ 640×640=409600`:r>8295044?`视频总像素数过大(${e}×${t}=${r}),需 ≤ 3326×2494=8295044`:null},ut=async e=>{let t=e.type.startsWith(`image/`),n=e.type.startsWith(`video/`);if(!t&&!n)return Z.error(`仅支持图片或视频文件`),!1;let r=n?100:10;if(e.size/1024/1024>r)return Z.error(`${n?`视频`:`图片`}大小不能超过${r}MB`),!1;let i=H.filter(e=>e.type===`image`).length,a=H.filter(e=>e.type===`video`).length,o=H.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(t&&i>=5)return Z.error(`最多上传5张图片`),!1;if(n&&a>=2)return Z.error(`最多上传2个视频`),!1;let s=0;if(n){let t=await new Promise(t=>{let n=document.createElement(`video`);n.preload=`metadata`,n.onloadedmetadata=()=>{t({duration:n.duration||0,width:n.videoWidth||0,height:n.videoHeight||0}),n.remove()},n.onerror=()=>{t({duration:0,width:0,height:0}),n.remove()},n.src=URL.createObjectURL(e)});if(s=t.duration,t.width>0&&t.height>0){let e=lt(t.width,t.height);if(e)return Z.error(`${e}`),!1}if(o+s>15)return Z.error(`视频总时长不能超过15秒`),!1}else{let t=await new Promise(t=>{let n=document.createElement(`img`);n.onload=()=>{t({width:n.width,height:n.height}),URL.revokeObjectURL(n.src)},n.onerror=()=>{t({width:0,height:0}),URL.revokeObjectURL(n.src)},n.src=URL.createObjectURL(e)});if(t.width>0&&t.height>0){let e=ct(t.width,t.height);if(e)return Z.error(`${e}`),!1}}G(!0);try{let r;r=t?await l5(e):await u5(e,s);let o=t?`图片`:`视频`,c=t?i+1:a+1;U(e=>[...e,{url:r.url,type:t?`image`:`video`,name:`${o}${c}`,duration:n?s:void 0}]),Z.success(`${o}上传成功`)}catch{Z.error(`上传失败`)}finally{G(!1)}return!1};(0,S.useEffect)(()=>{if(eoe().then(e=>{rt(e.video),st(e.image)}),O5().then(e=>{at(e)}),!et&&!je)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&(tt(!1),Me(!1))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[et,je]);let dt=e=>{let t=Array.isArray(e)?e:[];return{inputImageCount:t.filter(e=>e.type===`image`).length,inputVideoDuration:t.filter(e=>e.type===`video`).reduce((e,t)=>e+Number(t.duration||0),0)}},ft=()=>{let e={};if(e=it.find(e=>e.modelConfigId===(_?.engineId||Te)&&e.genType===He&&e.resolution===(He===`video`?_?.resolution||ye:_?.imageSize||Ke)),e||=He===`video`?{perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0}:{perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},He===`video`){let t=((_?.duration||he)*e.perSecondCredits+e.baseCredits)*e.ratio;if(_?.includeMediaReferences??De){let n=dt(_?.references||H);if(n.inputVideoDuration>0){let r=((e.inputVideoBaseCredits||0)+(e.inputVideoPerSecondCredits||0)*n.inputVideoDuration)*(e.inputVideoRatio||1);t+=r}if(n.inputImageCount>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n.inputImageCount)*(e.inputImageRatio||1);t+=r}}return Number(t.toFixed(2))}else{let t=e.baseCredits*e.ratio;if(_?.includeMediaReferences??De){let n=dt(_?.references||H);if(n.inputImageCount>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n.inputImageCount)*(e.inputImageRatio||1);t+=r}}return Number(t.toFixed(2))}},pt=e=>{let t=e.genType||e.gen_type||`video`,n=e.engineId||e.engine_id,r=e.resolution,i=Number(e.duration||0),a=e.imageSize||e.image_size,o=e.includeMediaReferences??e.include_media_references??!1,s=e.references||[],c=it.find(e=>e.modelConfigId===n&&e.genType===t&&e.resolution===(t===`video`?r:a));c||=t===`video`?{perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0}:{perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0};let l=0;if(t===`video`){if(l=(i*c.perSecondCredits+c.baseCredits)*c.ratio,o){let e=dt(s);if(e.inputVideoDuration>0){let t=((c.inputVideoBaseCredits||0)+(c.inputVideoPerSecondCredits||0)*e.inputVideoDuration)*(c.inputVideoRatio||1);l+=t}if(e.inputImageCount>0){let t=((c.inputImageBaseCredits||0)+(c.inputImagePerImageCredits||0)*e.inputImageCount)*(c.inputImageRatio||1);l+=t}}}else if(l=c.baseCredits*c.ratio,o){let e=dt(s);if(e.inputImageCount>0){let t=((c.inputImageBaseCredits||0)+(c.inputImagePerImageCredits||0)*e.inputImageCount)*(c.inputImageRatio||1);l+=t}}return Number(l.toFixed(2))},mt=e=>{Ct(e);let t=Et[Ke]?.[e];if(t){let[e,n]=t.split(/x/i).map(Number);Xe(e),Qe(n)}},ht=e=>{Tt(e);let t=Object.keys(Et[e]||{});_t(t.map(e=>({value:e,label:e})));let n=t.includes(We)?We:t[0]||`1:1`;n!==We&&Ge(n);let r=Et[e]?.[n];if(r){let[e,t]=r.split(/x/i).map(Number);Xe(e),Qe(t)}},[gt,_t]=(0,S.useState)([]),[vt,yt]=(0,S.useState)([]),[bt,xt]=(0,S.useState)([]),[St,Ct]=(0,S.useState)(0),[wt,Tt]=(0,S.useState)(0),[Et,Dt]=(0,S.useState)({});(0,S.useEffect)(()=>{bt[wt]&&bt[wt][St]!==void 0&&(Xe(bt[wt][St].substring(0,4)),Qe(bt[wt][St].substring(5)))},[St]),(0,S.useEffect)(()=>{bt[wt]&&bt[wt][St]!==void 0&&(Xe(bt[wt][St].substring(0,4)),Qe(bt[wt][St].substring(5)))},[wt]);let Ot=()=>{Xe(Ze),Qe(Je)},kt=e=>{let t=e.target.value===`image`?`image`:`video`;Ue(t);let n=(t===`image`?Ce:xe).filter(e=>e.supportsUniversalReference!==!1);n.length>0&&jt(n[0].id)};(0,S.useEffect)(()=>{b5().then(e=>{oe(Object.fromEntries(e.map(e=>[e.key,e.label]))),ce(Object.fromEntries(e.map(e=>[e.key,e.optionGroups||[]])))}).catch(()=>{}),Wae().then(e=>{let t=e.items||[];we(t);let n=t?.[0]?.supportedSizes||{};Dt(n);let r=Object.keys(n);yt(r.map(e=>({value:e,label:e})));let i=r.includes(Ke)?Ke:r[0]||`2K`,a=Object.keys(n[i]||{});_t(a.map(e=>({value:e,label:e})));let o=a.includes(We)?We:a[0]||`1:1`;o!==We&&Ge(o);let s=n[i]?.[o];if(s){let[e,t]=s.split(/x/i).map(Number);Xe(e),Qe(t)}}).catch(()=>{}),Uae().then(e=>{if(Se(e.items||[]),e.items?.length){let t=e.items[0];Ee(e=>e||t.id),Pe({ratios:t.supportedRatios?.length?t.supportedRatios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:t.supportedResolutions?.length?t.supportedResolutions:[`720p`,`1080p`],durations:t.supportedDurations?.length?t.supportedDurations:[5,8,10,12,15]})}}).catch(()=>{})},[]),(0,S.useEffect)(()=>{if(!_)return;let e=_.genType||He,t=e===`image`?Ce:xe,n=_.engineId||``,r=t.find(e=>e.id===n)||t[0];if(r)if(Ee(r.id),e===`image`){let e=r.supportedSizes||{};Dt(e);let t=Object.keys(e),n=t.includes(_.imageSize||``)?_.imageSize:t[0]||_.imageSize||`2K`;qe(n);let i=Object.keys(e[n]||{}),a=i.includes(_.imageProportion||``)?_.imageProportion:i[0]||_.imageProportion||`1:1`;Ge(a);let o=e[n]?.[a]||_.imagePx||``;if(o){let[e,t]=String(o).split(/x/i).map(Number);e>0&&t>0&&(Xe(e),Qe(t))}}else Pe({ratios:r.supportedRatios?.length?r.supportedRatios:[`16:9`],resolutions:r.supportedResolutions?.length?r.supportedResolutions:[`720p`],durations:r.supportedDurations?.length?r.supportedDurations:[5]}),r.supportedRatios?.includes(_e)||ve(r.supportedRatios?.[0]||`16:9`),r.supportedResolutions?.includes(ye)||be(r.supportedResolutions?.[0]||`720p`),r.supportedDurations?.includes(he)||ge(r.supportedDurations?.[0]||_.duration||5);Oe(!!_.includeMediaReferences)},[_?.id,_?.engineId,xe,Ce]);let At=e=>{let t=xe.find(t=>t.id===e)||xe[0];return{ratios:t?.supportedRatios?.length?t.supportedRatios:[`16:9`],resolutions:t?.supportedResolutions?.length?t.supportedResolutions:[`720p`],durations:t?.supportedDurations?.length?t.supportedDurations:[5]}},jt=e=>{Ee(e);let t=(He===`image`?Ce:xe).find(t=>t.id===e);if(!t)return;if(He===`image`){let e=t.supportedSizes||{};Dt(e);let n=Object.keys(e);yt(n.map(e=>({value:e,label:e})));let r=n.includes(Ke)?Ke:n[0]||`2K`,i=Object.keys(e[r]||{});_t(i.map(e=>({value:e,label:e})));let a=i.includes(We)?We:i[0]||`1:1`;qe(r),Ge(a);let o=e[r]?.[a]||``;if(o){let[e,t]=String(o).split(/x/i).map(Number);e>0&&t>0&&(Xe(e),Qe(t))}return}let n=At(e);Pe(n),ve(n.ratios[0]),be(n.resolutions[0]),ge(n.durations[0])};(0,S.useEffect)(()=>{a(),o({projectId:e,page:1,pageSize:100})},[e,a,o]);let Mt=(0,S.useRef)(!1);(0,S.useEffect)(()=>{Mt.current||u.length===0||(Mt.current=!0,u.forEach(t=>{t.projectId===e&&t.status===`generating`&&(D(e=>({...e,[t.id]:`generating`})),rn(t.id)),t.projectId===e&&t.status===`optimizing`&&Bt(t.id)}))},[u,e]);let Nt=(0,S.useRef)(new Set),Pt=(0,S.useRef)(null),Ft=(0,S.useRef)(null),It=e=>{Nt.current.add(e),zt()},Lt=e=>{Nt.current.delete(e),Nt.current.size===0&&Rt()},Rt=()=>{Pt.current&&=(clearInterval(Pt.current),null),Ft.current&&=(Ft.current.abort(),null)},zt=()=>{Pt.current||=setInterval(async()=>{try{Ft.current&&Ft.current.abort();let t=new AbortController;Ft.current=t;let n=await s5({projectId:e,page:1,pageSize:100,signal:t.signal});Ft.current=null;let r=Array.from(Nt.current),i=[];if(r.length>0){let e=u7.getState().records,t=e.items.map(e=>{if(r.includes(e.id)){let t=n.items.find(t=>t.id===e.id);if(t)return t.status!==`optimizing`&&i.push(e.id),t}return e});u7.setState({records:{...e,items:t}}),i.forEach(e=>{Lt(e)})}}catch(e){e.name}},3e3)},Bt=e=>{It(e)},Vt=(0,S.useRef)(!1),Ht=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(Vt.current||u.length===0)return;let t=localStorage.getItem(`pending_optimize`);if(t)try{let{key:n,projectId:r,prompt:i,duration:a,engineId:o,genType:s,aspectRatio:c,resolution:l,imageSize:d,imageProportion:f,imagePx:p,includeMediaReferences:m,referenceIds:h,ts:_}=JSON.parse(t);if(Date.now()-_>300*1e3||r!==e){localStorage.removeItem(`pending_optimize`);return}if(Ht.current===n)return;let y=u.find(e=>e.projectId===r&&e.originalPrompt===i&&e.duration===a&&e.engineId===o&&String(e.genType||`video`)===String(s||`video`)&&String(e.aspectRatio||``)===String(c||``)&&String(e.resolution||``)===String(l||``)&&String(e.imageSize||``)===String(d||``)&&String(e.imageProportion||``)===String(f||``)&&String(e.imagePx||``)===String(p||``)&&!!e.includeMediaReferences==!!m&&JSON.stringify((e.references||[]).map(e=>e.upload_resource_id||e.url).filter(Boolean).sort())===JSON.stringify((h||[]).slice().sort())&&e.status===`prompt_optimized`&&new Date(e.createdAt).getTime()>_-1e4);y?(Vt.current=!0,localStorage.removeItem(`pending_optimize`),v(y),b(y.optimizedPrompt||``),ze(y.textCreditsCost),Ve(y.textTokensUsed),g(!0),Z.success({content:`优化请求已恢复,消耗 ${y.textCreditsCost} 积分`,key:`recovery`})):Date.now()-_>3e4&&localStorage.removeItem(`pending_optimize`)}catch{localStorage.removeItem(`pending_optimize`)}},[u,e]);let Ut=r.find(t=>t.id===e),Wt=u.filter(t=>t.projectId===e),Gt=Ut?.name??`项目`,Kt=(0,S.useMemo)(()=>Ut&&se[Ut.industry]||[],[Ut,se]),qt=d?.credits??0,Jt=qt>=ft(),Yt=async()=>{try{if(!e){Z.error(`项目ID为空,请先选择项目`);return}let t=await n.validateFields();if(!t.prompt||!t.prompt.trim()){Z.error(`请输入视频/图片描述`);return}if(!Te){Z.error(`请选择生成引擎`);return}if(He===`video`&&(!_e||!ye)){Z.error(`请选择视频比例和分辨率`);return}m(!0);let r=Object.entries(le).map(([e,t])=>`@${e}:${t}`),i=r.length>0?`${t.prompt}\n\n${r.join(`;`)}`:t.prompt,a=Lse();localStorage.setItem(`pending_optimize`,JSON.stringify({key:a,projectId:e,prompt:i,duration:he,engineId:Te,genType:He,aspectRatio:He===`video`?_e:``,resolution:He===`video`?ye:``,imageSize:He===`image`?Ke:``,imageProportion:He===`image`?We:``,imagePx:He===`image`?`${Je}x${Ze}`:``,includeMediaReferences:De,referenceIds:H.map(e=>e.upload_resource_id||e.url).filter(Boolean).sort(),ts:Date.now()})),Ht.current=a;let o=await s(e,{prompt:i,duration:He===`video`?he:void 0,genType:He,engineId:Te,includeMediaReferences:De,aspectRatio:He===`video`?_e:void 0,resolution:He===`video`?ye:void 0,references:H.length>0?H:void 0,idempotencyKey:a,image_size:He===`image`?Ke:void 0,image_proportion:He===`image`?We:void 0,image_px:He===`image`?Je+`x`+Ze:void 0});localStorage.removeItem(`pending_optimize`),Ht.current=null,v(o.record),b(o.record.optimizedPrompt||``),ze(o.textCreditsCost),Ve(o.textTokensUsed),g(!0),Z.success({content:`「${Gt}」提示词优化完成,消耗 ${o.textCreditsCost} 积分`,key:`optimize`})}catch(e){let t=e?.response?.data?.message||e?.message||`操作失败,请稍后重试`;Z.error(t)}finally{m(!1),localStorage.removeItem(`pending_optimize`),Ht.current=null}},Xt=(0,S.useRef)(new Set),Zt=(0,S.useRef)(null),Qt=(0,S.useRef)(null),$t=e=>{Xt.current.add(e),nn()},en=e=>{Xt.current.delete(e),Xt.current.size===0&&tn()},tn=()=>{Zt.current&&=(clearInterval(Zt.current),null),Qt.current&&=(Qt.current.abort(),null)},nn=()=>{Zt.current||=setInterval(async()=>{try{Qt.current&&Qt.current.abort();let t=new AbortController;Qt.current=t;let n=await s5({projectId:e,page:1,pageSize:100,signal:t.signal});Qt.current=null;let r=Array.from(Xt.current),i=[];if(r.length>0){let e=u7.getState().records,t=e.items.map(e=>{if(r.includes(e.id)){let t=n.items.find(t=>t.id===e.id);if(t){let n=E[e.id];return t.shouldPoll??t.status===`generating`?n!==`generating`&&D(t=>({...t,[e.id]:`generating`})):i.push(e.id),t}}return e});u7.setState({records:{...e,items:t}}),i.forEach(e=>{let t=n.items.find(t=>t.id===e);en(e),t?.status===`completed`?(D(t=>({...t,[e]:`done`})),v(n=>n?.id===e?t:n),Z.success({content:`「${Gt}」视频生成完成!`,key:e,duration:5})):t?.status===`failed`&&(D(t=>({...t,[e]:`failed`})),v(n=>n?.id===e?t:n),Z.error({content:`「${Gt}」视频生成失败: ${t.errorMessage||`未知错误`}`,key:e,duration:5}))})}}catch(e){e.name}},5e3)},rn=e=>{$t(e)};(0,S.useEffect)(()=>()=>{tn(),Rt()},[]),(0,S.useEffect)(()=>{u.filter(e=>e.shouldPoll??e.status===`generating`).forEach(e=>{D(t=>({...t,[e.id]:`generating`})),rn(e.id)})},[u]);let an=async e=>{T(t=>({...t,[e]:!0})),D(t=>({...t,[e]:`generating`})),Z.loading({content:`「${Gt}」正在提交视频生成...`,duration:0,key:e});try{let t=Wt.find(t=>t.id===e)||_;if(!t||t.canGenerate===!1)throw Error(t?.configFallbackHint||`该记录当前不可生成,请重新生成提词`);let n=t.id===_?.id?y:I[e];n&&n!==t.optimizedPrompt&&await p5(e,n),(await c(e)).status===`failed`?(D(t=>({...t,[e]:`failed`})),Z.error({content:`「${Gt}」提交失败`,key:e,duration:3})):(Z.success({content:`「${Gt}」已提交,正在生成中...`,key:e,duration:3}),rn(e))}catch(t){D(t=>({...t,[e]:`failed`}));let n=`提交失败`;t?.response?.data?.detail?n=t.response.data.detail:t?.data?.detail?n=t.data.detail:t?.detail?n=t.detail:t?.message&&(n=t.message),Z.error({content:`${n}`,key:e,duration:3})}finally{T(t=>({...t,[e]:!1}))}},on=e=>{let t=E[e.id];return A7({status:(t===`done`?`completed`:t)||e.status,pipelineStage:t?null:e.pipelineStage,clientStatus:t?null:e.clientStatus,shouldPoll:t?t===`generating`:e.shouldPoll,canGenerate:e.canGenerate,canRetry:e.canRetry})},sn=e=>e.isActive?(0,$.jsx)(Xm,{style:{animation:`spinSlow 1s linear infinite`}}):e.isSuccess?(0,$.jsx)(B2,{}):e.isFailure?(0,$.jsx)(U2,{}):(0,$.jsx)(TB,{});return(0,$.jsxs)(`div`,{style:{margin:`-24px -32px -32px`,borderRadius:20,height:`calc(100vh - 8px)`,padding:`24px`,background:`#fff`,overflowY:`auto`},children:[(0,$.jsxs)(`div`,{className:`gen-header animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:24,padding:`16px 24px`,borderRadius:16,background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(99, 102, 241, 0.08)`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(X,{icon:(0,$.jsx)(q0,{}),onClick:()=>t(`/projects`),style:{borderRadius:10,fontSize:13,height:32,background:`rgba(99, 102, 241, 0.1)`,border:`1px solid rgba(99, 102, 241, 0.2)`,color:`#6366f1`},children:`返回`}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #6366f1, #8b5cf6, transparent)`,borderRadius:1}}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0,fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:Gt}),Ut&&(0,$.jsx)(SQ,{style:{background:`rgba(99, 102, 241, 0.08)`,border:`1px solid rgba(99, 102, 241, 0.15)`,color:`#6366f1`,borderRadius:6},children:q[Ut.industry]||Ut.industry})]}),(0,$.jsx)(Q.Text,{style:{color:`#64748b`,fontSize:13},children:`描述视频 → AI优化 → 生成视频`})]}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #8b5cf6, #6366f1, transparent)`,borderRadius:1}})]}),(0,$.jsxs)(SQ,{style:{background:`rgba(99, 102, 241, 0.08)`,border:`1px solid rgba(99, 102, 241, 0.15)`,color:`#6366f1`,borderRadius:20,fontSize:13,padding:`4px 14px`},children:[`剩余 `,qt,` 积分`]})]}),!h&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`animate-fadeInUp`,style:{marginBottom:24,padding:`16px 20px`,borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,boxShadow:`0 2px 12px rgba(0,0,0,0.03)`},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`flex-start`},children:[(0,$.jsxs)(`div`,{style:{marginRight:70,position:`relative`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:14,fontWeight:500,color:`#475569`,marginRight:16},children:`生成类型:`}),(0,$.jsxs)(LF.Group,{defaultValue:`video`,buttonStyle:`solid`,onChange:kt,children:[(0,$.jsxs)(LF.Button,{value:`video`,children:[(0,$.jsx)(z8,{style:{marginRight:6,fontSize:14}}),` `,`视频`]}),(0,$.jsxs)(LF.Button,{value:`image`,style:{zIndex:0},children:[(0,$.jsx)(L6,{style:{marginRight:6,fontSize:14}}),` `,`图片`]})]})]}),He===`video`&&[{icon:(0,$.jsx)(i$,{}),label:`描述视频+时长`,color:`#6366f1`},{icon:(0,$.jsx)(D8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(t8,{}),label:`选择参数生成`,color:`#10b981`}].map((e,t)=>(0,$.jsxs)(S.Fragment,{children:[t>0&&(0,$.jsx)(`div`,{style:{width:40,height:1,background:`linear-gradient(90deg, #e2e8f0, #cbd5e1, #e2e8f0)`,margin:`0 12px`,flexShrink:0}}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:10,background:`${e.color}12`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`span`,{style:{color:e.color,fontSize:15},children:e.icon})}),(0,$.jsx)(Q.Text,{style:{fontSize:13,fontWeight:500,color:`#1a1a2e`},children:e.label})]})]},t)),He===`image`&&[{icon:(0,$.jsx)(i$,{}),label:`描述图片+尺寸`,color:`#6366f1`},{icon:(0,$.jsx)(D8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(t8,{}),label:`图片生成`,color:`#10b981`}].map((e,t)=>(0,$.jsxs)(S.Fragment,{children:[t>0&&(0,$.jsx)(`div`,{style:{width:40,height:1,background:`linear-gradient(90deg, #e2e8f0, #cbd5e1, #e2e8f0)`,margin:`0 12px`,flexShrink:0}}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:10,background:`${e.color}12`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`span`,{style:{color:e.color,fontSize:15},children:e.icon})}),(0,$.jsx)(Q.Text,{style:{fontSize:13,fontWeight:500,color:`#1a1a2e`},children:e.label})]})]},t))]})}),(0,$.jsxs)(vH,{form:n,initialValues:{},children:[(0,$.jsx)(vH.Item,{name:`prompt`,noStyle:!0,rules:[{required:!0,message:`请输入视频描述`}],style:{display:`none`}}),(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{borderRadius:20,background:`#fff`,border:`1px solid #f0f0f5`,boxShadow:`0 4px 24px rgba(0,0,0,0.04)`,overflow:`visible`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`12px 16px 0`,minHeight:60},children:[H.map((e,t)=>(0,$.jsxs)(`div`,{className:`ref-thumb`,style:{position:`relative`,width:48,height:48,borderRadius:12,overflow:`visible`,flexShrink:0},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:12,overflow:`hidden`,border:`1px solid #e2e8f0`,cursor:`pointer`},onClick:()=>{e.type===`video`&&me(`https://ceshi.apiforeign.minzhongzc.com${e.url}`)},children:e.type===`image`?(0,$.jsx)(vU,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):(0,$.jsx)(M7,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`})}),(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),f5(e.url).catch(()=>{}),U(e=>e.filter((e,n)=>n!==t))},style:{position:`absolute`,top:-4,right:-4,width:16,height:16,borderRadius:`50%`,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,zIndex:10,opacity:0,transition:`opacity 0.15s`,backdropFilter:`blur(4px)`},children:(0,$.jsx)(U2,{style:{color:`#fff`,fontSize:10}})})]},t)),(0,$.jsx)(T7,{accept:`image/*,video/*`,mediaType:He,onLocalSelect:e=>{e.forEach(async e=>{await ut(e)})},onHistorySelect:e=>{e.forEach(e=>{U(t=>[...t,{url:e.resourceUrl||e.previewUrl||e.displayUrl||``,type:e.resourceType,name:e.fileName||``}])}),Z.success(`成功添加${e.length}个历史记录`)},onPortraitSelect:e=>{e.forEach(e=>{U(t=>[...t,{url:e.previewUrl||``,type:e.assetType===`Video`?`video`:`image`,name:e.name||`真人素材`,source:`private_portrait_asset`,private_asset_id:e.id,label:``,duration:e.assetType===`Video`?e.videoDuration||0:void 0}])}),Z.success(`已添加 ${e.length} 个真人素材参考`)},uploading:W,tooltipTitle:`图片${H.filter(e=>e.type===`image`).length}/5,视频${H.filter(e=>e.type===`video`).length}/2`,maxImageCount:5,maxVideoCount:2,usedImageCount:H.filter(e=>e.type===`image`).length,usedVideoCount:H.filter(e=>e.type===`video`).length,usedVideoDuration:H.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0),maxVideoDuration:15,children:(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:12,border:`1.5px dashed #d9d9d9`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.2s`,flexShrink:0},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6366f1`,e.currentTarget.style.background=`rgba(99,102,241,0.04)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`#d9d9d9`,e.currentTarget.style.background=`transparent`},children:W?(0,$.jsx)(Xm,{style:{fontSize:18,color:`#6366f1`}}):(0,$.jsx)(jI,{style:{fontSize:18,color:`#94a3b8`}})})})]}),(0,$.jsx)(`div`,{style:{padding:`8px 16px 4px`},children:(0,$.jsx)($U.TextArea,{ref:ae,value:K,onChange:e=>{let t=e.target.value;ee(t),n.setFieldsValue({prompt:t});let r=t.lastIndexOf(`@`);if(r>=0){let e=t.slice(r+1);if(!e.includes(` `)&&!e.includes(` + `})]})})})]}),(0,$.jsx)(`div`,{className:`desktop-content`,style:{flex:1,background:`#f1f2f3`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,padding:`24px 32px 32px`,border:`1px solid rgba(0, 0, 0, 0.06)`,overflow:`auto`,minHeight:0},children:!xe&&(0,$.jsx)(wt,{})})]}),(0,$.jsx)(`div`,{className:`mobile-header`,children:(0,$.jsxs)(`div`,{className:`mobile-header-content`,children:[(0,$.jsx)(`div`,{className:`mobile-menu-btn`,onClick:()=>A(!0),children:(0,$.jsx)(i6,{style:{fontSize:20}})}),(0,$.jsx)(`div`,{className:`mobile-header-title`,children:W}),(0,$.jsx)(`div`,{className:`mobile-header-right`,children:(0,$.jsxs)(`div`,{className:`mobile-credits-badge`,onClick:()=>l(!0),children:[(0,$.jsx)(V8,{}),(0,$.jsx)(`span`,{children:n?.credits||0})]})})]})}),(0,$.jsx)(`div`,{className:`mobile-content`,children:xe&&(0,$.jsx)(wt,{})}),(0,$.jsxs)(hV,{title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:36,height:36,borderRadius:10,flexShrink:0,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.35)`},children:K?(0,$.jsx)(`img`,{src:K,alt:`logo`,style:{width:24,height:24,objectFit:`contain`}}):(0,$.jsx)(D8,{style:{fontSize:18,color:`#ffffff`}})}),(0,$.jsx)(`span`,{style:{fontWeight:700,fontSize:16,color:`#1e293b`},children:W})]}),placement:`left`,onClose:()=>A(!1),open:k,size:280,closable:!0,className:`mobile-menu-drawer`,styles:{header:{borderBottom:`1px solid #f1f5f9`,padding:`16px 20px`},body:{padding:`12px 8px`,display:`flex`,flexDirection:`column`}},children:[(0,$.jsxs)(`div`,{style:{flex:1,overflow:`auto`,paddingBottom:12},children:[(0,$.jsx)(`div`,{style:{padding:`12px 8px 16px`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16},children:[(0,$.jsx)(Bw,{size:44,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0},children:(0,$.jsx)(L8,{})}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,$.jsx)(`div`,{style:{fontSize:15,fontWeight:600,color:`#1e293b`,marginBottom:2},children:n?.username||`用户`}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`},children:[(0,$.jsx)(V8,{style:{color:`#f59e0b`,marginRight:4}}),`积分: `,(0,$.jsx)(`span`,{style:{color:`#f59e0b`,fontWeight:600},children:n?.credits??0})]})]})]})}),(0,$.jsx)(r7,{data:ye}),Ne.map(e=>{let t=e.menu_type??e.menuType,n=Me[e.id]&&Me[e.id].length>0,r=e.path===Ae,i=H[e.id],a=i7[e.icon]||(0,$.jsx)(y3,{});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item ${r&&!n?`mobile-menu-item-active`:``} ${t===`group`?`mobile-menu-group`:``}`,onClick:()=>Pe(e),children:[t!==`group`&&(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:r?`#6366f1`:`#64748b`},children:a}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{paddingLeft:0,color:t===`group`?`#94a3b8`:r?`#4f46e5`:`#475569`,fontWeight:t===`group`||r?600:400,fontSize:t===`group`?12:15,textTransform:t===`group`?`uppercase`:`none`,letterSpacing:t===`group`?.5:0},children:e.label}),(t===`group`||n)&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#cbd5e1`,transition:`transform 0.2s ease`,transform:i?`rotate(90deg)`:`rotate(0deg)`},children:(0,$.jsx)(Vg,{})})]}),(t===`group`||n)&&i&&(0,$.jsx)(`div`,{className:`mobile-submenu`,children:(Me[e.id]||[]).map(e=>{let t=e.path===Ae,n=i7[e.icon]||(0,$.jsx)(y3,{});return(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-submenu-item ${t?`mobile-menu-item-active`:``}`,onClick:()=>Pe(e),children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:t?`#6366f1`:`#94a3b8`},children:n}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:t?`#4f46e5`:`#64748b`,fontWeight:t?600:400,fontSize:14},children:e.label})]},e.id)})})]},e.id)})]}),(0,$.jsxs)(`div`,{style:{padding:`8px 0`,borderTop:`1px solid #f1f5f9`},children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=credits`),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#f59e0b`},children:(0,$.jsx)(V8,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`积分明细`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=orders`),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#6366f1`},children:(0,$.jsx)(kV,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`订单记录`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/messages`),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#8b5cf6`},children:(0,$.jsx)(g2,{})}),(0,$.jsxs)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:[`消息中心`,D>0&&(0,$.jsx)(SQ,{color:`red`,style:{marginLeft:8,fontSize:11},children:D})]})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{s(!0),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#0ea5e9`},children:(0,$.jsx)(U3,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`个人信息`})]}),(0,$.jsx)(`div`,{style:{height:8}}),(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-recharge-item`,onClick:()=>{l(!0),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#fff`},children:(0,$.jsx)(jI,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#fff`,fontWeight:600},children:`充值积分`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{ze(),A(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#ef4444`},children:(0,$.jsx)(Y3,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#ef4444`},children:`退出登录`})]})]})]}),(0,$.jsx)(jG,{title:(0,$.jsxs)(wV,{children:[(0,$.jsx)(l8,{}),`账号设置`]}),open:o,onCancel:()=>{s(!1),f.resetFields(),p.resetFields()},width:440,footer:null,children:(0,$.jsxs)(sL,{defaultActiveKey:`profile`,children:[(0,$.jsx)(sL.TabPane,{tab:`个人信息`,children:(0,$.jsxs)(vH,{form:p,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(vH.Item,{name:`username`,label:`用户名`,rules:[{required:!0,message:`请输入用户名`},{min:3,message:`用户名至少3位`}],children:(0,$.jsx)($U,{placeholder:`请输入用户名`,size:`large`,prefix:(0,$.jsx)(L8,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(vH.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Re,style:{width:`100%`},children:`确认修改`})})]})},`profile`),(0,$.jsx)(sL.TabPane,{tab:`修改密码`,children:(0,$.jsxs)(vH,{form:f,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(vH.Item,{name:`oldPwd`,label:`原密码`,rules:[{required:!0,message:`请输入原密码`}],children:(0,$.jsx)($U.Password,{placeholder:`请输入原密码`,size:`large`,prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(vH.Item,{name:`newPwd`,label:`新密码`,rules:[{required:!0,message:`请输入新密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)($U.Password,{placeholder:`请输入新密码(至少6位)`,size:`large`,prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(vH.Item,{name:`confirmPwd`,label:`确认新密码`,rules:[{required:!0,message:`请再次输入新密码`},({getFieldValue:e})=>({validator(t,n){return!n||e(`newPwd`)===n?Promise.resolve():Promise.reject(Error(`两次密码不一致`))}})],children:(0,$.jsx)($U.Password,{placeholder:`请再次输入新密码`,size:`large`,prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(vH.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Le,style:{width:`100%`},children:`确认修改`})})]})},`password`)]})}),(0,$.jsx)(hV,{title:null,placement:`bottom`,open:c,onClose:()=>{l(!1),h(null),w(null)},height:`95vh`,className:`recharge-drawer`,styles:{header:{display:`none`},body:{padding:`20px 24px 0`,overflowY:`auto`,position:`relative`}},footer:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`12px 0`,borderTop:`1px solid #f0f0f0`},children:[(0,$.jsxs)(wV,{children:[(0,$.jsx)(V8,{style:{color:`#6366f1`}}),(0,$.jsx)(Q.Text,{style:{color:`#64748b`},children:`当前积分余额`}),(0,$.jsx)(Q.Text,{strong:!0,style:{color:`#6366f1`,fontSize:18},children:n?.credits??0})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{l(!1),h(null),w(null)},style:{borderRadius:10},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,disabled:!m&&C===null,loading:ce,onClick:async()=>{if(m){let e=v.find(e=>e.id===m);if(!e)return;let t=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);try{le(!0);let n=await x5(e.id,oe),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url;(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(q({price:e.price,credits:t,qrCode:r,method:n.paymentMethod}),l(!1),ie(!0),me.current=n.orderNo,localStorage.setItem(Te,JSON.stringify({orderNo:n.orderNo,price:e.price,credits:t,qrCode:r,method:n.paymentMethod,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),He(n.orderNo)):(Z.success(`充值成功!积分已到账`),e7.getState().refreshUser(),l(!1),h(null))}catch(e){Z.error(e?.message||`创建订单失败,请重试`)}finally{le(!1)}}},style:{borderRadius:10,fontWeight:600,background:m?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#d1d5db`,border:`none`,boxShadow:m?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:`确认充值`})]})]}),children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:16,zIndex:10},children:(0,$.jsx)(ju,{style:{fontSize:18,color:`#94a3b8`,cursor:`pointer`,padding:8,borderRadius:`50%`,transition:`color 0.2s`},onClick:()=>{l(!1),h(null),w(null)},onMouseEnter:e=>{e.target.style.color=`#6366f1`},onMouseLeave:e=>{e.target.style.color=`#94a3b8`}})}),(0,$.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:20,marginTop:16},children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0,fontSize:20,fontWeight:700,color:`#1a1a2e`},children:`选择合适的计划,助力业务提升`}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,alignItems:`center`,gap:12,marginTop:12},children:(0,$.jsx)(`div`,{style:{display:`inline-flex`,background:`#f5f5fa`,borderRadius:10,padding:4,gap:4},children:[{key:`yearly`,label:`连续包年 8折`},{key:`quarterly`,label:`连续包季 8折`},{key:`monthly`,label:`连续包月`}].map(e=>(0,$.jsx)(`div`,{onClick:()=>{let t=e.key;E(t),t!==`monthly`&&C!==null&&c7[C]?.onlyMonthly&&w(null)},style:{padding:`6px 16px`,borderRadius:8,cursor:`pointer`,fontSize:13,fontWeight:500,background:T===e.key?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:T===e.key?`#fff`:`#64748b`,transition:`all 0.2s`,whiteSpace:`nowrap`},children:e.label},e.key))})})]}),(0,$.jsx)(`div`,{style:{position:`absolute`,top:12,right:48,zIndex:10},children:(0,$.jsxs)(`div`,{onClick:()=>x(!0),style:{display:`flex`,alignItems:`center`,gap:6,cursor:`pointer`,padding:`6px 14px`,borderRadius:20,background:`linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08))`,border:`1px solid rgba(99,102,241,0.2)`,transition:`all 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15))`,e.currentTarget.style.borderColor=`rgba(99,102,241,0.4)`},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08))`,e.currentTarget.style.borderColor=`rgba(99,102,241,0.2)`},children:[(0,$.jsx)(V8,{style:{color:`#6366f1`,fontSize:14}}),(0,$.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:`#6366f1`},children:`积分充值`})]})}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:12,marginBottom:20},children:c7.map((e,t)=>({plan:e,idx:t})).filter(({plan:e})=>T===`monthly`||!e.onlyMonthly).map(({plan:e,idx:t})=>{let n=o7[t%o7.length],r=T===`monthly`?e.monthlyPrice:T===`quarterly`?e.quarterlyPrice:e.yearlyPrice,i=T===`monthly`?e.monthlyCredits:T===`quarterly`?e.quarterlyCredits:e.yearlyCredits,a=Math.round(i/r*10),o=C===t,s=e.hot;return(0,$.jsxs)(`div`,{onClick:()=>w(t),style:{flex:1,borderRadius:16,padding:`20px 16px 16px`,background:s?`linear-gradient(180deg, #f0edff 0%, #fafbff 30%)`:`#fafbff`,border:o?`2px solid #6366f1`:s?`2px solid #8b5cf6`:`1px solid #f0f0f5`,cursor:`pointer`,position:`relative`,transition:`all 0.2s`,display:`flex`,flexDirection:`column`,alignItems:`stretch`},children:[s&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:-10,right:12,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,color:`#fff`,fontSize:11,padding:`3px 10px`,borderRadius:8,fontWeight:600},children:`最热销`}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,color:`#1a1a2e`},children:e.tier}),(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:e.desc})]}),(0,$.jsxs)(`div`,{style:{marginTop:8,marginBottom:4},children:[(0,$.jsxs)(`span`,{style:{fontSize:28,fontWeight:800,background:n.gradient,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`},children:[`¥`,r]}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#94a3b8`,marginLeft:4},children:`/月`})]}),(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,marginBottom:8},children:`自动续订,可随时取消。`}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:12,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{fontSize:11,color:`#6366f1`,background:`rgba(99,102,241,0.08)`,padding:`3px 8px`,borderRadius:6,fontWeight:600},children:[`每月 `,i.toLocaleString(),` 积分`]}),(0,$.jsxs)(`div`,{style:{fontSize:11,color:`#94a3b8`,background:`#f5f5fa`,padding:`3px 8px`,borderRadius:6},children:[`¥10 = `,a,` 积分`]})]}),(0,$.jsxs)(X,{block:!0,size:`small`,onClick:e=>{e.stopPropagation(),w(t)},style:{borderRadius:10,marginBottom:12,fontWeight:600,height:36,background:o||s?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#1a1a2e`,border:`none`,color:`#fff`,fontSize:13},children:[`订阅月卡`,e.tier]}),(0,$.jsxs)(`div`,{style:{borderTop:`1px solid #f0f0f5`,paddingTop:10,display:`flex`,flexDirection:`column`,gap:6},children:[e.features.map((e,t)=>(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:6},children:[(0,$.jsx)(Tu,{style:{fontSize:12,color:`#6366f1`,flexShrink:0,marginTop:2}}),(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#64748b`,lineHeight:1.5},children:e})]},t)),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:6},children:[(0,$.jsx)(Tu,{style:{fontSize:12,color:`#6366f1`,flexShrink:0,marginTop:2}}),(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#64748b`,lineHeight:1.5},children:`解锁抢先购`})]})]})]},t)})}),!he.alipay&&!he.wechat?(0,$.jsx)(`div`,{style:{marginBottom:16,padding:16,background:`#fef2f2`,borderRadius:12,border:`1px solid #fecaca`},children:(0,$.jsx)(Q.Text,{style:{color:`#dc2626`,fontSize:13},children:`⚠️ 暂无可用的支付方式,请联系管理员开启支付功能`})}):(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{color:`#64748b`,fontSize:13,marginBottom:8,display:`block`},children:`选择支付方式`}),(0,$.jsxs)(LF.Group,{value:oe,onChange:e=>se(e.target.value),style:{display:`flex`,gap:12},children:[he.alipay&&(0,$.jsxs)(LF.Button,{value:`alipay`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:oe===`alipay`?`#1677ff`:void 0,color:oe===`alipay`?`#1677ff`:void 0},children:[(0,$.jsx)(F0,{style:{fontSize:16,marginRight:6}}),`支付宝`]}),he.wechat&&(0,$.jsxs)(LF.Button,{value:`wechat`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:oe===`wechat`?`#07c160`:void 0,color:oe===`wechat`?`#07c160`:void 0},children:[(0,$.jsx)(W8,{style:{fontSize:16,marginRight:6}}),`微信支付`]})]})]}),(0,$.jsxs)(`div`,{style:{padding:`12px 16px`,background:`rgba(99, 102, 241, 0.06)`,borderRadius:10,marginBottom:16,display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(O3,{style:{color:`#6366f1`,fontSize:14}}),(0,$.jsxs)(Q.Text,{style:{color:`#64748b`,fontSize:13},children:[`当前平台仅支持支付宝/微信扫码充值,如需转账支付请`,(0,$.jsx)(Q.Text,{style:{color:`#ff0000ff`,cursor:`pointer`,textDecoration:`underline`},onClick:()=>{l(!1),d(!0)},children:`联系我们`})]})]})]})}),(0,$.jsx)(jG,{title:(0,$.jsxs)(wV,{children:[(0,$.jsx)(V8,{style:{color:`#6366f1`}}),`积分充值`]}),open:b,onCancel:()=>{x(!1),h(null)},width:560,footer:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,padding:`12px 0 0`,borderTop:`1px solid #f0f0f0`},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{x(!1),h(null)},style:{borderRadius:10,marginRight:12},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,disabled:!m||!he.alipay&&!he.wechat,loading:ce,onClick:async()=>{let e=v.find(e=>e.id===m);if(!e)return;let t=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);try{le(!0);let n=await x5(e.id,oe),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url;(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(q({price:e.price,credits:t,qrCode:r,method:n.paymentMethod}),x(!1),ie(!0),me.current=n.orderNo,localStorage.setItem(Te,JSON.stringify({orderNo:n.orderNo,price:e.price,credits:t,qrCode:r,method:n.paymentMethod,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),He(n.orderNo)):(Z.success(`充值成功!积分已到账`),e7.getState().refreshUser(),x(!1),h(null))}catch(e){Z.error(e?.message||`创建订单失败,请重试`)}finally{le(!1)}},style:{borderRadius:10,fontWeight:600,background:m?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#d1d5db`,border:`none`,boxShadow:m?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:`确认充值`})]}),children:(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsxs)(wV,{style:{marginBottom:16},children:[(0,$.jsx)(V8,{style:{color:`#6366f1`}}),(0,$.jsx)(Q.Text,{style:{color:`#64748b`,letterSpacing:0},children:`当前积分余额`}),(0,$.jsx)(Q.Text,{strong:!0,style:{color:`#6366f1`,fontSize:20,fontWeight:600},children:n?.credits??0})]}),!he.alipay&&!he.wechat?(0,$.jsx)(`div`,{style:{marginBottom:16,padding:16,background:`#fef2f2`,borderRadius:12,border:`1px solid #fecaca`},children:(0,$.jsx)(Q.Text,{style:{color:`#dc2626`,fontSize:13},children:`⚠️ 暂无可用的支付方式,请联系管理员开启支付功能`})}):(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{color:`#64748b`,fontSize:13,marginBottom:8,display:`block`},children:`选择支付方式`}),(0,$.jsxs)(LF.Group,{value:oe,onChange:e=>se(e.target.value),style:{display:`flex`,gap:12},children:[he.alipay&&(0,$.jsxs)(LF.Button,{value:`alipay`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:oe===`alipay`?`#1677ff`:void 0,color:oe===`alipay`?`#1677ff`:void 0},children:[(0,$.jsx)(F0,{style:{fontSize:16,marginRight:6}}),`支付宝`]}),he.wechat&&(0,$.jsxs)(LF.Button,{value:`wechat`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:oe===`wechat`?`#07c160`:void 0,color:oe===`wechat`?`#07c160`:void 0},children:[(0,$.jsx)(W8,{style:{fontSize:16,marginRight:6}}),`微信支付`]})]})]}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:v.map((e,t)=>{let n=a7[t%a7.length],r=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);return(0,$.jsxs)(`div`,{onClick:()=>h(e.id),style:{flex:`1 1 45%`,minWidth:180,borderRadius:16,padding:`18px 14px`,background:m===e.id?`rgba(99,102,241,0.04)`:`#fafbff`,border:m===e.id?`2px solid #6366f1`:`1px solid #f0f0f5`,cursor:`pointer`,position:`relative`,transition:`all 0.2s`},children:[e.description&&(0,$.jsx)(SQ,{color:`purple`,style:{position:`absolute`,top:-10,left:`50%`,transform:`translateX(-50%)`,borderRadius:8,fontSize:11},children:e.description}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:40,height:40,borderRadius:12,flexShrink:0,background:n.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:16,color:`#fff`,boxShadow:`0 6px 16px ${n.shadow}`},children:n.icon}),(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6},children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14},children:e.name}),(0,$.jsxs)(Q.Text,{style:{fontSize:13,fontWeight:600,color:`#6366f1`},children:[r.toLocaleString(),` 积分`]})]}),(0,$.jsxs)(`div`,{style:{fontSize:20,fontWeight:800,marginTop:2,background:n.gradient,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`},children:[`¥`,e.price]})]})]})]},e.id)})})]})}),(0,$.jsx)(jG,{open:re,onCancel:async()=>{if(Ve(),me.current){try{await w5(me.current)}catch{}me.current=null}localStorage.removeItem(Te),ie(!1),q(null)},footer:null,width:400,closable:!1,styles:{body:{padding:0,borderRadius:16,overflow:`hidden`}},children:(0,$.jsxs)(`div`,{style:{padding:`24px`},children:[(0,$.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:24},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,background:ae?.method===`alipay`?`linear-gradient(135deg, #1677ff, #0958d9)`:`linear-gradient(135deg, #07c160, #06ae56)`,borderRadius:16,display:`flex`,alignItems:`center`,justifyContent:`center`,margin:`0 auto 12px`},children:ae?.method===`alipay`?(0,$.jsx)(F0,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(W8,{style:{fontSize:24,color:`#fff`}})}),(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:ae?.method===`alipay`?`支付宝支付`:`微信支付`}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:ae?.method===`alipay`?`请使用支付宝扫描二维码完成支付`:`请使用微信扫描二维码完成支付`})]}),(0,$.jsxs)(`div`,{style:{background:`#fff`,borderRadius:16,padding:20,display:`flex`,flexDirection:`column`,alignItems:`center`,boxShadow:`0 4px 20px rgba(0,0,0,0.08)`},children:[(0,$.jsx)(`div`,{style:{width:180,height:180,borderRadius:12,overflow:`hidden`,background:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:ae&&(0,$.jsx)(M0,{value:ae.qrCode,size:160,level:`M`,includeMargin:!1})}),(0,$.jsxs)(`div`,{style:{marginTop:16,textAlign:`center`},children:[(0,$.jsxs)(`div`,{style:{fontSize:28,fontWeight:700,color:`#1a1a2e`},children:[`¥`,ae?.price||0]}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`,marginTop:4},children:[`购买 `,ae?.credits||0,` 积分`]}),(0,$.jsx)(`div`,{style:{marginTop:12,padding:`8px 16px`,background:ue<=30?`#fef2f2`:`#f0f9ff`,borderRadius:8,border:ue<=30?`1px solid #fecaca`:`1px solid #bae6fd`,display:`inline-block`},children:(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:ue<=30?`#dc2626`:`#0284c7`},children:[`订单将在 `,(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:800},children:ue}),` 秒后关闭`]})})]})]}),(0,$.jsx)(`div`,{style:{marginTop:20,padding:16,background:`#fef3c7`,borderRadius:12},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8},children:[(0,$.jsx)(`div`,{style:{fontSize:16,marginTop:-2},children:`💡`}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#92400e`},children:[(0,$.jsx)(`div`,{style:{fontWeight:500,marginBottom:4},children:`支付提示`}),(0,$.jsxs)(`ul`,{style:{margin:0,paddingLeft:16},children:[(0,$.jsx)(`li`,{style:{marginBottom:2},children:`请在支付后等待页面自动跳转`}),(0,$.jsx)(`li`,{children:`如支付成功但未到账,请联系客服`})]})]})]})}),(0,$.jsx)(`div`,{style:{marginTop:20},children:(0,$.jsx)(X,{size:`large`,block:!0,onClick:async()=>{if(Ve(),me.current){try{await w5(me.current)}catch{}me.current=null}localStorage.removeItem(Te),ie(!1),q(null),h(null)},style:{borderRadius:10},children:`取消支付`})})]})}),(0,$.jsx)(bse,{}),(0,$.jsx)(`div`,{className:`contact-button-wrapper`,style:{right:`${I.x}px`,bottom:`${window.innerHeight-I.y}px`},children:(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(`div`,{className:`contact-tooltip`,style:{opacity:+!!j},children:`联系我们`}),(0,$.jsx)(`button`,{className:`contact-button ${R?`dragging`:``}`,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),onMouseDown:Ee,onMouseUp:Oe,children:(0,$.jsx)(s6,{style:{fontSize:20}})})]})}),(0,$.jsx)(jG,{title:(0,$.jsxs)(wV,{children:[(0,$.jsx)(s6,{}),`联系我们`]}),open:u,onCancel:()=>{d(!1),N.resetFields()},footer:null,width:480,className:`contact-modal`,children:(0,$.jsxs)(`div`,{style:{marginTop:8},children:[(0,$.jsxs)(vH,{form:N,layout:`vertical`,children:[(0,$.jsx)(vH.Item,{name:`name`,label:`姓名`,rules:[{required:!0,message:`请输入姓名`}],children:(0,$.jsx)($U,{placeholder:`请输入您的姓名`,size:`large`})}),(0,$.jsx)(vH.Item,{name:`phone`,label:`手机号`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1[3-9]\d{9}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)($U,{placeholder:`请输入您的手机号`,size:`large`})}),(0,$.jsx)(vH.Item,{name:`companyName`,label:`公司名称`,rules:[{required:!0,message:`请输入公司名称`}],children:(0,$.jsx)($U,{placeholder:`请输入公司名称`,size:`large`})}),(0,$.jsx)(vH.Item,{name:`industry`,label:`您的行业`,rules:[{required:!0,message:`请输入您的行业`}],children:(0,$.jsx)($U,{placeholder:`请输入您的行业`,size:`large`})}),(0,$.jsx)(vH.Item,{name:`message`,label:`留言(选填)`,children:(0,$.jsx)($U.TextArea,{placeholder:`请输入您的需求或问题`,rows:3,style:{borderRadius:10}})})]}),(0,$.jsxs)(`div`,{style:{marginTop:16,display:`flex`,gap:12},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{d(!1),N.resetFields()},style:{borderRadius:10,flex:1},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Be,loading:P,style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,flex:1},children:`提交`})]})]})})]})},wse=`http://localhost:8000/api`,Tse=()=>{let{checkAuth:e}=e7(),[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(`password`),[a,o]=(0,S.useState)(`password`),[s]=On(),c=s.get(`redirect`),l=s.get(`tab`),[u,d]=(0,S.useState)(0),[f,p]=(0,S.useState)(0),[m,h]=(0,S.useState)(!1),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(!1),[C,w]=(0,S.useState)(0),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),j=(()=>{try{let e=localStorage.getItem(`siteInfo`);if(e){let t=JSON.parse(e);return{siteName:t.siteName||`智创`,siteLogo:t.siteLogo||``}}}catch{}return{siteName:`智创`,siteLogo:``}})(),[M,N]=(0,S.useState)(j.siteName),[P,F]=(0,S.useState)(j.siteLogo),[I,L]=(0,S.useState)(``),[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(``),[H,U]=(0,S.useState)(``),W=Ye(),{login:G}=e7(),[K]=vH.useForm(),[ee]=vH.useForm(),[te]=vH.useForm();(0,S.useEffect)(()=>{h5().then(e=>{N(e.siteName),F(e.siteLogo),L(e.loginBgVideo||``),V(e.userAgreementPrivacyUrl),U(e.siteCopyright)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{l===`register`&&i(`register`)},[l]);let ne=()=>{if(c)try{W(decodeURIComponent(c));return}catch{}W(`/home`)},re=()=>m?!0:(Z.warning(`请先阅读并同意用户协议及隐私政策`),!1),ie=async()=>{if(re())try{let t=await K.validateFields();await G(t.phone,t.password,void 0,t.rememberMe),Z.success(`登录成功,欢迎回来`),await e(),ne()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}},ae=async()=>{if(re())try{let t=ee.getFieldsValue();if(!t.phone||!t.code){Z.error(`请填写手机号和验证码`);return}n(!0),await wae(t.phone,t.code),Z.success(`登录成功,欢迎回来`),await e(),ne()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}finally{n(!1)}},q=async()=>{if(re())try{let t=await te.validateFields();n(!0),await Tae(t.phone,t.regCode,t.password),Z.success(`注册成功`),await e(),ne()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`注册失败`;Z.error(t)}finally{n(!1)}},oe=(e,t)=>{e(60);let n=setInterval(()=>{e(e=>e<=1?(clearInterval(n),_(!1),t?O(!0):A(!0),0):e-1)},1e3)};(0,S.useEffect)(()=>{u===0&&r===`phone`&&x(!1)},[u,r]);let se=async(e,t)=>{try{if(!e||!/^1\d{10}$/.test(e)){Z.error(`请输入正确的手机号`);return}if(t){_(!0),y(!1);return}if(!b){_(!0),x(!1);return}let n=``;n=r===`register`?`register`:`login`,await g5(e,n),oe(t?p:d),Z.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t),r===`register`?(y(!1),p(0)):(x(!1),d(0)),w(e=>e+1)}},ce=async(e=!1)=>{let t=r===`register`?te.getFieldValue(`phone`):ee.getFieldValue(`phone`);try{let e=``;e=r===`register`?`register`:`login`,await g5(t,e),r===`register`?(y(!0),oe(p,!0)):(x(!0),oe(d,!1)),Z.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t),r===`register`?(y(!1),p(0),O(!0)):(x(!1),d(0),A(!0)),w(e=>e+1)}},le=e=>{o(e),i(e),d(0),p(0),x(!1),y(!1),_(!1),O(!1),A(!1),w(e=>e+1),e===`password`?K.resetFields():ee.resetFields()},ue={background:`#fff`,border:`1.5px solid #e2e8f0`,color:`#1e293b`,borderRadius:10,fontSize:14},de=e=>{if(!e){Z.warning(`暂未上传协议文件`);return}e.startsWith(`http://`)||e.startsWith(`https://`)?window.open(e,`_blank`):window.open(`${wse.replace(/\/api$/,``)}${e}`,`_blank`)};return(0,$.jsxs)(`div`,{className:`login-page`,children:[(0,$.jsx)(Ese,{src:I,onReady:()=>z(!0)}),(0,$.jsx)(`div`,{className:`login-bg-overlay`,style:{opacity:+!!R}}),(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,opacity:+!!R,transition:`opacity 0.5s ease`,pointerEvents:R?`auto`:`none`},children:[(0,$.jsx)(`div`,{className:`login-slogan`,children:(0,$.jsx)(`span`,{className:`login-slogan-text`,children:`AI赋能创意,素材触手可及`})}),(0,$.jsx)(`div`,{className:`login-center`,children:(0,$.jsxs)(lL,{className:`login-card`,styles:{body:{padding:`32px 32px`}},children:[(0,$.jsx)(`div`,{className:`login-card-header`,children:(0,$.jsxs)(`div`,{className:`login-logo-row`,children:[P?(0,$.jsx)(`img`,{src:P,alt:`logo`,className:`login-logo-img`}):(0,$.jsx)(`div`,{className:`login-logo-placeholder`,children:(0,$.jsx)(D8,{style:{fontSize:20,color:`#fff`}})}),(0,$.jsx)(`span`,{className:`login-site-name`,children:M})]})}),(0,$.jsx)(Q.Text,{className:`login-card-subtitle`,children:r===`register`?`注册新账号,开始创作视频`:`登录您的账号,开始创作`}),r!==`register`&&(0,$.jsx)(`div`,{className:`login-tabs`,children:[`password`,`phone`].map(e=>(0,$.jsx)(`div`,{onClick:()=>le(e),className:`login-tab ${a===e?`login-tab-active`:``}`,children:e===`password`?`密码登录`:`验证码登录`},e))}),r===`password`&&(0,$.jsxs)(vH,{form:K,size:`large`,layout:`vertical`,onFinish:ie,children:[(0,$.jsx)(vH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)($U,{prefix:(0,$.jsx)(u6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,style:ue})}),(0,$.jsx)(vH.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,$.jsx)($U.Password,{prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入密码`,style:ue})}),(0,$.jsx)(vH.Item,{name:`rememberMe`,valuePropName:`checked`,style:{marginBottom:12},children:(0,$.jsx)(aR,{children:`记住我的登录状态`})}),(0,$.jsx)(vH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,htmlType:`submit`,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`phone`&&(0,$.jsxs)(vH,{form:ee,size:`large`,layout:`vertical`,children:[(0,$.jsx)(vH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)($U,{prefix:(0,$.jsx)(u6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:ue})}),(0,$.jsx)(vH.Item,{name:`code`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(wV.Compact,{style:{width:`100%`},children:[(0,$.jsx)($U,{prefix:(0,$.jsx)(r8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!b,style:{...ue,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:u>0,style:{fontSize:14,fontWeight:400},onClick:()=>{k?(x(!1),_(!0),w(e=>e+1)):g&&!b?(E(!0),setTimeout(()=>E(!1),500)):se(ee.getFieldValue(`phone`))},className:`login-code-btn`,children:u>0?`${u}s`:k?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(vH.Item,{style:{marginBottom:12},children:(0,$.jsx)(l7,{onSuccess:ce,isVerified:b,shake:T})},C),(0,$.jsx)(vH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:ae,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`register`&&(0,$.jsxs)(vH,{form:te,size:`large`,layout:`vertical`,children:[(0,$.jsx)(vH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)($U,{prefix:(0,$.jsx)(u6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:ue})}),(0,$.jsx)(vH.Item,{name:`regCode`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(wV.Compact,{style:{width:`100%`},children:[(0,$.jsx)($U,{prefix:(0,$.jsx)(r8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!v,style:{...ue,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:f>0,style:{fontSize:14,fontWeight:400},onClick:()=>{D?(y(!1),_(!0),w(e=>e+1)):g&&!v?(E(!0),setTimeout(()=>E(!1),500)):se(te.getFieldValue(`phone`),!0)},className:`login-code-btn`,children:f>0?`${f}s`:D?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(vH.Item,{style:{marginBottom:12},children:(0,$.jsx)(l7,{onSuccess:ce,isVerified:v,shake:T})},C),(0,$.jsx)(vH.Item,{name:`password`,rules:[{required:!0,message:`请设置密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)($U.Password,{prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请设置密码(至少6位)`,style:ue})}),(0,$.jsx)(vH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:q,loading:t,block:!0,className:`login-submit-btn`,children:`注 册`})})]}),(0,$.jsx)(`div`,{className:`login-agreement`,children:(0,$.jsx)(aR,{checked:m,onChange:e=>h(e.target.checked),children:(0,$.jsxs)(`span`,{className:`login-agreement-text`,children:[`我已阅读并同意`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),de(B)},className:`login-link`,children:`《用户协议及隐私政策》`})]})})}),(0,$.jsx)(`div`,{className:`login-footer`,children:r===`register`?(0,$.jsx)(Q.Text,{className:`login-switch-btn`,onClick:()=>{i(`password`),o(`password`),O(!1),A(!1),y(!1),_(!1),w(e=>e+1),te.resetFields()},children:`已有账号?去登录`}):(0,$.jsx)(Q.Text,{className:`login-switch-btn`,onClick:()=>{i(`register`),O(!1),A(!1),y(!1),_(!1),w(e=>e+1)},children:`没有账号?立即注册`})})]})}),H&&(0,$.jsx)(`div`,{className:`login-copyright-wrapper`,children:(0,$.jsx)(`div`,{className:`login-copyright`,children:H})})]})]})},Ese=({src:e,onReady:t})=>{let[n,r]=(0,S.useState)(!1),i=S.useRef(null),a=()=>{n||(r(!0),i.current?.play().catch(()=>{}),t())};if(!e)return t(),null;let o=e.toLowerCase().endsWith(`.gif`),s=e.toLowerCase().endsWith(`.webp`);return o||s?(0,$.jsx)(`img`,{className:`login-bg-video`,src:e,alt:``,onLoad:a,onError:a}):(0,$.jsxs)($.Fragment,{children:[!n&&(0,$.jsx)(`div`,{className:`login-bg-video login-bg-placeholder`}),(0,$.jsx)(`video`,{ref:i,className:`login-bg-video`,style:{opacity:+!!n},autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:`auto`,onCanPlayThrough:a,onCanPlay:a,onError:a,children:(0,$.jsx)(`source`,{src:e,type:e.endsWith(`.webm`)?`video/webm`:e.endsWith(`.mov`)?`video/quicktime`:`video/mp4`})})]})},l7=({onSuccess:e,isVerified:t,shake:n})=>{let r=S.useRef(null),i=S.useRef(null),a=S.useRef(null),o=S.useRef(0),s=S.useRef(!1),[c,l]=S.useState(360),u=c-50;S.useEffect(()=>{let e=()=>{if(r.current){let e=r.current.offsetWidth;e>0&&l(e)}};e();let t=new ResizeObserver(e);return r.current&&t.observe(r.current),window.addEventListener(`resize`,e),()=>{t.disconnect(),window.removeEventListener(`resize`,e)}},[]);let d=n=>{if(s.current||t)return;let r=Math.max(0,Math.min(n,u));o.current=r,i.current&&(i.current.style.left=`${r}px`),a.current&&(a.current.style.width=`${r+50}px`),r>=u-5&&(s.current=!0,i.current&&(i.current.style.background=`#22c55e`,i.current.innerHTML=``),a.current&&(a.current.style.width=`${c}px`,a.current.style.background=`#dcfce7`),e())};return(0,$.jsxs)(`div`,{ref:r,onMouseDown:e=>{if(e.preventDefault(),s.current||t)return;let n=r.current;if(!n)return;let c=n.getBoundingClientRect(),l=e=>{d(e.clientX-c.left-50/2)},f=()=>{document.removeEventListener(`mousemove`,l),document.removeEventListener(`mouseup`,f),!s.current&&o.current{if(s.current||t)return;e.preventDefault();let n=r.current;if(!n)return;let c=n.getBoundingClientRect();d(e.touches[0].clientX-c.left-50/2);let l=e=>{d(e.touches[0].clientX-c.left-50/2)},f=()=>{document.removeEventListener(`touchmove`,l),document.removeEventListener(`touchend`,f),!s.current&&o.current({page:1,pageSize:10,total:0,items:[]}),u7=J8((e,t)=>({projects:[],records:Dse(),loading:!1,mediaType:`video`,countType:`请选择`,generationCount:1,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`9:16`,videoResolution:`720p`,engineOptions:{ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`480p`,`720p`,`1080p`],durations:[5,8,10,12,15]},enginesele:[],inputValue:``,currentMedia:[],fetchProjects:async()=>{e({loading:!0});try{e({projects:await Oae(),loading:!1})}catch{e({loading:!1})}},createProject:async(n,r)=>{let i=await kae(n,r);return e({projects:[i,...t().projects]}),i},deleteProject:async n=>{await Aae(n),e({projects:t().projects.filter(e=>e.id!==n)})},fetchRecords:async(t={})=>{e({loading:!0});try{e({records:await s5(t),loading:!1})}catch{e({loading:!1})}},optimizePrompt:async(n,r)=>{let i=await jae(n,r);try{await e7.getState().checkAuth()}catch{}let a=t().records,o=a.items.findIndex(e=>e.id===i.record.id),s=o>=0?a.items.map(e=>e.id===i.record.id?i.record:e):[i.record,...a.items];return e({records:{...a,total:o>=0?a.total:a.total+1,items:s}}),i},generateVideo:async n=>{let r=await Vae(n);try{await e7.getState().checkAuth()}catch{}let i=t().records;return e({records:{...i,items:i.items.map(e=>e.id===n?r:e)}}),r},retryGeneration:async n=>{let r=await Hae(n);try{await e7.getState().checkAuth()}catch{}let i=t().records;return e({records:{...i,items:i.items.map(e=>e.id===n?r:e)}}),r},updateRecordReferences:(n,r)=>{let i=t().records;e({records:{...i,items:i.items.map(e=>e.id===n?{...e,references:r}:e)}})},setMediaType:t=>e({mediaType:t}),setCountType:t=>e({countType:t}),setGenerationCount:t=>e({generationCount:t}),setImageSettings:(t,n,r,i)=>e({selectedRatio:t,selectedResolution:n,width:r,height:i}),setVideoSettings:(t,n,r)=>e({videoDuration:t,videoAspectRatio:n,videoResolution:r}),setEngineOptions:t=>e({engineOptions:t}),setSelectedRatio:t=>e({selectedRatio:t}),setSelectedResolution:t=>e({selectedResolution:t}),setWidth:t=>e({width:t}),setHeight:t=>e({height:t}),setVideoDuration:t=>e({videoDuration:t}),setVideoAspectRatio:t=>e({videoAspectRatio:t}),setVideoResolution:t=>e({videoResolution:t}),setEnginesele:t=>e({enginesele:t}),setInputValue:t=>e({inputValue:t}),setCurrentMedia:t=>e({currentMedia:t}),resetGenerationConfig:()=>e({mediaType:`image`,countType:`请选择`,generationCount:1,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`9:16`,videoResolution:`720p`,engineOptions:{ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`480p`,`720p`,`1080p`],durations:[5,8,10,12,15]},enginesele:[],inputValue:``,currentMedia:[]})})),d7=480;function f7(e){if(!e)return`-`;let t=e.trim();if(!t)return`-`;let n=t.match(/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(Z|[+-]\d{2}:?\d{2})?$/);if(!n)return t.slice(0,16).replace(`T`,` `);let[,r,i,a,o,s,c,l]=n,u=Date.UTC(+r,i-1,+a,+o,+s,+c);if(l&&l!==`Z`){let e=l[0]===`+`?1:-1,[t,n]=l.slice(1).split(`:`),r=u-e*(t*60+ +n)*6e4+d7*6e4,i=new Date(r);return`${i.getUTCFullYear()}-${p7(i.getUTCMonth()+1)}-${p7(i.getUTCDate())} ${p7(i.getUTCHours())}:${p7(i.getUTCMinutes())}`}let d=l===`Z`?u+d7*6e4:u,f=new Date(d);return`${f.getUTCFullYear()}-${p7(f.getUTCMonth()+1)}-${p7(f.getUTCDate())} ${p7(f.getUTCHours())}:${p7(f.getUTCMinutes())}`}function p7(e){return e<10?`0${e}`:String(e)}var m7=[`#f97316`,`#3b82f6`,`#8b5cf6`,`#10b981`,`#eab308`,`#6366f1`,`#ef4444`,`#06b6d4`,`#64748b`,`#78716c`],h7={ShoppingCartOutlined:(0,$.jsx)(d8,{}),BookOutlined:(0,$.jsx)(y2,{}),HomeOutlined:(0,$.jsx)(y3,{}),FireOutlined:(0,$.jsx)(B4,{}),RocketOutlined:(0,$.jsx)(t8,{}),SkinOutlined:(0,$.jsx)(Lie,{}),CompassOutlined:(0,$.jsx)(u4,{}),HeartOutlined:(0,$.jsx)(u3,{}),CarOutlined:(0,$.jsx)(P2,{}),CameraOutlined:(0,$.jsx)(j2,{}),CloudOutlined:(0,$.jsx)(K2,{}),StarOutlined:(0,$.jsx)(x8,{}),TrophyOutlined:(0,$.jsx)(j8,{}),ThunderboltOutlined:(0,$.jsx)(D8,{}),BulbOutlined:(0,$.jsx)(T2,{}),CoffeeOutlined:(0,$.jsx)(i4,{}),CrownOutlined:(0,$.jsx)(g4,{}),DashboardOutlined:(0,$.jsx)(y4,{}),FlagOutlined:(0,$.jsx)(U4,{}),GlobalOutlined:(0,$.jsx)(s3,{}),GiftOutlined:(0,$.jsx)(i3,{}),LaptopOutlined:(0,$.jsx)(j3,{}),MobileOutlined:(0,$.jsx)(u6,{}),MonitorOutlined:(0,$.jsx)(p6,{}),PayCircleOutlined:(0,$.jsx)(O6,{}),PictureOutlined:(0,$.jsx)(L6,{}),PlayCircleOutlined:(0,$.jsx)(K6,{}),SafetyOutlined:(0,$.jsx)(r8,{}),ShoppingOutlined:(0,$.jsx)(Nie,{}),SmileOutlined:(0,$.jsx)(g8,{}),SoundOutlined:(0,$.jsx)(y8,{}),TagOutlined:(0,$.jsx)(Kie,{}),TeamOutlined:(0,$.jsx)(T8,{}),ToolOutlined:(0,$.jsx)(Xie,{}),TruckOutlined:(0,$.jsx)(tae,{}),VideoCameraOutlined:(0,$.jsx)(z8,{}),WalletOutlined:(0,$.jsx)(V8,{}),BankOutlined:(0,$.jsx)(u2,{}),BuildOutlined:(0,$.jsx)(S2,{}),ExperimentOutlined:(0,$.jsx)(O4,{}),HighlightOutlined:(0,$.jsx)(p3,{}),IdcardOutlined:(0,$.jsx)(S3,{}),MedicineBoxOutlined:(0,$.jsx)(t6,{}),ReadOutlined:(0,$.jsx)(_ie,{}),RestOutlined:(0,$.jsx)(yie,{}),SketchOutlined:(0,$.jsx)(Fie,{}),SolutionOutlined:(0,$.jsx)(Bie,{})},Ose=()=>{let[e,t]=(0,S.useState)(!1),[n]=vH.useForm(),r=Ye(),{projects:i,fetchProjects:a,createProject:o,deleteProject:s}=u7(),[c,l]=(0,S.useState)([]);(0,S.useEffect)(()=>{a(),b5().then(l).catch(()=>{})},[]);let u=Object.fromEntries(c.map((e,t)=>[e.key,{label:e.label,color:m7[t%m7.length],icon:e.icon||`AppstoreOutlined`}]));return(0,$.jsxs)(`div`,{className:`content_box`,children:[(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:24,padding:`16px 24px`,borderRadius:16,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(99, 102, 241, 0.08)`,position:`relative`,overflow:`hidden`,flexWrap:`wrap`,gap:12},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`垂直行业提示词智能优化(新手专属,一键生成标准素材)`}),(0,$.jsxs)(`p`,{style:{fontSize:13,color:`#64748b`,margin:`4px 0 0 0`},children:[`共 `,i.length,` 个项目 · 按行业分类管理`]})]})}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[(0,$.jsx)(X,{icon:(0,$.jsx)(kV,{}),onClick:()=>r(`/records`),size:`large`,style:{background:`rgba(99, 102, 241, 0.1)`,border:`1px solid rgba(99, 102, 241, 0.2)`,color:`#6366f1`,fontWeight:600,borderRadius:10,height:42},children:`项目记录`}),(0,$.jsx)(X,{icon:(0,$.jsx)(jI,{}),onClick:()=>t(!0),size:`large`,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,color:`#fff`,fontWeight:600,borderRadius:10,height:42,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.35)`},children:`新建项目`})]})]}),i.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`还没有项目,创建您的第一个视频项目`,style:{padding:`60px 0`},children:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(jI,{}),onClick:()=>t(!0),size:`large`,children:`创建第一个项目`})}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},className:`stagger-children`,children:i.map((e,t)=>(0,$.jsxs)(`div`,{className:`project-card project-item animate-slideInCard`,onClick:()=>r(`/projects/${e.id}/generate`),style:{display:`flex`,alignItems:`center`,padding:`18px 22px`,borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,cursor:`pointer`,animationDelay:`${t*.06}s`},children:[(0,$.jsx)(`div`,{style:{width:50,height:50,borderRadius:14,flexShrink:0,background:`${u[e.industry]?.color||`#64748b`}12`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:24,marginRight:16,color:u[e.industry]?.color||`#64748b`},children:h7[u[e.industry]?.icon]||(0,$.jsx)(V0,{})}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:4,flexWrap:`wrap`},children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,color:`#1a1a2e`},children:e.name}),(0,$.jsx)(SQ,{color:u[e.industry]?.color||`#64748b`,style:{borderRadius:6,margin:0},children:u[e.industry]?.label||e.industry})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(SB,{style:{fontSize:12,color:`#94a3b8`}}),(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`创建于 `,f7(e.createdAt)]})]})]}),(0,$.jsxs)(`div`,{className:`project-actions`,style:{display:`flex`,alignItems:`center`,gap:8,marginLeft:16},children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(K6,{}),onClick:t=>{t.stopPropagation(),r(`/projects/${e.id}/generate`)},style:{background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`,borderRadius:10,fontWeight:600,height:36,boxShadow:`0 4px 12px rgba(99,102,241,0.25)`},children:`生成`}),(0,$.jsx)(FG,{title:`确定删除该项目?`,description:`项目下的生成记录将一并删除`,onConfirm:async t=>{t?.stopPropagation(),await s(e.id),Z.success(`项目已删除`)},onCancel:e=>e?.stopPropagation(),children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(IQ,{}),onClick:e=>e.stopPropagation(),style:{borderRadius:10,height:36,background:`rgba(239,68,68,0.06)`,border:`1px solid rgba(239,68,68,0.15)`,color:`#ef4444`}})}),(0,$.jsx)(Vg,{className:`mobile-hide`,style:{color:`#cbd5e1`,fontSize:12}})]})]},e.id))}),(0,$.jsx)(jG,{title:(0,$.jsxs)(wV,{children:[(0,$.jsx)(V0,{}),`新建项目`]}),open:e,onOk:async()=>{try{let e=await n.validateFields(),i=await o(e.name,e.industry);Z.success(`项目创建成功`),t(!1),n.resetFields(),r(`/projects/${i.id}/generate`)}catch{}},onCancel:()=>{t(!1),n.resetFields()},okText:`创建`,cancelText:`取消`,width:480,children:(0,$.jsxs)(vH,{form:n,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(vH.Item,{name:`name`,label:`项目名称`,rules:[{required:!0,message:`请输入项目名称`}],children:(0,$.jsx)($U,{placeholder:`例如:618电商大促宣传片`,prefix:(0,$.jsx)(vX,{}),size:`large`})}),(0,$.jsx)(vH.Item,{name:`industry`,label:`所属行业`,rules:[{required:!0,message:`请选择行业`}],children:(0,$.jsx)(zC,{placeholder:`选择项目所属行业`,size:`large`,children:c.map((e,t)=>(0,$.jsx)(zC.Option,{value:e.key,children:(0,$.jsxs)(wV,{children:[h7[e.icon]||(0,$.jsx)(V0,{}),` `,e.label]})},e.key))})})]})})]})};async function g7(e){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)return await navigator.clipboard.writeText(e),!0;let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}var{Text:_7}=Q,kse={real_person:{title:`选择真人素材库`,empty:`暂无可选 Active 真人素材`,projectError:`加载真人素材项目失败`,assetError:`加载真人素材失败`,fallbackName:`真人素材`},aigc_virtual:{title:`选择虚拟素材库`,empty:`暂无可选 Active 虚拟素材`,projectError:`加载虚拟素材项目失败`,assetError:`加载虚拟素材失败`,fallbackName:`虚拟素材`}},v7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`https://ceshi.apiforeign.minzhongzc.com`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,Ase=e=>e.assetType===`Video`?v7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.providerUrl):v7(`static`+(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.providerUrl)+`?w=300&q=50`),jse=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},y7=({open:e,libraryType:t=`real_person`,selectedIds:n=[],maxCount:r=20,onClose:i,onSelect:a,maxImageCount:o,maxVideoCount:s,usedImageCount:c,usedVideoCount:l,usedVideoDuration:u,maxVideoDuration:d,accept:f})=>{let p=kse[t],[m,h]=(0,S.useState)([]),[g,_]=(0,S.useState)(),[v,y]=(0,S.useState)(``),[b,x]=(0,S.useState)(f===`image/*`?`Image`:void 0),[C,w]=(0,S.useState)([]),[T,E]=(0,S.useState)(new Map),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),j=(0,S.useMemo)(()=>new Set(T.keys()),[T]),M=async()=>{O(!0);try{let e=(await(t===`aigc_virtual`?$5:Z5)({page:1,pageSize:100,status:`active`})).items||[];h(e),_(t=>t&&e.some(e=>e.id===t)?t:e[0]?.id)}catch(e){Z.error(e?.message||p.projectError)}finally{O(!1)}},N=async()=>{A(!0);try{w((await(t===`aigc_virtual`?ose:ese)({projectId:g,keyword:v.trim()||void 0,assetType:b,page:1,pageSize:100})).items||[])}catch(e){Z.error(e?.message||p.assetError)}finally{A(!1)}};(0,S.useEffect)(()=>{e&&setTimeout(()=>{E(new Map),y(``),x(void 0),_(void 0),w([]),M()},0)},[e,t]),(0,S.useEffect)(()=>{g&&setTimeout(()=>{N()},0)},[g,b]);let P=e=>{if(n.includes(e.id)){Z.info(`该素材已添加`);return}if(f===`image/*`&&e.assetType===`Video`){Z.warning(`当前仅支持选择图片素材`);return}E(t=>{let n=new Map(t);return n.has(e.id)?(n.delete(e.id),n):n.size>=r?(Z.warning(`最多选择 ${r} 个参考素材`),t):(n.set(e.id,e),n)})},F=(0,S.useMemo)(()=>{let e=Array.from(T.values()).filter(e=>e.assetType===`Image`).length,t=Array.from(T.values()).filter(e=>e.assetType===`Video`).length,n=Array.from(T.values()).filter(e=>e.assetType===`Video`).reduce((e,t)=>e+(t.videoDuration||0),0),r=o!==void 0&&c!==void 0?o-c:1/0,i=s!==void 0&&l!==void 0?s-l:1/0,a=d!==void 0&&u!==void 0?d-u:1/0;return e>r||t>i||n>a},[T,o,c,s,l,d,u]);return(0,$.jsxs)(jG,{title:`${p.title}`,open:e,onCancel:i,width:920,destroyOnHidden:!0,footer:[(0,$.jsx)(X,{onClick:i,children:`取消`},`cancel`),(0,$.jsxs)(X,{type:`primary`,onClick:()=>{let e=Array.from(T.values()).filter(e=>!n.includes(e.id));if(!e.length){Z.warning(`请选择至少一个${t===`aigc_virtual`?`虚拟`:`真人`}素材`);return}a(e),i()},disabled:F,style:{background:F?`#94a3b8`:`#8b5cf6`,opacity:F?.6:1,cursor:F?`not-allowed`:`pointer`},children:[`添加选中素材(`,T.size,`)`]},`ok`)],children:[f!==`image/*`&&(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:20,marginBottom:16,padding:`12px 16px`,background:`#fafafa`,borderRadius:8},children:(()=>{let e=Array.from(T.values()).filter(e=>e.assetType===`Image`).length,t=Array.from(T.values()).filter(e=>e.assetType===`Video`).length,n=Array.from(T.values()).filter(e=>e.assetType===`Video`).reduce((e,t)=>e+(t.videoDuration||0),0),r=o!==void 0&&c!==void 0?o-c:1/0,i=s!==void 0&&l!==void 0?s-l:1/0,a=d!==void 0&&u!==void 0?d-u:1/0,f=e>r,p=t>i,m=n>a;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:f?`#ef4444`:`#64748b`,fontWeight:f?600:400},children:[`还可选取图片 `,e,`/`,o!==void 0&&c!==void 0?o-c:`-`,` 张`]}),(0,$.jsxs)(`span`,{style:{fontSize:13,color:p||m?`#ef4444`:`#64748b`,fontWeight:p||m?600:400},children:[`视频还可选取 `,t,`/`,s!==void 0&&l!==void 0?s-l:`-`,` 个(`,n.toFixed(1),`/`,d!==void 0&&u!==void 0?(d-u).toFixed(1):`-`,`秒)`]})]})})()}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`240px 1fr`,gap:16,height:500},children:[(0,$.jsxs)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,background:`#fafafa`,overflowY:`auto`,height:`100%`},children:[(0,$.jsxs)(wV,{style:{width:`100%`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(_7,{strong:!0,children:`项目组`}),(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(VK,{}),onClick:M,loading:D})]}),(0,$.jsx)(oG,{spinning:D,children:m.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`暂无项目组`}):(0,$.jsx)(`div`,{children:m.map(e=>(0,$.jsx)(`div`,{onClick:()=>_(e.id),style:{cursor:`pointer`,padding:`10px 12px`,borderRadius:10,marginBottom:6,border:g===e.id?`1px solid #8b5cf6`:`1px solid transparent`,background:g===e.id?`#f5f3ff`:`#fff`},children:(0,$.jsxs)(`div`,{style:{width:`100%`},children:[(0,$.jsx)(_7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),(0,$.jsx)(_7,{type:`secondary`,style:{fontSize:12},children:typeof e.activeImageAssetCount==`number`||typeof e.activeVideoAssetCount==`number`?` 图 ${e.activeImageAssetCount||0} / 视 ${e.activeVideoAssetCount||0}`:``})]})},e.id))})})]}),(0,$.jsxs)(`div`,{style:{overflowY:`auto`,height:`100%`},children:[(0,$.jsxs)(wV,{style:{width:`100%`,marginBottom:12},children:[(0,$.jsx)($U,{allowClear:!0,prefix:(0,$.jsx)(PC,{}),placeholder:`搜索素材名称`,value:v,onChange:e=>y(e.target.value),onPressEnter:N}),(0,$.jsx)(zC,{allowClear:f!==`image/*`,placeholder:`素材类型`,value:b,onChange:x,style:{width:116},options:f===`image/*`?[{value:`Image`,label:`图片`}]:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{icon:(0,$.jsx)(VK,{}),onClick:N,loading:k,children:`刷新`})]}),(0,$.jsx)(oG,{spinning:k,children:C.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:p.empty,style:{marginTop:120}}):(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(140px, 1fr))`,gap:12,maxHeight:420,overflowY:`auto`,paddingRight:4},children:C.filter(e=>f!==`image/*`||e.assetType===`Image`).map(e=>{let t=j.has(e.id)||n.includes(e.id),r=n.includes(e.id),i=Ase(e),a=e.assetType===`Video`;return(0,$.jsxs)(`div`,{onClick:()=>P(e),style:{cursor:r?`not-allowed`:`pointer`,border:t?`2px solid #8b5cf6`:`1px solid #edf0f5`,borderRadius:12,overflow:`hidden`,background:`#fff`,boxShadow:t?`0 8px 20px rgba(139,92,246,0.18)`:`0 4px 12px rgba(15,23,42,0.04)`,opacity:r?.62:1,position:`relative`},children:[(0,$.jsxs)(`div`,{style:{aspectRatio:`1 / 1`,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[i?a?(0,$.jsx)(`video`,{src:i,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:i,alt:e.name||p.fallbackName,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):a?(0,$.jsx)(z8,{style:{fontSize:32,color:`#94a3b8`}}):(0,$.jsx)(L6,{style:{fontSize:32,color:`#94a3b8`}}),a&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:8,bottom:8,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:jse(e.videoDuration)})]}),t&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,width:24,height:24,borderRadius:12,background:`#8b5cf6`,color:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(OC,{})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsx)(_7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name||`未命名素材`}),(0,$.jsxs)(wV,{wrap:!0,size:4,style:{marginTop:6},children:[(0,$.jsx)(SQ,{color:a?`blue`:`default`,children:a?`视频`:`图片`}),(0,$.jsx)(SQ,{children:e.projectName})]})]})]},e.id)})})})]})]})]})},b7=({src:e,size:t=`normal`})=>{let n=(0,S.useRef)(null),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(0),[s,c]=(0,S.useState)(0),[l,u]=(0,S.useState)(1),[d,f]=(0,S.useState)(!1),p=e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`,m=(0,S.useCallback)(()=>{n.current&&(r?n.current.pause():n.current.play(),i(!r))},[r]),h=(0,S.useCallback)(()=>{n.current&&o(n.current.currentTime)},[]),g=(0,S.useCallback)(()=>{n.current&&c(n.current.duration)},[]),_=(0,S.useCallback)(()=>{i(!1),o(0)},[]),v=(0,S.useCallback)(e=>{if(!n.current||s===0)return;let t=e.currentTarget.getBoundingClientRect(),r=(e.clientX-t.left)/t.width*s;n.current.currentTime=r,o(r)},[s]),y=(0,S.useCallback)(e=>{if(!n.current)return;let t=parseFloat(e.target.value);n.current.volume=t,u(t),f(t===0)},[]),b=(0,S.useCallback)(()=>{n.current&&(d?(n.current.volume=l||.5,f(!1)):(n.current.volume=0,f(!0)))},[d,l]);(0,S.useEffect)(()=>{let e=n.current;if(e)return e.addEventListener(`timeupdate`,h),e.addEventListener(`loadedmetadata`,g),e.addEventListener(`ended`,_),()=>{e.removeEventListener(`timeupdate`,h),e.removeEventListener(`loadedmetadata`,g),e.removeEventListener(`ended`,_)}},[h,g,_]);let x=s>0?a/s*100:0;return(0,$.jsxs)(`div`,{style:{width:`100%`,height:t===`small`?130:112,background:`#f1f5f9`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:t===`small`?`16px 16px`:`12px 16px`},children:[(0,$.jsx)(`audio`,{ref:n,src:e}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16,width:`100%`},children:[(0,$.jsx)(`button`,{onClick:m,style:{width:48,height:48,borderRadius:`50%`,background:`linear-gradient(135deg, #8b5cf6, #a78bfa)`,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,flexShrink:0},children:r?(0,$.jsx)(S6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(K6,{style:{fontSize:24,color:`#fff`,marginLeft:2}})}),(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:8},children:[(0,$.jsxs)(`div`,{onClick:v,style:{height:5,background:`#e2e8f0`,borderRadius:10,cursor:`pointer`,overflow:`visible`,position:`relative`},children:[(0,$.jsx)(`div`,{style:{height:`100%`,width:`${x}%`,background:`linear-gradient(90deg, #8b5cf6, #a78bfa)`,borderRadius:10,transition:`width 0.1s linear`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,left:`${x}%`,top:`50%`,transform:`translate(-50%, -50%)`,width:t===`small`?12:14,height:t===`small`?12:14,background:`#fff`,borderRadius:`50%`,boxShadow:`0 2px 6px rgba(0,0,0,0.15)`,opacity:+(x>0),transition:`opacity 0.2s`}})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{fontSize:t===`small`?11:12,color:`#64748b`},children:p(a)}),(0,$.jsx)(`span`,{style:{fontSize:t===`small`?11:12,color:`#64748b`},children:p(s)})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flexShrink:0},children:[(0,$.jsx)(`button`,{onClick:b,style:{border:`none`,background:`transparent`,cursor:`pointer`,padding:0},children:d?(0,$.jsx)(U2,{style:{fontSize:t===`small`?14:16,color:`#94a3b8`}}):(0,$.jsx)(y8,{style:{fontSize:t===`small`?14:16,color:`#94a3b8`}})}),(0,$.jsx)(`input`,{type:`range`,min:`0`,max:`1`,step:`0.1`,value:d?0:l,onChange:y,style:{width:t===`small`?40:50,height:4,borderRadius:2,appearance:`none`,background:`#e2e8f0`,cursor:`pointer`}})]})]})]})},{Text:x7}=Q,S7=e=>{if(!e)return``;if(/^data:|blob:/i.test(e))return e;if(/^https?:\/\//i.test(e)){let t=new URL(e);return t.pathname.startsWith(`/uploads`)?t.pathname+t.search:e}return`${`https://ceshi.apiforeign.minzhongzc.com`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`},C7=(e,t)=>{if(e<300||e>6e3)return`图片宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`图片高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;return n<.4||n>2.5?`图片宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`:null},w7=(e,t)=>{if(e<300||e>6e3)return`视频宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`视频高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;if(n<.4||n>2.5)return`视频宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`;let r=e*t;return r<409600?`视频总像素数过小(${e}×${t}=${r}),需 ≥ 640×640=409600`:r>8295044?`视频总像素数过大(${e}×${t}=${r}),需 ≤ 3326×2494=8295044`:null},Mse=e=>{let t=e,n=t.width||t.videoWidth||t.imageWidth||0,r=t.height||t.videoHeight||t.imageHeight||0;if(e.resourceType===`image`){if(n>0&&r>0)return C7(n,r)}else if(e.resourceType===`video`&&n>0&&r>0)return w7(n,r);return null},Nse=e=>new Promise(t=>{let n=new Image;n.onload=()=>{t({width:n.width,height:n.height})},n.onerror=()=>{t({width:0,height:0})},n.src=e}),Pse=e=>e===`video`?(0,$.jsx)(z8,{}):e===`audio`?(0,$.jsx)(n2,{}):(0,$.jsx)(L6,{}),Fse=e=>e===`video`?`视频`:e===`audio`?`音频`:`图片`,Ise=({open:e,onClose:t,onSelect:n,allowedTypes:r,selectedIds:i=[],title:a=`选择历史上传素材`,maxImageCount:o,maxVideoCount:s,usedImageCount:c,usedVideoCount:l,maxVideoDuration:u,usedVideoDuration:d,maxAudioCount:f,usedAudioCount:p,maxAudioDuration:m,usedAudioDuration:h,hideLimitHint:g,defaultResourceType:_})=>{let[v,y]=(0,S.useState)(_||``),[b,x]=(0,S.useState)(``),[C,w]=(0,S.useState)(1),[T,E]=(0,S.useState)(10),[D,O]=(0,S.useState)(1),[k,A]=(0,S.useState)(8),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)([]),[L,R]=(0,S.useState)(0),[z,B]=(0,S.useState)(``),[V,H]=(0,S.useState)([]),[U,W]=(0,S.useState)(0),[G,K]=(0,S.useState)(new Map),ee=(0,S.useMemo)(()=>new Set(i),[i]),te=(0,S.useMemo)(()=>new Set(r||[`image`,`video`,`audio`]),[JSON.stringify(r)]),ne=(0,S.useMemo)(()=>Array.from(G.values()).filter(e=>e.resourceType===`image`).length,[G]),re=(0,S.useMemo)(()=>Array.from(G.values()).filter(e=>e.resourceType===`video`).length,[G]),ie=(0,S.useMemo)(()=>Array.from(G.values()).filter(e=>e.resourceType===`video`).reduce((e,t)=>e+(t.durationSeconds||0),0),[G]),ae=(0,S.useMemo)(()=>Array.from(G.values()).filter(e=>e.resourceType===`audio`).length,[G]),q=(0,S.useMemo)(()=>Array.from(G.values()).filter(e=>e.resourceType===`audio`).reduce((e,t)=>e+(t.durationSeconds||0),0),[G]),oe=(0,S.useMemo)(()=>o!==void 0&&c!==void 0?o-c:1/0,[o,c]),se=(0,S.useMemo)(()=>s!==void 0&&l!==void 0?s-l:1/0,[s,l]),ce=(0,S.useMemo)(()=>u!==void 0&&d!==void 0?u-d:1/0,[u,d]),le=(0,S.useMemo)(()=>f!==void 0&&p!==void 0?f-p:1/0,[f,p]),ue=(0,S.useMemo)(()=>m!==void 0&&h!==void 0?m-h:1/0,[m,h]),de=(0,S.useMemo)(()=>ne>oe,[ne,oe]),fe=(0,S.useMemo)(()=>re>se,[re,se]),pe=(0,S.useMemo)(()=>ie>ce,[ie,ce]),me=(0,S.useMemo)(()=>ae>le,[ae,le]),he=(0,S.useMemo)(()=>q>ue,[q,ue]),ge=(0,S.useCallback)(async()=>{if(e){P(!0);try{let e=await J5({resourceType:v||void 0,keyword:b||void 0,page:C,pageSize:T,scene:`picker`});I(C===1?e.groups||[]:t=>[...t,...e.groups||[]]),R(e.totalDays||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),C===1&&I([]),R(0)}finally{P(!1)}}},[te,b,e,C,T,v]),_e=(0,S.useCallback)(async e=>{M(!0);try{let t=await Y5(e,{resourceType:v||void 0,keyword:b||void 0,page:D,pageSize:8,scene:`picker`});H((t.items||[]).filter(e=>te.has(e.resourceType))),W(t.total||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),H([]),W(0)}finally{M(!1)}},[te,b,D,k,v]);(0,S.useEffect)(()=>{e&&ge()},[e,C,ge]),(0,S.useEffect)(()=>{z&&O(1)},[z]),(0,S.useEffect)(()=>{z&&_e(z)},[z,D,_e]),(0,S.useEffect)(()=>{e&&K(new Map)},[e]),(0,S.useEffect)(()=>{e&&(y(_||``),w(1))},[e,_]);let ve=async e=>{if(ee.has(e.id)){Z.warning(`该素材已经在参考内容中`);return}let t=e,n=t.width||t.videoWidth||t.imageWidth||0,r=t.height||t.videoHeight||t.imageHeight||0;if(e.resourceType===`image`){if(n<=0||r<=0){let t=S7(e.previewUrl||e.displayUrl||e.resourceUrl);if(t){let e=await Nse(t);n=e.width,r=e.height}}if(n>0&&r>0){let t=C7(n,r);if(t){Z.error(`${e.fileName||`图片`}:${t}`);return}}}else if(e.resourceType===`video`&&n>0&&r>0){let t=w7(n,r);if(t){Z.error(`${e.fileName||`视频`}:${t}`);return}}K(t=>{let n=new Map(t);return n.has(e.id)?n.delete(e.id):n.set(e.id,e),n})},ye=()=>{let e=Array.from(G.values());if(e.length===0){Z.warning(`请先选择历史素材`);return}n(e),K(new Map),t()},be=(0,S.useMemo)(()=>[{label:`全部`,value:``},{label:`图片`,value:`image`},{label:`视频`,value:`video`},{label:`音频`,value:`audio`}].filter(e=>!e.value||te.has(e.value)),[te]);return(0,$.jsxs)(jG,{title:a,open:e,onCancel:t,width:1e3,centered:!0,destroyOnHidden:!0,footer:[(0,$.jsx)(X,{onClick:t,children:`取消`},`cancel`),(0,$.jsxs)(X,{type:`primary`,onClick:ye,style:{background:`#8b5cf6`},disabled:de||fe||pe||me||he,children:[`应用选择 (`,G.size,`)`]},`ok`)],children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsxs)(wV,{wrap:!0,children:[(0,$.jsx)(zC,{value:v,options:be,style:{width:120},onChange:e=>{y(e),w(1)}}),(0,$.jsx)($U,{allowClear:!0,value:b,prefix:(0,$.jsx)(PC,{}),placeholder:`搜索文件名`,style:{width:220},onChange:e=>x(e.target.value),onPressEnter:()=>{w(1),ge()}}),(0,$.jsx)(X,{icon:(0,$.jsx)(VK,{}),onClick:ge,children:`刷新`})]}),!g&&(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginTop:12,flexWrap:`wrap`},children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:de?`#ef4444`:`#64748b`,fontWeight:de?600:400},children:[`还可选取图片 `,ne,`/`,o!==void 0&&c!==void 0?o-c:`-`,` 张`]}),(0,$.jsxs)(`span`,{style:{fontSize:13,color:fe||pe?`#ef4444`:`#64748b`,fontWeight:fe||pe?600:400},children:[`视频还可选取 `,re,`/`,s!==void 0&&l!==void 0?s-l:`-`,` 个(`,ie.toFixed(1),`/`,u!==void 0&&d!==void 0?(u-d).toFixed(1):`-`,`秒)`]}),f!==void 0&&(0,$.jsxs)(`span`,{style:{fontSize:13,color:me||he?`#ef4444`:`#64748b`,fontWeight:me||he?600:400},children:[`音频还可选取 `,ae,`/`,f!==void 0&&p!==void 0?f-p:`-`,` 个(`,q.toFixed(1),`/`,m!==void 0&&h!==void 0?(m-h).toFixed(1):`-`,`秒)`]})]})]}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`240px 1fr`,gap:16,height:500},children:[(0,$.jsxs)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,background:`#fafafa`,overflowY:`auto`},children:[(0,$.jsx)(x7,{strong:!0,style:{fontSize:14},children:`日期列表`}),(0,$.jsx)(oG,{spinning:N,children:F.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`暂无日期`,style:{padding:`40px 0`}}):(0,$.jsxs)(`div`,{style:{marginTop:12},children:[F.map(e=>(0,$.jsxs)(`div`,{onClick:()=>B(e.generatedDate),style:{padding:`10px 12px`,borderRadius:10,marginBottom:6,cursor:`pointer`,border:z===e.generatedDate?`1px solid #8b5cf6`:`1px solid transparent`,background:z===e.generatedDate?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(`div`,{style:{fontSize:13,fontWeight:500,color:`#334155`},children:e.generatedDate}),(0,$.jsxs)(`div`,{style:{fontSize:12,color:`#94a3b8`,marginTop:4},children:[`共 `,e.total,` 个素材`]})]},e.generatedDate)),L>F.length&&(0,$.jsx)(`div`,{style:{marginTop:12,textAlign:`center`},children:(0,$.jsx)(X,{size:`small`,onClick:()=>w(C+1),children:`加载更多`})})]})})]}),(0,$.jsx)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,overflowY:`auto`},children:(0,$.jsx)(oG,{spinning:j,children:z?V.length===0?(0,$.jsx)(lC,{description:`该日期暂无可复用的历史上传素材`,style:{padding:`48px 0`}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(150px, 1fr))`,gap:14},children:V.map(e=>{let t=G.has(e.id),n=ee.has(e.id),r=Mse(e),i=n||!!r,a=e.previewUrl||e.displayUrl||e.resourceUrl,o=S7(e.resourceType===`image`?`static`+a+`?w=300&q=50`:a);return(0,$.jsxs)(`div`,{onClick:()=>!i&&ve(e),style:{position:`relative`,borderRadius:14,border:t?`2px solid #8b5cf6`:`1px solid #e2e8f0`,background:i?`#f8fafc`:`#fff`,opacity:i?.55:1,cursor:i?`not-allowed`:`pointer`,overflow:`hidden`,boxShadow:t?`0 10px 24px rgba(139, 92, 246, 0.18)`:`0 6px 18px rgba(15,23,42,0.06)`},title:r||void 0,children:[(0,$.jsx)(`div`,{style:{background:`#f1f5f9`},children:e.resourceType===`image`?(0,$.jsx)(`img`,{src:o,alt:e.fileName||e.id,style:{width:`100%`,height:130,objectFit:`cover`}}):e.resourceType===`video`?(0,$.jsx)(`video`,{src:o,muted:!0,style:{width:`100%`,height:130,objectFit:`cover`}}):(0,$.jsx)(b7,{src:o,size:`small`})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsxs)(wV,{size:6,style:{marginBottom:6},children:[(0,$.jsx)(SQ,{color:`purple`,icon:Pse(e.resourceType),style:{margin:0},children:Fse(e.resourceType)}),e.durationSeconds?(0,$.jsxs)(SQ,{style:{margin:0},children:[Number(e.durationSeconds).toFixed(1),`s`]}):null,r&&(0,$.jsx)(SQ,{color:`red`,style:{margin:0},children:`尺寸不符`})]}),(0,$.jsx)(x7,{ellipsis:!0,style:{display:`block`,fontSize:13,color:`#334155`},title:e.fileName||e.id,children:e.fileName||e.id}),(0,$.jsx)(x7,{type:`secondary`,style:{fontSize:12},children:e.moduleLabel||`普通上传`})]}),t&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,width:24,height:24,borderRadius:12,background:`#8b5cf6`,color:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(OC,{})}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8},children:(0,$.jsx)(SQ,{children:`已选`})}),r&&(0,$.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,background:`rgba(239, 68, 68, 0.9)`,color:`#fff`,padding:`4px 8px`,fontSize:11,textAlign:`center`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:r})]},e.id)})}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:16,paddingBottom:8},children:(0,$.jsx)(zW,{current:D,pageSize:k,total:U,showSizeChanger:!0,pageSizeOptions:[8],onChange:(e,t)=>{O(e),A(t)}})})]}):(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`请选择日期`,style:{padding:`80px 0`}})})})]})]})},T7=({children:e,accept:t=`image/*,video/*`,multiple:n=!0,onLocalSelect:r,onHistorySelect:i,onPortraitSelect:a,onPortraitLibrarySelect:o,uploading:s,tooltipTitle:c,maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,usedVideoDuration:p,maxVideoDuration:m,maxAudioCount:h,usedAudioCount:g,maxAudioDuration:_,usedAudioDuration:v,hideLimitHint:y,mediaType:b})=>{let x=(0,S.useRef)(null),[C,w]=(0,S.useState)(!1),[T,E]=(0,S.useState)(`real_person`),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(!1),N=()=>{A(!1),x.current?.click()},P=e=>{let t=e.target.files;t&&r&&r(Array.from(t)),x.current&&(x.current.value=``)},F=e=>{if(A(!1),a){E(e),w(!0);return}if(o){o(e);return}E(e),w(!0)},I=(0,$.jsxs)(`div`,{style:{padding:`4px 0`,minWidth:180},children:[(0,$.jsxs)(`div`,{onClick:()=>{N()},style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(vX,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`本地上传`})]}),(0,$.jsxs)(`div`,{onClick:()=>{A(!1),O(!0)},style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(S4,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`从资产中选择`})]}),b!==`image`&&(0,$.jsxs)(`div`,{onClick:()=>F(`real_person`),style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(L8,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`真人素材库`})]}),b!==`image`&&(0,$.jsxs)(`div`,{onClick:()=>F(`aigc_virtual`),style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(T8,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`虚拟素材库`})]})]});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:x,type:`file`,accept:t,multiple:n,onChange:P,style:{display:`none`}}),c?(0,$.jsx)(kw,{title:c,children:(0,$.jsx)(Lw,{content:I,open:k,onOpenChange:A,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})})}):(0,$.jsx)(Lw,{content:I,open:k,onOpenChange:A,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})}),(0,$.jsx)(Ise,{open:D,onClose:()=>O(!1),onSelect:e=>{i?.(e),O(!1)},allowedTypes:t.includes(`audio`)?[`image`,`video`,`audio`]:[`image`,`video`],maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,maxVideoDuration:m,usedVideoDuration:p,maxAudioCount:h,usedAudioCount:g,maxAudioDuration:_,usedAudioDuration:v,hideLimitHint:y,defaultResourceType:b===`image`?`image`:``}),(0,$.jsx)(y7,{open:C,libraryType:T,onClose:()=>w(!1),onSelect:e=>{a?.(e),w(!1)},accept:t,maxCount:t===`image/*`&&!n?1:void 0,maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,usedVideoDuration:p,maxVideoDuration:m})]})};function Lse(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}return`${Date.now().toString(16).padStart(12,`0`)}-${Math.random().toString(16).slice(2,10).padStart(8,`0`)}-4xxx-yxxx-${Math.random().toString(16).slice(2,12)}`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var Rse={prompt_processing:`optimizing`,ready:`prompt_optimized`,generating:`generating`,success:`completed`,failure:`failed`},zse=new Set([`pending`,`optimizing`,`generating`]),E7=new Set([`queued`,`preparing`,`creating_provider_task`,`provider_result_staged`,`waiting_remote`,`polling`,`result_ready`,`download_queued`,`downloading`,`retry_waiting`,`recovery_inconsistent`,`upscale_queued`,`upscale_processing`,`upscale_polling`,`upscale_downloading`,`upscale_finalizing`,`upscale_retry_waiting`]),D7=new Set([`completed`,`done`]),O7=new Set([`failed`,`timeout`,`download_failed`,`upscale_failed`]),Bse=new Set([...D7,...O7,`deleted`]),Vse={pending:`待处理`,optimizing:`提词处理中`,prompt_optimized:`待生成`,generating:`生成中`,queued:`生成中`,preparing:`生成中`,creating_provider_task:`生成中`,provider_result_staged:`生成中`,waiting_remote:`生成中`,polling:`生成中`,result_ready:`生成中`,download_queued:`生成中`,downloading:`生成中`,retry_waiting:`生成中`,recovery_inconsistent:`生成中`,upscale_queued:`生成中`,upscale_processing:`生成中`,upscale_polling:`生成中`,upscale_downloading:`生成中`,upscale_finalizing:`生成中`,upscale_retry_waiting:`生成中`,completed:`成功`,done:`成功`,timeout:`失败`,download_failed:`失败`,upscale_failed:`失败`,failed:`失败`,deleted:`已删除`},Hse={pending:`default`,optimizing:`processing`,prompt_optimized:`blue`,generating:`processing`,queued:`processing`,preparing:`processing`,creating_provider_task:`processing`,provider_result_staged:`processing`,waiting_remote:`processing`,polling:`processing`,result_ready:`processing`,download_queued:`processing`,downloading:`processing`,retry_waiting:`orange`,recovery_inconsistent:`orange`,upscale_queued:`purple`,upscale_processing:`purple`,upscale_polling:`purple`,upscale_downloading:`purple`,upscale_finalizing:`purple`,upscale_retry_waiting:`orange`,completed:`success`,done:`success`,failed:`error`,timeout:`error`,download_failed:`error`,upscale_failed:`error`,deleted:`default`},k7=e=>String(e||``).trim().toLowerCase(),Use=e=>{let t=k7(e);return Vse[t]||t||`未知状态`},Wse=e=>Hse[k7(e)]||`default`,A7=e=>{let t=k7(e.status),n=k7(e.displayStatus),r=k7(e.pipelineStage),i=Rse[k7(e.clientStatus)]||``,a=i||n||t||r||`pending`;O7.has(r)||O7.has(t)||O7.has(n)?a=O7.has(r)?r:O7.has(t)?t:n:D7.has(t)||D7.has(n)?a=D7.has(t)?t:n:!i&&r&&E7.has(r)&&(a=r);let o=O7.has(a),s=D7.has(a),c=typeof e.shouldPoll==`boolean`?e.shouldPoll:!o&&!s&&(zse.has(t)||E7.has(r)),l=c;return{status:t,displayStatus:n,pipelineStage:r,effectiveKey:a,label:Use(a),color:Wse(a),isActive:l,isSuccess:s,isFailure:o,isTerminal:Bse.has(a),canGenerate:typeof e.canGenerate==`boolean`?e.canGenerate:t===`prompt_optimized`,canRetry:typeof e.canRetry==`boolean`?e.canRetry:o,shouldPoll:c}},j7=({label:e,value:t,options:n,suffix:r,expanded:i,onToggle:a,onSelect:o,onClose:s})=>{let c=(0,S.useRef)(null),l=(0,S.useRef)(null),u=(0,S.useRef)(i),[d,f]=(0,S.useState)(null);return u.current=i,(0,S.useEffect)(()=>{if(i&&c.current){let e=c.current.getBoundingClientRect();f({bottom:window.innerHeight-e.top+4,left:e.left,width:Math.max(e.width,100)})}else f(null)},[i]),(0,S.useEffect)(()=>{if(!i)return;let e=e=>{c.current?.contains(e.target)||l.current?.contains(e.target)||u.current&&s()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i,s]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:c,onClick:a,translate:`no`,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,cursor:`pointer`,userSelect:`none`,transition:`background 0.2s, border-color 0.2s`,background:`#fff`,border:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:`#374151`,fontWeight:500,lineHeight:`18px`},children:[t,r]}),(0,$.jsx)(xZ,{style:{fontSize:9,color:`#94a3b8`,transition:`transform 0.2s`,transform:i?`rotate(180deg)`:`rotate(0deg)`}})]}),d&&(0,Vi.createPortal)((0,$.jsxs)(`div`,{ref:l,style:{position:`fixed`,bottom:d.bottom,left:d.left,minWidth:d.width,maxHeight:200,overflowY:`auto`,background:`#fff`,borderRadius:12,padding:6,zIndex:99999,boxShadow:`0 8px 30px rgba(0,0,0,0.12)`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:10,color:`#94a3b8`,display:`block`,padding:`2px 6px 4px`},children:e}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:n.map((e,n)=>{let r=t===e;return(0,$.jsx)(`div`,{onClick:()=>{o(e),s()},style:{padding:`6px 10px`,borderRadius:8,fontSize:13,cursor:`pointer`,transition:`all 0.15s`,background:r?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:r?`#fff`:`#1a1a2e`,fontWeight:r?600:400},onMouseEnter:e=>{r||(e.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:e},n)})})]}),document.body)]})},Gse=({group:e,groupName:t,selected:n,expanded:r,onToggle:i,onSelect:a,onClose:o})=>{let s=(0,S.useRef)(null),c=(0,S.useRef)(null),l=(0,S.useRef)(r),[u,d]=(0,S.useState)(null);return l.current=r,(0,S.useEffect)(()=>{if(r&&s.current){let e=s.current.getBoundingClientRect();d({bottom:window.innerHeight-e.top+4,left:e.left})}else d(null)},[r]),(0,S.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||c.current?.contains(e.target)||l.current&&o()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r,o]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:s,onClick:()=>i(t),style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,cursor:`pointer`,userSelect:`none`,transition:`background 0.2s, border-color 0.2s`,background:`#ffffffff`,border:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#374151`,fontWeight:500,lineHeight:`18px`},children:n||e.name}),(0,$.jsx)(xZ,{style:{fontSize:9,color:`#94a3b8`,transition:`transform 0.2s`,transform:r?`rotate(180deg)`:`rotate(0deg)`}})]}),u&&(0,Vi.createPortal)((0,$.jsxs)(`div`,{ref:c,style:{position:`fixed`,bottom:u.bottom,left:u.left,background:`#fff`,borderRadius:12,padding:8,minWidth:160,zIndex:99999,boxShadow:`0 8px 30px rgba(0,0,0,0.12)`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:10,color:`#94a3b8`,display:`block`,padding:`2px 6px 4px`},children:e.name}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:e.options.map((e,r)=>{let i=n===e;return(0,$.jsx)(`div`,{onClick:()=>{a(e,t),o()},style:{padding:`6px 10px`,borderRadius:8,fontSize:13,cursor:`pointer`,transition:`all 0.15s`,background:i?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:i?`#fff`:`#1a1a2e`,fontWeight:i?600:400},onMouseEnter:e=>{i||(e.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:e=>{i||(e.currentTarget.style.background=`transparent`)},children:e},r)})})]}),document.body)]})},M7=({src:e,width:t=48,height:n=48})=>{let[r,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(null);return(0,S.useEffect)(()=>{let r=document.createElement(`video`);r.muted=!0,r.preload=`metadata`,r.crossOrigin=`anonymous`;let a=()=>{o(r.duration),r.currentTime=Math.min(1,r.duration*.1)},s=()=>{try{let e=document.createElement(`canvas`);e.width=t*2,e.height=n*2;let a=e.getContext(`2d`);a&&(a.drawImage(r,0,0,e.width,e.height),i(e.toDataURL(`image/jpeg`,.7)))}catch{}};return r.addEventListener(`loadedmetadata`,a),r.addEventListener(`seeked`,s),r.src=e,()=>{r.removeEventListener(`loadedmetadata`,a),r.removeEventListener(`seeked`,s)}},[e,t,n]),(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,position:`relative`,background:`#1a1a2e`},children:[r?(0,$.jsx)(`img`,{src:r,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(K6,{style:{color:`#fff`,fontSize:18}})}),a!=null&&(0,$.jsx)(`span`,{style:{position:`absolute`,bottom:2,right:2,fontSize:9,color:`#fff`,background:`rgba(0,0,0,0.6)`,borderRadius:4,padding:`1px 4px`,lineHeight:1.3},children:(e=>`${Math.round(e)}s`)(a)})]})},Kse=()=>{let{projectId:e}=$e(),t=Ye(),[n]=vH.useForm(),{projects:r,records:i,fetchProjects:a,fetchRecords:o,optimizePrompt:s,generateVideo:c,retryGeneration:l}=u7(),u=i.items,{user:d,optimizeHoldCredits:f}=e7(),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(!1),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(``),[x,C]=(0,S.useState)(!1),[w,T]=(0,S.useState)({}),[E,D]=(0,S.useState)({}),[O,k]=(0,S.useState)({}),[A,j]=(0,S.useState)({}),[M,N]=(0,S.useState)({}),P=(0,S.useRef)(null),F=(0,S.useCallback)(e=>{if(!e)return 0;let t=new Date(e).getTime(),n=(Date.now()-t)/1e3;return n>=180?99:Math.min(99,n*.6)},[]);(0,S.useEffect)(()=>{let e=Object.entries(E).filter(([,e])=>e===`generating`).map(([e])=>e);if(e.length===0){P.current&&=(clearInterval(P.current),null);return}let t=()=>{e.forEach(e=>{let t=u7.getState().records.items.find(t=>t.id===e);if(t?.createdAt){let n=F(t.createdAt);k(t=>({...t,[e]:n})),j(t=>({...t,[e]:n}))}})};return t(),P.current=window.setInterval(t,1e3),()=>{P.current&&=(clearInterval(P.current),null)}},[E,F]),(0,S.useEffect)(()=>{Object.entries(E).forEach(([e,t])=>{if(t===`done`&&!M[e]){N(t=>({...t,[e]:!0}));let t=A[e]||0,n=Date.now(),r=()=>{let i=Date.now()-n,a=Math.min(i/800,1),o=1-(1-a)**3,s=t+(100-t)*o;j(t=>({...t,[e]:s})),a<1&&requestAnimationFrame(r)};requestAnimationFrame(r)}})},[E]),(0,S.useEffect)(()=>{Object.entries(E).forEach(([e,t])=>{if(t===`generating`){let t=u7.getState().records.items.find(t=>t.id===e);if(t?.createdAt){let n=F(t.createdAt);k(t=>({...t,[e]:n})),j(t=>({...t,[e]:n}))}}})},[_]);let[I,L]=(0,S.useState)({}),[R,z]=(0,S.useState)(null),[B,V]=(0,S.useState)(null),[H,U]=(0,S.useState)([]),[W,G]=(0,S.useState)(!1),[K,ee]=(0,S.useState)(``),[te,ne]=(0,S.useState)(!1),[re,ie]=(0,S.useState)(``),ae=(0,S.useRef)(null),[q,oe]=(0,S.useState)({}),[se,ce]=(0,S.useState)({}),[le,ue]=(0,S.useState)({}),[de,fe]=(0,S.useState)(null),[pe,me]=(0,S.useState)(null),[he,ge]=(0,S.useState)(5),[_e,ve]=(0,S.useState)(`9:16`),[ye,be]=(0,S.useState)(`720p`),[xe,Se]=(0,S.useState)([]),[Ce,we]=(0,S.useState)([]),[Te,Ee]=(0,S.useState)(``),[De,Oe]=(0,S.useState)(!1),[ke,Ae]=(0,S.useState)(null),[je,Me]=(0,S.useState)(!1),[Ne,Pe]=(0,S.useState)({ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`720p`,`1080p`],durations:[5,8,10,12,15]});(0,S.useMemo)(()=>Ne.durations.map(e=>`${e}`),[Ne.durations]),(0,S.useCallback)(()=>{Ae(e=>e===`duration`?null:`duration`)},[]),(0,S.useCallback)(()=>{Ae(null)},[]);let Fe=(0,S.useCallback)(e=>{fe(t=>t===e?null:e)},[]),Ie=(0,S.useCallback)(()=>{fe(null)},[]);(0,S.useCallback)(e=>{ge(parseInt(e))},[]);let Le=(0,S.useCallback)((e,t)=>{ue(n=>{let r={...n};return r[t]===e?delete r[t]:r[t]=e,r})},[]),[Re,ze]=(0,S.useState)(0),[Be,Ve]=(0,S.useState)(0),[He,Ue]=(0,S.useState)(`video`),[We,Ge]=(0,S.useState)(`1:1`),[Ke,qe]=(0,S.useState)(`2K`),[Je,Xe]=(0,S.useState)(2048),[Ze,Qe]=(0,S.useState)(2048),[et,tt]=(0,S.useState)(!1),[nt,rt]=(0,S.useState)([]),[it,at]=(0,S.useState)([]),[ot,st]=(0,S.useState)([]),ct=(e,t)=>{if(e<300||e>6e3)return`图片宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`图片高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;return n<.4||n>2.5?`图片宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`:null},lt=(e,t)=>{if(e<300||e>6e3)return`视频宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`视频高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;if(n<.4||n>2.5)return`视频宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`;let r=e*t;return r<409600?`视频总像素数过小(${e}×${t}=${r}),需 ≥ 640×640=409600`:r>8295044?`视频总像素数过大(${e}×${t}=${r}),需 ≤ 3326×2494=8295044`:null},ut=async e=>{let t=e.type.startsWith(`image/`),n=e.type.startsWith(`video/`);if(!t&&!n)return Z.error(`仅支持图片或视频文件`),!1;let r=n?100:10;if(e.size/1024/1024>r)return Z.error(`${n?`视频`:`图片`}大小不能超过${r}MB`),!1;let i=H.filter(e=>e.type===`image`).length,a=H.filter(e=>e.type===`video`).length,o=H.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(t&&i>=5)return Z.error(`最多上传5张图片`),!1;if(n&&a>=2)return Z.error(`最多上传2个视频`),!1;let s=0;if(n){let t=await new Promise(t=>{let n=document.createElement(`video`);n.preload=`metadata`,n.onloadedmetadata=()=>{t({duration:n.duration||0,width:n.videoWidth||0,height:n.videoHeight||0}),n.remove()},n.onerror=()=>{t({duration:0,width:0,height:0}),n.remove()},n.src=URL.createObjectURL(e)});if(s=t.duration,t.width>0&&t.height>0){let e=lt(t.width,t.height);if(e)return Z.error(`${e}`),!1}if(o+s>15)return Z.error(`视频总时长不能超过15秒`),!1}else{let t=await new Promise(t=>{let n=document.createElement(`img`);n.onload=()=>{t({width:n.width,height:n.height}),URL.revokeObjectURL(n.src)},n.onerror=()=>{t({width:0,height:0}),URL.revokeObjectURL(n.src)},n.src=URL.createObjectURL(e)});if(t.width>0&&t.height>0){let e=ct(t.width,t.height);if(e)return Z.error(`${e}`),!1}}G(!0);try{let r;r=t?await l5(e):await u5(e,s);let o=t?`图片`:`视频`,c=t?i+1:a+1;U(e=>[...e,{url:r.url,type:t?`image`:`video`,name:`${o}${c}`,duration:n?s:void 0}]),Z.success(`${o}上传成功`)}catch{Z.error(`上传失败`)}finally{G(!1)}return!1};(0,S.useEffect)(()=>{if(eoe().then(e=>{rt(e.video),st(e.image)}),O5().then(e=>{at(e)}),!et&&!je)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&(tt(!1),Me(!1))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[et,je]);let dt=e=>{let t=Array.isArray(e)?e:[];return{inputImageCount:t.filter(e=>e.type===`image`).length,inputVideoDuration:t.filter(e=>e.type===`video`).reduce((e,t)=>e+Number(t.duration||0),0)}},ft=()=>{let e={};if(e=it.find(e=>e.modelConfigId===(_?.engineId||Te)&&e.genType===He&&e.resolution===(He===`video`?_?.resolution||ye:_?.imageSize||Ke)),e||=He===`video`?{perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0}:{perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},He===`video`){let t=((_?.duration||he)*e.perSecondCredits+e.baseCredits)*e.ratio;if(_?.includeMediaReferences??De){let n=dt(_?.references||H);if(n.inputVideoDuration>0){let r=((e.inputVideoBaseCredits||0)+(e.inputVideoPerSecondCredits||0)*n.inputVideoDuration)*(e.inputVideoRatio||1);t+=r}if(n.inputImageCount>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n.inputImageCount)*(e.inputImageRatio||1);t+=r}}return Number(t.toFixed(2))}else{let t=e.baseCredits*e.ratio;if(_?.includeMediaReferences??De){let n=dt(_?.references||H);if(n.inputImageCount>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n.inputImageCount)*(e.inputImageRatio||1);t+=r}}return Number(t.toFixed(2))}},pt=e=>{let t=e.genType||e.gen_type||`video`,n=e.engineId||e.engine_id,r=e.resolution,i=Number(e.duration||0),a=e.imageSize||e.image_size,o=e.includeMediaReferences??e.include_media_references??!1,s=e.references||[],c=it.find(e=>e.modelConfigId===n&&e.genType===t&&e.resolution===(t===`video`?r:a));c||=t===`video`?{perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0}:{perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0};let l=0;if(t===`video`){if(l=(i*c.perSecondCredits+c.baseCredits)*c.ratio,o){let e=dt(s);if(e.inputVideoDuration>0){let t=((c.inputVideoBaseCredits||0)+(c.inputVideoPerSecondCredits||0)*e.inputVideoDuration)*(c.inputVideoRatio||1);l+=t}if(e.inputImageCount>0){let t=((c.inputImageBaseCredits||0)+(c.inputImagePerImageCredits||0)*e.inputImageCount)*(c.inputImageRatio||1);l+=t}}}else if(l=c.baseCredits*c.ratio,o){let e=dt(s);if(e.inputImageCount>0){let t=((c.inputImageBaseCredits||0)+(c.inputImagePerImageCredits||0)*e.inputImageCount)*(c.inputImageRatio||1);l+=t}}return Number(l.toFixed(2))},mt=e=>{Ct(e);let t=Et[Ke]?.[e];if(t){let[e,n]=t.split(/x/i).map(Number);Xe(e),Qe(n)}},ht=e=>{Tt(e);let t=Object.keys(Et[e]||{});_t(t.map(e=>({value:e,label:e})));let n=t.includes(We)?We:t[0]||`1:1`;n!==We&&Ge(n);let r=Et[e]?.[n];if(r){let[e,t]=r.split(/x/i).map(Number);Xe(e),Qe(t)}},[gt,_t]=(0,S.useState)([]),[vt,yt]=(0,S.useState)([]),[bt,xt]=(0,S.useState)([]),[St,Ct]=(0,S.useState)(0),[wt,Tt]=(0,S.useState)(0),[Et,Dt]=(0,S.useState)({});(0,S.useEffect)(()=>{bt[wt]&&bt[wt][St]!==void 0&&(Xe(bt[wt][St].substring(0,4)),Qe(bt[wt][St].substring(5)))},[St]),(0,S.useEffect)(()=>{bt[wt]&&bt[wt][St]!==void 0&&(Xe(bt[wt][St].substring(0,4)),Qe(bt[wt][St].substring(5)))},[wt]);let Ot=()=>{Xe(Ze),Qe(Je)},kt=e=>{let t=e.target.value===`image`?`image`:`video`;Ue(t);let n=(t===`image`?Ce:xe).filter(e=>e.supportsUniversalReference!==!1);n.length>0&&jt(n[0].id)};(0,S.useEffect)(()=>{b5().then(e=>{oe(Object.fromEntries(e.map(e=>[e.key,e.label]))),ce(Object.fromEntries(e.map(e=>[e.key,e.optionGroups||[]])))}).catch(()=>{}),Wae().then(e=>{let t=e.items||[];we(t);let n=t?.[0]?.supportedSizes||{};Dt(n);let r=Object.keys(n);yt(r.map(e=>({value:e,label:e})));let i=r.includes(Ke)?Ke:r[0]||`2K`,a=Object.keys(n[i]||{});_t(a.map(e=>({value:e,label:e})));let o=a.includes(We)?We:a[0]||`1:1`;o!==We&&Ge(o);let s=n[i]?.[o];if(s){let[e,t]=s.split(/x/i).map(Number);Xe(e),Qe(t)}}).catch(()=>{}),Uae().then(e=>{if(Se(e.items||[]),e.items?.length){let t=e.items[0];Ee(e=>e||t.id),Pe({ratios:t.supportedRatios?.length?t.supportedRatios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:t.supportedResolutions?.length?t.supportedResolutions:[`720p`,`1080p`],durations:t.supportedDurations?.length?t.supportedDurations:[5,8,10,12,15]})}}).catch(()=>{})},[]),(0,S.useEffect)(()=>{if(!_)return;let e=_.genType||He,t=e===`image`?Ce:xe,n=_.engineId||``,r=t.find(e=>e.id===n)||t[0];if(r)if(Ee(r.id),e===`image`){let e=r.supportedSizes||{};Dt(e);let t=Object.keys(e),n=t.includes(_.imageSize||``)?_.imageSize:t[0]||_.imageSize||`2K`;qe(n);let i=Object.keys(e[n]||{}),a=i.includes(_.imageProportion||``)?_.imageProportion:i[0]||_.imageProportion||`1:1`;Ge(a);let o=e[n]?.[a]||_.imagePx||``;if(o){let[e,t]=String(o).split(/x/i).map(Number);e>0&&t>0&&(Xe(e),Qe(t))}}else Pe({ratios:r.supportedRatios?.length?r.supportedRatios:[`16:9`],resolutions:r.supportedResolutions?.length?r.supportedResolutions:[`720p`],durations:r.supportedDurations?.length?r.supportedDurations:[5]}),r.supportedRatios?.includes(_e)||ve(r.supportedRatios?.[0]||`16:9`),r.supportedResolutions?.includes(ye)||be(r.supportedResolutions?.[0]||`720p`),r.supportedDurations?.includes(he)||ge(r.supportedDurations?.[0]||_.duration||5);Oe(!!_.includeMediaReferences)},[_?.id,_?.engineId,xe,Ce]);let At=e=>{let t=xe.find(t=>t.id===e)||xe[0];return{ratios:t?.supportedRatios?.length?t.supportedRatios:[`16:9`],resolutions:t?.supportedResolutions?.length?t.supportedResolutions:[`720p`],durations:t?.supportedDurations?.length?t.supportedDurations:[5]}},jt=e=>{Ee(e);let t=(He===`image`?Ce:xe).find(t=>t.id===e);if(!t)return;if(He===`image`){let e=t.supportedSizes||{};Dt(e);let n=Object.keys(e);yt(n.map(e=>({value:e,label:e})));let r=n.includes(Ke)?Ke:n[0]||`2K`,i=Object.keys(e[r]||{});_t(i.map(e=>({value:e,label:e})));let a=i.includes(We)?We:i[0]||`1:1`;qe(r),Ge(a);let o=e[r]?.[a]||``;if(o){let[e,t]=String(o).split(/x/i).map(Number);e>0&&t>0&&(Xe(e),Qe(t))}return}let n=At(e);Pe(n),ve(n.ratios[0]),be(n.resolutions[0]),ge(n.durations[0])};(0,S.useEffect)(()=>{a(),o({projectId:e,page:1,pageSize:100})},[e,a,o]);let Mt=(0,S.useRef)(!1);(0,S.useEffect)(()=>{Mt.current||u.length===0||(Mt.current=!0,u.forEach(t=>{t.projectId===e&&t.status===`generating`&&(D(e=>({...e,[t.id]:`generating`})),rn(t.id)),t.projectId===e&&t.status===`optimizing`&&Bt(t.id)}))},[u,e]);let Nt=(0,S.useRef)(new Set),Pt=(0,S.useRef)(null),Ft=(0,S.useRef)(null),It=e=>{Nt.current.add(e),zt()},Lt=e=>{Nt.current.delete(e),Nt.current.size===0&&Rt()},Rt=()=>{Pt.current&&=(clearInterval(Pt.current),null),Ft.current&&=(Ft.current.abort(),null)},zt=()=>{Pt.current||=setInterval(async()=>{try{Ft.current&&Ft.current.abort();let t=new AbortController;Ft.current=t;let n=await s5({projectId:e,page:1,pageSize:100,signal:t.signal});Ft.current=null;let r=Array.from(Nt.current),i=[];if(r.length>0){let e=u7.getState().records,t=e.items.map(e=>{if(r.includes(e.id)){let t=n.items.find(t=>t.id===e.id);if(t)return t.status!==`optimizing`&&i.push(e.id),t}return e});u7.setState({records:{...e,items:t}}),i.forEach(e=>{Lt(e)})}}catch(e){e.name}},3e3)},Bt=e=>{It(e)},Vt=(0,S.useRef)(!1),Ht=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(Vt.current||u.length===0)return;let t=localStorage.getItem(`pending_optimize`);if(t)try{let{key:n,projectId:r,prompt:i,duration:a,engineId:o,genType:s,aspectRatio:c,resolution:l,imageSize:d,imageProportion:f,imagePx:p,includeMediaReferences:m,referenceIds:h,ts:_}=JSON.parse(t);if(Date.now()-_>300*1e3||r!==e){localStorage.removeItem(`pending_optimize`);return}if(Ht.current===n)return;let y=u.find(e=>e.projectId===r&&e.originalPrompt===i&&e.duration===a&&e.engineId===o&&String(e.genType||`video`)===String(s||`video`)&&String(e.aspectRatio||``)===String(c||``)&&String(e.resolution||``)===String(l||``)&&String(e.imageSize||``)===String(d||``)&&String(e.imageProportion||``)===String(f||``)&&String(e.imagePx||``)===String(p||``)&&!!e.includeMediaReferences==!!m&&JSON.stringify((e.references||[]).map(e=>e.upload_resource_id||e.url).filter(Boolean).sort())===JSON.stringify((h||[]).slice().sort())&&e.status===`prompt_optimized`&&new Date(e.createdAt).getTime()>_-1e4);y?(Vt.current=!0,localStorage.removeItem(`pending_optimize`),v(y),b(y.optimizedPrompt||``),ze(y.textCreditsCost),Ve(y.textTokensUsed),g(!0),Z.success({content:`优化请求已恢复,消耗 ${y.textCreditsCost} 积分`,key:`recovery`})):Date.now()-_>3e4&&localStorage.removeItem(`pending_optimize`)}catch{localStorage.removeItem(`pending_optimize`)}},[u,e]);let Ut=r.find(t=>t.id===e),Wt=u.filter(t=>t.projectId===e),Gt=Ut?.name??`项目`,Kt=(0,S.useMemo)(()=>Ut&&se[Ut.industry]||[],[Ut,se]),qt=d?.credits??0,Jt=qt>=ft(),Yt=async()=>{try{if(!e){Z.error(`项目ID为空,请先选择项目`);return}let t=await n.validateFields();if(!t.prompt||!t.prompt.trim()){Z.error(`请输入视频/图片描述`);return}if(!Te){Z.error(`请选择生成引擎`);return}if(He===`video`&&(!_e||!ye)){Z.error(`请选择视频比例和分辨率`);return}m(!0);let r=Object.entries(le).map(([e,t])=>`@${e}:${t}`),i=r.length>0?`${t.prompt}\n\n${r.join(`;`)}`:t.prompt,a=Lse();localStorage.setItem(`pending_optimize`,JSON.stringify({key:a,projectId:e,prompt:i,duration:he,engineId:Te,genType:He,aspectRatio:He===`video`?_e:``,resolution:He===`video`?ye:``,imageSize:He===`image`?Ke:``,imageProportion:He===`image`?We:``,imagePx:He===`image`?`${Je}x${Ze}`:``,includeMediaReferences:De,referenceIds:H.map(e=>e.upload_resource_id||e.url).filter(Boolean).sort(),ts:Date.now()})),Ht.current=a;let o=await s(e,{prompt:i,duration:He===`video`?he:void 0,genType:He,engineId:Te,includeMediaReferences:De,aspectRatio:He===`video`?_e:void 0,resolution:He===`video`?ye:void 0,references:H.length>0?H:void 0,idempotencyKey:a,image_size:He===`image`?Ke:void 0,image_proportion:He===`image`?We:void 0,image_px:He===`image`?Je+`x`+Ze:void 0});localStorage.removeItem(`pending_optimize`),Ht.current=null,v(o.record),b(o.record.optimizedPrompt||``),ze(o.textCreditsCost),Ve(o.textTokensUsed),g(!0),Z.success({content:`「${Gt}」提示词优化完成,消耗 ${o.textCreditsCost} 积分`,key:`optimize`})}catch(e){let t=e?.response?.data?.message||e?.message||`操作失败,请稍后重试`;Z.error(t)}finally{m(!1),localStorage.removeItem(`pending_optimize`),Ht.current=null}},Xt=(0,S.useRef)(new Set),Zt=(0,S.useRef)(null),Qt=(0,S.useRef)(null),$t=e=>{Xt.current.add(e),nn()},en=e=>{Xt.current.delete(e),Xt.current.size===0&&tn()},tn=()=>{Zt.current&&=(clearInterval(Zt.current),null),Qt.current&&=(Qt.current.abort(),null)},nn=()=>{Zt.current||=setInterval(async()=>{try{Qt.current&&Qt.current.abort();let t=new AbortController;Qt.current=t;let n=await s5({projectId:e,page:1,pageSize:100,signal:t.signal});Qt.current=null;let r=Array.from(Xt.current),i=[];if(r.length>0){let e=u7.getState().records,t=e.items.map(e=>{if(r.includes(e.id)){let t=n.items.find(t=>t.id===e.id);if(t){let n=E[e.id];return t.shouldPoll??t.status===`generating`?n!==`generating`&&D(t=>({...t,[e.id]:`generating`})):i.push(e.id),t}}return e});u7.setState({records:{...e,items:t}}),i.forEach(e=>{let t=n.items.find(t=>t.id===e);en(e),t?.status===`completed`?(D(t=>({...t,[e]:`done`})),v(n=>n?.id===e?t:n),Z.success({content:`「${Gt}」视频生成完成!`,key:e,duration:5})):t?.status===`failed`&&(D(t=>({...t,[e]:`failed`})),v(n=>n?.id===e?t:n),Z.error({content:`「${Gt}」视频生成失败: ${t.errorMessage||`未知错误`}`,key:e,duration:5}))})}}catch(e){e.name}},5e3)},rn=e=>{$t(e)};(0,S.useEffect)(()=>()=>{tn(),Rt()},[]),(0,S.useEffect)(()=>{u.filter(e=>e.shouldPoll??e.status===`generating`).forEach(e=>{D(t=>({...t,[e.id]:`generating`})),rn(e.id)})},[u]);let an=async e=>{T(t=>({...t,[e]:!0})),D(t=>({...t,[e]:`generating`})),Z.loading({content:`「${Gt}」正在提交视频生成...`,duration:0,key:e});try{let t=Wt.find(t=>t.id===e)||_;if(!t||t.canGenerate===!1)throw Error(t?.configFallbackHint||`该记录当前不可生成,请重新生成提词`);let n=t.id===_?.id?y:I[e];n&&n!==t.optimizedPrompt&&await p5(e,n),(await c(e)).status===`failed`?(D(t=>({...t,[e]:`failed`})),Z.error({content:`「${Gt}」提交失败`,key:e,duration:3})):(Z.success({content:`「${Gt}」已提交,正在生成中...`,key:e,duration:3}),rn(e))}catch(t){D(t=>({...t,[e]:`failed`}));let n=`提交失败`;t?.response?.data?.detail?n=t.response.data.detail:t?.data?.detail?n=t.data.detail:t?.detail?n=t.detail:t?.message&&(n=t.message),Z.error({content:`${n}`,key:e,duration:3})}finally{T(t=>({...t,[e]:!1}))}},on=e=>{let t=E[e.id];return A7({status:(t===`done`?`completed`:t)||e.status,pipelineStage:t?null:e.pipelineStage,clientStatus:t?null:e.clientStatus,shouldPoll:t?t===`generating`:e.shouldPoll,canGenerate:e.canGenerate,canRetry:e.canRetry})},sn=e=>e.isActive?(0,$.jsx)(Xm,{style:{animation:`spinSlow 1s linear infinite`}}):e.isSuccess?(0,$.jsx)(B2,{}):e.isFailure?(0,$.jsx)(U2,{}):(0,$.jsx)(TB,{});return(0,$.jsxs)(`div`,{style:{margin:`-24px -32px -32px`,borderRadius:20,height:`calc(100vh - 8px)`,padding:`24px`,background:`#fff`,overflowY:`auto`},children:[(0,$.jsxs)(`div`,{className:`gen-header animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:24,padding:`16px 24px`,borderRadius:16,background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(99, 102, 241, 0.08)`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(X,{icon:(0,$.jsx)(q0,{}),onClick:()=>t(`/projects`),style:{borderRadius:10,fontSize:13,height:32,background:`rgba(99, 102, 241, 0.1)`,border:`1px solid rgba(99, 102, 241, 0.2)`,color:`#6366f1`},children:`返回`}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #6366f1, #8b5cf6, transparent)`,borderRadius:1}}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0,fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:Gt}),Ut&&(0,$.jsx)(SQ,{style:{background:`rgba(99, 102, 241, 0.08)`,border:`1px solid rgba(99, 102, 241, 0.15)`,color:`#6366f1`,borderRadius:6},children:q[Ut.industry]||Ut.industry})]}),(0,$.jsx)(Q.Text,{style:{color:`#64748b`,fontSize:13},children:`描述视频 → AI优化 → 生成视频`})]}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #8b5cf6, #6366f1, transparent)`,borderRadius:1}})]}),(0,$.jsxs)(SQ,{style:{background:`rgba(99, 102, 241, 0.08)`,border:`1px solid rgba(99, 102, 241, 0.15)`,color:`#6366f1`,borderRadius:20,fontSize:13,padding:`4px 14px`},children:[`剩余 `,qt,` 积分`]})]}),!h&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`animate-fadeInUp`,style:{marginBottom:24,padding:`16px 20px`,borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,boxShadow:`0 2px 12px rgba(0,0,0,0.03)`},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`flex-start`},children:[(0,$.jsxs)(`div`,{style:{marginRight:70,position:`relative`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:14,fontWeight:500,color:`#475569`,marginRight:16},children:`生成类型:`}),(0,$.jsxs)(LF.Group,{defaultValue:`video`,buttonStyle:`solid`,onChange:kt,children:[(0,$.jsxs)(LF.Button,{value:`video`,children:[(0,$.jsx)(z8,{style:{marginRight:6,fontSize:14}}),` `,`视频`]}),(0,$.jsxs)(LF.Button,{value:`image`,style:{zIndex:0},children:[(0,$.jsx)(L6,{style:{marginRight:6,fontSize:14}}),` `,`图片`]})]})]}),He===`video`&&[{icon:(0,$.jsx)(i$,{}),label:`描述视频+时长`,color:`#6366f1`},{icon:(0,$.jsx)(D8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(t8,{}),label:`选择参数生成`,color:`#10b981`}].map((e,t)=>(0,$.jsxs)(S.Fragment,{children:[t>0&&(0,$.jsx)(`div`,{style:{width:40,height:1,background:`linear-gradient(90deg, #e2e8f0, #cbd5e1, #e2e8f0)`,margin:`0 12px`,flexShrink:0}}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:10,background:`${e.color}12`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`span`,{style:{color:e.color,fontSize:15},children:e.icon})}),(0,$.jsx)(Q.Text,{style:{fontSize:13,fontWeight:500,color:`#1a1a2e`},children:e.label})]})]},t)),He===`image`&&[{icon:(0,$.jsx)(i$,{}),label:`描述图片+尺寸`,color:`#6366f1`},{icon:(0,$.jsx)(D8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(t8,{}),label:`图片生成`,color:`#10b981`}].map((e,t)=>(0,$.jsxs)(S.Fragment,{children:[t>0&&(0,$.jsx)(`div`,{style:{width:40,height:1,background:`linear-gradient(90deg, #e2e8f0, #cbd5e1, #e2e8f0)`,margin:`0 12px`,flexShrink:0}}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:10,background:`${e.color}12`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`span`,{style:{color:e.color,fontSize:15},children:e.icon})}),(0,$.jsx)(Q.Text,{style:{fontSize:13,fontWeight:500,color:`#1a1a2e`},children:e.label})]})]},t))]})}),(0,$.jsxs)(vH,{form:n,initialValues:{},children:[(0,$.jsx)(vH.Item,{name:`prompt`,noStyle:!0,rules:[{required:!0,message:`请输入视频描述`}],style:{display:`none`}}),(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{borderRadius:20,background:`#fff`,border:`1px solid #f0f0f5`,boxShadow:`0 4px 24px rgba(0,0,0,0.04)`,overflow:`visible`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`12px 16px 0`,minHeight:60},children:[H.map((e,t)=>(0,$.jsxs)(`div`,{className:`ref-thumb`,style:{position:`relative`,width:48,height:48,borderRadius:12,overflow:`visible`,flexShrink:0},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:12,overflow:`hidden`,border:`1px solid #e2e8f0`,cursor:`pointer`},onClick:()=>{e.type===`video`&&me(`https://ceshi.apiforeign.minzhongzc.com${e.url}`)},children:e.type===`image`?(0,$.jsx)(vU,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):(0,$.jsx)(M7,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`})}),(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),f5(e.url).catch(()=>{}),U(e=>e.filter((e,n)=>n!==t))},style:{position:`absolute`,top:-4,right:-4,width:16,height:16,borderRadius:`50%`,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,zIndex:10,opacity:0,transition:`opacity 0.15s`,backdropFilter:`blur(4px)`},children:(0,$.jsx)(U2,{style:{color:`#fff`,fontSize:10}})})]},t)),(0,$.jsx)(T7,{accept:`image/*,video/*`,mediaType:He,onLocalSelect:e=>{e.forEach(async e=>{await ut(e)})},onHistorySelect:e=>{e.forEach(e=>{U(t=>[...t,{url:e.resourceUrl||e.previewUrl||e.displayUrl||``,type:e.resourceType,name:e.fileName||``}])}),Z.success(`成功添加${e.length}个历史记录`)},onPortraitSelect:e=>{e.forEach(e=>{U(t=>[...t,{url:e.previewUrl||``,type:e.assetType===`Video`?`video`:`image`,name:e.name||`真人素材`,source:`private_portrait_asset`,private_asset_id:e.id,label:``,duration:e.assetType===`Video`?e.videoDuration||0:void 0}])}),Z.success(`已添加 ${e.length} 个真人素材参考`)},uploading:W,tooltipTitle:`图片${H.filter(e=>e.type===`image`).length}/5,视频${H.filter(e=>e.type===`video`).length}/2`,maxImageCount:5,maxVideoCount:2,usedImageCount:H.filter(e=>e.type===`image`).length,usedVideoCount:H.filter(e=>e.type===`video`).length,usedVideoDuration:H.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0),maxVideoDuration:15,children:(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:12,border:`1.5px dashed #d9d9d9`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.2s`,flexShrink:0},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6366f1`,e.currentTarget.style.background=`rgba(99,102,241,0.04)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`#d9d9d9`,e.currentTarget.style.background=`transparent`},children:W?(0,$.jsx)(Xm,{style:{fontSize:18,color:`#6366f1`}}):(0,$.jsx)(jI,{style:{fontSize:18,color:`#94a3b8`}})})})]}),(0,$.jsx)(`div`,{style:{padding:`8px 16px 4px`},children:(0,$.jsx)($U.TextArea,{ref:ae,value:K,onChange:e=>{let t=e.target.value;ee(t),n.setFieldsValue({prompt:t});let r=t.lastIndexOf(`@`);if(r>=0){let e=t.slice(r+1);if(!e.includes(` `)&&!e.includes(` `)){ne(!0),ie(e);return}}ne(!1)},onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e=0;e0&&(e.preventDefault(),n.forEach(async e=>{await ut(e)}))},rows:3,placeholder:`上传参考素材后(手动开启是否参与最终生成,如不开启则只用做模型理解)、输入文字,自由组合图、文多元素。输入 @ 可引用参考内容...`,maxLength:500,variant:`borderless`,autoSize:{minRows:2,maxRows:6},style:{padding:`6px 2px`,fontSize:15,lineHeight:1.7,resize:`none`,caretColor:`#6366f1`}})}),te&&H.length>0&&(0,$.jsx)(`div`,{style:{margin:`0 16px 8px`,background:`#fff`,borderRadius:10,boxShadow:`0 6px 24px rgba(0,0,0,0.12)`,border:`1px solid #e2e8f0`,padding:6,maxHeight:180,overflowY:`auto`},children:(()=>{let e=H.filter(e=>!re||e.name.includes(re));return(e.length>0?e:H).map((e,t)=>{let r=H.indexOf(e);return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 10px`,borderRadius:8,cursor:`pointer`,transition:`background 0.15s`},onMouseEnter:e=>e.currentTarget.style.background=`#f1f5f9`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onMouseDown:t=>{t.preventDefault();let i=ae.current?.resizableTextArea?.textArea||ae.current?.nativeElement?.querySelector(`textarea`)||ae.current;if(!i||!i.value)return;let a=i.value,o=a.lastIndexOf(`@`),s=e.name||(e.type===`image`?`图片${r+1}`:`视频${r+1}`),c=a.slice(0,o)+`@${s} `;ee(c),n.setFieldValue(`prompt`,c),ne(!1),setTimeout(()=>{i.focus(),i.selectionStart=c.length,i.selectionEnd=c.length},50)},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,overflow:`hidden`,background:e.type===`image`?`#f1f5f9`:`#1a1a2e`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:e.type===`image`?(0,$.jsx)(`img`,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(K6,{style:{color:`#fff`,fontSize:14}})}),(0,$.jsx)(Q.Text,{style:{fontSize:13},children:e.name||(e.type===`image`?`图片${r+1}`:`视频${r+1}`)}),(0,$.jsx)(SQ,{style:{marginLeft:`auto`,fontSize:11},children:e.type===`image`?`图片`:`视频`})]},t)})})()}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`8px 12px 12px`,gap:8,flexWrap:`wrap`,position:`relative`,zIndex:50,minHeight:48},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,$.jsx)(j7,{label:`引擎`,value:(He===`image`?Ce:xe).filter(e=>e.supportsUniversalReference!==!1).find(e=>e.id===Te)?.name||`选择引擎`,options:(He===`image`?Ce:xe).filter(e=>e.supportsUniversalReference!==!1).map(e=>e.name),expanded:ke===`engine`,onToggle:()=>Ae(ke===`engine`?null:`engine`),onSelect:e=>{let t=(He===`image`?Ce:xe).filter(e=>e.supportsUniversalReference!==!1).find(t=>t.name===e);t&&jt(t.id),Ae(null)},onClose:()=>Ae(null)}),He!==`image`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>{Me(!je),Ae(null)},className:`image-settings-trigger`,style:{width:`100%`,padding:`4px 12px`,height:34,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.15)`,backgroundColor:`rgba(255,255,255,0.7)`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:6,transition:`all 0.2s`},children:[(0,$.jsx)(P3,{style:{fontSize:14,color:`#6366f1`}}),(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:[_e,` · `,he,`s · `,ye]})]}),je&&(0,$.jsxs)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:-160,width:350,backgroundColor:`#fff`,borderRadius:16,boxShadow:`0 10px 40px rgba(0,0,0,0.15)`,padding:16,border:`none`,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(`span`,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:Ne.ratios.map(e=>{let[t,n]=e.split(`:`).map(Number),r=t>=n?18:Math.round(t/n*18),i=n>=t?18:Math.round(n/t*18);return(0,$.jsxs)(`button`,{onClick:()=>ve(e),style:{flex:`0 0 calc(12.5% - 4px)`,minWidth:44,height:52,borderRadius:6,border:_e===e?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:_e===e?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{width:r,height:i,border:`2px solid ${_e===e?`#6366f1`:`#9ca3af`}`,borderRadius:3,marginBottom:2}}),(0,$.jsx)(`span`,{style:{fontSize:9,color:_e===e?`#6366f1`:`#6b7280`,fontWeight:_e===e?600:400},children:e})]},e)})})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(`span`,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择时长`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`,height:24,display:`flex`,alignItems:`center`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:0,right:0,height:6,borderRadius:3,background:`#e5e7eb`,transform:`translateY(-50%)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:0,height:6,borderRadius:3,background:`#6366f1`,width:`${(he-Math.min(...Ne.durations))/(Math.max(...Ne.durations)-Math.min(...Ne.durations))*100}%`,transform:`translateY(-50%)`}}),(0,$.jsx)(`input`,{type:`range`,min:Math.min(...Ne.durations),max:Math.max(...Ne.durations),value:he,onChange:e=>ge(Number(e.target.value)),style:{position:`relative`,width:`100%`,height:24,borderRadius:3,background:`transparent`,outline:`none`,appearance:`none`,cursor:`pointer`,zIndex:1}})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 12px`,backgroundColor:`#f1f5f9`,borderRadius:6},children:[(0,$.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:`#64748b`},children:he}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#9ca3af`},children:`秒`})]})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:6},children:Ne.resolutions.map(e=>(0,$.jsx)(`button`,{onClick:()=>be(e),style:{flex:1,height:42,borderRadius:8,border:ye===e?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:ye===e?`#6366f1`:`#f9fafb`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:(0,$.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:ye===e?`#fff`:`#4b5563`},children:e})},e))})]})]})]}),Kt.map((e,t)=>{let n=de===e.name,r=le[e.name];return(0,$.jsx)(Gse,{group:e,groupName:e.name,selected:r,expanded:n,onToggle:Fe,onSelect:Le,onClose:Ie},`og-${t}`)})]}),He==`image`&&(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>{tt(!et),Ae(null)},className:`image-settings-trigger`,style:{width:`100%`,padding:`4px 12px`,height:34,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.15)`,backgroundColor:`rgba(255,255,255,0.7)`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:6,transition:`all 0.2s`},children:[(0,$.jsx)(P3,{style:{fontSize:14,color:`#6366f1`}}),(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:[We===`auto`?`智能`:We,` · `,Ke,` · `,Je,`×`,Ze]})]}),et&&(0,$.jsxs)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:-160,width:350,backgroundColor:`#fff`,borderRadius:16,boxShadow:`0 10px 40px rgba(0,0,0,0.15)`,padding:16,border:`none`,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:8,fontSize:13,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:gt.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{Ge(e.value),mt(e.label)},style:{flex:`0 0 calc(11.11% - 5px)`,minWidth:48,height:52,borderRadius:6,border:We===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:We===e.value?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{width:(()=>{let[t,n]=e.value===`auto`?[1,1]:e.value.split(`:`).map(Number);return t>=n?20:Math.round(t/n*20)})(),height:(()=>{let[t,n]=e.value===`auto`?[1,1]:e.value.split(`:`).map(Number);return n>=t?20:Math.round(n/t*20)})(),border:`2px solid ${We===e.value?`#6366f1`:`#9ca3af`}`,borderRadius:(e.value,3),marginBottom:3,display:`flex`,alignItems:`center`,justifyContent:`center`},children:e.value===`auto`&&(0,$.jsx)(`span`,{style:{fontSize:8,color:We===e.value?`#6366f1`:`#9ca3af`},children:`智`})}),(0,$.jsx)(`span`,{style:{fontSize:10,color:We===e.value?`#6366f1`:`#6b7280`,fontWeight:We===e.value?600:400},children:e.value})]},e.value))})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:8,fontSize:13,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:6},children:vt.map(e=>(0,$.jsx)(`button`,{onClick:()=>{qe(e.value),ht(e.label)},style:{flex:1,height:44,borderRadius:6,border:Ke===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Ke===e.value?`#6366f1`:`#f9fafb`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:(0,$.jsxs)(`span`,{style:{fontSize:12,fontWeight:600,color:Ke===e.value?`#fff`:`#4b5563`},children:[e.value,e.value===`4k`&&(0,$.jsx)(`span`,{style:{marginLeft:3},children:`✨`})]})},e.value))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:8,fontSize:13,fontWeight:500,color:`#666666`},children:`尺寸`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flex:1,maxWidth:140},children:[(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:12,marginRight:6},children:`W`}),(0,$.jsx)($U,{value:Je,onChange:e=>Xe(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:6,height:36,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:13,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`button`,{onClick:Ot,style:{width:26,height:26,borderRadius:6,border:`1px solid #e5e7eb`,backgroundColor:`#fff`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,color:`#6366f1`},children:(0,$.jsx)(rU,{style:{fontSize:12}})}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flex:1,maxWidth:140},children:[(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:12,marginRight:6},children:`H`}),(0,$.jsx)($U,{value:Ze,onChange:e=>Qe(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:6,height:36,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:13,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:12},children:`PX`})]})]})]})]}),H.length>0&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(xq,{size:`small`,checked:De,onChange:Oe}),(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#64748b`},children:`生成时携带附件`})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0},children:[He===`image`&&(0,$.jsx)(`span`,{style:{color:`#7c7c7c`,fontSize:14},children:`(请在左侧选择图片比例和尺寸)`}),(0,$.jsx)(kw,{title:(d?.credits||0){if((d?.credits||0){let e=await g7(y);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(kw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(i$,{}),onClick:()=>C(!0),style:{color:`#6366f1`}})})]})]}),x?(0,$.jsxs)(`div`,{children:[(0,$.jsx)($U.TextArea,{value:y,onChange:e=>b(e.target.value),rows:5,style:{borderRadius:12,fontSize:14,lineHeight:1.7,border:`1px solid rgba(99,102,241,0.25)`,background:`rgba(99,102,241,0.02)`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:8},children:[(0,$.jsx)(X,{size:`small`,onClick:()=>{b(_.optimizedPrompt||``),C(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{C(!1),Z.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:14,borderRadius:12,background:`rgba(99,102,241,0.02)`,border:`1px solid rgba(99,102,241,0.1)`,minHeight:100},children:(0,$.jsx)(Q.Text,{style:{fontSize:14,color:`#1a1a2e`,lineHeight:1.7},children:y})})]})]}):(0,$.jsxs)(`div`,{className:`gen-prompt-row`,style:{display:`flex`,gap:24,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{flex:`1 1 55%`,minWidth:280},children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`原始提示词`}),(0,$.jsx)(`div`,{style:{padding:14,borderRadius:12,background:`#f8f9fc`,border:`1px solid #f0f0f5`,minHeight:80},children:(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#64748b`,lineHeight:1.6},children:_.originalPrompt})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词`,` `,!x&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!x&&(0,$.jsxs)(wV,{size:4,children:[(0,$.jsx)(kw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(D$,{}),onClick:async()=>{let e=await g7(y);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(kw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(i$,{}),onClick:()=>C(!0),style:{color:`#6366f1`}})})]})]}),x?(0,$.jsxs)(`div`,{children:[(0,$.jsx)($U.TextArea,{value:y,onChange:e=>b(e.target.value),rows:5,style:{borderRadius:12,fontSize:13,lineHeight:1.6,border:`1px solid rgba(99,102,241,0.25)`,background:`rgba(99,102,241,0.02)`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:8},children:[(0,$.jsx)(X,{size:`small`,onClick:()=>{b(_.optimizedPrompt||``),C(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{C(!1),Z.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:14,borderRadius:12,background:`rgba(99,102,241,0.02)`,border:`1px solid rgba(99,102,241,0.1)`,minHeight:120},children:(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#1a1a2e`,lineHeight:1.6},children:y})})]})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 40%`,minWidth:280},children:[_.videoUrl&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`生成视频`}),(0,$.jsx)(`div`,{style:{borderRadius:12,overflow:`hidden`,border:`1px solid #f0f0f5`,background:`#000`},children:(0,$.jsx)(`video`,{src:`https://ceshi.apiforeign.minzhongzc.com${_.videoUrl}`,controls:!0,style:{width:`100%`,maxHeight:350,display:`block`}})})]}),_.imageUrl&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`生成图片`}),(0,$.jsx)(vU,{src:`https://ceshi.apiforeign.minzhongzc.com${_.imageUrl}`,style:{width:`100%`,maxHeight:350,objectFit:`contain`,borderRadius:12,border:`1px solid #f0f0f5`},preview:!0})]})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,flexWrap:`wrap`,gap:12,marginTop:20,padding:`14px 18px`,borderRadius:12,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:`引擎`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:(He===`image`?Ce:xe).find(e=>e.id===_.engineId)?.name||`-`})]}),He!==`image`&&(0,$.jsx)(`div`,{style:{borderRadius:12,background:`#f8f9fc`,padding:`8px 12px`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:[_.duration||he,`s`]})]}),(0,$.jsx)(j7,{label:`比例`,value:_.aspectRatio||_e,options:[String(_.aspectRatio||_e)],expanded:!1,onToggle:()=>void 0,onSelect:()=>void 0,onClose:()=>Ae(null)}),(0,$.jsx)(j7,{label:`分辨率`,value:_.resolution||ye,options:[String(_.resolution||ye)],expanded:!1,onToggle:()=>void 0,onSelect:()=>void 0,onClose:()=>Ae(null)})]})}),He==`image`&&_&&(0,$.jsx)(`div`,{style:{marginTop:24,borderRadius:12,background:`#f8f9fc`,width:`25%`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-around`},children:[(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`分辨率`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#1a1a2e`},children:_.imageSize||`-`})]}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`画面比例`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#1a1a2e`},children:_.imageProportion||`-`})]}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`画面尺寸`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#1a1a2e`},children:_.imagePx||`-`})]})]})}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 12px`,borderRadius:10,background:`rgba(255, 255, 255, 0.95)`,border:`1px solid rgba(231, 234, 240, 0.95)`,boxShadow:`0 2px 8px rgba(47, 52, 64, 0.03)`,flexShrink:1,minWidth:0},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`3px 8px`,borderRadius:6,background:`rgba(99, 102, 241, 0.08)`,flexShrink:0},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#6366f1`,fontWeight:500},children:`文字积分`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`,fontWeight:700},children:Re})]}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:12,fontWeight:500,flexShrink:0},children:`+`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`3px 8px`,borderRadius:6,background:`rgba(16, 185, 129, 0.08)`,flexShrink:0},children:[(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#10b981`,fontWeight:500},children:[`预估`,He===`image`?`图`:`视`,`积分`]}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:13,color:`#10b981`,fontWeight:700},children:ft()})]}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:12,fontWeight:500,flexShrink:0},children:`=`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 10px`,borderRadius:6,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.12) 100%)`,border:`1px solid rgba(99, 102, 241, 0.2)`,flexShrink:0},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#6366f1`,fontWeight:600},children:`总计`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#6366f1`,fontWeight:800},children:(Re+ft()).toFixed(2)})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12,marginLeft:`auto`},children:[(0,$.jsxs)(X,{size:`large`,onClick:()=>{g(!1),v(null),b(``),ee(``),U([]),ue({}),fe(null),Ae(null),n.resetFields()},style:{borderRadius:12,minWidth:120,height:44,fontWeight:500},children:[`配置新`,He===`image`?`图片`:`视频`]}),(0,$.jsx)(kw,{title:Jt?``:`积分不足`,children:(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(t8,{}),onClick:()=>an(_.id),loading:E[_.id]===`generating`,disabled:!Jt||_.canGenerate===!1||E[_.id]===`generating`||E[_.id]===`done`,style:{borderRadius:12,minWidth:180,height:44,fontWeight:600,background:E[_.id]===`done`?`#10b981`:Jt?`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`:`#d1d5db`,border:`none`,boxShadow:Jt?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:E[_.id]===`done`?`生成完成`:E[_.id]===`generating`?`生成中...`:`生成${He===`image`?`图片`:`视频`} (${ft()}积分)`})})]})]}),_.references&&_.references.length>0&&(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`参考内容`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:_.references.map((e,t)=>(0,$.jsxs)(`div`,{style:{width:64,height:64,borderRadius:10,overflow:`hidden`,border:`1px solid #e2e8f0`,position:`relative`,cursor:`pointer`},onClick:()=>{e.type===`video`&&me(`https://ceshi.apiforeign.minzhongzc.com${e.url}`)},children:[e.type===`image`?(0,$.jsx)(vU,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(M7,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`,width:64,height:64}),(0,$.jsx)(SQ,{style:{position:`absolute`,bottom:0,left:0,right:0,margin:0,fontSize:9,textAlign:`center`,borderRadius:`0 0 8px 8px`,background:`rgba(0,0,0,0.5)`,border:`none`,color:`#fff`,padding:`0 2px`},children:e.name})]},t))})]})]}),Wt.length>0&&(0,$.jsxs)(`div`,{style:{marginTop:24},children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,display:`block`,marginBottom:12},children:`本项目生成记录`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,background:`#fff`,borderRadius:12,padding:8,border:`1px solid #f0f0f5`},className:`stagger-children`,children:Wt.map((e,t)=>{let n=on(e),r=n.effectiveKey,i=I[e.id]??(e.optimizedPrompt||e.originalPrompt),a=B===e.id,o=e.genType||`image`;return(0,$.jsxs)(`div`,{className:`animate-slideInCard`,style:{animationDelay:`${t*.05}s`},children:[(0,$.jsxs)(`div`,{className:`record-item`,onClick:()=>V(a?null:e.id),style:{padding:`12px 16px`,borderRadius:a?`8px 8px 0 0`:8,background:`#fafafa`,cursor:`pointer`,transition:`all 0.2s`,display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:8,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,background:o===`image`?`#fef3c7`:`#dbeafe`},children:o===`image`?(0,$.jsx)(L6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(z8,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(xZ,{style:{color:`#6366f1`,fontSize:11,flexShrink:0}}):(0,$.jsx)(L2,{style:{color:`#cbd5e1`,fontSize:11,flexShrink:0}}),(0,$.jsx)(SQ,{color:n.color,icon:sn(n),style:{margin:0},children:n.label}),(0,$.jsx)(Q.Text,{style:{flex:1,fontSize:13,color:`#475569`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:i}),r===`prompt_optimized`&&(0,$.jsx)(SQ,{color:`processing`,style:{padding:`3px 10px`,fontSize:12,margin:0,flexShrink:0},children:`待生成`}),o===`image`?(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.imageSize||`-`,` ·`,` `,e.imageProportion||`-`,` ·`,` `,e.imagePx||`-`,` ·`,` `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:f7(e.createdAt)})]}):(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.duration?`${e.duration}秒`:`-`,` ·`,` `,e.aspectRatio||`-`,` · `,e.resolution||`-`,` `,`·`,` `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:f7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation()})]}),a&&(0,$.jsx)(`div`,{style:{background:`#fff`,borderRadius:`0 0 8px 8px`,padding:`18px 20px`,animation:`fadeInUp 0.25s ease both`},children:(0,$.jsxs)(`div`,{className:`gen-detail-row`,style:{display:`flex`,gap:20,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{flex:`1 1 50%`,minWidth:260},children:[(0,$.jsxs)(`div`,{style:{marginBottom:14},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`原始提示词`}),(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#64748b`,lineHeight:1.7},children:e.originalPrompt})})]}),(0,$.jsxs)(`div`,{style:{marginBottom:14},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:6},children:[(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词`,` `,(r===`prompt_optimized`||n.isFailure)&&R!==e.id&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),R!==e.id&&(0,$.jsxs)(wV,{size:4,children:[(0,$.jsx)(kw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(D$,{}),onClick:async()=>{let e=await g7(i);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(r===`prompt_optimized`||n.isFailure)&&(0,$.jsx)(kw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(i$,{}),onClick:()=>{z(e.id),L(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt??``}))},style:{color:`#6366f1`}})})]})]}),R===e.id?(0,$.jsxs)(`div`,{children:[(0,$.jsx)($U.TextArea,{value:i,onChange:t=>L(n=>({...n,[e.id]:t.target.value})),rows:4,style:{borderRadius:10,fontSize:13,lineHeight:1.7,border:`1px solid rgba(99,102,241,0.25)`,background:`rgba(99,102,241,0.02)`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:8},children:[(0,$.jsx)(X,{size:`small`,onClick:()=>z(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{L(t=>({...t,[e.id]:i})),z(null),Z.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:r===`prompt_optimized`?`rgba(99,102,241,0.02)`:`#f8f9fc`,border:r===`prompt_optimized`?`1px solid rgba(99,102,241,0.1)`:`1px solid #f0f0f5`},children:(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#1a1a2e`,lineHeight:1.7},children:i})})]}),o===`image`?(0,$.jsx)(`div`,{style:{padding:`10px 14px`,borderRadius:10,background:`#f8f9fc`},children:(0,$.jsx)(`div`,{children:(0,$.jsx)(`div`,{style:{width:`100%`,display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:[{label:`引擎`,value:`${e.engineName}`},{label:`文字积分`,value:`${e.textCreditsCost||0}`},{label:`图片积分`,value:`${e.creditsCost||0}`},{label:`分辨率`,value:e.imageSize||`-`},{label:`比例`,value:e.imageProportion||`-`},{label:`尺寸`,value:e.imagePx||`-`},{label:`附件`,value:e.includeMediaReferences?`生成时携带`:`仅用于提词或不携带`}].map((e,t)=>(0,$.jsxs)(`div`,{style:{width:`21%`,textAlign:`left`,marginBottom:10},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:12,color:`#1a1a2e`},children:e.value})]},t))})})}):(0,$.jsx)(`div`,{style:{padding:`10px 14px`,borderRadius:10,background:`#f8f9fc`},children:(0,$.jsx)(`div`,{children:(0,$.jsx)(`div`,{style:{width:`100%`,display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:[{label:`引擎`,value:`${e.engineName}`},{label:`文字积分`,value:`${e.textCreditsCost||0}`},{label:`视频积分`,value:`${e.creditsCost||0}`},{label:`时长`,value:e.duration?`${e.duration}秒`:`-`},{label:`比例`,value:e.aspectRatio||`-`},{label:`分辨率`,value:e.resolution||`-`},{label:`附件`,value:e.includeMediaReferences?`生成时携带`:`仅用于提词或不携带`}].map((e,t)=>(0,$.jsxs)(`div`,{style:{width:`21%`,textAlign:`left`,marginBottom:10,marginRight:10},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:12,color:`#1a1a2e`},children:e.value})]},t))})})}),(e.references&&e.references.length>0||n.isFailure)&&(0,$.jsxs)(`div`,{style:{marginTop:14},children:[(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:[`参考素材`,` `,n.isFailure&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可删除/添加后重试)`})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[e.references?.map((t,r)=>(0,$.jsxs)(`div`,{style:{width:64,height:64,borderRadius:10,overflow:`visible`,border:`1px solid #e2e8f0`,position:`relative`,cursor:`pointer`},onClick:()=>{t.type===`video`&&me(`https://ceshi.apiforeign.minzhongzc.com${t.url}`)},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:10,overflow:`hidden`},children:t.type===`image`?(0,$.jsx)(vU,{src:`https://ceshi.apiforeign.minzhongzc.com${t.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(M7,{src:`https://ceshi.apiforeign.minzhongzc.com${t.url}`,width:64,height:64})}),(0,$.jsx)(SQ,{style:{position:`absolute`,bottom:0,left:0,right:0,margin:0,fontSize:9,textAlign:`center`,borderRadius:`0 0 8px 8px`,background:`rgba(0,0,0,0.5)`,border:`none`,color:`#fff`,padding:`0 2px`},children:t.name}),n.isFailure&&(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),f5(t.url).catch(()=>{});let i=e.references.filter((e,t)=>t!==r);u7.getState().updateRecordReferences(e.id,i)},style:{position:`absolute`,top:-4,right:-4,width:16,height:16,borderRadius:`50%`,background:`rgba(239,68,68,0.8)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,zIndex:10,opacity:0,transition:`opacity 0.15s`},children:(0,$.jsx)(U2,{style:{color:`#fff`,fontSize:10}})})]},r)),n.isFailure&&(0,$.jsx)(K1,{accept:`image/*,video/*`,showUploadList:!1,multiple:!0,beforeUpload:t=>{let n=t.type.startsWith(`image/`),r=t.type.startsWith(`video/`);return!n&&!r?(Z.error(`仅支持图片或视频文件`),!1):(n?l5(t).then(n=>{let r={url:n.url,type:`image`,name:t.name||`图片`},i=e.references||[];u7.getState().updateRecordReferences(e.id,[...i,r]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`)):new Promise(e=>{let n=document.createElement(`video`);n.preload=`metadata`,n.onloadedmetadata=()=>{e(n.duration||0),n.remove()},n.onerror=()=>{e(0),n.remove()},n.src=URL.createObjectURL(t)}).then(n=>{u5(t,n).then(r=>{let i={url:r.url,type:`video`,name:t.name||`视频`,duration:n||void 0},a=e.references||[];u7.getState().updateRecordReferences(e.id,[...a,i]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`))}),!1)},children:(0,$.jsx)(kw,{title:`添加参考素材`,children:(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:10,border:`1.5px dashed #d9d9d9`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.2s`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6366f1`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`#d9d9d9`},children:(0,$.jsx)(jI,{style:{fontSize:18,color:`#94a3b8`}})})})})]})]})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 40%`,minWidth:220,position:`relative`},children:[r===`prompt_optimized`&&(0,$.jsxs)(`div`,{style:{position:`absolute`,inset:0,padding:16,borderRadius:12,background:`#f8f9fc`,border:`1px solid #e2e8f0`,display:`flex`,flexDirection:`column`,justifyContent:`space-between`},children:[(0,$.jsx)(`div`,{style:{height:`100%`,minHeight:180,borderRadius:12,background:`linear-gradient(135deg, rgba(99,102,241,0.04), rgba(139,92,246,0.04))`,border:`1px dashed rgba(99,102,241,0.2)`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:10},children:(0,$.jsxs)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:[o===`video`?`视频`:`图片`,`等待生成`]})}),(0,$.jsx)(kw,{title:(d?.credits||0){if((d?.credits||0){let t=document.createElement(`a`);t.href=`https://ceshi.apiforeign.minzhongzc.com${o===`video`?e.videoUrl:e.imageUrl}&download=1`,t.download=`${e.projectName}${o===`video`?`.mp4`:`.png`}`,t.click()},style:{background:`rgba(0,0,0,0.5)`,border:`none`,color:`#fff`,backdropFilter:`blur(4px)`,borderRadius:8},children:`下载`})})}),(0,$.jsx)(`div`,{style:{minHeight:180,overflow:`hidden`},children:o===`video`?(0,$.jsx)(`video`,{src:`https://ceshi.apiforeign.minzhongzc.com${e.videoUrl}`,controls:!0,preload:`metadata`,style:{width:`100%`,height:`400px`,borderRadius:0}}):(0,$.jsx)(`img`,{src:`https://ceshi.apiforeign.minzhongzc.com${e.imageUrl}`,alt:e.projectName,style:{width:`100%`,maxHeight:`400px`,objectFit:`contain`,borderRadius:0}})}),(0,$.jsxs)(`div`,{style:{padding:`8px 12px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,background:`#fafbff`},children:[(0,$.jsxs)(wV,{children:[o===`video`?(0,$.jsx)(z8,{style:{color:`#6366f1`,fontSize:13}}):(0,$.jsx)(L6,{style:{color:`#6366f1`,fontSize:13}}),(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#475569`},children:e.projectName})]}),e.generatedAt&&(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:11,color:`#94a3b8`},children:f7(e.generatedAt)})]})]}):n.isFailure?(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:180,borderRadius:12,background:`rgba(239,68,68,0.03)`,border:`1px dashed rgba(239,68,68,0.2)`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:10,padding:16},children:[(0,$.jsx)(U2,{style:{color:`#ef4444`,fontSize:28}}),(0,$.jsxs)(Q.Text,{style:{color:`#ef4444`,fontSize:14,fontWeight:600},children:[o===`video`?`视频`:`图片`,`生成失败`]}),e.errorMessage&&(0,$.jsx)(Q.Text,{style:{color:`#ef4444`,fontSize:12,textAlign:`center`,lineHeight:1.6},children:e.errorMessage})]}):(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:180,borderRadius:12,background:`#f8f9fc`,border:`1px dashed #e2e8f0`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:10},children:[(0,$.jsx)(TB,{style:{color:`#94a3b8`,fontSize:28}}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:o===`image`?`待生成图片`:`待生成视频`})]})]})]})})]},e.id)})})]}),(0,$.jsx)(jG,{open:!!pe,onCancel:()=>me(null),footer:null,width:480,centered:!0,destroyOnHidden:!0,closable:!1,title:null,styles:{body:{padding:0,background:`#000`,position:`relative`}},children:pe&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:pe,controls:!0,autoPlay:!0,style:{width:`100%`,display:`block`,maxHeight:`70vh`}}),(0,$.jsx)(`div`,{onClick:()=>me(null),style:{position:`absolute`,top:8,right:8,width:28,height:28,borderRadius:`50%`,background:`rgba(0,0,0,0.6)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,zIndex:10,transition:`background 0.15s`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(0,0,0,0.85)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(0,0,0,0.6)`},children:(0,$.jsx)(fae,{style:{color:`#fff`,fontSize:16}})})]})})]})},qse=()=>{let e=Ye(),{records:t,projects:n,fetchRecords:r,fetchProjects:i,generateVideo:a,retryGeneration:o}=u7(),s=t.items,[c,l]=(0,S.useState)(1),[u,d]=(0,S.useState)(10),[f,p]=(0,S.useState)({}),[m,h]=(0,S.useState)(void 0),[g,_]=(0,S.useState)(void 0),[v,y]=(0,S.useState)({}),[b,x]=(0,S.useState)(null),[C,w]=(0,S.useState)(null),T=async e=>{let t=e.genType||`image`,n=e.canRetry===!0;if(!n&&(e.canGenerate===!1||!e.configComplete)||n&&!e.configComplete){Z.error(`该记录生成配置不完整,请重新生成提词`);return}p(t=>({...t,[e.id]:!0})),Z.loading({content:`「${e.projectName}」正在提交${t===`video`?`视频`:`图片`}生成...`,duration:0,key:e.id});try{if(n)await o(e.id);else{let t=v[e.id];t&&t!==e.optimizedPrompt&&await p5(e.id,t),await a(e.id)}Z.success({content:`「${e.projectName}」已提交,正在生成中...`,key:e.id,duration:3})}catch(t){Z.error({content:t?.response?.data?.detail||t?.message||`提交生成失败`,key:e.id,duration:3})}finally{p(t=>({...t,[e.id]:!1}))}};(0,S.useEffect)(()=>{i()},[i]),(0,S.useEffect)(()=>{r({projectId:m,status:g,page:c,pageSize:u})},[r,m,g,c,u]);let E=s;return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:20,padding:`16px 24px`,borderRadius:16,background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(99, 102, 241, 0.08)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(X,{icon:(0,$.jsx)(q0,{}),onClick:()=>e(`/projects`),style:{borderRadius:10,fontSize:13,height:32,background:`rgba(99, 102, 241, 0.1)`,border:`1px solid rgba(99, 102, 241, 0.2)`,color:`#6366f1`},children:`返回`}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #6366f1, #8b5cf6, transparent)`,borderRadius:1}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:2,style:{margin:0,fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`项目记录`}),(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#64748b`},children:`查看所有视频生成记录,点击记录查看完整内容和视频`})]}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #8b5cf6, #6366f1, transparent)`,borderRadius:1}})]})}),(0,$.jsxs)(`div`,{className:`record-filter-bar animate-fadeInUp`,style:{display:`flex`,gap:12,marginBottom:20,padding:`14px 20px`,borderRadius:14,background:`#fff`,border:`1px solid #f0f0f5`},children:[(0,$.jsxs)(wV,{children:[(0,$.jsx)(P4,{style:{color:`#94a3b8`}}),(0,$.jsx)(zC,{placeholder:`全部项目`,allowClear:!0,style:{width:200},onChange:e=>{h(e),l(1)},children:n.map(e=>(0,$.jsx)(zC.Option,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(zC,{placeholder:`全部状态`,allowClear:!0,style:{width:140},onChange:e=>{_(e),l(1)},children:[(0,$.jsx)(zC.Option,{value:`prompt_optimized`,children:`待生成`}),(0,$.jsx)(zC.Option,{value:`generating`,children:`生成中`}),(0,$.jsx)(zC.Option,{value:`completed`,children:`已完成`}),(0,$.jsx)(zC.Option,{value:`failed`,children:`失败`})]})]}),(0,$.jsxs)(Q.Text,{style:{marginLeft:`auto`,lineHeight:`32px`,color:`#94a3b8`,fontSize:13},children:[`共 `,t.total,` 条记录`]})]}),E.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`暂无生成记录`,style:{padding:60}}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},className:`stagger-children`,children:E.map((e,t)=>{let n=b===e.id,r=v[e.id]??e.optimizedPrompt,i=f[e.id],a=C===e.id,o=e.genType||`image`,s=A7(e);return(0,$.jsxs)(`div`,{className:`animate-slideInCard`,style:{animationDelay:`${t*.04}s`},children:[(0,$.jsxs)(`div`,{className:`record-item`,onClick:()=>w(a?null:e.id),style:{padding:`14px 20px`,borderRadius:a?`14px 14px 0 0`:14,background:`#fff`,border:`1px solid #f0f0f5`,cursor:`pointer`,transition:`all 0.2s`,display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:8,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,background:o===`image`?`#fef3c7`:`#dbeafe`},children:o===`image`?(0,$.jsx)(L6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(z8,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(xZ,{style:{color:`#6366f1`,fontSize:12,flexShrink:0}}):(0,$.jsx)(L2,{style:{color:`#cbd5e1`,fontSize:12,flexShrink:0}}),(0,$.jsx)(SQ,{color:s.color,icon:s.isActive?(0,$.jsx)(Xm,{spin:!0}):s.isSuccess?(0,$.jsx)(B2,{}):s.isFailure?(0,$.jsx)(U2,{}):(0,$.jsx)(TB,{}),style:{margin:0},children:s.label}),(0,$.jsx)(SQ,{style:{background:`#f0f0ff`,border:`none`,color:`#6366f1`,margin:0},children:e.projectName}),(0,$.jsx)(Q.Text,{style:{flex:1,fontSize:13,color:`#475569`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),o===`image`?(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.imageSize||`-`,` · `,e.imageProportion||`-`,` · `,e.imagePx||`-`,` · `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:f7(e.createdAt)})]}):(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.duration?`${e.duration}秒`:`-`,` · `,e.aspectRatio||`-`,` · `,e.resolution||`-`,` · `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:f7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(wV,{children:[e.status===`prompt_optimized`&&(0,$.jsx)(X,{type:`primary`,size:`small`,icon:(0,$.jsx)(K6,{}),loading:i,disabled:!e.configComplete||e.canGenerate===!1,onClick:()=>T(e),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`生成`}),s.isActive&&(0,$.jsx)(SQ,{color:`processing`,icon:(0,$.jsx)(Xm,{spin:!0}),style:{padding:`4px 12px`,fontSize:12},children:`生成中...`}),s.isFailure&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(K6,{}),loading:i,disabled:!e.configComplete||e.canRetry===!1,onClick:()=>T(e),style:{borderRadius:8},children:`重试`})]})})]}),a&&(0,$.jsx)(`div`,{style:{background:`#fff`,border:`1px solid #f0f0f5`,borderTop:`none`,borderRadius:`0 0 14px 14px`,padding:`20px 24px`,animation:`fadeInUp 0.25s ease both`},children:(0,$.jsxs)(`div`,{className:`gen-detail-row`,style:{display:`flex`,gap:24,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{flex:`1 1 50%`,minWidth:280},children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`原始提示词`}),(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#64748b`,lineHeight:1.7},children:e.originalPrompt})})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:6},children:[(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词 `,e.status===`prompt_optimized`&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!n&&(0,$.jsxs)(wV,{size:4,children:[(0,$.jsx)(kw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(D$,{}),onClick:async()=>{let e=await g7(r);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),e.status===`prompt_optimized`&&(0,$.jsx)(kw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(i$,{}),onClick:()=>{x(e.id),y(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt}))},style:{color:`#6366f1`}})})]})]}),n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)($U.TextArea,{value:r,onChange:t=>y(n=>({...n,[e.id]:t.target.value})),rows:4,style:{borderRadius:10,fontSize:13,lineHeight:1.7,border:`1px solid rgba(99,102,241,0.25)`,background:`rgba(99,102,241,0.02)`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:8},children:[(0,$.jsx)(X,{size:`small`,onClick:()=>x(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{y(t=>({...t,[e.id]:r})),x(null),Z.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`rgba(99,102,241,0.02)`,border:`1px solid rgba(99,102,241,0.1)`},children:(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#1a1a2e`,lineHeight:1.7},children:r})})]}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:16,padding:`12px 16px`,borderRadius:10,background:`#f8f9fc`},children:o===`image`?[{label:`分辨率`,value:e.imageSize?`${e.imageSize} `:`-`},{label:`画面比例`,value:e.imageProportion?`${e.imageProportion} `:`-`},{label:`画面尺寸`,value:e.imagePx?`${e.imagePx} `:`-`},{label:`消耗积分`,value:e.creditsCost?`${e.creditsCost} `:`-`,highlight:!!e.creditsCost}].map((e,t)=>(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:e.highlight?`#6366f1`:`#1a1a2e`},children:e.value})]},t)):[{label:`时长`,value:e.duration?`${e.duration} 秒`:`-`},{label:`画面比例`,value:e.aspectRatio||(e.status===`prompt_optimized`?`配置缺失`:`-`)},{label:`分辨率`,value:e.resolution||(e.status===`prompt_optimized`?`配置缺失`:`-`)},{label:`消耗积分`,value:e.creditsCost?`${e.creditsCost}`:`-`,highlight:!!e.creditsCost}].map((e,t)=>(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:e.highlight?`#6366f1`:`#1a1a2e`},children:e.value})]},t))}),e.status===`prompt_optimized`&&(0,$.jsx)(`div`,{style:{marginTop:16,display:`flex`,justifyContent:`flex-end`},children:(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(t8,{}),loading:i,disabled:!e.configComplete||e.canGenerate===!1,onClick:()=>T(e),style:{borderRadius:12,fontWeight:600,height:44,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 8px 24px rgba(99,102,241,0.3)`},children:o===`video`?`生成视频`:`生成图片`})}),s.isFailure&&(0,$.jsx)(`div`,{style:{marginTop:16,display:`flex`,justifyContent:`flex-end`},children:(0,$.jsxs)(X,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(K6,{}),loading:i,disabled:!e.configComplete||e.canRetry===!1,onClick:()=>T(e),style:{borderRadius:12,fontWeight:600,height:44},children:[`重新生成`,o===`video`?`视频`:`图片`]})})]}),(0,$.jsx)(`div`,{style:{flex:`1 1 40%`,minWidth:240},children:s.isActive?(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:200,borderRadius:14,background:`linear-gradient(135deg, rgba(99,102,241,0.04), rgba(139,92,246,0.04))`,border:`1px dashed rgba(99,102,241,0.2)`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12},children:[(0,$.jsx)(Xm,{style:{color:`#6366f1`,fontSize:32},spin:!0}),(0,$.jsxs)(Q.Text,{style:{color:`#94a3b8`,fontSize:14},children:[o===`video`?`视频`:`图片`,`生成中...`]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:12},children:`请耐心等待,生成完成后将自动展示`})]}):s.isSuccess&&(e.videoUrl||e.imageUrl)?(0,$.jsxs)(`div`,{style:{borderRadius:14,overflow:`hidden`,border:`1px solid #f0f0f5`,position:`relative`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:10,right:10,zIndex:10},children:(0,$.jsx)(kw,{title:`下载${o===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(B1,{}),onClick:()=>{let t=document.createElement(`a`);t.href=`https://ceshi.apiforeign.minzhongzc.com${o===`video`?e.videoUrl:e.imageUrl}&download=1`,t.download=`${e.projectName}${o===`video`?`.mp4`:`.png`}`,t.click()},style:{background:`rgba(0,0,0,0.5)`,border:`none`,color:`#fff`,backdropFilter:`blur(4px)`,borderRadius:8},children:`下载`})})}),(0,$.jsx)(`div`,{style:{minHeight:280,overflow:`hidden`},children:o===`video`?(0,$.jsx)(`video`,{src:`https://ceshi.apiforeign.minzhongzc.com${e.videoUrl}`,controls:!0,preload:`metadata`,style:{width:`100%`,height:`400px`,display:`block`}}):(0,$.jsx)(`img`,{src:`https://ceshi.apiforeign.minzhongzc.com${e.imageUrl}`,alt:e.projectName,style:{width:`100%`,maxHeight:`400px`,objectFit:`contain`,display:`block`}})}),(0,$.jsxs)(`div`,{style:{padding:`10px 14px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,background:`#fafbff`},children:[(0,$.jsxs)(wV,{children:[o===`video`?(0,$.jsx)(z8,{style:{color:`#6366f1`}}):(0,$.jsx)(L6,{style:{color:`#6366f1`}}),(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#475569`},children:e.projectName})]}),e.generatedAt&&(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`生成于 `,f7(e.generatedAt)]})]})]}):s.isFailure?(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:200,borderRadius:14,background:`rgba(239,68,68,0.03)`,border:`1px dashed rgba(239,68,68,0.2)`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12},children:[(0,$.jsx)(U2,{style:{color:`#ef4444`,fontSize:32}}),(0,$.jsxs)(Q.Text,{style:{color:`#ef4444`,fontSize:14},children:[o===`video`?`视频`:`图片`,`生成失败`]}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:12},children:`请在左侧点击重新生成`})]}):(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:200,borderRadius:14,background:`#f8f9fc`,border:`1px dashed #e2e8f0`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12},children:[(0,$.jsx)(TB,{style:{color:`#94a3b8`,fontSize:32}}),(0,$.jsxs)(Q.Text,{style:{color:`#94a3b8`,fontSize:14},children:[`待生成`,o===`video`?`视频`:`图片`]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:12},children:`点击左侧生成按钮开始生成`})]})})]})})]},e.id)})}),t.total>0&&(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:18},children:(0,$.jsx)(zW,{current:t.page||c,pageSize:t.pageSize||u,total:t.total,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{l(e),d(t)}})})]})},N7=({value:e,duration:t=1200})=>{let[n,r]=(0,S.useState)(0),i=(0,S.useRef)(0);return(0,S.useEffect)(()=>{let a=n,o=e-a;if(o===0)return;let s=performance.now(),c=e=>{let n=e-s,l=Math.min(n/t,1);r(a+o*(1-(1-l)**3)),l<1&&(i.current=requestAnimationFrame(c))};return i.current=requestAnimationFrame(c),()=>cancelAnimationFrame(i.current)},[e]),(0,$.jsx)($.Fragment,{children:n.toLocaleString()})},Jse=()=>{let{user:e}=e7(),[t,n]=(0,S.useState)([]),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(1),[s,c]=(0,S.useState)(10),[l,u]=(0,S.useState)(0);(0,S.useEffect)(()=>{(async()=>{i(!0);let e=await m5(a,s);n(e.records),u(e.total),i(!1)})()},[a,s]);let d=(e,t)=>{o(e),c(t)},f=t.filter(e=>e.type===`recharge`).reduce((e,t)=>e+t.amount,0),p=t.filter(e=>e.type===`consume`).reduce((e,t)=>e+Math.abs(t.amount),0);return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(fq,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(dR,{xs:24,sm:8,children:(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{borderRadius:16,padding:24,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,position:`relative`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,right:-20,top:-20,width:120,height:120,borderRadius:`50%`,background:`rgba(255,255,255,0.1)`}}),(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsxs)(wV,{style:{marginBottom:10},children:[(0,$.jsx)(V8,{style:{color:`rgba(255,255,255,0.8)`,fontSize:16}}),(0,$.jsx)(`span`,{style:{color:`rgba(255,255,255,0.8)`,fontSize:14},children:`当前可用积分`})]}),(0,$.jsx)(`div`,{style:{color:`#fff`,fontSize:38,fontWeight:800,lineHeight:1},children:(0,$.jsx)(N7,{value:e?.credits??0})})]})]})}),(0,$.jsx)(dR,{xs:12,sm:8,children:(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{borderRadius:16,padding:24,background:`#fff`,border:`1px solid #f0f0f5`,animationDelay:`0.06s`},children:[(0,$.jsxs)(wV,{style:{marginBottom:10},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,background:`rgba(16,185,129,0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)($0,{style:{color:`#10b981`,fontSize:14}})}),(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:14},children:`累计获得`})]}),(0,$.jsx)(`div`,{style:{color:`#10b981`,fontSize:28,fontWeight:800},children:(0,$.jsx)(N7,{value:f})})]})}),(0,$.jsx)(dR,{xs:12,sm:8,children:(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{borderRadius:16,padding:24,background:`#fff`,border:`1px solid #f0f0f5`,animationDelay:`0.12s`},children:[(0,$.jsxs)(wV,{style:{marginBottom:10},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,background:`rgba(239,68,68,0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(W0,{style:{color:`#ef4444`,fontSize:14}})}),(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:14},children:`累计消耗`})]}),(0,$.jsx)(`div`,{style:{color:`#ef4444`,fontSize:28,fontWeight:800},children:(0,$.jsx)(N7,{value:p})})]})})]}),(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{animationDelay:`0.15s`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(D8,{style:{color:`#6366f1`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`积分明细`})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(lQ,{columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>(0,$.jsx)(SQ,{color:e===`recharge`?`green`:`orange`,icon:e===`recharge`?(0,$.jsx)($0,{}):(0,$.jsx)(W0,{}),children:e===`recharge`?`充值`:`消费`})},{title:`积分变动`,dataIndex:`amount`,key:`amount`,width:120,render:e=>(0,$.jsxs)(Q.Text,{strong:!0,style:{color:e>0?`#10b981`:`#ef4444`,fontSize:15},children:[e>0?`+`:``,e]})},{title:`说明`,dataIndex:`description`,key:`description`},{title:`时间`,dataIndex:`createdAt`,key:`createdAt`,width:160,render:e=>(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,style:{color:`#94a3b8`},children:f7(e)})}],dataSource:t,rowKey:`id`,loading:r,pagination:{current:a,pageSize:s,total:l,onChange:d,showSizeChanger:!0,showTotal:e=>`共 ${e} 条`},scroll:{x:500}})})]})]})},Yse=()=>{let[e,t]=(0,S.useState)(!0),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(0),[o,s]=(0,S.useState)(0),[c,l]=(0,S.useState)(1),[u]=(0,S.useState)(10);(0,S.useEffect)(()=>{d()},[c]);let d=async()=>{t(!0);try{let e=await m5(c,u);r(e.records||[]),a(e.credits||0),s(e.total||0)}catch{r([])}t(!1)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(fq,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(dR,{xs:24,sm:8,children:(0,$.jsxs)(`div`,{style:{borderRadius:16,padding:24,background:`linear-gradient(135deg, #f59e0b 0%, #ea580c 100%)`,position:`relative`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,right:-20,top:-20,width:120,height:120,borderRadius:`50%`,background:`rgba(255,255,255,0.1)`}}),(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,$.jsx)(V8,{style:{color:`rgba(255,255,255,0.8)`,fontSize:16}}),(0,$.jsx)(`span`,{style:{color:`rgba(255,255,255,0.8)`,fontSize:14},children:`可用积分`})]}),(0,$.jsx)(`div`,{style:{color:`#fff`,fontSize:38,fontWeight:800,lineHeight:1},children:i.toLocaleString()})]})]})}),(0,$.jsx)(dR,{xs:12,sm:8,children:(0,$.jsxs)(`div`,{style:{borderRadius:16,padding:24,background:`#fff`,border:`1px solid #f0f0f5`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,background:`rgba(16,185,129,0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(pie,{style:{color:`#10b981`,fontSize:14}})}),(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:14},children:`累计获得`})]}),(0,$.jsx)(`div`,{style:{color:`#10b981`,fontSize:28,fontWeight:800},children:n.filter(e=>e.amount>0).reduce((e,t)=>e+t.amount,0).toLocaleString()})]})}),(0,$.jsx)(dR,{xs:12,sm:8,children:(0,$.jsxs)(`div`,{style:{borderRadius:16,padding:24,background:`#fff`,border:`1px solid #f0f0f5`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,background:`rgba(239,68,68,0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(D8,{style:{color:`#ef4444`,fontSize:14}})}),(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:14},children:`累计消耗`})]}),(0,$.jsx)(`div`,{style:{color:`#ef4444`,fontSize:28,fontWeight:800},children:n.filter(e=>e.amount<0).reduce((e,t)=>e+Math.abs(t.amount),0).toLocaleString()})]})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(D8,{style:{color:`#f59e0b`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`积分明细`})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(oG,{spinning:e,children:n.length===0?(0,$.jsx)(lC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无积分变动记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(lQ,{dataSource:n,columns:[{title:`变动类型`,dataIndex:`type`,key:`type`,width:120,render:e=>{let t={recharge:{color:`#10b981`,label:`充值`,bg:`rgba(16,185,129,0.1)`},consume:{color:`#ef4444`,label:`消费`,bg:`rgba(239,68,68,0.1)`},admin:{color:`#f59e0b`,label:`管理员调整`,bg:`rgba(245,158,11,0.1)`},refund:{color:`#8b5cf6`,label:`退款`,bg:`rgba(139,92,246,0.1)`},team_internal:{color:`#0958d9`,label:`团队内部`,bg:`rgba(139,92,246,0.1)`}}[e]||{color:`#64748b`,label:e,bg:`rgba(100,116,139,0.1)`};return(0,$.jsx)(SQ,{color:t.color,style:{background:t.bg,fontWeight:500,padding:`4px 12px`},children:t.label})}},{title:`描述`,dataIndex:`description`,key:`description`,ellipsis:!0},{title:`变动积分`,dataIndex:`amount`,key:`amount`,width:120,align:`right`,render:e=>(0,$.jsxs)(Q.Text,{strong:!0,style:{fontWeight:700,color:e>0?`#10b981`:`#ef4444`,fontSize:15},children:[e>0?`+`:``,e]})},{title:`创建时间`,key:`createdAt`,width:180,render:(e,t)=>{let n=t.created_at||t.createdAt||t.create_time||t.createTime;return n?new Date(n).toLocaleString(`zh-CN`):`-`}}],rowKey:`id`,pagination:!1,bordered:!1}),(0,$.jsx)(`div`,{style:{padding:`16px`,textAlign:`right`},children:(0,$.jsx)(zW,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})]})},Xse=()=>{let[e,t]=(0,S.useState)(!0),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(0),[o,s]=(0,S.useState)(1),[c]=(0,S.useState)(10),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)([null,null]),p=(0,S.useCallback)(async()=>{t(!0);try{let e=await S5(o,c,{statusFilter:l||void 0,startDate:d[0]?.format?.(`YYYY-MM-DD`),endDate:d[1]?.format?.(`YYYY-MM-DD`)});r(e.items||[]),a(e.total||0)}catch{r([])}t(!1)},[o,l,d]);return(0,S.useEffect)(()=>{p()},[p]),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(kV,{style:{color:`#0ea5e9`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`订单记录`}),(0,$.jsxs)(`span`,{style:{color:`#94a3b8`,fontSize:13},children:[`共 `,i,` 条记录`]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16,flexWrap:`wrap`},children:[(0,$.jsx)(zC,{placeholder:`支付状态`,allowClear:!0,style:{width:130},value:l||void 0,onChange:e=>{u(e||``),s(1)},options:[{value:`pending`,label:`待支付`},{value:`paid`,label:`已支付`},{value:`refunded`,label:`已退款`},{value:`failed`,label:`支付失败`},{value:`cancelled`,label:`已取消`}]}),(0,$.jsx)(MB.RangePicker,{value:d,onChange:e=>{f(e),s(1)},allowClear:!0,placeholder:[`开始日期`,`结束日期`]}),(l||d[0]||d[1])&&(0,$.jsx)(Q.Link,{onClick:()=>{u(``),f([null,null]),s(1)},children:`重置`})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(oG,{spinning:e,children:n.length===0?(0,$.jsx)(lC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无订单记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(lQ,{dataSource:n,columns:[{title:`订单号`,key:`orderNo`,width:200,render:(e,t)=>(0,$.jsx)(`span`,{style:{fontFamily:`monospace`,fontSize:13,color:`#64748b`},children:t.order_no||t.orderNo||t.id})},{title:`支付方式`,key:`paymentMethod`,width:100,render:(e,t)=>{let n=t.payment_method||t.paymentMethod||`wechat`,r={alipay:{icon:(0,$.jsx)(F0,{style:{fontSize:16}}),label:`支付宝`,color:`#1677ff`},wechat:{icon:(0,$.jsx)(W8,{style:{fontSize:16}}),label:`微信支付`,color:`#07c160`}},i=r[n]||r.wechat;return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(`span`,{style:{color:i.color},children:i.icon}),(0,$.jsx)(`span`,{style:{fontSize:13,color:`#374151`},children:i.label})]})}},{title:`金额`,key:`amount`,width:100,align:`right`,render:(e,t)=>{let n=t.amount||t.total_amount||0;return(0,$.jsxs)(Q.Text,{strong:!0,style:{fontWeight:700,fontSize:14,color:`#1e293b`},children:[`¥`,n]})}},{title:`获得积分`,key:`credits`,width:100,align:`center`,render:(e,t)=>{let n=t.credits||t.credit_amount||0;return(0,$.jsx)(Q.Text,{strong:!0,style:{fontWeight:600,fontSize:14,color:`#f59e0b`},children:n})}},{title:`状态`,key:`status`,width:100,render:(e,t)=>{let n=t.status||`pending`,r={pending:{color:`#f59e0b`,label:`待支付`,bg:`rgba(245,158,11,0.1)`},paid:{color:`#10b981`,label:`已支付`,bg:`rgba(16,185,129,0.1)`},refunded:{color:`#94a3b8`,label:`已退款`,bg:`rgba(148,163,184,0.1)`},failed:{color:`#ef4444`,label:`支付失败`,bg:`rgba(239,68,68,0.1)`},cancelled:{color:`#64748b`,label:`已取消`,bg:`rgba(100,116,139,0.1)`},processing:{color:`#0ea5e9`,label:`处理中`,bg:`rgba(14,165,233,0.1)`}}[n]||{color:`#64748b`,label:n,bg:`rgba(100,116,139,0.1)`};return(0,$.jsx)(SQ,{color:r.color,style:{background:r.bg,fontWeight:500,padding:`4px 12px`},children:r.label})}},{title:`创建时间`,key:`createdAt`,width:180,render:(e,t)=>{let n=t.created_at||t.createdAt;return n?new Date(n).toLocaleString(`zh-CN`):`-`}},{title:`支付时间`,key:`paidAt`,width:180,render:(e,t)=>{let n=t.paid_at||t.paidAt;return n?new Date(n).toLocaleString(`zh-CN`):`-`}}],rowKey:`order_no`,pagination:!1,bordered:!1}),(0,$.jsx)(`div`,{style:{padding:`16px`,textAlign:`right`},children:(0,$.jsx)(zW,{current:o,pageSize:c,total:i,onChange:e=>{s(e)},size:`small`})})]})})})]})})},Zse=()=>{let[e,t]=(0,S.useState)(!0),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(0),[o,s]=(0,S.useState)(0),[c,l]=(0,S.useState)(1),[u]=(0,S.useState)(10);(0,S.useEffect)(()=>{d(),f()},[c]);let d=async()=>{t(!0);try{let e=await _5(c,u);r(e.items||[]),s(e.total||0)}catch{r([])}t(!1)},f=async()=>{try{a(await v5())}catch{a(0)}},p=async e=>{try{await y5(e),d(),f()}catch{}};return(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(g2,{style:{color:`#6366f1`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`消息中心`}),(0,$.jsxs)(`span`,{style:{color:`#94a3b8`,fontSize:13},children:[`未读 `,i,` 条`]})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(oG,{spinning:e,children:n.length===0?(0,$.jsx)(lC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无消息`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(lQ,{dataSource:n,columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>{let t={system:{color:`#6366f1`,label:`系统`,bg:`rgba(99,102,241,0.1)`,icon:(0,$.jsx)(l8,{style:{fontSize:14}})},credit:{color:`#f59e0b`,label:`积分`,bg:`rgba(245,158,11,0.1)`,icon:(0,$.jsx)(V8,{style:{fontSize:14}})},promo:{color:`#8b5cf6`,label:`活动`,bg:`rgba(139,92,246,0.1)`,icon:(0,$.jsx)(i3,{style:{fontSize:14}})}},n=t[e]||t.system;return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(`span`,{style:{color:n.color},children:n.icon}),(0,$.jsx)(`span`,{style:{fontSize:13,color:n.color,fontWeight:500},children:n.label})]})}},{title:`标题`,dataIndex:`title`,key:`title`,ellipsis:!0},{title:`内容`,dataIndex:`content`,key:`content`,ellipsis:!0,render:e=>(0,$.jsx)(`div`,{style:{maxWidth:300},dangerouslySetInnerHTML:{__html:e}})},{title:`状态`,dataIndex:`isRead`,key:`isRead`,width:80,render:(e,t)=>e??t.is_read?(0,$.jsx)(SQ,{color:`gray`,style:{background:`rgba(148,163,184,0.1)`},children:`已读`}):(0,$.jsx)(SQ,{color:`purple`,style:{background:`rgba(139,92,246,0.1)`},children:`未读`})},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,width:160,render:e=>{if(!e)return`-`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/(1e3*60*60));if(r<1)return`刚刚`;if(r<24)return`${r}小时前`;let i=Math.floor(r/24);return i<7?`${i}天前`:t.toLocaleDateString(`zh-CN`)}},{title:`操作`,key:`action`,width:100,render:(e,t)=>t.isRead??t.is_read?null:(0,$.jsx)(X,{type:`text`,size:`small`,onClick:()=>p(t.id),style:{color:`#6366f1`},children:`标记已读`})}],rowKey:`id`,pagination:!1,bordered:!1}),(0,$.jsx)(`div`,{style:{padding:`16px`,textAlign:`right`},children:(0,$.jsx)(zW,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})})},P7=()=>{let[e]=On(),[t,n]=(0,S.useState)(`credits`);return(0,S.useEffect)(()=>{(e.get(`tab`)||`credits`)===`orders`?n(`orders`):n(`credits`)},[e]),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(sL,{activeKey:t,onChange:n,items:[{key:`credits`,label:`积分明细`},{key:`orders`,label:`订单记录`}],style:{marginBottom:24},size:`large`}),t===`credits`&&(0,$.jsx)(Yse,{}),t===`orders`&&(0,$.jsx)(Xse,{})]})};function F7(e){return`/static/${e.startsWith(`/`)?e.slice(1):e}&w=300&q=50`}var Qse=(e,t)=>e<=1?6:e===2||e===4||e===3?3:2,$se=e=>A7(e).label,ece=300,tce=.6,nce=e=>{let t=Math.sin(e*9999)*1e4;return t-Math.floor(t)},I7=(e,t=0)=>{if(!e)return 0;let n=new Date(e).getTime();if(isNaN(n))return 0;let r=Math.max(0,(Date.now()-n)/1e3);if(r>=ece)return 99;let i=Math.min(99,r*tce),a=t*3+nce(t+1)*8;return i=Math.max(0,i-a),i},rce=({item:e,isPending:t,isCompleted:n,onAnimationComplete:r,index:i=0})=>{let[a,o]=(0,S.useState)(0),[s,c]=(0,S.useState)(!1),l=(0,S.useRef)(null);return(0,S.useEffect)(()=>{s||o(I7(e.createdAt,i))},[e,i,s]),(0,S.useEffect)(()=>{if(n&&!s){c(!0);return}if(!t&&!s){l.current&&=(clearInterval(l.current),null);return}return l.current=window.setInterval(()=>{s||o(I7(e.createdAt,i))},1e3),()=>{l.current&&=(clearInterval(l.current),null)}},[e.createdAt,t,n,s,e.id,i]),(0,S.useEffect)(()=>{if(s){let e=a,t=Date.now(),n=()=>{let i=Date.now()-t,a=Math.min(i/800,1),s=1-(1-a)**3;o(e+(100-e)*s),a<1?requestAnimationFrame(n):setTimeout(()=>{r?.()},100)};requestAnimationFrame(n)}},[s,a,r]),!t&&!s?null:(0,$.jsx)(`div`,{style:{marginTop:4},children:(0,$.jsxs)(`div`,{style:{textAlign:`center`,fontSize:13,color:`#8b5cf6`,fontWeight:700,textShadow:`0 0 8px rgba(139, 92, 246, 0.3)`,transition:`all 0.3s ease-out`},children:[Math.round(a),`%`]})})},ice=({task:e,onPreview:t,resolveUrl:n=e=>e||``})=>{let r=Math.max(1,Math.min(5,Number(e.generationCount||e.childItems?.length||1))),i=[...e.childItems||[]].sort((e,t)=>Number(e.generationIndex||0)-Number(t.generationIndex||0)),a=i.length>0?i:r>1?Array.from({length:r},(t,n)=>({id:`${e.id||`task`}-placeholder-${n+1}`,genType:e.genType,status:e.status,displayStatus:e.displayStatus,pipelineStage:e.pipelineStage,generationIndex:n+1,errorMessage:e.errorMessage,createdAt:e.createdAt})):[e],[o,s]=(0,S.useState)(new Set),c=(0,S.useRef)(new Set);(0,S.useEffect)(()=>{let e=`gen-task-resource-grid-animations`;if(document.getElementById(e))return;let t=document.createElement(`style`);t.id=e,t.textContent=` .gen-task-loading-bg { position: relative; diff --git a/video-gen-app/dist/index.html b/video-gen-app/dist/index.html index 79b0a08d..77ebf209 100644 --- a/video-gen-app/dist/index.html +++ b/video-gen-app/dist/index.html @@ -27,7 +27,7 @@ 民众智创 - + diff --git a/video-gen-app/src/components/Layout/AppLayout.tsx b/video-gen-app/src/components/Layout/AppLayout.tsx index 6247fe64..948ba8a1 100644 --- a/video-gen-app/src/components/Layout/AppLayout.tsx +++ b/video-gen-app/src/components/Layout/AppLayout.tsx @@ -917,13 +917,16 @@ const AppLayout: React.FC = () => { return ( setBannerVisible(v)} /> - + { boxShadow: '0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)', padding: '24px 32px 32px', border: '1px solid rgba(0, 0, 0, 0.06)', - overflow: 'hidden', + overflow: 'auto', + minHeight: 0, }}> {!isMobile && }