diff --git a/video-gen-app/dist/assets/index-3t1R3DGk.js b/video-gen-app/dist/assets/index-qk7c8-id.js
similarity index 99%
rename from video-gen-app/dist/assets/index-3t1R3DGk.js
rename to video-gen-app/dist/assets/index-qk7c8-id.js
index 24bbe5ca..b30c37a0 100644
--- a/video-gen-app/dist/assets/index-3t1R3DGk.js
+++ b/video-gen-app/dist/assets/index-qk7c8-id.js
@@ -404,7 +404,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
to { opacity: 1; transform: translateY(0) scale(1); }
}
`})]})},N7=({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:{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)(f3,{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)(f3,{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`}})})]})]})},P7={HomeOutlined:(0,$.jsx)(J3,{}),DashboardOutlined:(0,$.jsx)(l3,{}),CodeOutlined:(0,$.jsx)(G4,{}),PlayCircleOutlined:(0,$.jsx)(l8,{}),WalletOutlined:(0,$.jsx)(b5,{}),SettingOutlined:(0,$.jsx)(z8,{}),BellOutlined:(0,$.jsx)(o4,{}),UserOutlined:(0,$.jsx)(g5,{}),AppstoreOutlined:(0,$.jsx)(N2,{}),FileTextOutlined:(0,$.jsx)(jH,{}),StarOutlined:(0,$.jsx)(t5,{}),HeartOutlined:(0,$.jsx)(z3,{}),CameraOutlined:(0,$.jsx)(x4,{}),RobotOutlined:(0,$.jsx)(w8,{}),CalculatorOutlined:(0,$.jsx)(v4,{}),DollarOutlined:(0,$.jsx)(h3,{}),GiftOutlined:(0,$.jsx)(N3,{}),ThunderboltOutlined:(0,$.jsx)(s5,{}),FireOutlined:(0,$.jsx)(D3,{}),CloudOutlined:(0,$.jsx)(I4,{}),SmileOutlined:(0,$.jsx)(Z8,{}),TrophyOutlined:(0,$.jsx)(u5,{}),RocketOutlined:(0,$.jsx)(D8,{}),BulbOutlined:(0,$.jsx)(h4,{}),PictureOutlined:(0,$.jsx)(e8,{}),VideoCameraOutlined:(0,$.jsx)(v5,{}),AudioOutlined:(0,$.jsx)(J2,{}),MailOutlined:(0,$.jsx)(w6,{}),PhoneOutlined:(0,$.jsx)(Z6,{}),GlobalOutlined:(0,$.jsx)(I3,{}),ShoppingCartOutlined:(0,$.jsx)(H8,{}),TeamOutlined:(0,$.jsx)(a5,{}),BarChartOutlined:(0,$.jsx)(r4,{}),PieChartOutlined:(0,$.jsx)(r8,{}),LineChartOutlined:(0,$.jsx)(f6,{}),SecurityScanOutlined:(0,$.jsx)(I8,{}),ApiOutlined:(0,$.jsx)(A2,{}),DatabaseOutlined:(0,$.jsx)(f3,{}),CloudServerOutlined:(0,$.jsx)(z4,{})},Lae=240,F7=[{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(Zq,{})},{gradient:`linear-gradient(135deg, #4a5568, #2d3748)`,shadow:`rgba(74,85,104,0.25)`,icon:(0,$.jsx)(w3,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(r3,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(Z2,{})}],Rae=()=>{let e=Ye(),t=Ke(),{user:n,logout:r}=j7(),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u]=bU.useForm(),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)([]),[h,g]=(0,S.useState)([]),[_,v]=(0,S.useState)(0),[y,b]=(0,S.useState)(!1),[x,C]=(0,S.useState)(!1),[w]=bU.useForm(),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(()=>({x:24,y:window.innerHeight*.75})),[k,A]=(0,S.useState)(!1),j=(0,S.useRef)(!1),M=(0,S.useRef)({x:0,y:0}),[N,P]=(0,S.useState)({}),[F,I]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteName||``;return t&&(document.title=t),t}),[L,R]=(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}),[z,B]=(0,S.useState)(!localStorage.getItem(`siteInfo`)),[V,H]=(0,S.useState)(!1),[U,W]=(0,S.useState)(null),[ee,G]=(0,S.useState)(`alipay`),[te,ne]=(0,S.useState)(!1),[K,re]=(0,S.useState)(180),ie=(0,S.useRef)(null),ae=(0,S.useRef)(null),q=(0,S.useRef)(null),[oe,se]=(0,S.useState)({alipay:!1,wechat:!1}),[ce,le]=(0,S.useState)(null),[ue,de]=(0,S.useState)(!1),[fe,pe]=(0,S.useState)(``),me=`pending_payment_order`;(0,S.useEffect)(()=>{J5().then(e=>{let t=e.siteName||`民众智创`,n=e.siteLogo||``;if(t!==F&&(I(t),document.title=t),n&&n!==L){R(n);let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=n,e.type=`image/png`}e.operationManual&&pe(e.operationManual),localStorage.setItem(`siteInfo`,JSON.stringify({siteName:t,siteLogo:n}))}).catch(()=>{}),z5().then(e=>{let t=e?.resourceCapacity;t&&le({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=()=>de(window.innerWidth<=767);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let he=e=>{e.button===0&&(A(!0),j.current=!1,M.current={x:e.clientX,y:e.clientY})},ge=e=>{if(!k)return;let t=Math.abs(e.clientX-M.current.x),n=Math.abs(e.clientY-M.current.y);(t>5||n>5)&&(j.current=!0);let r=Math.max(60,Math.min(window.innerHeight-60,e.clientY-(M.current.y-D.y)));O(e=>({x:e.x,y:r}))},_e=()=>{let e=j.current;A(!1),j.current=!1,e||l(!0)};(0,S.useEffect)(()=>{if(k)return document.addEventListener(`mousemove`,ge),document.addEventListener(`mouseup`,_e),()=>{document.removeEventListener(`mousemove`,ge),document.removeEventListener(`mouseup`,_e)}},[k]);let ve=()=>{Z5().then(e=>{v(e)}).catch(()=>{})};(0,S.useEffect)(()=>{(async()=>{let e=localStorage.getItem(me);if(e)try{let t=JSON.parse(e),n=await e7(t.orderNo);if(n.status===`pending`){W({price:t.price,credits:t.credits,qrCode:t.qrCode,method:t.method}),q.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?(H(!0),Ae(t.orderNo,a)):localStorage.removeItem(me)}else n.status===`paid`?(Z.success(`支付成功!积分已到账`),j7.getState().refreshUser(),localStorage.removeItem(me)):localStorage.removeItem(me)}catch{localStorage.removeItem(me)}})()},[]),(0,S.useEffect)(()=>{gie().then(e=>{m(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),_ie().then(e=>{g(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),vie().then(e=>{se(e),e.alipay?G(`alipay`):e.wechat&&G(`wechat`)}).catch(()=>{}),ve()},[n]);let ye=t.pathname.startsWith(`/records`)?`/records`:t.pathname,be=Lae,xe={};p.forEach(e=>{let t=e.parent_id??e.parentId;t&&(xe[t]||(xe[t]=[]),xe[t].push(e))});let Se=p.filter(e=>!(e.parent_id??e.parentId));Se.sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0)),Object.keys(xe).forEach(e=>{xe[e].sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0))});let Ce=t=>{let n=t.menu_type??t.menuType,r=xe[t.id]&&xe[t.id].length>0;n===`group`||r?P(e=>({...e,[t.id]:!e[t.id]})):t.path&&(e(t.path),b(!1))},we=[{key:`profile`,icon:(0,$.jsx)(g5,{}),label:`账号: ${n?.username}`,disabled:!0},{key:`credits`,icon:(0,$.jsx)(b5,{style:{color:`#c9a96e`}}),label:`积分: ${n?.credits??0}`,disabled:!0},{type:`divider`},...n?.isTeamManager?[{key:`teamManagement`,icon:(0,$.jsx)(a5,{style:{color:`#6366f1`}}),label:`团队管理`}]:[],{key:`myCredits`,icon:(0,$.jsx)(b5,{}),label:`积分明细`},{key:`orderRecords`,icon:(0,$.jsx)(jH,{}),label:`订单记录`},{key:`messages`,icon:(0,$.jsx)(o4,{}),label:`消息中心${_>0?`(${_})`:``}`},...fe?[{key:`manual`,icon:(0,$.jsx)(jH,{}),label:`操作手册`}]:[],{type:`divider`},{key:`changePwd`,icon:(0,$.jsx)(h6,{}),label:`修改密码`},{type:`divider`},{key:`logout`,icon:(0,$.jsx)(x6,{}),label:`退出登录`,danger:!0}],Te=({key:t})=>{t===`logout`?(r(),e(`/login`)):t===`changePwd`?a(!0):t===`messages`?e(`/messages`):t===`recharge`?s(!0):t===`teamManagement`?e(`/team-management`):t===`myCredits`?e(`/user-center?tab=credits`):t===`orderRecords`?e(`/user-center?tab=orders`):t===`manual`&&window.open(fe,`_blank`)},Ee=async()=>{try{let e=await u.validateFields();await B5(e.oldPwd,e.newPwd),Z.success(`密码修改成功`),a(!1),u.resetFields()}catch(e){e?.response?.data?.detail?Z.error(e.response.data.detail):e?.message&&Z.error(e.message)}},De=()=>{r(),e(`/login`)},Oe=async()=>{if(!n){Z.warning(`请先登录`);return}try{let e=await w.validateFields();E(!0),await $ie({phone:e.phone,company_name:e.companyName,industry:e.industry,name:e.name,message:e.message}),Z.success(`提交成功,我们会尽快与您联系`),l(!1),w.resetFields()}catch(e){Z.error(e?.message||`提交失败`)}finally{E(!1)}},ke=(0,S.useCallback)(()=>{ie.current&&=(clearInterval(ie.current),null),ae.current&&=(clearInterval(ae.current),null)},[]),Ae=(0,S.useCallback)((e,t=180)=>{ke(),re(t),ie.current=setInterval(async()=>{try{let t=await e7(e);t.status===`paid`?(ke(),q.current=null,localStorage.removeItem(me),Z.success(`支付成功!积分已到账`),j7.getState().refreshUser(),H(!1),W(null),f(null)):t.status===`cancelled`&&(ke(),q.current=null,localStorage.removeItem(me))}catch{}},2e3),ae.current=setInterval(()=>{re(e=>e<=1?(ke(),q.current&&=(t7(q.current).catch(()=>{}),null),localStorage.removeItem(me),Z.warning(`订单已超时,请重新充值`),H(!1),W(null),f(null),0):e-1)},1e3)},[ke]),je=(t,n=0)=>{let r=t.path===ye,i=P7[t.icon]||(0,$.jsx)(J3,{}),a=xe[t.id]&&xe[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:(xe[t.id]||[]).map(e=>je(e,n+1))})]},t.id)};return(0,$.jsxs)(uG,{style:{minHeight:`100vh`},children:[(0,$.jsxs)(`div`,{className:`desktop-sidebar`,style:{width:be,position:`fixed`,left:16,top:16,bottom:16,zIndex: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, left 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:L?(0,$.jsx)(`img`,{src:L,alt:`logo`,style:{width:28,height:28,objectFit:`contain`}}):(0,$.jsx)(s5,{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:F})]})}),(0,$.jsx)(`div`,{style:{flex:1,padding:`8px 8px`,overflow:`auto`},children:Se.map(e=>je(e))}),(0,$.jsxs)(`div`,{onClick:()=>s(!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)(mL,{style:{fontSize:16}}),(0,$.jsx)(`span`,{children:`充值积分`})]}),(0,$.jsx)(N7,{data:ce}),(0,$.jsx)(`div`,{style:{padding:`16px 16px`,flexShrink:0,paddingTop:0},children:(0,$.jsx)(OH,{menu:{items:we,onClick:Te},placement:`topRight`,arrow:!0,children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:12,borderRadius:14,cursor:`pointer`,transition:`all 0.25s ease`,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)`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #ffffff 0%, #f8fafc 100%)`,e.currentTarget.style.boxShadow=`0 4px 16px rgba(0, 0, 0, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)`,e.currentTarget.style.boxShadow=`0 2px 12px rgba(0, 0, 0, 0.04)`},children:[(0,$.jsx)(Pw,{size:36,icon:(0,$.jsx)(g5,{}),style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},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`},children:[`积分: `,n?.credits||0]})]})]})})})]}),(0,$.jsx)(`div`,{className:`desktop-content`,style:{marginLeft:be+28,marginRight:12,marginTop:16,marginBottom:16,flex:1,minHeight:`calc(100vh - 32px)`,background:`transparent`,padding:0,transition:`margin-left 0.25s ease`},children:(0,$.jsx)(`div`,{style:{boxSizing:`border-box`,height:`100%`,background:`#ffffffff`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,minHeight:`100%`,padding:`24px 32px 32px`,border:`1px solid rgba(0, 0, 0, 0.06)`},children:!ue&&(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:()=>b(!0),children:(0,$.jsx)(A6,{style:{fontSize:20}})}),(0,$.jsx)(`div`,{className:`mobile-header-title`,children:F}),(0,$.jsx)(`div`,{className:`mobile-header-right`,children:(0,$.jsxs)(`div`,{className:`mobile-credits-badge`,onClick:()=>s(!0),children:[(0,$.jsx)(b5,{}),(0,$.jsx)(`span`,{children:n?.credits||0})]})})]})}),(0,$.jsx)(`div`,{className:`mobile-content`,children:ue&&(0,$.jsx)(wt,{})}),(0,$.jsxs)(_H,{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:L?(0,$.jsx)(`img`,{src:L,alt:`logo`,style:{width:24,height:24,objectFit:`contain`}}):(0,$.jsx)(s5,{style:{fontSize:18,color:`#ffffff`}})}),(0,$.jsx)(`span`,{style:{fontWeight:700,fontSize:16,color:`#1e293b`},children:F})]}),placement:`left`,onClose:()=>b(!1),open:y,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)(Pw,{size:44,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0},children:(0,$.jsx)(g5,{})}),(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)(b5,{style:{color:`#f59e0b`,marginRight:4}}),`积分: `,(0,$.jsx)(`span`,{style:{color:`#f59e0b`,fontWeight:600},children:n?.credits??0})]})]})]})}),(0,$.jsx)(N7,{data:ce}),Se.map(e=>{let t=e.menu_type??e.menuType,n=xe[e.id]&&xe[e.id].length>0,r=e.path===ye,i=N[e.id],a=P7[e.icon]||(0,$.jsx)(J3,{});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item ${r&&!n?`mobile-menu-item-active`:``} ${t===`group`?`mobile-menu-group`:``}`,onClick:()=>Ce(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)(Bg,{})})]}),(t===`group`||n)&&i&&(0,$.jsx)(`div`,{className:`mobile-submenu`,children:(xe[e.id]||[]).map(e=>{let t=e.path===ye,n=P7[e.icon]||(0,$.jsx)(J3,{});return(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-submenu-item ${t?`mobile-menu-item-active`:``}`,onClick:()=>Ce(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`),b(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#f59e0b`},children:(0,$.jsx)(b5,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`积分明细`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=orders`),b(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#6366f1`},children:(0,$.jsx)(jH,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`订单记录`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/messages`),b(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#8b5cf6`},children:(0,$.jsx)(o4,{})}),(0,$.jsxs)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:[`消息中心`,_>0&&(0,$.jsx)(h$,{color:`red`,style:{marginLeft:8,fontSize:11},children:_})]})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{a(!0),b(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#0ea5e9`},children:(0,$.jsx)(h6,{})}),(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:()=>{s(!0),b(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#fff`},children:(0,$.jsx)(mL,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#fff`,fontWeight:600},children:`充值积分`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{De(),b(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#ef4444`},children:(0,$.jsx)(x6,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#ef4444`},children:`退出登录`})]})]})]}),(0,$.jsx)(NK,{title:(0,$.jsxs)(EH,{children:[(0,$.jsx)(h6,{}),`修改密码`]}),open:i,onOk:Ee,onCancel:()=>{a(!1),u.resetFields()},okText:`确认修改`,cancelText:`取消`,width:440,children:(0,$.jsxs)(bU,{form:u,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(bU.Item,{name:`oldPwd`,label:`原密码`,rules:[{required:!0,message:`请输入原密码`}],children:(0,$.jsx)(tG.Password,{placeholder:`请输入原密码`,size:`large`,prefix:(0,$.jsx)(h6,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(bU.Item,{name:`newPwd`,label:`新密码`,rules:[{required:!0,message:`请输入新密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(tG.Password,{placeholder:`请输入新密码(至少6位)`,size:`large`,prefix:(0,$.jsx)(h6,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(bU.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)(tG.Password,{placeholder:`请再次输入新密码`,size:`large`,prefix:(0,$.jsx)(h6,{style:{color:`#94a3b8`,marginRight:8}})})})]})}),(0,$.jsx)(NK,{title:(0,$.jsxs)(EH,{children:[(0,$.jsx)(N3,{}),`积分充值`]}),open:o,onCancel:()=>{s(!1),f(null)},width:680,className:`recharge-modal`,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:()=>{s(!1),f(null)},style:{borderRadius:10,marginRight:12},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,disabled:!d||!oe.alipay&&!oe.wechat,loading:te,onClick:async()=>{let e=h.find(e=>e.id===d);if(!e)return;let t=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);try{ne(!0);let n=await yie(e.id,ee),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url;(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(W({price:e.price,credits:t,qrCode:r,method:n.paymentMethod}),s(!1),H(!0),q.current=n.orderNo,localStorage.setItem(me,JSON.stringify({orderNo:n.orderNo,price:e.price,credits:t,qrCode:r,method:n.paymentMethod,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),Ae(n.orderNo)):(Z.success(`充值成功!积分已到账`),j7.getState().refreshUser(),s(!1),f(null))}catch(e){Z.error(e?.message||`创建订单失败,请重试`)}finally{ne(!1)}},style:{borderRadius:10,fontWeight:600,background:d?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#d1d5db`,border:`none`,boxShadow:d?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:`确认充值`})]}),children:(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsxs)(EH,{style:{marginBottom:16},children:[(0,$.jsx)(b5,{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})]}),!oe.alipay&&!oe.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)(HI.Group,{value:ee,onChange:e=>G(e.target.value),style:{display:`flex`,gap:12},children:[oe.alipay&&(0,$.jsxs)(HI.Button,{value:`alipay`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:ee===`alipay`?`#1677ff`:void 0,color:ee===`alipay`?`#1677ff`:void 0},children:[(0,$.jsx)(D2,{style:{fontSize:16,marginRight:6}}),`支付宝`]}),oe.wechat&&(0,$.jsxs)(HI.Button,{value:`wechat`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:ee===`wechat`?`#07c160`:void 0,color:ee===`wechat`?`#07c160`:void 0},children:[(0,$.jsx)(C5,{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)(e6,{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:()=>{s(!1),l(!0)},children:`联系我们`})]})]}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:h.map((e,t)=>{let n=F7[t%F7.length],r=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);return(0,$.jsxs)(`div`,{onClick:()=>f(e.id),style:{flex:`1 1 45%`,minWidth:200,borderRadius:16,padding:`20px 16px`,background:d===e.id?`rgba(99,102,241,0.04)`:`#fafbff`,border:d===e.id?`2px solid #6366f1`:`1px solid #f0f0f5`,cursor:`pointer`,position:`relative`,transition:`all 0.2s`},children:[e.description&&(0,$.jsx)(h$,{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:12},children:[(0,$.jsx)(`div`,{style:{width:44,height:44,borderRadius:12,flexShrink:0,background:n.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:18,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:15},children:e.name}),(0,$.jsxs)(Q.Text,{style:{fontSize:14,fontWeight:600,color:`#6366f1`},children:[r.toLocaleString(),` 积分`]})]}),(0,$.jsxs)(`div`,{style:{fontSize:22,fontWeight:800,marginTop:4,background:n.gradient,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`},children:[`¥`,e.price]})]})]})]},e.id)})})]})}),(0,$.jsx)(NK,{open:V,onCancel:async()=>{if(ke(),q.current){try{await t7(q.current)}catch{}q.current=null}localStorage.removeItem(me),H(!1),W(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:U?.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:U?.method===`alipay`?(0,$.jsx)(D2,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(C5,{style:{fontSize:24,color:`#fff`}})}),(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:U?.method===`alipay`?`支付宝支付`:`微信支付`}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:U?.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:U&&(0,$.jsx)(w2,{value:U.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:[`¥`,U?.price||0]}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`,marginTop:4},children:[`购买 `,U?.credits||0,` 积分`]}),(0,$.jsx)(`div`,{style:{marginTop:12,padding:`8px 16px`,background:K<=30?`#fef2f2`:`#f0f9ff`,borderRadius:8,border:K<=30?`1px solid #fecaca`:`1px solid #bae6fd`,display:`inline-block`},children:(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:K<=30?`#dc2626`:`#0284c7`},children:[`订单将在 `,(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:800},children:K}),` 秒后关闭`]})})]})]}),(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(ke(),q.current){try{await t7(q.current)}catch{}q.current=null}localStorage.removeItem(me),H(!1),W(null),f(null)},style:{borderRadius:10},children:`取消支付`})})]})}),(0,$.jsx)(Iae,{}),(0,$.jsx)(`div`,{className:`contact-button-wrapper`,style:{right:`${D.x}px`,bottom:`${window.innerHeight-D.y}px`},children:(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(`div`,{className:`contact-tooltip`,style:{opacity:+!!x},children:`联系我们`}),(0,$.jsx)(`button`,{className:`contact-button ${k?`dragging`:``}`,onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),onMouseDown:he,onMouseUp:_e,children:(0,$.jsx)(N6,{style:{fontSize:20}})})]})}),(0,$.jsx)(NK,{title:(0,$.jsxs)(EH,{children:[(0,$.jsx)(N6,{}),`联系我们`]}),open:c,onCancel:()=>{l(!1),w.resetFields()},footer:null,width:480,className:`contact-modal`,children:(0,$.jsxs)(`div`,{style:{marginTop:8},children:[(0,$.jsxs)(bU,{form:w,layout:`vertical`,children:[(0,$.jsx)(bU.Item,{name:`name`,label:`姓名`,rules:[{required:!0,message:`请输入姓名`}],children:(0,$.jsx)(tG,{placeholder:`请输入您的姓名`,size:`large`})}),(0,$.jsx)(bU.Item,{name:`phone`,label:`手机号`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1[3-9]\d{9}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(tG,{placeholder:`请输入您的手机号`,size:`large`})}),(0,$.jsx)(bU.Item,{name:`companyName`,label:`公司名称`,rules:[{required:!0,message:`请输入公司名称`}],children:(0,$.jsx)(tG,{placeholder:`请输入公司名称`,size:`large`})}),(0,$.jsx)(bU.Item,{name:`industry`,label:`您的行业`,rules:[{required:!0,message:`请输入您的行业`}],children:(0,$.jsx)(tG,{placeholder:`请输入您的行业`,size:`large`})}),(0,$.jsx)(bU.Item,{name:`message`,label:`留言(选填)`,children:(0,$.jsx)(tG.TextArea,{placeholder:`请输入您的需求或问题`,rows:3,style:{borderRadius:10}})})]}),(0,$.jsxs)(`div`,{style:{marginTop:16,display:`flex`,gap:12},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{l(!1),w.resetFields()},style:{borderRadius:10,flex:1},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Oe,loading:T,style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,flex:1},children:`提交`})]})]})})]})},zae=`http://localhost:8000/api`,Bae=()=>{let{checkAuth:e}=j7(),[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=(()=>{try{let e=localStorage.getItem(`siteInfo`);if(e){let t=JSON.parse(e);return{siteName:t.siteName||`VideoGen.AI`,siteLogo:t.siteLogo||``}}}catch{}return{siteName:`VideoGen.AI`,siteLogo:``}})(),[A,j]=(0,S.useState)(k.siteName),[M,N]=(0,S.useState)(k.siteLogo),[P,F]=(0,S.useState)(``),[I,L]=(0,S.useState)(``),R=Ye(),{login:z}=j7(),[B]=bU.useForm(),[V]=bU.useForm(),[H]=bU.useForm();(0,S.useEffect)(()=>{J5().then(e=>{j(e.siteName),N(e.siteLogo),F(e.userAgreementPrivacyUrl),L(e.siteCopyright)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{l===`register`&&i(`register`)},[l]);let U=()=>{if(c)try{R(decodeURIComponent(c));return}catch{}R(`/home`)},W=()=>m?!0:(Z.warning(`请先阅读并同意用户协议及隐私政策`),!1),ee=async()=>{if(W())try{let t=await B.validateFields();await z(t.phone,t.password,void 0,t.rememberMe),Z.success(`登录成功,欢迎回来`),await e(),U()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}},G=async()=>{if(W())try{let t=V.getFieldsValue();if(!t.phone||!t.code){Z.error(`请填写手机号和验证码`);return}n(!0),await Xre(t.phone,t.code),Z.success(`登录成功,欢迎回来`),await e(),U()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}finally{n(!1)}},te=async()=>{if(W())try{let t=await H.validateFields();n(!0),await Zre(t.phone,t.regCode,t.password),Z.success(`注册成功`),await e(),U()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`注册失败`;Z.error(t)}finally{n(!1)}},ne=(e,t)=>{e(60);let n=setInterval(()=>{e(e=>e<=1?(clearInterval(n),_(!1),t?E(!0):O(!0),0):e-1)},1e3)};(0,S.useEffect)(()=>{u===0&&r===`phone`&&x(!1)},[u,r]);let K=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 Y5(e,n),ne(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)}},re=async(e=!1)=>{let t=r===`register`?H.getFieldValue(`phone`):V.getFieldValue(`phone`);try{let e=``;e=r===`register`?`register`:`login`,await Y5(t,e),r===`register`?(y(!0),ne(p,!0)):(x(!0),ne(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),E(!0)):(x(!1),d(0),O(!0)),w(e=>e+1)}},ie=e=>{o(e),i(e),d(0),p(0),x(!1),y(!1),_(!1),E(!1),O(!1),w(e=>e+1),e===`password`?B.resetFields():V.resetFields()},ae=[{icon:(0,$.jsx)(h4,{}),title:`AI 智能优化`,desc:`输入原始提示词,AI 自动为您生成专业级视频、图片描述`},{icon:(0,$.jsx)(l8,{}),title:`一键生成视频、图片`,desc:`支持多种规格生成视频、图片`},{icon:(0,$.jsx)(G3,{}),title:`项目维度管理`,desc:`按项目行业分类视频、图片,支持多种行业`}],q={background:`#fff`,border:`1.5px solid #e2e8f0`,color:`#1e293b`,borderRadius:10,fontSize:14},oe=e=>{if(!e){Z.warning(`暂未上传协议文件`);return}e.startsWith(`http://`)||e.startsWith(`https://`)?window.open(e,`_blank`):window.open(`${zae.replace(/\/api$/,``)}${e}`,`_blank`)};return(0,$.jsxs)(`div`,{className:`login-page`,children:[(0,$.jsx)(`div`,{className:`login-bg-overlay`}),(0,$.jsx)(`div`,{className:`login-decoration login-decoration-1`}),(0,$.jsx)(`div`,{className:`login-decoration login-decoration-2`}),(0,$.jsx)(`div`,{className:`login-left-section`,children:(0,$.jsxs)(EH,{direction:`vertical`,size:36,className:`login-left-content`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`login-logo-row`,children:[M?(0,$.jsx)(`img`,{src:M,alt:`logo`,className:`login-logo-img`}):(0,$.jsx)(`div`,{className:`login-logo-placeholder`,children:(0,$.jsx)(s5,{style:{fontSize:26,color:`#fff`}})}),(0,$.jsx)(`span`,{className:`login-site-name`,children:A})]}),(0,$.jsx)(`div`,{className:`shiny-text-container`,children:(0,$.jsx)(`span`,{className:`shiny-text`,children:`AI赋能创意,素材触手可及`})}),(0,$.jsxs)(Q.Paragraph,{className:`login-desc`,children:[`专业的 AI 素材生成平台,通过智能提示词优化,`,(0,$.jsx)(`br`,{}),`让您的创意快速转化为精美视频、图片`]})]}),(0,$.jsx)(`div`,{className:`login-features-list`,children:ae.map((e,t)=>(0,$.jsxs)(`div`,{className:`electric-border-card login-feature-card`,children:[(0,$.jsx)(`div`,{className:`electric-border`}),(0,$.jsx)(`div`,{className:`electric-border-inner`}),(0,$.jsx)(`div`,{style:{position:`relative`,zIndex:1},children:(0,$.jsx)(`div`,{className:`login-feature-icon`,children:e.icon})}),(0,$.jsxs)(`div`,{style:{position:`relative`,zIndex:1},children:[(0,$.jsx)(Q.Text,{className:`login-feature-title`,children:e.title}),(0,$.jsx)(Q.Text,{className:`login-feature-desc`,children:e.desc})]})]},t))})]})}),(0,$.jsxs)(`div`,{className:`login-right-section`,children:[(0,$.jsx)(`div`,{className:`login-right-section-inner`,children:(0,$.jsxs)(RL,{className:`login-card`,styles:{body:{padding:`36px 28px`}},children:[(0,$.jsx)(Q.Title,{level:3,className:`login-card-title`,children:r===`register`?`创建账号`:`欢迎回来`}),(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:()=>ie(e),className:`login-tab ${a===e?`login-tab-active`:``}`,children:e===`password`?`密码登录`:`验证码登录`},e))}),r===`password`&&(0,$.jsxs)(bU,{form:B,size:`large`,layout:`vertical`,onFinish:ee,children:[(0,$.jsx)(bU.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(tG,{prefix:(0,$.jsx)(I6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,style:q})}),(0,$.jsx)(bU.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,$.jsx)(tG.Password,{prefix:(0,$.jsx)(h6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入密码`,style:q})}),(0,$.jsx)(bU.Item,{name:`rememberMe`,valuePropName:`checked`,style:{marginBottom:12},children:(0,$.jsx)(oz,{children:`记住我的登录状态`})}),(0,$.jsx)(bU.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)(bU,{form:V,size:`large`,layout:`vertical`,children:[(0,$.jsx)(bU.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(tG,{prefix:(0,$.jsx)(I6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:q})}),(0,$.jsx)(bU.Item,{name:`code`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(EH.Compact,{style:{width:`100%`},children:[(0,$.jsx)(tG,{prefix:(0,$.jsx)(A8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!b,style:{...q,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:u>0,onClick:()=>{D?(x(!1),_(!0),w(e=>e+1)):K(V.getFieldValue(`phone`))},className:`login-code-btn`,children:u>0?`${u}s`:D?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(bU.Item,{style:{marginBottom:12},children:(0,$.jsx)(I7,{onSuccess:re,isVerified:b})},C),(0,$.jsx)(bU.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:G,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`register`&&(0,$.jsxs)(bU,{form:H,size:`large`,layout:`vertical`,children:[(0,$.jsx)(bU.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(tG,{prefix:(0,$.jsx)(I6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:q})}),(0,$.jsx)(bU.Item,{name:`regCode`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(EH.Compact,{style:{width:`100%`},children:[(0,$.jsx)(tG,{prefix:(0,$.jsx)(A8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!v,style:{...q,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:f>0,onClick:()=>{T?(y(!1),_(!0),w(e=>e+1)):K(H.getFieldValue(`phone`),!0)},className:`login-code-btn`,children:f>0?`${f}s`:T?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(bU.Item,{style:{marginBottom:12},children:(0,$.jsx)(I7,{onSuccess:re,isVerified:v})},C),(0,$.jsx)(bU.Item,{name:`password`,rules:[{required:!0,message:`请设置密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(tG.Password,{prefix:(0,$.jsx)(h6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请设置密码(至少6位)`,style:q})}),(0,$.jsx)(bU.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:te,loading:t,block:!0,className:`login-submit-btn`,children:`注 册`})})]}),(0,$.jsx)(`div`,{className:`login-agreement`,children:(0,$.jsx)(oz,{checked:m,onChange:e=>h(e.target.checked),children:(0,$.jsxs)(`span`,{className:`login-agreement-text`,children:[`我已阅读并同意`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),oe(P)},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`),E(!1),O(!1),y(!1),_(!1),w(e=>e+1),H.resetFields()},children:`已有账号?去登录`}):(0,$.jsx)(Q.Text,{className:`login-switch-btn`,onClick:()=>{i(`register`),E(!1),O(!1),y(!1),_(!1),w(e=>e+1)},children:`没有账号?立即注册`})})]})}),I&&(0,$.jsx)(`div`,{className:`login-copyright-wrapper`,children:(0,$.jsx)(`div`,{className:`login-copyright`,children:I})})]})]})},I7=({onSuccess:e,isVerified:t})=>{let n=S.useRef(null),r=S.useRef(null),i=S.useRef(null),a=S.useRef(0),o=S.useRef(!1),[s,c]=S.useState(360),l=s-50;S.useEffect(()=>{let e=()=>{if(n.current){let e=n.current.offsetWidth;e>0&&c(e)}};e();let t=new ResizeObserver(e);return n.current&&t.observe(n.current),window.addEventListener(`resize`,e),()=>{t.disconnect(),window.removeEventListener(`resize`,e)}},[]);let u=n=>{if(o.current||t)return;let c=Math.max(0,Math.min(n,l));a.current=c,r.current&&(r.current.style.left=`${c}px`),i.current&&(i.current.style.width=`${c+50}px`),c>=l-5&&(o.current=!0,r.current&&(r.current.style.background=`#22c55e`,r.current.innerHTML=``),i.current&&(i.current.style.width=`${s}px`,i.current.style.background=`#dcfce7`),e())};return(0,$.jsxs)(`div`,{ref:n,onMouseDown:e=>{if(e.preventDefault(),o.current||t)return;let s=n.current;if(!s)return;let c=s.getBoundingClientRect(),d=e=>{u(e.clientX-c.left-50/2)},f=()=>{document.removeEventListener(`mousemove`,d),document.removeEventListener(`mouseup`,f),!o.current&&a.current{if(o.current||t)return;e.preventDefault();let s=n.current;if(!s)return;let c=s.getBoundingClientRect();u(e.touches[0].clientX-c.left-50/2);let d=e=>{u(e.touches[0].clientX-c.left-50/2)},f=()=>{document.removeEventListener(`touchmove`,d),document.removeEventListener(`touchend`,f),!o.current&&a.current({page:1,pageSize:10,total:0,items:[]}),L7=O5((e,t)=>({projects:[],records:Vae(),loading:!1,mediaType:`video`,countType:`请选择`,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`16:9`,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 $re(),loading:!1})}catch{e({loading:!1})}},createProject:async(n,r)=>{let i=await eie(n,r);return e({projects:[i,...t().projects]}),i},deleteProject:async n=>{await tie(n),e({projects:t().projects.filter(e=>e.id!==n)})},fetchRecords:async(t={})=>{e({loading:!0});try{e({records:await V5(t),loading:!1})}catch{e({loading:!1})}},optimizePrompt:async(n,r)=>{let i=await nie(n,r);try{await j7.getState().checkAuth()}catch{}let a=t().records;return e({records:{...a,total:a.total+1,items:[i.record,...a.items]}}),i},generateVideo:async(n,r)=>{let i=await pie(n,r);try{await j7.getState().checkAuth()}catch{}let a=t().records;return e({records:{...a,items:a.items.map(e=>e.id===n?i:e)}}),i},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}),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:`请选择`,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`16:9`,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:[]})}));function R7(e){if(!e)return`-`;let t=e.trim();t.includes(`T`)||(t=t.replace(` `,`T`));let n=t.indexOf(`.`);return n>0&&(t=t.slice(0,n)),t=t.replace(/[+-]\d{2}:?\d{0,2}$/,``).replace(/Z$/,``),t.replace(`T`,` `).slice(0,16)}var z7=[`#f97316`,`#3b82f6`,`#8b5cf6`,`#10b981`,`#eab308`,`#6366f1`,`#ef4444`,`#06b6d4`,`#64748b`,`#78716c`],B7={ShoppingCartOutlined:(0,$.jsx)(H8,{}),BookOutlined:(0,$.jsx)(l4,{}),HomeOutlined:(0,$.jsx)(J3,{}),FireOutlined:(0,$.jsx)(D3,{}),RocketOutlined:(0,$.jsx)(D8,{}),SkinOutlined:(0,$.jsx)(dre,{}),CompassOutlined:(0,$.jsx)(e3,{}),HeartOutlined:(0,$.jsx)(z3,{}),CarOutlined:(0,$.jsx)(w4,{}),CameraOutlined:(0,$.jsx)(x4,{}),CloudOutlined:(0,$.jsx)(I4,{}),StarOutlined:(0,$.jsx)(t5,{}),TrophyOutlined:(0,$.jsx)(u5,{}),ThunderboltOutlined:(0,$.jsx)(s5,{}),BulbOutlined:(0,$.jsx)(h4,{}),CoffeeOutlined:(0,$.jsx)(J4,{}),CrownOutlined:(0,$.jsx)(o3,{}),DashboardOutlined:(0,$.jsx)(l3,{}),FlagOutlined:(0,$.jsx)(A3,{}),GlobalOutlined:(0,$.jsx)(I3,{}),GiftOutlined:(0,$.jsx)(N3,{}),LaptopOutlined:(0,$.jsx)(r6,{}),MobileOutlined:(0,$.jsx)(I6,{}),MonitorOutlined:(0,$.jsx)(z6,{}),PayCircleOutlined:(0,$.jsx)(J6,{}),PictureOutlined:(0,$.jsx)(e8,{}),PlayCircleOutlined:(0,$.jsx)(l8,{}),SafetyOutlined:(0,$.jsx)(A8,{}),ShoppingOutlined:(0,$.jsx)(G8,{}),SmileOutlined:(0,$.jsx)(Z8,{}),SoundOutlined:(0,$.jsx)(gre,{}),TagOutlined:(0,$.jsx)(xre,{}),TeamOutlined:(0,$.jsx)(a5,{}),ToolOutlined:(0,$.jsx)(Tre,{}),TruckOutlined:(0,$.jsx)(Ore,{}),VideoCameraOutlined:(0,$.jsx)(v5,{}),WalletOutlined:(0,$.jsx)(b5,{}),BankOutlined:(0,$.jsx)(e4,{}),BuildOutlined:(0,$.jsx)(f4,{}),ExperimentOutlined:(0,$.jsx)(v3,{}),HighlightOutlined:(0,$.jsx)(H3,{}),IdcardOutlined:(0,$.jsx)(Z3,{}),MedicineBoxOutlined:(0,$.jsx)(D6,{}),ReadOutlined:(0,$.jsx)(h8,{}),RestOutlined:(0,$.jsx)(v8,{}),SketchOutlined:(0,$.jsx)(J8,{}),SolutionOutlined:(0,$.jsx)(mre,{})},Hae=()=>{let[e,t]=(0,S.useState)(!1),[n]=bU.useForm(),r=Ye(),{projects:i,fetchProjects:a,createProject:o,deleteProject:s}=L7(),[c,l]=(0,S.useState)([]);(0,S.useEffect)(()=>{a(),$5().then(l).catch(()=>{})},[]);let u=Object.fromEntries(c.map((e,t)=>[e.key,{label:e.label,color:z7[t%z7.length],icon:e.icon||`AppstoreOutlined`}]));return(0,$.jsxs)(`div`,{style:{margin:`-24px -32px -32px`,borderRadius:20,height:`calc(100vh - 34px)`,padding:`24px`},children:[(0,$.jsxs)(`div`,{className:`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)`,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)(jH,{}),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)(mL,{}),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)(rC,{image:rC.PRESENTED_IMAGE_SIMPLE,description:`还没有项目,创建您的第一个视频项目`,style:{padding:`60px 0`},children:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(mL,{}),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:B7[u[e.industry]?.icon]||(0,$.jsx)(N2,{})}),(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)(h$,{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)(wV,{style:{fontSize:12,color:`#94a3b8`}}),(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`创建于 `,R7(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)(l8,{}),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)(LK,{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)(k$,{}),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)(Bg,{className:`mobile-hide`,style:{color:`#cbd5e1`,fontSize:12}})]})]},e.id))}),(0,$.jsx)(NK,{title:(0,$.jsxs)(EH,{children:[(0,$.jsx)(N2,{}),`新建项目`]}),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)(bU,{form:n,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(bU.Item,{name:`name`,label:`项目名称`,rules:[{required:!0,message:`请输入项目名称`}],children:(0,$.jsx)(tG,{placeholder:`例如:618电商大促宣传片`,prefix:(0,$.jsx)(dZ,{}),size:`large`})}),(0,$.jsx)(bU.Item,{name:`industry`,label:`所属行业`,rules:[{required:!0,message:`请选择行业`}],children:(0,$.jsx)(NC,{placeholder:`选择项目所属行业`,size:`large`,children:c.map((e,t)=>(0,$.jsx)(NC.Option,{value:e.key,children:(0,$.jsxs)(EH,{children:[B7[e.icon]||(0,$.jsx)(N2,{}),` `,e.label]})},e.key))})})]})})]})},{Text:V7}=Q,Uae={real_person:{title:`选择真人素材库`,empty:`暂无可选 Active 真人素材`,projectError:`加载真人素材项目失败`,assetError:`加载真人素材失败`,fallbackName:`真人素材`},aigc_virtual:{title:`选择虚拟素材库`,empty:`暂无可选 Active 虚拟素材`,projectError:`加载虚拟素材项目失败`,assetError:`加载虚拟素材失败`,fallbackName:`虚拟素材`}},H7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,Wae=e=>e.assetType===`Video`?H7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.providerUrl):H7(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.providerUrl),Gae=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},U7=({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=Uae[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`?A7:k7)({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`?Sae:hae)({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)(NK,{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)(EH,{style:{width:`100%`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(V7,{strong:!0,children:`项目组`}),(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(Uq,{}),onClick:M,loading:D})]}),(0,$.jsx)(cK,{spinning:D,children:(0,$.jsx)(gK,{dataSource:m,locale:{emptyText:(0,$.jsx)(rC,{image:rC.PRESENTED_IMAGE_SIMPLE,description:`暂无项目组`})},renderItem:e=>(0,$.jsx)(gK.Item,{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)(V7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),(0,$.jsx)(V7,{type:`secondary`,style:{fontSize:12},children:typeof e.activeImageAssetCount==`number`||typeof e.activeVideoAssetCount==`number`?` 图 ${e.activeImageAssetCount||0} / 视 ${e.activeVideoAssetCount||0}`:``})]})})})})]}),(0,$.jsxs)(`div`,{style:{overflowY:`auto`,height:`100%`},children:[(0,$.jsxs)(EH,{style:{width:`100%`,marginBottom:12},children:[(0,$.jsx)(tG,{allowClear:!0,prefix:(0,$.jsx)(OC,{}),placeholder:`搜索素材名称`,value:v,onChange:e=>y(e.target.value),onPressEnter:N}),(0,$.jsx)(NC,{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)(Uq,{}),onClick:N,loading:k,children:`刷新`})]}),(0,$.jsx)(cK,{spinning:k,children:C.length===0?(0,$.jsx)(rC,{image:rC.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=Wae(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)(v5,{style:{fontSize:32,color:`#94a3b8`}}):(0,$.jsx)(e8,{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:Gae(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)(SC,{})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsx)(V7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name||`未命名素材`}),(0,$.jsxs)(EH,{wrap:!0,size:4,style:{marginTop:6},children:[(0,$.jsx)(h$,{color:a?`blue`:`default`,children:a?`视频`:`图片`}),(0,$.jsx)(h$,{children:e.projectName})]})]})]},e.id)})})})]})]})]})},{Text:W7}=Q,Kae=e=>e?/^(https?:|data:|blob:)/i.test(e)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,qae=e=>e===`video`?(0,$.jsx)(v5,{}):e===`audio`?(0,$.jsx)(J2,{}):(0,$.jsx)(e8,{}),Jae=e=>e===`video`?`视频`:e===`audio`?`音频`:`图片`,Yae=({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})=>{let[g,_]=(0,S.useState)(``),[v,y]=(0,S.useState)(``),[b,x]=(0,S.useState)(1),[C,w]=(0,S.useState)(10),[T,E]=(0,S.useState)(1),[D,O]=(0,S.useState)(10),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)([]),[F,I]=(0,S.useState)(0),[L,R]=(0,S.useState)(``),[z,B]=(0,S.useState)([]),[V,H]=(0,S.useState)(0),[U,W]=(0,S.useState)(new Map),ee=(0,S.useMemo)(()=>new Set(i),[i]),G=(0,S.useMemo)(()=>new Set(r||[`image`,`video`,`audio`]),[JSON.stringify(r)]),te=(0,S.useMemo)(()=>Array.from(U.values()).filter(e=>e.resourceType===`image`).length,[U]),ne=(0,S.useMemo)(()=>Array.from(U.values()).filter(e=>e.resourceType===`video`).length,[U]),K=(0,S.useMemo)(()=>Array.from(U.values()).filter(e=>e.resourceType===`video`).reduce((e,t)=>e+(t.durationSeconds||0),0),[U]),re=(0,S.useMemo)(()=>Array.from(U.values()).filter(e=>e.resourceType===`audio`).length,[U]),ie=(0,S.useMemo)(()=>Array.from(U.values()).filter(e=>e.resourceType===`audio`).reduce((e,t)=>e+(t.durationSeconds||0),0),[U]),ae=(0,S.useMemo)(()=>o!==void 0&&c!==void 0?o-c:1/0,[o,c]),q=(0,S.useMemo)(()=>s!==void 0&&l!==void 0?s-l:1/0,[s,l]),oe=(0,S.useMemo)(()=>u!==void 0&&d!==void 0?u-d:1/0,[u,d]),se=(0,S.useMemo)(()=>f!==void 0&&p!==void 0?f-p:1/0,[f,p]),ce=(0,S.useMemo)(()=>m!==void 0&&h!==void 0?m-h:1/0,[m,h]),le=(0,S.useMemo)(()=>te>ae,[te,ae]),ue=(0,S.useMemo)(()=>ne>q,[ne,q]),de=(0,S.useMemo)(()=>K>oe,[K,oe]),fe=(0,S.useMemo)(()=>re>se,[re,se]),pe=(0,S.useMemo)(()=>ie>ce,[ie,ce]),me=(0,S.useCallback)(async()=>{if(e){M(!0);try{let e=await D7({resourceType:g||void 0,keyword:v||void 0,page:b,pageSize:C,scene:`picker`});P(b===1?e.groups||[]:t=>[...t,...e.groups||[]]),I(e.totalDays||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),b===1&&P([]),I(0)}finally{M(!1)}}},[G,v,e,b,C,g]),he=(0,S.useCallback)(async e=>{A(!0);try{let t=await O7(e,{resourceType:g||void 0,keyword:v||void 0,page:T,pageSize:8,scene:`picker`});B((t.items||[]).filter(e=>G.has(e.resourceType))),H(t.total||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),B([]),H(0)}finally{A(!1)}},[G,v,T,D,g]);(0,S.useEffect)(()=>{e&&me()},[e,b,me]),(0,S.useEffect)(()=>{L&&E(1)},[L]),(0,S.useEffect)(()=>{L&&he(L)},[L,T,he]),(0,S.useEffect)(()=>{e&&W(new Map)},[e]);let ge=e=>{if(ee.has(e.id)){Z.warning(`该素材已经在参考内容中`);return}W(t=>{let n=new Map(t);return n.has(e.id)?n.delete(e.id):n.set(e.id,e),n})},_e=()=>{let e=Array.from(U.values());if(e.length===0){Z.warning(`请先选择历史素材`);return}n(e),W(new Map),t()},ve=(0,S.useMemo)(()=>[{label:`全部`,value:``},{label:`图片`,value:`image`},{label:`视频`,value:`video`},{label:`音频`,value:`audio`}].filter(e=>!e.value||G.has(e.value)),[G]);return(0,$.jsxs)(NK,{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:_e,style:{background:`#8b5cf6`},disabled:le||ue||de||fe||pe,children:[`应用选择 (`,U.size,`)`]},`ok`)],children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsxs)(EH,{wrap:!0,children:[(0,$.jsx)(NC,{value:g,options:ve,style:{width:120},onChange:e=>{_(e),x(1)}}),(0,$.jsx)(tG,{allowClear:!0,value:v,prefix:(0,$.jsx)(OC,{}),placeholder:`搜索文件名`,style:{width:220},onChange:e=>y(e.target.value),onPressEnter:()=>{x(1),me()}}),(0,$.jsx)(X,{icon:(0,$.jsx)(Uq,{}),onClick:me,children:`刷新`})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginTop:12,flexWrap:`wrap`},children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:le?`#ef4444`:`#64748b`,fontWeight:le?600:400},children:[`还可选取图片 `,te,`/`,o!==void 0&&c!==void 0?o-c:`-`,` 张`]}),(0,$.jsxs)(`span`,{style:{fontSize:13,color:ue||de?`#ef4444`:`#64748b`,fontWeight:ue||de?600:400},children:[`视频还可选取 `,ne,`/`,s!==void 0&&l!==void 0?s-l:`-`,` 个(`,K.toFixed(1),`/`,u!==void 0&&d!==void 0?(u-d).toFixed(1):`-`,`秒)`]}),f!==void 0&&(0,$.jsxs)(`span`,{style:{fontSize:13,color:fe||pe?`#ef4444`:`#64748b`,fontWeight:fe||pe?600:400},children:[`音频还可选取 `,re,`/`,f!==void 0&&p!==void 0?f-p:`-`,` 个(`,ie.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)(W7,{strong:!0,style:{fontSize:14},children:`日期列表`}),(0,$.jsx)(cK,{spinning:j,children:N.length===0?(0,$.jsx)(rC,{image:rC.PRESENTED_IMAGE_SIMPLE,description:`暂无日期`,style:{padding:`40px 0`}}):(0,$.jsxs)(`div`,{style:{marginTop:12},children:[N.map(e=>(0,$.jsxs)(`div`,{onClick:()=>R(e.generatedDate),style:{padding:`10px 12px`,borderRadius:10,marginBottom:6,cursor:`pointer`,border:L===e.generatedDate?`1px solid #8b5cf6`:`1px solid transparent`,background:L===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)),F>N.length&&(0,$.jsx)(`div`,{style:{marginTop:12,textAlign:`center`},children:(0,$.jsx)(X,{size:`small`,onClick:()=>x(b+1),children:`加载更多`})})]})})]}),(0,$.jsx)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,overflowY:`auto`},children:(0,$.jsx)(cK,{spinning:k,children:L?z.length===0?(0,$.jsx)(rC,{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:z.map(e=>{let t=U.has(e.id),n=ee.has(e.id),r=Kae(e.previewUrl||e.displayUrl||e.resourceUrl);return(0,$.jsxs)(`div`,{onClick:()=>!n&&ge(e),style:{position:`relative`,borderRadius:14,border:t?`2px solid #8b5cf6`:`1px solid #e2e8f0`,background:n?`#f8fafc`:`#fff`,opacity:n?.55:1,cursor:n?`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)`},children:[(0,$.jsx)(`div`,{style:{height:112,background:`#f1f5f9`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:e.resourceType===`image`?(0,$.jsx)(`img`,{src:r,alt:e.fileName||e.id,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):e.resourceType===`video`?(0,$.jsx)(`video`,{src:r,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`div`,{style:{width:58,height:58,borderRadius:18,background:`linear-gradient(135deg, #8b5cf6, #a78bfa)`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,fontSize:24},children:(0,$.jsx)(J2,{})})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsxs)(EH,{size:6,style:{marginBottom:6},children:[(0,$.jsx)(h$,{color:`purple`,icon:qae(e.resourceType),style:{margin:0},children:Jae(e.resourceType)}),e.durationSeconds?(0,$.jsxs)(h$,{style:{margin:0},children:[Number(e.durationSeconds).toFixed(1),`s`]}):null]}),(0,$.jsx)(W7,{ellipsis:!0,style:{display:`block`,fontSize:13,color:`#334155`},title:e.fileName||e.id,children:e.fileName||e.id}),(0,$.jsx)(W7,{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)(SC,{})}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8},children:(0,$.jsx)(h$,{children:`已选`})})]},e.id)})}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:16,paddingBottom:8},children:(0,$.jsx)(VG,{current:T,pageSize:D,total:V,showSizeChanger:!0,pageSizeOptions:[10,20,50,100],onChange:(e,t)=>{E(e),O(t)}})})]}):(0,$.jsx)(rC,{image:rC.PRESENTED_IMAGE_SIMPLE,description:`请选择日期`,style:{padding:`80px 0`}})})})]})]})},G7=({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})=>{let y=(0,S.useRef)(null),[b,x]=(0,S.useState)(!1),[C,w]=(0,S.useState)(`real_person`),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),j=()=>{O(!1),y.current?.click()},M=e=>{let t=e.target.files;t&&r&&r(Array.from(t)),y.current&&(y.current.value=``)},N=e=>{if(O(!1),a){w(e),x(!0);return}if(o){o(e);return}w(e),x(!0)},P=(0,$.jsxs)(`div`,{style:{padding:`4px 0`,minWidth:180},children:[(0,$.jsxs)(`div`,{onClick:()=>{j()},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)(dZ,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`本地上传`})]}),(0,$.jsxs)(`div`,{onClick:()=>{O(!1),E(!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)(f3,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`从资产中选择`})]}),(0,$.jsxs)(`div`,{onClick:()=>N(`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)(g5,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`真人素材库`})]}),(0,$.jsxs)(`div`,{onClick:()=>N(`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)(a5,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`虚拟素材库`})]})]});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:y,type:`file`,accept:t,multiple:n,onChange:M,style:{display:`none`}}),c?(0,$.jsx)(Cw,{title:c,children:(0,$.jsx)(jw,{content:P,open:D,onOpenChange:O,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})})}):(0,$.jsx)(jw,{content:P,open:D,onOpenChange:O,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})}),(0,$.jsx)(Yae,{open:T,onClose:()=>E(!1),onSelect:e=>{i?.(e),E(!1)},allowedTypes:t.includes(`audio`)?[`image`,`video`,`audio`]:t.includes(`video`)?[`image`,`video`]:[`image`],maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,maxVideoDuration:m,usedVideoDuration:p,maxAudioCount:h,usedAudioCount:g,maxAudioDuration:_,usedAudioDuration:v}),(0,$.jsx)(U7,{open:b,libraryType:C,onClose:()=>x(!1),onSelect:e=>{a?.(e),x(!1)},accept:t,maxCount:t===`image/*`&&!n?1:void 0,maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,usedVideoDuration:p,maxVideoDuration:m})]})};function Xae(){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 K7=({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)(l8,{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)})]})},Zae=()=>{let{projectId:e}=$e(),t=Ye(),[n]=bU.useForm(),{projects:r,records:i,fetchProjects:a,fetchRecords:o,optimizePrompt:s,generateVideo:c}=L7(),l=i.items,{user:u}=j7(),[d,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(null),[_,v]=(0,S.useState)(``),[y,b]=(0,S.useState)(!1),[x,C]=(0,S.useState)({}),[w,T]=(0,S.useState)({}),[E,D]=(0,S.useState)({}),[O,k]=(0,S.useState)(null),[A,j]=(0,S.useState)(null),[M,N]=(0,S.useState)([]),[P,F]=(0,S.useState)(!1),[I,L]=(0,S.useState)(``),[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(``),H=(0,S.useRef)(null),[U,W]=(0,S.useState)({}),[ee,G]=(0,S.useState)({}),[te,ne]=(0,S.useState)({}),[K,re]=(0,S.useState)(null),[ie,ae]=(0,S.useState)({}),[q,oe]=(0,S.useState)(null),[se,ce]=(0,S.useState)(5),[le,ue]=(0,S.useState)(`16:9`),[de,fe]=(0,S.useState)(`720p`),[pe,me]=(0,S.useState)(null),[he,ge]=(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]}),[_e,ve]=(0,S.useState)(0),[ye,be]=(0,S.useState)(0),[xe,Se]=(0,S.useState)(`video`),[Ce,we]=(0,S.useState)(`1:1`),[Te,Ee]=(0,S.useState)(`2K`),[De,Oe]=(0,S.useState)(2048),[ke,Ae]=(0,S.useState)(2048),[je,Me]=(0,S.useState)(!1),[Ne,Pe]=(0,S.useState)([]),[Fe,Ie]=(0,S.useState)([]),Le=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=M.filter(e=>e.type===`image`).length,a=M.filter(e=>e.type===`video`).length,o=M.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&&(s=await new Promise(t=>{let n=document.createElement(`video`);n.preload=`metadata`,n.onloadedmetadata=()=>{t(n.duration||0),n.remove()},n.onerror=()=>{t(0),n.remove()},n.src=URL.createObjectURL(e)}),o+s>15))return Z.error(`视频总时长不能超过15秒`),!1;F(!0);try{let r;r=t?await U5(e):await W5(e,s);let o=t?`图片`:`视频`,c=t?i+1:a+1;N(e=>[...e,{url:r.url,type:t?`image`:`video`,name:`${o}${c}`,duration:n?s:void 0}]),Z.success(`${o}上传成功`)}catch{Z.error(`上传失败`)}finally{F(!1)}return!1};(0,S.useEffect)(()=>{if(xie().then(e=>{Pe(e.video),Ie(e.image)}),!je)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Me(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[je]);let Re=(e,t)=>{for(let n=0;n{let t=e===`2k`?`2048`:e===`4k`?`4096`:e;for(let e=0;e{Xe(e)},Ve=e=>{Qe(parseInt(e))},[He,Ue]=(0,S.useState)([]),[We,Ge]=(0,S.useState)([]),[Ke,qe]=(0,S.useState)([]),[Je,Xe]=(0,S.useState)(0),[Ze,Qe]=(0,S.useState)(0);(0,S.useEffect)(()=>{Ke[Ze]&&Ke[Ze][Je]!==void 0&&(Oe(Ke[Ze][Je].substring(0,4)),Ae(Ke[Ze][Je].substring(5)))},[Je]),(0,S.useEffect)(()=>{Ke[Ze]&&Ke[Ze][Je]!==void 0&&(Oe(Ke[Ze][Je].substring(0,4)),Ae(Ke[Ze][Je].substring(5)))},[Ze]);let et=()=>{Oe(ke),Ae(De)},tt=e=>{Se(e.target.value===`image`?`image`:`video`)};(0,S.useEffect)(()=>{$5().then(e=>{W(Object.fromEntries(e.map(e=>[e.key,e.label]))),G(Object.fromEntries(e.map(e=>[e.key,e.optionGroups||[]])))}).catch(()=>{}),hie().then(e=>{let t=e.items?.[0]?.supportedSizes||{},n=[],r=[],i=[];for(let e in t[`2K`])n.push(e),r.push(t[`2K`][e]);n.forEach((e,t)=>{Ue(n=>[...n,{value:e,label:String(t)}])});for(let e in t[`4K`])i.push(t[`4K`][e]);qe([r,i]);let a=[];for(let e in t)a.push(e);a.forEach((e,t)=>{Ge(n=>[...n,{value:e,label:String(t)}])})}).catch(()=>{}),mie().then(e=>{if(e.items?.length){let t=e.items[0];ge({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)(()=>{a(),o({projectId:e,page:1,pageSize:100})},[e,a,o]);let nt=(0,S.useRef)(!1);(0,S.useEffect)(()=>{nt.current||l.length===0||(nt.current=!0,l.forEach(t=>{t.projectId===e&&t.status===`generating`&&(T(e=>({...e,[t.id]:`generating`})),kt(t.id)),t.projectId===e&&t.status===`optimizing`&&ut(t.id)}))},[l,e]);let rt=(0,S.useRef)(new Set),it=(0,S.useRef)(null),at=(0,S.useRef)(null),ot=e=>{rt.current.add(e),lt()},st=e=>{rt.current.delete(e),rt.current.size===0&&ct()},ct=()=>{it.current&&=(clearInterval(it.current),null),at.current&&=(at.current.abort(),null)},lt=()=>{it.current||=setInterval(async()=>{try{at.current&&at.current.abort();let t=new AbortController;at.current=t;let n=await V5({projectId:e,page:1,pageSize:100,signal:t.signal});at.current=null;let r=Array.from(rt.current),i=[];if(r.length>0){let e=L7.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});L7.setState({records:{...e,items:t}}),i.forEach(e=>{st(e)})}}catch(e){e.name}},3e3)},ut=e=>{ot(e)},dt=(0,S.useRef)(!1),ft=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(dt.current||l.length===0)return;let t=localStorage.getItem(`pending_optimize`);if(t)try{let{key:n,projectId:r,prompt:i,duration:a,ts:o}=JSON.parse(t);if(Date.now()-o>300*1e3||r!==e){localStorage.removeItem(`pending_optimize`);return}if(ft.current===n)return;let s=l.find(e=>e.projectId===r&&e.originalPrompt===i&&e.duration===a&&e.status===`prompt_optimized`&&new Date(e.createdAt).getTime()>o-1e4);s?(dt.current=!0,localStorage.removeItem(`pending_optimize`),g(s),v(s.optimizedPrompt||``),ve(s.textCreditsCost),be(s.textTokensUsed),m(!0),Z.success({content:`优化请求已恢复,消耗 ${s.textCreditsCost} 积分`,key:`recovery`})):Date.now()-o>3e4&&localStorage.removeItem(`pending_optimize`)}catch{localStorage.removeItem(`pending_optimize`)}},[l,e]);let pt=r.find(t=>t.id===e),mt=l.filter(t=>t.projectId===e),ht=pt?.name??`项目`,gt=pt&&ee[pt.industry]||[],_t=u?.credits??0,vt=e=>{let t=e===`2k`?`2048`:e===`4k`?`4096`:e;for(let e=0;e=yt,xt=async()=>{try{if(!e){Z.error(`项目ID为空,请先选择项目`);return}let t=await n.validateFields();if(!t.prompt||!t.prompt.trim()){Z.error(`请输入视频/图片描述`);return}f(!0);let r=Object.entries(te).map(([e,t])=>`@${e}:${t}`),i=r.length>0?`${t.prompt}\n\n${r.join(`;`)}`:t.prompt,a=Xae();localStorage.setItem(`pending_optimize`,JSON.stringify({key:a,projectId:e,prompt:i,duration:se,ts:Date.now()})),ft.current=a;let o=await s(e,{prompt:i,duration:se,genType:xe,resolution:Te,references:M.length>0?M:void 0,idempotencyKey:a,image_size:Te,image_proportion:Ce,image_px:De+`x`+ke});localStorage.removeItem(`pending_optimize`),ft.current=null,g(o.record),v(o.record.optimizedPrompt||``),ve(o.textCreditsCost),be(o.textTokensUsed),m(!0),Z.success({content:`「${ht}」提示词优化完成,消耗 ${o.textCreditsCost} 积分`,key:`optimize`})}catch(e){let t=e?.response?.data?.message||e?.message||`操作失败,请稍后重试`;Z.error(t)}finally{f(!1),localStorage.removeItem(`pending_optimize`),ft.current=null}},St=(0,S.useRef)(new Set),Ct=(0,S.useRef)(null),wt=(0,S.useRef)(null),Tt=e=>{St.current.add(e),Ot()},Et=e=>{St.current.delete(e),St.current.size===0&&Dt()},Dt=()=>{Ct.current&&=(clearInterval(Ct.current),null),wt.current&&=(wt.current.abort(),null)},Ot=()=>{Ct.current||=setInterval(async()=>{try{wt.current&&wt.current.abort();let t=new AbortController;wt.current=t;let n=await V5({projectId:e,page:1,pageSize:100,signal:t.signal});wt.current=null;let r=Array.from(St.current),i=[];if(r.length>0){let e=L7.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!==`generating`&&i.push(e.id),t}return e});L7.setState({records:{...e,items:t}}),i.forEach(e=>{let t=n.items.find(t=>t.id===e);Et(e),t?.status===`completed`?(T(t=>({...t,[e]:`done`})),g(n=>n?.id===e?t:n),Z.success({content:`「${ht}」视频生成完成!`,key:e,duration:5})):t?.status===`failed`&&(T(t=>({...t,[e]:`failed`})),g(n=>n?.id===e?t:n),Z.error({content:`「${ht}」视频生成失败: ${t.errorMessage||`未知错误`}`,key:e,duration:5}))})}}catch(e){e.name}},5e3)},kt=e=>{Tt(e)};(0,S.useEffect)(()=>()=>{Dt(),ct()},[]);let At=async e=>{if(!bt){Z.error(`积分不足,请先充值`);return}C(t=>({...t,[e]:!0})),T(t=>({...t,[e]:`generating`})),Z.loading({content:`「${ht}」正在提交视频生成...`,duration:0,key:e});try{(await c(e,{aspectRatio:le,resolution:de})).status===`failed`?(T(t=>({...t,[e]:`failed`})),Z.error({content:`「${ht}」提交失败`,key:e,duration:3})):(Z.success({content:`「${ht}」已提交,正在生成中...`,key:e,duration:3}),kt(e))}catch(t){T(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{C(t=>({...t,[e]:!1}))}},jt=async e=>{let t=mt.find(t=>t.id===e);if(t){C(t=>({...t,[e]:!0})),T(t=>({...t,[e]:`generating`})),Z.loading({content:`「${ht}」正在重新提交...`,duration:0,key:e});try{let n=E[e];n&&n!==t.optimizedPrompt&&await fie(e,n),(await c(e,{aspectRatio:t.aspectRatio||`16:9`,resolution:t.resolution||`720p`})).status===`failed`?(T(t=>({...t,[e]:`failed`})),Z.error({content:`「${ht}」提交失败`,key:e,duration:3})):(Z.success({content:`「${ht}」已提交,正在生成中...`,key:e,duration:3}),kt(e))}catch(t){T(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{C(t=>({...t,[e]:!1}))}}},Mt=e=>{let t=w[e.id];return t===`generating`?`generating`:t===`done`?`completed`:t===`failed`?`failed`:e.status},Nt={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(Xm,{style:{animation:`spinSlow 1s linear infinite`}})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(DV,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(Xm,{style:{animation:`spinSlow 1s linear infinite`}})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(A4,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(N4,{})}},Pt=({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:i?`rgba(99,102,241,0.08)`:`#f8f9fc`,border:i?`1px solid #6366f1`:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsxs)(`span`,{style:{fontSize:12,color:`#6366f1`,fontWeight:500,lineHeight:`18px`},children:[t,r]}),(0,$.jsx)(mQ,{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,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)]})},Ft=({group:e,selected:t,expanded:n,onToggle:r,onSelect:i,onClose:a})=>{let o=(0,S.useRef)(null),s=(0,S.useRef)(null),c=(0,S.useRef)(n),[l,u]=(0,S.useState)(null);return c.current=n,(0,S.useEffect)(()=>{if(n&&o.current){let e=o.current.getBoundingClientRect();u({bottom:window.innerHeight-e.top+4,left:e.left})}else u(null)},[n]),(0,S.useEffect)(()=>{if(!n)return;let e=e=>{o.current?.contains(e.target)||s.current?.contains(e.target)||c.current&&a()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n,a]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:o,onClick:r,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,cursor:`pointer`,userSelect:`none`,transition:`all 0.2s`,background:t?`rgba(99,102,241,0.08)`:`#f8f9fc`,border:n?`1px solid #6366f1`:`1px solid #e2e8f0`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:t?`#6366f1`:`#64748b`,fontWeight:t?600:400},children:t||e.name}),(0,$.jsx)(mQ,{style:{fontSize:9,color:t?`#6366f1`:`#94a3b8`,transition:`transform 0.2s`,transform:n?`rotate(180deg)`:`rotate(0deg)`}})]}),l&&(0,Vi.createPortal)((0,$.jsxs)(`div`,{ref:s,style:{position:`fixed`,bottom:l.bottom,left:l.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,n)=>{let r=t===e;return(0,$.jsx)(`div`,{onClick:()=>{i(e),a()},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)]})};return(0,$.jsxs)(`div`,{style:{margin:`-24px -32px -32px`,borderRadius:20,height:`calc(100vh - 34px)`,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)(z2,{}),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:ht}),pt&&(0,$.jsx)(h$,{style:{background:`rgba(99, 102, 241, 0.08)`,border:`1px solid rgba(99, 102, 241, 0.15)`,color:`#6366f1`,borderRadius:6},children:U[pt.industry]||pt.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)(h$,{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:[`剩余 `,_t,` 积分`]})]}),!p&&(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)(HI.Group,{defaultValue:`video`,buttonStyle:`solid`,onChange:tt,children:[(0,$.jsxs)(HI.Button,{value:`video`,children:[(0,$.jsx)(v5,{style:{marginRight:6,fontSize:14}}),` `,`视频`]}),(0,$.jsxs)(HI.Button,{value:`image`,style:{zIndex:0},children:[(0,$.jsx)(e8,{style:{marginRight:6,fontSize:14}}),` `,`图片`]})]})]}),xe===`video`&&[{icon:(0,$.jsx)(Z$,{}),label:`描述视频+时长`,color:`#6366f1`},{icon:(0,$.jsx)(s5,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(D8,{}),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)),xe===`image`&&[{icon:(0,$.jsx)(Z$,{}),label:`描述图片+尺寸`,color:`#6366f1`},{icon:(0,$.jsx)(s5,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(D8,{}),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)(bU,{form:n,initialValues:{},children:[(0,$.jsx)(bU.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:[M.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`&&oe(`http://ceshi.apiforeign.minzhong.cn${e.url}`)},children:e.type===`image`?(0,$.jsx)(bW,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(K7,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`})}),(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),K5(e.url).catch(()=>{}),N(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)(N4,{style:{color:`#fff`,fontSize:10}})})]},t)),(0,$.jsx)(G7,{accept:`image/*,video/*`,onLocalSelect:e=>{e.forEach(async e=>{await Le(e)})},onHistorySelect:e=>{e.forEach(e=>{N(t=>[...t,{url:e.resourceUrl||e.previewUrl||e.displayUrl||``,type:e.resourceType,name:e.fileName||``}])}),Z.success(`成功添加${e.length}个历史记录`)},onPortraitSelect:e=>{e.forEach(e=>{N(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:P,tooltipTitle:`图片${M.filter(e=>e.type===`image`).length}/5,视频${M.filter(e=>e.type===`video`).length}/2`,maxImageCount:5,maxVideoCount:2,usedImageCount:M.filter(e=>e.type===`image`).length,usedVideoCount:M.filter(e=>e.type===`video`).length,usedVideoDuration:M.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:P?(0,$.jsx)(Xm,{style:{fontSize:18,color:`#6366f1`}}):(0,$.jsx)(mL,{style:{fontSize:18,color:`#94a3b8`}})})})]}),(0,$.jsx)(`div`,{style:{padding:`8px 16px 4px`},children:(0,$.jsx)(tG.TextArea,{ref:H,value:I,onChange:e=>{let t=e.target.value;L(t),n.setFieldsValue({prompt:t});let r=t.lastIndexOf(`@`);if(r>=0){let e=t.slice(r+1);if(!e.includes(` `)&&!e.includes(`
-`)){z(!0),V(e);return}}z(!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 Le(e)}))},rows:3,placeholder:`上传参考素材、输入文字,自由组合图、文多元素。输入 @ 可引用参考内容...`,maxLength:500,bordered:!1,autoSize:{minRows:2,maxRows:6},style:{padding:`6px 2px`,fontSize:15,lineHeight:1.7,resize:`none`,caretColor:`#6366f1`}})}),R&&M.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:M.filter(e=>!B||e.name.includes(B)).map((e,t)=>(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 r=H.current?.resizableTextArea?.textArea||H.current?.nativeElement?.querySelector(`textarea`)||H.current;if(!r||!r.value)return;let i=r.value,a=i.lastIndexOf(`@`),o=i.slice(0,a)+`@${e.name} `;L(o),n.setFieldValue(`prompt`,o),z(!1),setTimeout(()=>{r.focus(),r.selectionStart=o.length,r.selectionEnd=o.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:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(l8,{style:{color:`#fff`,fontSize:14}})}),(0,$.jsx)(Q.Text,{style:{fontSize:13},children:e.name}),(0,$.jsx)(h$,{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:[xe!==`image`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,flexWrap:`wrap`},children:[(0,$.jsx)(Pt,{label:`时长`,value:`${se}`,options:he.durations.map(e=>`${e}`),suffix:`秒`,expanded:pe===`duration`,onToggle:()=>me(pe===`duration`?null:`duration`),onSelect:e=>ce(parseInt(e)),onClose:()=>me(null)}),gt.map((e,t)=>{let n=K===e.name,r=te[e.name];return(0,$.jsx)(Ft,{group:e,selected:r,expanded:n,onToggle:()=>re(n?null:e.name),onSelect:t=>{ne(n=>{let r={...n};return r[e.name]===t?delete r[e.name]:r[e.name]=t,r})},onClose:()=>re(null)},`og-${t}`)})]}),xe==`image`&&(0,$.jsxs)(`div`,{style:{position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>Me(!je),className:`image-settings-trigger`,style:{minWidth:220,padding:`0px 16px`,height:30,borderRadius:10,border:`1px solid #e2e8f0`,backgroundColor:`#f8f9fc`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:(0,$.jsxs)(`div`,{style:{textAlign:`left`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,fontWeight:600,color:`#374151`,marginRight:10},children:Ce===`auto`?`智能`:Ce}),(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#9ca3af`},children:[Te==`2K`?`高清 2K`:`超清 4K`,`| `,De,`×`,ke]})]})}),(0,$.jsx)(mQ,{style:{fontSize:14,color:`#9ca3af`}})]}),je&&(0,$.jsxs)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:0,width:520,backgroundColor:`#fff`,borderRadius:16,boxShadow:`0 10px 40px rgba(0,0,0,0.15)`,padding:20,border:`none`,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:He.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{we(e.value),Be(e.label)},style:{flex:`0 0 calc(11.11% - 5px)`,minWidth:48,height:56,borderRadius:8,border:Ce===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Ce===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 ${Ce===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:Ce===e.value?`#6366f1`:`#9ca3af`},children:`智`})}),(0,$.jsx)(`span`,{style:{fontSize:10,color:Ce===e.value?`#6366f1`:`#6b7280`,fontWeight:Ce===e.value?600:400},children:e.value})]},e.value))})]}),(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:8},children:We.map(e=>(0,$.jsx)(`button`,{onClick:()=>{Ee(e.value),Ve(e.label)},style:{flex:1,height:48,borderRadius:8,border:Te===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Te===e.value?`#6366f1`:`#f9fafb`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:(0,$.jsxs)(`span`,{style:{fontSize:13,fontWeight:600,color:Te===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:10,fontSize:13,fontWeight:500,color:`#666666`},children:`尺寸`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},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)(tG,{value:De,onChange:e=>Oe(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:6,height:40,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:14,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`button`,{onClick:et,style:{width:28,height:28,borderRadius:6,border:`1px solid #e5e7eb`,backgroundColor:`#fff`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,color:`#6366f1`},children:(0,$.jsx)(aW,{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)(tG,{value:ke,onChange:e=>Ae(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:6,height:40,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:14,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:12},children:`PX`})]})]})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0},children:[xe===`image`&&(0,$.jsx)(`span`,{style:{color:`#7c7c7c`,fontSize:14},children:`(请在左侧选择图片比例和尺寸)`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:xt,loading:d,style:{borderRadius:10,fontWeight:600,minWidth:140,height:40,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 4px 16px rgba(99,102,241,0.35)`},children:`AI优化提示词`})]})]})]})]})]}),p&&h&&(0,$.jsxs)(RL,{className:`animate-fadeInUp`,style:{borderRadius:16},styles:{body:{padding:`24px 28px`}},children:[!w[h.id]||w[h.id]===`idle`?(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,marginBottom:24,padding:`14px 18px`,borderRadius:12,background:`linear-gradient(135deg, rgba(16,185,129,0.06), rgba(5,150,105,0.06))`,border:`1px solid rgba(16,185,129,0.15)`},children:[(0,$.jsx)(A4,{style:{color:`#10b981`,fontSize:22}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,display:`block`},children:`提示词优化完成`}),(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`文本优化消耗 `,_e,` 积分· 您可以编辑提示词后选择参数生成视频`]})]})]}):(0,$.jsxs)(`div`,{style:{marginBottom:24,padding:`16px 18px`,borderRadius:12,display:`flex`,alignItems:`center`,gap:12,background:w[h.id]===`failed`?`rgba(239,68,68,0.04)`:w[h.id]===`done`?`rgba(16,185,129,0.04)`:`rgba(99,102,241,0.04)`,border:`1px solid ${w[h.id]===`failed`?`rgba(239,68,68,0.12)`:w[h.id]===`done`?`rgba(16,185,129,0.12)`:`rgba(99,102,241,0.12)`}`},children:[w[h.id]===`generating`&&(0,$.jsx)(Xm,{style:{color:`#6366f1`,fontSize:18},spin:!0}),w[h.id]===`done`&&(0,$.jsx)(A4,{style:{color:`#10b981`,fontSize:18}}),w[h.id]===`failed`&&(0,$.jsx)(N4,{style:{color:`#ef4444`,fontSize:18}}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14,color:w[h.id]===`failed`?`#ef4444`:w[h.id]===`done`?`#10b981`:`#6366f1`},children:[w[h.id]===`generating`&&`${xe===`image`?`图片`:`视频`}生成中,请稍候...`,w[h.id]===`done`&&`${xe===`image`?`图片`:`视频`}生成成功`,w[h.id]===`failed`&&`${xe===`image`?`图片`:`视频`}生成失败,请重试`]})]}),!w[h.id]||w[h.id]===`idle`||w[h.id]===`failed`?(0,$.jsxs)(`div`,{className:`gen-prompt-row`,style:{display:`flex`,gap:20,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{flex:`1 1 45%`,minWidth:240},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:100},children:(0,$.jsx)(Q.Text,{style:{fontSize:14,color:`#64748b`,lineHeight:1.7},children:h.originalPrompt})})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 45%`,minWidth:240},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:[`优化后的提示词`,` `,!y&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!y&&(0,$.jsxs)(EH,{size:4,children:[(0,$.jsx)(Cw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(b1,{}),onClick:()=>{navigator.clipboard.writeText(_),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(Cw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(Z$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(tG.TextArea,{value:_,onChange:e=>v(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:()=>{v(h.optimizedPrompt||``),b(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{b(!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:_})})]})]}):(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:h.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:[`优化后的提示词`,` `,!y&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!y&&(0,$.jsxs)(EH,{size:4,children:[(0,$.jsx)(Cw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(b1,{}),onClick:()=>{navigator.clipboard.writeText(_),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(Cw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(Z$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(tG.TextArea,{value:_,onChange:e=>v(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:()=>{v(h.optimizedPrompt||``),b(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{b(!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:_})})]})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 40%`,minWidth:280},children:[h.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:`http://ceshi.apiforeign.minzhong.cn${h.videoUrl}`,controls:!0,style:{width:`100%`,maxHeight:350,display:`block`}})})]}),h.imageUrl&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`生成图片`}),(0,$.jsx)(bW,{src:`http://ceshi.apiforeign.minzhong.cn${h.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`,marginTop:20,padding:`14px 18px`,borderRadius:12,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:[xe!==`image`&&(0,$.jsxs)(`div`,{style:{marginTop:24,borderRadius:12,background:`#f8f9fc`,width:`25%`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#1a1a2e`,fontWeight:600,display:`block`,marginBottom:12},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:[se,`s`]})]}),(0,$.jsx)(Pt,{label:`比例`,value:le,options:he.ratios,expanded:pe===`ratio`,onToggle:()=>me(pe===`ratio`?null:`ratio`),onSelect:e=>ue(e),onClose:()=>me(null)}),(0,$.jsx)(Pt,{label:`分辨率`,value:de,options:he.resolutions,expanded:pe===`resolution`,onToggle:()=>me(pe===`resolution`?null:`resolution`),onSelect:e=>fe(e),onClose:()=>me(null)})]})]}),xe==`image`&&h&&(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:h.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:h.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:h.imagePx||`-`})]})]})}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`文字积分`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#6366f1`},children:_e})]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:18},children:`+`}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:[`预估`,xe===`image`?`图片`:`视频`,`积分`]}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#10b981`},children:xe===`image`&&h.imageSize?vt(h.imageSize)||yt:Re(se,de)})]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:18},children:`=`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`总计`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16,color:`#1a1a2e`},children:(_e+(xe===`image`?vt(h.imageSize):Re(se,de))).toFixed(2)})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[(0,$.jsxs)(X,{size:`large`,onClick:()=>{m(!1),g(null),v(``),L(``),N([]),ne({}),re(null),me(null),n.resetFields()},style:{borderRadius:12,minWidth:120,height:44,fontWeight:500},children:[`配置新`,xe===`image`?`图片`:`视频`]}),(0,$.jsx)(Cw,{title:bt?``:`积分不足`,children:(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(D8,{}),onClick:()=>At(h.id),loading:w[h.id]===`generating`,disabled:!bt||w[h.id]===`generating`||w[h.id]===`done`,style:{borderRadius:12,minWidth:180,height:44,fontWeight:600,background:w[h.id]===`done`?`#10b981`:bt?`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`:`#d1d5db`,border:`none`,boxShadow:bt?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:w[h.id]===`done`?`生成完成`:w[h.id]===`generating`?`生成中...`:`生成${xe===`image`?`图片`:`视频`} (${xe===`image`?vt(h.imageSize):Re(se,de)}积分)`})})]})]}),h.references&&h.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:h.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`&&oe(`http://ceshi.apiforeign.minzhong.cn${e.url}`)},children:[e.type===`image`?(0,$.jsx)(bW,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(K7,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,width:64,height:64}),(0,$.jsx)(h$,{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))})]})]}),mt.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:mt.map((e,t)=>{let n=Mt(e),r=E[e.id]??(e.optimizedPrompt||e.originalPrompt),i=A===e.id,a=e.genType||`image`;return(0,$.jsxs)(`div`,{className:`animate-slideInCard`,style:{animationDelay:`${t*.05}s`},children:[(0,$.jsxs)(`div`,{className:`record-item`,onClick:()=>j(i?null:e.id),style:{padding:`12px 16px`,borderRadius:i?`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:a===`image`?`#fef3c7`:`#dbeafe`},children:a===`image`?(0,$.jsx)(e8,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(v5,{style:{color:`#2563eb`,fontSize:12}})}),i?(0,$.jsx)(mQ,{style:{color:`#6366f1`,fontSize:11,flexShrink:0}}):(0,$.jsx)(D4,{style:{color:`#cbd5e1`,fontSize:11,flexShrink:0}}),(0,$.jsx)(h$,{color:Nt[n]?.color,icon:Nt[n]?.icon,style:{margin:0},children:Nt[n]?.text}),(0,$.jsx)(Q.Text,{style:{flex:1,fontSize:13,color:`#475569`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),n===`prompt_optimized`&&(0,$.jsx)(h$,{color:`processing`,style:{padding:`3px 10px`,fontSize:12,margin:0,flexShrink:0},children:`待配置`}),a===`image`?(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.duration?`${e.imageSize}`:`-`,` ·`,` `,e.imageProportion||`-`,` ·`,` `,e.imagePx||`-`,` ·`,` `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:R7(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:R7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(EH,{children:n===`failed`&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(l8,{}),loading:x[e.id],onClick:()=>jt(e.id),style:{borderRadius:8},children:`重试`})})})]}),i&&(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:[`优化后的提示词`,` `,(n===`prompt_optimized`||n===`failed`)&&O!==e.id&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),O!==e.id&&(0,$.jsxs)(EH,{size:4,children:[(0,$.jsx)(Cw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(b1,{}),onClick:()=>{navigator.clipboard.writeText(r),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(n===`prompt_optimized`||n===`failed`)&&(0,$.jsx)(Cw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(Z$,{}),onClick:()=>{k(e.id),D(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt??``}))},style:{color:`#6366f1`}})})]})]}),O===e.id?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(tG.TextArea,{value:r,onChange:t=>D(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:()=>k(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{D(t=>({...t,[e.id]:r})),k(null),Z.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:n===`prompt_optimized`?`rgba(99,102,241,0.02)`:`#f8f9fc`,border:n===`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:r})})]}),a===`image`?(0,$.jsx)(`div`,{style:{display:`flex`,gap:14,padding:`10px 14px`,borderRadius:10,background:`#f8f9fc`},children:[{label:`文字积分`,value:`${e.textCreditsCost||0}`},{label:`图片积分`,value:`${e.creditsCost||0}`},{label:`分辨率`,value:e.imageSize?`${e.imageSize}`:`-`},{label:`比例`,value:e.imageProportion||`-`},{label:`尺寸`,value:e.imagePx||`-`}].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:13,color:`#1a1a2e`},children:e.value})]},t))}):(0,$.jsx)(`div`,{style:{display:`flex`,gap:14,padding:`10px 14px`,borderRadius:10,background:`#f8f9fc`},children:[{label:`文字积分`,value:`${e.textCreditsCost||0}`},{label:`视频积分`,value:`${e.creditsCost||0}`},{label:`时长`,value:e.duration?`${e.duration}秒`:`-`},{label:`比例`,value:e.aspectRatio||`-`},{label:`分辨率`,value:e.resolution||`-`}].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:13,color:`#1a1a2e`},children:e.value})]},t))}),(e.references&&e.references.length>0||n===`failed`)&&(0,$.jsxs)(`div`,{style:{marginTop:14},children:[(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:[`参考素材`,` `,n===`failed`&&(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`&&oe(`http://ceshi.apiforeign.minzhong.cn${t.url}`)},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:10,overflow:`hidden`},children:t.type===`image`?(0,$.jsx)(bW,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(K7,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,width:64,height:64})}),(0,$.jsx)(h$,{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===`failed`&&(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),K5(t.url).catch(()=>{});let i=e.references.filter((e,t)=>t!==r);L7.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)(N4,{style:{color:`#fff`,fontSize:10}})})]},r)),n===`failed`&&(0,$.jsx)(R0,{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?U5(t).then(n=>{let r={url:n.url,type:`image`,name:t.name||`图片`},i=e.references||[];L7.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=>{W5(t,n).then(r=>{let i={url:r.url,type:`video`,name:t.name||`视频`,duration:n||void 0},a=e.references||[];L7.getState().updateRecordReferences(e.id,[...a,i]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`))}),!1)},children:(0,$.jsx)(Cw,{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)(mL,{style:{fontSize:18,color:`#94a3b8`}})})})})]})]})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 40%`,minWidth:220,position:`relative`},children:[n===`prompt_optimized`&&(0,$.jsxs)(`div`,{style:{marginTop:16,position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,backgroundColor:`transparent`},children:[a===`video`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`,marginBottom:12},children:[(0,$.jsxs)(`div`,{translate:`no`,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,marginLeft:12},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:[e.duration,`秒`]})]}),(0,$.jsx)(Pt,{label:`比例`,value:ie[e.id]?.aspectRatio||`选择比例`,options:he.ratios,expanded:pe===`ratio-${e.id}`,onToggle:()=>me(pe===`ratio-${e.id}`?null:`ratio-${e.id}`),onSelect:t=>ae(n=>({...n,[e.id]:{...n[e.id],aspectRatio:t,resolution:n[e.id]?.resolution||``}})),onClose:()=>me(null)}),(0,$.jsx)(Pt,{label:`分辨率`,value:ie[e.id]?.resolution||`选择分辨率`,options:he.resolutions,expanded:pe===`res-${e.id}`,onToggle:()=>me(pe===`res-${e.id}`?null:`res-${e.id}`),onSelect:t=>ae(n=>({...n,[e.id]:{...n[e.id],aspectRatio:n[e.id]?.aspectRatio||``,resolution:t}})),onClose:()=>me(null)})]}),(0,$.jsxs)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(D8,{}),block:!0,loading:x[e.id],disabled:a===`video`&&(!ie[e.id]?.aspectRatio||!ie[e.id]?.resolution),onClick:async()=>{let t=ie[e.id];if(a===`video`){if(!t?.aspectRatio||!t?.resolution){Z.error(`请选择比例和分辨率`);return}if(_t({...t,[e.id]:!0})),T(t=>({...t,[e.id]:`generating`}));let n=a===`video`?`视频`:`图片`;Z.loading({content:`「${ht}」正在生成${n}...`,duration:0,key:e.id});try{await c(e.id,{aspectRatio:t?.aspectRatio,resolution:t?.resolution}),T(t=>({...t,[e.id]:`done`})),Z.success({content:`「${ht}」${n}生成成功!`,key:e.id,duration:3})}catch{T(t=>({...t,[e.id]:`failed`})),Z.error({content:`「${ht}」${n}生成失败`,key:e.id,duration:3})}finally{C(t=>({...t,[e.id]:!1}))}},style:{borderRadius:12,fontWeight:600,color:`#fff`,height:48,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,position:`absolute`,bottom:18,left:0},children:[`生成`,a===`video`?`视频`:`图片`,a===`video`?(0,$.jsx)(`span`,{style:{color:`#d2d2d2`,fontSize:`14px`,marginLeft:`6px`},children:`(请选择上方的比例分辨率)`}):``,` `,a===`video`&&ie[e.id]?.resolution?`(${Re(e.duration||5,ie[e.id].resolution)}积分)`:``,a===`image`&&e.imageSize?`(${ze(e.imageSize)}积分)`:a===`image`?`(积分)`:``]})]}),n===`failed`&&(0,$.jsx)(`div`,{style:{position:`absolute`,bottom:18,right:20},children:(0,$.jsxs)(X,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(l8,{}),block:!0,loading:x[e.id],onClick:()=>jt(e.id),style:{borderRadius:12,fontWeight:600,height:48},children:[`重新生成`,a===`video`?`视频`:`图片`]})}),n===`generating`?(0,$.jsxs)(`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,$.jsx)(Xm,{style:{color:`#6366f1`,fontSize:28},spin:!0}),(0,$.jsxs)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:[a===`video`?`视频`:`图片`,`生成中...`]})]}):n===`completed`&&e.videoUrl||e.imageUrl?(0,$.jsxs)(`div`,{style:{borderRadius:12,overflow:`hidden`,border:`1px solid #f0f0f5`,position:`relative`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:10,right:10,zIndex:10},children:(0,$.jsx)(Cw,{title:`下载${a===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(M0,{}),onClick:()=>{let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${a===`video`?e.videoUrl:e.imageUrl}&download=1`,t.download=`${e.projectName}${a===`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:a===`video`?(0,$.jsx)(`video`,{src:`http://ceshi.apiforeign.minzhong.cn${e.videoUrl}`,controls:!0,preload:`metadata`,style:{width:`100%`,height:`400px`,borderRadius:0}}):(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${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)(EH,{children:[a===`video`?(0,$.jsx)(v5,{style:{color:`#6366f1`,fontSize:13}}):(0,$.jsx)(e8,{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:R7(e.generatedAt)})]})]}):n===`failed`?(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)(N4,{style:{color:`#ef4444`,fontSize:28}}),(0,$.jsxs)(Q.Text,{style:{color:`#ef4444`,fontSize:14,fontWeight:600},children:[a===`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)(DV,{style:{color:`#94a3b8`,fontSize:28}}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:a===`image`?`待生成图片`:n===`prompt_optimized`?`待配置视频参数`:`待生成视频`})]})]})]})})]},e.id)})})]}),(0,$.jsx)(NK,{open:!!q,onCancel:()=>oe(null),footer:null,width:480,centered:!0,destroyOnHidden:!0,closable:!1,title:null,styles:{body:{padding:0,background:`#000`,position:`relative`}},children:q&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:q,controls:!0,autoPlay:!0,style:{width:`100%`,display:`block`,maxHeight:`70vh`}}),(0,$.jsx)(`div`,{onClick:()=>oe(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)(T5,{style:{color:`#fff`,fontSize:16}})})]})})]})},q7={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(Xm,{spin:!0})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(DV,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(Xm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(A4,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(N4,{})}},Qae=()=>{let e=Ye(),{records:t,projects:n,fetchRecords:r,fetchProjects:i,generateVideo:a}=L7(),o=t.items,[s,c]=(0,S.useState)(1),[l,u]=(0,S.useState)(10),[d,f]=(0,S.useState)({}),[p,m]=(0,S.useState)(void 0),[h,g]=(0,S.useState)(void 0),[_,v]=(0,S.useState)({}),[y,b]=(0,S.useState)(null),[x,C]=(0,S.useState)(null),[w,T]=(0,S.useState)(null);(0,S.useEffect)(()=>{i()},[i]),(0,S.useEffect)(()=>{r({projectId:p,status:h,page:s,pageSize:l})},[r,p,h,s,l]);let E=async()=>{if(!w)return;let{recordId:e,projectName:t,ratio:n,resolution:r}=w;f(t=>({...t,[e]:!0})),T(null),Z.loading({content:`「${t}」正在生成视频...`,duration:0,key:e});try{await a(e,{aspectRatio:n,resolution:r}),Z.success({content:`「${t}」视频生成成功!`,key:e,duration:3})}catch{Z.error({content:`「${t}」视频生成失败`,key:e,duration:3})}finally{f(t=>({...t,[e]:!1}))}},D=e=>{if((e.genType||`image`)===`image`){f(t=>({...t,[e.id]:!0})),Z.loading({content:`「${e.projectName}」正在生成图片...`,duration:0,key:e.id}),a(e.id,{}).then(()=>{Z.success({content:`「${e.projectName}」图片生成成功!`,key:e.id,duration:3})}).catch(()=>{Z.error({content:`「${e.projectName}」图片生成失败`,key:e.id,duration:3})}).finally(()=>{f(t=>({...t,[e.id]:!1}))});return}T({recordId:e.id,projectName:e.projectName,ratio:e.aspectRatio||`16:9`,resolution:e.resolution||`720p`})},O=o;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)(z2,{}),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)(EH,{children:[(0,$.jsx)(x3,{style:{color:`#94a3b8`}}),(0,$.jsx)(NC,{placeholder:`全部项目`,allowClear:!0,style:{width:200},onChange:e=>{m(e),c(1)},children:n.map(e=>(0,$.jsx)(NC.Option,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(NC,{placeholder:`全部状态`,allowClear:!0,style:{width:140},onChange:e=>{g(e),c(1)},children:[(0,$.jsx)(NC.Option,{value:`prompt_optimized`,children:`待生成`}),(0,$.jsx)(NC.Option,{value:`generating`,children:`生成中`}),(0,$.jsx)(NC.Option,{value:`completed`,children:`已完成`}),(0,$.jsx)(NC.Option,{value:`failed`,children:`失败`})]})]}),(0,$.jsxs)(Q.Text,{style:{marginLeft:`auto`,lineHeight:`32px`,color:`#94a3b8`,fontSize:13},children:[`共 `,t.total,` 条记录`]})]}),O.length===0?(0,$.jsx)(rC,{image:rC.PRESENTED_IMAGE_SIMPLE,description:`暂无生成记录`,style:{padding:60}}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},className:`stagger-children`,children:O.map((e,t)=>{let n=y===e.id,r=_[e.id]??e.optimizedPrompt,i=d[e.id],a=x===e.id,o=e.genType||`image`;return(0,$.jsxs)(`div`,{className:`animate-slideInCard`,style:{animationDelay:`${t*.04}s`},children:[(0,$.jsxs)(`div`,{className:`record-item`,onClick:()=>C(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)(e8,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(v5,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(mQ,{style:{color:`#6366f1`,fontSize:12,flexShrink:0}}):(0,$.jsx)(D4,{style:{color:`#cbd5e1`,fontSize:12,flexShrink:0}}),(0,$.jsx)(h$,{color:q7[e.status].color,icon:q7[e.status].icon,style:{margin:0},children:q7[e.status].text}),(0,$.jsx)(h$,{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.duration?`${e.imageSize}`:`-`,` · `,e.imageProportion||`-`,` · `,e.imagePx||`-`,` · `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:R7(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:R7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(EH,{children:[e.status===`prompt_optimized`&&(0,$.jsx)(X,{type:`primary`,size:`small`,icon:(0,$.jsx)(l8,{}),loading:i,onClick:()=>D(e),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`生成`}),e.status===`generating`&&(0,$.jsx)(h$,{color:`processing`,icon:(0,$.jsx)(Xm,{spin:!0}),style:{padding:`4px 12px`,fontSize:12},children:`生成中...`}),e.status===`failed`&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(l8,{}),loading:i,onClick:()=>D(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)(EH,{size:4,children:[(0,$.jsx)(Cw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(b1,{}),onClick:()=>{navigator.clipboard.writeText(r),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),e.status===`prompt_optimized`&&(0,$.jsx)(Cw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(Z$,{}),onClick:()=>{b(e.id),v(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt}))},style:{color:`#6366f1`}})})]})]}),n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(tG.TextArea,{value:r,onChange:t=>v(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:()=>b(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{v(t=>({...t,[e.id]:r})),b(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.imageProportion?`${e.imageProportion} `:`-`},{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)(D8,{}),loading:i,onClick:()=>D(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`?`选择参数生成视频`:`生成图片`})}),e.status===`failed`&&(0,$.jsx)(`div`,{style:{marginTop:16,display:`flex`,justifyContent:`flex-end`},children:(0,$.jsxs)(X,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(l8,{}),loading:i,onClick:()=>D(e),style:{borderRadius:12,fontWeight:600,height:44},children:[`重新生成`,o===`video`?`视频`:`图片`]})})]}),(0,$.jsx)(`div`,{style:{flex:`1 1 40%`,minWidth:240},children:e.status===`generating`?(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:`请耐心等待,生成完成后将自动展示`})]}):e.status===`completed`&&(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)(Cw,{title:`下载${o===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(M0,{}),onClick:()=>{let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${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:`http://ceshi.apiforeign.minzhong.cn${e.videoUrl}`,controls:!0,preload:`metadata`,style:{width:`100%`,height:`400px`,display:`block`}}):(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${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)(EH,{children:[o===`video`?(0,$.jsx)(v5,{style:{color:`#6366f1`}}):(0,$.jsx)(e8,{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:[`生成于 `,R7(e.generatedAt)]})]})]}):e.status===`failed`?(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)(N4,{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)(DV,{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)(VG,{current:t.page||s,pageSize:t.pageSize||l,total:t.total,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{c(e),u(t)}})}),(0,$.jsx)(NK,{title:(0,$.jsxs)(EH,{children:[(0,$.jsx)(D8,{}),`生成视频`]}),open:!!w,onCancel:()=>T(null),onOk:E,okText:`提交生成`,cancelText:`取消`,width:420,children:w&&(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:16},children:(()=>{let e=o.find(e=>e.id===w.recordId);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,children:[e?.duration||5,`秒`]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`画面比例`}),(0,$.jsx)(NC,{value:w.ratio,onChange:e=>T(t=>t?{...t,ratio:e}:null),style:{width:`100%`},options:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`].map(e=>({value:e,label:e}))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`分辨率`}),(0,$.jsx)(NC,{value:w.resolution,onChange:e=>T(t=>t?{...t,resolution:e}:null),style:{width:`100%`},options:[`480p`,`720p`,`1080p`].map(e=>({value:e,label:e}))})]})]})})()})})]})},J7=({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()})},$ae=()=>{let{user:e}=j7(),[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 q5(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)(mJ,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(pz,{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)(EH,{style:{marginBottom:10},children:[(0,$.jsx)(b5,{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)(J7,{value:e?.credits??0})})]})]})}),(0,$.jsx)(pz,{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)(EH,{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)(G2,{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)(J7,{value:f})})]})}),(0,$.jsx)(pz,{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)(EH,{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)(I2,{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)(J7,{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)(s5,{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)(n$,{columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>(0,$.jsx)(h$,{color:e===`recharge`?`green`:`orange`,icon:e===`recharge`?(0,$.jsx)(G2,{}):(0,$.jsx)(I2,{}),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:R7(e)})}],dataSource:t,rowKey:`id`,loading:r,pagination:{current:a,pageSize:s,total:l,onChange:d,showSizeChanger:!0,showTotal:e=>`共 ${e} 条`},scroll:{x:500}})})]})]})},eoe=()=>{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 q5(c,u);r(e.records||[]),a(e.credits||0),s(e.total||0)}catch{r([])}t(!1)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(mJ,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(pz,{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)(b5,{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)(pz,{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)(f8,{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)(pz,{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)(s5,{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)(s5,{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)(cK,{spinning:e,children:n.length===0?(0,$.jsx)(rC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无积分变动记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(n$,{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:`#8b5cf6`,label:`团队内部`,bg:`rgba(139,92,246,0.1)`}}[e]||{color:`#64748b`,label:e,bg:`rgba(100,116,139,0.1)`};return(0,$.jsx)(h$,{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)(VG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})]})},toe=()=>{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);(0,S.useEffect)(()=>{l()},[o]);let l=async()=>{t(!0);try{let e=await bie(o,c);r(e.items||[]),a(e.total||0)}catch{r([])}t(!1)};return(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(jH,{style:{color:`#0ea5e9`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`订单记录`}),(0,$.jsxs)(`span`,{style:{color:`#94a3b8`,fontSize:13},children:[`共 `,n.length,` 条记录`]})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(cK,{spinning:e,children:n.length===0?(0,$.jsx)(rC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无订单记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(n$,{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)(D2,{style:{fontSize:16}}),label:`支付宝`,color:`#1677ff`},wechat:{icon:(0,$.jsx)(C5,{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)(h$,{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)(VG,{current:o,pageSize:c,total:i,onChange:e=>{s(e)},size:`small`})})]})})})]})})},noe=()=>{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 X5(c,u);r(e.items||[]),s(e.total||0)}catch{r([])}t(!1)},f=async()=>{try{a(await Z5())}catch{a(0)}},p=async e=>{try{await Q5(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)(o4,{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)(cK,{spinning:e,children:n.length===0?(0,$.jsx)(rC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无消息`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(n$,{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)(z8,{style:{fontSize:14}})},credit:{color:`#f59e0b`,label:`积分`,bg:`rgba(245,158,11,0.1)`,icon:(0,$.jsx)(b5,{style:{fontSize:14}})},promo:{color:`#8b5cf6`,label:`活动`,bg:`rgba(139,92,246,0.1)`,icon:(0,$.jsx)(N3,{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},{title:`状态`,dataIndex:`isRead`,key:`isRead`,width:80,render:(e,t)=>e??t.is_read?(0,$.jsx)(h$,{color:`gray`,style:{background:`rgba(148,163,184,0.1)`},children:`已读`}):(0,$.jsx)(h$,{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)(VG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})})},Y7=()=>{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)(IL,{activeKey:t,onChange:n,items:[{key:`credits`,label:`积分明细`},{key:`orders`,label:`订单记录`}],style:{marginBottom:24},size:`large`}),t===`credits`&&(0,$.jsx)(eoe,{}),t===`orders`&&(0,$.jsx)(toe,{})]})},roe=`/assets/bg1-CQh9PRPW.png`,{Text:X7}=Q,ioe=({items:e,selectedId:t,onSelect:n})=>e.length?(0,$.jsx)(EH,{direction:`vertical`,style:{width:`100%`},size:10,children:e.map(e=>{let r=t===e.id;return(0,$.jsxs)(`div`,{onClick:()=>n(e),style:{padding:14,borderRadius:14,cursor:`pointer`,border:r?`1px solid #8b5cf6`:`1px solid #e2e8f0`,background:r?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(EH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(X7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(X7,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(EH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(h$,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(h$,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(h$,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})}):(0,$.jsx)(rC,{description:`暂无项目组`}),aoe={Active:`green`,Processing:`processing`,Failed:`red`,local_deleted:`default`,remote_deleted:`default`,delete_failed:`red`},ooe={Active:`入库成功`,Processing:`入库处理中`,Failed:`入库失败`,local_deleted:`本地已删除`,remote_deleted:`远程已删除`,delete_failed:`删除失败`},Z7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,Q7=e=>e.assetType===`Video`?Z7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):Z7(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),soe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},coe=({items:e,onDelete:t,onRefresh:n})=>{let r=(0,S.useRef)(null),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)(`Image`);(0,S.useEffect)(()=>(e.some(e=>e.status!==`Failed`&&e.status!==`Active`)&&n?r.current||=window.setInterval(()=>{n()},3e3):r.current&&=(clearInterval(r.current),null),()=>{r.current&&=(clearInterval(r.current),null)}),[e,n]);let u=e=>{let t=Q7(e);t&&(s(t),l(e.assetType===`Video`?`Video`:`Image`),a(!0))};return e.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`,gap:14},children:e.map(e=>{let n=e.assetType===`Video`,r=Q7(e);return(0,$.jsx)(RL,{hoverable:!0,bodyStyle:{padding:12},style:{borderRadius:16,overflow:`hidden`,borderColor:`#eef2f7`},cover:(0,$.jsxs)(`div`,{style:{height:170,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[r?n&&e.videoCoverUrl?(0,$.jsx)(`img`,{src:r,alt:e.name||`视频封面`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(`video`,{src:r,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:r,alt:e.name||``,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(v5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)(e8,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(h$,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),r&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(NW,{}),style:{position:`absolute`,right:10,top:10},onClick:()=>u(e)}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:10,bottom:10,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:soe(e.videoDuration)})]}),children:(0,$.jsxs)(EH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(Cw,{title:e.name||e.remoteAssetId||e.id,children:(0,$.jsx)(`div`,{style:{fontWeight:600,color:`#1e293b`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name||e.remoteAssetId||`未命名素材`})}),(0,$.jsxs)(EH,{wrap:!0,size:4,children:[(0,$.jsx)(h$,{color:aoe[e.status]||`default`,children:ooe[e.status]||e.status}),(0,$.jsx)(h$,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(EH,{size:6,wrap:!0,children:(0,$.jsx)(LK,{title:`确认删除这个素材吗?`,onConfirm:()=>t(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(k$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(NK,{title:`素材预览`,open:i,onCancel:()=>a(!1),footer:null,width:760,destroyOnClose:!0,children:(0,$.jsx)(`div`,{style:{minHeight:420,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#0f172a`,borderRadius:12,overflow:`hidden`},children:c===`Video`?(0,$.jsx)(`video`,{src:o,controls:!0,autoPlay:!0,style:{maxWidth:`100%`,maxHeight:520}}):(0,$.jsx)(`img`,{src:o,alt:`素材预览`,style:{maxWidth:`100%`,maxHeight:520,objectFit:`contain`}})})})]}):(0,$.jsx)(rC,{description:`暂无素材`})},$7=2,e9=15,loe=e=>{if(!e)return`Image`;if(e.type.startsWith(`video/`))return`Video`;let t=e.name.toLowerCase();return/\.(mp4|mov|webm|m4v|avi|mkv)$/.test(t)?`Video`:`Image`},uoe=e=>new Promise(t=>{if(!e.type.startsWith(`video/`)){t(null);return}let n=URL.createObjectURL(e),r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{let e=Number.isFinite(r.duration)?r.duration:null;URL.revokeObjectURL(n),t(e)},r.onerror=()=>{URL.revokeObjectURL(n),t(null)},r.src=n}),doe=e=>e==null||!Number.isFinite(e)||e<=0?(Z.error(`无法读取视频秒数,请检查视频文件是否损坏`),!1):e<$7?(Z.error(`视频素材最短不能少于 ${$7} 秒`),!1):e>e9?(Z.error(`视频素材最长不能超过 ${e9} 秒`),!1):!0,foe=({projectId:e,open:t,onClose:n,onSuccess:r})=>{let[i,a]=(0,S.useState)([]),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)(!1),u=()=>{a([]),s(``)};return(0,$.jsx)(NK,{title:`上传真人素材`,open:t,onCancel:n,onOk:async()=>{let t=i[0]?.originFileObj;if(!t){Z.warning(`请先选择图片或视频素材`);return}let a=loe(t);if(a===`Image`&&!t.type.startsWith(`image/`)){Z.error(`仅支持图片或视频素材`);return}l(!0);try{let i=a===`Video`?await uoe(t):null;if(a===`Video`&&!doe(i))return;let s=a===`Video`?await aie(t,i||void 0):await iie(t);await fae(e,{url:s.url,assetType:a,name:o.trim()||t.name,videoDuration:s.duration_seconds??i,fileSize:s.file_size_bytes??t.size,mimeType:t.type||null,uploadResourceId:s.resource_id||null}),Z.success(a===`Video`?`视频素材已提交入库,处理中`:`图片素材已提交入库,处理中`),u(),r(),n()}catch(e){Z.error(e?.message||`上传素材失败`)}finally{l(!1)}},confirmLoading:c,okText:`提交入库`,destroyOnHidden:!0,children:(0,$.jsxs)(EH,{direction:`vertical`,style:{width:`100%`},size:12,children:[(0,$.jsx)(tG,{value:o,onChange:e=>s(e.target.value),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsx)(R0,{accept:`image/*,video/*`,maxCount:1,fileList:i,beforeUpload:()=>!1,onChange:({fileList:e})=>a(e),listType:`picture`,children:(0,$.jsx)(X,{icon:(0,$.jsx)(p5,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12},children:[`当前开放图片和视频,音频暂不接入。视频素材必须在 `,$7,`~`,e9,` 秒内;入库后会经过火山真人一致性校验,Active 后才可用于 AI 创作。`]})]})})},poe=({project:e,onDeleted:t,onChanged:n})=>{let[r,i]=(0,S.useState)([]),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)(),[p,m]=(0,S.useState)(),[h,g]=(0,S.useState)(1),[_,v]=(0,S.useState)(20),[y,b]=(0,S.useState)(0),x=async(t=h,n=_)=>{o(!0);try{let r=await pae(e.id,{page:t,pageSize:n,keyword:l,status:d,assetType:p});i(r.items),b(r.total||0),g(t),v(n)}catch(e){Z.error(e?.message||`加载素材失败`)}finally{o(!1)}};(0,S.useEffect)(()=>{x(1,_)},[e.id,l,d,p]);let C=async e=>{try{await mae(e),await x(h,_),n(),Z.success(`素材已删除`)}catch(e){Z.error(e?.message||`删除素材失败`)}},w=async()=>{try{await uae(e.id),Z.success(`项目组已删除`),t()}catch(e){Z.error(e?.message||`删除项目组失败`)}},T=e.status===`active`;return(0,$.jsxs)(RL,{title:(0,$.jsx)(EH,{children:(0,$.jsx)(`span`,{children:e.name})}),extra:(0,$.jsxs)(EH,{children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(p5,{}),disabled:!T,onClick:()=>c(!0),children:`上传素材`}),(0,$.jsx)(LK,{title:`确认删除这个真人素材项目组吗?`,onConfirm:w,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(k$,{}),children:`删除项目组`})})]}),style:{borderRadius:16},children:[!T&&(0,$.jsx)(Q.Paragraph,{style:{color:`#f97316`},children:`项目组未完成真人认证,暂不能上传素材。请重新创建项目组并完成手机扫码认证。`}),(0,$.jsxs)(EH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(tG.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:l,onChange:e=>u(e.target.value),onSearch:()=>x(1,_),style:{width:240}}),(0,$.jsx)(NC,{allowClear:!0,placeholder:`素材状态`,value:d,onChange:e=>f(e),style:{width:150},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(NC,{allowClear:!0,placeholder:`素材类型`,value:p,onChange:e=>m(e),style:{width:130},options:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{onClick:()=>x(1,_),children:`筛选`})]}),(0,$.jsx)(cK,{spinning:a,children:r.length===0?(0,$.jsx)(rC,{description:`暂无素材,上传图片/视频后会异步入库`,style:{marginTop:80}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(coe,{items:r,loading:a,onDelete:C,onRefresh:()=>x(h,_)}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(VG,{current:h,pageSize:_,total:y,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>x(e,t)})})]})}),(0,$.jsx)(foe,{projectId:e.id,open:s,onClose:()=>c(!1),onSuccess:()=>{x(1,_),n()}})]})},t9=`group_active`,n9=2e3,moe=()=>{let[e,t]=(0,S.useState)([]),[n,r]=(0,S.useState)(null),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(null),[m,h]=(0,S.useState)(!1),[g]=bU.useForm(),_=(0,S.useRef)(null),v=()=>{_.current&&=(window.clearInterval(_.current),null)},y=()=>{v(),s(!1),l(!1),h(!1),d(null),p(null),g.resetFields()},b=async()=>{a(!0);try{let e=await k7({pageSize:100,status:`active`});t(e.items),r(t=>t?e.items.find(e=>e.id===t.id)||e.items[0]||null:e.items[0]||null)}catch(e){Z.error(e?.message||`加载真人素材项目组失败`)}finally{a(!1)}};(0,S.useEffect)(()=>{b()},[]),(0,S.useEffect)(()=>()=>v(),[]);let x=async e=>{v(),h(!1),Z.success(`真人认证完成,项目组已创建成功`),s(!1),p(null),d(null),g.resetFields();let n=await k7({pageSize:100,status:`active`});t(n.items),r(n.items.find(t=>t.id===e)||n.items[0]||null)},C=(e,t,n)=>{v(),h(!0);let r=async()=>{try{let n=await dae(e);if(p(n),n.status===t9){await x(t);return}[`callback_failed`,`failed`,`expired`].includes(n.status)&&(v(),h(!1),Z.error(n.errorMessage||`真人认证未完成,请重新创建项目组`))}catch(e){v(),h(!1),Z.error(e?.message||`轮询真人认证状态失败`)}};_.current=window.setInterval(r,Math.max(1e3,n||n9)),r()},w=async()=>{let e=await g.validateFields();l(!0);try{let t=`${window.location.origin}/private-portrait-authorized`,n=await lae({...e,callbackRedirectUrl:t});d(n.project),p(n.validateSession),Z.success(`请使用手机扫码完成人脸认证`),n.validateSession?.id&&C(n.validateSession.id,n.project.id,n.pollIntervalMs||n9)}catch(e){Z.error(e?.message||`创建项目组认证二维码失败`)}finally{l(!1)}},T=f?.h5Link||``,E=f?.status===t9;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`真人素材库`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`创建项目组时先完成真人认证,认证成功后项目组才会正式创建并可上传素材。`})]}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(mL,{}),onClick:()=>s(!0),children:`创建项目组`})]}),(0,$.jsxs)(mJ,{gutter:16,children:[(0,$.jsx)(pz,{xs:24,lg:5,children:(0,$.jsx)(RL,{style:{borderRadius:16,minHeight:520},children:(0,$.jsx)(cK,{spinning:i,children:e.length===0?(0,$.jsx)(rC,{description:`暂无真人项目组`}):(0,$.jsx)(ioe,{items:e,selectedId:n?.id,onSelect:r})})})}),(0,$.jsx)(pz,{xs:24,lg:19,children:n?(0,$.jsx)(poe,{project:n,onDeleted:()=>{r(null),b()},onChanged:b}):(0,$.jsx)(RL,{style:{borderRadius:16,minHeight:520,textAlign:`center`,color:`#94a3b8`},children:`请先创建或选择一个真人素材项目组`})})]}),(0,$.jsx)(NK,{title:`新建真人素材项目组`,open:o,onCancel:y,footer:f?[(0,$.jsx)(X,{onClick:y,children:`关闭`},`close`)]:void 0,onOk:f?void 0:w,okText:`开始认证并创建`,confirmLoading:c,maskClosable:!m,children:f?(0,$.jsxs)(EH,{direction:`vertical`,align:`center`,size:16,style:{width:`100%`},children:[E?(0,$.jsx)(A4,{style:{fontSize:54,color:`#22c55e`}}):T?(0,$.jsx)(Jq,{value:T,size:220}):(0,$.jsx)(cK,{}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Title,{level:5,style:{marginBottom:8},children:u?.name||`真人素材项目组`}),(0,$.jsx)(Q.Text,{type:E?`success`:`secondary`,children:E?`认证成功,项目组正在刷新`:`请使用手机扫码完成人脸认证,成功后回到电脑端查看项目组。`})]})]}):(0,$.jsxs)(bU,{form:g,layout:`vertical`,children:[(0,$.jsx)(bU.Item,{label:`项目组名称`,name:`name`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(tG,{placeholder:`例如:达人A、客户B、张三人像`})}),(0,$.jsx)(bU.Item,{label:`描述`,name:`description`,children:(0,$.jsx)(tG.TextArea,{rows:3,placeholder:`可选`})}),(0,$.jsx)(Q.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`点击后会生成真人认证二维码。手机扫码认证成功后,项目组才会出现在项目列表中。`})]})})]})},{Text:r9}=Q,i9=2,a9=15,hoe={creating:{label:`本地创建中`,color:`processing`},Processing:{label:`入库处理中`,color:`processing`},Active:{label:`入库成功`,color:`success`},Failed:{label:`入库失败`,color:`error`},local_deleted:{label:`本地已删`,color:`default`},remote_deleted:{label:`远端已删`,color:`default`},delete_failed:{label:`远端删除失败`,color:`error`}},goe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},o9=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,s9=e=>e.assetType===`Video`?o9(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):o9(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),_oe=e=>{if(!e)return`Image`;if(e.type.startsWith(`video/`))return`Video`;let t=e.name.toLowerCase();return/\.(mp4|mov|webm|m4v|avi|mkv)$/.test(t)?`Video`:`Image`},voe=e=>new Promise(t=>{if(!e.type.startsWith(`video/`)){t(null);return}let n=URL.createObjectURL(e),r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{let e=Number.isFinite(r.duration)?r.duration:null;URL.revokeObjectURL(n),t(e)},r.onerror=()=>{URL.revokeObjectURL(n),t(null)},r.src=n}),yoe=(e,t)=>e==null||!Number.isFinite(e)||e<=0?(t(`无法读取视频秒数,请检查视频文件是否损坏`),!1):ea9?(t(`视频素材最长不能超过 ${a9} 秒`),!1):!0,boe=({status:e})=>{let t=e||`-`,n=hoe[t];return(0,$.jsx)(h$,{color:n?.color||`default`,children:n?.label||t})},xoe=()=>{let{message:e}=Jb.useApp(),[t,n]=(0,S.useState)([]),[r,i]=(0,S.useState)(),[a,o]=(0,S.useState)([]),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(1),[p,m]=(0,S.useState)(20),[h,g]=(0,S.useState)(0),[_,v]=(0,S.useState)(``),[y,b]=(0,S.useState)(),[x,C]=(0,S.useState)(),[w,T]=(0,S.useState)(!1),[E,D]=(0,S.useState)(!1),[O,k]=(0,S.useState)(!1),[A,j]=(0,S.useState)(!1),[M,N]=(0,S.useState)([]),[P,F]=(0,S.useState)(``),[I,L]=(0,S.useState)(!1),[R,z]=(0,S.useState)(``),[B,V]=(0,S.useState)(`Image`),[H]=bU.useForm(),U=(0,S.useRef)(null),W=(0,S.useMemo)(()=>t.find(e=>e.id===r)||null,[t,r]),ee=async()=>{c(!0);try{let e=(await A7({page:1,pageSize:100,status:`active`})).items||[];n(e),i(t=>t&&e.some(e=>e.id===t)?t:e[0]?.id)}catch(t){e.error(t?.message||`加载虚拟人像项目组失败`)}finally{c(!1)}},G=async(t=d,n=p)=>{if(!r){o([]),g(0);return}u(!0);try{let e=await bae(r,{page:t,pageSize:n,keyword:_.trim()||void 0,status:y,assetType:x});o(e.items||[]),g(e.total||0),f(t),m(n)}catch(t){e.error(t?.message||`加载虚拟人像素材失败`)}finally{u(!1)}},te=async()=>{await ee()};(0,S.useEffect)(()=>{te()},[]),(0,S.useEffect)(()=>{r&&G(1,p)},[r]),(0,S.useEffect)(()=>(a.some(e=>e.status!==`Failed`&&e.status!==`Active`)&&r?U.current||=window.setInterval(()=>{G(d,p)},3e3):U.current&&=(clearInterval(U.current),null),()=>{U.current&&=(clearInterval(U.current),null)}),[a,r,d,p]);let ne=async()=>{let t=await H.validateFields();D(!0);try{let n=await _ae(t);e.success(`虚拟人像项目组已创建`),T(!1),H.resetFields(),await ee(),i(n.id)}catch(t){e.error(t?.message||`创建项目组失败`)}finally{D(!1)}},K=async()=>{if(!r){e.warning(`请先创建或选择项目组`);return}let t=M[0]?.originFileObj;if(!t){e.warning(`请先选择图片或视频素材`);return}let n=_oe(t);if(n===`Image`&&!t.type.startsWith(`image/`)){e.error(`仅支持图片或视频素材`);return}j(!0);try{let i=n===`Video`?await voe(t):null;if(n===`Video`&&!yoe(i,e.error))return;let a=n===`Video`?await sie(t,i||void 0):await oie(t);await yae(r,{url:a.url,assetType:n,name:P.trim()||t.name,videoDuration:a.duration_seconds??i,fileSize:a.file_size_bytes??t.size,mimeType:t.type||null,uploadResourceId:a.resource_id||null}),e.success(n===`Video`?`视频素材已提交入库,处理中`:`图片素材已提交入库,处理中`),k(!1),N([]),F(``),await Promise.all([ee(),G(1,p)])}catch(t){e.error(t?.message||`上传素材失败`)}finally{j(!1)}},re=async t=>{try{await xae(t),e.success(`素材已删除,远端删除将异步执行`),await Promise.all([ee(),G(d,p)])}catch(t){e.error(t?.message||`删除素材失败`)}},ie=async()=>{if(r)try{await vae(r),e.success(`项目组已删除,远端资产组将异步删除`),i(void 0),await te()}catch(t){e.error(t?.message||`删除项目组失败`)}},ae=t=>{let n=s9(t);if(!n){e.warning(`暂无可预览地址`);return}z(n),V(t.assetType===`Video`?`Video`:`Image`),L(!0)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`虚拟素材库`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`可提前上传虚拟人像素材,后续生成视频时可直接使用。`})]}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(mL,{}),onClick:()=>T(!0),children:`创建项目组`})]}),(0,$.jsxs)(mJ,{gutter:[10,10],children:[(0,$.jsx)(pz,{xs:24,lg:5,children:(0,$.jsx)(RL,{style:{borderRadius:16,minHeight:520,margin:`0 auto`,maxWidth:1200},children:(0,$.jsx)(cK,{spinning:s,children:t.length===0?(0,$.jsx)(rC,{description:`暂无虚拟人像项目组`}):(0,$.jsx)(EH,{direction:`vertical`,style:{width:`100%`},size:10,children:t.map(e=>{let t=r===e.id;return(0,$.jsxs)(`div`,{onClick:()=>i(e.id),style:{padding:14,borderRadius:14,cursor:`pointer`,border:t?`1px solid #8b5cf6`:`1px solid #e2e8f0`,background:t?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(EH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(r9,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(r9,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(EH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(h$,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(h$,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(h$,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})})})})}),(0,$.jsx)(pz,{xs:24,lg:19,children:(0,$.jsxs)(RL,{title:W?W.name:`素材资产`,extra:(0,$.jsxs)(EH,{wrap:!0,children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(p5,{}),disabled:!r,onClick:()=>k(!0),children:`上传图片/视频`}),r&&(0,$.jsx)(LK,{title:`确认删除当前虚拟人像项目组吗?`,onConfirm:ie,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(k$,{}),children:`删除项目组`})})]}),style:{borderRadius:16,minHeight:520},children:[(0,$.jsxs)(EH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(tG.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:_,onChange:e=>v(e.target.value),onSearch:()=>G(1,p),style:{width:240}}),(0,$.jsx)(NC,{allowClear:!0,placeholder:`素材状态`,value:y,onChange:e=>b(e),style:{width:150},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(NC,{allowClear:!0,placeholder:`素材类型`,value:x,onChange:e=>C(e),style:{width:130},options:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{onClick:()=>G(1,p),children:`筛选`})]}),(0,$.jsx)(cK,{spinning:l,children:r?a.length===0?(0,$.jsx)(rC,{description:`暂无素材,上传图片/视频后会异步入库`,style:{marginTop:80}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`,gap:14},children:a.map(e=>{let t=s9(e),n=e.assetType===`Video`;return(0,$.jsx)(RL,{hoverable:!0,bodyStyle:{padding:12},style:{borderRadius:16,overflow:`hidden`,borderColor:`#eef2f7`},cover:(0,$.jsxs)(`div`,{style:{height:170,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[t?n&&e.videoCoverUrl?(0,$.jsx)(`img`,{src:t,alt:e.name||`视频封面`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(`video`,{src:t,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:t,alt:e.name||`虚拟人像素材`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(v5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)(e8,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(h$,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),t&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(NW,{}),style:{position:`absolute`,right:10,top:10},onClick:()=>ae(e)}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:10,bottom:10,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:goe(e.videoDuration)})]}),children:(0,$.jsxs)(EH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(Cw,{title:e.name||e.remoteAssetId||e.id,children:(0,$.jsx)(`div`,{style:{fontWeight:600,color:`#1e293b`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name||e.remoteAssetId||`未命名素材`})}),(0,$.jsxs)(EH,{wrap:!0,size:4,children:[(0,$.jsx)(boe,{status:e.status}),(0,$.jsx)(h$,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(EH,{size:6,wrap:!0,children:(0,$.jsx)(LK,{title:`确认删除这个虚拟人像素材吗?`,onConfirm:()=>re(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(k$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(VG,{current:d,pageSize:p,total:h,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>G(e,t)})})]}):(0,$.jsx)(rC,{description:`请先创建或选择项目组`,style:{marginTop:80}})})]})})]}),(0,$.jsx)(NK,{title:`创建虚拟人像项目组`,open:w,onCancel:()=>T(!1),onOk:ne,confirmLoading:E,okText:`创建项目组`,children:(0,$.jsxs)(bU,{form:H,layout:`vertical`,children:[(0,$.jsx)(bU.Item,{name:`name`,label:`项目组名称`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(tG,{placeholder:`例如:虚拟主播A / 品牌代言人B`,maxLength:128})}),(0,$.jsx)(bU.Item,{name:`description`,label:`描述`,children:(0,$.jsx)(tG.TextArea,{placeholder:`可填写人物设定、服装风格、素材要求等`,maxLength:2e3,rows:4})})]})}),(0,$.jsx)(NK,{title:`上传虚拟人像素材`,open:O,onCancel:()=>k(!1),onOk:K,confirmLoading:A,okText:`提交入库`,children:(0,$.jsxs)(EH,{direction:`vertical`,style:{width:`100%`},size:14,children:[(0,$.jsx)(tG,{value:P,onChange:e=>F(e.target.value),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsx)(R0,{accept:`image/*,video/*`,maxCount:1,fileList:M,beforeUpload:()=>!1,onChange:({fileList:e})=>N(e),listType:`picture`,children:(0,$.jsx)(X,{icon:(0,$.jsx)(p5,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{padding:12,background:`#f8fafc`,borderRadius:12,color:`#64748b`,fontSize:13},children:[`当前开放图片和视频,音频暂不接入。视频素材必须在 `,i9,`~`,a9,` 秒内;提交后会调用火山 CreateAsset 异步处理,状态变为 Active 后才可用于 AI 创作。`]})]})}),(0,$.jsx)(NK,{title:`素材预览`,open:I,onCancel:()=>L(!1),footer:null,width:760,destroyOnClose:!0,children:(0,$.jsx)(`div`,{style:{minHeight:420,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#0f172a`,borderRadius:12,overflow:`hidden`},children:B===`Video`?(0,$.jsx)(`video`,{src:R,controls:!0,autoPlay:!0,style:{maxWidth:`100%`,maxHeight:520}}):(0,$.jsx)(`img`,{src:R,alt:`素材预览`,style:{maxWidth:`100%`,maxHeight:520,objectFit:`contain`}})})})]})},{Title:Soe,Text:Coe,Paragraph:woe}=Q,c9=e=>e===`aigc_virtual`?`aigc_virtual`:`real_person`,Toe=()=>{let[e,t]=On(),[n,r]=(0,S.useState)(()=>c9(e.get(`portraitTab`))),[i,a]=(0,S.useState)(null),[o,s]=(0,S.useState)([]),[c,l]=(0,S.useState)();(0,S.useEffect)(()=>{(async()=>{try{if(n===`aigc_virtual`){let[e,t]=await Promise.all([gae(),A7({page:1,pageSize:100,status:`active`})]);a(e);let n=t.items||[];s(n),l(e=>e&&n.some(t=>t.id===e)?e:n[0]?.id)}else{let[e,t]=await Promise.all([cae(),k7({pageSize:100,status:`active`})]);a(e);let n=t.items||[];s(n),l(e=>e&&n.some(t=>t.id===e)?e:n[0]?.id)}}catch(e){Z.error(e?.message||`加载数据失败`)}})()},[n]),(0,S.useMemo)(()=>o.find(e=>e.id===c)||null,[o,c]);let u=(0,S.useMemo)(()=>i?`已用 ${i.usedAssetCount||0} / ${i.assetLimit||0} 个素材,剩余 ${i.remainingAssetCount||0}`:`额度加载中`,[i]),d=(0,S.useMemo)(()=>[{key:`real_person`,label:`真人素材库`,children:(0,$.jsx)(moe,{})},{key:`aigc_virtual`,label:`虚拟素材库`,children:(0,$.jsx)(xoe,{})}],[]);return(0,$.jsx)(`div`,{children:(0,$.jsx)(IL,{activeKey:n,onChange:n=>{let i=c9(n);r(i);let a=new URLSearchParams(e);a.set(`filterType`,`private_portrait`),a.set(`portraitTab`,i),t(a,{replace:!0})},items:d,destroyInactiveTabPane:!1,tabBarExtraContent:(0,$.jsxs)(`div`,{style:{fontSize:14,fontWeight:700,color:`#4f46e5`,marginTop:8},children:[u,`。真人/虚拟共用,图片/视频共用;音频暂不开放。`]})})})},{Header:Eoe,Sider:Doe,Content:Ooe}=uG,{TextArea:koe}=tG,{Option:Aoe}=NC,{Text:l9}=Q,joe=()=>{let{message:e}=Jb.useApp(),t=Ke(),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(`1`),[o,s]=(0,S.useState)([]),{mediaType:c,countType:l,selectedRatio:u,selectedResolution:d,width:f,height:p,videoDuration:m,videoAspectRatio:h,videoResolution:g,engineOptions:_,enginesele:v,inputValue:y,setMediaType:b,setCountType:x,setSelectedRatio:C,setSelectedResolution:w,setWidth:T,setHeight:E,setVideoDuration:D,setVideoAspectRatio:O,setVideoResolution:k,setEngineOptions:A,setEnginesele:j,setInputValue:M,currentMedia:N,setCurrentMedia:P}=L7(),F=(c===`image`?v?.image:v?.video)?.find(e=>e.id===l),I=F?.maxImageCount??4,L=F?.maxVideoCount??1,[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(!1),[H,U]=(0,S.useState)(`universal`),[W,ee]=(0,S.useState)(null),[G,te]=(0,S.useState)(null),[ne,K]=(0,S.useState)(null),[re,ie]=(0,S.useState)(!1),[ae,q]=(0,S.useState)(!1),[oe,se]=(0,S.useState)(`real_person`),[ce,le]=(0,S.useState)(!1),ue=(0,S.useRef)(null),de=(0,S.useCallback)(()=>{ue.current&&=(window.clearTimeout(ue.current),null),le(!0)},[]),fe=(0,S.useCallback)(()=>{ue.current&&window.clearTimeout(ue.current),ue.current=window.setTimeout(()=>{le(!1),ue.current=null},260)},[]),[pe,me]=(0,S.useState)(!1),he=(0,S.useRef)(null),[ge,_e]=(0,S.useState)({top:0,left:0}),ve=e=>{let t=0,n=0,r=0;return e.map(e=>e.type===`image`?(t++,`图片${t}`):e.type===`video`?(n++,`视频${n}`):(r++,`音频${r}`))},[ye,be]=(0,S.useState)(!1),[xe,Se]=(0,S.useState)(``),[Ce,we]=(0,S.useState)(`image`),Te=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(ye&&Ce===`video`){let e=()=>{Te.current&&Te.current.play().catch(()=>{})};Te.current&&(Te.current.readyState>=2?e():Te.current.addEventListener(`loadedmetadata`,e));let t=setTimeout(e,300);return()=>{clearTimeout(t),Te.current&&(Te.current.removeEventListener(`loadedmetadata`,e),Te.current.pause())}}else Te.current&&Te.current.pause()},[ye,Ce]);let[Ee,De]=(0,S.useState)(new Set),Oe=e=>{if(!e)return null;try{let t=new URL(e).searchParams.get(`exp`);return t?parseInt(t,10):null}catch{try{let t=e.indexOf(`?`);if(t!==-1){let n=e.substring(t+1),r=new URLSearchParams(n).get(`exp`);if(r)return parseInt(r,10)}return null}catch{return null}}},ke=e=>{let t=Oe(e);return t?Math.floor(Date.now()/1e3)>t:!1},[Ae,je]=(0,S.useState)(!1),[Me,Ne]=(0,S.useState)(``),[Pe,Fe]=(0,S.useState)(`image`),[Ie,Le]=(0,S.useState)(``),Re=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(Ae&&Pe===`video`&&Re.current){let e=Re.current;e.currentTime=0,e.muted=!1;let t=e.play();t&&typeof t.catch==`function`&&t.catch(()=>{e.muted=!0,e.play().catch(()=>{})})}else if(!Ae&&Re.current){let e=Re.current;e.pause(),e.muted=!0,e.currentTime=0}},[Ae,Pe,Me]);let[ze,Be]=(0,S.useState)(null),[Ve,He]=(0,S.useState)(0),[Ue,We]=(0,S.useState)(!1),[Ge,qe]=(0,S.useState)(null),[Je,Ye]=(0,S.useState)({x:0,y:0}),[Xe,Ze]=(0,S.useState)(!1),[Qe,$e]=(0,S.useState)(!1),[et,tt]=(0,S.useState)([]),[nt,rt]=(0,S.useState)([]),[it,at]=(0,S.useState)({}),[ot,st]=(0,S.useState)(!1),[ct,lt]=(0,S.useState)(!1),[ut,dt]=(0,S.useState)([]),[ft,pt]=(0,S.useState)([]),[mt,ht]=(0,S.useState)([]),gt=()=>{let e={};if(e=mt.find(e=>e.modelConfigId===l&&e.genType===c&&e.resolution===(c===`video`?g:d)),e||(c===`video`?(e={perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},(g===`1080p`||g===`720p`||g===`480p`)&&(e.ratio=1.3)):(e={perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},(d===`2K`||d===`4K`||d===`1K`)&&(e.ratio=3))),c===`video`){let t=(m*e.perSecondCredits+e.baseCredits)*e.ratio,n=N.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n>0){let r=((e.inputVideoBaseCredits||0)+(e.inputVideoPerSecondCredits||0)*n)*(e.inputVideoRatio||1);t+=r}let r=N.filter(e=>e.type===`image`).length;if(r>0){let n=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*r)*(e.inputImageRatio||1);t+=n}return Number(t.toFixed(2))}else{let t=e.baseCredits*e.ratio,n=N.filter(e=>e.type===`image`).length;if(n>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n)*(e.inputImageRatio||1);t+=r}return Number(t.toFixed(2))}},_t=(0,S.useRef)(null),vt=(0,S.useRef)(null),yt=(0,S.useRef)(null);(0,S.useRef)(!0);let bt=(0,S.useRef)(!1),xt=(0,S.useRef)(0);o.find(e=>e.id===i);let[St,Ct]=(0,S.useState)([]),[wt,Tt]=(0,S.useState)({page:1,pageSize:20}),[Et,Dt]=(0,S.useState)(0),[Ot,kt]=(0,S.useState)(!1);(0,S.useEffect)(()=>{let e=t.state;e&&(e.generationPrompt&&M(e.generationPrompt),e.mediaReferences&&Array.isArray(e.mediaReferences)&&e.mediaReferences.length>0&&P(e.mediaReferences.map(e=>{let t=e.url||e.resourceUrl||e.previewUrl||``,n=t.startsWith(`http`)?t:`http://ceshi.apiforeign.minzhong.cn${t}`;return{...e,name:e.name||`参考${e.type}`,type:e.type===`video`?`video`:e.type===`audio`?`audio`:`image`,url:n,duration:e.duration||0,label:e.label||``}})),window.history.replaceState({},``,window.location.pathname))},[t.state]),(0,S.useEffect)(()=>()=>{ue.current&&window.clearTimeout(ue.current)},[]);let At=(0,S.useCallback)((e=`instant`)=>{let t=vt.current;t&&(xt.current=Date.now(),requestAnimationFrame(()=>{t.scrollTo({top:t.scrollHeight,behavior:e})}))},[]);(0,S.useEffect)(()=>{if(St.length>0&&!bt.current){let e=setTimeout(()=>{At(`smooth`),bt.current=!0},300);return()=>clearTimeout(e)}},[St.length,At]),(0,S.useEffect)(()=>{let e=c===`image`?v.image:v.video;e&&e.length>0&&(e.some(e=>e.id===l)||x(e[0].id))},[c,v]),(0,S.useEffect)(()=>{let e=e=>{let t=e.target;ct&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&<(!1),ot&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&st(!1),Xe&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ze(!1),Qe&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&$e(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[ct,ot,Xe,Qe]),(0,S.useEffect)(()=>{if(c!==`video`)return;let e=v?.video?.find(e=>e.id===l);if(!e)return;let t=e.supportsFirstLastFrame??!1,n=e.supportsUniversalReference??!0;U(e=>n?`universal`:e===`universal`&&!n&&t?`first_last_frame`:e)},[l,c,v]),(0,S.useEffect)(()=>{n7().then(e=>{if(j(e.engine),e.engine.video&&e.engine.video.length>0){let t=e.engine.video[0],n=e.engine.video.find(e=>e.id===l)||t;A({ratios:n.supportedRatios||[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:n.supportedResolutions||[`480p`,`720p`,`1080p`],durations:n.supportedDurations||[5,8,10,12,15]}),n.supportedRatios?.includes(h)||O(n.supportedRatios?.[0]||`16:9`),n.supportedResolutions?.includes(g)||k(n.supportedResolutions?.[0]||`720p`),n.supportedDurations?.includes(m)||D(n.supportedDurations?.[0]||5),l===`请选择`&&x(n.id)}if(e.engine.image&&e.engine.image.length>0){let t=e.engine.image.find(e=>e.id===l)||e.engine.image[0],n=t.supportedSizes||{},r=Object.keys(n).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),i=r[0]||`2K`,a=Object.keys(n[i]||{});if(tt(a.map(e=>({value:e,label:e}))),at(n),rt(r.map(e=>{let t=e.match(/(\d+)K/);return{value:e,label:`${{1:`标清`,2:`高清`,4:`超清`}[t?parseInt(t[1]):1]||`高清`} ${e}`}})),n[i]&&n[i][a[0]]){let[e,t]=n[i][a[0]].split(/[×x]/);T(Number(e)),E(Number(t)),C(a[0]),w(i)}l===`请选择`&&x(t.id)}}).catch(()=>{}),Tie().then(e=>{ht(e)}),r7(wt).then(e=>{let t=e.items,n=e.total;Ct(t),Dt(n)})},[]),(0,S.useEffect)(()=>{if(yt.current&&=(clearInterval(yt.current),null),St.some(e=>e.status===`generating`))return yt.current=window.setInterval(()=>{r7(wt).then(e=>{Ct(t=>t.map(t=>t.status===`generating`&&e.items.find(e=>e.id===t.id)||t)),Dt(e.total)}).catch(e=>{})},1e4),()=>{yt.current&&=(clearInterval(yt.current),null)}},[St,wt]),(0,S.useEffect)(()=>{if(!Xe)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ze(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[Xe]),(0,S.useEffect)(()=>{if(!Qe)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&$e(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[Qe]);let jt=e=>{let t=Object.keys(it).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),n=it[d]&&it[d][e]?d:t.find(t=>it[t]&&it[t][e])||t[0];if(n&&it[n]&&it[n][e]){let[t,r]=it[n][e].split(/[×x]/);T(Number(t)),E(Number(r)),C(e),w(n)}},Mt=e=>{it[e]||(e=Object.keys(it).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)})[0]||e);let t=it[e]?Object.keys(it[e]):[];tt(t.map(e=>({value:e,label:e})));let n=t.includes(u)?u:t[0]||``;if(n&&it[e]&&it[e][n]){let[t,r]=it[e][n].split(/[×x]/);T(Number(t)),E(Number(r)),C(n),w(e)}},Nt=()=>{T(p),E(f)},Pt=v?.video?.find(e=>e.id===l),Ft=Pt?.supportsFirstLastFrame??!1,It=Pt?.supportsUniversalReference??!0,Lt=e=>{e===`first_last_frame`&&!Ft||e===`universal`&&!It||(U(e),ie(!1),P([]),M(``))},Rt=()=>{let e=W;ee(G),te(e)},zt=()=>{ee(null),te(null)},Bt=()=>{te(null)},Vt=async()=>{let t=c===`video`&&H===`first_last_frame`;if(t){if(!y.trim()){e.warning(`请输入内容`);return}}else if(!y.trim()&&N.length===0){e.warning(`请输入内容或上传图片/视频`);return}let n;t?(n=[],W&&n.push({...W,role:`first_frame`}),G&&n.push({...G,role:`last_frame`}),n.length===0&&(n=void 0)):n=N.length>0?N.map(e=>{if(e.type===`image`){let{duration:t,...n}=e;return n}return e}):void 0,console.log(n);let r={id:``,gen_type:c,original_prompt:y.trim(),engine_id:l,idempotency_key:new Date().toLocaleString(`zh-CN`),media_references:n,...c===`image`&&{image_size:d,image_proportion:u,image_px:f+`x`+p},...c===`video`&&{duration:m,aspect_ratio:h,resolution:g}};V(!0),Sie(r).then(()=>{M(``),P([]),ee(null),te(null);let e={...wt,page:1};Tt(e),r7(e).then(e=>{Ct(t=>[...t,e.items[e.items.length-1]]),Dt(e.total),setTimeout(()=>{_t.current?.scrollIntoView({behavior:`smooth`})},100)}).catch(e=>{})}).catch(t=>{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),e.error({content:n,duration:3})}).finally(()=>{V(!1)}),setTimeout(()=>{V(!1)},3e3)},Ht=async()=>{if(St.length>=Et)return;let e=vt.current;if(!e)return;let t=e.scrollTop,n=e.scrollHeight;kt(!0);try{let r=wt.page+1,i=await r7({...wt,page:r}),a=Array.isArray(i)?{items:i,total:i.length}:i;a.total&&Dt(a.total),Tt(e=>({...e,page:r})),Ct(e=>{let t=new Set(e.map(e=>e.id));return[...a.items.filter(e=>!e.id||t.has(e.id)?!1:(t.add(e.id),!0)),...e]}),setTimeout(()=>{e.scrollTop=t+(e.scrollHeight-n)},200)}catch{}finally{kt(!1)}},Ut=e=>new Promise((t,n)=>{let r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{window.URL.revokeObjectURL(r.src),t(r.duration)},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法获取视频时长`))},r.src=URL.createObjectURL(e)}),Wt=e=>new Promise((t,n)=>{let r=document.createElement(`audio`);r.preload=`metadata`,r.onloadedmetadata=()=>{URL.revokeObjectURL(r.src),t(r.duration)},r.onerror=()=>{URL.revokeObjectURL(r.src),n(Error(`无法获取音频时长`))},r.src=URL.createObjectURL(e)}),Gt=e=>{let t=e.startsWith(`http`)?e:`http://ceshi.apiforeign.minzhong.cn${e}`;if(ze===t){let e=document.getElementById(`audio-player`);e&&e.pause(),Be(null)}else Be(t)},Kt=e=>new Promise((t,n)=>{let r=new Image;r.onload=()=>{window.URL.revokeObjectURL(r.src),t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法读取图片尺寸`))},r.src=URL.createObjectURL(e)}),qt=e=>new Promise((t,n)=>{let r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{window.URL.revokeObjectURL(r.src),t({width:r.videoWidth,height:r.videoHeight,duration:r.duration})},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法读取视频尺寸`))},r.src=URL.createObjectURL(e)}),Jt=(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},Yt=async(t,n)=>{let r=t.type.startsWith(`image/`),i=t.type.startsWith(`video/`);if(c===`video`&&H===`first_last_frame`){if(!r)return e.error(`首尾帧模式仅支持上传图片`),!1;if(t.size/1024/1024>10)return e.error(`图片大小不能超过10MB`),!1;try{let{width:n,height:r}=await Kt(t),i=Jt(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let i=n||ne;if(!i)return e.error(`请选择首帧或尾帧上传位置`),!1;z(!0);try{let n=await U5(t),r={name:t.name,type:`image`,url:n.url,role:i===`first`?`first_frame`:`last_frame`};i===`first`?ee(r):te(r),e.success(`图片上传成功`)}catch{e.error(`上传失败`)}finally{z(!1),K(null)}return!1}let a=t.type.startsWith(`audio/`);if(!r&&!i&&!a)return e.error(`仅支持图片、视频或音频文件`),!1;if(a){let n=t.name.split(`.`).pop()?.toLowerCase();if(![`wav`,`mp3`].includes(n||``))return e.error(`音频仅支持wav和mp3格式`),!1}if(c===`image`&&(i||a))return e.error(`图片模式仅支持上传图片`),!1;if(a&&c!==`video`)return e.error(`仅视频模式支持上传音频`),!1;let o=i?100:a?50:10,s=i?`视频`:a?`音频`:`图片`;if(t.size/1024/1024>o)return e.error(`${s}大小不能超过${o}MB`),!1;if(r)try{let{width:n,height:r}=await Kt(t),i=Jt(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let l=N.filter(e=>e.type===`image`).length;if(r&&l>=bn)return e.error(`该引擎最多上传${bn}张图片`),!1;let u=N.filter(e=>e.type===`video`).length;if(i&&u>=xn)return e.error(`该引擎最多上传${xn}个视频`),!1;let d=N.filter(e=>e.type===`audio`).length;if(a&&d>=Sn)return e.error(`该引擎最多上传${Sn}个音频`),!1;let f=0,p=0;if(i)try{if(f=await Ut(t),f<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=N.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n+f>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${(n+f).toFixed(1)} 秒`),!1;let{width:r,height:i}=await qt(t),a=Jt(r,i);if(a)return e.error(a),!1}catch{return e.error(`无法获取视频信息,请检查文件是否损坏`),!1}if(a)try{if(p=await Wt(t),p<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=N.filter(e=>e.type===`audio`).reduce((e,t)=>e+(t.duration||0),0);if(n+p>15)return e.error(`所有音频素材总时长不能超过 15 秒,当前 ${(n+p).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取音频信息,请检查文件是否损坏`),!1}z(!0);try{let e;e=r?await U5(t):a?await H5(t,p):await W5(t,f);let n=r?`image`:a?`audio`:`video`,o=[...N,{name:t.name,type:n,url:e.url,label:``,...i&&{duration:f},...a&&{duration:p}}],s=ve(o);P(o.map((e,t)=>({...e,label:s[t]})))}catch{e.error(`上传失败`)}finally{z(!1)}return!1},Xt=async t=>{let n=t.type.startsWith(`image/`),r=t.type.startsWith(`video/`),i=t.type.startsWith(`audio/`);if(!n&&!r&&!i)return e.error(`仅支持图片、视频或音频文件`),!1;let a=r?100:i?50:10;if(t.size/1024/1024>a)return e.error(`${r?`视频`:i?`音频`:`图片`}大小不能超过${a}MB`),!1;if(i){let n=t.name.split(`.`).pop()?.toLowerCase();if(![`wav`,`mp3`].includes(n||``))return e.error(`音频仅支持wav和mp3格式`),!1}if(n)try{let{width:n,height:r}=await Kt(t),i=Jt(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let o=0,s=0;if(r)try{if(o=await Ut(t),o<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=L7.getState().currentMedia.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n+o>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${(n+o).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取视频信息,请检查文件是否损坏`),!1}if(i)try{if(s=await Wt(t),s<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=L7.getState().currentMedia.filter(e=>e.type===`audio`).reduce((e,t)=>e+(t.duration||0),0);if(n+s>15)return e.error(`所有音频素材总时长不能超过 15 秒,当前 ${(n+s).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取音频信息,请检查文件是否损坏`),!1}let c=n?`image`:i?`audio`:`video`,l={name:t.name,type:c,url:``,label:``,...r&&{duration:o},...i&&{duration:s}},u=L7.getState().currentMedia;if(!$t(u,[l]))return!1;try{let e;return e=n?await U5(t):i?await H5(t,s):await W5(t,o),{name:l.name,type:l.type,url:e.url,label:l.label||``,...l.duration!==void 0&&{duration:l.duration}}}catch{return e.error(`上传失败`),!1}},Zt=async t=>{let n=0,r=0;z(!0);for(let e of t){let t=await Xt(e);if(t){let e=[...L7.getState().currentMedia,t],r=ve(e);P(e.map((e,t)=>({...e,label:r[t]}))),n++}else r++}z(!1),n>0&&e.success(`成功上传${n}个文件${r>0?`,${r}个文件上传失败`:``}`)},Qt=(e,t)=>e.filter(e=>e.type===t).reduce((e,t)=>e+(Number(t.duration)||0),0),$t=(t,n)=>{if(!n.length)return!1;if(c===`image`&&n.some(e=>e.type!==`image`))return e.error(`图片模式仅支持添加图片素材`),!1;if(n.some(e=>e.type===`audio`)&&c!==`video`)return e.error(`仅视频模式支持添加音频素材`),!1;let r=t.filter(e=>e.type===`image`).length,i=t.filter(e=>e.type===`video`).length,a=t.filter(e=>e.type===`audio`).length,o=n.filter(e=>e.type===`image`).length,s=n.filter(e=>e.type===`video`).length,l=n.filter(e=>e.type===`audio`).length;if(r+o>bn)return e.error(`该引擎最多上传${bn}张图片,当前还能添加 ${Math.max(0,bn-r)} 张`),!1;if(i+s>xn)return e.error(`该引擎最多上传${xn}个视频,当前还能添加 ${Math.max(0,xn-i)} 个`),!1;if(a+l>Sn)return e.error(`该引擎最多上传${Sn}个音频,当前还能添加 ${Math.max(0,Sn-a)} 个`),!1;for(let t of n){if(t.type!==`video`)continue;let n=Number(t.duration);if(!Number.isFinite(n)||n<=0)return e.error(`${t.name||`视频素材`}缺少视频秒数,不能用于 AI 创作`),!1;if(n<2)return e.error(`${t.name||`视频素材`}最短不能少于 2 秒`),!1;if(n>15)return e.error(`${t.name||`视频素材`}最长不能超过 15 秒`),!1}let u=Qt(t,`video`)+Qt(n,`video`);if(u>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${u.toFixed(1)} 秒`),!1;let d=Qt(t,`audio`)+Qt(n,`audio`);return d>15?(e.error(`所有音频素材总时长不能超过 15 秒,当前 ${d.toFixed(1)} 秒`),!1):!0},en=t=>{let n=t.mediaReference,r=n?.type||t.resourceType,i=n?.url||t.resourceUrl||t.displayUrl||t.previewUrl||``;if(!i)return e.error(`${t.fileName||t.id} 缺少素材地址,不能用于 AI 创作`),null;if(r===`audio`&&c!==`video`)return e.error(`仅视频模式支持添加音频素材`),null;let a=Number(n?.duration??t.durationSeconds);return{name:n?.name||t.fileName||t.id,type:r,url:i,source:`upload_resource`,upload_resource_id:t.id,label:``,...(r===`video`||r===`audio`)&&Number.isFinite(a)&&a>0?{duration:a}:{}}},tn=t=>{let n=t.map(en).filter(Boolean);if(!n.length)return;let r=L7.getState().currentMedia;if(!$t(r,n))return;let i=[...r,...n],a=ve(i);P(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个历史上传素材参考`)},nn=t=>{if(t.assetType===`Audio`)return e.error(`音频私域素材暂不支持用于 AI 创作`),null;let n=t.assetType===`Video`?`video`:`image`,r=oe===`aigc_virtual`?`虚拟素材`:`真人素材`,i=n===`video`?t.videoCoverUrl||t.previewUrl||t.displayUrl||t.providerUrl||``:t.previewUrl||t.displayUrl||t.videoCoverUrl||t.providerUrl||``;return{name:t.name||r,type:n,url:i,source:`private_portrait_asset`,private_asset_id:t.id,label:``,...n===`video`&&{duration:Number(t.videoDuration)||void 0}}},rn=e=>{se(e),q(!0)},an=t=>{let n=t.map(nn).filter(Boolean),r=L7.getState().currentMedia;if(!$t(r,n))return;let i=[...r,...n],a=ve(i);P(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个${oe===`aigc_virtual`?`虚拟`:`真人`}素材参考`)},on=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,sn=e=>{let t=N.filter((t,n)=>n!==e),n=ve(t);P(t.map((e,t)=>({...e,label:n[t]})))},cn=(e,t)=>{let n=e.selectionStart;return t.slice(0,n).match(/@([^@\s]*)$/)&&N.length>0?(me(!0),!0):(me(!1),!1)},ln=e=>{let t=e.target.value;M(t);let n=e.target;cn(n,t)},un=e=>{pe&&e.key===`Escape`&&me(!1)},dn=e=>{let t=he.current?.resizableTextArea?.textArea;if(!t)return;let n=t.selectionStart,r=y.slice(0,n),i=y.slice(n),a=r.lastIndexOf(`@`);if(a===-1){me(!1);return}M(r.slice(0,a)+`@${e} `+i),me(!1),setTimeout(()=>{let n=a+e.length+2;t.focus(),t.setSelectionRange(n,n)},0)},fn=()=>{be(!1),Se(``),Te.current&&Te.current.pause()},pn=e=>{if(e.preventDefault(),e.stopPropagation(),!xe)return;let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${xe}&download=1`,t.download=Ce===`image`?`image.png`:`video.mp4`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},mn=e=>{let t=String(e?.type||``).toLowerCase(),n=String(e?.url||e?.name||``).toLowerCase();return t.includes(`video`)||/\.(mp4|mov|avi|webm|m4v)(\?|$)/.test(n)?`video`:t.includes(`audio`)||/\.(mp3|wav|ogg|aac|m4a)(\?|$)/.test(n)?`audio`:`image`},hn=e=>e?/^https?:\/\//i.test(e)?e:`http://ceshi.apiforeign.minzhong.cn${e}`:``,gn=e=>{e?.url&&(Ne(e.url),Fe(mn(e)),Le(e.name||`附件`),je(!0))},_n=c===`video`&&H===`first_last_frame`,vn=!R&&(_n?!!(y.trim()||W):!!(y.trim()||N.length>0)),yn=c===`image`?`输入画面描述,或上传图片参考风格、构图、主体与光影。例:@图片1 参考色调,生成一张简洁高级的产品海报。`:_n?`首帧尾帧可以不传,如需传入建议描述首帧到尾帧的主体动作、镜头运动、节奏与转场。例:从首帧自然推进到尾帧,产品居中突出,动作平滑连贯。`:`上传最多12个参考素材,输入文字或 @ 引用参考内容,自由组合图、文、视频。例:@图片1 模仿 @视频1 的动作。`,bn=I,xn=L,Sn=F?.maxAudioCount??1;return(0,$.jsxs)(uG,{className:`ai-create-page`,style:{margin:`-24px -32px -32px`,borderRadius:22,height:`calc(100vh - 34px)`,background:`#fff`,overflow:`hidden`},children:[(0,$.jsx)(`audio`,{id:`audio-player`,src:ze||null,autoPlay:!0,onEnded:()=>Be(null),style:{display:`none`}}),!1,(0,$.jsxs)(uG,{style:{display:`flex`,flex:1,background:`#fff`},children:[(0,$.jsx)(`div`,{className:`animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`16px 24px`,borderRadius:22,background:`rgb(255, 255, 255)`,backdropFilter:`blur(22px)`,border:`1px solid rgba(231, 234, 240, 0.82)`,position:`relative`,overflow:`hidden`,flexWrap:`wrap`,gap:12},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(`div`,{style:{width:`15%`,height:1,background:`linear-gradient(90deg, transparent, rgba(117,106,136,0.18), rgba(232,227,236,0.48), transparent)`,borderRadius:1}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0,textAlign:`center`},children:[(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:700,color:`#8b5cf6`,letterSpacing:.4},children:`AI创作`}),(0,$.jsx)(`p`,{style:{fontSize:13,color:`#667085`,margin:`4px 0 0 0`},children:`输入想法、剧本或上传参考,智能生成视频/图片`})]}),(0,$.jsx)(`div`,{style:{width:`15%`,height:1,background:`linear-gradient(90deg, transparent, rgba(232,227,236,0.48), rgba(117,106,136,0.18), transparent)`,borderRadius:1}})]})}),(0,$.jsxs)(Ooe,{style:{flex:1,margin:0,padding:`20px 24px 22px`,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,overflow:`hidden`,minHeight:0},children:[St.length===0&&(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`},children:[(0,$.jsx)(`div`,{style:{width:80,height:80,borderRadius:50,background:`linear-gradient(135deg, #8b5cf6 0%, #ddd6fe 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,marginBottom:16},children:(0,$.jsx)(w8,{style:{fontSize:40,color:`#fff`}})}),(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:500,color:`#2f3440`},children:`你好,想创作什么?`}),(0,$.jsx)(`p`,{style:{margin:8,fontSize:13,color:`#98a2b3`},children:`输入想法、剧本或上传参考,开始你的创作之旅`})]}),St.length>0&&(0,$.jsxs)(`div`,{ref:vt,className:`ai-create-scroll`,style:{flex:1,overflowY:`auto`,paddingRight:10,paddingBottom:18,background:`#fff`},onScroll:e=>{let t=e.currentTarget;!(Date.now()-xt.current<500)&&bt.current&&t.scrollTop<=50&&!Ot&&St.length{let e=Z;return St.map(t=>(0,$.jsx)(`div`,{style:{width:`100%`,display:`flex`,justifyContent:`flex-start`,marginBottom:16},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:36,height:36,borderRadius:12,background:`linear-gradient(135deg, #8b5cf6 0%, #ddd6fe 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(w8,{style:{color:`#fff`,fontSize:16}})}),(0,$.jsx)(`div`,{style:{flex:1},children:(0,$.jsxs)(`div`,{style:{background:`rgba(255, 255, 255, 0.92)`,backdropFilter:`blur(18px)`,borderRadius:`22px`,padding:`14px 16px`,width:`70%`,minWidth:500,boxSizing:`border-box`,boxShadow:`0 18px 50px rgba(47, 52, 64, 0.075)`,position:`relative`,border:`1px solid rgba(231, 234, 240, 0.9)`},children:[(0,$.jsxs)(`div`,{style:{margin:4,fontSize:11,color:`#98a2b3`,textAlign:`left`,display:`flex`,flexWrap:`wrap`,gap:8,alignItems:`center`},children:[(0,$.jsx)(`span`,{children:t.createdAt?.replace(`T`,` `).split(`.`)[0]}),(0,$.jsx)(`span`,{style:{background:(t.genType,`rgba(139, 92, 246, 0.10)`),color:(t.genType,`#8b5cf6`),padding:`2px 8px`,borderRadius:12,fontWeight:500,fontSize:11,marginLeft:8},children:t.genType===`image`?`图片生成`:`视频生成`})]}),t.mediaReferences&&t.mediaReferences.length>0&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,zIndex:100},children:(0,$.jsx)(`span`,{style:{padding:`4px 12px`,borderRadius:16,color:`#8b5cf6`,cursor:`pointer`,fontWeight:500,border:`1px solid rgba(139, 92, 246, 0.2)`,background:`rgba(139, 92, 246, 0.04)`},onClick:e=>{e.stopPropagation();let n=e.currentTarget.getBoundingClientRect();Ye({x:n.left,y:n.top-10}),qe(t.id),We(!0)},children:`附件详情`})}),(0,$.jsxs)(`div`,{style:{position:`absolute`,bottom:8,right:8,zIndex:100,display:`flex`,gap:6},children:[(0,$.jsxs)(`button`,{onClick:n=>{if(n.stopPropagation(),M(t.originalPrompt||``),t.mediaReferences&&t.mediaReferences.length>0)if(t.mediaReferences.some(e=>e.role===`first_frame`||e.role===`last_frame`)&&t.genType===`video`){let e=t.mediaReferences.find(e=>e.role===`first_frame`),n=t.mediaReferences.find(e=>e.role===`last_frame`);ee(e?{...e,label:e.label||``}:null),te(n?{...n,label:n.label||``}:null),P([]),U(`first_last_frame`)}else P(t.mediaReferences.map(e=>({name:e.name,type:e.type,url:e.url,label:e.label||``,role:e.role}))),ee(null),te(null),U(`universal`);else P([]),ee(null),te(null);e.success(`已加载到编辑区`)},style:{height:28,padding:`0 10px`,borderRadius:10,border:`none`,background:`rgba(139, 92, 246, 0.08)`,color:`#8b5cf6`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`,gap:4,fontSize:12},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.15)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.08)`},children:[(0,$.jsx)(Uq,{style:{fontSize:12}}),`重新编辑`]}),(0,$.jsx)(LK,{title:`确定要删除吗?`,onConfirm:async()=>{try{await wie(t.id),e.success(`删除成功`),Ct(e=>e.filter(e=>e.id!==t.id)),Dt(e=>e-1)}catch(t){let n=t?.response?.data?.message||t?.message||`删除失败`;e.error(n)}},okText:`确定`,cancelText:`取消`,children:(0,$.jsxs)(`button`,{onClick:e=>e.stopPropagation(),style:{height:28,padding:`0 10px`,borderRadius:10,border:`none`,background:`rgba(139, 92, 246, 0.08)`,color:`#8b5cf6`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`,gap:4,fontSize:12},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(164, 91, 91, 0.1)`,e.currentTarget.style.color=`#A45B5B`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.08)`,e.currentTarget.style.color=`#8b5cf6`},children:[(0,$.jsx)(k$,{style:{fontSize:12}}),`删除`]})})]}),(t.status===`generating`||t.status===`failed`||t.status===`completed`)&&(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginBottom:16,marginTop:16,width:`100%`,alignItems:`flex-start`},children:[(0,$.jsx)(`div`,{style:{width:`50%`,overflow:`hidden`,borderRadius:12,position:`relative`,height:220,border:`1px solid #E7EAF0`,boxShadow:`0 4px 12px rgba(139, 92, 246, 0.08)`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #ffffff 0%, #FAFBFC 100%)`},children:t.status===`generating`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:12,left:12,display:`flex`,alignItems:`center`,gap:8,zIndex:2}}),(0,$.jsx)(`div`,{style:{position:`absolute`,inset:0,background:`linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%)`,animation:`shimmer 2s infinite`}}),(0,$.jsxs)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:16},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:`50%`,background:`rgba(139, 92, 246, 0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 0 30px rgba(139, 92, 246, 0.2)`},children:(0,$.jsx)(`div`,{style:{width:48,height:48,border:`3px solid #ddd6fe`,borderTopColor:`#8b5cf6`,borderRadius:`50%`,animation:`spin 1s linear infinite`}})}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`生成中...`})]})]}):t.status===`failed`?(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:`50%`,background:`rgba(168, 90, 106, 0.10)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(Ire,{style:{color:`#A45B5B`,fontSize:22}})}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#A45B5B`,fontWeight:620},children:`生成失败(积分已退)`}),t.errorMessage&&(0,$.jsx)(`span`,{style:{fontSize:13,color:`#A45B5B`,textAlign:`center`,padding:`0 8px`,lineHeight:1.5},children:t.errorMessage})]}):(0,$.jsx)($.Fragment,{children:t.genType===`image`?(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn/static${t.imageUrl}&w=300&p=50`,alt:t.name,style:{width:`100%`,height:`100%`,borderRadius:12,objectFit:`contain`,cursor:`pointer`,transition:`transform 0.3s ease`},onClick:()=>{Se(t.imageUrl),we(`image`),be(!0)},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.05)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn/static${t.videoCoverUrl}&w=300&p=50`,alt:t.name,style:{width:`100%`,height:`100%`,borderRadius:12,objectFit:`contain`,cursor:`pointer`,transition:`transform 0.3s ease`},onClick:()=>{Se(t.videoUrl),we(`video`),be(!0)},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.05)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:56,height:56,background:`rgba(47, 52, 64, 0.72)`,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`,boxShadow:`0 10px 24px rgba(47, 52, 64, 0.22)`},children:(0,$.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`#fff`,children:(0,$.jsx)(`path`,{d:`M8 5v14l11-7z`})})})]})})}),(0,$.jsxs)(`div`,{style:{width:`50%`,display:`flex`,flexDirection:`column`,gap:12},children:[(0,$.jsx)(`div`,{style:{background:`#FFFFFF`,borderRadius:12,padding:12,border:`1px solid #E7EAF0`,flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`p`,{style:{width:`100%`,height:150,overflow:`auto`,padding:0,marginTop:0,marginBottom:0,lineHeight:2,color:`#475467`,fontSize:13},children:t.originalPrompt})}),(0,$.jsxs)(`div`,{style:{fontSize:12,color:`#667085`,textAlign:`left`,display:`flex`,flexWrap:`wrap`,gap:12,alignItems:`center`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(`span`,{style:{borderRadius:16,color:`#8b5cf6`,fontWeight:500},children:t.engineSnapshot.name}),(0,$.jsx)(`span`,{style:{borderRadius:16,color:`#667085`},children:t.genType===`image`?`${t.imageProportion||``} · ${t.imagePx||``} · ${t.imageSize||``}`:`${t.duration||``}秒 · ${t.aspectRatio||``} · ${t.resolution||``}`}),(0,$.jsxs)(`span`,{style:{fontSize:14,borderRadius:16,color:`#8b5cf6`},children:[`消耗积分:`,t.creditsCost]})]})]})]})]})})]})},t.id))})(),(0,$.jsx)(`div`,{ref:_t})]}),Ue&&Ge&&(()=>{let e=St.find(e=>e.id===Ge)?.mediaReferences||[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`transparent`,zIndex:9998},onClick:()=>{We(!1),qe(null)}}),(0,$.jsxs)(`div`,{className:`ai-reference-expanded-tray ai-attachment-popover`,style:{position:`fixed`,top:`max(84px, ${Je.y-96}px)`,left:`max(24px, min(${Je.x-250}px, calc(100vw - 456px)))`,width:424,padding:`12px 12px 10px`,borderRadius:18,background:`rgba(255,255,255,0.98)`,border:`1px solid #E7EAF0`,boxShadow:`0 24px 60px rgba(31, 41, 55, 0.12)`,backdropFilter:`blur(18px)`,zIndex:9999,pointerEvents:`auto`},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:10},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:[(0,$.jsx)(`span`,{style:{fontSize:13,color:`#344054`,fontWeight:800},children:`参考附件`}),(0,$.jsx)(`span`,{style:{fontSize:11,color:`#98A2B3`,fontWeight:600},children:`点击素材查看,或直接下载原文件`})]}),(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:(0,$.jsx)(`button`,{onClick:()=>{We(!1),qe(null)},style:{width:26,height:26,borderRadius:`50%`,border:`1px solid transparent`,background:`#F6F7FA`,cursor:`pointer`,color:`#98a2b3`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#EEF1F6`,e.currentTarget.style.color=`#2f3440`},onMouseLeave:e=>{e.currentTarget.style.background=`#F6F7FA`,e.currentTarget.style.color=`#98a2b3`},children:(0,$.jsx)(ju,{style:{fontSize:12}})})})]}),(0,$.jsx)(`div`,{className:`ai-reference-tray-scroll`,style:{display:`flex`,gap:10,overflowX:`auto`,padding:`2px 2px 4px`},children:e.map((e,t)=>{let n=mn(e),r=e.label||(e.role===`first_frame`?`首帧`:e.role===`last_frame`?`尾帧`:`${n===`image`?`图片`:n===`video`?`视频`:`音频`}${t+1}`);return(0,$.jsxs)(`div`,{style:{flex:`0 0 92px`,width:92,borderRadius:16,background:`#FFFFFF`,border:`1px solid #E7EAF0`,boxShadow:`0 8px 18px rgba(31, 41, 55, 0.06)`,padding:7,boxSizing:`border-box`},children:[(0,$.jsx)(`div`,{onClick:t=>{n===`audio`?(t.stopPropagation(),Gt(e.url)):(gn(e),We(!1),qe(null))},style:{position:`relative`,width:`100%`,height:70,borderRadius:12,overflow:`hidden`,cursor:`pointer`,background:`#F7F8FA`,border:`1px solid rgba(231, 234, 240, 0.9)`},children:n===`image`?(0,$.jsx)(`img`,{src:hn(e.url),alt:e.name||r,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):n===`video`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:hn(e.url),muted:!0,playsInline:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(31, 41, 55, 0.08)`},children:(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:`50%`,background:`rgba(47, 52, 64, 0.72)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 8px 18px rgba(31, 41, 55, 0.22)`},children:(0,$.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`#fff`,children:(0,$.jsx)(`path`,{d:`M8 5v14l11-7z`})})})})]}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`},children:ze===(e.url.startsWith(`http`)?e.url:`http://ceshi.apiforeign.minzhong.cn${e.url}`)?(0,$.jsx)(G6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(J2,{style:{fontSize:24,color:`#fff`}})})}),(0,$.jsx)(`div`,{title:e.name||r,style:{marginTop:6,color:`#667085`,fontSize:10,fontWeight:700,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,textAlign:`center`},children:e.name||r}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:5,marginTop:7},children:(0,$.jsx)(`button`,{onClick:()=>{gn(e),We(!1),qe(null)},style:{flex:1,height:24,borderRadius:9,border:`1px solid #E7EAF0`,background:`#F8FAFC`,color:`#8b5cf6`,fontSize:11,fontWeight:700,cursor:`pointer`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#EEF1F6`},onMouseLeave:e=>{e.currentTarget.style.background=`#F8FAFC`},children:`查看`})})]},`${e.url||e.name||t}-${t}`)})})]})]})})(),(0,$.jsxs)(`div`,{style:{position:`relative`,background:`#ffffff`,borderRadius:24,padding:`18px 72px 16px 20px`,boxShadow:`0 22px 64px rgba(31, 41, 55, 0.08), 0 1px 0 rgba(255,255,255,0.98) inset`,transition:`all 0.25s ease`,border:`1px solid rgba(231, 234, 240, 0.78)`,backdropFilter:`blur(24px)`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,gap:18,alignItems:`flex-end`,marginBottom:14},children:[(0,$.jsx)(`div`,{style:{width:_n?220:70,minWidth:_n?220:70,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`flex-start`,paddingTop:2,gap:8},children:c===`video`&&H===`first_last_frame`?(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`stretch`,gap:12,width:`100%`,height:100},children:[(0,$.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,height:100,borderRadius:12,border:`1px solid #E7EAF0`,background:`#ffffff`,boxShadow:`0 6px 16px rgba(47, 52, 64, 0.04)`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,left:10,right:10,display:`flex`,alignItems:`center`,justifyContent:`space-between`,zIndex:2},children:(0,$.jsx)(`span`,{style:{fontSize:11,fontWeight:600,color:`#8b5cf6`,lineHeight:1},children:`首帧(可选)`})}),W?(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64},children:[(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${W.url}`,alt:W.name,onClick:()=>{Ne(W.url),Fe(`image`),Le(W.name),je(!0)},style:{width:`100%`,height:`100%`,objectFit:`cover`,borderRadius:8,cursor:`pointer`,border:`1px solid rgba(139, 92, 246, 0.2)`,boxShadow:`0 3px 10px rgba(47, 52, 64, 0.06)`}}),(0,$.jsx)(`button`,{onClick:zt,style:{position:`absolute`,top:-6,right:-6,width:18,height:18,border:`none`,background:`#A45B5B`,borderRadius:50,cursor:`pointer`,color:`#fff`,fontSize:9,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 4px rgba(164, 91, 91, 0.3)`,zIndex:10},children:(0,$.jsx)(k$,{style:{fontSize:9}})})]}):(0,$.jsx)(G7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&Yt(e[0],`first`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];ee({name:n.fileName||``,type:`image`,url:n.resourceUrl||n.previewUrl||n.displayUrl||``,role:`first_frame`,label:``}),e.success(`成功添加首帧`)}},onPortraitSelect:t=>{if(t.length>0){let n=t[0],r=n.previewUrl||n.displayUrl||n.videoCoverUrl||n.providerUrl||``;ee({name:n.name||`首帧图片`,type:`image`,url:r,role:`first_frame`,label:``}),e.success(`成功添加首帧`)}},uploading:R,children:(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(139, 92, 246, 0.28)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,backgroundColor:`rgba(139, 92, 246, 0.04)`,flexDirection:`column`,gap:4},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#a78bfa`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(139, 92, 246, 0.28)`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.04)`},children:[(0,$.jsx)(mL,{style:{fontSize:18,color:`#8b5cf6`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`上传首帧`})]})})]}),(0,$.jsx)(`button`,{onClick:Rt,disabled:!W||!G,title:`调换首尾帧`,style:{width:32,height:32,alignSelf:`center`,borderRadius:50,border:`1px solid rgba(231, 234, 240, 0.95)`,background:W&&G?`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`:`#F3F5F8`,cursor:W&&G?`pointer`:`not-allowed`,color:W&&G?`#fff`:`#98A2B3`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:W&&G?`0 6px 14px rgba(139, 92, 246, 0.24)`:`none`,transition:`all 0.2s ease`,flexShrink:0},onMouseEnter:e=>{W&&G&&(e.currentTarget.style.transform=`scale(1.06)`)},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:(0,$.jsx)(aW,{style:{fontSize:14}})}),(0,$.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,height:100,borderRadius:12,border:`1px solid #E7EAF0`,background:`#ffffff`,boxShadow:`0 6px 16px rgba(47, 52, 64, 0.04)`,overflow:`hidden`,opacity:W?1:.5},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,left:10,right:10,display:`flex`,alignItems:`center`,justifyContent:`space-between`,zIndex:2},children:(0,$.jsx)(`span`,{style:{fontSize:11,fontWeight:600,color:`#8b5cf6`,lineHeight:1},children:`尾帧`})}),G?(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64},children:[(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${G.url}`,alt:G.name,onClick:()=>{Ne(G.url),Fe(`image`),Le(G.name),je(!0)},style:{width:`100%`,height:`100%`,objectFit:`cover`,borderRadius:8,cursor:`pointer`,border:`1px solid rgba(139, 92, 246, 0.2)`,boxShadow:`0 3px 10px rgba(47, 52, 64, 0.06)`}}),(0,$.jsx)(`button`,{onClick:Bt,style:{position:`absolute`,top:-6,right:-6,width:18,height:18,border:`none`,background:`#A45B5B`,borderRadius:50,cursor:`pointer`,color:`#fff`,fontSize:9,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 4px rgba(164, 91, 91, 0.3)`,zIndex:10},children:(0,$.jsx)(k$,{style:{fontSize:9}})})]}):W?(0,$.jsx)(G7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&Yt(e[0],`last`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];te({name:n.fileName||``,type:`image`,url:n.resourceUrl||n.previewUrl||n.displayUrl||``,role:`last_frame`,label:``}),e.success(`成功添加尾帧`)}},onPortraitSelect:t=>{if(t.length>0){let n=t[0],r=n.previewUrl||n.displayUrl||n.videoCoverUrl||n.providerUrl||``;te({name:n.name||`尾帧图片`,type:`image`,url:r,role:`last_frame`,label:``}),e.success(`成功添加尾帧`)}},uploading:R,children:(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(139, 92, 246, 0.24)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,backgroundColor:`rgba(139, 92, 246, 0.04)`,flexDirection:`column`,gap:4},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#a78bfa`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(139, 92, 246, 0.24)`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.04)`},children:[(0,$.jsx)(mL,{style:{fontSize:18,color:`#8b5cf6`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`上传尾帧`})]})}):(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(226, 232, 240, 0.4)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`not-allowed`,backgroundColor:`rgba(241, 245, 249, 0.5)`,flexDirection:`column`,gap:4},children:[(0,$.jsx)(mL,{style:{fontSize:18,color:`#cbd5e1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#94a3b8`,fontWeight:500},children:`请先上传首帧`})]})]})]}):(0,$.jsx)($.Fragment,{children:!(c===`video`&&H===`first_last_frame`)&&(0,$.jsxs)(`div`,{style:{position:`relative`,width:64,height:72,marginTop:`-10`},onMouseEnter:de,onMouseLeave:fe,children:[N.length===0&&(0,$.jsx)(G7,{accept:c===`image`?`image/*`:`image/*,video/*,audio/*`,onLocalSelect:Zt,onHistorySelect:tn,onPortraitLibrarySelect:e=>{rn(e)},uploading:R,tooltipTitle:c===`image`?`图片${N.filter(e=>e.type===`image`).length}/${I}`:`图片${N.filter(e=>e.type===`image`).length}/${I},
+`)){z(!0),V(e);return}}z(!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 Le(e)}))},rows:3,placeholder:`上传参考素材、输入文字,自由组合图、文多元素。输入 @ 可引用参考内容...`,maxLength:500,bordered:!1,autoSize:{minRows:2,maxRows:6},style:{padding:`6px 2px`,fontSize:15,lineHeight:1.7,resize:`none`,caretColor:`#6366f1`}})}),R&&M.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:M.filter(e=>!B||e.name.includes(B)).map((e,t)=>(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 r=H.current?.resizableTextArea?.textArea||H.current?.nativeElement?.querySelector(`textarea`)||H.current;if(!r||!r.value)return;let i=r.value,a=i.lastIndexOf(`@`),o=i.slice(0,a)+`@${e.name} `;L(o),n.setFieldValue(`prompt`,o),z(!1),setTimeout(()=>{r.focus(),r.selectionStart=o.length,r.selectionEnd=o.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:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(l8,{style:{color:`#fff`,fontSize:14}})}),(0,$.jsx)(Q.Text,{style:{fontSize:13},children:e.name}),(0,$.jsx)(h$,{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:[xe!==`image`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,flexWrap:`wrap`},children:[(0,$.jsx)(Pt,{label:`时长`,value:`${se}`,options:he.durations.map(e=>`${e}`),suffix:`秒`,expanded:pe===`duration`,onToggle:()=>me(pe===`duration`?null:`duration`),onSelect:e=>ce(parseInt(e)),onClose:()=>me(null)}),gt.map((e,t)=>{let n=K===e.name,r=te[e.name];return(0,$.jsx)(Ft,{group:e,selected:r,expanded:n,onToggle:()=>re(n?null:e.name),onSelect:t=>{ne(n=>{let r={...n};return r[e.name]===t?delete r[e.name]:r[e.name]=t,r})},onClose:()=>re(null)},`og-${t}`)})]}),xe==`image`&&(0,$.jsxs)(`div`,{style:{position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>Me(!je),className:`image-settings-trigger`,style:{minWidth:220,padding:`0px 16px`,height:30,borderRadius:10,border:`1px solid #e2e8f0`,backgroundColor:`#f8f9fc`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:(0,$.jsxs)(`div`,{style:{textAlign:`left`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,fontWeight:600,color:`#374151`,marginRight:10},children:Ce===`auto`?`智能`:Ce}),(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#9ca3af`},children:[Te==`2K`?`高清 2K`:`超清 4K`,`| `,De,`×`,ke]})]})}),(0,$.jsx)(mQ,{style:{fontSize:14,color:`#9ca3af`}})]}),je&&(0,$.jsxs)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:0,width:520,backgroundColor:`#fff`,borderRadius:16,boxShadow:`0 10px 40px rgba(0,0,0,0.15)`,padding:20,border:`none`,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:He.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{we(e.value),Be(e.label)},style:{flex:`0 0 calc(11.11% - 5px)`,minWidth:48,height:56,borderRadius:8,border:Ce===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Ce===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 ${Ce===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:Ce===e.value?`#6366f1`:`#9ca3af`},children:`智`})}),(0,$.jsx)(`span`,{style:{fontSize:10,color:Ce===e.value?`#6366f1`:`#6b7280`,fontWeight:Ce===e.value?600:400},children:e.value})]},e.value))})]}),(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:8},children:We.map(e=>(0,$.jsx)(`button`,{onClick:()=>{Ee(e.value),Ve(e.label)},style:{flex:1,height:48,borderRadius:8,border:Te===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Te===e.value?`#6366f1`:`#f9fafb`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:(0,$.jsxs)(`span`,{style:{fontSize:13,fontWeight:600,color:Te===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:10,fontSize:13,fontWeight:500,color:`#666666`},children:`尺寸`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},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)(tG,{value:De,onChange:e=>Oe(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:6,height:40,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:14,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`button`,{onClick:et,style:{width:28,height:28,borderRadius:6,border:`1px solid #e5e7eb`,backgroundColor:`#fff`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,color:`#6366f1`},children:(0,$.jsx)(aW,{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)(tG,{value:ke,onChange:e=>Ae(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:6,height:40,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:14,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:12},children:`PX`})]})]})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0},children:[xe===`image`&&(0,$.jsx)(`span`,{style:{color:`#7c7c7c`,fontSize:14},children:`(请在左侧选择图片比例和尺寸)`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:xt,loading:d,style:{borderRadius:10,fontWeight:600,minWidth:140,height:40,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 4px 16px rgba(99,102,241,0.35)`},children:`AI优化提示词`})]})]})]})]})]}),p&&h&&(0,$.jsxs)(RL,{className:`animate-fadeInUp`,style:{borderRadius:16},styles:{body:{padding:`24px 28px`}},children:[!w[h.id]||w[h.id]===`idle`?(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,marginBottom:24,padding:`14px 18px`,borderRadius:12,background:`linear-gradient(135deg, rgba(16,185,129,0.06), rgba(5,150,105,0.06))`,border:`1px solid rgba(16,185,129,0.15)`},children:[(0,$.jsx)(A4,{style:{color:`#10b981`,fontSize:22}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,display:`block`},children:`提示词优化完成`}),(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`文本优化消耗 `,_e,` 积分· 您可以编辑提示词后选择参数生成视频`]})]})]}):(0,$.jsxs)(`div`,{style:{marginBottom:24,padding:`16px 18px`,borderRadius:12,display:`flex`,alignItems:`center`,gap:12,background:w[h.id]===`failed`?`rgba(239,68,68,0.04)`:w[h.id]===`done`?`rgba(16,185,129,0.04)`:`rgba(99,102,241,0.04)`,border:`1px solid ${w[h.id]===`failed`?`rgba(239,68,68,0.12)`:w[h.id]===`done`?`rgba(16,185,129,0.12)`:`rgba(99,102,241,0.12)`}`},children:[w[h.id]===`generating`&&(0,$.jsx)(Xm,{style:{color:`#6366f1`,fontSize:18},spin:!0}),w[h.id]===`done`&&(0,$.jsx)(A4,{style:{color:`#10b981`,fontSize:18}}),w[h.id]===`failed`&&(0,$.jsx)(N4,{style:{color:`#ef4444`,fontSize:18}}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14,color:w[h.id]===`failed`?`#ef4444`:w[h.id]===`done`?`#10b981`:`#6366f1`},children:[w[h.id]===`generating`&&`${xe===`image`?`图片`:`视频`}生成中,请稍候...`,w[h.id]===`done`&&`${xe===`image`?`图片`:`视频`}生成成功`,w[h.id]===`failed`&&`${xe===`image`?`图片`:`视频`}生成失败,请重试`]})]}),!w[h.id]||w[h.id]===`idle`||w[h.id]===`failed`?(0,$.jsxs)(`div`,{className:`gen-prompt-row`,style:{display:`flex`,gap:20,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{flex:`1 1 45%`,minWidth:240},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:100},children:(0,$.jsx)(Q.Text,{style:{fontSize:14,color:`#64748b`,lineHeight:1.7},children:h.originalPrompt})})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 45%`,minWidth:240},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:[`优化后的提示词`,` `,!y&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!y&&(0,$.jsxs)(EH,{size:4,children:[(0,$.jsx)(Cw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(b1,{}),onClick:()=>{navigator.clipboard.writeText(_),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(Cw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(Z$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(tG.TextArea,{value:_,onChange:e=>v(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:()=>{v(h.optimizedPrompt||``),b(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{b(!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:_})})]})]}):(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:h.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:[`优化后的提示词`,` `,!y&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!y&&(0,$.jsxs)(EH,{size:4,children:[(0,$.jsx)(Cw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(b1,{}),onClick:()=>{navigator.clipboard.writeText(_),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(Cw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(Z$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(tG.TextArea,{value:_,onChange:e=>v(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:()=>{v(h.optimizedPrompt||``),b(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{b(!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:_})})]})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 40%`,minWidth:280},children:[h.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:`http://ceshi.apiforeign.minzhong.cn${h.videoUrl}`,controls:!0,style:{width:`100%`,maxHeight:350,display:`block`}})})]}),h.imageUrl&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`生成图片`}),(0,$.jsx)(bW,{src:`http://ceshi.apiforeign.minzhong.cn${h.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`,marginTop:20,padding:`14px 18px`,borderRadius:12,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:[xe!==`image`&&(0,$.jsxs)(`div`,{style:{marginTop:24,borderRadius:12,background:`#f8f9fc`,width:`25%`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#1a1a2e`,fontWeight:600,display:`block`,marginBottom:12},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:[se,`s`]})]}),(0,$.jsx)(Pt,{label:`比例`,value:le,options:he.ratios,expanded:pe===`ratio`,onToggle:()=>me(pe===`ratio`?null:`ratio`),onSelect:e=>ue(e),onClose:()=>me(null)}),(0,$.jsx)(Pt,{label:`分辨率`,value:de,options:he.resolutions,expanded:pe===`resolution`,onToggle:()=>me(pe===`resolution`?null:`resolution`),onSelect:e=>fe(e),onClose:()=>me(null)})]})]}),xe==`image`&&h&&(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:h.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:h.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:h.imagePx||`-`})]})]})}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`文字积分`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#6366f1`},children:_e})]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:18},children:`+`}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:[`预估`,xe===`image`?`图片`:`视频`,`积分`]}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#10b981`},children:xe===`image`&&h.imageSize?vt(h.imageSize)||yt:Re(se,de)})]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:18},children:`=`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`总计`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16,color:`#1a1a2e`},children:(_e+(xe===`image`?vt(h.imageSize):Re(se,de))).toFixed(2)})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[(0,$.jsxs)(X,{size:`large`,onClick:()=>{m(!1),g(null),v(``),L(``),N([]),ne({}),re(null),me(null),n.resetFields()},style:{borderRadius:12,minWidth:120,height:44,fontWeight:500},children:[`配置新`,xe===`image`?`图片`:`视频`]}),(0,$.jsx)(Cw,{title:bt?``:`积分不足`,children:(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(D8,{}),onClick:()=>At(h.id),loading:w[h.id]===`generating`,disabled:!bt||w[h.id]===`generating`||w[h.id]===`done`,style:{borderRadius:12,minWidth:180,height:44,fontWeight:600,background:w[h.id]===`done`?`#10b981`:bt?`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`:`#d1d5db`,border:`none`,boxShadow:bt?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:w[h.id]===`done`?`生成完成`:w[h.id]===`generating`?`生成中...`:`生成${xe===`image`?`图片`:`视频`} (${xe===`image`?vt(h.imageSize):Re(se,de)}积分)`})})]})]}),h.references&&h.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:h.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`&&oe(`http://ceshi.apiforeign.minzhong.cn${e.url}`)},children:[e.type===`image`?(0,$.jsx)(bW,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(K7,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,width:64,height:64}),(0,$.jsx)(h$,{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))})]})]}),mt.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:mt.map((e,t)=>{let n=Mt(e),r=E[e.id]??(e.optimizedPrompt||e.originalPrompt),i=A===e.id,a=e.genType||`image`;return(0,$.jsxs)(`div`,{className:`animate-slideInCard`,style:{animationDelay:`${t*.05}s`},children:[(0,$.jsxs)(`div`,{className:`record-item`,onClick:()=>j(i?null:e.id),style:{padding:`12px 16px`,borderRadius:i?`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:a===`image`?`#fef3c7`:`#dbeafe`},children:a===`image`?(0,$.jsx)(e8,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(v5,{style:{color:`#2563eb`,fontSize:12}})}),i?(0,$.jsx)(mQ,{style:{color:`#6366f1`,fontSize:11,flexShrink:0}}):(0,$.jsx)(D4,{style:{color:`#cbd5e1`,fontSize:11,flexShrink:0}}),(0,$.jsx)(h$,{color:Nt[n]?.color,icon:Nt[n]?.icon,style:{margin:0},children:Nt[n]?.text}),(0,$.jsx)(Q.Text,{style:{flex:1,fontSize:13,color:`#475569`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),n===`prompt_optimized`&&(0,$.jsx)(h$,{color:`processing`,style:{padding:`3px 10px`,fontSize:12,margin:0,flexShrink:0},children:`待配置`}),a===`image`?(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.duration?`${e.imageSize}`:`-`,` ·`,` `,e.imageProportion||`-`,` ·`,` `,e.imagePx||`-`,` ·`,` `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:R7(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:R7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(EH,{children:n===`failed`&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(l8,{}),loading:x[e.id],onClick:()=>jt(e.id),style:{borderRadius:8},children:`重试`})})})]}),i&&(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:[`优化后的提示词`,` `,(n===`prompt_optimized`||n===`failed`)&&O!==e.id&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),O!==e.id&&(0,$.jsxs)(EH,{size:4,children:[(0,$.jsx)(Cw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(b1,{}),onClick:()=>{navigator.clipboard.writeText(r),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(n===`prompt_optimized`||n===`failed`)&&(0,$.jsx)(Cw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(Z$,{}),onClick:()=>{k(e.id),D(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt??``}))},style:{color:`#6366f1`}})})]})]}),O===e.id?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(tG.TextArea,{value:r,onChange:t=>D(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:()=>k(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{D(t=>({...t,[e.id]:r})),k(null),Z.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:n===`prompt_optimized`?`rgba(99,102,241,0.02)`:`#f8f9fc`,border:n===`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:r})})]}),a===`image`?(0,$.jsx)(`div`,{style:{display:`flex`,gap:14,padding:`10px 14px`,borderRadius:10,background:`#f8f9fc`},children:[{label:`文字积分`,value:`${e.textCreditsCost||0}`},{label:`图片积分`,value:`${e.creditsCost||0}`},{label:`分辨率`,value:e.imageSize?`${e.imageSize}`:`-`},{label:`比例`,value:e.imageProportion||`-`},{label:`尺寸`,value:e.imagePx||`-`}].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:13,color:`#1a1a2e`},children:e.value})]},t))}):(0,$.jsx)(`div`,{style:{display:`flex`,gap:14,padding:`10px 14px`,borderRadius:10,background:`#f8f9fc`},children:[{label:`文字积分`,value:`${e.textCreditsCost||0}`},{label:`视频积分`,value:`${e.creditsCost||0}`},{label:`时长`,value:e.duration?`${e.duration}秒`:`-`},{label:`比例`,value:e.aspectRatio||`-`},{label:`分辨率`,value:e.resolution||`-`}].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:13,color:`#1a1a2e`},children:e.value})]},t))}),(e.references&&e.references.length>0||n===`failed`)&&(0,$.jsxs)(`div`,{style:{marginTop:14},children:[(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:[`参考素材`,` `,n===`failed`&&(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`&&oe(`http://ceshi.apiforeign.minzhong.cn${t.url}`)},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:10,overflow:`hidden`},children:t.type===`image`?(0,$.jsx)(bW,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(K7,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,width:64,height:64})}),(0,$.jsx)(h$,{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===`failed`&&(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),K5(t.url).catch(()=>{});let i=e.references.filter((e,t)=>t!==r);L7.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)(N4,{style:{color:`#fff`,fontSize:10}})})]},r)),n===`failed`&&(0,$.jsx)(R0,{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?U5(t).then(n=>{let r={url:n.url,type:`image`,name:t.name||`图片`},i=e.references||[];L7.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=>{W5(t,n).then(r=>{let i={url:r.url,type:`video`,name:t.name||`视频`,duration:n||void 0},a=e.references||[];L7.getState().updateRecordReferences(e.id,[...a,i]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`))}),!1)},children:(0,$.jsx)(Cw,{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)(mL,{style:{fontSize:18,color:`#94a3b8`}})})})})]})]})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 40%`,minWidth:220,position:`relative`},children:[n===`prompt_optimized`&&(0,$.jsxs)(`div`,{style:{marginTop:16,position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,backgroundColor:`transparent`},children:[a===`video`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`,marginBottom:12},children:[(0,$.jsxs)(`div`,{translate:`no`,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,marginLeft:12},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:[e.duration,`秒`]})]}),(0,$.jsx)(Pt,{label:`比例`,value:ie[e.id]?.aspectRatio||`选择比例`,options:he.ratios,expanded:pe===`ratio-${e.id}`,onToggle:()=>me(pe===`ratio-${e.id}`?null:`ratio-${e.id}`),onSelect:t=>ae(n=>({...n,[e.id]:{...n[e.id],aspectRatio:t,resolution:n[e.id]?.resolution||``}})),onClose:()=>me(null)}),(0,$.jsx)(Pt,{label:`分辨率`,value:ie[e.id]?.resolution||`选择分辨率`,options:he.resolutions,expanded:pe===`res-${e.id}`,onToggle:()=>me(pe===`res-${e.id}`?null:`res-${e.id}`),onSelect:t=>ae(n=>({...n,[e.id]:{...n[e.id],aspectRatio:n[e.id]?.aspectRatio||``,resolution:t}})),onClose:()=>me(null)})]}),(0,$.jsxs)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(D8,{}),block:!0,loading:x[e.id],disabled:a===`video`&&(!ie[e.id]?.aspectRatio||!ie[e.id]?.resolution),onClick:async()=>{let t=ie[e.id];if(a===`video`){if(!t?.aspectRatio||!t?.resolution){Z.error(`请选择比例和分辨率`);return}if(_t({...t,[e.id]:!0})),T(t=>({...t,[e.id]:`generating`}));let n=a===`video`?`视频`:`图片`;Z.loading({content:`「${ht}」正在生成${n}...`,duration:0,key:e.id});try{await c(e.id,{aspectRatio:t?.aspectRatio,resolution:t?.resolution}),T(t=>({...t,[e.id]:`done`})),Z.success({content:`「${ht}」${n}生成成功!`,key:e.id,duration:3})}catch{T(t=>({...t,[e.id]:`failed`})),Z.error({content:`「${ht}」${n}生成失败`,key:e.id,duration:3})}finally{C(t=>({...t,[e.id]:!1}))}},style:{borderRadius:12,fontWeight:600,color:`#fff`,height:48,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,position:`absolute`,bottom:18,left:0},children:[`生成`,a===`video`?`视频`:`图片`,a===`video`?(0,$.jsx)(`span`,{style:{color:`#d2d2d2`,fontSize:`14px`,marginLeft:`6px`},children:`(请选择上方的比例分辨率)`}):``,` `,a===`video`&&ie[e.id]?.resolution?`(${Re(e.duration||5,ie[e.id].resolution)}积分)`:``,a===`image`&&e.imageSize?`(${ze(e.imageSize)}积分)`:a===`image`?`(积分)`:``]})]}),n===`failed`&&(0,$.jsx)(`div`,{style:{position:`absolute`,bottom:18,right:20},children:(0,$.jsxs)(X,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(l8,{}),block:!0,loading:x[e.id],onClick:()=>jt(e.id),style:{borderRadius:12,fontWeight:600,height:48},children:[`重新生成`,a===`video`?`视频`:`图片`]})}),n===`generating`?(0,$.jsxs)(`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,$.jsx)(Xm,{style:{color:`#6366f1`,fontSize:28},spin:!0}),(0,$.jsxs)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:[a===`video`?`视频`:`图片`,`生成中...`]})]}):n===`completed`&&e.videoUrl||e.imageUrl?(0,$.jsxs)(`div`,{style:{borderRadius:12,overflow:`hidden`,border:`1px solid #f0f0f5`,position:`relative`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:10,right:10,zIndex:10},children:(0,$.jsx)(Cw,{title:`下载${a===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(M0,{}),onClick:()=>{let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${a===`video`?e.videoUrl:e.imageUrl}&download=1`,t.download=`${e.projectName}${a===`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:a===`video`?(0,$.jsx)(`video`,{src:`http://ceshi.apiforeign.minzhong.cn${e.videoUrl}`,controls:!0,preload:`metadata`,style:{width:`100%`,height:`400px`,borderRadius:0}}):(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${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)(EH,{children:[a===`video`?(0,$.jsx)(v5,{style:{color:`#6366f1`,fontSize:13}}):(0,$.jsx)(e8,{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:R7(e.generatedAt)})]})]}):n===`failed`?(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)(N4,{style:{color:`#ef4444`,fontSize:28}}),(0,$.jsxs)(Q.Text,{style:{color:`#ef4444`,fontSize:14,fontWeight:600},children:[a===`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)(DV,{style:{color:`#94a3b8`,fontSize:28}}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:a===`image`?`待生成图片`:n===`prompt_optimized`?`待配置视频参数`:`待生成视频`})]})]})]})})]},e.id)})})]}),(0,$.jsx)(NK,{open:!!q,onCancel:()=>oe(null),footer:null,width:480,centered:!0,destroyOnHidden:!0,closable:!1,title:null,styles:{body:{padding:0,background:`#000`,position:`relative`}},children:q&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:q,controls:!0,autoPlay:!0,style:{width:`100%`,display:`block`,maxHeight:`70vh`}}),(0,$.jsx)(`div`,{onClick:()=>oe(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)(T5,{style:{color:`#fff`,fontSize:16}})})]})})]})},q7={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(Xm,{spin:!0})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(DV,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(Xm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(A4,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(N4,{})}},Qae=()=>{let e=Ye(),{records:t,projects:n,fetchRecords:r,fetchProjects:i,generateVideo:a}=L7(),o=t.items,[s,c]=(0,S.useState)(1),[l,u]=(0,S.useState)(10),[d,f]=(0,S.useState)({}),[p,m]=(0,S.useState)(void 0),[h,g]=(0,S.useState)(void 0),[_,v]=(0,S.useState)({}),[y,b]=(0,S.useState)(null),[x,C]=(0,S.useState)(null),[w,T]=(0,S.useState)(null);(0,S.useEffect)(()=>{i()},[i]),(0,S.useEffect)(()=>{r({projectId:p,status:h,page:s,pageSize:l})},[r,p,h,s,l]);let E=async()=>{if(!w)return;let{recordId:e,projectName:t,ratio:n,resolution:r}=w;f(t=>({...t,[e]:!0})),T(null),Z.loading({content:`「${t}」正在生成视频...`,duration:0,key:e});try{await a(e,{aspectRatio:n,resolution:r}),Z.success({content:`「${t}」视频生成成功!`,key:e,duration:3})}catch{Z.error({content:`「${t}」视频生成失败`,key:e,duration:3})}finally{f(t=>({...t,[e]:!1}))}},D=e=>{if((e.genType||`image`)===`image`){f(t=>({...t,[e.id]:!0})),Z.loading({content:`「${e.projectName}」正在生成图片...`,duration:0,key:e.id}),a(e.id,{}).then(()=>{Z.success({content:`「${e.projectName}」图片生成成功!`,key:e.id,duration:3})}).catch(()=>{Z.error({content:`「${e.projectName}」图片生成失败`,key:e.id,duration:3})}).finally(()=>{f(t=>({...t,[e.id]:!1}))});return}T({recordId:e.id,projectName:e.projectName,ratio:e.aspectRatio||`16:9`,resolution:e.resolution||`720p`})},O=o;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)(z2,{}),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)(EH,{children:[(0,$.jsx)(x3,{style:{color:`#94a3b8`}}),(0,$.jsx)(NC,{placeholder:`全部项目`,allowClear:!0,style:{width:200},onChange:e=>{m(e),c(1)},children:n.map(e=>(0,$.jsx)(NC.Option,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(NC,{placeholder:`全部状态`,allowClear:!0,style:{width:140},onChange:e=>{g(e),c(1)},children:[(0,$.jsx)(NC.Option,{value:`prompt_optimized`,children:`待生成`}),(0,$.jsx)(NC.Option,{value:`generating`,children:`生成中`}),(0,$.jsx)(NC.Option,{value:`completed`,children:`已完成`}),(0,$.jsx)(NC.Option,{value:`failed`,children:`失败`})]})]}),(0,$.jsxs)(Q.Text,{style:{marginLeft:`auto`,lineHeight:`32px`,color:`#94a3b8`,fontSize:13},children:[`共 `,t.total,` 条记录`]})]}),O.length===0?(0,$.jsx)(rC,{image:rC.PRESENTED_IMAGE_SIMPLE,description:`暂无生成记录`,style:{padding:60}}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},className:`stagger-children`,children:O.map((e,t)=>{let n=y===e.id,r=_[e.id]??e.optimizedPrompt,i=d[e.id],a=x===e.id,o=e.genType||`image`;return(0,$.jsxs)(`div`,{className:`animate-slideInCard`,style:{animationDelay:`${t*.04}s`},children:[(0,$.jsxs)(`div`,{className:`record-item`,onClick:()=>C(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)(e8,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(v5,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(mQ,{style:{color:`#6366f1`,fontSize:12,flexShrink:0}}):(0,$.jsx)(D4,{style:{color:`#cbd5e1`,fontSize:12,flexShrink:0}}),(0,$.jsx)(h$,{color:q7[e.status].color,icon:q7[e.status].icon,style:{margin:0},children:q7[e.status].text}),(0,$.jsx)(h$,{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.duration?`${e.imageSize}`:`-`,` · `,e.imageProportion||`-`,` · `,e.imagePx||`-`,` · `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:R7(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:R7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(EH,{children:[e.status===`prompt_optimized`&&(0,$.jsx)(X,{type:`primary`,size:`small`,icon:(0,$.jsx)(l8,{}),loading:i,onClick:()=>D(e),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`生成`}),e.status===`generating`&&(0,$.jsx)(h$,{color:`processing`,icon:(0,$.jsx)(Xm,{spin:!0}),style:{padding:`4px 12px`,fontSize:12},children:`生成中...`}),e.status===`failed`&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(l8,{}),loading:i,onClick:()=>D(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)(EH,{size:4,children:[(0,$.jsx)(Cw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(b1,{}),onClick:()=>{navigator.clipboard.writeText(r),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),e.status===`prompt_optimized`&&(0,$.jsx)(Cw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(Z$,{}),onClick:()=>{b(e.id),v(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt}))},style:{color:`#6366f1`}})})]})]}),n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(tG.TextArea,{value:r,onChange:t=>v(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:()=>b(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{v(t=>({...t,[e.id]:r})),b(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.imageProportion?`${e.imageProportion} `:`-`},{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)(D8,{}),loading:i,onClick:()=>D(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`?`选择参数生成视频`:`生成图片`})}),e.status===`failed`&&(0,$.jsx)(`div`,{style:{marginTop:16,display:`flex`,justifyContent:`flex-end`},children:(0,$.jsxs)(X,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(l8,{}),loading:i,onClick:()=>D(e),style:{borderRadius:12,fontWeight:600,height:44},children:[`重新生成`,o===`video`?`视频`:`图片`]})})]}),(0,$.jsx)(`div`,{style:{flex:`1 1 40%`,minWidth:240},children:e.status===`generating`?(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:`请耐心等待,生成完成后将自动展示`})]}):e.status===`completed`&&(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)(Cw,{title:`下载${o===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(M0,{}),onClick:()=>{let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${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:`http://ceshi.apiforeign.minzhong.cn${e.videoUrl}`,controls:!0,preload:`metadata`,style:{width:`100%`,height:`400px`,display:`block`}}):(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${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)(EH,{children:[o===`video`?(0,$.jsx)(v5,{style:{color:`#6366f1`}}):(0,$.jsx)(e8,{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:[`生成于 `,R7(e.generatedAt)]})]})]}):e.status===`failed`?(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)(N4,{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)(DV,{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)(VG,{current:t.page||s,pageSize:t.pageSize||l,total:t.total,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{c(e),u(t)}})}),(0,$.jsx)(NK,{title:(0,$.jsxs)(EH,{children:[(0,$.jsx)(D8,{}),`生成视频`]}),open:!!w,onCancel:()=>T(null),onOk:E,okText:`提交生成`,cancelText:`取消`,width:420,children:w&&(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:16},children:(()=>{let e=o.find(e=>e.id===w.recordId);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,children:[e?.duration||5,`秒`]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`画面比例`}),(0,$.jsx)(NC,{value:w.ratio,onChange:e=>T(t=>t?{...t,ratio:e}:null),style:{width:`100%`},options:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`].map(e=>({value:e,label:e}))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`分辨率`}),(0,$.jsx)(NC,{value:w.resolution,onChange:e=>T(t=>t?{...t,resolution:e}:null),style:{width:`100%`},options:[`480p`,`720p`,`1080p`].map(e=>({value:e,label:e}))})]})]})})()})})]})},J7=({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()})},$ae=()=>{let{user:e}=j7(),[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 q5(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)(mJ,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(pz,{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)(EH,{style:{marginBottom:10},children:[(0,$.jsx)(b5,{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)(J7,{value:e?.credits??0})})]})]})}),(0,$.jsx)(pz,{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)(EH,{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)(G2,{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)(J7,{value:f})})]})}),(0,$.jsx)(pz,{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)(EH,{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)(I2,{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)(J7,{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)(s5,{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)(n$,{columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>(0,$.jsx)(h$,{color:e===`recharge`?`green`:`orange`,icon:e===`recharge`?(0,$.jsx)(G2,{}):(0,$.jsx)(I2,{}),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:R7(e)})}],dataSource:t,rowKey:`id`,loading:r,pagination:{current:a,pageSize:s,total:l,onChange:d,showSizeChanger:!0,showTotal:e=>`共 ${e} 条`},scroll:{x:500}})})]})]})},eoe=()=>{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 q5(c,u);r(e.records||[]),a(e.credits||0),s(e.total||0)}catch{r([])}t(!1)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(mJ,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(pz,{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)(b5,{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)(pz,{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)(f8,{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)(pz,{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)(s5,{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)(s5,{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)(cK,{spinning:e,children:n.length===0?(0,$.jsx)(rC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无积分变动记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(n$,{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)(h$,{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)(VG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})]})},toe=()=>{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);(0,S.useEffect)(()=>{l()},[o]);let l=async()=>{t(!0);try{let e=await bie(o,c);r(e.items||[]),a(e.total||0)}catch{r([])}t(!1)};return(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(jH,{style:{color:`#0ea5e9`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`订单记录`}),(0,$.jsxs)(`span`,{style:{color:`#94a3b8`,fontSize:13},children:[`共 `,n.length,` 条记录`]})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(cK,{spinning:e,children:n.length===0?(0,$.jsx)(rC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无订单记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(n$,{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)(D2,{style:{fontSize:16}}),label:`支付宝`,color:`#1677ff`},wechat:{icon:(0,$.jsx)(C5,{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)(h$,{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)(VG,{current:o,pageSize:c,total:i,onChange:e=>{s(e)},size:`small`})})]})})})]})})},noe=()=>{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 X5(c,u);r(e.items||[]),s(e.total||0)}catch{r([])}t(!1)},f=async()=>{try{a(await Z5())}catch{a(0)}},p=async e=>{try{await Q5(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)(o4,{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)(cK,{spinning:e,children:n.length===0?(0,$.jsx)(rC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无消息`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(n$,{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)(z8,{style:{fontSize:14}})},credit:{color:`#f59e0b`,label:`积分`,bg:`rgba(245,158,11,0.1)`,icon:(0,$.jsx)(b5,{style:{fontSize:14}})},promo:{color:`#8b5cf6`,label:`活动`,bg:`rgba(139,92,246,0.1)`,icon:(0,$.jsx)(N3,{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},{title:`状态`,dataIndex:`isRead`,key:`isRead`,width:80,render:(e,t)=>e??t.is_read?(0,$.jsx)(h$,{color:`gray`,style:{background:`rgba(148,163,184,0.1)`},children:`已读`}):(0,$.jsx)(h$,{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)(VG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})})},Y7=()=>{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)(IL,{activeKey:t,onChange:n,items:[{key:`credits`,label:`积分明细`},{key:`orders`,label:`订单记录`}],style:{marginBottom:24},size:`large`}),t===`credits`&&(0,$.jsx)(eoe,{}),t===`orders`&&(0,$.jsx)(toe,{})]})},roe=`/assets/bg1-CQh9PRPW.png`,{Text:X7}=Q,ioe=({items:e,selectedId:t,onSelect:n})=>e.length?(0,$.jsx)(EH,{direction:`vertical`,style:{width:`100%`},size:10,children:e.map(e=>{let r=t===e.id;return(0,$.jsxs)(`div`,{onClick:()=>n(e),style:{padding:14,borderRadius:14,cursor:`pointer`,border:r?`1px solid #8b5cf6`:`1px solid #e2e8f0`,background:r?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(EH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(X7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(X7,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(EH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(h$,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(h$,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(h$,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})}):(0,$.jsx)(rC,{description:`暂无项目组`}),aoe={Active:`green`,Processing:`processing`,Failed:`red`,local_deleted:`default`,remote_deleted:`default`,delete_failed:`red`},ooe={Active:`入库成功`,Processing:`入库处理中`,Failed:`入库失败`,local_deleted:`本地已删除`,remote_deleted:`远程已删除`,delete_failed:`删除失败`},Z7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,Q7=e=>e.assetType===`Video`?Z7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):Z7(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),soe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},coe=({items:e,onDelete:t,onRefresh:n})=>{let r=(0,S.useRef)(null),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)(`Image`);(0,S.useEffect)(()=>(e.some(e=>e.status!==`Failed`&&e.status!==`Active`)&&n?r.current||=window.setInterval(()=>{n()},3e3):r.current&&=(clearInterval(r.current),null),()=>{r.current&&=(clearInterval(r.current),null)}),[e,n]);let u=e=>{let t=Q7(e);t&&(s(t),l(e.assetType===`Video`?`Video`:`Image`),a(!0))};return e.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`,gap:14},children:e.map(e=>{let n=e.assetType===`Video`,r=Q7(e);return(0,$.jsx)(RL,{hoverable:!0,bodyStyle:{padding:12},style:{borderRadius:16,overflow:`hidden`,borderColor:`#eef2f7`},cover:(0,$.jsxs)(`div`,{style:{height:170,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[r?n&&e.videoCoverUrl?(0,$.jsx)(`img`,{src:r,alt:e.name||`视频封面`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(`video`,{src:r,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:r,alt:e.name||``,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(v5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)(e8,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(h$,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),r&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(NW,{}),style:{position:`absolute`,right:10,top:10},onClick:()=>u(e)}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:10,bottom:10,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:soe(e.videoDuration)})]}),children:(0,$.jsxs)(EH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(Cw,{title:e.name||e.remoteAssetId||e.id,children:(0,$.jsx)(`div`,{style:{fontWeight:600,color:`#1e293b`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name||e.remoteAssetId||`未命名素材`})}),(0,$.jsxs)(EH,{wrap:!0,size:4,children:[(0,$.jsx)(h$,{color:aoe[e.status]||`default`,children:ooe[e.status]||e.status}),(0,$.jsx)(h$,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(EH,{size:6,wrap:!0,children:(0,$.jsx)(LK,{title:`确认删除这个素材吗?`,onConfirm:()=>t(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(k$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(NK,{title:`素材预览`,open:i,onCancel:()=>a(!1),footer:null,width:760,destroyOnClose:!0,children:(0,$.jsx)(`div`,{style:{minHeight:420,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#0f172a`,borderRadius:12,overflow:`hidden`},children:c===`Video`?(0,$.jsx)(`video`,{src:o,controls:!0,autoPlay:!0,style:{maxWidth:`100%`,maxHeight:520}}):(0,$.jsx)(`img`,{src:o,alt:`素材预览`,style:{maxWidth:`100%`,maxHeight:520,objectFit:`contain`}})})})]}):(0,$.jsx)(rC,{description:`暂无素材`})},$7=2,e9=15,loe=e=>{if(!e)return`Image`;if(e.type.startsWith(`video/`))return`Video`;let t=e.name.toLowerCase();return/\.(mp4|mov|webm|m4v|avi|mkv)$/.test(t)?`Video`:`Image`},uoe=e=>new Promise(t=>{if(!e.type.startsWith(`video/`)){t(null);return}let n=URL.createObjectURL(e),r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{let e=Number.isFinite(r.duration)?r.duration:null;URL.revokeObjectURL(n),t(e)},r.onerror=()=>{URL.revokeObjectURL(n),t(null)},r.src=n}),doe=e=>e==null||!Number.isFinite(e)||e<=0?(Z.error(`无法读取视频秒数,请检查视频文件是否损坏`),!1):e<$7?(Z.error(`视频素材最短不能少于 ${$7} 秒`),!1):e>e9?(Z.error(`视频素材最长不能超过 ${e9} 秒`),!1):!0,foe=({projectId:e,open:t,onClose:n,onSuccess:r})=>{let[i,a]=(0,S.useState)([]),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)(!1),u=()=>{a([]),s(``)};return(0,$.jsx)(NK,{title:`上传真人素材`,open:t,onCancel:n,onOk:async()=>{let t=i[0]?.originFileObj;if(!t){Z.warning(`请先选择图片或视频素材`);return}let a=loe(t);if(a===`Image`&&!t.type.startsWith(`image/`)){Z.error(`仅支持图片或视频素材`);return}l(!0);try{let i=a===`Video`?await uoe(t):null;if(a===`Video`&&!doe(i))return;let s=a===`Video`?await aie(t,i||void 0):await iie(t);await fae(e,{url:s.url,assetType:a,name:o.trim()||t.name,videoDuration:s.duration_seconds??i,fileSize:s.file_size_bytes??t.size,mimeType:t.type||null,uploadResourceId:s.resource_id||null}),Z.success(a===`Video`?`视频素材已提交入库,处理中`:`图片素材已提交入库,处理中`),u(),r(),n()}catch(e){Z.error(e?.message||`上传素材失败`)}finally{l(!1)}},confirmLoading:c,okText:`提交入库`,destroyOnHidden:!0,children:(0,$.jsxs)(EH,{direction:`vertical`,style:{width:`100%`},size:12,children:[(0,$.jsx)(tG,{value:o,onChange:e=>s(e.target.value),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsx)(R0,{accept:`image/*,video/*`,maxCount:1,fileList:i,beforeUpload:()=>!1,onChange:({fileList:e})=>a(e),listType:`picture`,children:(0,$.jsx)(X,{icon:(0,$.jsx)(p5,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12},children:[`当前开放图片和视频,音频暂不接入。视频素材必须在 `,$7,`~`,e9,` 秒内;入库后会经过火山真人一致性校验,Active 后才可用于 AI 创作。`]})]})})},poe=({project:e,onDeleted:t,onChanged:n})=>{let[r,i]=(0,S.useState)([]),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)(),[p,m]=(0,S.useState)(),[h,g]=(0,S.useState)(1),[_,v]=(0,S.useState)(20),[y,b]=(0,S.useState)(0),x=async(t=h,n=_)=>{o(!0);try{let r=await pae(e.id,{page:t,pageSize:n,keyword:l,status:d,assetType:p});i(r.items),b(r.total||0),g(t),v(n)}catch(e){Z.error(e?.message||`加载素材失败`)}finally{o(!1)}};(0,S.useEffect)(()=>{x(1,_)},[e.id,l,d,p]);let C=async e=>{try{await mae(e),await x(h,_),n(),Z.success(`素材已删除`)}catch(e){Z.error(e?.message||`删除素材失败`)}},w=async()=>{try{await uae(e.id),Z.success(`项目组已删除`),t()}catch(e){Z.error(e?.message||`删除项目组失败`)}},T=e.status===`active`;return(0,$.jsxs)(RL,{title:(0,$.jsx)(EH,{children:(0,$.jsx)(`span`,{children:e.name})}),extra:(0,$.jsxs)(EH,{children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(p5,{}),disabled:!T,onClick:()=>c(!0),children:`上传素材`}),(0,$.jsx)(LK,{title:`确认删除这个真人素材项目组吗?`,onConfirm:w,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(k$,{}),children:`删除项目组`})})]}),style:{borderRadius:16},children:[!T&&(0,$.jsx)(Q.Paragraph,{style:{color:`#f97316`},children:`项目组未完成真人认证,暂不能上传素材。请重新创建项目组并完成手机扫码认证。`}),(0,$.jsxs)(EH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(tG.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:l,onChange:e=>u(e.target.value),onSearch:()=>x(1,_),style:{width:240}}),(0,$.jsx)(NC,{allowClear:!0,placeholder:`素材状态`,value:d,onChange:e=>f(e),style:{width:150},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(NC,{allowClear:!0,placeholder:`素材类型`,value:p,onChange:e=>m(e),style:{width:130},options:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{onClick:()=>x(1,_),children:`筛选`})]}),(0,$.jsx)(cK,{spinning:a,children:r.length===0?(0,$.jsx)(rC,{description:`暂无素材,上传图片/视频后会异步入库`,style:{marginTop:80}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(coe,{items:r,loading:a,onDelete:C,onRefresh:()=>x(h,_)}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(VG,{current:h,pageSize:_,total:y,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>x(e,t)})})]})}),(0,$.jsx)(foe,{projectId:e.id,open:s,onClose:()=>c(!1),onSuccess:()=>{x(1,_),n()}})]})},t9=`group_active`,n9=2e3,moe=()=>{let[e,t]=(0,S.useState)([]),[n,r]=(0,S.useState)(null),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(null),[m,h]=(0,S.useState)(!1),[g]=bU.useForm(),_=(0,S.useRef)(null),v=()=>{_.current&&=(window.clearInterval(_.current),null)},y=()=>{v(),s(!1),l(!1),h(!1),d(null),p(null),g.resetFields()},b=async()=>{a(!0);try{let e=await k7({pageSize:100,status:`active`});t(e.items),r(t=>t?e.items.find(e=>e.id===t.id)||e.items[0]||null:e.items[0]||null)}catch(e){Z.error(e?.message||`加载真人素材项目组失败`)}finally{a(!1)}};(0,S.useEffect)(()=>{b()},[]),(0,S.useEffect)(()=>()=>v(),[]);let x=async e=>{v(),h(!1),Z.success(`真人认证完成,项目组已创建成功`),s(!1),p(null),d(null),g.resetFields();let n=await k7({pageSize:100,status:`active`});t(n.items),r(n.items.find(t=>t.id===e)||n.items[0]||null)},C=(e,t,n)=>{v(),h(!0);let r=async()=>{try{let n=await dae(e);if(p(n),n.status===t9){await x(t);return}[`callback_failed`,`failed`,`expired`].includes(n.status)&&(v(),h(!1),Z.error(n.errorMessage||`真人认证未完成,请重新创建项目组`))}catch(e){v(),h(!1),Z.error(e?.message||`轮询真人认证状态失败`)}};_.current=window.setInterval(r,Math.max(1e3,n||n9)),r()},w=async()=>{let e=await g.validateFields();l(!0);try{let t=`${window.location.origin}/private-portrait-authorized`,n=await lae({...e,callbackRedirectUrl:t});d(n.project),p(n.validateSession),Z.success(`请使用手机扫码完成人脸认证`),n.validateSession?.id&&C(n.validateSession.id,n.project.id,n.pollIntervalMs||n9)}catch(e){Z.error(e?.message||`创建项目组认证二维码失败`)}finally{l(!1)}},T=f?.h5Link||``,E=f?.status===t9;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`真人素材库`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`创建项目组时先完成真人认证,认证成功后项目组才会正式创建并可上传素材。`})]}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(mL,{}),onClick:()=>s(!0),children:`创建项目组`})]}),(0,$.jsxs)(mJ,{gutter:16,children:[(0,$.jsx)(pz,{xs:24,lg:5,children:(0,$.jsx)(RL,{style:{borderRadius:16,minHeight:520},children:(0,$.jsx)(cK,{spinning:i,children:e.length===0?(0,$.jsx)(rC,{description:`暂无真人项目组`}):(0,$.jsx)(ioe,{items:e,selectedId:n?.id,onSelect:r})})})}),(0,$.jsx)(pz,{xs:24,lg:19,children:n?(0,$.jsx)(poe,{project:n,onDeleted:()=>{r(null),b()},onChanged:b}):(0,$.jsx)(RL,{style:{borderRadius:16,minHeight:520,textAlign:`center`,color:`#94a3b8`},children:`请先创建或选择一个真人素材项目组`})})]}),(0,$.jsx)(NK,{title:`新建真人素材项目组`,open:o,onCancel:y,footer:f?[(0,$.jsx)(X,{onClick:y,children:`关闭`},`close`)]:void 0,onOk:f?void 0:w,okText:`开始认证并创建`,confirmLoading:c,maskClosable:!m,children:f?(0,$.jsxs)(EH,{direction:`vertical`,align:`center`,size:16,style:{width:`100%`},children:[E?(0,$.jsx)(A4,{style:{fontSize:54,color:`#22c55e`}}):T?(0,$.jsx)(Jq,{value:T,size:220}):(0,$.jsx)(cK,{}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Title,{level:5,style:{marginBottom:8},children:u?.name||`真人素材项目组`}),(0,$.jsx)(Q.Text,{type:E?`success`:`secondary`,children:E?`认证成功,项目组正在刷新`:`请使用手机扫码完成人脸认证,成功后回到电脑端查看项目组。`})]})]}):(0,$.jsxs)(bU,{form:g,layout:`vertical`,children:[(0,$.jsx)(bU.Item,{label:`项目组名称`,name:`name`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(tG,{placeholder:`例如:达人A、客户B、张三人像`})}),(0,$.jsx)(bU.Item,{label:`描述`,name:`description`,children:(0,$.jsx)(tG.TextArea,{rows:3,placeholder:`可选`})}),(0,$.jsx)(Q.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`点击后会生成真人认证二维码。手机扫码认证成功后,项目组才会出现在项目列表中。`})]})})]})},{Text:r9}=Q,i9=2,a9=15,hoe={creating:{label:`本地创建中`,color:`processing`},Processing:{label:`入库处理中`,color:`processing`},Active:{label:`入库成功`,color:`success`},Failed:{label:`入库失败`,color:`error`},local_deleted:{label:`本地已删`,color:`default`},remote_deleted:{label:`远端已删`,color:`default`},delete_failed:{label:`远端删除失败`,color:`error`}},goe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},o9=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,s9=e=>e.assetType===`Video`?o9(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):o9(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),_oe=e=>{if(!e)return`Image`;if(e.type.startsWith(`video/`))return`Video`;let t=e.name.toLowerCase();return/\.(mp4|mov|webm|m4v|avi|mkv)$/.test(t)?`Video`:`Image`},voe=e=>new Promise(t=>{if(!e.type.startsWith(`video/`)){t(null);return}let n=URL.createObjectURL(e),r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{let e=Number.isFinite(r.duration)?r.duration:null;URL.revokeObjectURL(n),t(e)},r.onerror=()=>{URL.revokeObjectURL(n),t(null)},r.src=n}),yoe=(e,t)=>e==null||!Number.isFinite(e)||e<=0?(t(`无法读取视频秒数,请检查视频文件是否损坏`),!1):ea9?(t(`视频素材最长不能超过 ${a9} 秒`),!1):!0,boe=({status:e})=>{let t=e||`-`,n=hoe[t];return(0,$.jsx)(h$,{color:n?.color||`default`,children:n?.label||t})},xoe=()=>{let{message:e}=Jb.useApp(),[t,n]=(0,S.useState)([]),[r,i]=(0,S.useState)(),[a,o]=(0,S.useState)([]),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(1),[p,m]=(0,S.useState)(20),[h,g]=(0,S.useState)(0),[_,v]=(0,S.useState)(``),[y,b]=(0,S.useState)(),[x,C]=(0,S.useState)(),[w,T]=(0,S.useState)(!1),[E,D]=(0,S.useState)(!1),[O,k]=(0,S.useState)(!1),[A,j]=(0,S.useState)(!1),[M,N]=(0,S.useState)([]),[P,F]=(0,S.useState)(``),[I,L]=(0,S.useState)(!1),[R,z]=(0,S.useState)(``),[B,V]=(0,S.useState)(`Image`),[H]=bU.useForm(),U=(0,S.useRef)(null),W=(0,S.useMemo)(()=>t.find(e=>e.id===r)||null,[t,r]),ee=async()=>{c(!0);try{let e=(await A7({page:1,pageSize:100,status:`active`})).items||[];n(e),i(t=>t&&e.some(e=>e.id===t)?t:e[0]?.id)}catch(t){e.error(t?.message||`加载虚拟人像项目组失败`)}finally{c(!1)}},G=async(t=d,n=p)=>{if(!r){o([]),g(0);return}u(!0);try{let e=await bae(r,{page:t,pageSize:n,keyword:_.trim()||void 0,status:y,assetType:x});o(e.items||[]),g(e.total||0),f(t),m(n)}catch(t){e.error(t?.message||`加载虚拟人像素材失败`)}finally{u(!1)}},te=async()=>{await ee()};(0,S.useEffect)(()=>{te()},[]),(0,S.useEffect)(()=>{r&&G(1,p)},[r]),(0,S.useEffect)(()=>(a.some(e=>e.status!==`Failed`&&e.status!==`Active`)&&r?U.current||=window.setInterval(()=>{G(d,p)},3e3):U.current&&=(clearInterval(U.current),null),()=>{U.current&&=(clearInterval(U.current),null)}),[a,r,d,p]);let ne=async()=>{let t=await H.validateFields();D(!0);try{let n=await _ae(t);e.success(`虚拟人像项目组已创建`),T(!1),H.resetFields(),await ee(),i(n.id)}catch(t){e.error(t?.message||`创建项目组失败`)}finally{D(!1)}},K=async()=>{if(!r){e.warning(`请先创建或选择项目组`);return}let t=M[0]?.originFileObj;if(!t){e.warning(`请先选择图片或视频素材`);return}let n=_oe(t);if(n===`Image`&&!t.type.startsWith(`image/`)){e.error(`仅支持图片或视频素材`);return}j(!0);try{let i=n===`Video`?await voe(t):null;if(n===`Video`&&!yoe(i,e.error))return;let a=n===`Video`?await sie(t,i||void 0):await oie(t);await yae(r,{url:a.url,assetType:n,name:P.trim()||t.name,videoDuration:a.duration_seconds??i,fileSize:a.file_size_bytes??t.size,mimeType:t.type||null,uploadResourceId:a.resource_id||null}),e.success(n===`Video`?`视频素材已提交入库,处理中`:`图片素材已提交入库,处理中`),k(!1),N([]),F(``),await Promise.all([ee(),G(1,p)])}catch(t){e.error(t?.message||`上传素材失败`)}finally{j(!1)}},re=async t=>{try{await xae(t),e.success(`素材已删除,远端删除将异步执行`),await Promise.all([ee(),G(d,p)])}catch(t){e.error(t?.message||`删除素材失败`)}},ie=async()=>{if(r)try{await vae(r),e.success(`项目组已删除,远端资产组将异步删除`),i(void 0),await te()}catch(t){e.error(t?.message||`删除项目组失败`)}},ae=t=>{let n=s9(t);if(!n){e.warning(`暂无可预览地址`);return}z(n),V(t.assetType===`Video`?`Video`:`Image`),L(!0)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`虚拟素材库`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`可提前上传虚拟人像素材,后续生成视频时可直接使用。`})]}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(mL,{}),onClick:()=>T(!0),children:`创建项目组`})]}),(0,$.jsxs)(mJ,{gutter:[10,10],children:[(0,$.jsx)(pz,{xs:24,lg:5,children:(0,$.jsx)(RL,{style:{borderRadius:16,minHeight:520,margin:`0 auto`,maxWidth:1200},children:(0,$.jsx)(cK,{spinning:s,children:t.length===0?(0,$.jsx)(rC,{description:`暂无虚拟人像项目组`}):(0,$.jsx)(EH,{direction:`vertical`,style:{width:`100%`},size:10,children:t.map(e=>{let t=r===e.id;return(0,$.jsxs)(`div`,{onClick:()=>i(e.id),style:{padding:14,borderRadius:14,cursor:`pointer`,border:t?`1px solid #8b5cf6`:`1px solid #e2e8f0`,background:t?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(EH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(r9,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(r9,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(EH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(h$,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(h$,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(h$,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})})})})}),(0,$.jsx)(pz,{xs:24,lg:19,children:(0,$.jsxs)(RL,{title:W?W.name:`素材资产`,extra:(0,$.jsxs)(EH,{wrap:!0,children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(p5,{}),disabled:!r,onClick:()=>k(!0),children:`上传图片/视频`}),r&&(0,$.jsx)(LK,{title:`确认删除当前虚拟人像项目组吗?`,onConfirm:ie,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(k$,{}),children:`删除项目组`})})]}),style:{borderRadius:16,minHeight:520},children:[(0,$.jsxs)(EH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(tG.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:_,onChange:e=>v(e.target.value),onSearch:()=>G(1,p),style:{width:240}}),(0,$.jsx)(NC,{allowClear:!0,placeholder:`素材状态`,value:y,onChange:e=>b(e),style:{width:150},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(NC,{allowClear:!0,placeholder:`素材类型`,value:x,onChange:e=>C(e),style:{width:130},options:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{onClick:()=>G(1,p),children:`筛选`})]}),(0,$.jsx)(cK,{spinning:l,children:r?a.length===0?(0,$.jsx)(rC,{description:`暂无素材,上传图片/视频后会异步入库`,style:{marginTop:80}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`,gap:14},children:a.map(e=>{let t=s9(e),n=e.assetType===`Video`;return(0,$.jsx)(RL,{hoverable:!0,bodyStyle:{padding:12},style:{borderRadius:16,overflow:`hidden`,borderColor:`#eef2f7`},cover:(0,$.jsxs)(`div`,{style:{height:170,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[t?n&&e.videoCoverUrl?(0,$.jsx)(`img`,{src:t,alt:e.name||`视频封面`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(`video`,{src:t,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:t,alt:e.name||`虚拟人像素材`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(v5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)(e8,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(h$,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),t&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(NW,{}),style:{position:`absolute`,right:10,top:10},onClick:()=>ae(e)}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:10,bottom:10,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:goe(e.videoDuration)})]}),children:(0,$.jsxs)(EH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(Cw,{title:e.name||e.remoteAssetId||e.id,children:(0,$.jsx)(`div`,{style:{fontWeight:600,color:`#1e293b`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name||e.remoteAssetId||`未命名素材`})}),(0,$.jsxs)(EH,{wrap:!0,size:4,children:[(0,$.jsx)(boe,{status:e.status}),(0,$.jsx)(h$,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(EH,{size:6,wrap:!0,children:(0,$.jsx)(LK,{title:`确认删除这个虚拟人像素材吗?`,onConfirm:()=>re(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(k$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(VG,{current:d,pageSize:p,total:h,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>G(e,t)})})]}):(0,$.jsx)(rC,{description:`请先创建或选择项目组`,style:{marginTop:80}})})]})})]}),(0,$.jsx)(NK,{title:`创建虚拟人像项目组`,open:w,onCancel:()=>T(!1),onOk:ne,confirmLoading:E,okText:`创建项目组`,children:(0,$.jsxs)(bU,{form:H,layout:`vertical`,children:[(0,$.jsx)(bU.Item,{name:`name`,label:`项目组名称`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(tG,{placeholder:`例如:虚拟主播A / 品牌代言人B`,maxLength:128})}),(0,$.jsx)(bU.Item,{name:`description`,label:`描述`,children:(0,$.jsx)(tG.TextArea,{placeholder:`可填写人物设定、服装风格、素材要求等`,maxLength:2e3,rows:4})})]})}),(0,$.jsx)(NK,{title:`上传虚拟人像素材`,open:O,onCancel:()=>k(!1),onOk:K,confirmLoading:A,okText:`提交入库`,children:(0,$.jsxs)(EH,{direction:`vertical`,style:{width:`100%`},size:14,children:[(0,$.jsx)(tG,{value:P,onChange:e=>F(e.target.value),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsx)(R0,{accept:`image/*,video/*`,maxCount:1,fileList:M,beforeUpload:()=>!1,onChange:({fileList:e})=>N(e),listType:`picture`,children:(0,$.jsx)(X,{icon:(0,$.jsx)(p5,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{padding:12,background:`#f8fafc`,borderRadius:12,color:`#64748b`,fontSize:13},children:[`当前开放图片和视频,音频暂不接入。视频素材必须在 `,i9,`~`,a9,` 秒内;提交后会调用火山 CreateAsset 异步处理,状态变为 Active 后才可用于 AI 创作。`]})]})}),(0,$.jsx)(NK,{title:`素材预览`,open:I,onCancel:()=>L(!1),footer:null,width:760,destroyOnClose:!0,children:(0,$.jsx)(`div`,{style:{minHeight:420,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#0f172a`,borderRadius:12,overflow:`hidden`},children:B===`Video`?(0,$.jsx)(`video`,{src:R,controls:!0,autoPlay:!0,style:{maxWidth:`100%`,maxHeight:520}}):(0,$.jsx)(`img`,{src:R,alt:`素材预览`,style:{maxWidth:`100%`,maxHeight:520,objectFit:`contain`}})})})]})},{Title:Soe,Text:Coe,Paragraph:woe}=Q,c9=e=>e===`aigc_virtual`?`aigc_virtual`:`real_person`,Toe=()=>{let[e,t]=On(),[n,r]=(0,S.useState)(()=>c9(e.get(`portraitTab`))),[i,a]=(0,S.useState)(null),[o,s]=(0,S.useState)([]),[c,l]=(0,S.useState)();(0,S.useEffect)(()=>{(async()=>{try{if(n===`aigc_virtual`){let[e,t]=await Promise.all([gae(),A7({page:1,pageSize:100,status:`active`})]);a(e);let n=t.items||[];s(n),l(e=>e&&n.some(t=>t.id===e)?e:n[0]?.id)}else{let[e,t]=await Promise.all([cae(),k7({pageSize:100,status:`active`})]);a(e);let n=t.items||[];s(n),l(e=>e&&n.some(t=>t.id===e)?e:n[0]?.id)}}catch(e){Z.error(e?.message||`加载数据失败`)}})()},[n]),(0,S.useMemo)(()=>o.find(e=>e.id===c)||null,[o,c]);let u=(0,S.useMemo)(()=>i?`已用 ${i.usedAssetCount||0} / ${i.assetLimit||0} 个素材,剩余 ${i.remainingAssetCount||0}`:`额度加载中`,[i]),d=(0,S.useMemo)(()=>[{key:`real_person`,label:`真人素材库`,children:(0,$.jsx)(moe,{})},{key:`aigc_virtual`,label:`虚拟素材库`,children:(0,$.jsx)(xoe,{})}],[]);return(0,$.jsx)(`div`,{children:(0,$.jsx)(IL,{activeKey:n,onChange:n=>{let i=c9(n);r(i);let a=new URLSearchParams(e);a.set(`filterType`,`private_portrait`),a.set(`portraitTab`,i),t(a,{replace:!0})},items:d,destroyInactiveTabPane:!1,tabBarExtraContent:(0,$.jsxs)(`div`,{style:{fontSize:14,fontWeight:700,color:`#4f46e5`,marginTop:8},children:[u,`。真人/虚拟共用,图片/视频共用;音频暂不开放。`]})})})},{Header:Eoe,Sider:Doe,Content:Ooe}=uG,{TextArea:koe}=tG,{Option:Aoe}=NC,{Text:l9}=Q,joe=()=>{let{message:e}=Jb.useApp(),t=Ke(),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(`1`),[o,s]=(0,S.useState)([]),{mediaType:c,countType:l,selectedRatio:u,selectedResolution:d,width:f,height:p,videoDuration:m,videoAspectRatio:h,videoResolution:g,engineOptions:_,enginesele:v,inputValue:y,setMediaType:b,setCountType:x,setSelectedRatio:C,setSelectedResolution:w,setWidth:T,setHeight:E,setVideoDuration:D,setVideoAspectRatio:O,setVideoResolution:k,setEngineOptions:A,setEnginesele:j,setInputValue:M,currentMedia:N,setCurrentMedia:P}=L7(),F=(c===`image`?v?.image:v?.video)?.find(e=>e.id===l),I=F?.maxImageCount??4,L=F?.maxVideoCount??1,[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(!1),[H,U]=(0,S.useState)(`universal`),[W,ee]=(0,S.useState)(null),[G,te]=(0,S.useState)(null),[ne,K]=(0,S.useState)(null),[re,ie]=(0,S.useState)(!1),[ae,q]=(0,S.useState)(!1),[oe,se]=(0,S.useState)(`real_person`),[ce,le]=(0,S.useState)(!1),ue=(0,S.useRef)(null),de=(0,S.useCallback)(()=>{ue.current&&=(window.clearTimeout(ue.current),null),le(!0)},[]),fe=(0,S.useCallback)(()=>{ue.current&&window.clearTimeout(ue.current),ue.current=window.setTimeout(()=>{le(!1),ue.current=null},260)},[]),[pe,me]=(0,S.useState)(!1),he=(0,S.useRef)(null),[ge,_e]=(0,S.useState)({top:0,left:0}),ve=e=>{let t=0,n=0,r=0;return e.map(e=>e.type===`image`?(t++,`图片${t}`):e.type===`video`?(n++,`视频${n}`):(r++,`音频${r}`))},[ye,be]=(0,S.useState)(!1),[xe,Se]=(0,S.useState)(``),[Ce,we]=(0,S.useState)(`image`),Te=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(ye&&Ce===`video`){let e=()=>{Te.current&&Te.current.play().catch(()=>{})};Te.current&&(Te.current.readyState>=2?e():Te.current.addEventListener(`loadedmetadata`,e));let t=setTimeout(e,300);return()=>{clearTimeout(t),Te.current&&(Te.current.removeEventListener(`loadedmetadata`,e),Te.current.pause())}}else Te.current&&Te.current.pause()},[ye,Ce]);let[Ee,De]=(0,S.useState)(new Set),Oe=e=>{if(!e)return null;try{let t=new URL(e).searchParams.get(`exp`);return t?parseInt(t,10):null}catch{try{let t=e.indexOf(`?`);if(t!==-1){let n=e.substring(t+1),r=new URLSearchParams(n).get(`exp`);if(r)return parseInt(r,10)}return null}catch{return null}}},ke=e=>{let t=Oe(e);return t?Math.floor(Date.now()/1e3)>t:!1},[Ae,je]=(0,S.useState)(!1),[Me,Ne]=(0,S.useState)(``),[Pe,Fe]=(0,S.useState)(`image`),[Ie,Le]=(0,S.useState)(``),Re=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(Ae&&Pe===`video`&&Re.current){let e=Re.current;e.currentTime=0,e.muted=!1;let t=e.play();t&&typeof t.catch==`function`&&t.catch(()=>{e.muted=!0,e.play().catch(()=>{})})}else if(!Ae&&Re.current){let e=Re.current;e.pause(),e.muted=!0,e.currentTime=0}},[Ae,Pe,Me]);let[ze,Be]=(0,S.useState)(null),[Ve,He]=(0,S.useState)(0),[Ue,We]=(0,S.useState)(!1),[Ge,qe]=(0,S.useState)(null),[Je,Ye]=(0,S.useState)({x:0,y:0}),[Xe,Ze]=(0,S.useState)(!1),[Qe,$e]=(0,S.useState)(!1),[et,tt]=(0,S.useState)([]),[nt,rt]=(0,S.useState)([]),[it,at]=(0,S.useState)({}),[ot,st]=(0,S.useState)(!1),[ct,lt]=(0,S.useState)(!1),[ut,dt]=(0,S.useState)([]),[ft,pt]=(0,S.useState)([]),[mt,ht]=(0,S.useState)([]),gt=()=>{let e={};if(e=mt.find(e=>e.modelConfigId===l&&e.genType===c&&e.resolution===(c===`video`?g:d)),e||(c===`video`?(e={perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},(g===`1080p`||g===`720p`||g===`480p`)&&(e.ratio=1.3)):(e={perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},(d===`2K`||d===`4K`||d===`1K`)&&(e.ratio=3))),c===`video`){let t=(m*e.perSecondCredits+e.baseCredits)*e.ratio,n=N.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n>0){let r=((e.inputVideoBaseCredits||0)+(e.inputVideoPerSecondCredits||0)*n)*(e.inputVideoRatio||1);t+=r}let r=N.filter(e=>e.type===`image`).length;if(r>0){let n=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*r)*(e.inputImageRatio||1);t+=n}return Number(t.toFixed(2))}else{let t=e.baseCredits*e.ratio,n=N.filter(e=>e.type===`image`).length;if(n>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n)*(e.inputImageRatio||1);t+=r}return Number(t.toFixed(2))}},_t=(0,S.useRef)(null),vt=(0,S.useRef)(null),yt=(0,S.useRef)(null);(0,S.useRef)(!0);let bt=(0,S.useRef)(!1),xt=(0,S.useRef)(0);o.find(e=>e.id===i);let[St,Ct]=(0,S.useState)([]),[wt,Tt]=(0,S.useState)({page:1,pageSize:20}),[Et,Dt]=(0,S.useState)(0),[Ot,kt]=(0,S.useState)(!1);(0,S.useEffect)(()=>{let e=t.state;e&&(e.generationPrompt&&M(e.generationPrompt),e.mediaReferences&&Array.isArray(e.mediaReferences)&&e.mediaReferences.length>0&&P(e.mediaReferences.map(e=>{let t=e.url||e.resourceUrl||e.previewUrl||``,n=t.startsWith(`http`)?t:`http://ceshi.apiforeign.minzhong.cn${t}`;return{...e,name:e.name||`参考${e.type}`,type:e.type===`video`?`video`:e.type===`audio`?`audio`:`image`,url:n,duration:e.duration||0,label:e.label||``}})),window.history.replaceState({},``,window.location.pathname))},[t.state]),(0,S.useEffect)(()=>()=>{ue.current&&window.clearTimeout(ue.current)},[]);let At=(0,S.useCallback)((e=`instant`)=>{let t=vt.current;t&&(xt.current=Date.now(),requestAnimationFrame(()=>{t.scrollTo({top:t.scrollHeight,behavior:e})}))},[]);(0,S.useEffect)(()=>{if(St.length>0&&!bt.current){let e=setTimeout(()=>{At(`smooth`),bt.current=!0},300);return()=>clearTimeout(e)}},[St.length,At]),(0,S.useEffect)(()=>{let e=c===`image`?v.image:v.video;e&&e.length>0&&(e.some(e=>e.id===l)||x(e[0].id))},[c,v]),(0,S.useEffect)(()=>{let e=e=>{let t=e.target;ct&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&<(!1),ot&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&st(!1),Xe&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ze(!1),Qe&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&$e(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[ct,ot,Xe,Qe]),(0,S.useEffect)(()=>{if(c!==`video`)return;let e=v?.video?.find(e=>e.id===l);if(!e)return;let t=e.supportsFirstLastFrame??!1,n=e.supportsUniversalReference??!0;U(e=>n?`universal`:e===`universal`&&!n&&t?`first_last_frame`:e)},[l,c,v]),(0,S.useEffect)(()=>{n7().then(e=>{if(j(e.engine),e.engine.video&&e.engine.video.length>0){let t=e.engine.video[0],n=e.engine.video.find(e=>e.id===l)||t;A({ratios:n.supportedRatios||[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:n.supportedResolutions||[`480p`,`720p`,`1080p`],durations:n.supportedDurations||[5,8,10,12,15]}),n.supportedRatios?.includes(h)||O(n.supportedRatios?.[0]||`16:9`),n.supportedResolutions?.includes(g)||k(n.supportedResolutions?.[0]||`720p`),n.supportedDurations?.includes(m)||D(n.supportedDurations?.[0]||5),l===`请选择`&&x(n.id)}if(e.engine.image&&e.engine.image.length>0){let t=e.engine.image.find(e=>e.id===l)||e.engine.image[0],n=t.supportedSizes||{},r=Object.keys(n).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),i=r[0]||`2K`,a=Object.keys(n[i]||{});if(tt(a.map(e=>({value:e,label:e}))),at(n),rt(r.map(e=>{let t=e.match(/(\d+)K/);return{value:e,label:`${{1:`标清`,2:`高清`,4:`超清`}[t?parseInt(t[1]):1]||`高清`} ${e}`}})),n[i]&&n[i][a[0]]){let[e,t]=n[i][a[0]].split(/[×x]/);T(Number(e)),E(Number(t)),C(a[0]),w(i)}l===`请选择`&&x(t.id)}}).catch(()=>{}),Tie().then(e=>{ht(e)}),r7(wt).then(e=>{let t=e.items,n=e.total;Ct(t),Dt(n)})},[]),(0,S.useEffect)(()=>{if(yt.current&&=(clearInterval(yt.current),null),St.some(e=>e.status===`generating`))return yt.current=window.setInterval(()=>{r7(wt).then(e=>{Ct(t=>t.map(t=>t.status===`generating`&&e.items.find(e=>e.id===t.id)||t)),Dt(e.total)}).catch(e=>{})},1e4),()=>{yt.current&&=(clearInterval(yt.current),null)}},[St,wt]),(0,S.useEffect)(()=>{if(!Xe)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ze(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[Xe]),(0,S.useEffect)(()=>{if(!Qe)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&$e(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[Qe]);let jt=e=>{let t=Object.keys(it).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),n=it[d]&&it[d][e]?d:t.find(t=>it[t]&&it[t][e])||t[0];if(n&&it[n]&&it[n][e]){let[t,r]=it[n][e].split(/[×x]/);T(Number(t)),E(Number(r)),C(e),w(n)}},Mt=e=>{it[e]||(e=Object.keys(it).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)})[0]||e);let t=it[e]?Object.keys(it[e]):[];tt(t.map(e=>({value:e,label:e})));let n=t.includes(u)?u:t[0]||``;if(n&&it[e]&&it[e][n]){let[t,r]=it[e][n].split(/[×x]/);T(Number(t)),E(Number(r)),C(n),w(e)}},Nt=()=>{T(p),E(f)},Pt=v?.video?.find(e=>e.id===l),Ft=Pt?.supportsFirstLastFrame??!1,It=Pt?.supportsUniversalReference??!0,Lt=e=>{e===`first_last_frame`&&!Ft||e===`universal`&&!It||(U(e),ie(!1),P([]),M(``))},Rt=()=>{let e=W;ee(G),te(e)},zt=()=>{ee(null),te(null)},Bt=()=>{te(null)},Vt=async()=>{let t=c===`video`&&H===`first_last_frame`;if(t){if(!y.trim()){e.warning(`请输入内容`);return}}else if(!y.trim()&&N.length===0){e.warning(`请输入内容或上传图片/视频`);return}let n;t?(n=[],W&&n.push({...W,role:`first_frame`}),G&&n.push({...G,role:`last_frame`}),n.length===0&&(n=void 0)):n=N.length>0?N.map(e=>{if(e.type===`image`){let{duration:t,...n}=e;return n}return e}):void 0,console.log(n);let r={id:``,gen_type:c,original_prompt:y.trim(),engine_id:l,idempotency_key:new Date().toLocaleString(`zh-CN`),media_references:n,...c===`image`&&{image_size:d,image_proportion:u,image_px:f+`x`+p},...c===`video`&&{duration:m,aspect_ratio:h,resolution:g}};V(!0),Sie(r).then(()=>{M(``),P([]),ee(null),te(null);let e={...wt,page:1};Tt(e),r7(e).then(e=>{Ct(t=>[...t,e.items[e.items.length-1]]),Dt(e.total),setTimeout(()=>{_t.current?.scrollIntoView({behavior:`smooth`})},100)}).catch(e=>{})}).catch(t=>{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),e.error({content:n,duration:3})}).finally(()=>{V(!1)}),setTimeout(()=>{V(!1)},3e3)},Ht=async()=>{if(St.length>=Et)return;let e=vt.current;if(!e)return;let t=e.scrollTop,n=e.scrollHeight;kt(!0);try{let r=wt.page+1,i=await r7({...wt,page:r}),a=Array.isArray(i)?{items:i,total:i.length}:i;a.total&&Dt(a.total),Tt(e=>({...e,page:r})),Ct(e=>{let t=new Set(e.map(e=>e.id));return[...a.items.filter(e=>!e.id||t.has(e.id)?!1:(t.add(e.id),!0)),...e]}),setTimeout(()=>{e.scrollTop=t+(e.scrollHeight-n)},200)}catch{}finally{kt(!1)}},Ut=e=>new Promise((t,n)=>{let r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{window.URL.revokeObjectURL(r.src),t(r.duration)},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法获取视频时长`))},r.src=URL.createObjectURL(e)}),Wt=e=>new Promise((t,n)=>{let r=document.createElement(`audio`);r.preload=`metadata`,r.onloadedmetadata=()=>{URL.revokeObjectURL(r.src),t(r.duration)},r.onerror=()=>{URL.revokeObjectURL(r.src),n(Error(`无法获取音频时长`))},r.src=URL.createObjectURL(e)}),Gt=e=>{let t=e.startsWith(`http`)?e:`http://ceshi.apiforeign.minzhong.cn${e}`;if(ze===t){let e=document.getElementById(`audio-player`);e&&e.pause(),Be(null)}else Be(t)},Kt=e=>new Promise((t,n)=>{let r=new Image;r.onload=()=>{window.URL.revokeObjectURL(r.src),t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法读取图片尺寸`))},r.src=URL.createObjectURL(e)}),qt=e=>new Promise((t,n)=>{let r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{window.URL.revokeObjectURL(r.src),t({width:r.videoWidth,height:r.videoHeight,duration:r.duration})},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法读取视频尺寸`))},r.src=URL.createObjectURL(e)}),Jt=(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},Yt=async(t,n)=>{let r=t.type.startsWith(`image/`),i=t.type.startsWith(`video/`);if(c===`video`&&H===`first_last_frame`){if(!r)return e.error(`首尾帧模式仅支持上传图片`),!1;if(t.size/1024/1024>10)return e.error(`图片大小不能超过10MB`),!1;try{let{width:n,height:r}=await Kt(t),i=Jt(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let i=n||ne;if(!i)return e.error(`请选择首帧或尾帧上传位置`),!1;z(!0);try{let n=await U5(t),r={name:t.name,type:`image`,url:n.url,role:i===`first`?`first_frame`:`last_frame`};i===`first`?ee(r):te(r),e.success(`图片上传成功`)}catch{e.error(`上传失败`)}finally{z(!1),K(null)}return!1}let a=t.type.startsWith(`audio/`);if(!r&&!i&&!a)return e.error(`仅支持图片、视频或音频文件`),!1;if(a){let n=t.name.split(`.`).pop()?.toLowerCase();if(![`wav`,`mp3`].includes(n||``))return e.error(`音频仅支持wav和mp3格式`),!1}if(c===`image`&&(i||a))return e.error(`图片模式仅支持上传图片`),!1;if(a&&c!==`video`)return e.error(`仅视频模式支持上传音频`),!1;let o=i?100:a?50:10,s=i?`视频`:a?`音频`:`图片`;if(t.size/1024/1024>o)return e.error(`${s}大小不能超过${o}MB`),!1;if(r)try{let{width:n,height:r}=await Kt(t),i=Jt(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let l=N.filter(e=>e.type===`image`).length;if(r&&l>=bn)return e.error(`该引擎最多上传${bn}张图片`),!1;let u=N.filter(e=>e.type===`video`).length;if(i&&u>=xn)return e.error(`该引擎最多上传${xn}个视频`),!1;let d=N.filter(e=>e.type===`audio`).length;if(a&&d>=Sn)return e.error(`该引擎最多上传${Sn}个音频`),!1;let f=0,p=0;if(i)try{if(f=await Ut(t),f<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=N.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n+f>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${(n+f).toFixed(1)} 秒`),!1;let{width:r,height:i}=await qt(t),a=Jt(r,i);if(a)return e.error(a),!1}catch{return e.error(`无法获取视频信息,请检查文件是否损坏`),!1}if(a)try{if(p=await Wt(t),p<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=N.filter(e=>e.type===`audio`).reduce((e,t)=>e+(t.duration||0),0);if(n+p>15)return e.error(`所有音频素材总时长不能超过 15 秒,当前 ${(n+p).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取音频信息,请检查文件是否损坏`),!1}z(!0);try{let e;e=r?await U5(t):a?await H5(t,p):await W5(t,f);let n=r?`image`:a?`audio`:`video`,o=[...N,{name:t.name,type:n,url:e.url,label:``,...i&&{duration:f},...a&&{duration:p}}],s=ve(o);P(o.map((e,t)=>({...e,label:s[t]})))}catch{e.error(`上传失败`)}finally{z(!1)}return!1},Xt=async t=>{let n=t.type.startsWith(`image/`),r=t.type.startsWith(`video/`),i=t.type.startsWith(`audio/`);if(!n&&!r&&!i)return e.error(`仅支持图片、视频或音频文件`),!1;let a=r?100:i?50:10;if(t.size/1024/1024>a)return e.error(`${r?`视频`:i?`音频`:`图片`}大小不能超过${a}MB`),!1;if(i){let n=t.name.split(`.`).pop()?.toLowerCase();if(![`wav`,`mp3`].includes(n||``))return e.error(`音频仅支持wav和mp3格式`),!1}if(n)try{let{width:n,height:r}=await Kt(t),i=Jt(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let o=0,s=0;if(r)try{if(o=await Ut(t),o<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=L7.getState().currentMedia.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n+o>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${(n+o).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取视频信息,请检查文件是否损坏`),!1}if(i)try{if(s=await Wt(t),s<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=L7.getState().currentMedia.filter(e=>e.type===`audio`).reduce((e,t)=>e+(t.duration||0),0);if(n+s>15)return e.error(`所有音频素材总时长不能超过 15 秒,当前 ${(n+s).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取音频信息,请检查文件是否损坏`),!1}let c=n?`image`:i?`audio`:`video`,l={name:t.name,type:c,url:``,label:``,...r&&{duration:o},...i&&{duration:s}},u=L7.getState().currentMedia;if(!$t(u,[l]))return!1;try{let e;return e=n?await U5(t):i?await H5(t,s):await W5(t,o),{name:l.name,type:l.type,url:e.url,label:l.label||``,...l.duration!==void 0&&{duration:l.duration}}}catch{return e.error(`上传失败`),!1}},Zt=async t=>{let n=0,r=0;z(!0);for(let e of t){let t=await Xt(e);if(t){let e=[...L7.getState().currentMedia,t],r=ve(e);P(e.map((e,t)=>({...e,label:r[t]}))),n++}else r++}z(!1),n>0&&e.success(`成功上传${n}个文件${r>0?`,${r}个文件上传失败`:``}`)},Qt=(e,t)=>e.filter(e=>e.type===t).reduce((e,t)=>e+(Number(t.duration)||0),0),$t=(t,n)=>{if(!n.length)return!1;if(c===`image`&&n.some(e=>e.type!==`image`))return e.error(`图片模式仅支持添加图片素材`),!1;if(n.some(e=>e.type===`audio`)&&c!==`video`)return e.error(`仅视频模式支持添加音频素材`),!1;let r=t.filter(e=>e.type===`image`).length,i=t.filter(e=>e.type===`video`).length,a=t.filter(e=>e.type===`audio`).length,o=n.filter(e=>e.type===`image`).length,s=n.filter(e=>e.type===`video`).length,l=n.filter(e=>e.type===`audio`).length;if(r+o>bn)return e.error(`该引擎最多上传${bn}张图片,当前还能添加 ${Math.max(0,bn-r)} 张`),!1;if(i+s>xn)return e.error(`该引擎最多上传${xn}个视频,当前还能添加 ${Math.max(0,xn-i)} 个`),!1;if(a+l>Sn)return e.error(`该引擎最多上传${Sn}个音频,当前还能添加 ${Math.max(0,Sn-a)} 个`),!1;for(let t of n){if(t.type!==`video`)continue;let n=Number(t.duration);if(!Number.isFinite(n)||n<=0)return e.error(`${t.name||`视频素材`}缺少视频秒数,不能用于 AI 创作`),!1;if(n<2)return e.error(`${t.name||`视频素材`}最短不能少于 2 秒`),!1;if(n>15)return e.error(`${t.name||`视频素材`}最长不能超过 15 秒`),!1}let u=Qt(t,`video`)+Qt(n,`video`);if(u>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${u.toFixed(1)} 秒`),!1;let d=Qt(t,`audio`)+Qt(n,`audio`);return d>15?(e.error(`所有音频素材总时长不能超过 15 秒,当前 ${d.toFixed(1)} 秒`),!1):!0},en=t=>{let n=t.mediaReference,r=n?.type||t.resourceType,i=n?.url||t.resourceUrl||t.displayUrl||t.previewUrl||``;if(!i)return e.error(`${t.fileName||t.id} 缺少素材地址,不能用于 AI 创作`),null;if(r===`audio`&&c!==`video`)return e.error(`仅视频模式支持添加音频素材`),null;let a=Number(n?.duration??t.durationSeconds);return{name:n?.name||t.fileName||t.id,type:r,url:i,source:`upload_resource`,upload_resource_id:t.id,label:``,...(r===`video`||r===`audio`)&&Number.isFinite(a)&&a>0?{duration:a}:{}}},tn=t=>{let n=t.map(en).filter(Boolean);if(!n.length)return;let r=L7.getState().currentMedia;if(!$t(r,n))return;let i=[...r,...n],a=ve(i);P(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个历史上传素材参考`)},nn=t=>{if(t.assetType===`Audio`)return e.error(`音频私域素材暂不支持用于 AI 创作`),null;let n=t.assetType===`Video`?`video`:`image`,r=oe===`aigc_virtual`?`虚拟素材`:`真人素材`,i=n===`video`?t.videoCoverUrl||t.previewUrl||t.displayUrl||t.providerUrl||``:t.previewUrl||t.displayUrl||t.videoCoverUrl||t.providerUrl||``;return{name:t.name||r,type:n,url:i,source:`private_portrait_asset`,private_asset_id:t.id,label:``,...n===`video`&&{duration:Number(t.videoDuration)||void 0}}},rn=e=>{se(e),q(!0)},an=t=>{let n=t.map(nn).filter(Boolean),r=L7.getState().currentMedia;if(!$t(r,n))return;let i=[...r,...n],a=ve(i);P(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个${oe===`aigc_virtual`?`虚拟`:`真人`}素材参考`)},on=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,sn=e=>{let t=N.filter((t,n)=>n!==e),n=ve(t);P(t.map((e,t)=>({...e,label:n[t]})))},cn=(e,t)=>{let n=e.selectionStart;return t.slice(0,n).match(/@([^@\s]*)$/)&&N.length>0?(me(!0),!0):(me(!1),!1)},ln=e=>{let t=e.target.value;M(t);let n=e.target;cn(n,t)},un=e=>{pe&&e.key===`Escape`&&me(!1)},dn=e=>{let t=he.current?.resizableTextArea?.textArea;if(!t)return;let n=t.selectionStart,r=y.slice(0,n),i=y.slice(n),a=r.lastIndexOf(`@`);if(a===-1){me(!1);return}M(r.slice(0,a)+`@${e} `+i),me(!1),setTimeout(()=>{let n=a+e.length+2;t.focus(),t.setSelectionRange(n,n)},0)},fn=()=>{be(!1),Se(``),Te.current&&Te.current.pause()},pn=e=>{if(e.preventDefault(),e.stopPropagation(),!xe)return;let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${xe}&download=1`,t.download=Ce===`image`?`image.png`:`video.mp4`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},mn=e=>{let t=String(e?.type||``).toLowerCase(),n=String(e?.url||e?.name||``).toLowerCase();return t.includes(`video`)||/\.(mp4|mov|avi|webm|m4v)(\?|$)/.test(n)?`video`:t.includes(`audio`)||/\.(mp3|wav|ogg|aac|m4a)(\?|$)/.test(n)?`audio`:`image`},hn=e=>e?/^https?:\/\//i.test(e)?e:`http://ceshi.apiforeign.minzhong.cn${e}`:``,gn=e=>{e?.url&&(Ne(e.url),Fe(mn(e)),Le(e.name||`附件`),je(!0))},_n=c===`video`&&H===`first_last_frame`,vn=!R&&(_n?!!(y.trim()||W):!!(y.trim()||N.length>0)),yn=c===`image`?`输入画面描述,或上传图片参考风格、构图、主体与光影。例:@图片1 参考色调,生成一张简洁高级的产品海报。`:_n?`首帧尾帧可以不传,如需传入建议描述首帧到尾帧的主体动作、镜头运动、节奏与转场。例:从首帧自然推进到尾帧,产品居中突出,动作平滑连贯。`:`上传最多12个参考素材,输入文字或 @ 引用参考内容,自由组合图、文、视频。例:@图片1 模仿 @视频1 的动作。`,bn=I,xn=L,Sn=F?.maxAudioCount??1;return(0,$.jsxs)(uG,{className:`ai-create-page`,style:{margin:`-24px -32px -32px`,borderRadius:22,height:`calc(100vh - 34px)`,background:`#fff`,overflow:`hidden`},children:[(0,$.jsx)(`audio`,{id:`audio-player`,src:ze||null,autoPlay:!0,onEnded:()=>Be(null),style:{display:`none`}}),!1,(0,$.jsxs)(uG,{style:{display:`flex`,flex:1,background:`#fff`},children:[(0,$.jsx)(`div`,{className:`animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`16px 24px`,borderRadius:22,background:`rgb(255, 255, 255)`,backdropFilter:`blur(22px)`,border:`1px solid rgba(231, 234, 240, 0.82)`,position:`relative`,overflow:`hidden`,flexWrap:`wrap`,gap:12},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(`div`,{style:{width:`15%`,height:1,background:`linear-gradient(90deg, transparent, rgba(117,106,136,0.18), rgba(232,227,236,0.48), transparent)`,borderRadius:1}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0,textAlign:`center`},children:[(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:700,color:`#8b5cf6`,letterSpacing:.4},children:`AI创作`}),(0,$.jsx)(`p`,{style:{fontSize:13,color:`#667085`,margin:`4px 0 0 0`},children:`输入想法、剧本或上传参考,智能生成视频/图片`})]}),(0,$.jsx)(`div`,{style:{width:`15%`,height:1,background:`linear-gradient(90deg, transparent, rgba(232,227,236,0.48), rgba(117,106,136,0.18), transparent)`,borderRadius:1}})]})}),(0,$.jsxs)(Ooe,{style:{flex:1,margin:0,padding:`20px 24px 22px`,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,overflow:`hidden`,minHeight:0},children:[St.length===0&&(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`},children:[(0,$.jsx)(`div`,{style:{width:80,height:80,borderRadius:50,background:`linear-gradient(135deg, #8b5cf6 0%, #ddd6fe 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,marginBottom:16},children:(0,$.jsx)(w8,{style:{fontSize:40,color:`#fff`}})}),(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:500,color:`#2f3440`},children:`你好,想创作什么?`}),(0,$.jsx)(`p`,{style:{margin:8,fontSize:13,color:`#98a2b3`},children:`输入想法、剧本或上传参考,开始你的创作之旅`})]}),St.length>0&&(0,$.jsxs)(`div`,{ref:vt,className:`ai-create-scroll`,style:{flex:1,overflowY:`auto`,paddingRight:10,paddingBottom:18,background:`#fff`},onScroll:e=>{let t=e.currentTarget;!(Date.now()-xt.current<500)&&bt.current&&t.scrollTop<=50&&!Ot&&St.length{let e=Z;return St.map(t=>(0,$.jsx)(`div`,{style:{width:`100%`,display:`flex`,justifyContent:`flex-start`,marginBottom:16},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:36,height:36,borderRadius:12,background:`linear-gradient(135deg, #8b5cf6 0%, #ddd6fe 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(w8,{style:{color:`#fff`,fontSize:16}})}),(0,$.jsx)(`div`,{style:{flex:1},children:(0,$.jsxs)(`div`,{style:{background:`rgba(255, 255, 255, 0.92)`,backdropFilter:`blur(18px)`,borderRadius:`22px`,padding:`14px 16px`,width:`70%`,minWidth:500,boxSizing:`border-box`,boxShadow:`0 18px 50px rgba(47, 52, 64, 0.075)`,position:`relative`,border:`1px solid rgba(231, 234, 240, 0.9)`},children:[(0,$.jsxs)(`div`,{style:{margin:4,fontSize:11,color:`#98a2b3`,textAlign:`left`,display:`flex`,flexWrap:`wrap`,gap:8,alignItems:`center`},children:[(0,$.jsx)(`span`,{children:t.createdAt?.replace(`T`,` `).split(`.`)[0]}),(0,$.jsx)(`span`,{style:{background:(t.genType,`rgba(139, 92, 246, 0.10)`),color:(t.genType,`#8b5cf6`),padding:`2px 8px`,borderRadius:12,fontWeight:500,fontSize:11,marginLeft:8},children:t.genType===`image`?`图片生成`:`视频生成`})]}),t.mediaReferences&&t.mediaReferences.length>0&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,zIndex:100},children:(0,$.jsx)(`span`,{style:{padding:`4px 12px`,borderRadius:16,color:`#8b5cf6`,cursor:`pointer`,fontWeight:500,border:`1px solid rgba(139, 92, 246, 0.2)`,background:`rgba(139, 92, 246, 0.04)`},onClick:e=>{e.stopPropagation();let n=e.currentTarget.getBoundingClientRect();Ye({x:n.left,y:n.top-10}),qe(t.id),We(!0)},children:`附件详情`})}),(0,$.jsxs)(`div`,{style:{position:`absolute`,bottom:8,right:8,zIndex:100,display:`flex`,gap:6},children:[(0,$.jsxs)(`button`,{onClick:n=>{if(n.stopPropagation(),M(t.originalPrompt||``),t.mediaReferences&&t.mediaReferences.length>0)if(t.mediaReferences.some(e=>e.role===`first_frame`||e.role===`last_frame`)&&t.genType===`video`){let e=t.mediaReferences.find(e=>e.role===`first_frame`),n=t.mediaReferences.find(e=>e.role===`last_frame`);ee(e?{...e,label:e.label||``}:null),te(n?{...n,label:n.label||``}:null),P([]),U(`first_last_frame`)}else P(t.mediaReferences.map(e=>({name:e.name,type:e.type,url:e.url,label:e.label||``,role:e.role}))),ee(null),te(null),U(`universal`);else P([]),ee(null),te(null);e.success(`已加载到编辑区`)},style:{height:28,padding:`0 10px`,borderRadius:10,border:`none`,background:`rgba(139, 92, 246, 0.08)`,color:`#8b5cf6`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`,gap:4,fontSize:12},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.15)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.08)`},children:[(0,$.jsx)(Uq,{style:{fontSize:12}}),`重新编辑`]}),(0,$.jsx)(LK,{title:`确定要删除吗?`,onConfirm:async()=>{try{await wie(t.id),e.success(`删除成功`),Ct(e=>e.filter(e=>e.id!==t.id)),Dt(e=>e-1)}catch(t){let n=t?.response?.data?.message||t?.message||`删除失败`;e.error(n)}},okText:`确定`,cancelText:`取消`,children:(0,$.jsxs)(`button`,{onClick:e=>e.stopPropagation(),style:{height:28,padding:`0 10px`,borderRadius:10,border:`none`,background:`rgba(139, 92, 246, 0.08)`,color:`#8b5cf6`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`,gap:4,fontSize:12},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(164, 91, 91, 0.1)`,e.currentTarget.style.color=`#A45B5B`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.08)`,e.currentTarget.style.color=`#8b5cf6`},children:[(0,$.jsx)(k$,{style:{fontSize:12}}),`删除`]})})]}),(t.status===`generating`||t.status===`failed`||t.status===`completed`)&&(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginBottom:16,marginTop:16,width:`100%`,alignItems:`flex-start`},children:[(0,$.jsx)(`div`,{style:{width:`50%`,overflow:`hidden`,borderRadius:12,position:`relative`,height:220,border:`1px solid #E7EAF0`,boxShadow:`0 4px 12px rgba(139, 92, 246, 0.08)`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #ffffff 0%, #FAFBFC 100%)`},children:t.status===`generating`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:12,left:12,display:`flex`,alignItems:`center`,gap:8,zIndex:2}}),(0,$.jsx)(`div`,{style:{position:`absolute`,inset:0,background:`linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%)`,animation:`shimmer 2s infinite`}}),(0,$.jsxs)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:16},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:`50%`,background:`rgba(139, 92, 246, 0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 0 30px rgba(139, 92, 246, 0.2)`},children:(0,$.jsx)(`div`,{style:{width:48,height:48,border:`3px solid #ddd6fe`,borderTopColor:`#8b5cf6`,borderRadius:`50%`,animation:`spin 1s linear infinite`}})}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`生成中...`})]})]}):t.status===`failed`?(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:`50%`,background:`rgba(168, 90, 106, 0.10)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(Ire,{style:{color:`#A45B5B`,fontSize:22}})}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#A45B5B`,fontWeight:620},children:`生成失败(积分已退)`}),t.errorMessage&&(0,$.jsx)(`span`,{style:{fontSize:13,color:`#A45B5B`,textAlign:`center`,padding:`0 8px`,lineHeight:1.5},children:t.errorMessage})]}):(0,$.jsx)($.Fragment,{children:t.genType===`image`?(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn/static${t.imageUrl}&w=300&p=50`,alt:t.name,style:{width:`100%`,height:`100%`,borderRadius:12,objectFit:`contain`,cursor:`pointer`,transition:`transform 0.3s ease`},onClick:()=>{Se(t.imageUrl),we(`image`),be(!0)},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.05)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn/static${t.videoCoverUrl}&w=300&p=50`,alt:t.name,style:{width:`100%`,height:`100%`,borderRadius:12,objectFit:`contain`,cursor:`pointer`,transition:`transform 0.3s ease`},onClick:()=>{Se(t.videoUrl),we(`video`),be(!0)},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.05)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:56,height:56,background:`rgba(47, 52, 64, 0.72)`,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`,boxShadow:`0 10px 24px rgba(47, 52, 64, 0.22)`},children:(0,$.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`#fff`,children:(0,$.jsx)(`path`,{d:`M8 5v14l11-7z`})})})]})})}),(0,$.jsxs)(`div`,{style:{width:`50%`,display:`flex`,flexDirection:`column`,gap:12},children:[(0,$.jsx)(`div`,{style:{background:`#FFFFFF`,borderRadius:12,padding:12,border:`1px solid #E7EAF0`,flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`p`,{style:{width:`100%`,height:150,overflow:`auto`,padding:0,marginTop:0,marginBottom:0,lineHeight:2,color:`#475467`,fontSize:13},children:t.originalPrompt})}),(0,$.jsxs)(`div`,{style:{fontSize:12,color:`#667085`,textAlign:`left`,display:`flex`,flexWrap:`wrap`,gap:12,alignItems:`center`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(`span`,{style:{borderRadius:16,color:`#8b5cf6`,fontWeight:500},children:t.engineSnapshot.name}),(0,$.jsx)(`span`,{style:{borderRadius:16,color:`#667085`},children:t.genType===`image`?`${t.imageProportion||``} · ${t.imagePx||``} · ${t.imageSize||``}`:`${t.duration||``}秒 · ${t.aspectRatio||``} · ${t.resolution||``}`}),(0,$.jsxs)(`span`,{style:{fontSize:14,borderRadius:16,color:`#8b5cf6`},children:[`消耗积分:`,t.creditsCost]})]})]})]})]})})]})},t.id))})(),(0,$.jsx)(`div`,{ref:_t})]}),Ue&&Ge&&(()=>{let e=St.find(e=>e.id===Ge)?.mediaReferences||[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`transparent`,zIndex:9998},onClick:()=>{We(!1),qe(null)}}),(0,$.jsxs)(`div`,{className:`ai-reference-expanded-tray ai-attachment-popover`,style:{position:`fixed`,top:`max(84px, ${Je.y-96}px)`,left:`max(24px, min(${Je.x-250}px, calc(100vw - 456px)))`,width:424,padding:`12px 12px 10px`,borderRadius:18,background:`rgba(255,255,255,0.98)`,border:`1px solid #E7EAF0`,boxShadow:`0 24px 60px rgba(31, 41, 55, 0.12)`,backdropFilter:`blur(18px)`,zIndex:9999,pointerEvents:`auto`},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:10},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:[(0,$.jsx)(`span`,{style:{fontSize:13,color:`#344054`,fontWeight:800},children:`参考附件`}),(0,$.jsx)(`span`,{style:{fontSize:11,color:`#98A2B3`,fontWeight:600},children:`点击素材查看,或直接下载原文件`})]}),(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:(0,$.jsx)(`button`,{onClick:()=>{We(!1),qe(null)},style:{width:26,height:26,borderRadius:`50%`,border:`1px solid transparent`,background:`#F6F7FA`,cursor:`pointer`,color:`#98a2b3`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#EEF1F6`,e.currentTarget.style.color=`#2f3440`},onMouseLeave:e=>{e.currentTarget.style.background=`#F6F7FA`,e.currentTarget.style.color=`#98a2b3`},children:(0,$.jsx)(ju,{style:{fontSize:12}})})})]}),(0,$.jsx)(`div`,{className:`ai-reference-tray-scroll`,style:{display:`flex`,gap:10,overflowX:`auto`,padding:`2px 2px 4px`},children:e.map((e,t)=>{let n=mn(e),r=e.label||(e.role===`first_frame`?`首帧`:e.role===`last_frame`?`尾帧`:`${n===`image`?`图片`:n===`video`?`视频`:`音频`}${t+1}`);return(0,$.jsxs)(`div`,{style:{flex:`0 0 92px`,width:92,borderRadius:16,background:`#FFFFFF`,border:`1px solid #E7EAF0`,boxShadow:`0 8px 18px rgba(31, 41, 55, 0.06)`,padding:7,boxSizing:`border-box`},children:[(0,$.jsx)(`div`,{onClick:t=>{n===`audio`?(t.stopPropagation(),Gt(e.url)):(gn(e),We(!1),qe(null))},style:{position:`relative`,width:`100%`,height:70,borderRadius:12,overflow:`hidden`,cursor:`pointer`,background:`#F7F8FA`,border:`1px solid rgba(231, 234, 240, 0.9)`},children:n===`image`?(0,$.jsx)(`img`,{src:hn(e.url),alt:e.name||r,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):n===`video`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:hn(e.url),muted:!0,playsInline:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(31, 41, 55, 0.08)`},children:(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:`50%`,background:`rgba(47, 52, 64, 0.72)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 8px 18px rgba(31, 41, 55, 0.22)`},children:(0,$.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`#fff`,children:(0,$.jsx)(`path`,{d:`M8 5v14l11-7z`})})})})]}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`},children:ze===(e.url.startsWith(`http`)?e.url:`http://ceshi.apiforeign.minzhong.cn${e.url}`)?(0,$.jsx)(G6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(J2,{style:{fontSize:24,color:`#fff`}})})}),(0,$.jsx)(`div`,{title:e.name||r,style:{marginTop:6,color:`#667085`,fontSize:10,fontWeight:700,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,textAlign:`center`},children:e.name||r}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:5,marginTop:7},children:(0,$.jsx)(`button`,{onClick:()=>{gn(e),We(!1),qe(null)},style:{flex:1,height:24,borderRadius:9,border:`1px solid #E7EAF0`,background:`#F8FAFC`,color:`#8b5cf6`,fontSize:11,fontWeight:700,cursor:`pointer`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#EEF1F6`},onMouseLeave:e=>{e.currentTarget.style.background=`#F8FAFC`},children:`查看`})})]},`${e.url||e.name||t}-${t}`)})})]})]})})(),(0,$.jsxs)(`div`,{style:{position:`relative`,background:`#ffffff`,borderRadius:24,padding:`18px 72px 16px 20px`,boxShadow:`0 22px 64px rgba(31, 41, 55, 0.08), 0 1px 0 rgba(255,255,255,0.98) inset`,transition:`all 0.25s ease`,border:`1px solid rgba(231, 234, 240, 0.78)`,backdropFilter:`blur(24px)`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,gap:18,alignItems:`flex-end`,marginBottom:14},children:[(0,$.jsx)(`div`,{style:{width:_n?220:70,minWidth:_n?220:70,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`flex-start`,paddingTop:2,gap:8},children:c===`video`&&H===`first_last_frame`?(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`stretch`,gap:12,width:`100%`,height:100},children:[(0,$.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,height:100,borderRadius:12,border:`1px solid #E7EAF0`,background:`#ffffff`,boxShadow:`0 6px 16px rgba(47, 52, 64, 0.04)`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,left:10,right:10,display:`flex`,alignItems:`center`,justifyContent:`space-between`,zIndex:2},children:(0,$.jsx)(`span`,{style:{fontSize:11,fontWeight:600,color:`#8b5cf6`,lineHeight:1},children:`首帧(可选)`})}),W?(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64},children:[(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${W.url}`,alt:W.name,onClick:()=>{Ne(W.url),Fe(`image`),Le(W.name),je(!0)},style:{width:`100%`,height:`100%`,objectFit:`cover`,borderRadius:8,cursor:`pointer`,border:`1px solid rgba(139, 92, 246, 0.2)`,boxShadow:`0 3px 10px rgba(47, 52, 64, 0.06)`}}),(0,$.jsx)(`button`,{onClick:zt,style:{position:`absolute`,top:-6,right:-6,width:18,height:18,border:`none`,background:`#A45B5B`,borderRadius:50,cursor:`pointer`,color:`#fff`,fontSize:9,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 4px rgba(164, 91, 91, 0.3)`,zIndex:10},children:(0,$.jsx)(k$,{style:{fontSize:9}})})]}):(0,$.jsx)(G7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&Yt(e[0],`first`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];ee({name:n.fileName||``,type:`image`,url:n.resourceUrl||n.previewUrl||n.displayUrl||``,role:`first_frame`,label:``}),e.success(`成功添加首帧`)}},onPortraitSelect:t=>{if(t.length>0){let n=t[0],r=n.previewUrl||n.displayUrl||n.videoCoverUrl||n.providerUrl||``;ee({name:n.name||`首帧图片`,type:`image`,url:r,role:`first_frame`,label:``}),e.success(`成功添加首帧`)}},uploading:R,children:(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(139, 92, 246, 0.28)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,backgroundColor:`rgba(139, 92, 246, 0.04)`,flexDirection:`column`,gap:4},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#a78bfa`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(139, 92, 246, 0.28)`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.04)`},children:[(0,$.jsx)(mL,{style:{fontSize:18,color:`#8b5cf6`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`上传首帧`})]})})]}),(0,$.jsx)(`button`,{onClick:Rt,disabled:!W||!G,title:`调换首尾帧`,style:{width:32,height:32,alignSelf:`center`,borderRadius:50,border:`1px solid rgba(231, 234, 240, 0.95)`,background:W&&G?`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`:`#F3F5F8`,cursor:W&&G?`pointer`:`not-allowed`,color:W&&G?`#fff`:`#98A2B3`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:W&&G?`0 6px 14px rgba(139, 92, 246, 0.24)`:`none`,transition:`all 0.2s ease`,flexShrink:0},onMouseEnter:e=>{W&&G&&(e.currentTarget.style.transform=`scale(1.06)`)},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:(0,$.jsx)(aW,{style:{fontSize:14}})}),(0,$.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,height:100,borderRadius:12,border:`1px solid #E7EAF0`,background:`#ffffff`,boxShadow:`0 6px 16px rgba(47, 52, 64, 0.04)`,overflow:`hidden`,opacity:W?1:.5},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,left:10,right:10,display:`flex`,alignItems:`center`,justifyContent:`space-between`,zIndex:2},children:(0,$.jsx)(`span`,{style:{fontSize:11,fontWeight:600,color:`#8b5cf6`,lineHeight:1},children:`尾帧`})}),G?(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64},children:[(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${G.url}`,alt:G.name,onClick:()=>{Ne(G.url),Fe(`image`),Le(G.name),je(!0)},style:{width:`100%`,height:`100%`,objectFit:`cover`,borderRadius:8,cursor:`pointer`,border:`1px solid rgba(139, 92, 246, 0.2)`,boxShadow:`0 3px 10px rgba(47, 52, 64, 0.06)`}}),(0,$.jsx)(`button`,{onClick:Bt,style:{position:`absolute`,top:-6,right:-6,width:18,height:18,border:`none`,background:`#A45B5B`,borderRadius:50,cursor:`pointer`,color:`#fff`,fontSize:9,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 4px rgba(164, 91, 91, 0.3)`,zIndex:10},children:(0,$.jsx)(k$,{style:{fontSize:9}})})]}):W?(0,$.jsx)(G7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&Yt(e[0],`last`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];te({name:n.fileName||``,type:`image`,url:n.resourceUrl||n.previewUrl||n.displayUrl||``,role:`last_frame`,label:``}),e.success(`成功添加尾帧`)}},onPortraitSelect:t=>{if(t.length>0){let n=t[0],r=n.previewUrl||n.displayUrl||n.videoCoverUrl||n.providerUrl||``;te({name:n.name||`尾帧图片`,type:`image`,url:r,role:`last_frame`,label:``}),e.success(`成功添加尾帧`)}},uploading:R,children:(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(139, 92, 246, 0.24)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,backgroundColor:`rgba(139, 92, 246, 0.04)`,flexDirection:`column`,gap:4},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#a78bfa`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(139, 92, 246, 0.24)`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.04)`},children:[(0,$.jsx)(mL,{style:{fontSize:18,color:`#8b5cf6`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`上传尾帧`})]})}):(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(226, 232, 240, 0.4)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`not-allowed`,backgroundColor:`rgba(241, 245, 249, 0.5)`,flexDirection:`column`,gap:4},children:[(0,$.jsx)(mL,{style:{fontSize:18,color:`#cbd5e1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#94a3b8`,fontWeight:500},children:`请先上传首帧`})]})]})]}):(0,$.jsx)($.Fragment,{children:!(c===`video`&&H===`first_last_frame`)&&(0,$.jsxs)(`div`,{style:{position:`relative`,width:64,height:72,marginTop:`-10`},onMouseEnter:de,onMouseLeave:fe,children:[N.length===0&&(0,$.jsx)(G7,{accept:c===`image`?`image/*`:`image/*,video/*,audio/*`,onLocalSelect:Zt,onHistorySelect:tn,onPortraitLibrarySelect:e=>{rn(e)},uploading:R,tooltipTitle:c===`image`?`图片${N.filter(e=>e.type===`image`).length}/${I}`:`图片${N.filter(e=>e.type===`image`).length}/${I},
视频${N.filter(e=>e.type===`video`).length}/${L}${Sn>0?`,
音频${N.filter(e=>e.type===`audio`).length}/${Sn}`:``}`,maxImageCount:I,maxVideoCount:L,usedImageCount:N.filter(e=>e.type===`image`).length,usedVideoCount:N.filter(e=>e.type===`video`).length,usedVideoDuration:N.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0),maxVideoDuration:15,maxAudioCount:Sn>0?Sn:void 0,usedAudioCount:N.filter(e=>e.type===`audio`).length,maxAudioDuration:15,usedAudioDuration:N.filter(e=>e.type===`audio`).reduce((e,t)=>e+(t.duration||0),0),children:(0,$.jsx)(`div`,{style:{width:54,height:74,borderRadius:7,border:`1px solid rgba(231, 234, 240, 0.95)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,background:`#f4f4f4`,flexDirection:`column`,gap:5,transform:`rotate(-7deg)`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#D7DDE7`,e.currentTarget.style.background=`#f4f4f4`,e.currentTarget.style.transform=`rotate(0deg) translateY(-2px)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(231, 234, 240, 0.95)`,e.currentTarget.style.background=`#f4f4f4`,e.currentTarget.style.transform=`rotate(-7deg)`},children:R?(0,$.jsx)(Xm,{style:{fontSize:17,color:`#667085`}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mL,{style:{fontSize:18,color:`#667085`,lineHeight:1}}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, 14px)`,columnGap:2,justifyContent:`center`,color:`#344054`,fontSize:12,fontWeight:700,lineHeight:1.05,letterSpacing:0},children:[(0,$.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:1},children:[(0,$.jsx)(`span`,{children:`参`}),(0,$.jsx)(`span`,{children:`考`})]}),(0,$.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:1},children:[(0,$.jsx)(`span`,{children:`内`}),(0,$.jsx)(`span`,{children:`容`})]})]})]})})}),N.length>0&&(0,$.jsx)($.Fragment,{children:N.map((e,t)=>{let n=Math.min(N.length,3)-1-t,r=ce?t*58:t<3?t*6:18,i=ce?!0:t<3;return(0,$.jsx)(`div`,{style:{position:`absolute`,left:r,bottom:0,zIndex:t+1,transition:`all 0.28s cubic-bezier(0.4, 0, 0.2, 1)`,transform:ce?`scale(1) rotate(0deg)`:`scale(${t<3?1-n*.08:0}) rotate(${t<3?-3+t*1.5:0}deg)`,opacity:i?ce?1:1-n*.15:0,pointerEvents:i?`auto`:`none`},children:(0,$.jsxs)(`div`,{style:{position:`relative`,width:52,height:60},children:[e.type===`image`?(0,$.jsx)(`img`,{src:on(e.url),alt:e.name,onClick:()=>{Ne(e.url),Fe(`image`),Le(e.name),je(!0)},style:{width:52,height:60,objectFit:`cover`,borderRadius:10,cursor:`pointer`,border:`1px solid rgba(255,255,255,0.98)`,boxShadow:`0 4px 12px rgba(31,41,55,0.15)`}}):e.type===`video`?(0,$.jsx)(`video`,{src:on(e.url),muted:!0,onClick:()=>{Ne(e.url),Fe(`video`),Le(e.name),je(!0)},style:{width:52,height:60,objectFit:`cover`,borderRadius:10,cursor:`pointer`,border:`1px solid rgba(255,255,255,0.98)`,boxShadow:`0 4px 12px rgba(31,41,55,0.15)`}}):(0,$.jsx)(`div`,{onClick:t=>{t.stopPropagation(),Gt(e.url)},style:{width:52,height:60,objectFit:`cover`,borderRadius:10,cursor:`pointer`,border:`1px solid rgba(255,255,255,0.98)`,boxShadow:`0 4px 12px rgba(31,41,55,0.15)`,background:`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:ze===on(e.url)?(0,$.jsx)(G6,{style:{fontSize:20,color:`#fff`}}):(0,$.jsx)(J2,{style:{fontSize:20,color:`#fff`}})}),(0,$.jsx)(`button`,{onClick:()=>sn(t),style:{position:`absolute`,top:-6,right:-6,width:20,height:20,borderRadius:50,background:`#1f2937`,border:`none`,color:`#fff`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 6px rgba(0,0,0,0.2)`,zIndex:10,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#dc2626`,e.currentTarget.style.transform=`scale(1.1)`},onMouseLeave:e=>{e.currentTarget.style.background=`#1f2937`,e.currentTarget.style.transform=`scale(1)`},children:(0,$.jsx)(k$,{style:{fontSize:10}})})]})},`stack-${t}`)})}),N.length>0&&(0,$.jsx)(G7,{accept:c===`image`?`image/*`:`image/*,video/*,audio/*`,onLocalSelect:Zt,onHistorySelect:tn,onPortraitLibrarySelect:e=>{rn(e)},uploading:R,tooltipTitle:c===`image`?`图片${N.filter(e=>e.type===`image`).length}/${I}`:`图片${N.filter(e=>e.type===`image`).length}/${I},
视频${N.filter(e=>e.type===`video`).length}/${L}${Sn>0?`,
diff --git a/video-gen-app/dist/index.html b/video-gen-app/dist/index.html
index 086270ac..bbac0695 100644
--- a/video-gen-app/dist/index.html
+++ b/video-gen-app/dist/index.html
@@ -28,7 +28,7 @@
}
})();
-
+
diff --git a/video-gen-app/src/pages/CreditRecordsPage.tsx b/video-gen-app/src/pages/CreditRecordsPage.tsx
index d2207dfc..a072a8e8 100644
--- a/video-gen-app/src/pages/CreditRecordsPage.tsx
+++ b/video-gen-app/src/pages/CreditRecordsPage.tsx
@@ -44,7 +44,7 @@ const CreditRecordsPage: React.FC = () => {
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: '#8b5cf6', label: '团队内部', bg: 'rgba(139,92,246,0.1)' },
+ team_internal: { color: '#0958d9', label: '团队内部', bg: 'rgba(139,92,246,0.1)' },
};
const config = typeConfig[text] || { color: '#64748b', label: text, bg: 'rgba(100,116,139,0.1)' };
return (