diff --git a/video-gen-admin/dist/assets/index-cvtLwU6k.js b/video-gen-admin/dist/assets/index-Bq0Cmo9c.js similarity index 96% rename from video-gen-admin/dist/assets/index-cvtLwU6k.js rename to video-gen-admin/dist/assets/index-Bq0Cmo9c.js index 0ebd0bfd..d7eccab5 100644 --- a/video-gen-admin/dist/assets/index-cvtLwU6k.js +++ b/video-gen-admin/dist/assets/index-Bq0Cmo9c.js @@ -543,6 +543,6 @@ MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC...\r MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...\r `,disabled:!i})}),(0,Q.jsx)(X.Item,{name:`alipay_gateway`,label:`网关地址`,children:(0,Q.jsx)(LN,{placeholder:`https://openapi.alipay.com/gateway.do`,size:`large`,disabled:!i})}),(0,Q.jsx)(X.Item,{name:`alipay_notify_url`,label:`回调地址`,children:(0,Q.jsx)(LN,{placeholder:`https://yourdomain.com/api/payments/alipay/callback`,size:`large`,disabled:!i})})]})]})})]}),(0,Q.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,marginTop:24},children:(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(W2,{}),onClick:async()=>{try{let e=await u.validateFields();t(!0),await rVe({payment_mock:String(o),payment_wechat_enabled:String(n),payment_wechat_appid:e.wechat_appid||``,payment_wechat_mch_id:e.wechat_mch_id||``,payment_wechat_private_key:e.wechat_private_key||``,payment_wechat_cert_serial_no:e.wechat_cert_serial_no||``,payment_wechat_api_v3_key:e.wechat_api_v3_key||``,payment_wechat_notify_url:e.wechat_notify_url||``,payment_wechat_public_key:e.wechat_public_key||``,payment_wechat_public_key_id:e.wechat_public_key_id||``,payment_alipay_enabled:String(i),payment_alipay_app_id:e.alipay_app_id||``,payment_alipay_private_key:e.alipay_private_key||``,payment_alipay_public_key:e.alipay_public_key||``,payment_alipay_notify_url:e.alipay_notify_url||``,payment_alipay_gateway:e.alipay_gateway||``,payment_order_timeout:String(e.order_timeout||180)}),yP.success(`支付配置已保存`),d()}catch{yP.error(`保存失败`)}finally{t(!1)}},loading:e,size:`large`,style:{borderRadius:8,minWidth:160,height:44,fontSize:15},children:`保存配置`})})]})},{Option:U5}=Sb,{RangePicker:sUe}=cM,cUe=()=>{let[e,t]=(0,C.useState)(!1),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(1),[o,s]=(0,C.useState)(10),[c,l]=(0,C.useState)(0),[u,d]=(0,C.useState)({startDate:(0,QS.default)().format(`YYYY-MM-DD`),endDate:(0,QS.default)().format(`YYYY-MM-DD`)}),f=async()=>{try{t(!0);let[e,n]=await Promise.all([iVe(u),aVe({...u,page:i,pageSize:o})]);r({...e,recent:n.items||[]}),l(n.total)}catch{yP.error(`加载支付统计失败`)}finally{t(!1)}};(0,C.useEffect)(()=>{f()},[u,i,o]);let p=(e,t)=>{a(e),s(t)},m=()=>{d({startDate:(0,QS.default)().format(`YYYY-MM-DD`),endDate:(0,QS.default)().format(`YYYY-MM-DD`)})},h=async e=>{try{t(!0),await oVe(e),yP.success(`退款成功`),await f()}catch(e){yP.error(e?.response?.data?.detail||`退款失败`)}finally{t(!1)}},g=e=>{e&&e.length===2&&d(t=>({...t,startDate:e[0].format(`YYYY-MM-DD`),endDate:e[1].format(`YYYY-MM-DD`)}))},_={paid:{color:`green`,label:`已支付`,icon:(0,Q.jsx)(IK,{})},pending:{color:`gold`,label:`待支付`,icon:(0,Q.jsx)(iM,{})},cancelled:{color:`default`,label:`已取消`,icon:(0,Q.jsx)(cq,{})},refunded:{color:`red`,label:`已退款`,icon:(0,Q.jsx)(x6,{})}},v={alipay:{color:`blue`,label:`支付宝`},wechat:{color:`green`,label:`微信`}},y=[{title:`订单号`,dataIndex:`orderNo`,key:`orderNo`,width:200},{title:`用户`,dataIndex:`username`,key:`username`,width:120},{title:`支付方式`,dataIndex:`paymentMethod`,key:`paymentMethod`,width:100,render:e=>{let t=v[e]||{color:`default`,label:e};return(0,Q.jsx)(xR,{color:t.color,children:t.label})}},{title:`金额`,dataIndex:`amount`,key:`amount`,width:100,render:e=>(0,Q.jsxs)(Z.Text,{strong:!0,style:{color:`#10b981`},children:[`¥`,e.toFixed(2)]})},{title:`积分`,dataIndex:`credits`,key:`credits`,width:80},{title:`状态`,dataIndex:`status`,key:`status`,width:100,render:e=>{let t=_[e]||{color:`default`,label:e,icon:null};return(0,Q.jsx)(xR,{color:t.color,icon:t.icon,children:t.label})}},{title:`支付宝交易号`,dataIndex:`tradeNo`,key:`tradeNo`,width:200,render:e=>e||`-`},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,width:160,render:e=>(0,Q.jsx)(`span`,{className:`date-display`,style:{color:`#94a3b8`},children:e?E5(e):`-`})},{title:`支付时间`,dataIndex:`paidAt`,key:`paidAt`,width:160,render:e=>(0,Q.jsx)(`span`,{className:`date-display`,style:{color:`#94a3b8`},children:e?E5(e):`-`})},{title:`操作`,key:`action`,width:120,render:(e,t)=>t.status===`paid`?(0,Q.jsx)(wP,{title:`确认要退款该订单吗?`,description:`退款后积分会扣除,金额会原路返回`,onConfirm:()=>h(t.orderNo),okText:`确认`,cancelText:`取消`,children:(0,Q.jsx)(XS,{type:`link`,danger:!0,size:`small`,icon:(0,Q.jsx)(x6,{}),children:`退款`})}):null}];if(!n)return(0,Q.jsx)(`div`,{style:{padding:24,color:`#94a3b8`},children:`加载中…`});let b=n.byStatus?.paid||{count:0,amount:0},x=n.byStatus?.pending||{count:0,amount:0},S=n.byStatus?.cancelled||{count:0,amount:0},w=n.byStatus?.refunded||{count:0,amount:0},T=b.count+x.count+S.count+w.count,E=n.month||{count:0,amount:0};return(0,Q.jsx)($p,{locale:N8.default,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(BP,{gutter:[16,16],style:{marginBottom:24},children:[(0,Q.jsx)(nj,{xs:24,sm:12,lg:12,children:(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsx)(UP,{title:`今日收入`,value:n.today.paidAmount,precision:2,prefix:(0,Q.jsx)(ZJ,{style:{color:`#10b981`}}),suffix:`元`,valueStyle:{color:`#10b981`,fontWeight:700}}),(0,Q.jsxs)(Z.Text,{type:`secondary`,style:{fontSize:12},children:[n.today.paidCount,` 笔订单`]})]})}),(0,Q.jsx)(nj,{xs:24,sm:12,lg:12,children:(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsx)(UP,{title:`本月累计`,value:E.paidAmount,precision:2,prefix:(0,Q.jsx)(ZJ,{style:{color:`#6366f1`}}),suffix:`元`,valueStyle:{color:`#6366f1`,fontWeight:700}}),(0,Q.jsxs)(Z.Text,{type:`secondary`,style:{fontSize:12},children:[E.paidCount,` 笔订单`]})]})})]}),(0,Q.jsx)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`,marginBottom:16},title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(ZJ,{}),`订单状态分布`]}),children:(0,Q.jsx)(BP,{gutter:16,children:[`paid`,`pending`,`cancelled`,`refunded`].map(e=>{let t=n.byStatus?.[e]||{count:0,amount:0},r=_[e],i=T>0?(t.count/T*100).toFixed(1):`0.0`;return(0,Q.jsx)(nj,{span:6,children:(0,Q.jsxs)(`div`,{style:{padding:16,borderRadius:10,background:`#fafbff`,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(xR,{color:r.color,icon:r.icon,children:r.label}),(0,Q.jsxs)(Z.Text,{type:`secondary`,style:{fontSize:12},children:[i,`%`]})]}),(0,Q.jsxs)(`div`,{style:{marginTop:8,fontSize:20,fontWeight:700},children:[t.count,` `,(0,Q.jsx)(`span`,{style:{fontSize:13,color:`#94a3b8`,fontWeight:400},children:`笔`})]}),(0,Q.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`,marginTop:4},children:[`¥`,t.amount.toFixed(2)]})]})},e)})})}),(0,Q.jsxs)(NA,{bordered:!1,style:{borderRadius:12,border:`1px solid #f0f0f5`},title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(ZJ,{}),`订单列表`]}),children:[(0,Q.jsxs)(BP,{gutter:[16,16],align:`middle`,style:{marginBottom:24},children:[(0,Q.jsxs)(nj,{xs:24,sm:12,md:6,children:[(0,Q.jsx)(`span`,{style:{marginRight:8},children:`支付方式:`}),(0,Q.jsxs)(Sb,{placeholder:`全部`,allowClear:!0,style:{width:150},value:u.paymentMethod,onChange:e=>d(t=>({...t,paymentMethod:e})),children:[(0,Q.jsx)(U5,{value:`alipay`,children:`支付宝`}),(0,Q.jsx)(U5,{value:`wechat`,children:`微信`})]})]}),(0,Q.jsxs)(nj,{xs:24,sm:12,md:6,children:[(0,Q.jsx)(`span`,{style:{marginRight:8},children:`状态:`}),(0,Q.jsxs)(Sb,{placeholder:`全部`,allowClear:!0,style:{width:150},value:u.status,onChange:e=>d(t=>({...t,status:e})),children:[(0,Q.jsx)(U5,{value:`paid`,children:`已支付`}),(0,Q.jsx)(U5,{value:`pending`,children:`待支付`}),(0,Q.jsx)(U5,{value:`cancelled`,children:`已取消`}),(0,Q.jsx)(U5,{value:`refunded`,children:`已退款`})]})]}),(0,Q.jsxs)(nj,{xs:24,sm:12,md:8,children:[(0,Q.jsx)(`span`,{style:{marginRight:8},children:`日期范围:`}),(0,Q.jsx)(sUe,{value:[(0,QS.default)(u.startDate),(0,QS.default)(u.endDate)],onChange:g})]}),(0,Q.jsx)(nj,{xs:24,sm:12,md:4,children:(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:m,children:`重置`})})]}),(0,Q.jsx)(cR,{columns:y,dataSource:n.recent||[],rowKey:`id`,loading:e,pagination:{current:i,pageSize:o,total:c,onChange:p,showSizeChanger:!0,showTotal:e=>`共 ${e} 条`},scroll:{x:1e3},size:`middle`})]})]})})},W5=[{name:`ShoppingCartOutlined`,label:`购物`,component:(0,Q.jsx)(m4,{})},{name:`BookOutlined`,label:`书籍`,component:(0,Q.jsx)(fW,{})},{name:`HomeOutlined`,label:`房产`,component:(0,Q.jsx)(pQ,{})},{name:`FireOutlined`,label:`火`,component:(0,Q.jsx)(WX,{})},{name:`RocketOutlined`,label:`科技`,component:(0,Q.jsx)(M2,{})},{name:`SkinOutlined`,label:`时尚`,component:(0,Q.jsx)(A4,{})},{name:`CompassOutlined`,label:`指南`,component:(0,Q.jsx)(Vq,{})},{name:`HeartOutlined`,label:`健康`,component:(0,Q.jsx)(nQ,{})},{name:`CarOutlined`,label:`汽车`,component:(0,Q.jsx)(oK,{})},{name:`CameraOutlined`,label:`相机`,component:(0,Q.jsx)(ZG,{})},{name:`CloudOutlined`,label:`云`,component:(0,Q.jsx)(gq,{})},{name:`StarOutlined`,label:`星`,component:(0,Q.jsx)(s3,{})},{name:`TrophyOutlined`,label:`奖杯`,component:(0,Q.jsx)(l6,{})},{name:`ThunderboltOutlined`,label:`闪电`,component:(0,Q.jsx)(K3,{})},{name:`BulbOutlined`,label:`灯泡`,component:(0,Q.jsx)(DG,{})},{name:`CoffeeOutlined`,label:`咖啡`,component:(0,Q.jsx)(Fq,{})},{name:`CrownOutlined`,label:`皇冠`,component:(0,Q.jsx)(fJ,{})},{name:`DashboardOutlined`,label:`仪表`,component:(0,Q.jsx)(bJ,{})},{name:`FlagOutlined`,label:`旗帜`,component:(0,Q.jsx)(JX,{})},{name:`GlobalOutlined`,label:`全球`,component:(0,Q.jsx)(RZ,{})},{name:`GiftOutlined`,label:`礼物`,component:(0,Q.jsx)(jZ,{})},{name:`LaptopOutlined`,label:`笔记本`,component:(0,Q.jsx)(QQ,{})},{name:`MobileOutlined`,label:`手机`,component:(0,Q.jsx)(d1,{})},{name:`MonitorOutlined`,label:`显示器`,component:(0,Q.jsx)(_1,{})},{name:`PayCircleOutlined`,label:`支付`,component:(0,Q.jsx)(H1,{})},{name:`PictureOutlined`,label:`图片`,component:(0,Q.jsx)($1,{})},{name:`PlayCircleOutlined`,label:`播放`,component:(0,Q.jsx)(c0,{})},{name:`SafetyOutlined`,label:`安全`,component:(0,Q.jsx)(V2,{})},{name:`ShoppingOutlined`,label:`商店`,component:(0,Q.jsx)(_4,{})},{name:`SmileOutlined`,label:`笑脸`,component:(0,Q.jsx)(W4,{})},{name:`SoundOutlined`,label:`声音`,component:(0,Q.jsx)(t3,{})},{name:`TagOutlined`,label:`标签`,component:(0,Q.jsx)(N3,{})},{name:`TeamOutlined`,label:`团队`,component:(0,Q.jsx)(U3,{})},{name:`ToolOutlined`,label:`工具`,component:(0,Q.jsx)($3,{})},{name:`TruckOutlined`,label:`物流`,component:(0,Q.jsx)(p6,{})},{name:`VideoCameraOutlined`,label:`视频`,component:(0,Q.jsx)($6,{})},{name:`WalletOutlined`,label:`钱包`,component:(0,Q.jsx)(r8,{})},{name:`BankOutlined`,label:`银行`,component:(0,Q.jsx)(hU,{})},{name:`BuildOutlined`,label:`建筑`,component:(0,Q.jsx)(vG,{})},{name:`ExperimentOutlined`,label:`实验`,component:(0,Q.jsx)(PY,{})},{name:`HighlightOutlined`,label:`高亮`,component:(0,Q.jsx)(sQ,{})},{name:`IdcardOutlined`,label:`名片`,component:(0,Q.jsx)(CQ,{})},{name:`MedicineBoxOutlined`,label:`医药`,component:(0,Q.jsx)(L$,{})},{name:`ReadOutlined`,label:`阅读`,component:(0,Q.jsx)(i2,{})},{name:`RestOutlined`,label:`休息`,component:(0,Q.jsx)(_2,{})},{name:`SketchOutlined`,label:`钻石`,component:(0,Q.jsx)(E4,{})},{name:`SolutionOutlined`,label:`方案`,component:(0,Q.jsx)(X4,{})}],lUe=Object.fromEntries(W5.map(e=>[e.name,e.component]));function G5(e){return lUe[e]||(0,Q.jsx)(vH,{})}function uUe(e){try{let t=typeof e==`string`?JSON.parse(e):e;if(!Array.isArray(t))return{skillItems:[],optionGroups:[]};let n=[],r=[];for(let e of t)e&&e.type===`option_group`&&e.name&&Array.isArray(e.options)?r.push({name:e.name,options:e.options}):e&&e.key&&e.label&&n.push({key:e.key,label:e.label});return{skillItems:n,optionGroups:r}}catch{return{skillItems:[],optionGroups:[]}}}var dUe=({value:e,onChange:t})=>{let n=W5.find(t=>t.name===e);return(0,Q.jsx)(AM,{trigger:[`click`],dropdownRender:()=>(0,Q.jsx)(`div`,{style:{background:`#fff`,borderRadius:12,padding:12,width:360,boxShadow:`0 12px 40px rgba(0,0,0,0.15)`,border:`1px solid #f0f0f5`},children:(0,Q.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(8, 1fr)`,gap:4},children:W5.map(n=>(0,Q.jsx)(`div`,{onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),t?.(n.name)},title:n.label,style:{width:40,height:40,borderRadius:8,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,fontSize:18,transition:`all 0.15s`,background:e===n.name?`#6366f1`:`transparent`,color:e===n.name?`#fff`:`#64748b`,border:e===n.name?`none`:`1px solid transparent`},onMouseEnter:t=>{e!==n.name&&(t.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:t=>{e!==n.name&&(t.currentTarget.style.background=`transparent`)},children:n.component},n.name))})}),children:(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,borderRadius:8,border:`1px solid #d9d9d9`,cursor:`pointer`,height:40},children:[e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{style:{fontSize:18,color:`#6366f1`},children:G5(e)}),(0,Q.jsx)(`span`,{style:{color:`#64748b`,fontSize:13},children:n?.label||e})]}):(0,Q.jsx)(`span`,{style:{color:`#bfbfbf`,fontSize:13},children:`选择图标`}),(0,Q.jsx)(mb,{style:{fontSize:10,color:`#bfbfbf`,marginLeft:`auto`}})]})})},fUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)({open:!1,item:null}),[c]=X.useForm(),l=async()=>{r(!0);try{t((await JBe()).map(e=>{let{skillItems:t,optionGroups:n}=uUe(e.skills);return{id:e.id,key:e.key,label:e.label,icon:e.icon||``,description:e.description||``,skills:JSON.stringify(t),optionGroups:n,isActive:e.is_active??e.isActive??!0,sortOrder:e.sort_order??e.sortOrder??0}}))}catch{yP.error(`加载行业配置失败`)}finally{r(!1)}};(0,C.useEffect)(()=>{l()},[]);let u=async()=>{try{let e=await c.validateFields();a(!0);let t=[];e.skills_wentutujie?.trim()&&t.push({type:`skill`,key:`文图理解生成视频提示词`,label:e.skills_wentutujie.trim()}),e.skills_wentutujie_image?.trim()&&t.push({type:`skill`,key:`文图理解生成图片提示词`,label:e.skills_wentutujie_image.trim()});let n=(e.optionGroups||[]).filter(e=>e?.name?.trim()).map(e=>({name:e.name.trim(),options:(e.options||[]).filter(e=>e?.trim())})).filter(e=>e.options.length>0);for(let e of n)t.push({type:`option_group`,name:e.name,options:e.options});let r={key:e.key,label:e.label,icon:e.icon||``,description:e.description||``,skills:t,is_active:e.is_active??!0,sort_order:e.sort_order??0};o.item?.id?(await o5({id:o.item.id,...r}),yP.success(`已更新`)):(await o5(r),yP.success(`已添加`)),s({open:!1,item:null}),c.resetFields(),l()}catch(e){if(e?.errorFields)return;yP.error(e?.message||`保存失败`)}finally{a(!1)}},d=async e=>{try{await YBe(e),yP.success(`已删除`),l()}catch(e){yP.error(e?.message||`删除失败`)}},f=e=>{s({open:!0,item:e||null});let t=``,n=``,r=[];if(e){try{let r=JSON.parse(e.skills);if(Array.isArray(r))for(let e of r)(e.key===`文图理解生成视频提示词`||e.key===`文图理解`)&&(t=e.label||``),e.key===`文图理解生成图片提示词`&&(n=e.label||``)}catch{}r=e.optionGroups.length>0?e.optionGroups:[{name:``,options:[]}]}e?c.setFieldsValue({key:e.key,label:e.label,icon:e.icon||``,description:e.description,skills_wentutujie:t,skills_wentutujie_image:n,optionGroups:r,is_active:e.isActive,sort_order:e.sortOrder}):(c.resetFields(),c.setFieldsValue({is_active:!0,sort_order:0,optionGroups:[{name:``,options:[]}]}))};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(vH,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`行业与技能配置`}),(0,Q.jsxs)(xR,{color:`purple`,children:[e.length,` 个行业`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>f(),style:{borderRadius:8},children:`添加行业`})]}),(0,Q.jsx)(cR,{columns:[{title:`行业`,key:`industry`,width:180,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,Q.jsx)(`div`,{style:{width:36,height:36,borderRadius:10,background:`#f1f5f9`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:18,color:`#6366f1`,flexShrink:0},children:G5(t.icon)}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.label}),(0,Q.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12},children:t.key})]})]})},{title:`描述`,dataIndex:`description`,ellipsis:!0},{title:`选项配置`,key:`optionGroups`,width:260,render:(e,t)=>!t.optionGroups||t.optionGroups.length===0?(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#cbd5e1`},children:`未配置`}):(0,Q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:t.optionGroups.map((e,t)=>(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,Q.jsx)(xR,{color:`blue`,style:{margin:0,fontSize:11},children:e.name}),(0,Q.jsxs)(Z.Text,{style:{fontSize:11,color:`#64748b`},children:[e.options.slice(0,3).join(`、`),e.options.length>3?`...${e.options.length}项`:``]})]},t))})},{title:`文图理解生成视频提示词`,dataIndex:`skills`,ellipsis:!0,render:e=>{try{let t=JSON.parse(e);if(Array.isArray(t)){let e=t.find(e=>e.key===`文图理解生成视频提示词`||e.key===`文图理解`);if(e)return(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{fontSize:12},children:e.label})}}catch{}return(0,Q.jsx)(`span`,{style:{color:`#bfbfbf`},children:`-`})}},{title:`文图理解生成图片提示词`,dataIndex:`skills`,ellipsis:!0,render:e=>{try{let t=JSON.parse(e);if(Array.isArray(t)){let e=t.find(e=>e.key===`文图理解生成图片提示词`);if(e)return(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{fontSize:12},children:e.label})}}catch{}return(0,Q.jsx)(`span`,{style:{color:`#bfbfbf`},children:`-`})}},{title:`状态`,dataIndex:`isActive`,width:80,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>f(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除该行业?`,onConfirm:()=>d(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:900}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(vH,{}),o.item?`编辑行业`:`添加行业`]}),open:o.open,onOk:u,onCancel:()=>{s({open:!1,item:null}),c.resetFields()},okText:`保存`,cancelText:`取消`,width:640,confirmLoading:i,children:(0,Q.jsxs)(X,{form:c,layout:`vertical`,style:{marginTop:16},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`key`,label:`行业标识`,style:{flex:1},rules:[{required:!0,message:`请输入标识`}],children:(0,Q.jsx)(LN,{placeholder:`例如:ecommerce`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`label`,label:`行业名称`,style:{flex:1},rules:[{required:!0,message:`请输入名称`}],children:(0,Q.jsx)(LN,{placeholder:`例如:电商`,size:`large`})})]}),(0,Q.jsx)(X.Item,{name:`icon`,label:`行业图标`,children:(0,Q.jsx)(dUe,{})}),(0,Q.jsx)(X.Item,{name:`description`,label:`行业描述`,children:(0,Q.jsx)(LN.TextArea,{rows:2,placeholder:`行业描述`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`skills_wentutujie`,label:`文图理解生成视频提示词`,extra:`用于LLM优化视频提示词的系统指令,根据行业特点引导AI理解文案与画面的关系`,children:(0,Q.jsx)(LN.TextArea,{rows:3,placeholder:`请输入文图理解生成视频提示词,例如: 你是一位专业的电商视频文案专家,擅长将产品卖点转化为视觉语言`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`skills_wentutujie_image`,label:`文图理解生成图片提示词`,extra:`用于LLM优化图片提示词的系统指令,根据行业特点引导AI理解文案与画面的关系`,children:(0,Q.jsx)(LN.TextArea,{rows:3,placeholder:`请输入文图理解生成图片提示词,例如: -你是一位专业的电商图片文案专家,擅长将产品卖点转化为图片生成提示词`,size:`large`})}),(0,Q.jsxs)(`div`,{style:{marginBottom:8},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:13},children:`行业选项配置`}),(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,marginLeft:8},children:`添加选项组,每组包含名称和多个选项,前台将显示为下拉选择`})]}),(0,Q.jsx)(X.List,{name:`optionGroups`,children:(e,{add:t,remove:n})=>(0,Q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,marginBottom:16},children:[e.map(({key:e,name:t,...r})=>(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`,padding:`10px 12px`,borderRadius:10,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:8},children:[(0,Q.jsx)(X.Item,{...r,name:[t,`name`],label:`选项名称`,style:{marginBottom:0},rules:[{required:!0,message:`请输入选项名称`}],children:(0,Q.jsx)(LN,{placeholder:`例如:视频风格`,size:`middle`,style:{borderRadius:8}})}),(0,Q.jsx)(X.Item,{...r,name:[t,`options`],label:`选项内容`,style:{marginBottom:0},children:(0,Q.jsx)(Sb,{mode:`tags`,size:`middle`,placeholder:`输入选项后回车添加`,style:{borderRadius:8},tokenSeparators:[`,`,`,`,`、`]})})]}),(0,Q.jsx)(a1,{onClick:()=>n(t),style:{color:`#ef4444`,fontSize:16,marginTop:34,cursor:`pointer`,flexShrink:0}})]},e)),(0,Q.jsx)(XS,{type:`dashed`,onClick:()=>t(),block:!0,icon:(0,Q.jsx)(cA,{}),style:{borderRadius:8,height:36},children:`添加选项组`})]})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`is_active`,label:`启用状态`,valuePropName:`checked`,initialValue:!0,style:{flex:1},children:(0,Q.jsx)(aF,{})}),(0,Q.jsx)(X.Item,{name:`sort_order`,label:`排序`,initialValue:0,style:{flex:1},children:(0,Q.jsx)(LN,{type:`number`,size:`large`})})]})]})})]})};function K5(e){if(Array.isArray(e))return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return[]}var pUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)({open:!1,engine:null}),[o]=X.useForm(),s=async()=>{r(!0);try{t((await XBe()).map(e=>({...e,supportedRatios:K5(e.supportedRatios),supportedResolutions:K5(e.supportedResolutions),supportedDurations:K5(e.supportedDurations)})))}catch{yP.error(`加载视频引擎失败`)}finally{r(!1)}};(0,C.useEffect)(()=>{s()},[]);let c=async()=>{try{let e=await o.validateFields(),t={name:e.name,provider:e.provider,api_base:e.apiBase,api_key:e.apiKey,model_name:e.modelName,supported_ratios:JSON.stringify(e.supportedRatios||[]),supported_resolutions:JSON.stringify(e.supportedResolutions||[]),supported_durations:JSON.stringify(e.supportedDurations||[]),max_duration:e.maxDuration??15,max_image_count:e.maxImageCount??2,max_video_count:e.maxVideoCount??0,max_audio_count:e.maxAudioCount??0,supports_first_last_frame:e.supportsFirstLastFrame??!1,supports_universal_reference:e.supportsUniversalReference??!0,is_active:e.isActive??!0,priority:e.priority??0};i.engine?(await s5({id:i.engine.id,...t}),yP.success(`已更新`)):(await s5(t),yP.success(`已添加`)),a({open:!1,engine:null}),o.resetFields(),s()}catch(e){if(e?.errorFields)return;yP.error(e?.message||`保存失败`)}},l=async e=>{try{await ZBe(e),yP.success(`已删除`),s()}catch{yP.error(`删除失败`)}},u=e=>{a({open:!0,engine:e||null}),e?o.setFieldsValue(e):(o.resetFields(),o.setFieldsValue({isActive:!0,priority:0,maxDuration:30,maxImageCount:2,maxVideoCount:0,maxAudioCount:0,supportsFirstLastFrame:!1,supportsUniversalReference:!0,supportedRatios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],supportedResolutions:[`480p`,`720p`,`1080p`],supportedDurations:[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]}))};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(c0,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`视频引擎配置`}),(0,Q.jsxs)(xR,{color:`purple`,children:[e.length,` 个引擎`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>u(),style:{borderRadius:8},children:`添加引擎`})]}),(0,Q.jsx)(cR,{columns:[{title:`引擎名称`,key:`name`,width:180,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,Q.jsx)(`div`,{style:{width:36,height:36,borderRadius:8,background:t.isActive?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`linear-gradient(135deg, #94a3b8, #cbd5e1)`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,fontSize:16},children:(0,Q.jsx)(c0,{})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.name}),(0,Q.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12},children:t.provider})]})]})},{title:`支持比例`,dataIndex:`supportedRatios`,width:200,render:e=>(0,Q.jsx)(OM,{size:2,wrap:!0,children:e.map(e=>(0,Q.jsx)(xR,{children:e},e))})},{title:`支持分辨率`,dataIndex:`supportedResolutions`,width:150,render:e=>(0,Q.jsx)(OM,{size:2,wrap:!0,children:e.map(e=>(0,Q.jsx)(xR,{color:`blue`,children:e},e))})},{title:`支持时长`,dataIndex:`supportedDurations`,width:120,render:e=>(0,Q.jsx)(xR,{color:`orange`,children:e?.length?`${Math.min(...e)}-${Math.max(...e)}s`:`-`})},{title:`最大图片`,dataIndex:`maxImageCount`,width:100,render:e=>(0,Q.jsxs)(xR,{color:`purple`,children:[e,` 张`]})},{title:`最大视频`,dataIndex:`maxVideoCount`,width:100,render:e=>(0,Q.jsxs)(xR,{color:`cyan`,children:[e,` 个`]})},{title:`最大音频`,dataIndex:`maxAudioCount`,width:100,render:e=>(0,Q.jsxs)(xR,{color:e>0?`geekblue`:`default`,children:[e||0,` 段`]})},{title:`首尾帧`,dataIndex:`supportsFirstLastFrame`,width:90,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`default`,children:e?`支持`:`不支持`})},{title:`全能参考`,dataIndex:`supportsUniversalReference`,width:100,render:e=>(0,Q.jsx)(xR,{color:e?`purple`:`default`,children:e?`支持`:`不支持`})},{title:`状态`,dataIndex:`isActive`,width:80,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>u(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除?`,onConfirm:()=>l(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:1200}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(c0,{}),i.engine?`编辑引擎`:`添加引擎`]}),open:i.open,onOk:c,onCancel:()=>{a({open:!1,engine:null}),o.resetFields()},okText:`保存`,cancelText:`取消`,width:620,children:(0,Q.jsxs)(X,{form:o,layout:`vertical`,style:{marginTop:16},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`name`,label:`引擎名称`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(LN,{placeholder:`Seedance 2.0`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`provider`,label:`提供商`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`ark`,label:`火山引擎 (Ark)`}]})})]}),(0,Q.jsx)(X.Item,{name:`apiBase`,label:`API基础地址`,rules:[{required:!0}],children:(0,Q.jsx)(LN,{placeholder:`https://ark.cn-beijing.volces.com/api/v3`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`apiKey`,label:`API Key`,children:(0,Q.jsx)(LN.Password,{placeholder:`sk-****`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`modelName`,label:`模型名称`,children:(0,Q.jsx)(LN,{placeholder:`doubao-seedance-2-0-260128`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`supportedRatios`,label:`支持比例`,children:(0,Q.jsx)(Sb,{mode:`multiple`,size:`large`,options:[{value:`16:9`,label:`16:9 (横屏)`},{value:`4:3`,label:`4:3 (标准)`},{value:`1:1`,label:`1:1 (方形)`},{value:`3:4`,label:`3:4 (竖版)`},{value:`9:16`,label:`9:16 (竖屏)`},{value:`21:9`,label:`21:9 (超宽)`}]})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`supportedResolutions`,label:`支持分辨率`,style:{flex:1},children:(0,Q.jsx)(Sb,{mode:`multiple`,size:`large`,options:[{value:`480p`},{value:`720p`},{value:`1080p`}]})}),(0,Q.jsx)(X.Item,{name:`supportedDurations`,label:`支持时长(秒)`,style:{flex:1},children:(0,Q.jsx)(Sb,{mode:`multiple`,size:`large`,options:Array.from({length:12},(e,t)=>({value:t+4,label:`${t+4}秒`}))})})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`maxDuration`,label:`最大时长(秒)`,style:{flex:1},children:(0,Q.jsx)(LN,{type:`number`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`maxImageCount`,label:`最大图片数量`,style:{flex:1},children:(0,Q.jsx)(LN,{type:`number`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`maxVideoCount`,label:`最大视频数量`,style:{flex:1},children:(0,Q.jsx)(LN,{type:`number`,size:`large`})})]}),(0,Q.jsx)(`div`,{style:{display:`flex`,gap:16},children:(0,Q.jsx)(X.Item,{name:`maxAudioCount`,label:`最大参考音频数`,style:{flex:1},extra:`0 表示不支持音频参考,最大 3 段`,rules:[{validator:(e,t)=>{let n=Number(t??0);return!Number.isInteger(n)||n<0||n>3?Promise.reject(Error(`最大参考音频数必须为 0-3 的整数`)):Promise.resolve()}}],children:(0,Q.jsx)(LN,{type:`number`,size:`large`,min:0,max:3})})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`supportsFirstLastFrame`,label:`首尾帧模式`,valuePropName:`checked`,style:{paddingTop:30,flex:1},children:(0,Q.jsx)(aF,{checkedChildren:`支持`,unCheckedChildren:`不支持`})}),(0,Q.jsx)(X.Item,{name:`supportsUniversalReference`,label:`全能参考模式`,valuePropName:`checked`,style:{paddingTop:30,flex:1},children:(0,Q.jsx)(aF,{checkedChildren:`支持`,unCheckedChildren:`不支持`})}),(0,Q.jsx)(X.Item,{name:`isActive`,label:`启用状态`,valuePropName:`checked`,style:{paddingTop:30,flex:1},children:(0,Q.jsx)(aF,{})})]}),(0,Q.jsx)(`div`,{style:{display:`flex`,gap:16},children:(0,Q.jsx)(X.Item,{name:`priority`,label:`优先级`,style:{flex:1},children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:0,label:`0 (默认)`},{value:1,label:`1`},{value:2,label:`2`},{value:3,label:`3`},{value:5,label:`5`},{value:10,label:`10 (最高)`}]})})})]})})]})};function mUe(e){if(Array.isArray(e))return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return[]}function hUe(e){if(e&&typeof e==`object`&&!Array.isArray(e))return e;if(typeof e==`string`)try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}return{}}var q5={"1K":{"1:1":`1024x1024`,"4:3":`1152x864`,"3:4":`864x1152`,"16:9":`1312x736`,"9:16":`736x1312`,"3:2":`1248x832`,"2:3":`832x1248`,"21:9":`1568x672`},"2K":{"1:1":`2048x2048`,"4:3":`2304x1728`,"3:4":`1728x2304`,"16:9":`2848x1600`,"9:16":`1600x2848`,"3:2":`2496x1664`,"2:3":`1664x2496`,"21:9":`3136x1344`},"4K":{"1:1":`4096x4096`,"4:3":`4704x3520`,"3:4":`3520x4704`,"16:9":`5504x3040`,"9:16":`3040x5504`,"3:2":`4992x3328`,"2:3":`3328x4992`,"21:9":`6197x2656`}},J5=[`1:1`,`4:3`,`3:4`,`16:9`,`9:16`,`3:2`,`2:3`,`21:9`],gUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)({open:!1,engine:null}),[o]=X.useForm(),s=async()=>{r(!0);try{t((await QBe()).map(e=>({...e,supportedModels:mUe(e.supportedModels),supportedSizes:hUe(e.supportedSizes)})))}catch{yP.error(`加载图片引擎失败`)}finally{r(!1)}};(0,C.useEffect)(()=>{s()},[]);let c=async()=>{try{let e=await o.validateFields(),t={};for(let n of[`1K`,`2K`,`4K`]){let r=e[`size_${n}`]||[];if(r.length>0){t[n]={};for(let e of r)t[n][e]=q5[n]?.[e]||e}}let n={name:e.name,provider:e.provider,api_base:e.apiBase,api_key:e.apiKey,model_name:e.modelName,supported_models:JSON.stringify(e.supportedModels||[]),supported_sizes:JSON.stringify(t),default_size:e.defaultSize||`2K`,max_image_count:e.maxImageCount??0,generate_url:e.generateUrl||``,is_active:e.isActive??!0,priority:e.priority??0};i.engine?(await c5({id:i.engine.id,...n}),yP.success(`已更新`)):(await c5(n),yP.success(`已添加`)),a({open:!1,engine:null}),o.resetFields(),s()}catch(e){if(e?.errorFields)return;yP.error(e?.message||`保存失败`)}},l=async e=>{try{await $Be(e),yP.success(`已删除`),s()}catch{yP.error(`删除失败`)}},u=e=>{if(a({open:!0,engine:e||null}),e){let t={};for(let n of[`1K`,`2K`,`4K`])t[`size_${n}`]=Object.keys(e.supportedSizes?.[n]||{});o.setFieldsValue({...e,...t})}else o.resetFields(),o.setFieldsValue({isActive:!0,priority:0,supportedModels:[`doubao-seedream-5-0-260128`],defaultSize:`2K`,maxImageCount:0,size_1K:J5,size_2K:J5,size_4K:J5})};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)($1,{style:{fontSize:18,color:`#10b981`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`图片引擎配置`}),(0,Q.jsxs)(xR,{color:`green`,children:[e.length,` 个引擎`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>u(),style:{borderRadius:8},children:`添加引擎`})]}),(0,Q.jsx)(cR,{columns:[{title:`引擎名称`,key:`name`,width:180,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,Q.jsx)(`div`,{style:{width:36,height:36,borderRadius:8,background:t.isActive?`linear-gradient(135deg, #10b981, #059669)`:`linear-gradient(135deg, #94a3b8, #cbd5e1)`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,fontSize:16},children:(0,Q.jsx)($1,{})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.name}),(0,Q.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12},children:t.modelName})]})]})},{title:`1K 支持比例`,key:`sizes_1k`,width:260,render:(e,t)=>{let n=Object.keys(t.supportedSizes?.[`1K`]||{});return n.length===0?(0,Q.jsx)(`span`,{style:{color:`#bfbfbf`},children:`-`}):(0,Q.jsx)(OM,{size:2,wrap:!0,children:n.map(e=>(0,Q.jsxs)(xR,{color:`green`,children:[e,` `,t.supportedSizes[`1K`][e]]},e))})}},{title:`2K 支持比例`,key:`sizes_2k`,width:260,render:(e,t)=>{let n=Object.keys(t.supportedSizes?.[`2K`]||{});return n.length===0?(0,Q.jsx)(`span`,{style:{color:`#bfbfbf`},children:`-`}):(0,Q.jsx)(OM,{size:2,wrap:!0,children:n.map(e=>(0,Q.jsxs)(xR,{color:`blue`,children:[e,` `,t.supportedSizes[`2K`][e]]},e))})}},{title:`4K 支持比例`,key:`sizes_4k`,width:260,render:(e,t)=>{let n=Object.keys(t.supportedSizes?.[`4K`]||{});return n.length===0?(0,Q.jsx)(`span`,{style:{color:`#bfbfbf`},children:`-`}):(0,Q.jsx)(OM,{size:2,wrap:!0,children:n.map(e=>(0,Q.jsxs)(xR,{color:`purple`,children:[e,` `,t.supportedSizes[`4K`][e]]},e))})}},{title:`最大图片`,dataIndex:`maxImageCount`,width:100,render:e=>(0,Q.jsxs)(xR,{color:`purple`,children:[e,` 张`]})},{title:`状态`,dataIndex:`isActive`,width:80,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>u(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除?`,onConfirm:()=>l(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:1e3}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)($1,{}),i.engine?`编辑引擎`:`添加引擎`]}),open:i.open,onOk:c,onCancel:()=>{a({open:!1,engine:null}),o.resetFields()},okText:`保存`,cancelText:`取消`,width:680,children:(0,Q.jsxs)(X,{form:o,layout:`vertical`,style:{marginTop:16},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`name`,label:`引擎名称`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(LN,{placeholder:`豆包文生图`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`provider`,label:`提供商`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`ark`,label:`火山引擎 (Ark)`}]})})]}),(0,Q.jsx)(X.Item,{name:`apiBase`,label:`API基础地址`,rules:[{required:!0}],children:(0,Q.jsx)(LN,{placeholder:`https://ark.cn-beijing.volces.com/api/v3`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`apiKey`,label:`API Key`,children:(0,Q.jsx)(LN.Password,{placeholder:`sk-****`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`modelName`,label:`默认模型`,children:(0,Q.jsx)(LN,{placeholder:`doubao-seedream-5-0-260128`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`supportedModels`,label:`支持模型列表`,children:(0,Q.jsx)(Sb,{mode:`tags`,size:`large`,placeholder:`输入模型ID后回车添加`,tokenSeparators:[`,`,`,`],options:[{value:`doubao-seedream-5-0-260128`}]})}),(0,Q.jsxs)(`div`,{style:{background:`#f8f9fc`,borderRadius:10,padding:16,marginBottom:8},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:14},children:`尺寸配置`}),(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,marginLeft:8},children:`勾选每个档位支持的比例,前台选择后传对应像素值给SDK`})]}),[`1K`,`2K`,`4K`].map(e=>(0,Q.jsxs)(`div`,{style:{background:`#fafbfc`,borderRadius:10,padding:`12px 16px`,marginBottom:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:13,color:e===`2K`?`#3b82f6`:`#8b5cf6`},children:e}),(0,Q.jsx)(X.Item,{name:`size_${e}`,style:{marginTop:8,marginBottom:0},children:(0,Q.jsx)(XA.Group,{style:{width:`100%`},children:(0,Q.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:`6px 0`},children:J5.map(t=>(0,Q.jsxs)(XA,{value:t,style:{fontSize:12},children:[t,` `,(0,Q.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:11},children:q5[e]?.[t]})]},t))})})})]},e)),(0,Q.jsx)(X.Item,{name:`defaultSize`,label:`默认尺寸档位`,children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`1K`,label:`1K`},{value:`2K`,label:`2K`},{value:`4K`,label:`4K`}]})}),(0,Q.jsx)(X.Item,{name:`maxImageCount`,label:`最大图片数量`,children:(0,Q.jsx)(LN,{type:`number`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`generateUrl`,label:`生成接口地址`,children:(0,Q.jsx)(LN,{placeholder:`https://ark.cn-beijing.volces.com/api/v3/images/generations`,size:`large`})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`priority`,label:`优先级`,children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:0,label:`0 (默认)`},{value:1,label:`1`},{value:2,label:`2`},{value:3,label:`3`},{value:5,label:`5`},{value:10,label:`10 (最高)`}]})}),(0,Q.jsx)(X.Item,{name:`isActive`,label:`启用状态`,valuePropName:`checked`,style:{paddingTop:30},children:(0,Q.jsx)(aF,{})})]})]})})]})},_Ue=[`2K`,`4K`],vUe=[`480p`,`720p`,`1080p`],yUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)([]),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)({open:!1,ratio:null}),[c]=X.useForm(),[l,u]=(0,C.useState)(10),[d,f]=(0,C.useState)(null),[p,m]=(0,C.useState)(!1),h=X.useWatch(`genType`,c)||`video`,g=X.useWatch(`modelConfigId`,c),_=async()=>{a(!0);try{let[e,n,i]=await Promise.all([eVe(),t5(),jVe()]),a=(i?.engine?.image||[]).map(e=>({...e,genType:`image`})),o=(i?.engine?.video||[]).map(e=>({...e,genType:`video`}));t(e),r([...o,...a]);let s=n.find(e=>e.key===`text_credits_per_1000_tokens`);s&&(u(Number(s.value)||10),f({id:s.id}))}catch{yP.error(`加载积分比例失败`)}finally{a(!1)}};(0,C.useEffect)(()=>{_()},[]);let v=(0,C.useMemo)(()=>n.filter(e=>e.genType===h).map(e=>({value:e.id,label:`${e.name}${e.modelName?`(${e.modelName})`:``}`})),[n,h]),y=(0,C.useMemo)(()=>n.find(e=>e.id===g&&e.genType===h),[n,h,g]),b=(0,C.useMemo)(()=>{if(h===`image`){let e=y?.supportedSizes?Object.keys(y.supportedSizes):[];return(e.length?e:_Ue).map(e=>({value:e,label:e}))}let e=y?.supportedResolutions||[];return(e.length?e:vUe).map(e=>({value:e,label:e}))},[h,y]),x=(e,t)=>n.find(n=>n.id===e&&(!t||n.genType===t))?.name||e,S=async()=>{try{let e=await c.validateFields(),t={model_config_id:e.modelConfigId,gen_type:e.genType,resolution:e.resolution,ratio:e.ratio,base_credits:e.baseCredits,per_second_credits:e.genType===`image`?0:e.perSecondCredits||0};e.genType===`video`&&(t.input_video_ratio=e.inputVideoRatio??1,t.input_video_base_credits=e.inputVideoBaseCredits??0,t.input_video_per_second_credits=e.inputVideoPerSecondCredits??0),o.ratio?(await l5({id:o.ratio.id,...t}),yP.success(`已更新`)):(await l5(t),yP.success(`已添加`)),s({open:!1,ratio:null}),c.resetFields(),_()}catch(e){if(e?.errorFields)return;yP.error(e?.message||`保存失败`)}},w=async e=>{try{await tVe(e),yP.success(`已删除`),_()}catch{yP.error(`删除失败`)}},T=async()=>{if(d){m(!0);try{await n5(d.id,String(l)),yP.success(`文字积分费率已更新`)}catch(e){yP.error(e?.message||`保存失败`)}finally{m(!1)}}},E=e=>{s({open:!0,ratio:e||null}),e?c.setFieldsValue({modelConfigId:e.modelConfigId,genType:e.genType===`image`?`image`:`video`,resolution:e.resolution,ratio:e.ratio,baseCredits:e.baseCredits,perSecondCredits:e.perSecondCredits,inputVideoRatio:e.inputVideoRatio,inputVideoBaseCredits:e.inputVideoBaseCredits,inputVideoPerSecondCredits:e.inputVideoPerSecondCredits}):(c.resetFields(),c.setFieldsValue({genType:`video`,ratio:1,baseCredits:60,perSecondCredits:2,inputVideoRatio:1,inputVideoBaseCredits:0,inputVideoPerSecondCredits:.5}))};return(0,Q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(oZ,{style:{fontSize:18,color:`#f59e0b`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`文字积分费率`})]}),(0,Q.jsx)(XS,{type:`primary`,loading:p,onClick:T,style:{borderRadius:8},children:`保存`})]}),(0,Q.jsx)(Z.Text,{type:`secondary`,style:{display:`block`,marginBottom:16,fontSize:13},children:`文字积分计算公式:ceil(总token数 x 费率 / 1000),最低1积分`}),(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,Q.jsx)(Z.Text,{children:`每1000 token消耗积分:`}),(0,Q.jsxs)(OM.Compact,{style:{width:160},children:[(0,Q.jsx)(Ej,{min:0,max:1e3,step:.01,value:l,onChange:e=>u(e||0),size:`large`,style:{width:`100%`}}),(0,Q.jsx)(Z.Text,{children:`积分`})]}),(0,Q.jsxs)(Z.Text,{type:`secondary`,style:{fontSize:12},children:[`示例:1000 token = `,l,` 积分,500 token = `,(500*l/1e3).toFixed(4),` 积分`]})]})]}),(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(IG,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`积分比例配置`}),(0,Q.jsxs)(xR,{color:`purple`,children:[e.length,` 条规则`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>E(),style:{borderRadius:8},children:`添加比例`})]}),(0,Q.jsx)(Z.Text,{type:`secondary`,style:{display:`block`,marginBottom:16,fontSize:13},children:`视频积分公式:(基础积分 + 每秒积分 x 视频时长) x 模型倍率;图片积分公式:基础积分 x 模型倍率`}),(0,Q.jsx)(cR,{columns:[{title:`类型`,dataIndex:`genType`,width:80,render:e=>(0,Q.jsx)(xR,{color:e===`image`?`cyan`:`orange`,children:e===`image`?`图片`:`视频`})},{title:`引擎`,dataIndex:`modelConfigId`,width:180,render:(e,t)=>(0,Q.jsx)(xR,{color:t.genType===`image`?`cyan`:`purple`,children:x(e,t.genType)})},{title:`分辨率/尺寸`,dataIndex:`resolution`,width:110,render:e=>(0,Q.jsx)(xR,{color:{"480p":`blue`,"720p":`blue`,"1080p":`blue`,"4K":`green`,"2K":`green`}[e]||`default`,children:e})},{title:`倍率`,dataIndex:`ratio`,width:100,sorter:(e,t)=>e.ratio-t.ratio,render:e=>(0,Q.jsxs)(Z.Text,{strong:!0,style:{color:e>=2?`#ef4444`:e>=1.5?`#f59e0b`:`#10b981`},children:[`x`,e]})},{title:`基础积分`,dataIndex:`baseCredits`,width:100,render:e=>(0,Q.jsxs)(Z.Text,{children:[e,` 积分`]})},{title:`每秒积分`,dataIndex:`perSecondCredits`,width:100,render:(e,t)=>(0,Q.jsx)(Z.Text,{children:t.genType===`image`?`-`:`${e} 积分/秒`})},{title:`视频倍率`,dataIndex:`inputVideoRatio`,width:100,render:(e,t)=>(0,Q.jsx)(Z.Text,{children:t.genType===`image`?`-`:(0,Q.jsxs)(`span`,{style:{color:e>=2?`#ef4444`:e>=1.5?`#f59e0b`:`#10b981`},children:[`x`,e]})})},{title:`视频基础积分`,dataIndex:`inputVideoBaseCredits`,width:110,render:(e,t)=>(0,Q.jsx)(Z.Text,{children:t.genType===`image`?`-`:`${e} 积分`})},{title:`视频每秒积分`,dataIndex:`inputVideoPerSecondCredits`,width:110,render:(e,t)=>(0,Q.jsx)(Z.Text,{children:t.genType===`image`?`-`:`${e} 积分/秒`})},{title:`示例计算(视频15秒,上传视频15秒)`,key:`example`,width:140,render:(e,t)=>{let n;return t.genType===`image`?n=Math.round(t.baseCredits*t.ratio):(n=Math.round((t.baseCredits+t.perSecondCredits*15)*t.ratio),t.inputVideoRatio&&t.inputVideoPerSecondCredits&&(n+=Math.round((t.inputVideoBaseCredits+t.inputVideoPerSecondCredits*15)*t.inputVideoRatio))),(0,Q.jsxs)(Z.Text,{strong:!0,style:{color:`#6366f1`},children:[n,` 积分`]})}},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>E(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除?`,onConfirm:()=>w(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:i,pagination:!1,scroll:{x:1180}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(IG,{}),o.ratio?`编辑比例`:`添加比例`]}),open:o.open,onOk:S,onCancel:()=>{s({open:!1,ratio:null}),c.resetFields()},okText:`保存`,cancelText:`取消`,width:520,children:(0,Q.jsxs)(X,{form:c,layout:`vertical`,style:{marginTop:16},children:[(0,Q.jsx)(X.Item,{name:`genType`,label:`生成类型`,rules:[{required:!0,message:`请选择生成类型`}],children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`video`,label:`视频`},{value:`image`,label:`图片`}],onChange:()=>{c.setFieldsValue({modelConfigId:void 0,resolution:void 0})}})}),(0,Q.jsx)(X.Item,{name:`modelConfigId`,label:`引擎`,rules:[{required:!0,message:`请选择引擎`}],children:(0,Q.jsx)(Sb,{size:`large`,placeholder:`请选择引擎`,options:v,showSearch:!0,optionFilterProp:`label`,onChange:()=>c.setFieldsValue({resolution:void 0})})}),(0,Q.jsx)(X.Item,{name:`resolution`,label:h===`image`?`图片尺寸`:`分辨率`,rules:[{required:!0,message:h===`image`?`请选择图片尺寸`:`请选择分辨率`}],children:(0,Q.jsx)(Sb,{size:`large`,placeholder:h===`image`?`请选择图片尺寸`:`请选择分辨率`,options:b})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`ratio`,label:`倍率`,style:{flex:1},rules:[{required:!0,message:`请输入倍率`}],children:(0,Q.jsx)(Ej,{min:.1,max:10,step:.1,style:{width:`100%`},size:`large`})}),(0,Q.jsx)(X.Item,{name:`baseCredits`,label:`基础积分`,style:{flex:1},rules:[{required:!0,message:`请输入基础积分`}],children:(0,Q.jsx)(Ej,{min:0,max:1e3,style:{width:`100%`},size:`large`})}),h!==`image`&&(0,Q.jsx)(X.Item,{name:`perSecondCredits`,label:`每秒积分`,style:{flex:1},rules:[{required:!0,message:`请输入每秒积分`}],children:(0,Q.jsx)(Ej,{min:0,max:100,style:{width:`100%`},size:`large`})})]}),h!==`image`&&(0,Q.jsxs)(`div`,{style:{marginTop:8,padding:`12px 16px`,backgroundColor:`#f5f5ff`,borderRadius:8,border:`1px solid #e0e0ff`},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{display:`block`,marginBottom:8,color:`#4f46e5`},children:`传入视频价格`}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`inputVideoRatio`,label:`倍率`,style:{flex:1,marginBottom:0},rules:[{required:!0,message:`请输入传入视频倍率`}],children:(0,Q.jsx)(Ej,{min:0,max:10,step:.1,style:{width:`100%`},size:`large`})}),(0,Q.jsx)(X.Item,{name:`inputVideoBaseCredits`,label:`基础积分`,style:{flex:1,marginBottom:0},rules:[{required:!0,message:`请输入传入视频基础积分`}],children:(0,Q.jsx)(Ej,{min:0,max:500,style:{width:`100%`},size:`large`})}),(0,Q.jsx)(X.Item,{name:`inputVideoPerSecondCredits`,label:`每秒积分`,style:{flex:1,marginBottom:0},rules:[{required:!0,message:`请输入传入视频每秒积分`}],children:(0,Q.jsx)(Ej,{min:0,max:50,style:{width:`100%`},size:`large`})})]})]})]})})]})},Y5={HomeOutlined:(0,Q.jsx)(pQ,{}),PlayCircleOutlined:(0,Q.jsx)(c0,{}),WalletOutlined:(0,Q.jsx)(r8,{}),RobotOutlined:(0,Q.jsx)(k2,{}),SettingOutlined:(0,Q.jsx)(o4,{}),BellOutlined:(0,Q.jsx)(HU,{}),UserOutlined:(0,Q.jsx)(V6,{}),AppstoreOutlined:(0,Q.jsx)(vH,{}),FileTextOutlined:(0,Q.jsx)(MM,{}),StarOutlined:(0,Q.jsx)(s3,{}),HeartOutlined:(0,Q.jsx)(nQ,{}),CameraOutlined:(0,Q.jsx)(ZG,{}),DashboardOutlined:(0,Q.jsx)(bJ,{}),CalculatorOutlined:(0,Q.jsx)(IG,{}),DollarOutlined:(0,Q.jsx)(ZJ,{}),GiftOutlined:(0,Q.jsx)(jZ,{}),ThunderboltOutlined:(0,Q.jsx)(K3,{}),FireOutlined:(0,Q.jsx)(WX,{}),CloudOutlined:(0,Q.jsx)(gq,{}),SmileOutlined:(0,Q.jsx)(W4,{}),TrophyOutlined:(0,Q.jsx)(l6,{}),RocketOutlined:(0,Q.jsx)(M2,{}),BulbOutlined:(0,Q.jsx)(DG,{}),CodeOutlined:(0,Q.jsx)(Tq,{}),PictureOutlined:(0,Q.jsx)($1,{}),VideoCameraOutlined:(0,Q.jsx)($6,{}),AudioOutlined:(0,Q.jsx)(JH,{}),MailOutlined:(0,Q.jsx)(M$,{}),PhoneOutlined:(0,Q.jsx)(K1,{}),GlobalOutlined:(0,Q.jsx)(RZ,{}),ShoppingCartOutlined:(0,Q.jsx)(m4,{}),TeamOutlined:(0,Q.jsx)(U3,{}),BarChartOutlined:(0,Q.jsx)(xU,{}),PieChartOutlined:(0,Q.jsx)(n0,{}),LineChartOutlined:(0,Q.jsx)(f$,{}),SecurityScanOutlined:(0,Q.jsx)($2,{}),ApiOutlined:(0,Q.jsx)(eH,{}),DatabaseOutlined:(0,Q.jsx)(wJ,{}),CloudServerOutlined:(0,Q.jsx)(vq,{}),MenuOutlined:(0,Q.jsx)(J$,{})},bUe=Object.keys(Y5).map(e=>({value:e,label:(0,Q.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[Y5[e],` `,e.replace(`Outlined`,``)]})})),xUe={page:`blue`,group:`purple`},SUe={page:`页面`,group:`分组`},CUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!0),[i,a]=(0,C.useState)(`frontend`),[o,s]=(0,C.useState)({open:!1,menu:null}),[c]=X.useForm(),l=async()=>{r(!0);try{t(await u5())}catch{}r(!1)};(0,C.useEffect)(()=>{l()},[]);let u=async()=>{try{let e=await c.validateFields(),t={label:e.label,path:e.path||``,icon:e.icon||``,sort_order:e.sortOrder??0,is_active:e.isActive??!0,parent_id:e.parentId||null,menu_type:e.menuType||`page`,menu_target:e.menuTarget||`frontend`,is_default:e.isDefault??!1};o.menu?.id?await d5({...t,id:o.menu.id}):await d5(t),yP.success(o.menu?.id?`菜单已更新`:`菜单已添加`),s({open:!1,menu:null}),c.resetFields(),l()}catch{}},d=async e=>{try{await dVe(e),yP.success(`菜单已删除`),l()}catch(e){yP.error(e?.message||`删除失败`)}},f=t=>{s({open:!0,menu:t||null}),t?c.setFieldsValue({label:t.label,path:t.path,icon:t.icon,sortOrder:t.sortOrder??0,isActive:t.isActive??!0,parentId:t.parentId??``,menuType:t.menuType??`page`,menuTarget:t.menuTarget??`frontend`,isDefault:t.isDefault??!1}):(c.resetFields(),c.setFieldsValue({icon:`HomeOutlined`,sortOrder:e.length,isActive:!0,menuType:`page`,menuTarget:i,isDefault:!1}))},p=e.filter(e=>{let t=e.menuTarget??`frontend`;return t===i||t===`both`}),m=[{value:``,label:`顶级菜单`},...p.filter(e=>e.menuType===`group`).map(e=>({value:e.id,label:e.label}))],h=[],g=p.filter(e=>!e.parentId),_={};p.filter(e=>e.parentId).forEach(e=>{let t=e.parentId;_[t]||(_[t]=[]),_[t].push(e)}),g.sort((e,t)=>(e.sortOrder??0)-(t.sortOrder??0)).forEach(e=>{h.push({...e,_depth:0}),(_[e.id]||[]).sort((e,t)=>(e.sortOrder??0)-(t.sortOrder??0)).forEach(e=>{h.push({...e,_depth:1})})});let v=[{title:`排序`,dataIndex:`sortOrder`,width:60},{title:`菜单名称`,key:`label`,width:180,render:(e,t)=>(0,Q.jsxs)(`span`,{style:{paddingLeft:t._depth*20,fontWeight:t._depth===0?600:400},children:[t._depth===1&&(0,Q.jsx)(`span`,{style:{color:`#cbd5e1`,marginRight:4},children:`└`}),t.label]})},{title:`路由路径`,dataIndex:`path`,width:160,render:e=>e||(0,Q.jsx)(Z.Text,{type:`secondary`,children:`-`})},{title:`图标`,dataIndex:`icon`,width:100,render:e=>e&&Y5[e]?(0,Q.jsx)(`span`,{style:{fontSize:16,color:`#6366f1`},children:Y5[e]}):`-`},{title:`类型`,dataIndex:`menuType`,width:80,render:e=>(0,Q.jsx)(xR,{color:xUe[e]||`default`,children:SUe[e]||e})},{title:`状态`,dataIndex:`isActive`,width:70,render:e=>(0,Q.jsx)(`span`,{style:{color:e?`#22c55e`:`#94a3b8`},children:e?`启用`:`停用`})},...i===`frontend`?[{title:`默认显示`,dataIndex:`isDefault`,width:80,render:e=>e?(0,Q.jsx)(xR,{color:`green`,children:`默认`}):(0,Q.jsx)(Z.Text,{type:`secondary`,children:`-`})}]:[],{title:`操作`,key:`action`,width:150,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>f(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除该菜单?`,onConfirm:()=>d(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}];return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(J$,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`菜单配置`})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>f(),style:{borderRadius:8},children:`添加菜单`})]}),(0,Q.jsx)(jA,{activeKey:i,onChange:a,items:[{key:`frontend`,label:`前台菜单`},{key:`admin`,label:`后台菜单`}]}),(0,Q.jsx)(cR,{columns:v,dataSource:h,rowKey:`id`,loading:n,pagination:!1,scroll:{x:900}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(J$,{}),o.menu?.id?`编辑菜单`:`添加菜单`]}),open:o.open,onOk:u,onCancel:()=>{s({open:!1,menu:null}),c.resetFields()},okText:`确认`,cancelText:`取消`,width:520,children:(0,Q.jsxs)(X,{form:c,layout:`vertical`,children:[(0,Q.jsx)(X.Item,{name:`label`,label:`菜单名称`,rules:[{required:!0,message:`请输入菜单名称`}],children:(0,Q.jsx)(LN,{placeholder:`例如:我的项目`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`path`,label:`路由路径`,tooltip:`分组类型可留空`,children:(0,Q.jsx)(LN,{placeholder:`例如:/projects(分组可留空)`,size:`large`})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`menuType`,label:`菜单类型`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`page`,label:`页面`},{value:`group`,label:`分组`}]})}),(0,Q.jsx)(X.Item,{name:`menuTarget`,label:`适用端`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`frontend`,label:`前台`},{value:`admin`,label:`后台`},{value:`both`,label:`两者`}]})})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`icon`,label:`图标`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(Sb,{size:`large`,options:bUe})}),(0,Q.jsx)(X.Item,{name:`sortOrder`,label:`排序`,style:{flex:1},children:(0,Q.jsx)(Ej,{min:0,max:100,style:{width:`100%`},size:`large`,placeholder:`默认0`})})]}),(0,Q.jsx)(X.Item,{name:`parentId`,label:`上级菜单`,children:(0,Q.jsx)(Sb,{size:`large`,options:m,allowClear:!0,placeholder:`顶级菜单`})}),(0,Q.jsx)(X.Item,{name:`isActive`,label:`启用`,valuePropName:`checked`,children:(0,Q.jsx)(aF,{})}),(0,Q.jsx)(X.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.menuTarget!==t.menuTarget,children:({getFieldValue:e})=>e(`menuTarget`)===`admin`?null:(0,Q.jsx)(X.Item,{name:`isDefault`,label:`新用户默认显示`,valuePropName:`checked`,tooltip:`开启后,新注册用户默认显示此菜单`,children:(0,Q.jsx)(aF,{})})})]})})]})},wUe={normal:`blue`,gift:`green`,promo:`purple`},TUe={normal:`常规`,gift:`赠送`,promo:`促销`},EUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)({open:!1,item:null}),[o]=X.useForm(),s=async()=>{r(!0);try{t((await _Ve()).map(e=>({id:e.id,name:e.name,credits:e.credits,price:e.price,bonusCredits:e.bonus_credits??e.bonusCredits??0,totalCredits:e.total_credits??e.totalCredits??e.credits,description:e.description,packageType:e.package_type??e.packageType??`normal`,isGift:e.is_gift??e.isGift??!1,isActive:e.is_active??e.isActive??!0,sortOrder:e.sort_order??e.sortOrder??0})))}catch{yP.error(`加载充值套餐失败`)}finally{r(!1)}};(0,C.useEffect)(()=>{s()},[]);let c=async()=>{try{let e=await o.validateFields(),t={name:e.name,credits:e.credits,price:e.price,bonus_credits:e.bonusCredits||0,description:e.description||null,package_type:e.packageType||`normal`,is_gift:e.isGift||!1,is_active:e.isActive??!0,sort_order:e.sortOrder??0};i.item?.id?(await p5({id:i.item.id,...t}),yP.success(`已更新`)):(await p5(t),yP.success(`已添加`)),a({open:!1,item:null}),o.resetFields(),s()}catch{}},l=async e=>{try{await vVe(e),yP.success(`已删除`),s()}catch(e){yP.error(e?.message||`删除失败`)}},u=e=>{a({open:!0,item:e||null}),e?o.setFieldsValue({name:e.name,credits:e.credits,price:e.price,bonusCredits:e.bonusCredits,description:e.description,packageType:e.packageType,isGift:e.isGift,isActive:e.isActive,sortOrder:e.sortOrder}):(o.resetFields(),o.setFieldsValue({isActive:!0,sortOrder:0,packageType:`normal`,bonusCredits:0,isGift:!1}))};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(jZ,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`充值套餐管理`}),(0,Q.jsxs)(xR,{color:`purple`,children:[e.length,` 个套餐`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>u(),style:{borderRadius:8},children:`添加套餐`})]}),(0,Q.jsx)(cR,{columns:[{title:`套餐名称`,key:`name`,width:160,render:(e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.name}),t.description&&(0,Q.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12},children:t.description})]})},{title:`基础积分`,dataIndex:`credits`,width:100,render:e=>(0,Q.jsx)(Z.Text,{children:e.toLocaleString()})},{title:`赠送积分`,dataIndex:`bonusCredits`,width:100,render:e=>e>0?(0,Q.jsxs)(xR,{color:`green`,children:[`+`,e.toLocaleString()]}):(0,Q.jsx)(Z.Text,{type:`secondary`,children:`-`})},{title:`总积分`,key:`total`,width:100,render:(e,t)=>(0,Q.jsx)(Z.Text,{strong:!0,style:{color:`#6366f1`},children:(t.credits+t.bonusCredits).toLocaleString()})},{title:`价格(元)`,dataIndex:`price`,width:100,render:e=>(0,Q.jsxs)(Z.Text,{strong:!0,children:[`¥`,e]})},{title:`类型`,dataIndex:`packageType`,width:80,render:e=>(0,Q.jsx)(xR,{color:wUe[e]||`default`,children:TUe[e]||e})},{title:`状态`,dataIndex:`isActive`,width:80,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>u(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除?`,onConfirm:()=>l(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:900}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(jZ,{}),i.item?`编辑套餐`:`添加套餐`]}),open:i.open,onOk:c,onCancel:()=>{a({open:!1,item:null}),o.resetFields()},okText:`保存`,cancelText:`取消`,width:520,children:(0,Q.jsxs)(X,{form:o,layout:`vertical`,style:{marginTop:16},children:[(0,Q.jsx)(X.Item,{name:`name`,label:`套餐名称`,rules:[{required:!0,message:`请输入套餐名称`}],children:(0,Q.jsx)(LN,{placeholder:`例如:进阶包`,size:`large`})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`credits`,label:`基础积分`,rules:[{required:!0,message:`请输入积分`}],style:{flex:1},children:(0,Q.jsx)(Ej,{min:1,placeholder:`2000`,size:`large`,style:{width:`100%`}})}),(0,Q.jsx)(X.Item,{name:`price`,label:`价格(元)`,rules:[{required:!0,message:`请输入价格`}],style:{flex:1},children:(0,Q.jsx)(Ej,{min:.01,step:1,placeholder:`168`,size:`large`,style:{width:`100%`}})})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`bonusCredits`,label:`赠送积分`,initialValue:0,style:{flex:1},children:(0,Q.jsx)(Ej,{min:0,placeholder:`0`,size:`large`,style:{width:`100%`}})}),(0,Q.jsx)(X.Item,{name:`packageType`,label:`套餐类型`,initialValue:`normal`,style:{flex:1},children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`normal`,label:`常规`},{value:`gift`,label:`赠送`},{value:`promo`,label:`促销`}]})})]}),(0,Q.jsx)(X.Item,{name:`description`,label:`描述`,children:(0,Q.jsx)(LN,{placeholder:`套餐描述(可选)`,size:`large`})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`isActive`,label:`启用状态`,valuePropName:`checked`,initialValue:!0,style:{flex:1},children:(0,Q.jsx)(aF,{})}),(0,Q.jsx)(X.Item,{name:`isGift`,label:`是否赠送`,valuePropName:`checked`,initialValue:!1,style:{flex:1},children:(0,Q.jsx)(aF,{})}),(0,Q.jsx)(X.Item,{name:`sortOrder`,label:`排序`,initialValue:0,style:{flex:1},children:(0,Q.jsx)(Ej,{size:`large`,style:{width:`100%`}})})]})]})})]})},DUe={POST:`green`,PUT:`blue`,DELETE:`red`},OUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(0),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(1),c=async e=>{a(!0);try{let n=await yVe(e||o);t(n.items||[]),r(n.total||0)}catch{yP.error(`加载操作日志失败`)}finally{a(!1)}};return(0,C.useEffect)(()=>{c()},[]),(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(uQ,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`操作日志`})]}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>c(),children:`刷新`})]}),(0,Q.jsx)(cR,{columns:[{title:`操作人`,dataIndex:`username`,width:120,render:e=>(0,Q.jsx)(Z.Text,{strong:!0,children:e})},{title:`操作`,dataIndex:`action`,width:160,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`方法`,dataIndex:`method`,width:80,render:e=>(0,Q.jsx)(xR,{color:DUe[e]||`default`,children:e})},{title:`路径`,dataIndex:`path`,width:220,ellipsis:!0,render:e=>(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12},children:e})},{title:`时间`,dataIndex:`createdAt`,width:160,render:e=>(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12},children:E5(e)})}],dataSource:e,rowKey:`id`,loading:i,pagination:{current:o,pageSize:20,total:n,showTotal:e=>`共 ${e} 条记录`,onChange:e=>{s(e),c(e)}},scroll:{x:800}})]})})},kUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(0),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(1),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(null),[g]=X.useForm(),[_]=X.useForm(),v=async e=>{a(!0);try{let n=await bVe(e||o);t(n.items||[]),r(n.total||0)}catch{yP.error(`加载应用管理列表失败`)}finally{a(!1)}},y=async()=>{try{let e=await g.validateFields();await xVe({app_id:e.app_id,secret:e.secret,open_type:e.open_type,max_count:e.max_count,auth_url:e.auth_url,company:e.company}),yP.success(`创建成功`),l(!1),g.resetFields(),v()}catch(e){yP.error(e?.message||`创建失败`)}},b=async e=>{try{h(await m5(e)),d(!0)}catch(e){yP.error(e?.message||`获取详情失败`)}},x=async e=>{try{let t=await m5(e);h(t),_.setFieldsValue({appId:t.appId,secret:t.secret,openType:t.openType,maxCount:t.maxCount,authUrl:t.authUrl,company:t.company}),p(!0)}catch(e){yP.error(e?.message||`获取详情失败`)}},S=async()=>{if(m)try{let e=await _.validateFields();await SVe(m.id,{app_id:e.app_id,secret:e.secret,open_type:e.open_type,count:e.count,auth_url:e.auth_url,company:e.company}),yP.success(`更新成功`),p(!1),_.resetFields(),v()}catch(e){yP.error(e?.message||`更新失败`)}},w=e=>{xP.confirm({title:`确认删除`,content:`确定要删除这个应用管理吗?`,okText:`删除`,okType:`danger`,cancelText:`取消`,onOk:async()=>{try{await CVe(e),yP.success(`删除成功`),v()}catch(e){yP.error(e?.message||`删除失败`)}}})};return(0,C.useEffect)(()=>{v()},[]),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(J$,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`应用管理列表`})]}),(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>v(),children:`刷新`}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>l(!0),children:`创建`})]})]}),(0,Q.jsx)(cR,{columns:[{title:`ID`,dataIndex:`id`,width:120,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`应用ID`,dataIndex:`appId`,width:120,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`应用密钥`,dataIndex:`secret`,width:120,render:e=>{if(!e)return`-`;let t=e.length>12?`${e.slice(0,6)}...${e.slice(-4)}`:e;return(0,Q.jsx)(fx,{title:e,placement:`topLeft`,children:(0,Q.jsx)(Z.Text,{style:{fontSize:12},children:t})})}},{title:`开户方式`,dataIndex:`openType`,width:90,render:e=>(0,Q.jsx)(Z.Text,{children:{1:`千川`,2:`广告`,3:`本地推`,4:`星图`,5:`快手代理商`,6:`巨量星图`,7:`巨量服务单`,8:`腾讯服务单`,9:`腾讯营销K2`,10:`腾讯营销K3`}[e]||e})},{title:`归属公司`,dataIndex:`company`,width:120,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`授权次数`,dataIndex:`maxCount`,width:90,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`状态`,dataIndex:`status`,width:80,render:e=>(0,Q.jsx)(xR,{color:e===1?`green`:`red`,children:e===1?`正常`:`禁用`})},{title:`授权URL`,dataIndex:`authUrl`,width:200,render:e=>e?(0,Q.jsx)(fx,{title:e,placement:`topLeft`,children:(0,Q.jsx)(Z.Text,{style:{fontSize:12},ellipsis:!0,children:e.length>30?`${e.slice(0,27)}...`:e})}):`-`},{title:`创建人`,dataIndex:`createBy`,width:120,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`创建时间`,dataIndex:`createdAt`,width:160,render:e=>(0,Q.jsx)(Z.Text,{children:E5(e)})},{title:`更新时间`,dataIndex:`updatedAt`,width:160,render:e=>(0,Q.jsx)(Z.Text,{children:E5(e)})},{title:`操作`,width:120,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(ON,{}),size:`small`,onClick:()=>b(t.id),children:`详情`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(DR,{}),size:`small`,onClick:()=>x(t.id),children:`更新`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(wR,{}),size:`small`,danger:!0,onClick:()=>w(t.id),children:`删除`})]})}],dataSource:e,rowKey:`id`,loading:i,pagination:{current:o,pageSize:20,total:n,showTotal:e=>`共 ${e} 条记录`,onChange:e=>{s(e),v(e)}},scroll:{x:`max-content`}})]}),(0,Q.jsx)(xP,{title:`创建应用管理`,open:c,onOk:y,onCancel:()=>{l(!1),g.resetFields()},okText:`创建`,cancelText:`取消`,width:600,children:(0,Q.jsxs)(X,{form:g,layout:`vertical`,children:[(0,Q.jsx)(X.Item,{name:`app_id`,label:`应用ID`,rules:[{required:!0,message:`请输入应用ID`},{max:64,message:`应用ID不能超过64个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用ID`})}),(0,Q.jsx)(X.Item,{name:`secret`,label:`应用密钥`,rules:[{required:!0,message:`请输入应用密钥`},{max:256,message:`应用密钥不能超过256个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用密钥`})}),(0,Q.jsx)(X.Item,{name:`open_type`,label:`开户方式`,rules:[{required:!0,message:`请选择开户方式`}],children:(0,Q.jsxs)(Sb,{placeholder:`请选择开户方式`,children:[(0,Q.jsx)(Sb.Option,{value:1,children:`千川`}),(0,Q.jsx)(Sb.Option,{value:2,children:`广告`}),(0,Q.jsx)(Sb.Option,{value:3,children:`本地推`}),(0,Q.jsx)(Sb.Option,{value:4,children:`星图`}),(0,Q.jsx)(Sb.Option,{value:5,children:`快手代理商`}),(0,Q.jsx)(Sb.Option,{value:6,children:`巨量星图`}),(0,Q.jsx)(Sb.Option,{value:7,children:`巨量服务单`}),(0,Q.jsx)(Sb.Option,{value:8,children:`腾讯服务单`}),(0,Q.jsx)(Sb.Option,{value:9,children:`腾讯营销K2`}),(0,Q.jsx)(Sb.Option,{value:10,children:`腾讯营销K3`})]})}),(0,Q.jsx)(X.Item,{name:`max_count`,label:`最大授权用户数`,initialValue:100,children:(0,Q.jsx)(Ej,{min:1,placeholder:`应用最大可以授权多少个用户`})}),(0,Q.jsx)(X.Item,{name:`auth_url`,label:`应用授权链接`,children:(0,Q.jsx)(LN,{placeholder:`请输入应用授权链接`})}),(0,Q.jsx)(X.Item,{name:`company`,label:`应用归属公司名称`,rules:[{max:256,message:`公司名称不能超过256个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用归属公司名称`})})]})}),(0,Q.jsx)(xP,{title:`应用管理详情`,open:u,onCancel:()=>{d(!1),h(null)},okText:`关闭`,cancelText:`取消`,width:600,children:m&&(0,Q.jsxs)(`div`,{style:{lineHeight:`2`},children:[(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`ID:`}),` `,m.id]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`应用ID:`}),` `,m.appId]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`应用密钥:`}),` `,m.secret]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`开户方式:`}),` `,{1:`千川`,2:`广告`,3:`本地推`,4:`星图`,5:`快手代理商`,6:`巨量星图`,7:`巨量服务单`,8:`腾讯服务单`,9:`腾讯营销K2`,10:`腾讯营销K3`}[m.openType]||m.openType]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`归属公司:`}),` `,m.company||`-`]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`授权次数:`}),` `,m.maxCount]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`状态:`}),` `,m.status===1?`正常`:`禁用`]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`授权URL:`}),` `,m.authUrl||`-`]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`创建人:`}),` `,m.createBy]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`创建时间:`}),` `,E5(m.createdAt)]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`更新时间:`}),` `,E5(m.updatedAt)]})]})}),(0,Q.jsx)(xP,{title:`更新应用管理`,open:f,onOk:S,onCancel:()=>{p(!1),_.resetFields(),h(null)},okText:`更新`,cancelText:`取消`,width:600,children:(0,Q.jsxs)(X,{form:_,layout:`vertical`,children:[(0,Q.jsx)(X.Item,{name:`appId`,label:`应用ID`,rules:[{required:!0,message:`请输入应用ID`},{max:64,message:`应用ID不能超过64个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用ID`})}),(0,Q.jsx)(X.Item,{name:`secret`,label:`应用密钥`,rules:[{required:!0,message:`请输入应用密钥`},{max:256,message:`应用密钥不能超过256个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用密钥`})}),(0,Q.jsx)(X.Item,{name:`openType`,label:`开户方式`,rules:[{required:!0,message:`请选择开户方式`}],children:(0,Q.jsxs)(Sb,{placeholder:`请选择开户方式`,children:[(0,Q.jsx)(Sb.Option,{value:1,children:`千川`}),(0,Q.jsx)(Sb.Option,{value:2,children:`广告`}),(0,Q.jsx)(Sb.Option,{value:3,children:`本地推`}),(0,Q.jsx)(Sb.Option,{value:4,children:`星图`}),(0,Q.jsx)(Sb.Option,{value:5,children:`快手代理商`}),(0,Q.jsx)(Sb.Option,{value:6,children:`巨量星图`}),(0,Q.jsx)(Sb.Option,{value:7,children:`巨量服务单`}),(0,Q.jsx)(Sb.Option,{value:8,children:`腾讯服务单`}),(0,Q.jsx)(Sb.Option,{value:9,children:`腾讯营销K2`}),(0,Q.jsx)(Sb.Option,{value:10,children:`腾讯营销K3`})]})}),(0,Q.jsx)(X.Item,{name:`maxCount`,label:`最大授权用户数`,children:(0,Q.jsx)(Ej,{min:1,placeholder:`应用最大可以授权多少个用户`})}),(0,Q.jsx)(X.Item,{name:`authUrl`,label:`应用授权链接`,children:(0,Q.jsx)(LN,{placeholder:`请输入应用授权链接`})}),(0,Q.jsx)(X.Item,{name:`company`,label:`应用归属公司名称`,rules:[{max:256,message:`公司名称不能超过256个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用归属公司名称`})})]})})]})},X5=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``),Z5={image:`empty`,video:`empty`,videoCover:`empty`,references:{}},Q5={optimizing:{color:`processing`,text:`优化中`,icon:(0,Q.jsx)(fm,{spin:!0})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,Q.jsx)(iM,{})},generating:{color:`warning`,text:`生成中`,icon:(0,Q.jsx)(fm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,Q.jsx)(IK,{})},failed:{color:`error`,text:`失败`,icon:(0,Q.jsx)(cq,{})}},$5={image:{text:`图片`,color:`purple`,icon:(0,Q.jsx)(fX,{})},video:{text:`视频`,color:`geekblue`,icon:(0,Q.jsx)($6,{})}},AUe=e=>/^(https?:)?\/\//i.test(e)||/^(blob|data):/i.test(e),e7=e=>!!e&&/^blob:/i.test(e.trim()),t7=e=>{if(!e)return``;let t=String(e).trim();return t?AUe(t)?t:X5?`${X5}${t.startsWith(`/`)?t:`/${t}`}`:t.startsWith(`/`)?t:`/${t}`:``},jUe=e=>e?e.length>12?`${e.slice(0,8)}...`:e:`-`,n7=e=>e?E5(e):`-`,MUe=e=>e==null||e===``,r7=e=>{if(!e||e7(e))return!1;try{let t=new URL(t7(e),window.location.origin),n=t.searchParams.get(`exp`)||t.searchParams.get(`expires`)||t.searchParams.get(`expire`)||t.searchParams.get(`expires_at`)||t.searchParams.get(`x-expires`);if(!n)return!1;let r=Number(n);if(!Number.isFinite(r))return!1;let i=r>1e10?r:r*1e3;return Date.now()>=i}catch{return!1}},i7=e=>e?e7(e)||r7(e)?`invalid`:`checking`:`empty`,a7=e=>{let t=e.url||e.mediaUrl||e.fileUrl;return typeof t==`string`&&t.trim()?t.trim():void 0},NUe=e=>{let t=String(e.type||e.mediaType||e.mimeType||``).toLowerCase(),n=a7(e)?.toLowerCase()||``;return t.includes(`video`)||/\.(mp4|mov|webm|m4v)(\?|$)/i.test(n)?`video`:t.includes(`image`)||/\.(png|jpe?g|webp|gif|bmp|svg)(\?|$)/i.test(n)?`image`:t||`unknown`},o7=(e,t)=>`${t}-${a7(e)||`empty`}`,s7=(e,t=`资源`)=>e7(e)?`本地临时素材已失效`:r7(e)?`${t}链接已超时,请刷新列表或重新搜索后再查看`:`${t}加载失败,请刷新列表或重新搜索后再查看`,c7=({text:e,minHeight:t=240,compact:n=!1,action:r})=>(0,Q.jsxs)(`div`,{style:{width:`100%`,minHeight:n?void 0:t,height:n?`100%`:void 0,borderRadius:n?10:12,background:`#f8f9fc`,border:`1px dashed #cbd5e1`,color:`#64748b`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexDirection:`column`,gap:n?4:10,textAlign:`center`},children:[(0,Q.jsx)(Z.Text,{style:{color:`#64748b`,fontSize:n?11:13},children:e}),r]}),l7=({label:e,value:t})=>(0,Q.jsxs)(`div`,{style:{flex:1,minWidth:120},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:14},children:MUe(t)?`-`:t})]}),PUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(0),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(1),[c]=(0,C.useState)(20),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(0),[h,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(Z5),[y,b]=(0,C.useState)(!1),x=(0,C.useRef)(null),[S,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(null),D=(0,C.useCallback)(async()=>{a(!0);try{let e=await OVe({userId:d.trim()||void 0,status:l||void 0,page:o,pageSize:c});t((e.items||[]).map(e=>({id:e.id,userId:e.userId,username:e.username,projectId:e.projectId,projectName:e.projectName,industry:e.industry,originalPrompt:e.originalPrompt,optimizedPrompt:e.optimizedPrompt,duration:e.duration,aspectRatio:e.aspectRatio,resolution:e.resolution,status:e.status,videoUrl:e.videoUrl,videoCoverUrl:e.videoCoverUrl,references:e.references,creditsCost:e.creditsCost||0,textCreditsCost:e.textCreditsCost||0,textTokensUsed:e.textTokensUsed||0,videoTokensUsed:e.videoTokensUsed||0,errorMessage:e.errorMessage,createdAt:e.createdAt,generatedAt:e.generatedAt,genType:e.genType,imageSize:e.imageSize,imageUrl:e.imageUrl,imageTokensUsed:e.imageTokensUsed||0,imageProportion:e.imageProportion,imagePx:e.imagePx}))),r(e.total||0)}catch{yP.error(`加载记录失败`)}finally{a(!1)}},[l,d,o,c]);(0,C.useEffect)(()=>{D()},[D,p]),(0,C.useEffect)(()=>{if(!h){v(Z5);return}let e=(h.references||[]).reduce((e,t,n)=>{let r=a7(t);return e[o7(t,n)]=i7(r),e},{});x.current&&(x.current.pause(),x.current.currentTime=0),b(!1),v({image:i7(h.imageUrl),video:i7(h.videoUrl),videoCover:i7(h.videoCoverUrl),references:e})},[h]);let O=()=>{s(1),m(e=>e+1)},k=(0,C.useCallback)(e=>{g(e)},[]),A=()=>{x.current&&x.current.pause(),b(!1),g(null)},j=e=>{v(t=>({...t,...e}))},M=(e,t)=>{v(n=>({...n,references:{...n.references,[e]:t}}))},N=(e,t=`素材`)=>{if(!e){yP.warning(`${t}链接为空,暂无法查看`);return}if(e7(e)){yP.warning(`本地临时素材已失效,暂无法查看`);return}if(r7(e)){yP.warning(`${t}链接已超时,请刷新列表或重新搜索后再查看`);return}window.open(t7(e),`_blank`,`noopener,noreferrer`)},P=()=>{if(h?.videoUrl){if(r7(h.videoUrl)){j({video:`invalid`}),yP.warning(`视频链接已超时,请刷新列表或重新搜索后再查看`);return}b(!0),window.setTimeout(()=>{x.current?.play().catch(()=>{b(!1),j({video:`invalid`}),yP.warning(`视频播放失败,请确认资源链接是否仍然有效`)})},0)}},F=async(e,t,n)=>{w(e);try{await kVe(e,t,n),yP.success(`状态已更新`),D()}catch(e){yP.error(e?.message||`更新失败`)}finally{w(null)}},I=async()=>{if(T){w(T.record.id);try{await AVe(T.record.id,T.ratio,T.resolution,T.image_size),yP.success(`已提交${T.record.genType===`video`?`视频`:`图片`}生成`),E(null),D()}catch(e){yP.error(e?.message||`生成失败`)}finally{w(null)}}},L=(0,C.useMemo)(()=>[{title:`用户`,key:`user`,width:120,render:(e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:13},children:t.username||`未知用户`}),(0,Q.jsx)(`div`,{style:{fontSize:11,color:`#94a3b8`},children:jUe(t.userId)})]})},{title:`项目`,dataIndex:`projectName`,width:120,ellipsis:!0,render:e=>(0,Q.jsx)(Z.Text,{style:{fontSize:13},children:e||`-`})},{title:`行业`,dataIndex:`industry`,width:100,ellipsis:!0,render:e=>(0,Q.jsx)(xR,{color:`cyan`,children:e||`-`})},{title:`类型`,dataIndex:`genType`,width:90,ellipsis:!0,render:e=>{let t=$5[e]||{text:e||`-`,color:`default`,icon:null};return(0,Q.jsx)(xR,{color:t.color,icon:t.icon,children:t.text})}},{title:`提示词`,key:`prompt`,ellipsis:!0,render:(e,t)=>(0,Q.jsx)(fx,{title:t.originalPrompt,placement:`topLeft`,children:(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#475569`},ellipsis:!0,children:t.originalPrompt||`-`})})},{title:`参数`,key:`params`,width:160,render:(e,t)=>t.genType===`video`?t.duration||t.aspectRatio||t.resolution?(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[t.duration?(0,Q.jsxs)(xR,{children:[t.duration,`s`]}):null,t.aspectRatio?(0,Q.jsx)(xR,{children:t.aspectRatio}):null,t.resolution?(0,Q.jsx)(xR,{children:t.resolution}):null]}):(0,Q.jsx)(xR,{color:`default`,children:`待配置`}):t.imageSize||t.imageProportion||t.imagePx?(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[t.imageSize?(0,Q.jsx)(xR,{children:t.imageSize}):null,t.imageProportion?(0,Q.jsx)(xR,{children:t.imageProportion}):null,t.imagePx?(0,Q.jsx)(xR,{children:t.imagePx}):null]}):(0,Q.jsx)(xR,{color:`default`,children:`待配置`})},{title:`积分`,key:`credits`,width:120,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{fontSize:12},children:[t.textCreditsCost>0?(0,Q.jsxs)(`div`,{style:{color:`#f59e0b`},children:[`文字: `,t.textCreditsCost]}):null,t.creditsCost>0?(0,Q.jsxs)(`div`,{style:{color:`#6366f1`},children:[t.genType===`video`?`视频`:`图片`,`: `,t.creditsCost]}):null,t.textCreditsCost===0&&t.creditsCost===0?(0,Q.jsx)(Z.Text,{style:{color:`#94a3b8`},children:`0`}):null]})},{title:`状态`,dataIndex:`status`,width:90,render:e=>{let t=Q5[e]||{color:`default`,text:e||`-`,icon:null};return(0,Q.jsx)(xR,{color:t.color,icon:t.icon,children:t.text})}},{title:`时间`,key:`time`,width:150,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{fontSize:12,color:`#94a3b8`},children:[(0,Q.jsx)(`div`,{children:n7(t.createdAt)}),t.generatedAt?(0,Q.jsxs)(`div`,{style:{color:`#10b981`},children:[`生成: `,n7(t.generatedAt)]}):null]})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(ON,{}),onClick:()=>k(t),children:`详情`}),t.status===`generating`?(0,Q.jsx)(XS,{size:`small`,danger:!0,loading:S===t.id,onClick:()=>{xP.confirm({title:`确认操作`,icon:(0,Q.jsx)(DY,{}),content:`确定将此记录标记为失败?`,onOk:()=>F(t.id,`failed`)})},children:`标记失败`}):null,t.status===`failed`?(0,Q.jsx)(XS,{size:`small`,type:`primary`,danger:!0,loading:S===t.id,onClick:()=>E({record:t,ratio:t.aspectRatio||`16:9`,resolution:t.resolution||`720p`,image_size:t.imageSize||`2K`}),children:`重试生成`}):null,t.status===`prompt_optimized`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(XS,{size:`small`,type:`primary`,loading:S===t.id,onClick:()=>E({record:t,ratio:t.aspectRatio||`16:9`,resolution:t.resolution||`720p`,image_size:t.imageSize||`2K`}),style:{background:`#6366f1`,border:`none`},children:[`生成`,t.genType===`video`?`视频`:`图片`]}),(0,Q.jsx)(XS,{size:`small`,danger:!0,loading:S===t.id,onClick:()=>{xP.confirm({title:`确认操作`,icon:(0,Q.jsx)(DY,{}),content:`确定将此记录标记为失败?`,onOk:()=>F(t.id,`failed`)})},children:`标记失败`})]}):null]})}],[k,S]),R=h?$5[h.genType||``]||{text:h.genType||`-`,color:`default`,icon:null}:null,z=h?Q5[h.status]||{color:`default`,text:h.status||`-`,icon:null}:null,B=()=>{if(!h||h.genType!==`image`||h.status!==`completed`)return null;if(!h.imageUrl)return(0,Q.jsx)(c7,{text:`此图片任务暂无结果图片`,minHeight:260});if(_.image===`invalid`)return(0,Q.jsx)(c7,{text:s7(h.imageUrl,`图片`),minHeight:260});let e=t7(h.imageUrl);return(0,Q.jsxs)(`div`,{title:`点击新页面查看图片`,onClick:()=>N(h.imageUrl,`生成图片`),style:{position:`relative`,width:`100%`,minHeight:260,borderRadius:12,background:`#f8f9fc`,border:`1px solid #e2e8f0`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`},children:[(0,Q.jsx)(`img`,{src:e,alt:`生成图片`,onLoad:()=>j({image:`valid`}),onError:()=>j({image:`invalid`}),style:{display:_.image===`valid`?`block`:`none`,width:`100%`,maxHeight:560,objectFit:`contain`,background:`#fff`}},`${h.id}-${e}`),_.image===`checking`?(0,Q.jsx)(c7,{text:`图片加载检测中...`,minHeight:260}):null]})},V=()=>{if(!h||y||_.video===`invalid`)return null;let e=h.videoUrl?(0,Q.jsx)(XS,{type:`primary`,shape:`circle`,size:`large`,icon:(0,Q.jsx)(c0,{}),onClick:P,style:{boxShadow:`0 8px 20px rgba(15,23,42,0.25)`}}):null;if(!h.videoCoverUrl)return(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:12,overflow:`hidden`,background:`#f8f9fc`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,Q.jsx)(c7,{text:`此视频无封面`,minHeight:340,action:e})});if(_.videoCover===`invalid`)return(0,Q.jsx)(c7,{text:s7(h.videoCoverUrl,`视频封面`),minHeight:340,action:e});let t=t7(h.videoCoverUrl);return(0,Q.jsxs)(`div`,{style:{position:`absolute`,inset:0,borderRadius:12,overflow:`hidden`,background:`#f8f9fc`,border:`1px solid #e2e8f0`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,Q.jsx)(`img`,{src:t,alt:`视频封面`,onLoad:()=>j({videoCover:`valid`}),onError:()=>j({videoCover:`invalid`}),style:{display:_.videoCover===`valid`?`block`:`none`,width:`100%`,height:`100%`,objectFit:`contain`,background:`#000`}},`${h.id}-cover-${t}`),_.videoCover===`checking`?(0,Q.jsx)(c7,{text:`视频封面加载检测中...`,minHeight:340,action:e}):null,_.videoCover===`valid`?(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(15,23,42,0.18)`},children:e}):null]})},H=()=>{if(!h||h.genType!==`video`||h.status!==`completed`)return null;if(!h.videoUrl)return(0,Q.jsx)(c7,{text:`此视频任务暂无结果视频`,minHeight:340});if(_.video===`invalid`)return(0,Q.jsx)(c7,{text:s7(h.videoUrl,`视频`),minHeight:340});let e=t7(h.videoUrl);return(0,Q.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:340,borderRadius:12,background:`#000`,overflow:`hidden`,border:`1px solid #e2e8f0`},children:[(0,Q.jsx)(`video`,{ref:x,src:e,preload:`metadata`,controls:y,onLoadedMetadata:()=>j({video:`valid`}),onCanPlay:()=>j({video:`valid`}),onPlaying:()=>{b(!0),j({video:`valid`})},onPause:()=>b(!1),onEnded:()=>b(!1),onError:()=>{b(!1),j({video:`invalid`})},style:{width:`100%`,height:`100%`,objectFit:`contain`,background:`#000`,opacity:+!!y,pointerEvents:y?`auto`:`none`}},`${h.id}-${e}`),V()]})},U=(e,t)=>{let n=a7(e),r=NUe(e),i=o7(e,t),a=_.references[i]||i7(n),o=r===`image`,s=r===`video`,c=typeof e.name==`string`&&e.name?e.name:`参考素材 ${t+1}`;if(!n)return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsx)(`div`,{style:{width:94,height:94},children:(0,Q.jsx)(c7,{text:`无链接`,compact:!0})}),(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})]},i);if(a===`invalid`)return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsx)(`div`,{style:{width:94,height:94},children:(0,Q.jsx)(c7,{text:e7(n)?`本地临时素材已失效`:`素材不可访问`,compact:!0})}),(0,Q.jsx)(fx,{title:c,children:(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})})]},i);let l=t7(n);return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,title:`点击新页面查看素材`,onClick:()=>N(n,s?`视频素材`:o?`图片素材`:`素材`),onKeyDown:e=>{e.key===`Enter`&&N(n,s?`视频素材`:o?`图片素材`:`素材`)},style:{width:94,height:94,borderRadius:10,overflow:`hidden`,border:`1px solid #e2e8f0`,background:`#f8f9fc`,position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`},children:[o?(0,Q.jsx)(`img`,{src:l,alt:c,onLoad:()=>M(i,`valid`),onError:()=>M(i,`invalid`),style:{display:a===`valid`?`block`:`none`,width:`100%`,height:`100%`,objectFit:`cover`}}):null,s?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`video`,{src:l,preload:`metadata`,onLoadedMetadata:()=>M(i,`valid`),onError:()=>M(i,`invalid`),style:{display:`none`}}),(0,Q.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12,textAlign:`center`},children:[(0,Q.jsx)(c0,{style:{fontSize:18}}),(0,Q.jsx)(`div`,{children:`视频素材`}),(0,Q.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,marginTop:2},children:`点击查看`})]})]}):null,!o&&!s?(0,Q.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12,textAlign:`center`},children:[`文件素材`,(0,Q.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,marginTop:2},children:`点击查看`})]}):null,a===`checking`&&o?(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#f8f9fc`},children:(0,Q.jsx)(fm,{style:{color:`#6366f1`}})}):null]}),(0,Q.jsx)(fx,{title:c,children:(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})})]},i)};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16,flexWrap:`wrap`,gap:12},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)($6,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`生成记录管理`}),(0,Q.jsxs)(xR,{color:`purple`,children:[n,` 条记录`]})]}),(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(Sb,{placeholder:`状态筛选`,allowClear:!0,style:{width:120},value:l||void 0,onChange:e=>{u(e||``),s(1)},options:[{value:`optimizing`,label:`优化中`},{value:`prompt_optimized`,label:`待生成`},{value:`generating`,label:`生成中`},{value:`completed`,label:`已完成`},{value:`failed`,label:`失败`}]}),(0,Q.jsx)(LN,{placeholder:`用户ID搜索`,prefix:(0,Q.jsx)(_b,{style:{color:`#94a3b8`}}),style:{width:200},value:d,onChange:e=>f(e.target.value),onPressEnter:O,allowClear:!0}),(0,Q.jsx)(XS,{type:`primary`,onClick:O,style:{borderRadius:8},children:`搜索`})]})]}),(0,Q.jsx)(cR,{columns:L,dataSource:e,rowKey:`id`,loading:i,scroll:{x:1120},pagination:{current:o,pageSize:c,total:n,onChange:s,showSizeChanger:!1,showTotal:e=>`共 ${e} 条`}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[h?.genType===`video`?(0,Q.jsx)($6,{}):(0,Q.jsx)(fX,{}),(0,Q.jsx)(`span`,{children:`生成记录详情`})]}),open:!!h,onCancel:A,footer:null,width:900,destroyOnClose:!0,children:h?(0,Q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:16},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,flexWrap:`wrap`},children:[(0,Q.jsxs)(`div`,{style:{flex:1,minWidth:150,padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`用户`}),(0,Q.jsx)(Z.Text,{strong:!0,children:h.username||`-`})]}),(0,Q.jsxs)(`div`,{style:{flex:1,minWidth:150,padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`项目`}),(0,Q.jsx)(Z.Text,{strong:!0,children:h.projectName||`-`})]}),(0,Q.jsxs)(`div`,{style:{flex:1,minWidth:150,padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`类型 / 状态`}),(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[R?(0,Q.jsx)(xR,{color:R.color,icon:R.icon,children:R.text}):null,z?(0,Q.jsx)(xR,{color:z.color,icon:z.icon,children:z.text}):null]})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`原始提示词`}),(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:(0,Q.jsx)(Z.Text,{style:{fontSize:13,color:`#475569`,lineHeight:1.7},children:h.originalPrompt||`-`})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`优化后提示词`}),(0,Q.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,Q.jsx)(Z.Text,{style:{fontSize:13,color:`#1a1a2e`,lineHeight:1.7},children:h.optimizedPrompt||`-`})})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(l7,{label:`文字积分`,value:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{color:`#f59e0b`},children:h.textCreditsCost||0}),(0,Q.jsxs)(Z.Text,{style:{fontSize:11,color:`#94a3b8`},children:[` (`,h.textTokensUsed||0,` tokens)`]})]})}),(0,Q.jsx)(l7,{label:`${h.genType===`image`?`图片`:`视频`}积分`,value:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{color:`#6366f1`},children:h.creditsCost||0}),h.genType===`video`&&h.videoTokensUsed?(0,Q.jsxs)(Z.Text,{style:{fontSize:11,color:`#94a3b8`},children:[` (`,h.videoTokensUsed,` tokens)`]}):null,h.genType===`image`&&h.imageTokensUsed?(0,Q.jsxs)(Z.Text,{style:{fontSize:11,color:`#94a3b8`},children:[` (`,h.imageTokensUsed,` tokens)`]}):null]})}),(0,Q.jsx)(l7,{label:`总积分`,value:(h.textCreditsCost||0)+(h.creditsCost||0)})]}),h.genType===`video`?h.duration||h.aspectRatio||h.resolution?(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(l7,{label:`时长`,value:h.duration?`${h.duration}秒`:`-`}),(0,Q.jsx)(l7,{label:`比例`,value:h.aspectRatio||`-`}),(0,Q.jsx)(l7,{label:`分辨率`,value:h.resolution||`-`})]}):(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,textAlign:`center`},children:(0,Q.jsx)(xR,{color:`default`,children:`视频参数待用户配置`})}):null,h.genType===`image`?h.imageSize||h.imageProportion||h.imagePx?(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(l7,{label:`尺寸`,value:h.imagePx||`-`}),(0,Q.jsx)(l7,{label:`比例`,value:h.imageProportion||`-`}),(0,Q.jsx)(l7,{label:`分辨率`,value:h.imageSize||`-`})]}):(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,textAlign:`center`},children:(0,Q.jsx)(xR,{color:`default`,children:`图片参数待用户配置`})}):null,!h?.references||h.references.length===0?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`参考内容`}),(0,Q.jsx)(`div`,{style:{display:`flex`,gap:10,flexWrap:`wrap`},children:h.references.map((e,t)=>U(e,t))})]}),h.status===`completed`?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:h.genType===`video`?`生成视频`:`生成图片`}),h.genType===`video`?H():B()]}):null,h.status===`failed`&&h.errorMessage?(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`rgba(239,68,68,0.04)`,border:`1px solid rgba(239,68,68,0.15)`},children:(0,Q.jsxs)(Z.Text,{style:{fontSize:12,color:`#ef4444`},children:[`错误信息: `,h.errorMessage]})}):null,(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,fontSize:12,color:`#94a3b8`,flexWrap:`wrap`},children:[(0,Q.jsxs)(`span`,{children:[`创建: `,n7(h.createdAt)]}),(0,Q.jsxs)(`span`,{children:[`生成: `,n7(h.generatedAt)]})]})]}):(0,Q.jsx)(Ky,{description:`暂无详情`})}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[T&&(T.record.genType===`video`?(0,Q.jsx)(c0,{}):(0,Q.jsx)(fX,{})),T&&(T.record.genType===`video`?`生成视频`:`生成图片`)]}),open:!!T,onCancel:()=>E(null),onOk:I,okText:`提交生成`,cancelText:`取消`,confirmLoading:T?S===T.record.id:!1,width:420,children:T?(0,Q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:16},children:T.record.genType===`video`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`时长`}),(0,Q.jsxs)(Z.Text,{strong:!0,children:[T.record.duration||5,`s`]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`画面比例`}),(0,Q.jsx)(Sb,{value:T.ratio,onChange:e=>E(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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`分辨率`}),(0,Q.jsx)(Sb,{value:T.resolution,onChange:e=>E(t=>t?{...t,resolution:e}:null),style:{width:`100%`},options:[`480p`,`720p`,`1080p`].map(e=>({value:e,label:e}))})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`尺寸`}),(0,Q.jsx)(Z.Text,{strong:!0,children:T.record.imagePx||`-`})]}),(0,Q.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`比例`}),(0,Q.jsx)(Z.Text,{strong:!0,children:T.record.imageProportion||`-`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`分辨率`}),(0,Q.jsx)(Sb,{value:T.image_size,onChange:e=>E(t=>t?{...t,image_size:e}:null),style:{width:`100%`},options:[`2K`,`4K`].map(e=>({value:e,label:e}))})]})]})}):null})]})},{RangePicker:FUe}=cM,u7=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``),d7=20,f7=e=>e&&(e.name||e.modelName||e.id)||null,p7={image:`empty`,video:`empty`,videoCover:`empty`,references:{}},m7={pending:{color:`default`,text:`待处理`,icon:(0,Q.jsx)(iM,{})},generating:{color:`warning`,text:`生成中`,icon:(0,Q.jsx)(fm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,Q.jsx)(IK,{})},failed:{color:`error`,text:`失败`,icon:(0,Q.jsx)(cq,{})}},h7={timeout:`任务超时`,queued:`已入队`,preparing:`准备中`,creating_provider_task:`创建任务中`,waiting_remote:`等待生成`,result_ready:`结果就绪`,downloading:`下载中`,done:`完成`,download_failed:`下载失败`,polling:`轮询中`,failed:`失败`},g7={image:{text:`图片`,color:`purple`,icon:(0,Q.jsx)(fX,{})},video:{text:`视频`,color:`geekblue`,icon:(0,Q.jsx)($6,{})}},IUe=e=>/^(https?:)?\/\//i.test(e)||/^(blob|data):/i.test(e),_7=e=>!!e&&/^blob:/i.test(e.trim()),v7=e=>{if(!e)return``;let t=String(e).trim();return t?IUe(t)?t:u7?`${u7}${t.startsWith(`/`)?t:`/${t}`}`:t.startsWith(`/`)?t:`/${t}`:``},LUe=e=>e?e.length>12?`${e.slice(0,8)}...`:e:`-`,y7=e=>e?E5(e):`-`,RUe=e=>e==null||e===``,b7=e=>{if(!e||_7(e))return!1;try{let t=new URL(v7(e),window.location.origin),n=t.searchParams.get(`exp`)||t.searchParams.get(`expires`)||t.searchParams.get(`expire`)||t.searchParams.get(`expires_at`)||t.searchParams.get(`x-expires`);if(!n)return!1;let r=Number(n);if(!Number.isFinite(r))return!1;let i=r>1e10?r:r*1e3;return Date.now()>=i}catch{return!1}},x7=e=>e?_7(e)||b7(e)?`invalid`:`checking`:`empty`,S7=e=>{let t=e.url||e.mediaUrl||e.fileUrl;return typeof t==`string`&&t.trim()?t.trim():void 0},C7=e=>{let t=String(e.type||e.mediaType||e.mimeType||``).toLowerCase(),n=S7(e)?.toLowerCase()||``;return t.includes(`video`)||/\.(mp4|mov|webm|m4v)(\?|$)/i.test(n)?`video`:t.includes(`image`)||/\.(png|jpe?g|webp|gif|bmp|svg)(\?|$)/i.test(n)?`image`:t||`unknown`},w7=(e,t)=>`${t}-${S7(e)||`empty`}`,T7=(e,t=`资源`)=>_7(e)?`本地临时素材已失效`:b7(e)?`${t}链接已超时,请刷新列表或重新搜索后再查看`:`${t}加载失败,请刷新列表或重新搜索后再查看`,E7=({text:e,minHeight:t=240,compact:n=!1,action:r})=>(0,Q.jsxs)(`div`,{style:{width:`100%`,minHeight:n?void 0:t,height:n?`100%`:void 0,borderRadius:n?10:12,background:`#f8f9fc`,border:`1px dashed #cbd5e1`,color:`#64748b`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexDirection:`column`,gap:n?4:10,textAlign:`center`},children:[(0,Q.jsx)(Z.Text,{style:{color:`#64748b`,fontSize:n?11:13},children:e}),r]}),D7=({label:e,value:t})=>(0,Q.jsxs)(`div`,{style:{flex:1,minWidth:120},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:14},children:RUe(t)?`-`:t})]}),O7=()=>(0,QS.default)().startOf(`day`),k7=()=>(0,QS.default)().endOf(`day`),zUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(0),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(1),[c,l]=(0,C.useState)(``),[u,d]=(0,C.useState)(``),[f,p]=(0,C.useState)(``),[m,h]=(0,C.useState)(``),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(``),[T,E]=(0,C.useState)([O7(),k7()]),[D,O]=(0,C.useState)([O7(),k7()]),[k,A]=(0,C.useState)(0),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(p7),[F,I]=(0,C.useState)(!1),L=(0,C.useRef)(null),[R,z]=(0,C.useState)(null),B=(0,C.useCallback)(async()=>{a(!0);try{let e=await MVe({genType:u||void 0,status:c||void 0,userId:v||void 0,userName:b||void 0,engineId:S||void 0,createdStart:D?.[0]?.format?.(`YYYY-MM-DDTHH:mm:ss`),createdEnd:D?.[1]?.format?.(`YYYY-MM-DDTHH:mm:ss`),page:o,pageSize:d7});t(e.items||[]),r(e.total||0)}catch(e){yP.error(e?.message||`加载创作记录失败`)}finally{a(!1)}},[u,c,o,v,b,S,D]);(0,C.useEffect)(()=>{B()},[B,k]),(0,C.useEffect)(()=>{if(!j){P(p7);return}let e=(j.mediaReferences||[]).reduce((e,t,n)=>{let r=S7(t);return e[w7(t,n)]=x7(r),e},{});L.current&&(L.current.pause(),L.current.currentTime=0),I(!1),P({image:x7(j.imageUrl),video:x7(j.videoUrl),videoCover:x7(j.videoCoverUrl),references:e})},[j]);let V=()=>{s(1),y(m.trim()),x(g.trim()),w(f),O(T),A(e=>e+1)},H=()=>{l(``),d(``),p(``),h(``),_(``),y(``),x(``),w(``);let e=[O7(),k7()];E(e),O(e),s(1),A(e=>e+1)},U=(0,C.useCallback)(e=>{M(e)},[]),W=()=>{L.current&&L.current.pause(),I(!1),M(null)},ee=e=>{P(t=>({...t,...e}))},te=(e,t)=>{P(n=>({...n,references:{...n.references,[e]:t}}))},ne=()=>{if(j?.videoUrl){if(b7(j.videoUrl)){ee({video:`invalid`}),yP.warning(`视频链接已超时,请刷新列表或重新搜索后再查看`);return}I(!0),window.setTimeout(()=>{L.current?.play().catch(()=>{I(!1),ee({video:`invalid`}),yP.warning(`视频播放失败,请确认资源链接是否仍然有效`)})},0)}},re=(e,t=`素材`)=>{if(!e){yP.warning(`${t}链接为空,暂无法查看`);return}if(_7(e)){yP.warning(`本地临时素材已失效,暂无法查看`);return}if(b7(e)){yP.warning(`${t}链接已超时,请刷新列表或重新搜索后再查看`);return}window.open(v7(e),`_blank`,`noopener,noreferrer`)},ie=(e,t,n)=>{if(_7(e)){yP.warning(`本地临时素材已失效,暂无法查看`);return}if(b7(e)){yP.warning(`链接已超时,请刷新列表或重新搜索后再查看`);return}z({url:v7(e),type:t,title:n})},ae=()=>z(null),G=(0,C.useMemo)(()=>[{title:`用户`,key:`user`,width:150,render:(e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:13},children:t.userName||`未知用户`}),(0,Q.jsx)(`div`,{style:{fontSize:11,color:`#94a3b8`},children:LUe(t.userId)})]})},{title:`类型`,dataIndex:`genType`,width:90,render:e=>{let t=g7[e]||{text:e||`-`,color:`default`,icon:null};return(0,Q.jsx)(xR,{color:t.color,icon:t.icon,children:t.text})}},{title:`引擎`,key:`engine`,width:160,render:(e,t)=>{let n=f7(t.engineSnapshot);return(0,Q.jsx)(fx,{title:t.engineId||`未知引擎`,placement:`topLeft`,children:(0,Q.jsx)(xR,{icon:(0,Q.jsx)(k2,{}),color:`cyan`,children:n||t.engineId||`-`})})}},{title:`附件`,key:`references`,width:100,render:(e,t)=>{let n=t.mediaReferences||[];return n.length===0?(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`},children:`无`}):(0,Q.jsx)(OM,{size:2,wrap:!0,children:n.map((e,t)=>{let n=S7(e),r=C7(e),i=typeof e.name==`string`&&e.name?e.name:`附件 ${t+1}`;return n?(0,Q.jsx)(fx,{title:i,children:(0,Q.jsx)(XS,{size:`small`,type:`text`,icon:r===`video`?(0,Q.jsx)($6,{style:{color:`#6366f1`}}):r===`audio`?(0,Q.jsx)(JH,{style:{color:`#f59e0b`}}):(0,Q.jsx)(fX,{style:{color:`#8b5cf6`}}),style:{width:28,height:28,padding:0},onClick:e=>{e.stopPropagation(),ie(n,r===`video`?`video`:`image`,i)}})},t):null})})}},{title:`结果`,key:`result`,width:90,render:(e,t)=>t.status===`completed`?t.genType===`video`&&t.videoUrl?(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(c0,{}),type:`link`,style:{padding:0},onClick:e=>{e.stopPropagation(),ie(t.videoUrl,`video`,`生成视频`)},children:`看视频`}):t.genType===`image`&&t.imageUrl?(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(fX,{}),type:`link`,style:{padding:0},onClick:e=>{e.stopPropagation(),ie(t.imageUrl,`image`,`生成图片`)},children:`看图片`}):(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`},children:`无`}):(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`},children:`-`})},{title:`提示词`,key:`prompt`,ellipsis:!0,render:(e,t)=>(0,Q.jsx)(fx,{title:t.originalPrompt,placement:`topLeft`,children:(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#475569`},ellipsis:!0,children:t.originalPrompt||`-`})})},{title:`参数`,key:`params`,width:180,render:(e,t)=>t.genType===`video`?t.duration||t.aspectRatio||t.resolution?(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[t.duration?(0,Q.jsxs)(xR,{children:[t.duration,`s`]}):null,t.aspectRatio?(0,Q.jsx)(xR,{children:t.aspectRatio}):null,t.resolution?(0,Q.jsx)(xR,{children:t.resolution}):null]}):(0,Q.jsx)(xR,{color:`default`,children:`无参数`}):t.imageSize||t.imageProportion||t.imagePx?(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[t.imageSize?(0,Q.jsx)(xR,{children:t.imageSize}):null,t.imageProportion?(0,Q.jsx)(xR,{children:t.imageProportion}):null,t.imagePx?(0,Q.jsx)(xR,{children:t.imagePx}):null]}):(0,Q.jsx)(xR,{color:`default`,children:`无参数`})},{title:`积分`,key:`credits`,width:130,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{fontSize:12},children:[(0,Q.jsxs)(`div`,{style:{color:`#6366f1`},children:[`总: `,t.creditsCost||0]}),t.textCreditsCost>0?(0,Q.jsxs)(`div`,{style:{color:`#f59e0b`},children:[`文字: `,t.textCreditsCost]}):null]})},{title:`状态`,dataIndex:`status`,width:100,render:e=>{let t=m7[e]||{color:`default`,text:e||`-`,icon:null};return(0,Q.jsx)(xR,{color:t.color,icon:t.icon,children:t.text})}},{title:`阶段`,dataIndex:`pipelineStage`,width:120,render:e=>(0,Q.jsx)(xR,{color:`blue`,children:h7[e]||e||`-`})},{title:`时间`,key:`time`,width:170,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{fontSize:12,color:`#94a3b8`},children:[(0,Q.jsx)(`div`,{children:y7(t.createdAt)}),t.generatedAt?(0,Q.jsxs)(`div`,{style:{color:`#10b981`},children:[`生成: `,y7(t.generatedAt)]}):null]})},{title:`操作`,key:`action`,width:90,fixed:`right`,render:(e,t)=>(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(ON,{}),onClick:()=>U(t),children:`详情`})}],[U]),oe=j?g7[j.genType]||{text:j.genType||`-`,color:`default`,icon:null}:null,K=j?m7[j.status]||{color:`default`,text:j.status||`-`,icon:null}:null,se=()=>{if(!j||j.genType!==`image`||j.status!==`completed`)return null;if(!j.imageUrl)return(0,Q.jsx)(E7,{text:`此图片任务暂无结果图片`,minHeight:260});if(N.image===`invalid`)return(0,Q.jsx)(E7,{text:T7(j.imageUrl,`图片`),minHeight:260});let e=v7(j.imageUrl);return(0,Q.jsxs)(`div`,{style:{position:`relative`,width:`100%`,minHeight:260,borderRadius:12,background:`#f8f9fc`,border:`1px solid #e2e8f0`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,Q.jsx)(`img`,{src:e,alt:`生成图片`,onLoad:()=>ee({image:`valid`}),onError:()=>ee({image:`invalid`}),style:{display:N.image===`valid`?`block`:`none`,width:`100%`,maxHeight:560,objectFit:`contain`,background:`#fff`}},`${j.id}-${e}`),N.image===`checking`?(0,Q.jsx)(E7,{text:`图片加载检测中...`,minHeight:260}):null]})},ce=()=>{if(!j||F||N.video===`invalid`)return null;let e=j.videoUrl?(0,Q.jsx)(XS,{type:`primary`,shape:`circle`,size:`large`,icon:(0,Q.jsx)(c0,{}),onClick:ne,style:{boxShadow:`0 8px 20px rgba(15,23,42,0.25)`}}):null;if(!j.videoCoverUrl)return(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:12,overflow:`hidden`,background:`#f8f9fc`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,Q.jsx)(E7,{text:`此视频无封面`,minHeight:340,action:e})});if(N.videoCover===`invalid`)return(0,Q.jsx)(E7,{text:T7(j.videoCoverUrl,`视频封面`),minHeight:340,action:e});let t=v7(j.videoCoverUrl);return(0,Q.jsxs)(`div`,{style:{position:`absolute`,inset:0,borderRadius:12,overflow:`hidden`,background:`#f8f9fc`,border:`1px solid #e2e8f0`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,Q.jsx)(`img`,{src:t,alt:`视频封面`,onLoad:()=>ee({videoCover:`valid`}),onError:()=>ee({videoCover:`invalid`}),style:{display:N.videoCover===`valid`?`block`:`none`,width:`100%`,height:`100%`,objectFit:`contain`,background:`#000`}},`${j.id}-cover-${t}`),N.videoCover===`checking`?(0,Q.jsx)(E7,{text:`视频封面加载检测中...`,minHeight:340,action:e}):null,N.videoCover===`valid`?(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(15,23,42,0.18)`},children:e}):null]})},le=()=>{if(!j||j.genType!==`video`||j.status!==`completed`)return null;if(!j.videoUrl)return(0,Q.jsx)(E7,{text:`此视频任务暂无结果视频`,minHeight:340});if(N.video===`invalid`)return(0,Q.jsx)(E7,{text:T7(j.videoUrl,`视频`),minHeight:340});let e=v7(j.videoUrl);return(0,Q.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:340,borderRadius:12,background:`#000`,overflow:`hidden`,border:`1px solid #e2e8f0`},children:[(0,Q.jsx)(`video`,{ref:L,src:e,preload:`metadata`,controls:F,onLoadedMetadata:()=>ee({video:`valid`}),onCanPlay:()=>ee({video:`valid`}),onPlaying:()=>{I(!0),ee({video:`valid`})},onPause:()=>I(!1),onEnded:()=>I(!1),onError:()=>{I(!1),ee({video:`invalid`})},style:{width:`100%`,height:`100%`,objectFit:`contain`,background:`#000`,opacity:+!!F,pointerEvents:F?`auto`:`none`}},`${j.id}-${e}`),ce()]})},ue=(e,t)=>{let n=S7(e),r=C7(e),i=w7(e,t),a=N.references[i]||x7(n),o=r===`image`,s=r===`video`,c=typeof e.name==`string`&&e.name?e.name:`参考素材 ${t+1}`;if(!n)return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsx)(`div`,{style:{width:94,height:94},children:(0,Q.jsx)(E7,{text:`无链接`,compact:!0})}),(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})]},i);if(a===`invalid`)return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsx)(`div`,{style:{width:94,height:94},children:(0,Q.jsx)(E7,{text:_7(n)?`本地临时素材已失效`:`素材不可访问`,compact:!0})}),(0,Q.jsx)(fx,{title:c,children:(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})})]},i);let l=v7(n);return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,title:`点击新页面查看素材`,onClick:()=>re(n,s?`视频素材`:o?`图片素材`:`素材`),onKeyDown:e=>{e.key===`Enter`&&re(n,s?`视频素材`:o?`图片素材`:`素材`)},style:{width:94,height:94,borderRadius:10,overflow:`hidden`,border:`1px solid #e2e8f0`,background:`#f8f9fc`,position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`},children:[o?(0,Q.jsx)(`img`,{src:l,alt:c,onLoad:()=>te(i,`valid`),onError:()=>te(i,`invalid`),style:{display:a===`valid`?`block`:`none`,width:`100%`,height:`100%`,objectFit:`cover`}}):null,s?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`video`,{src:l,preload:`metadata`,onLoadedMetadata:()=>te(i,`valid`),onError:()=>te(i,`invalid`),style:{display:`none`}}),(0,Q.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12,textAlign:`center`},children:[(0,Q.jsx)(c0,{style:{fontSize:18}}),(0,Q.jsx)(`div`,{children:`视频素材`}),(0,Q.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,marginTop:2},children:`点击查看`})]})]}):null,!o&&!s?(0,Q.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12,textAlign:`center`},children:[`文件素材`,(0,Q.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,marginTop:2},children:`点击查看`})]}):null,a===`checking`&&o?(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#f8f9fc`},children:(0,Q.jsx)(fm,{style:{color:`#6366f1`}})}):null]}),(0,Q.jsx)(fx,{title:c,children:(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})})]},i)};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16,flexWrap:`wrap`,gap:12},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(c0,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`创作记录管理`}),(0,Q.jsxs)(xR,{color:`purple`,children:[n,` 条记录`]})]}),(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`状态筛选`,value:c||void 0,style:{width:140},onChange:e=>{l(e||``),s(1)},options:[{value:`generating`,label:`生成中`},{value:`completed`,label:`已完成`},{value:`failed`,label:`失败`}]}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`类型筛选`,value:u||void 0,style:{width:120},onChange:e=>{d(e||``),s(1)},options:[{value:`image`,label:`图片`},{value:`video`,label:`视频`}]}),(0,Q.jsx)(Sb,{allowClear:!0,showSearch:!0,placeholder:`引擎筛选`,value:f||void 0,style:{width:180},onChange:e=>{p(e||``),s(1),w(e||``)},optionFilterProp:`label`,options:Array.from(new Map(e.filter(e=>e.engineId).map(e=>[e.engineId,{value:e.engineId,label:f7(e.engineSnapshot)||e.engineId}])).values())}),(0,Q.jsx)(FUe,{value:T,onChange:e=>{e&&e[0]&&e[1]?E([e[0].startOf(`day`),e[1].endOf(`day`)]):E(e)},placeholder:[`开始日期`,`结束日期`]}),(0,Q.jsx)(LN,{placeholder:`用户ID搜索`,prefix:(0,Q.jsx)(_b,{style:{color:`#94a3b8`}}),style:{width:150},value:m,onChange:e=>h(e.target.value),onPressEnter:V,allowClear:!0}),(0,Q.jsx)(LN,{placeholder:`用户名搜索`,prefix:(0,Q.jsx)(_b,{style:{color:`#94a3b8`}}),style:{width:150},value:g,onChange:e=>_(e.target.value),onPressEnter:V,allowClear:!0}),(0,Q.jsx)(XS,{type:`primary`,onClick:V,style:{borderRadius:8},children:`搜索`}),(0,Q.jsx)(XS,{onClick:H,style:{borderRadius:8},children:`重置`})]})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:i,columns:G,dataSource:e,scroll:{x:1650},pagination:{current:o,pageSize:d7,total:n,showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:e=>s(e)}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[j?.genType===`video`?(0,Q.jsx)($6,{}):(0,Q.jsx)(fX,{}),(0,Q.jsx)(`span`,{children:`创作记录详情`})]}),open:!!j,onCancel:W,footer:null,width:900,destroyOnClose:!0,children:j?(0,Q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:12},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:[oe?(0,Q.jsx)(xR,{color:oe.color,icon:oe.icon,children:oe.text}):null,K?(0,Q.jsx)(xR,{color:K.color,icon:K.icon,children:K.text}):null,j.pipelineStage?(0,Q.jsx)(xR,{color:`blue`,children:h7[j.pipelineStage]||j.pipelineStage}):null]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`用户名称`,value:j.userName||`未知用户`}),(0,Q.jsx)(D7,{label:`用户ID`,value:j.userId||`-`}),(0,Q.jsx)(D7,{label:`任务ID`,value:j.id})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`原始提示词`}),(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,lineHeight:1.6},children:j.originalPrompt||`-`})]}),j.genType===`video`?(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`时长`,value:j.duration?`${j.duration}秒`:`-`}),(0,Q.jsx)(D7,{label:`画面比例`,value:j.aspectRatio||`-`}),(0,Q.jsx)(D7,{label:`分辨率`,value:j.resolution||`-`})]}):(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`图片档位`,value:j.imageSize||`-`}),(0,Q.jsx)(D7,{label:`图片比例`,value:j.imageProportion||`-`}),(0,Q.jsx)(D7,{label:`像素尺寸`,value:j.imagePx||`-`})]}),j.engineSnapshot?(0,Q.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`引擎快照`}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`引擎名称`,value:j.engineSnapshot.name||`-`}),(0,Q.jsx)(D7,{label:`服务商`,value:j.engineSnapshot.provider||`-`}),(0,Q.jsx)(D7,{label:`模型`,value:j.engineSnapshot.modelName||`-`}),(0,Q.jsx)(D7,{label:`引擎ID`,value:j.engineSnapshot.id||j.engineId||`-`})]})]}):null,(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`总积分`,value:(0,Q.jsx)(Z.Text,{strong:!0,style:{color:`#6366f1`},children:j.creditsCost||0})}),(0,Q.jsx)(D7,{label:`文字积分`,value:`${j.textCreditsCost||0} (${j.textTokensUsed||0} tokens)`}),(0,Q.jsx)(D7,{label:`图片 tokens`,value:j.imageTokensUsed??0}),(0,Q.jsx)(D7,{label:`视频 tokens`,value:j.videoTokensUsed??0})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`第三方任务ID`,value:j.providerTaskId||j.seedanceTaskId||`-`}),(0,Q.jsx)(D7,{label:`轮询次数`,value:j.pollCount??0}),(0,Q.jsx)(D7,{label:`重试次数`,value:j.retryCount??0})]}),!j?.mediaReferences||j.mediaReferences.length===0?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`参考内容`}),(0,Q.jsx)(`div`,{style:{display:`flex`,gap:10,flexWrap:`wrap`},children:j.mediaReferences.map((e,t)=>ue(e,t))})]}),j.mediaReferences&&j.mediaReferences.length>0?(0,Q.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`附件快速查看(点击新窗口打开)`}),(0,Q.jsx)(OM,{size:8,wrap:!0,children:j.mediaReferences.map((e,t)=>{let n=S7(e),r=C7(e),i=typeof e.name==`string`&&e.name?e.name:`附件 ${t+1}`;return n?(0,Q.jsx)(XS,{size:`small`,icon:r===`video`?(0,Q.jsx)(c0,{}):(0,Q.jsx)(g$,{}),onClick:()=>ie(n,r===`video`?`video`:`image`,i),children:i},t):null})})]}):null,j.status===`completed`?(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:6},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`},children:j.genType===`video`?`生成视频`:`生成图片`}),j.genType===`video`&&j.videoUrl?(0,Q.jsx)(XS,{size:`small`,type:`link`,icon:(0,Q.jsx)(c0,{}),onClick:()=>ie(j.videoUrl,`video`,`生成视频`),style:{padding:0},children:`弹窗播放`}):null,j.genType===`image`&&j.imageUrl?(0,Q.jsx)(XS,{size:`small`,type:`link`,icon:(0,Q.jsx)(fX,{}),onClick:()=>ie(j.imageUrl,`image`,`生成图片`),style:{padding:0},children:`弹窗查看`}):null]}),j.genType===`video`?le():se()]}):null,j.status===`failed`&&j.errorMessage?(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`rgba(239,68,68,0.04)`,border:`1px solid rgba(239,68,68,0.15)`},children:(0,Q.jsxs)(Z.Text,{style:{fontSize:12,color:`#ef4444`},children:[`错误信息: `,j.errorMessage]})}):null,(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,fontSize:12,color:`#94a3b8`,flexWrap:`wrap`},children:[(0,Q.jsxs)(`span`,{children:[`创建: `,y7(j.createdAt)]}),(0,Q.jsxs)(`span`,{children:[`生成: `,y7(j.generatedAt)]})]})]}):(0,Q.jsx)(Ky,{description:`暂无详情`})}),(0,Q.jsx)(xP,{title:R?.title||`资源预览`,open:!!R,onCancel:ae,footer:null,width:R?.type===`video`?800:600,destroyOnHidden:!0,children:R?R.type===`video`?(0,Q.jsx)(`video`,{src:R.url,controls:!0,autoPlay:!0,style:{width:`100%`,maxHeight:600,background:`#000`,borderRadius:8}},R.url):(0,Q.jsx)(`img`,{src:R.url,alt:R.title,style:{width:`100%`,maxHeight:600,objectFit:`contain`,borderRadius:8}}):null})]})},A7=20,BUe=[{value:`pending`,label:`已创建`},{value:`waiting_user`,label:`等待用户操作`},{value:`processing`,label:`处理中`},{value:`completed`,label:`已完成`},{value:`failed`,label:`失败`},{value:`cancelled`,label:`已取消`}],VUe={pending:{color:`default`,text:`已创建`},waiting_user:{color:`processing`,text:`等待用户操作`},processing:{color:`warning`,text:`处理中`},completed:{color:`success`,text:`已完成`},failed:{color:`error`,text:`失败`},cancelled:{color:`default`,text:`已取消`}},HUe={material_input:`素材输入`,image_prompt_optimize:`图片 AI 提词`,image_generate:`图片生成`,video_prompt_optimize:`视频 AI 提词`,video_generate:`视频生成`},j7=e=>e?E5(e):`-`,M7=e=>e?e.length>16?`${e.slice(0,10)}...`:e:`-`,UUe=({status:e})=>{if(!e)return(0,Q.jsx)(xR,{children:`-`});let t=VUe[e]||{color:`blue`,text:e};return(0,Q.jsx)(xR,{color:t.color,children:t.text})},WUe=()=>{let e=Ze(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)(0),[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(1),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(null),[y,b]=(0,C.useState)(``),[x,S]=(0,C.useState)(``),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(0),A=(0,C.useCallback)(async()=>{o(!0);try{let e=await NVe({status:l||void 0,keyword:y||void 0,userId:x||void 0,userName:w||void 0,createdStart:E?.[0]?.toISOString?.(),createdEnd:E?.[1]?.toISOString?.(),page:s,pageSize:A7});n(e.items||[]),i(e.total||0)}catch(e){yP.error(e?.message||`加载爆款开头复刻任务失败`)}finally{o(!1)}},[s,E,y,x,w,l]);(0,C.useEffect)(()=>{A()},[A,O]);let j=()=>{b(d.trim()),S(p.trim()),T(h.trim()),D(_),c(1)};return(0,Q.jsx)(`div`,{style:{padding:24},children:(0,Q.jsx)(NA,{children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(OM,{align:`center`,style:{justifyContent:`space-between`,width:`100%`},children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Title,{level:3,style:{marginBottom:4},children:`爆款开头复刻`}),(0,Q.jsx)(Z.Text,{type:`secondary`,children:`只读排查页面:查看任务列表、素材、步骤详情和生成结果。`})]}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>k(e=>e+1),children:`刷新`})]}),(0,Q.jsxs)(OM,{wrap:!0,children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`任务状态`,style:{width:160},value:l||void 0,onChange:e=>{u(e||``),c(1)},options:BUe}),(0,Q.jsx)(LN,{allowClear:!0,prefix:(0,Q.jsx)(_b,{}),placeholder:`关键词:标题/项目名/核心点`,style:{width:260},value:d,onChange:e=>f(e.target.value),onPressEnter:j}),(0,Q.jsx)(LN,{allowClear:!0,placeholder:`用户ID(管理员)`,style:{width:190},value:p,onChange:e=>m(e.target.value),onPressEnter:j}),(0,Q.jsx)(LN,{allowClear:!0,placeholder:`用户名(管理员)`,style:{width:230},value:h,onChange:e=>g(e.target.value),onPressEnter:j}),(0,Q.jsx)(cM.RangePicker,{showTime:!0,value:_,onChange:v,placeholder:[`创建开始`,`创建结束`]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(_b,{}),onClick:j,children:`搜索`}),(0,Q.jsx)(XS,{onClick:()=>{u(``),f(``),m(``),g(``),v(null),b(``),S(``),T(``),D(null),c(1),k(e=>e+1)},children:`重置`})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:a,dataSource:t,pagination:{current:s,pageSize:A7,total:r,showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:c},scroll:{x:1380},columns:[{title:`项目ID`,dataIndex:`id`,width:150,render:e=>(0,Q.jsx)(fx,{title:e,children:M7(e)})},{title:`用户`,width:180,render:(e,t)=>(0,Q.jsxs)(OM,{direction:`vertical`,size:0,children:[(0,Q.jsx)(Z.Text,{children:t.userName||`-`}),(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12},children:M7(t.userId)})]})},{title:`项目信息`,width:260,render:(e,t)=>(0,Q.jsxs)(OM,{direction:`vertical`,size:2,children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.title||t.targetProjectName||`-`}),(0,Q.jsxs)(Z.Text,{type:`secondary`,ellipsis:!0,style:{maxWidth:240},children:[`素材:`,t.sourceProjectName||`-`]}),(0,Q.jsxs)(Z.Text,{type:`secondary`,ellipsis:!0,style:{maxWidth:240},children:[`核心:`,t.coreContentPoint||`-`]})]})},{title:`状态`,dataIndex:`status`,width:130,render:e=>(0,Q.jsx)(UUe,{status:e})},{title:`当前步骤`,dataIndex:`currentStepCode`,width:140,render:e=>HUe[e]||e||`-`},{title:`图片结果`,dataIndex:`finalImageUrl`,width:90,render:e=>e?(0,Q.jsx)(xR,{color:`success`,children:`有`}):(0,Q.jsx)(xR,{children:`无`})},{title:`视频结果`,dataIndex:`finalVideoUrl`,width:90,render:e=>e?(0,Q.jsx)(xR,{color:`success`,children:`有`}):(0,Q.jsx)(xR,{children:`无`})},{title:`错误信息`,dataIndex:`errorMessage`,width:220,ellipsis:!0,render:e=>e||`-`},{title:`创建时间`,dataIndex:`createdAt`,width:170,render:j7},{title:`更新时间`,dataIndex:`updatedAt`,width:170,render:j7},{title:`操作`,fixed:`right`,width:110,render:(t,n)=>(0,Q.jsx)(XS,{type:`link`,icon:(0,Q.jsx)(ON,{}),onClick:()=>e(`/hot-opening-replications/${n.id}`),children:`详情`})}]})]})})})},N7=({value:e,maxHeight:t=420})=>e==null||e===``?(0,Q.jsx)(Ky,{image:Ky.PRESENTED_IMAGE_SIMPLE,description:`暂无 JSON 数据`}):(0,Q.jsx)(`pre`,{style:{margin:0,padding:12,maxHeight:t,overflow:`auto`,background:`#0f172a`,color:`#e2e8f0`,borderRadius:8,fontSize:12,lineHeight:1.6},children:JSON.stringify(e,null,2)}),GUe=({input:e,output:t,raw:n,inputLabel:r=`查看 input_json`,outputLabel:i=`查看 output_json`,rawLabel:a=`查看原始 JSON`})=>{let o=[];return e!==void 0&&o.push({key:`input`,label:r,children:(0,Q.jsx)(N7,{value:e})}),t!==void 0&&o.push({key:`output`,label:i,children:(0,Q.jsx)(N7,{value:t})}),n!==void 0&&o.push({key:`raw`,label:a,children:(0,Q.jsx)(N7,{value:n})}),o.length?(0,Q.jsx)(Hh,{size:`small`,style:{marginTop:12},items:o}):null},KUe=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``);function qUe(e){if(!e)return``;let t=String(e).trim();return t?/^(https?:)?\/\//i.test(t)||/^(blob|data):/i.test(t)?t:`${KUe}${t.startsWith(`/`)?t:`/${t}`}`:``}var P7=({url:e,type:t,height:n=260,emptyDescription:r=`暂无资源`,errorDescription:i=`资源加载失败,可能文件不存在、签名过期或访问权限受限。`})=>{let a=(0,C.useMemo)(()=>qUe(e),[e]),[o,s]=(0,C.useState)(!1);(0,C.useEffect)(()=>{s(!1)},[a]);let c=a?(0,Q.jsxs)(OM,{wrap:!0,style:{marginTop:8},children:[(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(XR,{}),onClick:async()=>{if(a)try{await navigator.clipboard.writeText(a),yP.success(`资源地址已复制`)}catch{yP.error(`复制失败,请手动复制`)}},children:`复制地址`}),(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(g$,{}),onClick:()=>window.open(a,`_blank`,`noopener,noreferrer`),children:`新窗口打开`}),(0,Q.jsx)(Z.Text,{copyable:{text:a},type:`secondary`,style:{maxWidth:460},ellipsis:!0,children:a})]}):null;return a?(0,Q.jsxs)(`div`,{children:[o?(0,Q.jsx)(cf,{type:`warning`,showIcon:!0,message:`资源预览失败`,description:i,style:{marginBottom:8}}):null,t===`image`?(0,Q.jsx)(CN,{src:a,onError:()=>s(!0),style:{width:`100%`,maxHeight:n,objectFit:`contain`,borderRadius:12,background:`#f8fafc`,border:`1px solid #f1f5f9`},fallback:``,preview:!o}):(0,Q.jsx)(`video`,{src:a,controls:!0,preload:`metadata`,onError:()=>s(!0),style:{width:`100%`,maxHeight:n,borderRadius:12,background:`#0f172a`,border:`1px solid #f1f5f9`}}),c]}):(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`div`,{style:{height:n,borderRadius:12,border:`1px dashed #cbd5e1`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#f8fafc`},children:(0,Q.jsx)(Ky,{image:Ky.PRESENTED_IMAGE_SIMPLE,description:r})})})},F7={pending:{text:`待处理`,color:`default`},waiting_user:{text:`等待用户操作`,color:`processing`},processing:{text:`处理中`,color:`warning`},completed:{text:`已完成`,color:`success`},failed:{text:`失败`,color:`error`},cancelled:{text:`已取消`,color:`default`},canceled:{text:`已取消`,color:`default`},timeout:{text:`已超时`,color:`error`},queued:{text:`已入队`,color:`processing`},preparing:{text:`准备中`,color:`processing`},creating_provider_task:{text:`创建远端任务`,color:`processing`},waiting_remote:{text:`等待远端结果`,color:`processing`},polling:{text:`轮询远端结果`,color:`processing`},result_ready:{text:`结果已就绪`,color:`success`},downloading:{text:`下载中`,color:`processing`},done:{text:`已完成`,color:`success`},download_failed:{text:`下载失败`,color:`error`},retry_waiting:{text:`等待重试`,color:`orange`},pending_analysis:{text:`等待分析`,color:`default`},analyzing:{text:`分析中`,color:`processing`},analysis_completed:{text:`分析完成`,color:`success`},analysis_failed:{text:`分析失败`,color:`error`},splitting:{text:`拆镜中`,color:`warning`},split_completed:{text:`拆镜完成`,color:`success`},partial_failed:{text:`部分失败`,color:`orange`},none:{text:`未拆镜`,color:`default`},not_required:{text:`无需处理`,color:`default`},not_started:{text:`未开始`,color:`default`},project_created:{text:`已创建项目`,color:`processing`},true:{text:`是`,color:`success`},false:{text:`否`,color:`default`}},I7={material_input:`素材输入`,image_prompt_optimize:`图片 AI 提词`,image_generate:`图片生成`,video_prompt_optimize:`视频 AI 提词`,video_generate:`视频生成`},L7={hot_opening_replicate:`爆款开头复刻`,shot_replicate:`拆镜复刻`},R7={ai_suggestion:{text:`AI 建议`,color:`purple`},custom:{text:`自定义`,color:`cyan`},original:{text:`原视频`,color:`blue`}};function z7(e){return e?L7[e]||e:`-`}function B7(e){return e?I7[e]||e:`-`}function JUe(e){return e?F7[e]?.text||I7[e]||L7[e]||R7[e]?.text||e:`-`}function YUe(e){return e?F7[e]?.color||R7[e]?.color||`blue`:`default`}var V7=({status:e,tooltipRaw:t=!0})=>{if(e==null||e===``)return(0,Q.jsx)(xR,{children:`-`});let n=String(e),r=JUe(n),i=(0,Q.jsx)(xR,{color:YUe(n),children:r});return!t||r===n?i:(0,Q.jsx)(fx,{title:n,children:i})};function H7(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function U7(e,...t){for(let n of t){let t=e[n];if(t!=null&&String(t).trim()!==``)return String(t)}return``}function W7(e,t,...n){for(let t of n){let n=e[t];if(n===!0||n===!1)return n;if(n===`true`)return!0;if(n===`false`)return!1}return t}function XUe(e,...t){for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t)&&t>0)return t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e)&&e>0)return e}}}function G7(e){if(!H7(e))return null;let t=U7(e,`key`);return t?{key:t,label:U7(e,`label`)||t,type:U7(e,`type`)||void 0,enabled:W7(e,!0,`enabled`),editable:W7(e,!0,`editable`),maxLength:XUe(e,`maxLength`,`max_length`)}:null}function K7(e){if(!H7(e))return null;let t=e.data;return H7(t)?t:Array.isArray(e.sections)?e:null}function ZUe(e){return!!K7(e)}function QUe(e){let t=K7(e);return(Array.isArray(t?.sections)?t.sections:[]).map(e=>{let t=G7(e);if(!t||!H7(e))return null;let n=Array.isArray(e.children)?e.children.map(G7).filter(Boolean):[],r=Array.isArray(e.itemFields)?e.itemFields.map(G7).filter(Boolean):Array.isArray(e.item_fields)?e.item_fields.map(G7).filter(Boolean):[];return{...t,contentKey:U7(e,`contentKey`,`content_key`)||void 0,children:n,itemFields:r}}).filter(e=>!!e&&e.enabled)}function $Ue(e){return H7(e)?Object.entries(e).filter(([e])=>![`schemaVersion`,`schemaUsage`,`schema_version`,`schema_usage`].includes(e)).map(([e,t])=>Array.isArray(t)&&t.every(H7)?{key:e,label:e,type:`flow`,enabled:!0,editable:!1,itemFields:Array.from(new Set(t.flatMap(e=>Object.keys(e)))).filter(e=>e!==`时间段`).map(e=>({key:e,label:e,enabled:!0,editable:!1})),children:[]}:H7(t)?{key:e,label:e,type:`object`,enabled:!0,editable:!1,children:Object.keys(t).map(e=>({key:e,label:e,enabled:!0,editable:!1})),itemFields:[]}:{key:e,label:e,type:`text`,enabled:!0,editable:!1,children:[],itemFields:[]}):[]}var q7=e=>!!e&&typeof e==`object`&&!Array.isArray(e),J7=e=>typeof e==`string`&&e.length>80,Y7=e=>e==null||e===``?(0,Q.jsx)(Z.Text,{type:`secondary`,children:`-`}):typeof e==`boolean`?e?`是`:`否`:typeof e==`number`?e:typeof e==`string`?(0,Q.jsx)(Z.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:e}):(0,Q.jsx)(N7,{value:e,maxHeight:220}),X7=e=>e?(0,Q.jsx)(xR,{color:`processing`,children:`可编辑`}):(0,Q.jsx)(xR,{color:`default`,children:`只读`}),Z7=(e,t)=>e[t],eWe=(e,t)=>{let n=Z7(e,t.key);if(!q7(n))return(0,Q.jsx)(N7,{value:n??{},maxHeight:220});let r=t.children.filter(e=>e.enabled);return r.length?(0,Q.jsx)(fM,{size:`small`,column:2,bordered:!0,children:r.map(e=>(0,Q.jsx)(fM.Item,{label:(0,Q.jsxs)(OM,{size:4,children:[e.label,X7(e.editable)]}),span:J7(n[e.key])||q7(n[e.key])||Array.isArray(n[e.key])?2:1,children:Y7(n[e.key])},e.key))}):(0,Q.jsx)(N7,{value:n,maxHeight:220})},tWe=(e,t)=>{let n=e.itemFields.filter(e=>e.enabled);return n.length?[{key:`时间段`,label:`时间段`,enabled:!0,editable:!1},...n]:Array.from(new Set(t.flatMap(e=>Object.keys(e)))).map(e=>({key:e,label:e,enabled:!0,editable:!1}))},nWe=(e,t)=>{let n=Z7(e,t.key);if(!Array.isArray(n)||!n.every(q7))return(0,Q.jsx)(N7,{value:n??[],maxHeight:260});let r=n,i=tWe(t,r);return(0,Q.jsx)(cR,{size:`small`,rowKey:(e,n)=>`${t.key}-${n}`,columns:i.map(e=>({title:(0,Q.jsxs)(OM,{size:4,children:[e.label,X7(e.editable)]}),dataIndex:e.key,key:e.key,width:J7(r.find(t=>t[e.key])?.[e.key])?320:160,render:e=>Y7(e)})),dataSource:r,pagination:!1,scroll:{x:Math.max(900,i.length*180)},tableLayout:`fixed`})},rWe=(e,t)=>Y7(Z7(e,t.key)),iWe=({schema:e,finalPrompt:t,schemaConfigSnapshot:n,schemaConfigSource:r,schemaConfigVersion:i,schemaConfigIsFallback:a})=>{let o=!!e&&Object.keys(e).length>0;if(!o&&!t)return(0,Q.jsx)(Ky,{description:`暂无视频提词 schema`});let s=o?e:{},c=ZUe(n),l=(c?QUe(n):$Ue(s)).filter(e=>e.key in s).map(e=>({key:e.key,label:(0,Q.jsxs)(OM,{size:8,wrap:!0,children:[(0,Q.jsx)(`span`,{children:e.label}),X7(e.editable),c?null:(0,Q.jsx)(xR,{color:`warning`,children:`管理后台兜底展示`})]}),children:e.type===`object`?eWe(s,e):e.type===`flow`?nWe(s,e):rWe(s,e)}));return(0,Q.jsxs)(OM,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Q.jsx)(NA,{size:`small`,title:`Schema 配置来源`,children:(0,Q.jsxs)(fM,{size:`small`,column:3,bordered:!0,children:[(0,Q.jsx)(fM.Item,{label:`来源`,children:r||n?.source||(c?`-`:`viewer_fallback`)}),(0,Q.jsx)(fM.Item,{label:`版本`,children:i||n?.version||`-`}),(0,Q.jsx)(fM.Item,{label:`历史兜底`,children:a||!c?(0,Q.jsx)(xR,{color:`warning`,children:`是`}):(0,Q.jsx)(xR,{color:`success`,children:`否`})})]})}),t?(0,Q.jsx)(NA,{size:`small`,title:`最终视频提示词`,children:(0,Q.jsx)(Z.Paragraph,{style:{whiteSpace:`pre-wrap`,marginBottom:0},children:t})}):null,l.length?(0,Q.jsx)(Hh,{size:`small`,items:l}):o?(0,Q.jsx)(NA,{size:`small`,title:`视频提词 Schema`,children:(0,Q.jsx)(N7,{value:s,maxHeight:360})}):null,o?(0,Q.jsx)(Hh,{size:`small`,items:[{key:`raw_schema`,label:`原始 JSON / 历史脏字段排查`,children:(0,Q.jsx)(N7,{value:s,maxHeight:420})}]}):null]})},aWe=[`material_input`,`image_prompt_optimize`,`image_generate`,`video_prompt_optimize`,`video_generate`],oWe={material_input:`参考素材、项目名称和核心内容点`,image_prompt_optimize:`图片 AI 提词优化结果`,image_generate:`图片引擎、生成参数和结果图`,video_prompt_optimize:`视频 JSON schema、动作流程和最终提词`,video_generate:`视频引擎、生成参数、封面和结果视频`},Q7=e=>e?E5(e):`-`,$7=e=>e?e.length>18?`${e.slice(0,10)}...${e.slice(-4)}`:e:`-`,sWe=({text:e=`-`})=>(0,Q.jsx)(Z.Text,{type:`secondary`,children:e}),e9=({step:e})=>e?(0,Q.jsx)(GUe,{input:e.input,output:e.output}):null,t9=({index:e,stepCode:t,step:n,current:r})=>(0,Q.jsxs)(OM,{wrap:!0,size:8,children:[(0,Q.jsx)(Z.Text,{strong:!0,children:`第${e}步:${B7(t)}`}),(0,Q.jsx)(V7,{status:n?.status||`not_started`}),r?(0,Q.jsx)(xR,{color:`blue`,children:`当前步骤`}):null,(0,Q.jsx)(Z.Text,{type:`secondary`,children:oWe[t]||t}),n?.updatedAt?(0,Q.jsxs)(Z.Text,{type:`secondary`,children:[`更新时间:`,Q7(n.updatedAt)]}):null,n?.chatTaskId?(0,Q.jsx)(fx,{title:n.chatTaskId,children:(0,Q.jsxs)(xR,{children:[`Chat:`,$7(n.chatTaskId)]})}):null]}),cWe=(e,t)=>{if(!e)return[];let n=new Set;return n.add(`material_input`),e.currentStepCode&&n.add(e.currentStepCode),Object.values(t).forEach(e=>{(e.status===`failed`||e.errorMessage)&&n.add(e.stepCode)}),e.errorMessage&&n.add(e.currentStepCode||`material_input`),Array.from(n)},n9=(e,t=`错误信息`)=>e?(0,Q.jsx)(cf,{type:`error`,showIcon:!0,message:t,description:e,style:{marginTop:12,marginBottom:12}}):null,lWe=(e,t=`暂无提词`)=>e?(0,Q.jsx)(Z.Paragraph,{style:{whiteSpace:`pre-wrap`,marginBottom:0},children:e}):(0,Q.jsx)(sWe,{text:t}),r9=({moduleType:e=`shot_replicate`})=>{let{projectId:t}=tt(),n=Ze(),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(!1),s=(0,C.useCallback)(async()=>{if(t){o(!0);try{i(e===`hot_opening_replicate`?await PVe(t):await zVe(t))}catch(e){yP.error(e?.message||`加载复刻项目详情失败`)}finally{o(!1)}}},[e,t]);(0,C.useEffect)(()=>{s()},[s]);let c=(0,C.useMemo)(()=>{let e={};return(r?.steps||[]).forEach(t=>{e[t.stepCode]=t}),e},[r]),l=r?.module||e,u=z7(l),d=(0,C.useMemo)(()=>aWe.map(e=>{let t=c[e],n=`wait`;return t?.status===`completed`?n=`finish`:t?.status===`processing`?n=`process`:t?.status===`failed`&&(n=`error`),{title:B7(e),description:t?(0,Q.jsx)(V7,{status:t.status}):`未创建`,status:n}}),[c]),f=(0,C.useMemo)(()=>cWe(r,c),[r,c]);if(a&&!r)return(0,Q.jsx)(`div`,{style:{padding:64,textAlign:`center`},children:(0,Q.jsx)(cP,{size:`large`})});if(!r)return(0,Q.jsx)(NA,{style:{margin:24},children:(0,Q.jsx)(Ky,{description:`未找到复刻项目详情`})});let p=c.material_input,m=c.image_prompt_optimize,h=c.image_generate,g=c.video_prompt_optimize,_=c.video_generate,v=r.imageGeneration?.resultImageUrl||r.finalImageUrl,y=r.videoGeneration?.resultVideoCoverUrl||r.finalVideoCoverUrl,b=r.videoGeneration?.resultVideoUrl||r.finalVideoUrl,x=[{key:`material_input`,label:(0,Q.jsx)(t9,{index:1,stepCode:`material_input`,step:p,current:r.currentStepCode===`material_input`}),children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:2,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`模块类型`,children:(0,Q.jsx)(V7,{status:l})}),(0,Q.jsx)(fM.Item,{label:`素材步骤ID`,children:r.material?.materialStepId||`-`}),(0,Q.jsx)(fM.Item,{label:`参考素材项目名`,children:r.material?.sourceProjectName||`-`}),(0,Q.jsx)(fM.Item,{label:`生成项目名称`,children:r.material?.targetProjectName||`-`}),(0,Q.jsx)(fM.Item,{label:`核心内容点`,span:2,children:r.material?.coreContentPoint||`-`})]}),(0,Q.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:16},children:[(0,Q.jsx)(NA,{size:`small`,title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(c0,{}),`素材视频`]}),children:(0,Q.jsx)(P7,{type:`video`,url:r.material?.materialVideoUrl,emptyDescription:`暂无素材视频`})}),(0,Q.jsx)(NA,{size:`small`,title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(fX,{}),`素材图片`]}),children:(0,Q.jsx)(P7,{type:`image`,url:r.material?.materialImageUrl,emptyDescription:`暂无素材图片`})})]}),n9(p?.errorMessage),(0,Q.jsx)(e9,{step:p})]})},{key:`image_prompt_optimize`,label:(0,Q.jsx)(t9,{index:2,stepCode:`image_prompt_optimize`,step:m,current:r.currentStepCode===`image_prompt_optimize`}),children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:2,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`提词步骤ID`,children:r.imageGeneration?.promptStepId||`-`}),(0,Q.jsx)(fM.Item,{label:`步骤状态`,children:(0,Q.jsx)(V7,{status:m?.status||r.imageGeneration?.status})}),(0,Q.jsx)(fM.Item,{label:`图片提示词`,span:2,children:lWe(r.imageGeneration?.prompt,`暂无图片提示词`)})]}),n9(m?.errorMessage||r.imageGeneration?.errorMessage),(0,Q.jsx)(e9,{step:m})]})},{key:`image_generate`,label:(0,Q.jsx)(t9,{index:3,stepCode:`image_generate`,step:h,current:r.currentStepCode===`image_generate`}),children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`生成步骤ID`,children:r.imageGeneration?.generateStepId||`-`}),(0,Q.jsx)(fM.Item,{label:`Chat任务ID`,children:r.imageGeneration?.chatTaskId||`-`}),(0,Q.jsx)(fM.Item,{label:`状态`,children:(0,Q.jsx)(V7,{status:r.imageGeneration?.status||h?.status})}),(0,Q.jsx)(fM.Item,{label:`图片引擎ID`,children:r.imageGeneration?.engineId||`-`}),(0,Q.jsx)(fM.Item,{label:`图片引擎名称`,children:r.imageGeneration?.engineName||`-`}),(0,Q.jsx)(fM.Item,{label:`生成参数`,span:3,children:(0,Q.jsx)(N7,{value:r.imageGeneration?.params||{},maxHeight:160})})]}),n9(r.imageGeneration?.errorMessage||h?.errorMessage),(0,Q.jsx)(NA,{size:`small`,title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(fX,{}),`图片结果`]}),children:(0,Q.jsx)(P7,{type:`image`,url:v,height:360,emptyDescription:h?.status===`failed`||r.imageGeneration?.errorMessage?`图片生成失败,未返回图片地址`:`暂无图片结果`,errorDescription:`图片资源加载失败,可能图片文件不存在、签名过期或访问权限受限。`})}),(0,Q.jsx)(e9,{step:h})]})},{key:`video_prompt_optimize`,label:(0,Q.jsx)(t9,{index:4,stepCode:`video_prompt_optimize`,step:g,current:r.currentStepCode===`video_prompt_optimize`}),children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`提词步骤ID`,children:r.videoGeneration?.promptStepId||`-`}),(0,Q.jsx)(fM.Item,{label:`步骤状态`,children:(0,Q.jsx)(V7,{status:g?.status})}),(0,Q.jsx)(fM.Item,{label:`提词参数`,span:3,children:(0,Q.jsx)(N7,{value:r.videoGeneration?.promptParams||{},maxHeight:160})})]}),n9(g?.errorMessage||r.videoGeneration?.errorMessage),(0,Q.jsx)(iWe,{schema:r.videoGeneration?.promptSchema,finalPrompt:r.videoGeneration?.finalPrompt,schemaConfigSnapshot:r.videoGeneration?.schemaConfigSnapshot,schemaConfigSource:r.videoGeneration?.schemaConfigSource,schemaConfigVersion:r.videoGeneration?.schemaConfigVersion,schemaConfigIsFallback:r.videoGeneration?.schemaConfigIsFallback}),(0,Q.jsx)(e9,{step:g})]})},{key:`video_generate`,label:(0,Q.jsx)(t9,{index:5,stepCode:`video_generate`,step:_,current:r.currentStepCode===`video_generate`}),children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`生成步骤ID`,children:r.videoGeneration?.generateStepId||`-`}),(0,Q.jsx)(fM.Item,{label:`Chat任务ID`,children:r.videoGeneration?.chatTaskId||`-`}),(0,Q.jsx)(fM.Item,{label:`状态`,children:(0,Q.jsx)(V7,{status:r.videoGeneration?.status||_?.status})}),(0,Q.jsx)(fM.Item,{label:`视频引擎ID`,children:r.videoGeneration?.engineId||`-`}),(0,Q.jsx)(fM.Item,{label:`视频引擎名称`,children:r.videoGeneration?.engineName||`-`}),(0,Q.jsx)(fM.Item,{label:`生成参数`,span:3,children:(0,Q.jsx)(N7,{value:r.videoGeneration?.params||{},maxHeight:160})})]}),n9(r.videoGeneration?.errorMessage||_?.errorMessage),(0,Q.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:16},children:[(0,Q.jsx)(NA,{size:`small`,title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(fX,{}),`视频封面`]}),children:(0,Q.jsx)(P7,{type:`image`,url:y,emptyDescription:_?.status===`failed`||r.videoGeneration?.errorMessage?`视频生成失败,未返回封面`:`暂无视频封面`,errorDescription:`视频封面加载失败,可能文件不存在、签名过期或访问权限受限。`})}),(0,Q.jsx)(NA,{size:`small`,title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)($6,{}),`最终视频`]}),children:(0,Q.jsx)(P7,{type:`video`,url:b,emptyDescription:_?.status===`failed`||r.videoGeneration?.errorMessage?`视频生成失败,未返回视频地址`:`暂无最终视频`,errorDescription:`视频资源加载失败,可能文件不存在、签名过期或访问权限受限。`})})]}),(0,Q.jsx)(e9,{step:_})]})}];return(0,Q.jsx)(`div`,{style:{padding:24},children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(OM,{wrap:!0,style:{justifyContent:`space-between`,width:`100%`},children:[(0,Q.jsxs)(OM,{wrap:!0,children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(AH,{}),onClick:()=>n(-1),children:`返回`}),(0,Q.jsxs)(Z.Title,{level:3,style:{margin:0},children:[u,`项目详情`]}),(0,Q.jsx)(V7,{status:r.status}),r.module&&r.module!==e?(0,Q.jsxs)(xR,{color:`gold`,children:[`接口模块:`,z7(r.module)]}):null]}),(0,Q.jsx)(XS,{onClick:s,loading:a,children:`刷新`})]}),(0,Q.jsx)(NA,{children:(0,Q.jsxs)(fM,{title:`基础信息`,column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`项目ID`,children:r.id}),(0,Q.jsx)(fM.Item,{label:`模块类型`,children:(0,Q.jsx)(V7,{status:l})}),(0,Q.jsx)(fM.Item,{label:`用户ID`,children:r.userId||`-`}),(0,Q.jsx)(fM.Item,{label:`用户名`,children:r.userName||`-`}),(0,Q.jsx)(fM.Item,{label:`标题`,children:r.title||`-`}),(0,Q.jsx)(fM.Item,{label:`当前步骤`,children:(0,Q.jsx)(fx,{title:r.currentStepCode||``,children:B7(r.currentStepCode)})}),(0,Q.jsx)(fM.Item,{label:`状态`,children:(0,Q.jsx)(V7,{status:r.status})}),(0,Q.jsx)(fM.Item,{label:`创建时间`,children:Q7(r.createdAt)}),(0,Q.jsx)(fM.Item,{label:`更新时间`,children:Q7(r.updatedAt)}),(0,Q.jsx)(fM.Item,{label:`完成时间`,children:Q7(r.completedAt)}),r.errorMessage?(0,Q.jsx)(fM.Item,{label:`错误信息`,span:3,children:(0,Q.jsx)(cf,{type:`error`,showIcon:!0,message:r.errorMessage})}):null]})}),(0,Q.jsx)(NA,{title:`步骤进度`,children:(0,Q.jsx)(uhe,{items:d})}),(0,Q.jsx)(NA,{title:`最终结果预览`,children:(0,Q.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(280px, 1fr))`,gap:16},children:[(0,Q.jsx)(NA,{size:`small`,title:`最终图片`,children:(0,Q.jsx)(P7,{type:`image`,url:r.finalImageUrl||r.imageGeneration?.resultImageUrl,height:220,emptyDescription:`暂无最终图片`})}),(0,Q.jsx)(NA,{size:`small`,title:`最终视频封面`,children:(0,Q.jsx)(P7,{type:`image`,url:r.finalVideoCoverUrl||r.videoGeneration?.resultVideoCoverUrl,height:220,emptyDescription:`暂无最终视频封面`})}),(0,Q.jsx)(NA,{size:`small`,title:`最终视频`,children:(0,Q.jsx)(P7,{type:`video`,url:r.finalVideoUrl||r.videoGeneration?.resultVideoUrl,height:220,emptyDescription:`暂无最终视频`})})]})}),(0,Q.jsx)(Hh,{defaultActiveKey:f,items:x}),(0,Q.jsx)(Hh,{items:[{key:`steps-table`,label:`完整步骤列表`,children:(0,Q.jsx)(cR,{rowKey:`id`,size:`small`,pagination:!1,dataSource:r.steps||[],scroll:{x:1100},columns:[{title:`序号`,dataIndex:`stepIndex`,width:70},{title:`步骤`,dataIndex:`stepCode`,width:160,render:e=>(0,Q.jsx)(fx,{title:e,children:B7(e)})},{title:`状态`,dataIndex:`status`,width:120,render:e=>(0,Q.jsx)(V7,{status:e})},{title:`版本`,dataIndex:`version`,width:70},{title:`当前有效`,dataIndex:`isCurrent`,width:90,render:e=>e?(0,Q.jsx)(xR,{color:`success`,children:`是`}):(0,Q.jsx)(xR,{children:`否`})},{title:`Chat任务`,dataIndex:`chatTaskId`,width:160,render:e=>(0,Q.jsx)(fx,{title:e||``,children:$7(e)})},{title:`创建时间`,dataIndex:`createdAt`,width:170,render:Q7},{title:`完成时间`,dataIndex:`completedAt`,width:170,render:Q7},{title:`错误`,dataIndex:`errorMessage`,ellipsis:!0,render:e=>e||`-`}]})},{key:`raw-detail`,label:`完整详情原始 JSON`,children:(0,Q.jsx)(N7,{value:r,maxHeight:520})}]})]})})},uWe=()=>(0,Q.jsx)(r9,{moduleType:`hot_opening_replicate`}),i9=20,dWe=[{value:`pending_analysis`,label:`等待分析`},{value:`analyzing`,label:`分析中`},{value:`analysis_completed`,label:`分析完成`},{value:`analysis_failed`,label:`分析失败`},{value:`splitting`,label:`拆镜中`},{value:`split_completed`,label:`拆镜完成`},{value:`partial_failed`,label:`部分失败`},{value:`failed`,label:`失败`}],fWe=[{value:`pending`,label:`待分析`},{value:`processing`,label:`分析中`},{value:`completed`,label:`分析完成`},{value:`failed`,label:`分析失败`}],pWe=[{value:`none`,label:`未拆镜`},{value:`pending`,label:`待拆镜`},{value:`processing`,label:`拆镜中`},{value:`completed`,label:`拆镜完成`},{value:`failed`,label:`拆镜失败`},{value:`retry_waiting`,label:`等待重试`}],mWe={pending_analysis:{color:`default`,text:`等待分析`},analyzing:{color:`processing`,text:`分析中`},analysis_completed:{color:`success`,text:`分析完成`},analysis_failed:{color:`error`,text:`分析失败`},splitting:{color:`warning`,text:`拆镜中`},split_completed:{color:`success`,text:`拆镜完成`},partial_failed:{color:`orange`,text:`部分失败`},failed:{color:`error`,text:`失败`},none:{color:`default`,text:`未拆镜`},pending:{color:`default`,text:`待处理`},processing:{color:`warning`,text:`处理中`},completed:{color:`success`,text:`完成`},retry_waiting:{color:`orange`,text:`等待重试`}},a9=e=>e?E5(e):`-`,o9=e=>e?e.length>16?`${e.slice(0,10)}...`:e:`-`,s9=({status:e})=>{if(!e)return(0,Q.jsx)(xR,{children:`-`});let t=mWe[e]||{color:`blue`,text:e};return(0,Q.jsx)(xR,{color:t.color,children:t.text})},hWe=()=>{let e=Ze(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)(0),[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(1),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(``),[y,b]=(0,C.useState)(``),[x,S]=(0,C.useState)(null),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(``),[O,k]=(0,C.useState)(``),[A,j]=(0,C.useState)(null),[M,N]=(0,C.useState)(0),P=(0,C.useCallback)(async()=>{o(!0);try{let e=await FVe({status:l||void 0,analysisStatus:d||void 0,splitStatus:p||void 0,keyword:w||void 0,userId:E||void 0,userName:O||void 0,createdStart:A?.[0]?.toISOString?.(),createdEnd:A?.[1]?.toISOString?.(),page:s,pageSize:i9});n(e.items||[]),i(e.total||0)}catch(e){yP.error(e?.message||`加载拆镜复刻任务失败`)}finally{o(!1)}},[d,s,A,w,E,O,p,l]);(0,C.useEffect)(()=>{P()},[P,M]);let F=()=>{T(h.trim()),D(_.trim()),k(y.trim()),j(x),c(1)};return(0,Q.jsx)(`div`,{style:{padding:24},children:(0,Q.jsx)(NA,{children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(OM,{align:`center`,style:{justifyContent:`space-between`,width:`100%`},children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Title,{level:3,style:{marginBottom:4},children:`拆镜复刻`}),(0,Q.jsx)(Z.Text,{type:`secondary`,children:`只读排查页面:查看拆镜总任务、AI 分析结果、切片列表和关联复刻项目。`})]}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>N(e=>e+1),children:`刷新`})]}),(0,Q.jsxs)(OM,{wrap:!0,children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`总任务状态`,style:{width:150},value:l||void 0,onChange:e=>{u(e||``),c(1)},options:dWe}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`分析状态`,style:{width:140},value:d||void 0,onChange:e=>{f(e||``),c(1)},options:fWe}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`拆镜状态`,style:{width:140},value:p||void 0,onChange:e=>{m(e||``),c(1)},options:pWe}),(0,Q.jsx)(LN,{allowClear:!0,prefix:(0,Q.jsx)(_b,{}),placeholder:`关键词:标题/内容/分类/受众`,style:{width:260},value:h,onChange:e=>g(e.target.value),onPressEnter:F}),(0,Q.jsx)(LN,{allowClear:!0,placeholder:`用户ID(管理员)`,style:{width:190},value:_,onChange:e=>v(e.target.value),onPressEnter:F}),(0,Q.jsx)(LN,{allowClear:!0,placeholder:`用户名(管理员)`,style:{width:230},value:y,onChange:e=>b(e.target.value),onPressEnter:F}),(0,Q.jsx)(cM.RangePicker,{showTime:!0,value:x,onChange:S,placeholder:[`创建开始`,`创建结束`]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(_b,{}),onClick:F,children:`搜索`}),(0,Q.jsx)(XS,{onClick:()=>{u(``),f(``),m(``),g(``),v(``),b(``),S(null),T(``),D(``),k(``),j(null),c(1),N(e=>e+1)},children:`重置`})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:a,dataSource:t,pagination:{current:s,pageSize:i9,total:r,showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:c},scroll:{x:1500},columns:[{title:`任务集ID`,dataIndex:`id`,width:150,render:e=>(0,Q.jsx)(fx,{title:e,children:o9(e)})},{title:`用户`,width:180,render:(e,t)=>(0,Q.jsxs)(OM,{direction:`vertical`,size:0,children:[(0,Q.jsx)(Z.Text,{children:t.userName||`-`}),(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12},children:o9(t.userId)})]})},{title:`任务信息`,width:300,render:(e,t)=>(0,Q.jsxs)(OM,{direction:`vertical`,size:2,children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.title||`-`}),(0,Q.jsxs)(Z.Text,{type:`secondary`,ellipsis:!0,style:{maxWidth:280},children:[`分类:`,t.originalVideoCategory||`-`]}),(0,Q.jsxs)(Z.Text,{type:`secondary`,ellipsis:!0,style:{maxWidth:280},children:[`受众:`,t.originalVideoAudience||`-`]})]})},{title:`总状态`,dataIndex:`status`,width:120,render:e=>(0,Q.jsx)(s9,{status:e})},{title:`分析状态`,dataIndex:`analysisStatus`,width:110,render:e=>(0,Q.jsx)(s9,{status:e})},{title:`拆镜状态`,dataIndex:`splitStatus`,width:110,render:e=>(0,Q.jsx)(s9,{status:e})},{title:`切片进度`,width:180,render:(e,t)=>{let n=t.segmentCount||0,r=t.completedSegmentCount||0;return(0,Q.jsx)(FP,{size:`small`,percent:n?Math.round(r/n*100):0,format:()=>`${r}/${n}`})}},{title:`失败片段`,dataIndex:`failedSegmentCount`,width:90,render:e=>e?(0,Q.jsx)(xR,{color:`error`,children:e}):(0,Q.jsx)(xR,{children:`0`})},{title:`视频时长`,dataIndex:`videoDurationSeconds`,width:100,render:e=>`${Number(e||0).toFixed(1)}s`},{title:`创建时间`,dataIndex:`createdAt`,width:170,render:a9},{title:`更新时间`,dataIndex:`updatedAt`,width:170,render:a9},{title:`操作`,fixed:`right`,width:120,render:(t,n)=>(0,Q.jsx)(XS,{type:`link`,icon:(0,Q.jsx)(ON,{}),onClick:()=>e(`/shot-replications/task-sets/${n.id}`),children:`查看切片`})}]})]})})})},gWe=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``),c9=20,_We=[{value:`ai_suggestion`,label:`AI 建议`},{value:`custom`,label:`自定义`}],vWe=[{value:`none`,label:`未拆镜`},{value:`pending`,label:`待拆镜`},{value:`processing`,label:`拆镜中`},{value:`completed`,label:`拆镜完成`},{value:`failed`,label:`拆镜失败`},{value:`retry_waiting`,label:`等待重试`}],yWe=[{value:`not_required`,label:`无需分析`},{value:`pending`,label:`待分析`},{value:`processing`,label:`分析中`},{value:`completed`,label:`分析完成`},{value:`failed`,label:`分析失败`}],bWe=[{value:`not_started`,label:`未复刻`},{value:`project_created`,label:`已创建项目`},{value:`processing`,label:`复刻中`},{value:`completed`,label:`复刻完成`},{value:`failed`,label:`复刻失败`}],xWe={pending_analysis:{color:`default`,text:`等待分析`},analyzing:{color:`processing`,text:`分析中`},analysis_completed:{color:`success`,text:`分析完成`},analysis_failed:{color:`error`,text:`分析失败`},splitting:{color:`warning`,text:`拆镜中`},split_completed:{color:`success`,text:`拆镜完成`},partial_failed:{color:`orange`,text:`部分失败`},failed:{color:`error`,text:`失败`},none:{color:`default`,text:`未拆镜`},pending:{color:`default`,text:`待处理`},processing:{color:`warning`,text:`处理中`},completed:{color:`success`,text:`完成`},retry_waiting:{color:`orange`,text:`等待重试`},not_required:{color:`default`,text:`无需分析`},not_started:{color:`default`,text:`未复刻`},project_created:{color:`processing`,text:`已创建项目`}},SWe=e=>{if(!e)return``;let t=String(e).trim();return t?/^(https?:)?\/\//i.test(t)||/^(blob|data):/i.test(t)?t:`${gWe}${t.startsWith(`/`)?t:`/${t}`}`:``},l9=e=>e?E5(e):`-`,u9=e=>e?e.length>16?`${e.slice(0,10)}...`:e:`-`,d9=({status:e})=>{if(!e)return(0,Q.jsx)(xR,{children:`-`});let t=xWe[e]||{color:`blue`,text:e};return(0,Q.jsx)(xR,{color:t.color,children:t.text})},f9=({value:e,maxHeight:t=420})=>(0,Q.jsx)(`pre`,{style:{margin:0,padding:12,maxHeight:t,overflow:`auto`,background:`#0f172a`,color:`#e2e8f0`,borderRadius:8,fontSize:12,lineHeight:1.6},children:JSON.stringify(e??{},null,2)}),p9=({url:e,height:t=280})=>e?(0,Q.jsx)(`video`,{src:SWe(e),controls:!0,preload:`metadata`,style:{width:`100%`,maxHeight:t,borderRadius:12,background:`#0f172a`}}):(0,Q.jsx)(Ky,{description:`暂无视频`,image:Ky.PRESENTED_IMAGE_SIMPLE}),CWe=({items:e=[]})=>(0,Q.jsx)(cR,{rowKey:`index`,size:`small`,pagination:!1,dataSource:e,scroll:{x:!0},columns:[{title:`序号`,dataIndex:`index`,width:70},{title:`时间节点`,dataIndex:`timeNode`,width:120},{title:`开始`,dataIndex:`startSecond`,width:80,render:e=>`${Number(e||0).toFixed(2)}s`},{title:`结束`,dataIndex:`endSecond`,width:80,render:e=>`${Number(e||0).toFixed(2)}s`},{title:`内容`,dataIndex:`content`,ellipsis:!0},{title:`分类`,dataIndex:`category`,width:140},{title:`受众`,dataIndex:`audience`,ellipsis:!0}]}),wWe=()=>{let{taskSetId:e}=tt(),t=Ze(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)([]),[o,s]=(0,C.useState)(0),[c,l]=(0,C.useState)(1),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(0),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(``),[T,E]=(0,C.useState)(!1),[D,O]=(0,C.useState)(null),k=(0,C.useCallback)(async()=>{if(e){d(!0);try{r(await IVe(e))}catch(e){yP.error(e?.message||`加载拆镜任务详情失败`)}finally{d(!1)}}},[e]),A=(0,C.useCallback)(async()=>{if(e){p(!0);try{let t=await LVe(e,{sourceMode:g||void 0,splitStatus:v||void 0,analysisStatus:b||void 0,replicateStatus:S||void 0,page:c,pageSize:c9});a(t.items||[]),s(t.total||0)}catch(e){yP.error(e?.message||`加载拆镜片段失败`)}finally{p(!1)}}},[b,c,S,g,v,e]);(0,C.useEffect)(()=>{k()},[k,m]),(0,C.useEffect)(()=>{A()},[A,m]);let j=async e=>{E(!0),O(null);try{O(await RVe(e))}catch(e){yP.error(e?.message||`加载片段详情失败`)}};return u&&!n?(0,Q.jsx)(`div`,{style:{padding:64,textAlign:`center`},children:(0,Q.jsx)(cP,{size:`large`})}):n?(0,Q.jsxs)(`div`,{style:{padding:24},children:[(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(OM,{style:{justifyContent:`space-between`,width:`100%`},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(AH,{}),onClick:()=>t(`/shot-replications`),children:`返回列表`}),(0,Q.jsx)(Z.Title,{level:3,style:{margin:0},children:`拆镜任务详情`}),(0,Q.jsx)(d9,{status:n.status})]}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>h(e=>e+1),children:`刷新`})]}),(0,Q.jsx)(NA,{children:(0,Q.jsxs)(fM,{title:`总任务信息`,column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`任务集ID`,children:n.id}),(0,Q.jsx)(fM.Item,{label:`用户ID`,children:n.userId||`-`}),(0,Q.jsx)(fM.Item,{label:`用户名`,children:n.userName||`-`}),(0,Q.jsx)(fM.Item,{label:`标题`,children:n.title||`-`}),(0,Q.jsxs)(fM.Item,{label:`视频时长`,children:[Number(n.videoDurationSeconds||0).toFixed(2),`s`]}),(0,Q.jsx)(fM.Item,{label:`总状态`,children:(0,Q.jsx)(d9,{status:n.status})}),(0,Q.jsx)(fM.Item,{label:`分析状态`,children:(0,Q.jsx)(d9,{status:n.analysisStatus})}),(0,Q.jsx)(fM.Item,{label:`拆镜状态`,children:(0,Q.jsx)(d9,{status:n.splitStatus})}),(0,Q.jsxs)(fM.Item,{label:`片段数量`,children:[n.completedSegmentCount,`/`,n.segmentCount,`,失败 `,n.failedSegmentCount]}),(0,Q.jsx)(fM.Item,{label:`原视频分类`,children:n.originalVideoCategory||`-`}),(0,Q.jsx)(fM.Item,{label:`创建时间`,children:l9(n.createdAt)}),(0,Q.jsx)(fM.Item,{label:`更新时间`,children:l9(n.updatedAt)}),(0,Q.jsx)(fM.Item,{label:`原视频内容`,span:3,children:n.originalVideoContent||`-`}),(0,Q.jsx)(fM.Item,{label:`原视频受众`,span:3,children:n.originalVideoAudience||`-`}),n.analysisErrorMessage?(0,Q.jsx)(fM.Item,{label:`分析错误`,span:3,children:(0,Q.jsx)(cf,{type:`error`,message:n.analysisErrorMessage})}):null,n.splitErrorMessage?(0,Q.jsx)(fM.Item,{label:`拆镜错误`,span:3,children:(0,Q.jsx)(cf,{type:`error`,message:n.splitErrorMessage})}):null]})}),(0,Q.jsx)(NA,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(c0,{}),`原视频预览`]}),children:(0,Q.jsx)(p9,{url:n.videoUrl,height:360})}),(0,Q.jsxs)(NA,{title:`AI 建议拆镜列表`,children:[n.aiSuggestions?.length?(0,Q.jsx)(CWe,{items:n.aiSuggestions}):(0,Q.jsx)(Ky,{description:`暂无 AI 建议拆镜`}),(0,Q.jsx)(Hh,{size:`small`,ghost:!0,style:{marginTop:12},items:[{key:`raw`,label:`查看原视频分析完整 JSON`,children:(0,Q.jsx)(f9,{value:n.analysisResultJson})}]})]}),(0,Q.jsxs)(NA,{title:`片段列表`,children:[(0,Q.jsxs)(OM,{wrap:!0,style:{marginBottom:16},children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`片段来源`,style:{width:140},value:g||void 0,options:_We,onChange:e=>{_(e||``),l(1)}}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`切割状态`,style:{width:140},value:v||void 0,options:vWe,onChange:e=>{y(e||``),l(1)}}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`分析状态`,style:{width:140},value:b||void 0,options:yWe,onChange:e=>{x(e||``),l(1)}}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`复刻状态`,style:{width:150},value:S||void 0,options:bWe,onChange:e=>{w(e||``),l(1)}}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(_b,{}),onClick:()=>h(e=>e+1),children:`筛选`}),(0,Q.jsx)(XS,{onClick:()=>{_(``),y(``),x(``),w(``),l(1),h(e=>e+1)},children:`重置`})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:f,dataSource:i,pagination:{current:c,pageSize:c9,total:o,showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:l},scroll:{x:1550},columns:[{title:`片段ID`,dataIndex:`id`,width:150,render:e=>(0,Q.jsx)(fx,{title:e,children:u9(e)})},{title:`序号`,dataIndex:`segmentIndex`,width:70},{title:`来源`,dataIndex:`sourceMode`,width:100,render:e=>e===`ai_suggestion`?(0,Q.jsx)(xR,{color:`purple`,children:`AI建议`}):(0,Q.jsx)(xR,{color:`cyan`,children:`自定义`})},{title:`时间节点`,dataIndex:`timeNode`,width:130},{title:`时长`,dataIndex:`durationSeconds`,width:90,render:e=>`${Number(e||0).toFixed(2)}s`},{title:`切割`,dataIndex:`splitStatus`,width:100,render:e=>(0,Q.jsx)(d9,{status:e})},{title:`分析`,dataIndex:`analysisStatus`,width:100,render:e=>(0,Q.jsx)(d9,{status:e})},{title:`复刻`,dataIndex:`replicateStatus`,width:110,render:e=>(0,Q.jsx)(d9,{status:e})},{title:`片段内容`,dataIndex:`segmentContent`,width:260,ellipsis:!0,render:e=>e||`-`},{title:`分类`,dataIndex:`segmentCategory`,width:120,render:e=>e||`-`},{title:`关联项目`,width:220,render:(e,n)=>n.moduleProjectId?(0,Q.jsxs)(OM,{direction:`vertical`,size:0,children:[(0,Q.jsx)(XS,{type:`link`,style:{padding:0},onClick:()=>t(`/shot-replications/projects/${n.moduleProjectId}`),children:u9(n.moduleProjectId)}),(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12},children:n.moduleProjectTitle||B7(n.moduleProjectCurrentStepCode)}),(0,Q.jsx)(d9,{status:n.moduleProjectStatus})]}):(0,Q.jsx)(xR,{children:`未创建`})},{title:`错误`,dataIndex:`splitLastError`,width:220,ellipsis:!0,render:(e,t)=>e||t.analysisErrorMessage||`-`},{title:`创建时间`,dataIndex:`createdAt`,width:170,render:l9},{title:`操作`,fixed:`right`,width:100,render:(e,t)=>(0,Q.jsx)(XS,{type:`link`,icon:(0,Q.jsx)(ON,{}),onClick:()=>j(t.id),children:`详情`})}]})]})]}),(0,Q.jsx)(Lde,{title:`片段详情`,width:720,open:T,onClose:()=>E(!1),destroyOnClose:!0,children:D?(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:2,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`片段ID`,span:2,children:D.id}),(0,Q.jsx)(fM.Item,{label:`时间节点`,children:D.timeNode}),(0,Q.jsxs)(fM.Item,{label:`时长`,children:[Number(D.durationSeconds||0).toFixed(2),`s`]}),(0,Q.jsx)(fM.Item,{label:`切割状态`,children:(0,Q.jsx)(d9,{status:D.splitStatus})}),(0,Q.jsx)(fM.Item,{label:`分析状态`,children:(0,Q.jsx)(d9,{status:D.analysisStatus})}),(0,Q.jsx)(fM.Item,{label:`复刻状态`,children:(0,Q.jsx)(d9,{status:D.replicateStatus})}),(0,Q.jsx)(fM.Item,{label:`关联项目`,children:D.moduleProjectId?(0,Q.jsx)(XS,{type:`link`,onClick:()=>t(`/shot-replications/projects/${D.moduleProjectId}`),children:D.moduleProjectId}):`-`}),(0,Q.jsx)(fM.Item,{label:`片段内容`,span:2,children:D.segmentContent||`-`}),(0,Q.jsx)(fM.Item,{label:`片段分类`,children:D.segmentCategory||`-`}),(0,Q.jsx)(fM.Item,{label:`片段受众`,children:D.segmentAudience||`-`})]}),(0,Q.jsx)(NA,{size:`small`,title:`片段视频`,children:(0,Q.jsx)(p9,{url:D.segmentVideoUrl,height:300})}),D.splitLastError?(0,Q.jsx)(cf,{type:`error`,message:`切割错误`,description:D.splitLastError}):null,D.analysisErrorMessage?(0,Q.jsx)(cf,{type:`error`,message:`分析错误`,description:D.analysisErrorMessage}):null,(0,Q.jsx)(Hh,{size:`small`,items:[{key:`analysis`,label:`片段分析 JSON`,children:(0,Q.jsx)(f9,{value:D.analysisJson})},{key:`suggestion`,label:`AI 建议原始 JSON`,children:(0,Q.jsx)(f9,{value:D.aiSuggestionJson})}]})]}):(0,Q.jsx)(cP,{})})]}):(0,Q.jsx)(NA,{style:{margin:24},children:(0,Q.jsx)(Ky,{description:`未找到拆镜任务详情`})})},{Title:TWe,Text:m9,Paragraph:EWe}=Z,{TextArea:h9}=LN,g9=[{label:`对象`,value:`object`},{label:`数组`,value:`array`},{label:`字符串`,value:`string`},{label:`数字`,value:`number`},{label:`布尔`,value:`boolean`},{label:`流程数组`,value:`flow`}],_9=`画面属性`,DWe=new Set([`视频时长`,`视频比例`,`清晰度`,`帧率`,`推荐分辨率`]);function v9(e,t){return e===_9&&!!t&&DWe.has(t)}function y9(e){return e===_9}function OWe(e){return JSON.parse(JSON.stringify(e??null))}function b9(e,t,n,r){return!e||typeof e!=`object`?r:e[t]===void 0?e[n]===void 0?r:e[n]:e[t]}function kWe(e){return{key:String(e?.key||e?.label||`新流程字段`),label:String(e?.label||e?.key||`新流程字段`),enabled:e?.enabled??!0,editable:e?.editable??!0,maxLength:Number(b9(e,`maxLength`,`max_length`,800)||800),value:e?.value??``}}function x9(e){let t=String(e?.type||`string`),n={key:String(e?.key||e?.label||`新字段`),label:String(e?.label||e?.key||`新字段`),type:t,enabled:e?.enabled??!0,editable:e?.editable??!0,maxLength:Number(b9(e,`maxLength`,`max_length`,t===`flow`?800:1e3)||(t===`flow`?800:1e3))};if(t===`object`)n.children=Array.isArray(e?.children)?e.children.map(x9):[];else if(t===`flow`){n.contentKey=String(b9(e,`contentKey`,`content_key`,e?.key===`镜头流程`?`镜头内容`:`动作内容`));let t=b9(e,`contentAliases`,`content_aliases`,[]);n.contentAliases=Array.isArray(t)?t.map(e=>String(e)).filter(Boolean):[];let r=b9(e,`itemFields`,`item_fields`,[]);n.itemFields=Array.isArray(r)&&r.length>0?r.map(kWe):[{key:n.contentKey,label:n.contentKey,enabled:!0,editable:!0,maxLength:n.maxLength||800,value:``}]}else n.value=e?.value??(t===`array`?[]:t===`boolean`?!1:t===`number`?0:`无`);return n}function AWe(e){let t=Array.isArray(e?.segments)?e.segments:[],n=Array.isArray(e?.ratios)?e.ratios:[];return{minDuration:Number(b9(e,`minDuration`,`min_duration`,1)||1),maxDuration:Number(b9(e,`maxDuration`,`max_duration`,5)||5),ratios:n.map(e=>Number(e||0)),segments:t.map(e=>({stage:String(e?.stage||`新阶段`),description:String(e?.description||e?.desc||`阶段说明`)}))}}function S9(e){let t=Array.isArray(e?.sections)?e.sections:[],n=Array.isArray(e?.timePlanRules)?e.timePlanRules:Array.isArray(e?.time_plan_rules)?e.time_plan_rules:[];return{version:e?.version||`video_prompt_schema_config_v1`,enabled:e?.enabled??!0,sections:t.map(x9),timePlanRules:n.map(AWe)}}function C9(e,t){let n=y9(e.key),r=v9(t,e.key),i={key:e.key,label:e.label,type:r?`string`:e.type,enabled:n||r?!0:!!e.enabled,editable:r?!1:!!e.editable,max_length:e.maxLength};return e.type===`object`?i.children=(e.children||[]).map(t=>C9(t,e.key)):e.type===`flow`?(i.content_key=e.contentKey,i.content_aliases=e.contentAliases||[],i.item_fields=(e.itemFields||[]).map(e=>({key:e.key,label:e.label,enabled:!!e.enabled,editable:!!e.editable,max_length:e.maxLength,value:e.value??``}))):i.value=e.value,i}function w9(e,t){return{version:e.version,enabled:t,sections:(e.sections||[]).map(e=>C9(e)),time_plan_rules:(e.timePlanRules||[]).map(e=>({min_duration:e.minDuration,max_duration:e.maxDuration,ratios:e.ratios||[],segments:(e.segments||[]).map(e=>({stage:e.stage,description:e.description}))}))}}function T9(e){return e?.runtimeSchema||e?.runtime_schema||{}}function E9(e){let t=e?.timePlan||e?.time_plan||T9(e)?.动态时间规划||[];return Array.isArray(t)?t:[]}function jWe(e){return e?.schemaConfigSnapshot||e?.schema_config_snapshot||{}}function MWe(e,t){let n=new Blob([JSON.stringify(t,null,2)],{type:`application/json;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}var D9=(e=`string`)=>({key:`新字段`,label:`新字段`,type:e,enabled:!0,editable:!0,maxLength:e===`flow`?800:1e3,value:e===`array`?[]:e===`boolean`?!1:e===`number`?0:`无`,children:e===`object`?[]:void 0,contentKey:e===`flow`?`动作内容`:void 0,contentAliases:e===`flow`?[`动作内容`,`动作`,`动作说明`,`内容`,`说明`]:void 0,itemFields:e===`flow`?[{key:`动作内容`,label:`动作内容`,enabled:!0,editable:!0,maxLength:800,value:``}]:void 0}),NWe=()=>({minDuration:1,maxDuration:5,ratios:[.2,.4,.4],segments:[{stage:`开场吸引`,description:`快速吸引注意力`},{stage:`核心展示`,description:`展示主体动作、核心卖点或主要视觉内容`},{stage:`收尾引导`,description:`给出行动引导并稳定落版`}]}),PWe=()=>{let[e,t]=(0,C.useState)(!1),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(!1),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(null),[g]=X.useForm(),_=(0,C.useRef)(null),v=c?.sections||[],y=c?.timePlanRules||[],b=async()=>{t(!0);try{let e=await BVe();a(!!(e.isEnabled??e.is_enabled??e.data?.enabled??!1)),s(!!(e.usingDefault??e.using_default??!1)),l(S9(e.data)),d(S9(e.defaultData??e.default_data))}catch(e){yP.error(e?.message||`加载失败`)}finally{t(!1)}};(0,C.useEffect)(()=>{b()},[]);let x=e=>{l(t=>{let n=S9(OWe(t));return e(n),n})},S=async()=>{if(c){r(!0);try{let e=await VVe({is_enabled:i,data:w9(c,i)});l(S9(e.data)),a(!!(e.isEnabled??e.is_enabled??e.data?.enabled??!1)),s(!!(e.usingDefault??e.using_default??!1)),yP.success(`保存成功`)}catch(e){yP.error(e?.message||`保存失败`)}finally{r(!1)}}},w=async()=>{r(!0);try{let e=await HVe();l(S9(e.data)),d(S9(e.defaultData??e.default_data)),a(!!(e.isEnabled??e.is_enabled??e.data?.enabled??!1)),s(!!(e.usingDefault??e.using_default??!1)),yP.success(`已恢复默认配置`)}catch(e){yP.error(e?.message||`恢复默认失败`)}finally{r(!1)}},T=async()=>{try{MWe(`video_prompt_schema_config.json`,await UVe())}catch(e){yP.error(e?.message||`导出失败`)}},E=async e=>{let t=e.target.files?.[0];if(e.target.value=``,t)try{let e=await t.text(),n=JSON.parse(e),r=n.data||n,o=await WVe({is_enabled:!!(n.isEnabled??n.is_enabled??i),data:r});l(S9(o.data)),a(!!(o.isEnabled??o.is_enabled??o.data?.enabled??!1)),s(!!(o.usingDefault??o.using_default??!1)),yP.success(`导入成功`)}catch(e){yP.error(e?.message||`导入失败,请检查 JSON 格式`)}},D=()=>{g.setFieldsValue({duration:8,aspectRatio:`9:16`,resolution:`1080p`,frameRate:`30fps`}),h(null),p(!0)},O=async()=>{if(!c)return;let e=await g.validateFields();try{h(await GVe({is_enabled:i,data:w9(c,i),duration:Number(e.duration||8),aspect_ratio:e.aspectRatio,resolution:e.resolution,frame_rate:e.frameRate}))}catch(e){yP.error(e?.message||`预览失败`)}},k=()=>{x(e=>{e.sections.push(D9(`object`))})},A=(e,t)=>{x(n=>{let r=n.sections[e];y9(r?.key)&&(delete t.key,delete t.type,delete t.enabled),n.sections[e]={...n.sections[e],...t},t.type===`object`&&(n.sections[e].children=n.sections[e].children||[]),t.type===`flow`&&(n.sections[e].contentKey=n.sections[e].contentKey||`动作内容`,n.sections[e].contentAliases=n.sections[e].contentAliases||[`动作内容`,`动作`,`动作说明`,`内容`,`说明`],n.sections[e].itemFields=n.sections[e].itemFields||[{key:`动作内容`,label:`动作内容`,enabled:!0,editable:!0,maxLength:800,value:``}])})},j=e=>{x(t=>{t.sections.splice(e,1)})},M=e=>{x(t=>{let n=t.sections[e];n.children=n.children||[],n.children.push(D9(`string`))})},N=(e,t,n)=>{x(r=>{let i=r.sections[e],a=i.children||[],o=a[t];v9(i?.key,o?.key)&&(delete n.key,delete n.type,delete n.enabled,n.editable=!1),a[t]={...a[t],...n},r.sections[e].children=a})},P=(e,t)=>{x(n=>{n.sections[e].children?.splice(t,1)})},F=e=>{x(t=>{let n=t.sections[e];n.itemFields=n.itemFields||[],n.itemFields.push({key:`新流程字段`,label:`新流程字段`,enabled:!0,editable:!0,maxLength:800,value:``})})},I=(e,t,n)=>{x(r=>{let i=r.sections[e].itemFields||[];i[t]={...i[t],...n},r.sections[e].itemFields=i})},L=(e,t)=>{x(n=>{n.sections[e].itemFields?.splice(t,1)})},R=()=>{x(e=>{e.timePlanRules.push(NWe())})},z=(e,t)=>{x(n=>{n.timePlanRules[e]={...n.timePlanRules[e],...t}})},B=e=>{x(t=>{t.timePlanRules.splice(e,1)})},V=(e,t,n)=>{x(r=>{let i=r.timePlanRules[e];n.ratio!==void 0&&(i.ratios[t]=Number(n.ratio||0)),n.stage!==void 0&&(i.segments[t].stage=n.stage),n.description!==void 0&&(i.segments[t].description=n.description)})},H=e=>{x(t=>{let n=t.timePlanRules[e];n.ratios.push(1),n.segments.push({stage:`新阶段`,description:`阶段说明`})})},U=(e,t)=>{x(n=>{let r=n.timePlanRules[e];r.ratios.splice(t,1),r.segments.splice(t,1)})},W=(0,C.useMemo)(()=>v.map((e,t)=>({key:`section-${t}`,label:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(m9,{strong:!0,children:e.label||e.key||`未命名分组`}),e.key&&e.key!==e.label&&(0,Q.jsxs)(xR,{color:`blue`,children:[`key: `,e.key]}),(0,Q.jsx)(xR,{children:e.type}),y9(e.key)&&(0,Q.jsx)(xR,{color:`red`,children:`系统锁定`}),!e.enabled&&!y9(e.key)&&(0,Q.jsx)(xR,{color:`default`,children:`已禁用`})]}),children:(0,Q.jsxs)(OM,{direction:`vertical`,style:{width:`100%`},size:`middle`,children:[(0,Q.jsxs)(BP,{gutter:12,align:`middle`,children:[(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(LN,{addonBefore:`key`,value:e.key,maxLength:64,placeholder:`传给 AI 的字段名`,disabled:y9(e.key),onChange:e=>A(t,{key:e.target.value})})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(LN,{addonBefore:`label`,value:e.label,maxLength:64,placeholder:`后台显示名称`,onChange:e=>A(t,{label:e.target.value})})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(Sb,{value:e.type,options:g9,style:{width:`100%`},disabled:y9(e.key),onChange:e=>A(t,{type:e})})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsxs)(OM,{children:[`启用`,(0,Q.jsx)(aF,{checked:y9(e.key)?!0:e.enabled,disabled:y9(e.key),onChange:e=>A(t,{enabled:e})})]})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsxs)(OM,{children:[`可编辑`,(0,Q.jsx)(aF,{checked:e.editable,onChange:e=>A(t,{editable:e})})]})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(Ej,{min:1,max:2e4,value:e.maxLength,addonBefore:`长度`,style:{width:`100%`},onChange:e=>A(t,{maxLength:Number(e||1e3)})})}),(0,Q.jsx)(nj,{span:2,style:{textAlign:`right`},children:(0,Q.jsx)(wP,{title:`确认删除该分组?`,disabled:y9(e.key),onConfirm:()=>j(t),children:(0,Q.jsx)(XS,{danger:!0,icon:(0,Q.jsx)(wR,{}),disabled:y9(e.key)})})})]}),e.type===`object`&&(0,Q.jsx)(NA,{size:`small`,title:`对象字段`,extra:(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(cA,{}),onClick:()=>M(t),children:`新增字段`}),children:(0,Q.jsx)(OM,{direction:`vertical`,style:{width:`100%`},children:(e.children||[]).map((n,r)=>(0,Q.jsxs)(BP,{gutter:8,align:`middle`,children:[(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(LN,{addonBefore:`key`,value:n.key,maxLength:64,placeholder:`传给 AI 的字段名`,disabled:v9(e.key,n.key),onChange:e=>N(t,r,{key:e.target.value})})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(LN,{addonBefore:`label`,value:n.label,maxLength:64,placeholder:`后台显示名称`,onChange:e=>N(t,r,{label:e.target.value})})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsx)(Sb,{value:n.type,options:g9.filter(e=>e.value!==`object`&&e.value!==`flow`),style:{width:`100%`},disabled:v9(e.key,n.key),onChange:e=>N(t,r,{type:e})})}),(0,Q.jsx)(nj,{span:2,children:(0,Q.jsxs)(OM,{children:[`启用`,(0,Q.jsx)(aF,{checked:v9(e.key,n.key)?!0:n.enabled,disabled:v9(e.key,n.key),onChange:e=>N(t,r,{enabled:e})})]})}),(0,Q.jsx)(nj,{span:2,children:(0,Q.jsxs)(OM,{children:[`编辑`,(0,Q.jsx)(aF,{checked:v9(e.key,n.key)?!1:n.editable,disabled:v9(e.key,n.key),onChange:e=>N(t,r,{editable:e})})]})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsx)(Ej,{min:1,max:2e4,value:n.maxLength,addonBefore:`长度`,style:{width:`100%`},onChange:e=>N(t,r,{maxLength:Number(e||1e3)})})}),(0,Q.jsx)(nj,{span:5,children:(0,Q.jsx)(LN,{value:Array.isArray(n.value)?n.value.join(`/`):String(n.value??``),maxLength:n.maxLength||1e3,placeholder:`默认值`,onChange:e=>N(t,r,{value:n.type===`array`?e.target.value.split(`/`).filter(Boolean):e.target.value})})}),(0,Q.jsx)(nj,{span:1,style:{textAlign:`right`},children:(0,Q.jsx)(XS,{danger:!0,size:`small`,icon:(0,Q.jsx)(wR,{}),disabled:v9(e.key,n.key),onClick:()=>P(t,r)})})]},`child-${t}-${r}`))})}),e.type===`flow`&&(0,Q.jsxs)(NA,{size:`small`,title:`流程数组对象字段`,extra:(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(cA,{}),onClick:()=>F(t),children:`新增流程字段`}),children:[(0,Q.jsxs)(BP,{gutter:12,style:{marginBottom:12},children:[(0,Q.jsx)(nj,{span:6,children:(0,Q.jsx)(LN,{addonBefore:`内容字段`,value:e.contentKey,maxLength:64,onChange:e=>A(t,{contentKey:e.target.value})})}),(0,Q.jsx)(nj,{span:18,children:(0,Q.jsx)(LN,{addonBefore:`别名 / 分隔`,value:(e.contentAliases||[]).join(`/`),onChange:e=>A(t,{contentAliases:e.target.value.split(`/`).map(e=>e.trim()).filter(Boolean)})})})]}),(0,Q.jsx)(OM,{direction:`vertical`,style:{width:`100%`},children:(e.itemFields||[]).map((e,n)=>(0,Q.jsxs)(BP,{gutter:8,align:`middle`,children:[(0,Q.jsx)(nj,{span:5,children:(0,Q.jsx)(LN,{addonBefore:`key`,value:e.key,maxLength:64,placeholder:`流程对象字段名`,onChange:e=>I(t,n,{key:e.target.value})})}),(0,Q.jsx)(nj,{span:5,children:(0,Q.jsx)(LN,{addonBefore:`label`,value:e.label,maxLength:64,placeholder:`后台显示名称`,onChange:e=>I(t,n,{label:e.target.value})})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsxs)(OM,{children:[`启用`,(0,Q.jsx)(aF,{checked:e.enabled,onChange:e=>I(t,n,{enabled:e})})]})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsxs)(OM,{children:[`编辑`,(0,Q.jsx)(aF,{checked:e.editable,onChange:e=>I(t,n,{editable:e})})]})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(Ej,{min:1,max:2e4,value:e.maxLength,addonBefore:`长度`,style:{width:`100%`},onChange:e=>I(t,n,{maxLength:Number(e||800)})})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsx)(LN,{value:String(e.value??``),maxLength:e.maxLength||800,placeholder:`默认值`,onChange:e=>I(t,n,{value:e.target.value})})}),(0,Q.jsx)(nj,{span:1,style:{textAlign:`right`},children:(0,Q.jsx)(XS,{danger:!0,size:`small`,icon:(0,Q.jsx)(wR,{}),onClick:()=>L(t,n)})})]},`flow-${t}-${n}`))})]}),e.type!==`object`&&e.type!==`flow`&&(0,Q.jsx)(NA,{size:`small`,title:`默认值`,children:(0,Q.jsx)(h9,{rows:3,value:Array.isArray(e.value)?e.value.join(` +你是一位专业的电商图片文案专家,擅长将产品卖点转化为图片生成提示词`,size:`large`})}),(0,Q.jsxs)(`div`,{style:{marginBottom:8},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:13},children:`行业选项配置`}),(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,marginLeft:8},children:`添加选项组,每组包含名称和多个选项,前台将显示为下拉选择`})]}),(0,Q.jsx)(X.List,{name:`optionGroups`,children:(e,{add:t,remove:n})=>(0,Q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,marginBottom:16},children:[e.map(({key:e,name:t,...r})=>(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`,padding:`10px 12px`,borderRadius:10,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:8},children:[(0,Q.jsx)(X.Item,{...r,name:[t,`name`],label:`选项名称`,style:{marginBottom:0},rules:[{required:!0,message:`请输入选项名称`}],children:(0,Q.jsx)(LN,{placeholder:`例如:视频风格`,size:`middle`,style:{borderRadius:8}})}),(0,Q.jsx)(X.Item,{...r,name:[t,`options`],label:`选项内容`,style:{marginBottom:0},children:(0,Q.jsx)(Sb,{mode:`tags`,size:`middle`,placeholder:`输入选项后回车添加`,style:{borderRadius:8},tokenSeparators:[`,`,`,`,`、`]})})]}),(0,Q.jsx)(a1,{onClick:()=>n(t),style:{color:`#ef4444`,fontSize:16,marginTop:34,cursor:`pointer`,flexShrink:0}})]},e)),(0,Q.jsx)(XS,{type:`dashed`,onClick:()=>t(),block:!0,icon:(0,Q.jsx)(cA,{}),style:{borderRadius:8,height:36},children:`添加选项组`})]})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`is_active`,label:`启用状态`,valuePropName:`checked`,initialValue:!0,style:{flex:1},children:(0,Q.jsx)(aF,{})}),(0,Q.jsx)(X.Item,{name:`sort_order`,label:`排序`,initialValue:0,style:{flex:1},children:(0,Q.jsx)(LN,{type:`number`,size:`large`})})]})]})})]})};function K5(e){if(Array.isArray(e))return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return[]}var pUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)({open:!1,engine:null}),[o]=X.useForm(),s=async()=>{r(!0);try{t((await XBe()).map(e=>({...e,supportedRatios:K5(e.supportedRatios),supportedResolutions:K5(e.supportedResolutions),supportedDurations:K5(e.supportedDurations)})))}catch{yP.error(`加载视频引擎失败`)}finally{r(!1)}};(0,C.useEffect)(()=>{s()},[]);let c=async()=>{try{let e=await o.validateFields(),t={name:e.name,provider:e.provider,api_base:e.apiBase,api_key:e.apiKey,model_name:e.modelName,supported_ratios:JSON.stringify(e.supportedRatios||[]),supported_resolutions:JSON.stringify(e.supportedResolutions||[]),supported_durations:JSON.stringify(e.supportedDurations||[]),max_duration:e.maxDuration??15,max_image_count:e.maxImageCount??2,max_video_count:e.maxVideoCount??0,max_audio_count:e.maxAudioCount??0,supports_first_last_frame:e.supportsFirstLastFrame??!1,supports_universal_reference:e.supportsUniversalReference??!0,is_active:e.isActive??!0,priority:e.priority??0};i.engine?(await s5({id:i.engine.id,...t}),yP.success(`已更新`)):(await s5(t),yP.success(`已添加`)),a({open:!1,engine:null}),o.resetFields(),s()}catch(e){if(e?.errorFields)return;yP.error(e?.message||`保存失败`)}},l=async e=>{try{await ZBe(e),yP.success(`已删除`),s()}catch{yP.error(`删除失败`)}},u=e=>{a({open:!0,engine:e||null}),e?o.setFieldsValue(e):(o.resetFields(),o.setFieldsValue({isActive:!0,priority:0,maxDuration:30,maxImageCount:2,maxVideoCount:0,maxAudioCount:0,supportsFirstLastFrame:!1,supportsUniversalReference:!0,supportedRatios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],supportedResolutions:[`480p`,`720p`,`1080p`],supportedDurations:[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]}))};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(c0,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`视频引擎配置`}),(0,Q.jsxs)(xR,{color:`purple`,children:[e.length,` 个引擎`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>u(),style:{borderRadius:8},children:`添加引擎`})]}),(0,Q.jsx)(cR,{columns:[{title:`引擎名称`,key:`name`,width:180,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,Q.jsx)(`div`,{style:{width:36,height:36,borderRadius:8,background:t.isActive?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`linear-gradient(135deg, #94a3b8, #cbd5e1)`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,fontSize:16},children:(0,Q.jsx)(c0,{})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.name}),(0,Q.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12},children:t.provider})]})]})},{title:`支持比例`,dataIndex:`supportedRatios`,width:200,render:e=>(0,Q.jsx)(OM,{size:2,wrap:!0,children:e.map(e=>(0,Q.jsx)(xR,{children:e},e))})},{title:`支持分辨率`,dataIndex:`supportedResolutions`,width:150,render:e=>(0,Q.jsx)(OM,{size:2,wrap:!0,children:e.map(e=>(0,Q.jsx)(xR,{color:`blue`,children:e},e))})},{title:`支持时长`,dataIndex:`supportedDurations`,width:120,render:e=>(0,Q.jsx)(xR,{color:`orange`,children:e?.length?`${Math.min(...e)}-${Math.max(...e)}s`:`-`})},{title:`最大图片`,dataIndex:`maxImageCount`,width:100,render:e=>(0,Q.jsxs)(xR,{color:`purple`,children:[e,` 张`]})},{title:`最大视频`,dataIndex:`maxVideoCount`,width:100,render:e=>(0,Q.jsxs)(xR,{color:`cyan`,children:[e,` 个`]})},{title:`最大音频`,dataIndex:`maxAudioCount`,width:100,render:e=>(0,Q.jsxs)(xR,{color:e>0?`geekblue`:`default`,children:[e||0,` 段`]})},{title:`首尾帧`,dataIndex:`supportsFirstLastFrame`,width:90,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`default`,children:e?`支持`:`不支持`})},{title:`全能参考`,dataIndex:`supportsUniversalReference`,width:100,render:e=>(0,Q.jsx)(xR,{color:e?`purple`:`default`,children:e?`支持`:`不支持`})},{title:`状态`,dataIndex:`isActive`,width:80,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>u(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除?`,onConfirm:()=>l(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:1200}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(c0,{}),i.engine?`编辑引擎`:`添加引擎`]}),open:i.open,onOk:c,onCancel:()=>{a({open:!1,engine:null}),o.resetFields()},okText:`保存`,cancelText:`取消`,width:620,children:(0,Q.jsxs)(X,{form:o,layout:`vertical`,style:{marginTop:16},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`name`,label:`引擎名称`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(LN,{placeholder:`Seedance 2.0`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`provider`,label:`提供商`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`ark`,label:`火山引擎 (Ark)`}]})})]}),(0,Q.jsx)(X.Item,{name:`apiBase`,label:`API基础地址`,rules:[{required:!0}],children:(0,Q.jsx)(LN,{placeholder:`https://ark.cn-beijing.volces.com/api/v3`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`apiKey`,label:`API Key`,children:(0,Q.jsx)(LN.Password,{placeholder:`sk-****`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`modelName`,label:`模型名称`,children:(0,Q.jsx)(LN,{placeholder:`doubao-seedance-2-0-260128`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`supportedRatios`,label:`支持比例`,children:(0,Q.jsx)(Sb,{mode:`multiple`,size:`large`,options:[{value:`16:9`,label:`16:9 (横屏)`},{value:`4:3`,label:`4:3 (标准)`},{value:`1:1`,label:`1:1 (方形)`},{value:`3:4`,label:`3:4 (竖版)`},{value:`9:16`,label:`9:16 (竖屏)`},{value:`21:9`,label:`21:9 (超宽)`}]})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`supportedResolutions`,label:`支持分辨率`,style:{flex:1},children:(0,Q.jsx)(Sb,{mode:`multiple`,size:`large`,options:[{value:`480p`},{value:`720p`},{value:`1080p`}]})}),(0,Q.jsx)(X.Item,{name:`supportedDurations`,label:`支持时长(秒)`,style:{flex:1},children:(0,Q.jsx)(Sb,{mode:`multiple`,size:`large`,options:Array.from({length:12},(e,t)=>({value:t+4,label:`${t+4}秒`}))})})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`maxDuration`,label:`最大时长(秒)`,style:{flex:1},children:(0,Q.jsx)(LN,{type:`number`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`maxImageCount`,label:`最大图片数量`,style:{flex:1},children:(0,Q.jsx)(LN,{type:`number`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`maxVideoCount`,label:`最大视频数量`,style:{flex:1},children:(0,Q.jsx)(LN,{type:`number`,size:`large`})})]}),(0,Q.jsx)(`div`,{style:{display:`flex`,gap:16},children:(0,Q.jsx)(X.Item,{name:`maxAudioCount`,label:`最大参考音频数`,style:{flex:1},extra:`0 表示不支持音频参考,最大 3 段`,rules:[{validator:(e,t)=>{let n=Number(t??0);return!Number.isInteger(n)||n<0||n>3?Promise.reject(Error(`最大参考音频数必须为 0-3 的整数`)):Promise.resolve()}}],children:(0,Q.jsx)(LN,{type:`number`,size:`large`,min:0,max:3})})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`supportsFirstLastFrame`,label:`首尾帧模式`,valuePropName:`checked`,style:{paddingTop:30,flex:1},children:(0,Q.jsx)(aF,{checkedChildren:`支持`,unCheckedChildren:`不支持`})}),(0,Q.jsx)(X.Item,{name:`supportsUniversalReference`,label:`全能参考模式`,valuePropName:`checked`,style:{paddingTop:30,flex:1},children:(0,Q.jsx)(aF,{checkedChildren:`支持`,unCheckedChildren:`不支持`})}),(0,Q.jsx)(X.Item,{name:`isActive`,label:`启用状态`,valuePropName:`checked`,style:{paddingTop:30,flex:1},children:(0,Q.jsx)(aF,{})})]}),(0,Q.jsx)(`div`,{style:{display:`flex`,gap:16},children:(0,Q.jsx)(X.Item,{name:`priority`,label:`优先级`,style:{flex:1},children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:0,label:`0 (默认)`},{value:1,label:`1`},{value:2,label:`2`},{value:3,label:`3`},{value:5,label:`5`},{value:10,label:`10 (最高)`}]})})})]})})]})};function mUe(e){if(Array.isArray(e))return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return[]}function hUe(e){if(e&&typeof e==`object`&&!Array.isArray(e))return e;if(typeof e==`string`)try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}return{}}var q5={"1K":{"1:1":`1024x1024`,"4:3":`1152x864`,"3:4":`864x1152`,"16:9":`1312x736`,"9:16":`736x1312`,"3:2":`1248x832`,"2:3":`832x1248`,"21:9":`1568x672`},"2K":{"1:1":`2048x2048`,"4:3":`2304x1728`,"3:4":`1728x2304`,"16:9":`2848x1600`,"9:16":`1600x2848`,"3:2":`2496x1664`,"2:3":`1664x2496`,"21:9":`3136x1344`},"4K":{"1:1":`4096x4096`,"4:3":`4704x3520`,"3:4":`3520x4704`,"16:9":`5504x3040`,"9:16":`3040x5504`,"3:2":`4992x3328`,"2:3":`3328x4992`,"21:9":`6197x2656`}},J5=[`1:1`,`4:3`,`3:4`,`16:9`,`9:16`,`3:2`,`2:3`,`21:9`],gUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)({open:!1,engine:null}),[o]=X.useForm(),s=async()=>{r(!0);try{t((await QBe()).map(e=>({...e,supportedModels:mUe(e.supportedModels),supportedSizes:hUe(e.supportedSizes)})))}catch{yP.error(`加载图片引擎失败`)}finally{r(!1)}};(0,C.useEffect)(()=>{s()},[]);let c=async()=>{try{let e=await o.validateFields(),t={};for(let n of[`1K`,`2K`,`4K`]){let r=e[`size_${n}`]||[];if(r.length>0){t[n]={};for(let e of r)t[n][e]=q5[n]?.[e]||e}}let n={name:e.name,provider:e.provider,api_base:e.apiBase,api_key:e.apiKey,model_name:e.modelName,supported_models:JSON.stringify(e.supportedModels||[]),supported_sizes:JSON.stringify(t),default_size:e.defaultSize||`2K`,max_image_count:e.maxImageCount??0,generate_url:e.generateUrl||``,is_active:e.isActive??!0,priority:e.priority??0};i.engine?(await c5({id:i.engine.id,...n}),yP.success(`已更新`)):(await c5(n),yP.success(`已添加`)),a({open:!1,engine:null}),o.resetFields(),s()}catch(e){if(e?.errorFields)return;yP.error(e?.message||`保存失败`)}},l=async e=>{try{await $Be(e),yP.success(`已删除`),s()}catch{yP.error(`删除失败`)}},u=e=>{if(a({open:!0,engine:e||null}),e){let t={};for(let n of[`1K`,`2K`,`4K`])t[`size_${n}`]=Object.keys(e.supportedSizes?.[n]||{});o.setFieldsValue({...e,...t})}else o.resetFields(),o.setFieldsValue({isActive:!0,priority:0,supportedModels:[`doubao-seedream-5-0-260128`],defaultSize:`2K`,maxImageCount:0,size_1K:J5,size_2K:J5,size_4K:J5})};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)($1,{style:{fontSize:18,color:`#10b981`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`图片引擎配置`}),(0,Q.jsxs)(xR,{color:`green`,children:[e.length,` 个引擎`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>u(),style:{borderRadius:8},children:`添加引擎`})]}),(0,Q.jsx)(cR,{columns:[{title:`引擎名称`,key:`name`,width:180,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,Q.jsx)(`div`,{style:{width:36,height:36,borderRadius:8,background:t.isActive?`linear-gradient(135deg, #10b981, #059669)`:`linear-gradient(135deg, #94a3b8, #cbd5e1)`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,fontSize:16},children:(0,Q.jsx)($1,{})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.name}),(0,Q.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12},children:t.modelName})]})]})},{title:`1K 支持比例`,key:`sizes_1k`,width:260,render:(e,t)=>{let n=Object.keys(t.supportedSizes?.[`1K`]||{});return n.length===0?(0,Q.jsx)(`span`,{style:{color:`#bfbfbf`},children:`-`}):(0,Q.jsx)(OM,{size:2,wrap:!0,children:n.map(e=>(0,Q.jsxs)(xR,{color:`green`,children:[e,` `,t.supportedSizes[`1K`][e]]},e))})}},{title:`2K 支持比例`,key:`sizes_2k`,width:260,render:(e,t)=>{let n=Object.keys(t.supportedSizes?.[`2K`]||{});return n.length===0?(0,Q.jsx)(`span`,{style:{color:`#bfbfbf`},children:`-`}):(0,Q.jsx)(OM,{size:2,wrap:!0,children:n.map(e=>(0,Q.jsxs)(xR,{color:`blue`,children:[e,` `,t.supportedSizes[`2K`][e]]},e))})}},{title:`4K 支持比例`,key:`sizes_4k`,width:260,render:(e,t)=>{let n=Object.keys(t.supportedSizes?.[`4K`]||{});return n.length===0?(0,Q.jsx)(`span`,{style:{color:`#bfbfbf`},children:`-`}):(0,Q.jsx)(OM,{size:2,wrap:!0,children:n.map(e=>(0,Q.jsxs)(xR,{color:`purple`,children:[e,` `,t.supportedSizes[`4K`][e]]},e))})}},{title:`最大图片`,dataIndex:`maxImageCount`,width:100,render:e=>(0,Q.jsxs)(xR,{color:`purple`,children:[e,` 张`]})},{title:`状态`,dataIndex:`isActive`,width:80,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>u(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除?`,onConfirm:()=>l(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:1e3}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)($1,{}),i.engine?`编辑引擎`:`添加引擎`]}),open:i.open,onOk:c,onCancel:()=>{a({open:!1,engine:null}),o.resetFields()},okText:`保存`,cancelText:`取消`,width:680,children:(0,Q.jsxs)(X,{form:o,layout:`vertical`,style:{marginTop:16},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`name`,label:`引擎名称`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(LN,{placeholder:`豆包文生图`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`provider`,label:`提供商`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`ark`,label:`火山引擎 (Ark)`}]})})]}),(0,Q.jsx)(X.Item,{name:`apiBase`,label:`API基础地址`,rules:[{required:!0}],children:(0,Q.jsx)(LN,{placeholder:`https://ark.cn-beijing.volces.com/api/v3`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`apiKey`,label:`API Key`,children:(0,Q.jsx)(LN.Password,{placeholder:`sk-****`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`modelName`,label:`默认模型`,children:(0,Q.jsx)(LN,{placeholder:`doubao-seedream-5-0-260128`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`supportedModels`,label:`支持模型列表`,children:(0,Q.jsx)(Sb,{mode:`tags`,size:`large`,placeholder:`输入模型ID后回车添加`,tokenSeparators:[`,`,`,`],options:[{value:`doubao-seedream-5-0-260128`}]})}),(0,Q.jsxs)(`div`,{style:{background:`#f8f9fc`,borderRadius:10,padding:16,marginBottom:8},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:14},children:`尺寸配置`}),(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,marginLeft:8},children:`勾选每个档位支持的比例,前台选择后传对应像素值给SDK`})]}),[`1K`,`2K`,`4K`].map(e=>(0,Q.jsxs)(`div`,{style:{background:`#fafbfc`,borderRadius:10,padding:`12px 16px`,marginBottom:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:13,color:e===`2K`?`#3b82f6`:`#8b5cf6`},children:e}),(0,Q.jsx)(X.Item,{name:`size_${e}`,style:{marginTop:8,marginBottom:0},children:(0,Q.jsx)(XA.Group,{style:{width:`100%`},children:(0,Q.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:`6px 0`},children:J5.map(t=>(0,Q.jsxs)(XA,{value:t,style:{fontSize:12},children:[t,` `,(0,Q.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:11},children:q5[e]?.[t]})]},t))})})})]},e)),(0,Q.jsx)(X.Item,{name:`defaultSize`,label:`默认尺寸档位`,children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`1K`,label:`1K`},{value:`2K`,label:`2K`},{value:`4K`,label:`4K`}]})}),(0,Q.jsx)(X.Item,{name:`maxImageCount`,label:`最大图片数量`,children:(0,Q.jsx)(LN,{type:`number`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`generateUrl`,label:`生成接口地址`,children:(0,Q.jsx)(LN,{placeholder:`https://ark.cn-beijing.volces.com/api/v3/images/generations`,size:`large`})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`priority`,label:`优先级`,children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:0,label:`0 (默认)`},{value:1,label:`1`},{value:2,label:`2`},{value:3,label:`3`},{value:5,label:`5`},{value:10,label:`10 (最高)`}]})}),(0,Q.jsx)(X.Item,{name:`isActive`,label:`启用状态`,valuePropName:`checked`,style:{paddingTop:30},children:(0,Q.jsx)(aF,{})})]})]})})]})},_Ue=[`2K`,`4K`],vUe=[`480p`,`720p`,`1080p`],yUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)([]),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)({open:!1,ratio:null}),[c]=X.useForm(),[l,u]=(0,C.useState)(10),[d,f]=(0,C.useState)(null),[p,m]=(0,C.useState)(!1),h=X.useWatch(`genType`,c)||`video`,g=X.useWatch(`modelConfigId`,c),_=async()=>{a(!0);try{let[e,n,i]=await Promise.all([eVe(),t5(),jVe()]),a=(i?.engine?.image||[]).map(e=>({...e,genType:`image`})),o=(i?.engine?.video||[]).map(e=>({...e,genType:`video`}));t(e),r([...o,...a]);let s=n.find(e=>e.key===`text_credits_per_1000_tokens`);s&&(u(Number(s.value)||10),f({id:s.id}))}catch{yP.error(`加载积分比例失败`)}finally{a(!1)}};(0,C.useEffect)(()=>{_()},[]);let v=(0,C.useMemo)(()=>n.filter(e=>e.genType===h).map(e=>({value:e.id,label:`${e.name}${e.modelName?`(${e.modelName})`:``}`})),[n,h]),y=(0,C.useMemo)(()=>n.find(e=>e.id===g&&e.genType===h),[n,h,g]),b=(0,C.useMemo)(()=>{if(h===`image`){let e=y?.supportedSizes?Object.keys(y.supportedSizes):[];return(e.length?e:_Ue).map(e=>({value:e,label:e}))}let e=y?.supportedResolutions||[];return(e.length?e:vUe).map(e=>({value:e,label:e}))},[h,y]),x=(e,t)=>n.find(n=>n.id===e&&(!t||n.genType===t))?.name||e,S=async()=>{try{let e=await c.validateFields(),t={model_config_id:e.modelConfigId,gen_type:e.genType,resolution:e.resolution,ratio:e.ratio,base_credits:e.baseCredits,per_second_credits:e.genType===`image`?0:e.perSecondCredits||0};e.genType===`video`&&(t.input_video_ratio=e.inputVideoRatio??1,t.input_video_base_credits=e.inputVideoBaseCredits??0,t.input_video_per_second_credits=e.inputVideoPerSecondCredits??0),t.input_image_ratio=e.inputImageRatio??1,t.input_image_base_credits=e.inputImageBaseCredits??0,t.input_image_per_image_credits=e.inputImagePerImageCredits??0,o.ratio?(await l5({id:o.ratio.id,...t}),yP.success(`已更新`)):(await l5(t),yP.success(`已添加`)),s({open:!1,ratio:null}),c.resetFields(),_()}catch(e){if(e?.errorFields)return;yP.error(e?.message||`保存失败`)}},w=async e=>{try{await tVe(e),yP.success(`已删除`),_()}catch{yP.error(`删除失败`)}},T=async()=>{if(d){m(!0);try{await n5(d.id,String(l)),yP.success(`文字积分费率已更新`)}catch(e){yP.error(e?.message||`保存失败`)}finally{m(!1)}}},E=e=>{s({open:!0,ratio:e||null}),e?c.setFieldsValue({modelConfigId:e.modelConfigId,genType:e.genType===`image`?`image`:`video`,resolution:e.resolution,ratio:e.ratio,baseCredits:e.baseCredits,perSecondCredits:e.perSecondCredits,inputVideoRatio:e.inputVideoRatio,inputVideoBaseCredits:e.inputVideoBaseCredits,inputVideoPerSecondCredits:e.inputVideoPerSecondCredits,inputImageRatio:e.inputImageRatio,inputImageBaseCredits:e.inputImageBaseCredits,inputImagePerImageCredits:e.inputImagePerImageCredits}):(c.resetFields(),c.setFieldsValue({genType:`video`,ratio:1,baseCredits:60,perSecondCredits:2,inputVideoRatio:1,inputVideoBaseCredits:0,inputVideoPerSecondCredits:.5,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:.5}))};return(0,Q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(oZ,{style:{fontSize:18,color:`#f59e0b`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`文字积分费率`})]}),(0,Q.jsx)(XS,{type:`primary`,loading:p,onClick:T,style:{borderRadius:8},children:`保存`})]}),(0,Q.jsx)(Z.Text,{type:`secondary`,style:{display:`block`,marginBottom:16,fontSize:13},children:`文字积分计算公式:ceil(总token数 x 费率 / 1000),最低1积分`}),(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,Q.jsx)(Z.Text,{children:`每1000 token消耗积分:`}),(0,Q.jsxs)(OM.Compact,{style:{width:160},children:[(0,Q.jsx)(Ej,{min:0,max:1e3,step:.01,value:l,onChange:e=>u(e||0),size:`large`,style:{width:`100%`}}),(0,Q.jsx)(Z.Text,{children:`积分`})]}),(0,Q.jsxs)(Z.Text,{type:`secondary`,style:{fontSize:12},children:[`示例:1000 token = `,l,` 积分,500 token = `,(500*l/1e3).toFixed(4),` 积分`]})]})]}),(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(IG,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`积分比例配置`}),(0,Q.jsxs)(xR,{color:`purple`,children:[e.length,` 条规则`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>E(),style:{borderRadius:8},children:`添加比例`})]}),(0,Q.jsx)(Z.Text,{type:`secondary`,style:{display:`block`,marginBottom:16,fontSize:13},children:`视频积分公式:(基础积分 + 每秒积分 x 视频时长) x 模型倍率;图片积分公式:基础积分 x 模型倍率`}),(0,Q.jsx)(cR,{columns:[{title:`类型`,dataIndex:`genType`,width:80,render:e=>(0,Q.jsx)(xR,{color:e===`image`?`cyan`:`orange`,children:e===`image`?`图片`:`视频`})},{title:`引擎`,dataIndex:`modelConfigId`,width:180,render:(e,t)=>(0,Q.jsx)(xR,{color:t.genType===`image`?`cyan`:`purple`,children:x(e,t.genType)})},{title:`分辨率/尺寸`,dataIndex:`resolution`,width:110,render:e=>(0,Q.jsx)(xR,{color:{"480p":`blue`,"720p":`blue`,"1080p":`blue`,"4K":`green`,"2K":`green`}[e]||`default`,children:e})},{title:`倍率`,dataIndex:`ratio`,width:100,sorter:(e,t)=>e.ratio-t.ratio,render:e=>(0,Q.jsxs)(Z.Text,{strong:!0,style:{color:e>=2?`#ef4444`:e>=1.5?`#f59e0b`:`#10b981`},children:[`x`,e]})},{title:`基础积分`,dataIndex:`baseCredits`,width:100,render:e=>(0,Q.jsxs)(Z.Text,{children:[e,` 积分`]})},{title:`每秒积分`,dataIndex:`perSecondCredits`,width:100,render:(e,t)=>(0,Q.jsx)(Z.Text,{children:t.genType===`image`?`-`:`${e} 积分/秒`})},{title:`传入视频`,children:[{title:`倍率`,dataIndex:`inputVideoRatio`,width:90,render:(e,t)=>(0,Q.jsx)(Z.Text,{children:t.genType===`image`?`-`:(0,Q.jsxs)(`span`,{style:{color:e>=2?`#ef4444`:e>=1.5?`#f59e0b`:`#10b981`},children:[`x`,e]})})},{title:`基础积分`,dataIndex:`inputVideoBaseCredits`,width:100,render:(e,t)=>(0,Q.jsx)(Z.Text,{children:t.genType===`image`?`-`:`${e} 积分`})},{title:`每秒积分`,dataIndex:`inputVideoPerSecondCredits`,width:100,render:(e,t)=>(0,Q.jsx)(Z.Text,{children:t.genType===`image`?`-`:`${e} 积分/秒`})}]},{title:`传入图片`,children:[{title:`倍率`,dataIndex:`inputImageRatio`,width:90,render:e=>(0,Q.jsxs)(`span`,{style:{color:e>=2?`#ef4444`:e>=1.5?`#f59e0b`:`#10b981`},children:[`x`,e]})},{title:`基础积分`,dataIndex:`inputImageBaseCredits`,width:100,render:e=>(0,Q.jsxs)(Z.Text,{children:[e,` 积分`]})},{title:`每张积分`,dataIndex:`inputImagePerImageCredits`,width:100,render:e=>(0,Q.jsxs)(Z.Text,{children:[e,` 积分/张`]})}]},{title:`示例计算`,key:`example`,width:160,render:(e,t)=>{let n;return t.genType===`image`?(n=Math.round(t.baseCredits*t.ratio),t.inputImageRatio&&t.inputImagePerImageCredits&&(n+=Math.round((t.inputImageBaseCredits+t.inputImagePerImageCredits*3)*t.inputImageRatio))):(n=Math.round((t.baseCredits+t.perSecondCredits*15)*t.ratio),t.inputVideoRatio&&t.inputVideoPerSecondCredits&&(n+=Math.round((t.inputVideoBaseCredits+t.inputVideoPerSecondCredits*15)*t.inputVideoRatio)),t.inputImageRatio&&t.inputImagePerImageCredits&&(n+=Math.round((t.inputImageBaseCredits+t.inputImagePerImageCredits*3)*t.inputImageRatio))),(0,Q.jsxs)(Z.Text,{strong:!0,style:{color:`#6366f1`},children:[n,` 积分`]})}},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>E(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除?`,onConfirm:()=>w(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:i,pagination:!1,scroll:{x:1500}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(IG,{}),o.ratio?`编辑比例`:`添加比例`]}),open:o.open,onOk:S,onCancel:()=>{s({open:!1,ratio:null}),c.resetFields()},okText:`保存`,cancelText:`取消`,width:520,children:(0,Q.jsxs)(X,{form:c,layout:`vertical`,style:{marginTop:16},children:[(0,Q.jsx)(X.Item,{name:`genType`,label:`生成类型`,rules:[{required:!0,message:`请选择生成类型`}],children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`video`,label:`视频`},{value:`image`,label:`图片`}],onChange:()=>{c.setFieldsValue({modelConfigId:void 0,resolution:void 0})}})}),(0,Q.jsx)(X.Item,{name:`modelConfigId`,label:`引擎`,rules:[{required:!0,message:`请选择引擎`}],children:(0,Q.jsx)(Sb,{size:`large`,placeholder:`请选择引擎`,options:v,showSearch:!0,optionFilterProp:`label`,onChange:()=>c.setFieldsValue({resolution:void 0})})}),(0,Q.jsx)(X.Item,{name:`resolution`,label:h===`image`?`图片尺寸`:`分辨率`,rules:[{required:!0,message:h===`image`?`请选择图片尺寸`:`请选择分辨率`}],children:(0,Q.jsx)(Sb,{size:`large`,placeholder:h===`image`?`请选择图片尺寸`:`请选择分辨率`,options:b})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`ratio`,label:`倍率`,style:{flex:1},rules:[{required:!0,message:`请输入倍率`}],children:(0,Q.jsx)(Ej,{min:.1,max:10,step:.1,style:{width:`100%`},size:`large`})}),(0,Q.jsx)(X.Item,{name:`baseCredits`,label:`基础积分`,style:{flex:1},rules:[{required:!0,message:`请输入基础积分`}],children:(0,Q.jsx)(Ej,{min:0,max:1e3,style:{width:`100%`},size:`large`})}),h!==`image`&&(0,Q.jsx)(X.Item,{name:`perSecondCredits`,label:`每秒积分`,style:{flex:1},rules:[{required:!0,message:`请输入每秒积分`}],children:(0,Q.jsx)(Ej,{min:0,max:100,style:{width:`100%`},size:`large`})})]}),h!==`image`&&(0,Q.jsxs)(`div`,{style:{marginTop:8,padding:`12px 16px`,backgroundColor:`#f5f5ff`,borderRadius:8,border:`1px solid #e0e0ff`},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{display:`block`,marginBottom:8,color:`#4f46e5`},children:`传入视频价格`}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`inputVideoRatio`,label:`倍率`,style:{flex:1,marginBottom:0},rules:[{required:!0,message:`请输入传入视频倍率`}],children:(0,Q.jsx)(Ej,{min:0,max:10,step:.1,style:{width:`100%`},size:`large`})}),(0,Q.jsx)(X.Item,{name:`inputVideoBaseCredits`,label:`基础积分`,style:{flex:1,marginBottom:0},rules:[{required:!0,message:`请输入传入视频基础积分`}],children:(0,Q.jsx)(Ej,{min:0,max:500,style:{width:`100%`},size:`large`})}),(0,Q.jsx)(X.Item,{name:`inputVideoPerSecondCredits`,label:`每秒积分`,style:{flex:1,marginBottom:0},rules:[{required:!0,message:`请输入传入视频每秒积分`}],children:(0,Q.jsx)(Ej,{min:0,max:50,style:{width:`100%`},size:`large`})})]})]}),(0,Q.jsxs)(`div`,{style:{marginTop:12,padding:`12px 16px`,backgroundColor:`#f0fff4`,borderRadius:8,border:`1px solid #c6f6d5`},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{display:`block`,marginBottom:8,color:`#059669`},children:`传入图片价格`}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`inputImageRatio`,label:`倍率`,style:{flex:1,marginBottom:0},rules:[{required:!0,message:`请输入传入图片倍率`}],children:(0,Q.jsx)(Ej,{min:0,max:10,step:.1,style:{width:`100%`},size:`large`})}),(0,Q.jsx)(X.Item,{name:`inputImageBaseCredits`,label:`基础积分`,style:{flex:1,marginBottom:0},rules:[{required:!0,message:`请输入传入图片基础积分`}],children:(0,Q.jsx)(Ej,{min:0,max:500,style:{width:`100%`},size:`large`})}),(0,Q.jsx)(X.Item,{name:`inputImagePerImageCredits`,label:`每张积分`,style:{flex:1,marginBottom:0},rules:[{required:!0,message:`请输入传入图片每张积分`}],children:(0,Q.jsx)(Ej,{min:0,max:50,style:{width:`100%`},size:`large`})})]})]})]})})]})},Y5={HomeOutlined:(0,Q.jsx)(pQ,{}),PlayCircleOutlined:(0,Q.jsx)(c0,{}),WalletOutlined:(0,Q.jsx)(r8,{}),RobotOutlined:(0,Q.jsx)(k2,{}),SettingOutlined:(0,Q.jsx)(o4,{}),BellOutlined:(0,Q.jsx)(HU,{}),UserOutlined:(0,Q.jsx)(V6,{}),AppstoreOutlined:(0,Q.jsx)(vH,{}),FileTextOutlined:(0,Q.jsx)(MM,{}),StarOutlined:(0,Q.jsx)(s3,{}),HeartOutlined:(0,Q.jsx)(nQ,{}),CameraOutlined:(0,Q.jsx)(ZG,{}),DashboardOutlined:(0,Q.jsx)(bJ,{}),CalculatorOutlined:(0,Q.jsx)(IG,{}),DollarOutlined:(0,Q.jsx)(ZJ,{}),GiftOutlined:(0,Q.jsx)(jZ,{}),ThunderboltOutlined:(0,Q.jsx)(K3,{}),FireOutlined:(0,Q.jsx)(WX,{}),CloudOutlined:(0,Q.jsx)(gq,{}),SmileOutlined:(0,Q.jsx)(W4,{}),TrophyOutlined:(0,Q.jsx)(l6,{}),RocketOutlined:(0,Q.jsx)(M2,{}),BulbOutlined:(0,Q.jsx)(DG,{}),CodeOutlined:(0,Q.jsx)(Tq,{}),PictureOutlined:(0,Q.jsx)($1,{}),VideoCameraOutlined:(0,Q.jsx)($6,{}),AudioOutlined:(0,Q.jsx)(JH,{}),MailOutlined:(0,Q.jsx)(M$,{}),PhoneOutlined:(0,Q.jsx)(K1,{}),GlobalOutlined:(0,Q.jsx)(RZ,{}),ShoppingCartOutlined:(0,Q.jsx)(m4,{}),TeamOutlined:(0,Q.jsx)(U3,{}),BarChartOutlined:(0,Q.jsx)(xU,{}),PieChartOutlined:(0,Q.jsx)(n0,{}),LineChartOutlined:(0,Q.jsx)(f$,{}),SecurityScanOutlined:(0,Q.jsx)($2,{}),ApiOutlined:(0,Q.jsx)(eH,{}),DatabaseOutlined:(0,Q.jsx)(wJ,{}),CloudServerOutlined:(0,Q.jsx)(vq,{}),MenuOutlined:(0,Q.jsx)(J$,{})},bUe=Object.keys(Y5).map(e=>({value:e,label:(0,Q.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[Y5[e],` `,e.replace(`Outlined`,``)]})})),xUe={page:`blue`,group:`purple`},SUe={page:`页面`,group:`分组`},CUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!0),[i,a]=(0,C.useState)(`frontend`),[o,s]=(0,C.useState)({open:!1,menu:null}),[c]=X.useForm(),l=async()=>{r(!0);try{t(await u5())}catch{}r(!1)};(0,C.useEffect)(()=>{l()},[]);let u=async()=>{try{let e=await c.validateFields(),t={label:e.label,path:e.path||``,icon:e.icon||``,sort_order:e.sortOrder??0,is_active:e.isActive??!0,parent_id:e.parentId||null,menu_type:e.menuType||`page`,menu_target:e.menuTarget||`frontend`,is_default:e.isDefault??!1};o.menu?.id?await d5({...t,id:o.menu.id}):await d5(t),yP.success(o.menu?.id?`菜单已更新`:`菜单已添加`),s({open:!1,menu:null}),c.resetFields(),l()}catch{}},d=async e=>{try{await dVe(e),yP.success(`菜单已删除`),l()}catch(e){yP.error(e?.message||`删除失败`)}},f=t=>{s({open:!0,menu:t||null}),t?c.setFieldsValue({label:t.label,path:t.path,icon:t.icon,sortOrder:t.sortOrder??0,isActive:t.isActive??!0,parentId:t.parentId??``,menuType:t.menuType??`page`,menuTarget:t.menuTarget??`frontend`,isDefault:t.isDefault??!1}):(c.resetFields(),c.setFieldsValue({icon:`HomeOutlined`,sortOrder:e.length,isActive:!0,menuType:`page`,menuTarget:i,isDefault:!1}))},p=e.filter(e=>{let t=e.menuTarget??`frontend`;return t===i||t===`both`}),m=[{value:``,label:`顶级菜单`},...p.filter(e=>e.menuType===`group`).map(e=>({value:e.id,label:e.label}))],h=[],g=p.filter(e=>!e.parentId),_={};p.filter(e=>e.parentId).forEach(e=>{let t=e.parentId;_[t]||(_[t]=[]),_[t].push(e)}),g.sort((e,t)=>(e.sortOrder??0)-(t.sortOrder??0)).forEach(e=>{h.push({...e,_depth:0}),(_[e.id]||[]).sort((e,t)=>(e.sortOrder??0)-(t.sortOrder??0)).forEach(e=>{h.push({...e,_depth:1})})});let v=[{title:`排序`,dataIndex:`sortOrder`,width:60},{title:`菜单名称`,key:`label`,width:180,render:(e,t)=>(0,Q.jsxs)(`span`,{style:{paddingLeft:t._depth*20,fontWeight:t._depth===0?600:400},children:[t._depth===1&&(0,Q.jsx)(`span`,{style:{color:`#cbd5e1`,marginRight:4},children:`└`}),t.label]})},{title:`路由路径`,dataIndex:`path`,width:160,render:e=>e||(0,Q.jsx)(Z.Text,{type:`secondary`,children:`-`})},{title:`图标`,dataIndex:`icon`,width:100,render:e=>e&&Y5[e]?(0,Q.jsx)(`span`,{style:{fontSize:16,color:`#6366f1`},children:Y5[e]}):`-`},{title:`类型`,dataIndex:`menuType`,width:80,render:e=>(0,Q.jsx)(xR,{color:xUe[e]||`default`,children:SUe[e]||e})},{title:`状态`,dataIndex:`isActive`,width:70,render:e=>(0,Q.jsx)(`span`,{style:{color:e?`#22c55e`:`#94a3b8`},children:e?`启用`:`停用`})},...i===`frontend`?[{title:`默认显示`,dataIndex:`isDefault`,width:80,render:e=>e?(0,Q.jsx)(xR,{color:`green`,children:`默认`}):(0,Q.jsx)(Z.Text,{type:`secondary`,children:`-`})}]:[],{title:`操作`,key:`action`,width:150,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>f(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除该菜单?`,onConfirm:()=>d(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}];return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(J$,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`菜单配置`})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>f(),style:{borderRadius:8},children:`添加菜单`})]}),(0,Q.jsx)(jA,{activeKey:i,onChange:a,items:[{key:`frontend`,label:`前台菜单`},{key:`admin`,label:`后台菜单`}]}),(0,Q.jsx)(cR,{columns:v,dataSource:h,rowKey:`id`,loading:n,pagination:!1,scroll:{x:900}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(J$,{}),o.menu?.id?`编辑菜单`:`添加菜单`]}),open:o.open,onOk:u,onCancel:()=>{s({open:!1,menu:null}),c.resetFields()},okText:`确认`,cancelText:`取消`,width:520,children:(0,Q.jsxs)(X,{form:c,layout:`vertical`,children:[(0,Q.jsx)(X.Item,{name:`label`,label:`菜单名称`,rules:[{required:!0,message:`请输入菜单名称`}],children:(0,Q.jsx)(LN,{placeholder:`例如:我的项目`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`path`,label:`路由路径`,tooltip:`分组类型可留空`,children:(0,Q.jsx)(LN,{placeholder:`例如:/projects(分组可留空)`,size:`large`})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`menuType`,label:`菜单类型`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`page`,label:`页面`},{value:`group`,label:`分组`}]})}),(0,Q.jsx)(X.Item,{name:`menuTarget`,label:`适用端`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`frontend`,label:`前台`},{value:`admin`,label:`后台`},{value:`both`,label:`两者`}]})})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`icon`,label:`图标`,style:{flex:1},rules:[{required:!0}],children:(0,Q.jsx)(Sb,{size:`large`,options:bUe})}),(0,Q.jsx)(X.Item,{name:`sortOrder`,label:`排序`,style:{flex:1},children:(0,Q.jsx)(Ej,{min:0,max:100,style:{width:`100%`},size:`large`,placeholder:`默认0`})})]}),(0,Q.jsx)(X.Item,{name:`parentId`,label:`上级菜单`,children:(0,Q.jsx)(Sb,{size:`large`,options:m,allowClear:!0,placeholder:`顶级菜单`})}),(0,Q.jsx)(X.Item,{name:`isActive`,label:`启用`,valuePropName:`checked`,children:(0,Q.jsx)(aF,{})}),(0,Q.jsx)(X.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.menuTarget!==t.menuTarget,children:({getFieldValue:e})=>e(`menuTarget`)===`admin`?null:(0,Q.jsx)(X.Item,{name:`isDefault`,label:`新用户默认显示`,valuePropName:`checked`,tooltip:`开启后,新注册用户默认显示此菜单`,children:(0,Q.jsx)(aF,{})})})]})})]})},wUe={normal:`blue`,gift:`green`,promo:`purple`},TUe={normal:`常规`,gift:`赠送`,promo:`促销`},EUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)({open:!1,item:null}),[o]=X.useForm(),s=async()=>{r(!0);try{t((await _Ve()).map(e=>({id:e.id,name:e.name,credits:e.credits,price:e.price,bonusCredits:e.bonus_credits??e.bonusCredits??0,totalCredits:e.total_credits??e.totalCredits??e.credits,description:e.description,packageType:e.package_type??e.packageType??`normal`,isGift:e.is_gift??e.isGift??!1,isActive:e.is_active??e.isActive??!0,sortOrder:e.sort_order??e.sortOrder??0})))}catch{yP.error(`加载充值套餐失败`)}finally{r(!1)}};(0,C.useEffect)(()=>{s()},[]);let c=async()=>{try{let e=await o.validateFields(),t={name:e.name,credits:e.credits,price:e.price,bonus_credits:e.bonusCredits||0,description:e.description||null,package_type:e.packageType||`normal`,is_gift:e.isGift||!1,is_active:e.isActive??!0,sort_order:e.sortOrder??0};i.item?.id?(await p5({id:i.item.id,...t}),yP.success(`已更新`)):(await p5(t),yP.success(`已添加`)),a({open:!1,item:null}),o.resetFields(),s()}catch{}},l=async e=>{try{await vVe(e),yP.success(`已删除`),s()}catch(e){yP.error(e?.message||`删除失败`)}},u=e=>{a({open:!0,item:e||null}),e?o.setFieldsValue({name:e.name,credits:e.credits,price:e.price,bonusCredits:e.bonusCredits,description:e.description,packageType:e.packageType,isGift:e.isGift,isActive:e.isActive,sortOrder:e.sortOrder}):(o.resetFields(),o.setFieldsValue({isActive:!0,sortOrder:0,packageType:`normal`,bonusCredits:0,isGift:!1}))};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(jZ,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`充值套餐管理`}),(0,Q.jsxs)(xR,{color:`purple`,children:[e.length,` 个套餐`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>u(),style:{borderRadius:8},children:`添加套餐`})]}),(0,Q.jsx)(cR,{columns:[{title:`套餐名称`,key:`name`,width:160,render:(e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.name}),t.description&&(0,Q.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12},children:t.description})]})},{title:`基础积分`,dataIndex:`credits`,width:100,render:e=>(0,Q.jsx)(Z.Text,{children:e.toLocaleString()})},{title:`赠送积分`,dataIndex:`bonusCredits`,width:100,render:e=>e>0?(0,Q.jsxs)(xR,{color:`green`,children:[`+`,e.toLocaleString()]}):(0,Q.jsx)(Z.Text,{type:`secondary`,children:`-`})},{title:`总积分`,key:`total`,width:100,render:(e,t)=>(0,Q.jsx)(Z.Text,{strong:!0,style:{color:`#6366f1`},children:(t.credits+t.bonusCredits).toLocaleString()})},{title:`价格(元)`,dataIndex:`price`,width:100,render:e=>(0,Q.jsxs)(Z.Text,{strong:!0,children:[`¥`,e]})},{title:`类型`,dataIndex:`packageType`,width:80,render:e=>(0,Q.jsx)(xR,{color:wUe[e]||`default`,children:TUe[e]||e})},{title:`状态`,dataIndex:`isActive`,width:80,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>u(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确定删除?`,onConfirm:()=>l(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:900}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(jZ,{}),i.item?`编辑套餐`:`添加套餐`]}),open:i.open,onOk:c,onCancel:()=>{a({open:!1,item:null}),o.resetFields()},okText:`保存`,cancelText:`取消`,width:520,children:(0,Q.jsxs)(X,{form:o,layout:`vertical`,style:{marginTop:16},children:[(0,Q.jsx)(X.Item,{name:`name`,label:`套餐名称`,rules:[{required:!0,message:`请输入套餐名称`}],children:(0,Q.jsx)(LN,{placeholder:`例如:进阶包`,size:`large`})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`credits`,label:`基础积分`,rules:[{required:!0,message:`请输入积分`}],style:{flex:1},children:(0,Q.jsx)(Ej,{min:1,placeholder:`2000`,size:`large`,style:{width:`100%`}})}),(0,Q.jsx)(X.Item,{name:`price`,label:`价格(元)`,rules:[{required:!0,message:`请输入价格`}],style:{flex:1},children:(0,Q.jsx)(Ej,{min:.01,step:1,placeholder:`168`,size:`large`,style:{width:`100%`}})})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`bonusCredits`,label:`赠送积分`,initialValue:0,style:{flex:1},children:(0,Q.jsx)(Ej,{min:0,placeholder:`0`,size:`large`,style:{width:`100%`}})}),(0,Q.jsx)(X.Item,{name:`packageType`,label:`套餐类型`,initialValue:`normal`,style:{flex:1},children:(0,Q.jsx)(Sb,{size:`large`,options:[{value:`normal`,label:`常规`},{value:`gift`,label:`赠送`},{value:`promo`,label:`促销`}]})})]}),(0,Q.jsx)(X.Item,{name:`description`,label:`描述`,children:(0,Q.jsx)(LN,{placeholder:`套餐描述(可选)`,size:`large`})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16},children:[(0,Q.jsx)(X.Item,{name:`isActive`,label:`启用状态`,valuePropName:`checked`,initialValue:!0,style:{flex:1},children:(0,Q.jsx)(aF,{})}),(0,Q.jsx)(X.Item,{name:`isGift`,label:`是否赠送`,valuePropName:`checked`,initialValue:!1,style:{flex:1},children:(0,Q.jsx)(aF,{})}),(0,Q.jsx)(X.Item,{name:`sortOrder`,label:`排序`,initialValue:0,style:{flex:1},children:(0,Q.jsx)(Ej,{size:`large`,style:{width:`100%`}})})]})]})})]})},DUe={POST:`green`,PUT:`blue`,DELETE:`red`},OUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(0),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(1),c=async e=>{a(!0);try{let n=await yVe(e||o);t(n.items||[]),r(n.total||0)}catch{yP.error(`加载操作日志失败`)}finally{a(!1)}};return(0,C.useEffect)(()=>{c()},[]),(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(uQ,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`操作日志`})]}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>c(),children:`刷新`})]}),(0,Q.jsx)(cR,{columns:[{title:`操作人`,dataIndex:`username`,width:120,render:e=>(0,Q.jsx)(Z.Text,{strong:!0,children:e})},{title:`操作`,dataIndex:`action`,width:160,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`方法`,dataIndex:`method`,width:80,render:e=>(0,Q.jsx)(xR,{color:DUe[e]||`default`,children:e})},{title:`路径`,dataIndex:`path`,width:220,ellipsis:!0,render:e=>(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12},children:e})},{title:`时间`,dataIndex:`createdAt`,width:160,render:e=>(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12},children:E5(e)})}],dataSource:e,rowKey:`id`,loading:i,pagination:{current:o,pageSize:20,total:n,showTotal:e=>`共 ${e} 条记录`,onChange:e=>{s(e),c(e)}},scroll:{x:800}})]})})},kUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(0),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(1),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(null),[g]=X.useForm(),[_]=X.useForm(),v=async e=>{a(!0);try{let n=await bVe(e||o);t(n.items||[]),r(n.total||0)}catch{yP.error(`加载应用管理列表失败`)}finally{a(!1)}},y=async()=>{try{let e=await g.validateFields();await xVe({app_id:e.app_id,secret:e.secret,open_type:e.open_type,max_count:e.max_count,auth_url:e.auth_url,company:e.company}),yP.success(`创建成功`),l(!1),g.resetFields(),v()}catch(e){yP.error(e?.message||`创建失败`)}},b=async e=>{try{h(await m5(e)),d(!0)}catch(e){yP.error(e?.message||`获取详情失败`)}},x=async e=>{try{let t=await m5(e);h(t),_.setFieldsValue({appId:t.appId,secret:t.secret,openType:t.openType,maxCount:t.maxCount,authUrl:t.authUrl,company:t.company}),p(!0)}catch(e){yP.error(e?.message||`获取详情失败`)}},S=async()=>{if(m)try{let e=await _.validateFields();await SVe(m.id,{app_id:e.app_id,secret:e.secret,open_type:e.open_type,count:e.count,auth_url:e.auth_url,company:e.company}),yP.success(`更新成功`),p(!1),_.resetFields(),v()}catch(e){yP.error(e?.message||`更新失败`)}},w=e=>{xP.confirm({title:`确认删除`,content:`确定要删除这个应用管理吗?`,okText:`删除`,okType:`danger`,cancelText:`取消`,onOk:async()=>{try{await CVe(e),yP.success(`删除成功`),v()}catch(e){yP.error(e?.message||`删除失败`)}}})};return(0,C.useEffect)(()=>{v()},[]),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(J$,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`应用管理列表`})]}),(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>v(),children:`刷新`}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>l(!0),children:`创建`})]})]}),(0,Q.jsx)(cR,{columns:[{title:`ID`,dataIndex:`id`,width:120,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`应用ID`,dataIndex:`appId`,width:120,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`应用密钥`,dataIndex:`secret`,width:120,render:e=>{if(!e)return`-`;let t=e.length>12?`${e.slice(0,6)}...${e.slice(-4)}`:e;return(0,Q.jsx)(fx,{title:e,placement:`topLeft`,children:(0,Q.jsx)(Z.Text,{style:{fontSize:12},children:t})})}},{title:`开户方式`,dataIndex:`openType`,width:90,render:e=>(0,Q.jsx)(Z.Text,{children:{1:`千川`,2:`广告`,3:`本地推`,4:`星图`,5:`快手代理商`,6:`巨量星图`,7:`巨量服务单`,8:`腾讯服务单`,9:`腾讯营销K2`,10:`腾讯营销K3`}[e]||e})},{title:`归属公司`,dataIndex:`company`,width:120,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`授权次数`,dataIndex:`maxCount`,width:90,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`状态`,dataIndex:`status`,width:80,render:e=>(0,Q.jsx)(xR,{color:e===1?`green`:`red`,children:e===1?`正常`:`禁用`})},{title:`授权URL`,dataIndex:`authUrl`,width:200,render:e=>e?(0,Q.jsx)(fx,{title:e,placement:`topLeft`,children:(0,Q.jsx)(Z.Text,{style:{fontSize:12},ellipsis:!0,children:e.length>30?`${e.slice(0,27)}...`:e})}):`-`},{title:`创建人`,dataIndex:`createBy`,width:120,render:e=>(0,Q.jsx)(Z.Text,{children:e})},{title:`创建时间`,dataIndex:`createdAt`,width:160,render:e=>(0,Q.jsx)(Z.Text,{children:E5(e)})},{title:`更新时间`,dataIndex:`updatedAt`,width:160,render:e=>(0,Q.jsx)(Z.Text,{children:E5(e)})},{title:`操作`,width:120,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(ON,{}),size:`small`,onClick:()=>b(t.id),children:`详情`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(DR,{}),size:`small`,onClick:()=>x(t.id),children:`更新`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(wR,{}),size:`small`,danger:!0,onClick:()=>w(t.id),children:`删除`})]})}],dataSource:e,rowKey:`id`,loading:i,pagination:{current:o,pageSize:20,total:n,showTotal:e=>`共 ${e} 条记录`,onChange:e=>{s(e),v(e)}},scroll:{x:`max-content`}})]}),(0,Q.jsx)(xP,{title:`创建应用管理`,open:c,onOk:y,onCancel:()=>{l(!1),g.resetFields()},okText:`创建`,cancelText:`取消`,width:600,children:(0,Q.jsxs)(X,{form:g,layout:`vertical`,children:[(0,Q.jsx)(X.Item,{name:`app_id`,label:`应用ID`,rules:[{required:!0,message:`请输入应用ID`},{max:64,message:`应用ID不能超过64个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用ID`})}),(0,Q.jsx)(X.Item,{name:`secret`,label:`应用密钥`,rules:[{required:!0,message:`请输入应用密钥`},{max:256,message:`应用密钥不能超过256个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用密钥`})}),(0,Q.jsx)(X.Item,{name:`open_type`,label:`开户方式`,rules:[{required:!0,message:`请选择开户方式`}],children:(0,Q.jsxs)(Sb,{placeholder:`请选择开户方式`,children:[(0,Q.jsx)(Sb.Option,{value:1,children:`千川`}),(0,Q.jsx)(Sb.Option,{value:2,children:`广告`}),(0,Q.jsx)(Sb.Option,{value:3,children:`本地推`}),(0,Q.jsx)(Sb.Option,{value:4,children:`星图`}),(0,Q.jsx)(Sb.Option,{value:5,children:`快手代理商`}),(0,Q.jsx)(Sb.Option,{value:6,children:`巨量星图`}),(0,Q.jsx)(Sb.Option,{value:7,children:`巨量服务单`}),(0,Q.jsx)(Sb.Option,{value:8,children:`腾讯服务单`}),(0,Q.jsx)(Sb.Option,{value:9,children:`腾讯营销K2`}),(0,Q.jsx)(Sb.Option,{value:10,children:`腾讯营销K3`})]})}),(0,Q.jsx)(X.Item,{name:`max_count`,label:`最大授权用户数`,initialValue:100,children:(0,Q.jsx)(Ej,{min:1,placeholder:`应用最大可以授权多少个用户`})}),(0,Q.jsx)(X.Item,{name:`auth_url`,label:`应用授权链接`,children:(0,Q.jsx)(LN,{placeholder:`请输入应用授权链接`})}),(0,Q.jsx)(X.Item,{name:`company`,label:`应用归属公司名称`,rules:[{max:256,message:`公司名称不能超过256个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用归属公司名称`})})]})}),(0,Q.jsx)(xP,{title:`应用管理详情`,open:u,onCancel:()=>{d(!1),h(null)},okText:`关闭`,cancelText:`取消`,width:600,children:m&&(0,Q.jsxs)(`div`,{style:{lineHeight:`2`},children:[(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`ID:`}),` `,m.id]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`应用ID:`}),` `,m.appId]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`应用密钥:`}),` `,m.secret]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`开户方式:`}),` `,{1:`千川`,2:`广告`,3:`本地推`,4:`星图`,5:`快手代理商`,6:`巨量星图`,7:`巨量服务单`,8:`腾讯服务单`,9:`腾讯营销K2`,10:`腾讯营销K3`}[m.openType]||m.openType]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`归属公司:`}),` `,m.company||`-`]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`授权次数:`}),` `,m.maxCount]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`状态:`}),` `,m.status===1?`正常`:`禁用`]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`授权URL:`}),` `,m.authUrl||`-`]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`创建人:`}),` `,m.createBy]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`创建时间:`}),` `,E5(m.createdAt)]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:`更新时间:`}),` `,E5(m.updatedAt)]})]})}),(0,Q.jsx)(xP,{title:`更新应用管理`,open:f,onOk:S,onCancel:()=>{p(!1),_.resetFields(),h(null)},okText:`更新`,cancelText:`取消`,width:600,children:(0,Q.jsxs)(X,{form:_,layout:`vertical`,children:[(0,Q.jsx)(X.Item,{name:`appId`,label:`应用ID`,rules:[{required:!0,message:`请输入应用ID`},{max:64,message:`应用ID不能超过64个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用ID`})}),(0,Q.jsx)(X.Item,{name:`secret`,label:`应用密钥`,rules:[{required:!0,message:`请输入应用密钥`},{max:256,message:`应用密钥不能超过256个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用密钥`})}),(0,Q.jsx)(X.Item,{name:`openType`,label:`开户方式`,rules:[{required:!0,message:`请选择开户方式`}],children:(0,Q.jsxs)(Sb,{placeholder:`请选择开户方式`,children:[(0,Q.jsx)(Sb.Option,{value:1,children:`千川`}),(0,Q.jsx)(Sb.Option,{value:2,children:`广告`}),(0,Q.jsx)(Sb.Option,{value:3,children:`本地推`}),(0,Q.jsx)(Sb.Option,{value:4,children:`星图`}),(0,Q.jsx)(Sb.Option,{value:5,children:`快手代理商`}),(0,Q.jsx)(Sb.Option,{value:6,children:`巨量星图`}),(0,Q.jsx)(Sb.Option,{value:7,children:`巨量服务单`}),(0,Q.jsx)(Sb.Option,{value:8,children:`腾讯服务单`}),(0,Q.jsx)(Sb.Option,{value:9,children:`腾讯营销K2`}),(0,Q.jsx)(Sb.Option,{value:10,children:`腾讯营销K3`})]})}),(0,Q.jsx)(X.Item,{name:`maxCount`,label:`最大授权用户数`,children:(0,Q.jsx)(Ej,{min:1,placeholder:`应用最大可以授权多少个用户`})}),(0,Q.jsx)(X.Item,{name:`authUrl`,label:`应用授权链接`,children:(0,Q.jsx)(LN,{placeholder:`请输入应用授权链接`})}),(0,Q.jsx)(X.Item,{name:`company`,label:`应用归属公司名称`,rules:[{max:256,message:`公司名称不能超过256个字符`}],children:(0,Q.jsx)(LN,{placeholder:`请输入应用归属公司名称`})})]})})]})},X5=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``),Z5={image:`empty`,video:`empty`,videoCover:`empty`,references:{}},Q5={optimizing:{color:`processing`,text:`优化中`,icon:(0,Q.jsx)(fm,{spin:!0})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,Q.jsx)(iM,{})},generating:{color:`warning`,text:`生成中`,icon:(0,Q.jsx)(fm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,Q.jsx)(IK,{})},failed:{color:`error`,text:`失败`,icon:(0,Q.jsx)(cq,{})}},$5={image:{text:`图片`,color:`purple`,icon:(0,Q.jsx)(fX,{})},video:{text:`视频`,color:`geekblue`,icon:(0,Q.jsx)($6,{})}},AUe=e=>/^(https?:)?\/\//i.test(e)||/^(blob|data):/i.test(e),e7=e=>!!e&&/^blob:/i.test(e.trim()),t7=e=>{if(!e)return``;let t=String(e).trim();return t?AUe(t)?t:X5?`${X5}${t.startsWith(`/`)?t:`/${t}`}`:t.startsWith(`/`)?t:`/${t}`:``},jUe=e=>e?e.length>12?`${e.slice(0,8)}...`:e:`-`,n7=e=>e?E5(e):`-`,MUe=e=>e==null||e===``,r7=e=>{if(!e||e7(e))return!1;try{let t=new URL(t7(e),window.location.origin),n=t.searchParams.get(`exp`)||t.searchParams.get(`expires`)||t.searchParams.get(`expire`)||t.searchParams.get(`expires_at`)||t.searchParams.get(`x-expires`);if(!n)return!1;let r=Number(n);if(!Number.isFinite(r))return!1;let i=r>1e10?r:r*1e3;return Date.now()>=i}catch{return!1}},i7=e=>e?e7(e)||r7(e)?`invalid`:`checking`:`empty`,a7=e=>{let t=e.url||e.mediaUrl||e.fileUrl;return typeof t==`string`&&t.trim()?t.trim():void 0},NUe=e=>{let t=String(e.type||e.mediaType||e.mimeType||``).toLowerCase(),n=a7(e)?.toLowerCase()||``;return t.includes(`video`)||/\.(mp4|mov|webm|m4v)(\?|$)/i.test(n)?`video`:t.includes(`image`)||/\.(png|jpe?g|webp|gif|bmp|svg)(\?|$)/i.test(n)?`image`:t||`unknown`},o7=(e,t)=>`${t}-${a7(e)||`empty`}`,s7=(e,t=`资源`)=>e7(e)?`本地临时素材已失效`:r7(e)?`${t}链接已超时,请刷新列表或重新搜索后再查看`:`${t}加载失败,请刷新列表或重新搜索后再查看`,c7=({text:e,minHeight:t=240,compact:n=!1,action:r})=>(0,Q.jsxs)(`div`,{style:{width:`100%`,minHeight:n?void 0:t,height:n?`100%`:void 0,borderRadius:n?10:12,background:`#f8f9fc`,border:`1px dashed #cbd5e1`,color:`#64748b`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexDirection:`column`,gap:n?4:10,textAlign:`center`},children:[(0,Q.jsx)(Z.Text,{style:{color:`#64748b`,fontSize:n?11:13},children:e}),r]}),l7=({label:e,value:t})=>(0,Q.jsxs)(`div`,{style:{flex:1,minWidth:120},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:14},children:MUe(t)?`-`:t})]}),PUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(0),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(1),[c]=(0,C.useState)(20),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(0),[h,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(Z5),[y,b]=(0,C.useState)(!1),x=(0,C.useRef)(null),[S,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(null),D=(0,C.useCallback)(async()=>{a(!0);try{let e=await OVe({userId:d.trim()||void 0,status:l||void 0,page:o,pageSize:c});t((e.items||[]).map(e=>({id:e.id,userId:e.userId,username:e.username,projectId:e.projectId,projectName:e.projectName,industry:e.industry,originalPrompt:e.originalPrompt,optimizedPrompt:e.optimizedPrompt,duration:e.duration,aspectRatio:e.aspectRatio,resolution:e.resolution,status:e.status,videoUrl:e.videoUrl,videoCoverUrl:e.videoCoverUrl,references:e.references,creditsCost:e.creditsCost||0,textCreditsCost:e.textCreditsCost||0,textTokensUsed:e.textTokensUsed||0,videoTokensUsed:e.videoTokensUsed||0,errorMessage:e.errorMessage,createdAt:e.createdAt,generatedAt:e.generatedAt,genType:e.genType,imageSize:e.imageSize,imageUrl:e.imageUrl,imageTokensUsed:e.imageTokensUsed||0,imageProportion:e.imageProportion,imagePx:e.imagePx}))),r(e.total||0)}catch{yP.error(`加载记录失败`)}finally{a(!1)}},[l,d,o,c]);(0,C.useEffect)(()=>{D()},[D,p]),(0,C.useEffect)(()=>{if(!h){v(Z5);return}let e=(h.references||[]).reduce((e,t,n)=>{let r=a7(t);return e[o7(t,n)]=i7(r),e},{});x.current&&(x.current.pause(),x.current.currentTime=0),b(!1),v({image:i7(h.imageUrl),video:i7(h.videoUrl),videoCover:i7(h.videoCoverUrl),references:e})},[h]);let O=()=>{s(1),m(e=>e+1)},k=(0,C.useCallback)(e=>{g(e)},[]),A=()=>{x.current&&x.current.pause(),b(!1),g(null)},j=e=>{v(t=>({...t,...e}))},M=(e,t)=>{v(n=>({...n,references:{...n.references,[e]:t}}))},N=(e,t=`素材`)=>{if(!e){yP.warning(`${t}链接为空,暂无法查看`);return}if(e7(e)){yP.warning(`本地临时素材已失效,暂无法查看`);return}if(r7(e)){yP.warning(`${t}链接已超时,请刷新列表或重新搜索后再查看`);return}window.open(t7(e),`_blank`,`noopener,noreferrer`)},P=()=>{if(h?.videoUrl){if(r7(h.videoUrl)){j({video:`invalid`}),yP.warning(`视频链接已超时,请刷新列表或重新搜索后再查看`);return}b(!0),window.setTimeout(()=>{x.current?.play().catch(()=>{b(!1),j({video:`invalid`}),yP.warning(`视频播放失败,请确认资源链接是否仍然有效`)})},0)}},F=async(e,t,n)=>{w(e);try{await kVe(e,t,n),yP.success(`状态已更新`),D()}catch(e){yP.error(e?.message||`更新失败`)}finally{w(null)}},I=async()=>{if(T){w(T.record.id);try{await AVe(T.record.id,T.ratio,T.resolution,T.image_size),yP.success(`已提交${T.record.genType===`video`?`视频`:`图片`}生成`),E(null),D()}catch(e){yP.error(e?.message||`生成失败`)}finally{w(null)}}},L=(0,C.useMemo)(()=>[{title:`用户`,key:`user`,width:120,render:(e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:13},children:t.username||`未知用户`}),(0,Q.jsx)(`div`,{style:{fontSize:11,color:`#94a3b8`},children:jUe(t.userId)})]})},{title:`项目`,dataIndex:`projectName`,width:120,ellipsis:!0,render:e=>(0,Q.jsx)(Z.Text,{style:{fontSize:13},children:e||`-`})},{title:`行业`,dataIndex:`industry`,width:100,ellipsis:!0,render:e=>(0,Q.jsx)(xR,{color:`cyan`,children:e||`-`})},{title:`类型`,dataIndex:`genType`,width:90,ellipsis:!0,render:e=>{let t=$5[e]||{text:e||`-`,color:`default`,icon:null};return(0,Q.jsx)(xR,{color:t.color,icon:t.icon,children:t.text})}},{title:`提示词`,key:`prompt`,ellipsis:!0,render:(e,t)=>(0,Q.jsx)(fx,{title:t.originalPrompt,placement:`topLeft`,children:(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#475569`},ellipsis:!0,children:t.originalPrompt||`-`})})},{title:`参数`,key:`params`,width:160,render:(e,t)=>t.genType===`video`?t.duration||t.aspectRatio||t.resolution?(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[t.duration?(0,Q.jsxs)(xR,{children:[t.duration,`s`]}):null,t.aspectRatio?(0,Q.jsx)(xR,{children:t.aspectRatio}):null,t.resolution?(0,Q.jsx)(xR,{children:t.resolution}):null]}):(0,Q.jsx)(xR,{color:`default`,children:`待配置`}):t.imageSize||t.imageProportion||t.imagePx?(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[t.imageSize?(0,Q.jsx)(xR,{children:t.imageSize}):null,t.imageProportion?(0,Q.jsx)(xR,{children:t.imageProportion}):null,t.imagePx?(0,Q.jsx)(xR,{children:t.imagePx}):null]}):(0,Q.jsx)(xR,{color:`default`,children:`待配置`})},{title:`积分`,key:`credits`,width:120,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{fontSize:12},children:[t.textCreditsCost>0?(0,Q.jsxs)(`div`,{style:{color:`#f59e0b`},children:[`文字: `,t.textCreditsCost]}):null,t.creditsCost>0?(0,Q.jsxs)(`div`,{style:{color:`#6366f1`},children:[t.genType===`video`?`视频`:`图片`,`: `,t.creditsCost]}):null,t.textCreditsCost===0&&t.creditsCost===0?(0,Q.jsx)(Z.Text,{style:{color:`#94a3b8`},children:`0`}):null]})},{title:`状态`,dataIndex:`status`,width:90,render:e=>{let t=Q5[e]||{color:`default`,text:e||`-`,icon:null};return(0,Q.jsx)(xR,{color:t.color,icon:t.icon,children:t.text})}},{title:`时间`,key:`time`,width:150,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{fontSize:12,color:`#94a3b8`},children:[(0,Q.jsx)(`div`,{children:n7(t.createdAt)}),t.generatedAt?(0,Q.jsxs)(`div`,{style:{color:`#10b981`},children:[`生成: `,n7(t.generatedAt)]}):null]})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(ON,{}),onClick:()=>k(t),children:`详情`}),t.status===`generating`?(0,Q.jsx)(XS,{size:`small`,danger:!0,loading:S===t.id,onClick:()=>{xP.confirm({title:`确认操作`,icon:(0,Q.jsx)(DY,{}),content:`确定将此记录标记为失败?`,onOk:()=>F(t.id,`failed`)})},children:`标记失败`}):null,t.status===`failed`?(0,Q.jsx)(XS,{size:`small`,type:`primary`,danger:!0,loading:S===t.id,onClick:()=>E({record:t,ratio:t.aspectRatio||`16:9`,resolution:t.resolution||`720p`,image_size:t.imageSize||`2K`}),children:`重试生成`}):null,t.status===`prompt_optimized`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(XS,{size:`small`,type:`primary`,loading:S===t.id,onClick:()=>E({record:t,ratio:t.aspectRatio||`16:9`,resolution:t.resolution||`720p`,image_size:t.imageSize||`2K`}),style:{background:`#6366f1`,border:`none`},children:[`生成`,t.genType===`video`?`视频`:`图片`]}),(0,Q.jsx)(XS,{size:`small`,danger:!0,loading:S===t.id,onClick:()=>{xP.confirm({title:`确认操作`,icon:(0,Q.jsx)(DY,{}),content:`确定将此记录标记为失败?`,onOk:()=>F(t.id,`failed`)})},children:`标记失败`})]}):null]})}],[k,S]),R=h?$5[h.genType||``]||{text:h.genType||`-`,color:`default`,icon:null}:null,z=h?Q5[h.status]||{color:`default`,text:h.status||`-`,icon:null}:null,B=()=>{if(!h||h.genType!==`image`||h.status!==`completed`)return null;if(!h.imageUrl)return(0,Q.jsx)(c7,{text:`此图片任务暂无结果图片`,minHeight:260});if(_.image===`invalid`)return(0,Q.jsx)(c7,{text:s7(h.imageUrl,`图片`),minHeight:260});let e=t7(h.imageUrl);return(0,Q.jsxs)(`div`,{title:`点击新页面查看图片`,onClick:()=>N(h.imageUrl,`生成图片`),style:{position:`relative`,width:`100%`,minHeight:260,borderRadius:12,background:`#f8f9fc`,border:`1px solid #e2e8f0`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`},children:[(0,Q.jsx)(`img`,{src:e,alt:`生成图片`,onLoad:()=>j({image:`valid`}),onError:()=>j({image:`invalid`}),style:{display:_.image===`valid`?`block`:`none`,width:`100%`,maxHeight:560,objectFit:`contain`,background:`#fff`}},`${h.id}-${e}`),_.image===`checking`?(0,Q.jsx)(c7,{text:`图片加载检测中...`,minHeight:260}):null]})},V=()=>{if(!h||y||_.video===`invalid`)return null;let e=h.videoUrl?(0,Q.jsx)(XS,{type:`primary`,shape:`circle`,size:`large`,icon:(0,Q.jsx)(c0,{}),onClick:P,style:{boxShadow:`0 8px 20px rgba(15,23,42,0.25)`}}):null;if(!h.videoCoverUrl)return(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:12,overflow:`hidden`,background:`#f8f9fc`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,Q.jsx)(c7,{text:`此视频无封面`,minHeight:340,action:e})});if(_.videoCover===`invalid`)return(0,Q.jsx)(c7,{text:s7(h.videoCoverUrl,`视频封面`),minHeight:340,action:e});let t=t7(h.videoCoverUrl);return(0,Q.jsxs)(`div`,{style:{position:`absolute`,inset:0,borderRadius:12,overflow:`hidden`,background:`#f8f9fc`,border:`1px solid #e2e8f0`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,Q.jsx)(`img`,{src:t,alt:`视频封面`,onLoad:()=>j({videoCover:`valid`}),onError:()=>j({videoCover:`invalid`}),style:{display:_.videoCover===`valid`?`block`:`none`,width:`100%`,height:`100%`,objectFit:`contain`,background:`#000`}},`${h.id}-cover-${t}`),_.videoCover===`checking`?(0,Q.jsx)(c7,{text:`视频封面加载检测中...`,minHeight:340,action:e}):null,_.videoCover===`valid`?(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(15,23,42,0.18)`},children:e}):null]})},H=()=>{if(!h||h.genType!==`video`||h.status!==`completed`)return null;if(!h.videoUrl)return(0,Q.jsx)(c7,{text:`此视频任务暂无结果视频`,minHeight:340});if(_.video===`invalid`)return(0,Q.jsx)(c7,{text:s7(h.videoUrl,`视频`),minHeight:340});let e=t7(h.videoUrl);return(0,Q.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:340,borderRadius:12,background:`#000`,overflow:`hidden`,border:`1px solid #e2e8f0`},children:[(0,Q.jsx)(`video`,{ref:x,src:e,preload:`metadata`,controls:y,onLoadedMetadata:()=>j({video:`valid`}),onCanPlay:()=>j({video:`valid`}),onPlaying:()=>{b(!0),j({video:`valid`})},onPause:()=>b(!1),onEnded:()=>b(!1),onError:()=>{b(!1),j({video:`invalid`})},style:{width:`100%`,height:`100%`,objectFit:`contain`,background:`#000`,opacity:+!!y,pointerEvents:y?`auto`:`none`}},`${h.id}-${e}`),V()]})},U=(e,t)=>{let n=a7(e),r=NUe(e),i=o7(e,t),a=_.references[i]||i7(n),o=r===`image`,s=r===`video`,c=typeof e.name==`string`&&e.name?e.name:`参考素材 ${t+1}`;if(!n)return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsx)(`div`,{style:{width:94,height:94},children:(0,Q.jsx)(c7,{text:`无链接`,compact:!0})}),(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})]},i);if(a===`invalid`)return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsx)(`div`,{style:{width:94,height:94},children:(0,Q.jsx)(c7,{text:e7(n)?`本地临时素材已失效`:`素材不可访问`,compact:!0})}),(0,Q.jsx)(fx,{title:c,children:(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})})]},i);let l=t7(n);return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,title:`点击新页面查看素材`,onClick:()=>N(n,s?`视频素材`:o?`图片素材`:`素材`),onKeyDown:e=>{e.key===`Enter`&&N(n,s?`视频素材`:o?`图片素材`:`素材`)},style:{width:94,height:94,borderRadius:10,overflow:`hidden`,border:`1px solid #e2e8f0`,background:`#f8f9fc`,position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`},children:[o?(0,Q.jsx)(`img`,{src:l,alt:c,onLoad:()=>M(i,`valid`),onError:()=>M(i,`invalid`),style:{display:a===`valid`?`block`:`none`,width:`100%`,height:`100%`,objectFit:`cover`}}):null,s?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`video`,{src:l,preload:`metadata`,onLoadedMetadata:()=>M(i,`valid`),onError:()=>M(i,`invalid`),style:{display:`none`}}),(0,Q.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12,textAlign:`center`},children:[(0,Q.jsx)(c0,{style:{fontSize:18}}),(0,Q.jsx)(`div`,{children:`视频素材`}),(0,Q.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,marginTop:2},children:`点击查看`})]})]}):null,!o&&!s?(0,Q.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12,textAlign:`center`},children:[`文件素材`,(0,Q.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,marginTop:2},children:`点击查看`})]}):null,a===`checking`&&o?(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#f8f9fc`},children:(0,Q.jsx)(fm,{style:{color:`#6366f1`}})}):null]}),(0,Q.jsx)(fx,{title:c,children:(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})})]},i)};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16,flexWrap:`wrap`,gap:12},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)($6,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`生成记录管理`}),(0,Q.jsxs)(xR,{color:`purple`,children:[n,` 条记录`]})]}),(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(Sb,{placeholder:`状态筛选`,allowClear:!0,style:{width:120},value:l||void 0,onChange:e=>{u(e||``),s(1)},options:[{value:`optimizing`,label:`优化中`},{value:`prompt_optimized`,label:`待生成`},{value:`generating`,label:`生成中`},{value:`completed`,label:`已完成`},{value:`failed`,label:`失败`}]}),(0,Q.jsx)(LN,{placeholder:`用户ID搜索`,prefix:(0,Q.jsx)(_b,{style:{color:`#94a3b8`}}),style:{width:200},value:d,onChange:e=>f(e.target.value),onPressEnter:O,allowClear:!0}),(0,Q.jsx)(XS,{type:`primary`,onClick:O,style:{borderRadius:8},children:`搜索`})]})]}),(0,Q.jsx)(cR,{columns:L,dataSource:e,rowKey:`id`,loading:i,scroll:{x:1120},pagination:{current:o,pageSize:c,total:n,onChange:s,showSizeChanger:!1,showTotal:e=>`共 ${e} 条`}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[h?.genType===`video`?(0,Q.jsx)($6,{}):(0,Q.jsx)(fX,{}),(0,Q.jsx)(`span`,{children:`生成记录详情`})]}),open:!!h,onCancel:A,footer:null,width:900,destroyOnClose:!0,children:h?(0,Q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:16},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,flexWrap:`wrap`},children:[(0,Q.jsxs)(`div`,{style:{flex:1,minWidth:150,padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`用户`}),(0,Q.jsx)(Z.Text,{strong:!0,children:h.username||`-`})]}),(0,Q.jsxs)(`div`,{style:{flex:1,minWidth:150,padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`项目`}),(0,Q.jsx)(Z.Text,{strong:!0,children:h.projectName||`-`})]}),(0,Q.jsxs)(`div`,{style:{flex:1,minWidth:150,padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`类型 / 状态`}),(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[R?(0,Q.jsx)(xR,{color:R.color,icon:R.icon,children:R.text}):null,z?(0,Q.jsx)(xR,{color:z.color,icon:z.icon,children:z.text}):null]})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`原始提示词`}),(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:(0,Q.jsx)(Z.Text,{style:{fontSize:13,color:`#475569`,lineHeight:1.7},children:h.originalPrompt||`-`})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`优化后提示词`}),(0,Q.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,Q.jsx)(Z.Text,{style:{fontSize:13,color:`#1a1a2e`,lineHeight:1.7},children:h.optimizedPrompt||`-`})})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(l7,{label:`文字积分`,value:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{color:`#f59e0b`},children:h.textCreditsCost||0}),(0,Q.jsxs)(Z.Text,{style:{fontSize:11,color:`#94a3b8`},children:[` (`,h.textTokensUsed||0,` tokens)`]})]})}),(0,Q.jsx)(l7,{label:`${h.genType===`image`?`图片`:`视频`}积分`,value:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{color:`#6366f1`},children:h.creditsCost||0}),h.genType===`video`&&h.videoTokensUsed?(0,Q.jsxs)(Z.Text,{style:{fontSize:11,color:`#94a3b8`},children:[` (`,h.videoTokensUsed,` tokens)`]}):null,h.genType===`image`&&h.imageTokensUsed?(0,Q.jsxs)(Z.Text,{style:{fontSize:11,color:`#94a3b8`},children:[` (`,h.imageTokensUsed,` tokens)`]}):null]})}),(0,Q.jsx)(l7,{label:`总积分`,value:(h.textCreditsCost||0)+(h.creditsCost||0)})]}),h.genType===`video`?h.duration||h.aspectRatio||h.resolution?(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(l7,{label:`时长`,value:h.duration?`${h.duration}秒`:`-`}),(0,Q.jsx)(l7,{label:`比例`,value:h.aspectRatio||`-`}),(0,Q.jsx)(l7,{label:`分辨率`,value:h.resolution||`-`})]}):(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,textAlign:`center`},children:(0,Q.jsx)(xR,{color:`default`,children:`视频参数待用户配置`})}):null,h.genType===`image`?h.imageSize||h.imageProportion||h.imagePx?(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(l7,{label:`尺寸`,value:h.imagePx||`-`}),(0,Q.jsx)(l7,{label:`比例`,value:h.imageProportion||`-`}),(0,Q.jsx)(l7,{label:`分辨率`,value:h.imageSize||`-`})]}):(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,textAlign:`center`},children:(0,Q.jsx)(xR,{color:`default`,children:`图片参数待用户配置`})}):null,!h?.references||h.references.length===0?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`参考内容`}),(0,Q.jsx)(`div`,{style:{display:`flex`,gap:10,flexWrap:`wrap`},children:h.references.map((e,t)=>U(e,t))})]}),h.status===`completed`?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:h.genType===`video`?`生成视频`:`生成图片`}),h.genType===`video`?H():B()]}):null,h.status===`failed`&&h.errorMessage?(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`rgba(239,68,68,0.04)`,border:`1px solid rgba(239,68,68,0.15)`},children:(0,Q.jsxs)(Z.Text,{style:{fontSize:12,color:`#ef4444`},children:[`错误信息: `,h.errorMessage]})}):null,(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,fontSize:12,color:`#94a3b8`,flexWrap:`wrap`},children:[(0,Q.jsxs)(`span`,{children:[`创建: `,n7(h.createdAt)]}),(0,Q.jsxs)(`span`,{children:[`生成: `,n7(h.generatedAt)]})]})]}):(0,Q.jsx)(Ky,{description:`暂无详情`})}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[T&&(T.record.genType===`video`?(0,Q.jsx)(c0,{}):(0,Q.jsx)(fX,{})),T&&(T.record.genType===`video`?`生成视频`:`生成图片`)]}),open:!!T,onCancel:()=>E(null),onOk:I,okText:`提交生成`,cancelText:`取消`,confirmLoading:T?S===T.record.id:!1,width:420,children:T?(0,Q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:16},children:T.record.genType===`video`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`时长`}),(0,Q.jsxs)(Z.Text,{strong:!0,children:[T.record.duration||5,`s`]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`画面比例`}),(0,Q.jsx)(Sb,{value:T.ratio,onChange:e=>E(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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`分辨率`}),(0,Q.jsx)(Sb,{value:T.resolution,onChange:e=>E(t=>t?{...t,resolution:e}:null),style:{width:`100%`},options:[`480p`,`720p`,`1080p`].map(e=>({value:e,label:e}))})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`尺寸`}),(0,Q.jsx)(Z.Text,{strong:!0,children:T.record.imagePx||`-`})]}),(0,Q.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`比例`}),(0,Q.jsx)(Z.Text,{strong:!0,children:T.record.imageProportion||`-`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`分辨率`}),(0,Q.jsx)(Sb,{value:T.image_size,onChange:e=>E(t=>t?{...t,image_size:e}:null),style:{width:`100%`},options:[`2K`,`4K`].map(e=>({value:e,label:e}))})]})]})}):null})]})},{RangePicker:FUe}=cM,u7=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``),d7=20,f7=e=>e&&(e.name||e.modelName||e.id)||null,p7={image:`empty`,video:`empty`,videoCover:`empty`,references:{}},m7={pending:{color:`default`,text:`待处理`,icon:(0,Q.jsx)(iM,{})},generating:{color:`warning`,text:`生成中`,icon:(0,Q.jsx)(fm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,Q.jsx)(IK,{})},failed:{color:`error`,text:`失败`,icon:(0,Q.jsx)(cq,{})}},h7={timeout:`任务超时`,queued:`已入队`,preparing:`准备中`,creating_provider_task:`创建任务中`,waiting_remote:`等待生成`,result_ready:`结果就绪`,downloading:`下载中`,done:`完成`,download_failed:`下载失败`,polling:`轮询中`,failed:`失败`},g7={image:{text:`图片`,color:`purple`,icon:(0,Q.jsx)(fX,{})},video:{text:`视频`,color:`geekblue`,icon:(0,Q.jsx)($6,{})}},IUe=e=>/^(https?:)?\/\//i.test(e)||/^(blob|data):/i.test(e),_7=e=>!!e&&/^blob:/i.test(e.trim()),v7=e=>{if(!e)return``;let t=String(e).trim();return t?IUe(t)?t:u7?`${u7}${t.startsWith(`/`)?t:`/${t}`}`:t.startsWith(`/`)?t:`/${t}`:``},LUe=e=>e?e.length>12?`${e.slice(0,8)}...`:e:`-`,y7=e=>e?E5(e):`-`,RUe=e=>e==null||e===``,b7=e=>{if(!e||_7(e))return!1;try{let t=new URL(v7(e),window.location.origin),n=t.searchParams.get(`exp`)||t.searchParams.get(`expires`)||t.searchParams.get(`expire`)||t.searchParams.get(`expires_at`)||t.searchParams.get(`x-expires`);if(!n)return!1;let r=Number(n);if(!Number.isFinite(r))return!1;let i=r>1e10?r:r*1e3;return Date.now()>=i}catch{return!1}},x7=e=>e?_7(e)||b7(e)?`invalid`:`checking`:`empty`,S7=e=>{let t=e.url||e.mediaUrl||e.fileUrl;return typeof t==`string`&&t.trim()?t.trim():void 0},C7=e=>{let t=String(e.type||e.mediaType||e.mimeType||``).toLowerCase(),n=S7(e)?.toLowerCase()||``;return t.includes(`video`)||/\.(mp4|mov|webm|m4v)(\?|$)/i.test(n)?`video`:t.includes(`image`)||/\.(png|jpe?g|webp|gif|bmp|svg)(\?|$)/i.test(n)?`image`:t||`unknown`},w7=(e,t)=>`${t}-${S7(e)||`empty`}`,T7=(e,t=`资源`)=>_7(e)?`本地临时素材已失效`:b7(e)?`${t}链接已超时,请刷新列表或重新搜索后再查看`:`${t}加载失败,请刷新列表或重新搜索后再查看`,E7=({text:e,minHeight:t=240,compact:n=!1,action:r})=>(0,Q.jsxs)(`div`,{style:{width:`100%`,minHeight:n?void 0:t,height:n?`100%`:void 0,borderRadius:n?10:12,background:`#f8f9fc`,border:`1px dashed #cbd5e1`,color:`#64748b`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexDirection:`column`,gap:n?4:10,textAlign:`center`},children:[(0,Q.jsx)(Z.Text,{style:{color:`#64748b`,fontSize:n?11:13},children:e}),r]}),D7=({label:e,value:t})=>(0,Q.jsxs)(`div`,{style:{flex:1,minWidth:120},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:14},children:RUe(t)?`-`:t})]}),O7=()=>(0,QS.default)().startOf(`day`),k7=()=>(0,QS.default)().endOf(`day`),zUe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(0),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(1),[c,l]=(0,C.useState)(``),[u,d]=(0,C.useState)(``),[f,p]=(0,C.useState)(``),[m,h]=(0,C.useState)(``),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(``),[T,E]=(0,C.useState)([O7(),k7()]),[D,O]=(0,C.useState)([O7(),k7()]),[k,A]=(0,C.useState)(0),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(p7),[F,I]=(0,C.useState)(!1),L=(0,C.useRef)(null),[R,z]=(0,C.useState)(null),B=(0,C.useCallback)(async()=>{a(!0);try{let e=await MVe({genType:u||void 0,status:c||void 0,userId:v||void 0,userName:b||void 0,engineId:S||void 0,createdStart:D?.[0]?.format?.(`YYYY-MM-DDTHH:mm:ss`),createdEnd:D?.[1]?.format?.(`YYYY-MM-DDTHH:mm:ss`),page:o,pageSize:d7});t(e.items||[]),r(e.total||0)}catch(e){yP.error(e?.message||`加载创作记录失败`)}finally{a(!1)}},[u,c,o,v,b,S,D]);(0,C.useEffect)(()=>{B()},[B,k]),(0,C.useEffect)(()=>{if(!j){P(p7);return}let e=(j.mediaReferences||[]).reduce((e,t,n)=>{let r=S7(t);return e[w7(t,n)]=x7(r),e},{});L.current&&(L.current.pause(),L.current.currentTime=0),I(!1),P({image:x7(j.imageUrl),video:x7(j.videoUrl),videoCover:x7(j.videoCoverUrl),references:e})},[j]);let V=()=>{s(1),y(m.trim()),x(g.trim()),w(f),O(T),A(e=>e+1)},H=()=>{l(``),d(``),p(``),h(``),_(``),y(``),x(``),w(``);let e=[O7(),k7()];E(e),O(e),s(1),A(e=>e+1)},U=(0,C.useCallback)(e=>{M(e)},[]),W=()=>{L.current&&L.current.pause(),I(!1),M(null)},ee=e=>{P(t=>({...t,...e}))},te=(e,t)=>{P(n=>({...n,references:{...n.references,[e]:t}}))},ne=()=>{if(j?.videoUrl){if(b7(j.videoUrl)){ee({video:`invalid`}),yP.warning(`视频链接已超时,请刷新列表或重新搜索后再查看`);return}I(!0),window.setTimeout(()=>{L.current?.play().catch(()=>{I(!1),ee({video:`invalid`}),yP.warning(`视频播放失败,请确认资源链接是否仍然有效`)})},0)}},re=(e,t=`素材`)=>{if(!e){yP.warning(`${t}链接为空,暂无法查看`);return}if(_7(e)){yP.warning(`本地临时素材已失效,暂无法查看`);return}if(b7(e)){yP.warning(`${t}链接已超时,请刷新列表或重新搜索后再查看`);return}window.open(v7(e),`_blank`,`noopener,noreferrer`)},ie=(e,t,n)=>{if(_7(e)){yP.warning(`本地临时素材已失效,暂无法查看`);return}if(b7(e)){yP.warning(`链接已超时,请刷新列表或重新搜索后再查看`);return}z({url:v7(e),type:t,title:n})},ae=()=>z(null),G=(0,C.useMemo)(()=>[{title:`用户`,key:`user`,width:150,render:(e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:13},children:t.userName||`未知用户`}),(0,Q.jsx)(`div`,{style:{fontSize:11,color:`#94a3b8`},children:LUe(t.userId)})]})},{title:`类型`,dataIndex:`genType`,width:90,render:e=>{let t=g7[e]||{text:e||`-`,color:`default`,icon:null};return(0,Q.jsx)(xR,{color:t.color,icon:t.icon,children:t.text})}},{title:`引擎`,key:`engine`,width:160,render:(e,t)=>{let n=f7(t.engineSnapshot);return(0,Q.jsx)(fx,{title:t.engineId||`未知引擎`,placement:`topLeft`,children:(0,Q.jsx)(xR,{icon:(0,Q.jsx)(k2,{}),color:`cyan`,children:n||t.engineId||`-`})})}},{title:`附件`,key:`references`,width:100,render:(e,t)=>{let n=t.mediaReferences||[];return n.length===0?(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`},children:`无`}):(0,Q.jsx)(OM,{size:2,wrap:!0,children:n.map((e,t)=>{let n=S7(e),r=C7(e),i=typeof e.name==`string`&&e.name?e.name:`附件 ${t+1}`;return n?(0,Q.jsx)(fx,{title:i,children:(0,Q.jsx)(XS,{size:`small`,type:`text`,icon:r===`video`?(0,Q.jsx)($6,{style:{color:`#6366f1`}}):r===`audio`?(0,Q.jsx)(JH,{style:{color:`#f59e0b`}}):(0,Q.jsx)(fX,{style:{color:`#8b5cf6`}}),style:{width:28,height:28,padding:0},onClick:e=>{e.stopPropagation(),ie(n,r===`video`?`video`:`image`,i)}})},t):null})})}},{title:`结果`,key:`result`,width:90,render:(e,t)=>t.status===`completed`?t.genType===`video`&&t.videoUrl?(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(c0,{}),type:`link`,style:{padding:0},onClick:e=>{e.stopPropagation(),ie(t.videoUrl,`video`,`生成视频`)},children:`看视频`}):t.genType===`image`&&t.imageUrl?(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(fX,{}),type:`link`,style:{padding:0},onClick:e=>{e.stopPropagation(),ie(t.imageUrl,`image`,`生成图片`)},children:`看图片`}):(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`},children:`无`}):(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`},children:`-`})},{title:`提示词`,key:`prompt`,ellipsis:!0,render:(e,t)=>(0,Q.jsx)(fx,{title:t.originalPrompt,placement:`topLeft`,children:(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#475569`},ellipsis:!0,children:t.originalPrompt||`-`})})},{title:`参数`,key:`params`,width:180,render:(e,t)=>t.genType===`video`?t.duration||t.aspectRatio||t.resolution?(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[t.duration?(0,Q.jsxs)(xR,{children:[t.duration,`s`]}):null,t.aspectRatio?(0,Q.jsx)(xR,{children:t.aspectRatio}):null,t.resolution?(0,Q.jsx)(xR,{children:t.resolution}):null]}):(0,Q.jsx)(xR,{color:`default`,children:`无参数`}):t.imageSize||t.imageProportion||t.imagePx?(0,Q.jsxs)(OM,{size:4,wrap:!0,children:[t.imageSize?(0,Q.jsx)(xR,{children:t.imageSize}):null,t.imageProportion?(0,Q.jsx)(xR,{children:t.imageProportion}):null,t.imagePx?(0,Q.jsx)(xR,{children:t.imagePx}):null]}):(0,Q.jsx)(xR,{color:`default`,children:`无参数`})},{title:`积分`,key:`credits`,width:130,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{fontSize:12},children:[(0,Q.jsxs)(`div`,{style:{color:`#6366f1`},children:[`总: `,t.creditsCost||0]}),t.textCreditsCost>0?(0,Q.jsxs)(`div`,{style:{color:`#f59e0b`},children:[`文字: `,t.textCreditsCost]}):null]})},{title:`状态`,dataIndex:`status`,width:100,render:e=>{let t=m7[e]||{color:`default`,text:e||`-`,icon:null};return(0,Q.jsx)(xR,{color:t.color,icon:t.icon,children:t.text})}},{title:`阶段`,dataIndex:`pipelineStage`,width:120,render:e=>(0,Q.jsx)(xR,{color:`blue`,children:h7[e]||e||`-`})},{title:`时间`,key:`time`,width:170,render:(e,t)=>(0,Q.jsxs)(`div`,{style:{fontSize:12,color:`#94a3b8`},children:[(0,Q.jsx)(`div`,{children:y7(t.createdAt)}),t.generatedAt?(0,Q.jsxs)(`div`,{style:{color:`#10b981`},children:[`生成: `,y7(t.generatedAt)]}):null]})},{title:`操作`,key:`action`,width:90,fixed:`right`,render:(e,t)=>(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(ON,{}),onClick:()=>U(t),children:`详情`})}],[U]),oe=j?g7[j.genType]||{text:j.genType||`-`,color:`default`,icon:null}:null,K=j?m7[j.status]||{color:`default`,text:j.status||`-`,icon:null}:null,se=()=>{if(!j||j.genType!==`image`||j.status!==`completed`)return null;if(!j.imageUrl)return(0,Q.jsx)(E7,{text:`此图片任务暂无结果图片`,minHeight:260});if(N.image===`invalid`)return(0,Q.jsx)(E7,{text:T7(j.imageUrl,`图片`),minHeight:260});let e=v7(j.imageUrl);return(0,Q.jsxs)(`div`,{style:{position:`relative`,width:`100%`,minHeight:260,borderRadius:12,background:`#f8f9fc`,border:`1px solid #e2e8f0`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,Q.jsx)(`img`,{src:e,alt:`生成图片`,onLoad:()=>ee({image:`valid`}),onError:()=>ee({image:`invalid`}),style:{display:N.image===`valid`?`block`:`none`,width:`100%`,maxHeight:560,objectFit:`contain`,background:`#fff`}},`${j.id}-${e}`),N.image===`checking`?(0,Q.jsx)(E7,{text:`图片加载检测中...`,minHeight:260}):null]})},ce=()=>{if(!j||F||N.video===`invalid`)return null;let e=j.videoUrl?(0,Q.jsx)(XS,{type:`primary`,shape:`circle`,size:`large`,icon:(0,Q.jsx)(c0,{}),onClick:ne,style:{boxShadow:`0 8px 20px rgba(15,23,42,0.25)`}}):null;if(!j.videoCoverUrl)return(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:12,overflow:`hidden`,background:`#f8f9fc`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,Q.jsx)(E7,{text:`此视频无封面`,minHeight:340,action:e})});if(N.videoCover===`invalid`)return(0,Q.jsx)(E7,{text:T7(j.videoCoverUrl,`视频封面`),minHeight:340,action:e});let t=v7(j.videoCoverUrl);return(0,Q.jsxs)(`div`,{style:{position:`absolute`,inset:0,borderRadius:12,overflow:`hidden`,background:`#f8f9fc`,border:`1px solid #e2e8f0`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,Q.jsx)(`img`,{src:t,alt:`视频封面`,onLoad:()=>ee({videoCover:`valid`}),onError:()=>ee({videoCover:`invalid`}),style:{display:N.videoCover===`valid`?`block`:`none`,width:`100%`,height:`100%`,objectFit:`contain`,background:`#000`}},`${j.id}-cover-${t}`),N.videoCover===`checking`?(0,Q.jsx)(E7,{text:`视频封面加载检测中...`,minHeight:340,action:e}):null,N.videoCover===`valid`?(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(15,23,42,0.18)`},children:e}):null]})},le=()=>{if(!j||j.genType!==`video`||j.status!==`completed`)return null;if(!j.videoUrl)return(0,Q.jsx)(E7,{text:`此视频任务暂无结果视频`,minHeight:340});if(N.video===`invalid`)return(0,Q.jsx)(E7,{text:T7(j.videoUrl,`视频`),minHeight:340});let e=v7(j.videoUrl);return(0,Q.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:340,borderRadius:12,background:`#000`,overflow:`hidden`,border:`1px solid #e2e8f0`},children:[(0,Q.jsx)(`video`,{ref:L,src:e,preload:`metadata`,controls:F,onLoadedMetadata:()=>ee({video:`valid`}),onCanPlay:()=>ee({video:`valid`}),onPlaying:()=>{I(!0),ee({video:`valid`})},onPause:()=>I(!1),onEnded:()=>I(!1),onError:()=>{I(!1),ee({video:`invalid`})},style:{width:`100%`,height:`100%`,objectFit:`contain`,background:`#000`,opacity:+!!F,pointerEvents:F?`auto`:`none`}},`${j.id}-${e}`),ce()]})},ue=(e,t)=>{let n=S7(e),r=C7(e),i=w7(e,t),a=N.references[i]||x7(n),o=r===`image`,s=r===`video`,c=typeof e.name==`string`&&e.name?e.name:`参考素材 ${t+1}`;if(!n)return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsx)(`div`,{style:{width:94,height:94},children:(0,Q.jsx)(E7,{text:`无链接`,compact:!0})}),(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})]},i);if(a===`invalid`)return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsx)(`div`,{style:{width:94,height:94},children:(0,Q.jsx)(E7,{text:_7(n)?`本地临时素材已失效`:`素材不可访问`,compact:!0})}),(0,Q.jsx)(fx,{title:c,children:(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})})]},i);let l=v7(n);return(0,Q.jsxs)(`div`,{style:{width:94},children:[(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,title:`点击新页面查看素材`,onClick:()=>re(n,s?`视频素材`:o?`图片素材`:`素材`),onKeyDown:e=>{e.key===`Enter`&&re(n,s?`视频素材`:o?`图片素材`:`素材`)},style:{width:94,height:94,borderRadius:10,overflow:`hidden`,border:`1px solid #e2e8f0`,background:`#f8f9fc`,position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`},children:[o?(0,Q.jsx)(`img`,{src:l,alt:c,onLoad:()=>te(i,`valid`),onError:()=>te(i,`invalid`),style:{display:a===`valid`?`block`:`none`,width:`100%`,height:`100%`,objectFit:`cover`}}):null,s?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`video`,{src:l,preload:`metadata`,onLoadedMetadata:()=>te(i,`valid`),onError:()=>te(i,`invalid`),style:{display:`none`}}),(0,Q.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12,textAlign:`center`},children:[(0,Q.jsx)(c0,{style:{fontSize:18}}),(0,Q.jsx)(`div`,{children:`视频素材`}),(0,Q.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,marginTop:2},children:`点击查看`})]})]}):null,!o&&!s?(0,Q.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12,textAlign:`center`},children:[`文件素材`,(0,Q.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,marginTop:2},children:`点击查看`})]}):null,a===`checking`&&o?(0,Q.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#f8f9fc`},children:(0,Q.jsx)(fm,{style:{color:`#6366f1`}})}):null]}),(0,Q.jsx)(fx,{title:c,children:(0,Q.jsx)(Z.Text,{ellipsis:!0,style:{display:`block`,marginTop:4,fontSize:11,color:`#94a3b8`},children:c})})]},i)};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16,flexWrap:`wrap`,gap:12},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(c0,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`创作记录管理`}),(0,Q.jsxs)(xR,{color:`purple`,children:[n,` 条记录`]})]}),(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`状态筛选`,value:c||void 0,style:{width:140},onChange:e=>{l(e||``),s(1)},options:[{value:`generating`,label:`生成中`},{value:`completed`,label:`已完成`},{value:`failed`,label:`失败`}]}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`类型筛选`,value:u||void 0,style:{width:120},onChange:e=>{d(e||``),s(1)},options:[{value:`image`,label:`图片`},{value:`video`,label:`视频`}]}),(0,Q.jsx)(Sb,{allowClear:!0,showSearch:!0,placeholder:`引擎筛选`,value:f||void 0,style:{width:180},onChange:e=>{p(e||``),s(1),w(e||``)},optionFilterProp:`label`,options:Array.from(new Map(e.filter(e=>e.engineId).map(e=>[e.engineId,{value:e.engineId,label:f7(e.engineSnapshot)||e.engineId}])).values())}),(0,Q.jsx)(FUe,{value:T,onChange:e=>{e&&e[0]&&e[1]?E([e[0].startOf(`day`),e[1].endOf(`day`)]):E(e)},placeholder:[`开始日期`,`结束日期`]}),(0,Q.jsx)(LN,{placeholder:`用户ID搜索`,prefix:(0,Q.jsx)(_b,{style:{color:`#94a3b8`}}),style:{width:150},value:m,onChange:e=>h(e.target.value),onPressEnter:V,allowClear:!0}),(0,Q.jsx)(LN,{placeholder:`用户名搜索`,prefix:(0,Q.jsx)(_b,{style:{color:`#94a3b8`}}),style:{width:150},value:g,onChange:e=>_(e.target.value),onPressEnter:V,allowClear:!0}),(0,Q.jsx)(XS,{type:`primary`,onClick:V,style:{borderRadius:8},children:`搜索`}),(0,Q.jsx)(XS,{onClick:H,style:{borderRadius:8},children:`重置`})]})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:i,columns:G,dataSource:e,scroll:{x:1650},pagination:{current:o,pageSize:d7,total:n,showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:e=>s(e)}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[j?.genType===`video`?(0,Q.jsx)($6,{}):(0,Q.jsx)(fX,{}),(0,Q.jsx)(`span`,{children:`创作记录详情`})]}),open:!!j,onCancel:W,footer:null,width:900,destroyOnClose:!0,children:j?(0,Q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:12},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:[oe?(0,Q.jsx)(xR,{color:oe.color,icon:oe.icon,children:oe.text}):null,K?(0,Q.jsx)(xR,{color:K.color,icon:K.icon,children:K.text}):null,j.pipelineStage?(0,Q.jsx)(xR,{color:`blue`,children:h7[j.pipelineStage]||j.pipelineStage}):null]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`用户名称`,value:j.userName||`未知用户`}),(0,Q.jsx)(D7,{label:`用户ID`,value:j.userId||`-`}),(0,Q.jsx)(D7,{label:`任务ID`,value:j.id})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`原始提示词`}),(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,lineHeight:1.6},children:j.originalPrompt||`-`})]}),j.genType===`video`?(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`时长`,value:j.duration?`${j.duration}秒`:`-`}),(0,Q.jsx)(D7,{label:`画面比例`,value:j.aspectRatio||`-`}),(0,Q.jsx)(D7,{label:`分辨率`,value:j.resolution||`-`})]}):(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`图片档位`,value:j.imageSize||`-`}),(0,Q.jsx)(D7,{label:`图片比例`,value:j.imageProportion||`-`}),(0,Q.jsx)(D7,{label:`像素尺寸`,value:j.imagePx||`-`})]}),j.engineSnapshot?(0,Q.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`引擎快照`}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`引擎名称`,value:j.engineSnapshot.name||`-`}),(0,Q.jsx)(D7,{label:`服务商`,value:j.engineSnapshot.provider||`-`}),(0,Q.jsx)(D7,{label:`模型`,value:j.engineSnapshot.modelName||`-`}),(0,Q.jsx)(D7,{label:`引擎ID`,value:j.engineSnapshot.id||j.engineId||`-`})]})]}):null,(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`总积分`,value:(0,Q.jsx)(Z.Text,{strong:!0,style:{color:`#6366f1`},children:j.creditsCost||0})}),(0,Q.jsx)(D7,{label:`文字积分`,value:`${j.textCreditsCost||0} (${j.textTokensUsed||0} tokens)`}),(0,Q.jsx)(D7,{label:`图片 tokens`,value:j.imageTokensUsed??0}),(0,Q.jsx)(D7,{label:`视频 tokens`,value:j.videoTokensUsed??0})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:12,borderRadius:10,background:`#f8f9fc`,flexWrap:`wrap`},children:[(0,Q.jsx)(D7,{label:`第三方任务ID`,value:j.providerTaskId||j.seedanceTaskId||`-`}),(0,Q.jsx)(D7,{label:`轮询次数`,value:j.pollCount??0}),(0,Q.jsx)(D7,{label:`重试次数`,value:j.retryCount??0})]}),!j?.mediaReferences||j.mediaReferences.length===0?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`参考内容`}),(0,Q.jsx)(`div`,{style:{display:`flex`,gap:10,flexWrap:`wrap`},children:j.mediaReferences.map((e,t)=>ue(e,t))})]}),j.mediaReferences&&j.mediaReferences.length>0?(0,Q.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`附件快速查看(点击新窗口打开)`}),(0,Q.jsx)(OM,{size:8,wrap:!0,children:j.mediaReferences.map((e,t)=>{let n=S7(e),r=C7(e),i=typeof e.name==`string`&&e.name?e.name:`附件 ${t+1}`;return n?(0,Q.jsx)(XS,{size:`small`,icon:r===`video`?(0,Q.jsx)(c0,{}):(0,Q.jsx)(g$,{}),onClick:()=>ie(n,r===`video`?`video`:`image`,i),children:i},t):null})})]}):null,j.status===`completed`?(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:6},children:[(0,Q.jsx)(Z.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`},children:j.genType===`video`?`生成视频`:`生成图片`}),j.genType===`video`&&j.videoUrl?(0,Q.jsx)(XS,{size:`small`,type:`link`,icon:(0,Q.jsx)(c0,{}),onClick:()=>ie(j.videoUrl,`video`,`生成视频`),style:{padding:0},children:`弹窗播放`}):null,j.genType===`image`&&j.imageUrl?(0,Q.jsx)(XS,{size:`small`,type:`link`,icon:(0,Q.jsx)(fX,{}),onClick:()=>ie(j.imageUrl,`image`,`生成图片`),style:{padding:0},children:`弹窗查看`}):null]}),j.genType===`video`?le():se()]}):null,j.status===`failed`&&j.errorMessage?(0,Q.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`rgba(239,68,68,0.04)`,border:`1px solid rgba(239,68,68,0.15)`},children:(0,Q.jsxs)(Z.Text,{style:{fontSize:12,color:`#ef4444`},children:[`错误信息: `,j.errorMessage]})}):null,(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:16,fontSize:12,color:`#94a3b8`,flexWrap:`wrap`},children:[(0,Q.jsxs)(`span`,{children:[`创建: `,y7(j.createdAt)]}),(0,Q.jsxs)(`span`,{children:[`生成: `,y7(j.generatedAt)]})]})]}):(0,Q.jsx)(Ky,{description:`暂无详情`})}),(0,Q.jsx)(xP,{title:R?.title||`资源预览`,open:!!R,onCancel:ae,footer:null,width:R?.type===`video`?800:600,destroyOnHidden:!0,children:R?R.type===`video`?(0,Q.jsx)(`video`,{src:R.url,controls:!0,autoPlay:!0,style:{width:`100%`,maxHeight:600,background:`#000`,borderRadius:8}},R.url):(0,Q.jsx)(`img`,{src:R.url,alt:R.title,style:{width:`100%`,maxHeight:600,objectFit:`contain`,borderRadius:8}}):null})]})},A7=20,BUe=[{value:`pending`,label:`已创建`},{value:`waiting_user`,label:`等待用户操作`},{value:`processing`,label:`处理中`},{value:`completed`,label:`已完成`},{value:`failed`,label:`失败`},{value:`cancelled`,label:`已取消`}],VUe={pending:{color:`default`,text:`已创建`},waiting_user:{color:`processing`,text:`等待用户操作`},processing:{color:`warning`,text:`处理中`},completed:{color:`success`,text:`已完成`},failed:{color:`error`,text:`失败`},cancelled:{color:`default`,text:`已取消`}},HUe={material_input:`素材输入`,image_prompt_optimize:`图片 AI 提词`,image_generate:`图片生成`,video_prompt_optimize:`视频 AI 提词`,video_generate:`视频生成`},j7=e=>e?E5(e):`-`,M7=e=>e?e.length>16?`${e.slice(0,10)}...`:e:`-`,UUe=({status:e})=>{if(!e)return(0,Q.jsx)(xR,{children:`-`});let t=VUe[e]||{color:`blue`,text:e};return(0,Q.jsx)(xR,{color:t.color,children:t.text})},WUe=()=>{let e=Ze(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)(0),[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(1),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(null),[y,b]=(0,C.useState)(``),[x,S]=(0,C.useState)(``),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(0),A=(0,C.useCallback)(async()=>{o(!0);try{let e=await NVe({status:l||void 0,keyword:y||void 0,userId:x||void 0,userName:w||void 0,createdStart:E?.[0]?.toISOString?.(),createdEnd:E?.[1]?.toISOString?.(),page:s,pageSize:A7});n(e.items||[]),i(e.total||0)}catch(e){yP.error(e?.message||`加载爆款开头复刻任务失败`)}finally{o(!1)}},[s,E,y,x,w,l]);(0,C.useEffect)(()=>{A()},[A,O]);let j=()=>{b(d.trim()),S(p.trim()),T(h.trim()),D(_),c(1)};return(0,Q.jsx)(`div`,{style:{padding:24},children:(0,Q.jsx)(NA,{children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(OM,{align:`center`,style:{justifyContent:`space-between`,width:`100%`},children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Title,{level:3,style:{marginBottom:4},children:`爆款开头复刻`}),(0,Q.jsx)(Z.Text,{type:`secondary`,children:`只读排查页面:查看任务列表、素材、步骤详情和生成结果。`})]}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>k(e=>e+1),children:`刷新`})]}),(0,Q.jsxs)(OM,{wrap:!0,children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`任务状态`,style:{width:160},value:l||void 0,onChange:e=>{u(e||``),c(1)},options:BUe}),(0,Q.jsx)(LN,{allowClear:!0,prefix:(0,Q.jsx)(_b,{}),placeholder:`关键词:标题/项目名/核心点`,style:{width:260},value:d,onChange:e=>f(e.target.value),onPressEnter:j}),(0,Q.jsx)(LN,{allowClear:!0,placeholder:`用户ID(管理员)`,style:{width:190},value:p,onChange:e=>m(e.target.value),onPressEnter:j}),(0,Q.jsx)(LN,{allowClear:!0,placeholder:`用户名(管理员)`,style:{width:230},value:h,onChange:e=>g(e.target.value),onPressEnter:j}),(0,Q.jsx)(cM.RangePicker,{showTime:!0,value:_,onChange:v,placeholder:[`创建开始`,`创建结束`]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(_b,{}),onClick:j,children:`搜索`}),(0,Q.jsx)(XS,{onClick:()=>{u(``),f(``),m(``),g(``),v(null),b(``),S(``),T(``),D(null),c(1),k(e=>e+1)},children:`重置`})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:a,dataSource:t,pagination:{current:s,pageSize:A7,total:r,showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:c},scroll:{x:1380},columns:[{title:`项目ID`,dataIndex:`id`,width:150,render:e=>(0,Q.jsx)(fx,{title:e,children:M7(e)})},{title:`用户`,width:180,render:(e,t)=>(0,Q.jsxs)(OM,{direction:`vertical`,size:0,children:[(0,Q.jsx)(Z.Text,{children:t.userName||`-`}),(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12},children:M7(t.userId)})]})},{title:`项目信息`,width:260,render:(e,t)=>(0,Q.jsxs)(OM,{direction:`vertical`,size:2,children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.title||t.targetProjectName||`-`}),(0,Q.jsxs)(Z.Text,{type:`secondary`,ellipsis:!0,style:{maxWidth:240},children:[`素材:`,t.sourceProjectName||`-`]}),(0,Q.jsxs)(Z.Text,{type:`secondary`,ellipsis:!0,style:{maxWidth:240},children:[`核心:`,t.coreContentPoint||`-`]})]})},{title:`状态`,dataIndex:`status`,width:130,render:e=>(0,Q.jsx)(UUe,{status:e})},{title:`当前步骤`,dataIndex:`currentStepCode`,width:140,render:e=>HUe[e]||e||`-`},{title:`图片结果`,dataIndex:`finalImageUrl`,width:90,render:e=>e?(0,Q.jsx)(xR,{color:`success`,children:`有`}):(0,Q.jsx)(xR,{children:`无`})},{title:`视频结果`,dataIndex:`finalVideoUrl`,width:90,render:e=>e?(0,Q.jsx)(xR,{color:`success`,children:`有`}):(0,Q.jsx)(xR,{children:`无`})},{title:`错误信息`,dataIndex:`errorMessage`,width:220,ellipsis:!0,render:e=>e||`-`},{title:`创建时间`,dataIndex:`createdAt`,width:170,render:j7},{title:`更新时间`,dataIndex:`updatedAt`,width:170,render:j7},{title:`操作`,fixed:`right`,width:110,render:(t,n)=>(0,Q.jsx)(XS,{type:`link`,icon:(0,Q.jsx)(ON,{}),onClick:()=>e(`/hot-opening-replications/${n.id}`),children:`详情`})}]})]})})})},N7=({value:e,maxHeight:t=420})=>e==null||e===``?(0,Q.jsx)(Ky,{image:Ky.PRESENTED_IMAGE_SIMPLE,description:`暂无 JSON 数据`}):(0,Q.jsx)(`pre`,{style:{margin:0,padding:12,maxHeight:t,overflow:`auto`,background:`#0f172a`,color:`#e2e8f0`,borderRadius:8,fontSize:12,lineHeight:1.6},children:JSON.stringify(e,null,2)}),GUe=({input:e,output:t,raw:n,inputLabel:r=`查看 input_json`,outputLabel:i=`查看 output_json`,rawLabel:a=`查看原始 JSON`})=>{let o=[];return e!==void 0&&o.push({key:`input`,label:r,children:(0,Q.jsx)(N7,{value:e})}),t!==void 0&&o.push({key:`output`,label:i,children:(0,Q.jsx)(N7,{value:t})}),n!==void 0&&o.push({key:`raw`,label:a,children:(0,Q.jsx)(N7,{value:n})}),o.length?(0,Q.jsx)(Hh,{size:`small`,style:{marginTop:12},items:o}):null},KUe=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``);function qUe(e){if(!e)return``;let t=String(e).trim();return t?/^(https?:)?\/\//i.test(t)||/^(blob|data):/i.test(t)?t:`${KUe}${t.startsWith(`/`)?t:`/${t}`}`:``}var P7=({url:e,type:t,height:n=260,emptyDescription:r=`暂无资源`,errorDescription:i=`资源加载失败,可能文件不存在、签名过期或访问权限受限。`})=>{let a=(0,C.useMemo)(()=>qUe(e),[e]),[o,s]=(0,C.useState)(!1);(0,C.useEffect)(()=>{s(!1)},[a]);let c=a?(0,Q.jsxs)(OM,{wrap:!0,style:{marginTop:8},children:[(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(XR,{}),onClick:async()=>{if(a)try{await navigator.clipboard.writeText(a),yP.success(`资源地址已复制`)}catch{yP.error(`复制失败,请手动复制`)}},children:`复制地址`}),(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(g$,{}),onClick:()=>window.open(a,`_blank`,`noopener,noreferrer`),children:`新窗口打开`}),(0,Q.jsx)(Z.Text,{copyable:{text:a},type:`secondary`,style:{maxWidth:460},ellipsis:!0,children:a})]}):null;return a?(0,Q.jsxs)(`div`,{children:[o?(0,Q.jsx)(cf,{type:`warning`,showIcon:!0,message:`资源预览失败`,description:i,style:{marginBottom:8}}):null,t===`image`?(0,Q.jsx)(CN,{src:a,onError:()=>s(!0),style:{width:`100%`,maxHeight:n,objectFit:`contain`,borderRadius:12,background:`#f8fafc`,border:`1px solid #f1f5f9`},fallback:``,preview:!o}):(0,Q.jsx)(`video`,{src:a,controls:!0,preload:`metadata`,onError:()=>s(!0),style:{width:`100%`,maxHeight:n,borderRadius:12,background:`#0f172a`,border:`1px solid #f1f5f9`}}),c]}):(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`div`,{style:{height:n,borderRadius:12,border:`1px dashed #cbd5e1`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#f8fafc`},children:(0,Q.jsx)(Ky,{image:Ky.PRESENTED_IMAGE_SIMPLE,description:r})})})},F7={pending:{text:`待处理`,color:`default`},waiting_user:{text:`等待用户操作`,color:`processing`},processing:{text:`处理中`,color:`warning`},completed:{text:`已完成`,color:`success`},failed:{text:`失败`,color:`error`},cancelled:{text:`已取消`,color:`default`},canceled:{text:`已取消`,color:`default`},timeout:{text:`已超时`,color:`error`},queued:{text:`已入队`,color:`processing`},preparing:{text:`准备中`,color:`processing`},creating_provider_task:{text:`创建远端任务`,color:`processing`},waiting_remote:{text:`等待远端结果`,color:`processing`},polling:{text:`轮询远端结果`,color:`processing`},result_ready:{text:`结果已就绪`,color:`success`},downloading:{text:`下载中`,color:`processing`},done:{text:`已完成`,color:`success`},download_failed:{text:`下载失败`,color:`error`},retry_waiting:{text:`等待重试`,color:`orange`},pending_analysis:{text:`等待分析`,color:`default`},analyzing:{text:`分析中`,color:`processing`},analysis_completed:{text:`分析完成`,color:`success`},analysis_failed:{text:`分析失败`,color:`error`},splitting:{text:`拆镜中`,color:`warning`},split_completed:{text:`拆镜完成`,color:`success`},partial_failed:{text:`部分失败`,color:`orange`},none:{text:`未拆镜`,color:`default`},not_required:{text:`无需处理`,color:`default`},not_started:{text:`未开始`,color:`default`},project_created:{text:`已创建项目`,color:`processing`},true:{text:`是`,color:`success`},false:{text:`否`,color:`default`}},I7={material_input:`素材输入`,image_prompt_optimize:`图片 AI 提词`,image_generate:`图片生成`,video_prompt_optimize:`视频 AI 提词`,video_generate:`视频生成`},L7={hot_opening_replicate:`爆款开头复刻`,shot_replicate:`拆镜复刻`},R7={ai_suggestion:{text:`AI 建议`,color:`purple`},custom:{text:`自定义`,color:`cyan`},original:{text:`原视频`,color:`blue`}};function z7(e){return e?L7[e]||e:`-`}function B7(e){return e?I7[e]||e:`-`}function JUe(e){return e?F7[e]?.text||I7[e]||L7[e]||R7[e]?.text||e:`-`}function YUe(e){return e?F7[e]?.color||R7[e]?.color||`blue`:`default`}var V7=({status:e,tooltipRaw:t=!0})=>{if(e==null||e===``)return(0,Q.jsx)(xR,{children:`-`});let n=String(e),r=JUe(n),i=(0,Q.jsx)(xR,{color:YUe(n),children:r});return!t||r===n?i:(0,Q.jsx)(fx,{title:n,children:i})};function H7(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function U7(e,...t){for(let n of t){let t=e[n];if(t!=null&&String(t).trim()!==``)return String(t)}return``}function W7(e,t,...n){for(let t of n){let n=e[t];if(n===!0||n===!1)return n;if(n===`true`)return!0;if(n===`false`)return!1}return t}function XUe(e,...t){for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t)&&t>0)return t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e)&&e>0)return e}}}function G7(e){if(!H7(e))return null;let t=U7(e,`key`);return t?{key:t,label:U7(e,`label`)||t,type:U7(e,`type`)||void 0,enabled:W7(e,!0,`enabled`),editable:W7(e,!0,`editable`),maxLength:XUe(e,`maxLength`,`max_length`)}:null}function K7(e){if(!H7(e))return null;let t=e.data;return H7(t)?t:Array.isArray(e.sections)?e:null}function ZUe(e){return!!K7(e)}function QUe(e){let t=K7(e);return(Array.isArray(t?.sections)?t.sections:[]).map(e=>{let t=G7(e);if(!t||!H7(e))return null;let n=Array.isArray(e.children)?e.children.map(G7).filter(Boolean):[],r=Array.isArray(e.itemFields)?e.itemFields.map(G7).filter(Boolean):Array.isArray(e.item_fields)?e.item_fields.map(G7).filter(Boolean):[];return{...t,contentKey:U7(e,`contentKey`,`content_key`)||void 0,children:n,itemFields:r}}).filter(e=>!!e&&e.enabled)}function $Ue(e){return H7(e)?Object.entries(e).filter(([e])=>![`schemaVersion`,`schemaUsage`,`schema_version`,`schema_usage`].includes(e)).map(([e,t])=>Array.isArray(t)&&t.every(H7)?{key:e,label:e,type:`flow`,enabled:!0,editable:!1,itemFields:Array.from(new Set(t.flatMap(e=>Object.keys(e)))).filter(e=>e!==`时间段`).map(e=>({key:e,label:e,enabled:!0,editable:!1})),children:[]}:H7(t)?{key:e,label:e,type:`object`,enabled:!0,editable:!1,children:Object.keys(t).map(e=>({key:e,label:e,enabled:!0,editable:!1})),itemFields:[]}:{key:e,label:e,type:`text`,enabled:!0,editable:!1,children:[],itemFields:[]}):[]}var q7=e=>!!e&&typeof e==`object`&&!Array.isArray(e),J7=e=>typeof e==`string`&&e.length>80,Y7=e=>e==null||e===``?(0,Q.jsx)(Z.Text,{type:`secondary`,children:`-`}):typeof e==`boolean`?e?`是`:`否`:typeof e==`number`?e:typeof e==`string`?(0,Q.jsx)(Z.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:e}):(0,Q.jsx)(N7,{value:e,maxHeight:220}),X7=e=>e?(0,Q.jsx)(xR,{color:`processing`,children:`可编辑`}):(0,Q.jsx)(xR,{color:`default`,children:`只读`}),Z7=(e,t)=>e[t],eWe=(e,t)=>{let n=Z7(e,t.key);if(!q7(n))return(0,Q.jsx)(N7,{value:n??{},maxHeight:220});let r=t.children.filter(e=>e.enabled);return r.length?(0,Q.jsx)(fM,{size:`small`,column:2,bordered:!0,children:r.map(e=>(0,Q.jsx)(fM.Item,{label:(0,Q.jsxs)(OM,{size:4,children:[e.label,X7(e.editable)]}),span:J7(n[e.key])||q7(n[e.key])||Array.isArray(n[e.key])?2:1,children:Y7(n[e.key])},e.key))}):(0,Q.jsx)(N7,{value:n,maxHeight:220})},tWe=(e,t)=>{let n=e.itemFields.filter(e=>e.enabled);return n.length?[{key:`时间段`,label:`时间段`,enabled:!0,editable:!1},...n]:Array.from(new Set(t.flatMap(e=>Object.keys(e)))).map(e=>({key:e,label:e,enabled:!0,editable:!1}))},nWe=(e,t)=>{let n=Z7(e,t.key);if(!Array.isArray(n)||!n.every(q7))return(0,Q.jsx)(N7,{value:n??[],maxHeight:260});let r=n,i=tWe(t,r);return(0,Q.jsx)(cR,{size:`small`,rowKey:(e,n)=>`${t.key}-${n}`,columns:i.map(e=>({title:(0,Q.jsxs)(OM,{size:4,children:[e.label,X7(e.editable)]}),dataIndex:e.key,key:e.key,width:J7(r.find(t=>t[e.key])?.[e.key])?320:160,render:e=>Y7(e)})),dataSource:r,pagination:!1,scroll:{x:Math.max(900,i.length*180)},tableLayout:`fixed`})},rWe=(e,t)=>Y7(Z7(e,t.key)),iWe=({schema:e,finalPrompt:t,schemaConfigSnapshot:n,schemaConfigSource:r,schemaConfigVersion:i,schemaConfigIsFallback:a})=>{let o=!!e&&Object.keys(e).length>0;if(!o&&!t)return(0,Q.jsx)(Ky,{description:`暂无视频提词 schema`});let s=o?e:{},c=ZUe(n),l=(c?QUe(n):$Ue(s)).filter(e=>e.key in s).map(e=>({key:e.key,label:(0,Q.jsxs)(OM,{size:8,wrap:!0,children:[(0,Q.jsx)(`span`,{children:e.label}),X7(e.editable),c?null:(0,Q.jsx)(xR,{color:`warning`,children:`管理后台兜底展示`})]}),children:e.type===`object`?eWe(s,e):e.type===`flow`?nWe(s,e):rWe(s,e)}));return(0,Q.jsxs)(OM,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Q.jsx)(NA,{size:`small`,title:`Schema 配置来源`,children:(0,Q.jsxs)(fM,{size:`small`,column:3,bordered:!0,children:[(0,Q.jsx)(fM.Item,{label:`来源`,children:r||n?.source||(c?`-`:`viewer_fallback`)}),(0,Q.jsx)(fM.Item,{label:`版本`,children:i||n?.version||`-`}),(0,Q.jsx)(fM.Item,{label:`历史兜底`,children:a||!c?(0,Q.jsx)(xR,{color:`warning`,children:`是`}):(0,Q.jsx)(xR,{color:`success`,children:`否`})})]})}),t?(0,Q.jsx)(NA,{size:`small`,title:`最终视频提示词`,children:(0,Q.jsx)(Z.Paragraph,{style:{whiteSpace:`pre-wrap`,marginBottom:0},children:t})}):null,l.length?(0,Q.jsx)(Hh,{size:`small`,items:l}):o?(0,Q.jsx)(NA,{size:`small`,title:`视频提词 Schema`,children:(0,Q.jsx)(N7,{value:s,maxHeight:360})}):null,o?(0,Q.jsx)(Hh,{size:`small`,items:[{key:`raw_schema`,label:`原始 JSON / 历史脏字段排查`,children:(0,Q.jsx)(N7,{value:s,maxHeight:420})}]}):null]})},aWe=[`material_input`,`image_prompt_optimize`,`image_generate`,`video_prompt_optimize`,`video_generate`],oWe={material_input:`参考素材、项目名称和核心内容点`,image_prompt_optimize:`图片 AI 提词优化结果`,image_generate:`图片引擎、生成参数和结果图`,video_prompt_optimize:`视频 JSON schema、动作流程和最终提词`,video_generate:`视频引擎、生成参数、封面和结果视频`},Q7=e=>e?E5(e):`-`,$7=e=>e?e.length>18?`${e.slice(0,10)}...${e.slice(-4)}`:e:`-`,sWe=({text:e=`-`})=>(0,Q.jsx)(Z.Text,{type:`secondary`,children:e}),e9=({step:e})=>e?(0,Q.jsx)(GUe,{input:e.input,output:e.output}):null,t9=({index:e,stepCode:t,step:n,current:r})=>(0,Q.jsxs)(OM,{wrap:!0,size:8,children:[(0,Q.jsx)(Z.Text,{strong:!0,children:`第${e}步:${B7(t)}`}),(0,Q.jsx)(V7,{status:n?.status||`not_started`}),r?(0,Q.jsx)(xR,{color:`blue`,children:`当前步骤`}):null,(0,Q.jsx)(Z.Text,{type:`secondary`,children:oWe[t]||t}),n?.updatedAt?(0,Q.jsxs)(Z.Text,{type:`secondary`,children:[`更新时间:`,Q7(n.updatedAt)]}):null,n?.chatTaskId?(0,Q.jsx)(fx,{title:n.chatTaskId,children:(0,Q.jsxs)(xR,{children:[`Chat:`,$7(n.chatTaskId)]})}):null]}),cWe=(e,t)=>{if(!e)return[];let n=new Set;return n.add(`material_input`),e.currentStepCode&&n.add(e.currentStepCode),Object.values(t).forEach(e=>{(e.status===`failed`||e.errorMessage)&&n.add(e.stepCode)}),e.errorMessage&&n.add(e.currentStepCode||`material_input`),Array.from(n)},n9=(e,t=`错误信息`)=>e?(0,Q.jsx)(cf,{type:`error`,showIcon:!0,message:t,description:e,style:{marginTop:12,marginBottom:12}}):null,lWe=(e,t=`暂无提词`)=>e?(0,Q.jsx)(Z.Paragraph,{style:{whiteSpace:`pre-wrap`,marginBottom:0},children:e}):(0,Q.jsx)(sWe,{text:t}),r9=({moduleType:e=`shot_replicate`})=>{let{projectId:t}=tt(),n=Ze(),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(!1),s=(0,C.useCallback)(async()=>{if(t){o(!0);try{i(e===`hot_opening_replicate`?await PVe(t):await zVe(t))}catch(e){yP.error(e?.message||`加载复刻项目详情失败`)}finally{o(!1)}}},[e,t]);(0,C.useEffect)(()=>{s()},[s]);let c=(0,C.useMemo)(()=>{let e={};return(r?.steps||[]).forEach(t=>{e[t.stepCode]=t}),e},[r]),l=r?.module||e,u=z7(l),d=(0,C.useMemo)(()=>aWe.map(e=>{let t=c[e],n=`wait`;return t?.status===`completed`?n=`finish`:t?.status===`processing`?n=`process`:t?.status===`failed`&&(n=`error`),{title:B7(e),description:t?(0,Q.jsx)(V7,{status:t.status}):`未创建`,status:n}}),[c]),f=(0,C.useMemo)(()=>cWe(r,c),[r,c]);if(a&&!r)return(0,Q.jsx)(`div`,{style:{padding:64,textAlign:`center`},children:(0,Q.jsx)(cP,{size:`large`})});if(!r)return(0,Q.jsx)(NA,{style:{margin:24},children:(0,Q.jsx)(Ky,{description:`未找到复刻项目详情`})});let p=c.material_input,m=c.image_prompt_optimize,h=c.image_generate,g=c.video_prompt_optimize,_=c.video_generate,v=r.imageGeneration?.resultImageUrl||r.finalImageUrl,y=r.videoGeneration?.resultVideoCoverUrl||r.finalVideoCoverUrl,b=r.videoGeneration?.resultVideoUrl||r.finalVideoUrl,x=[{key:`material_input`,label:(0,Q.jsx)(t9,{index:1,stepCode:`material_input`,step:p,current:r.currentStepCode===`material_input`}),children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:2,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`模块类型`,children:(0,Q.jsx)(V7,{status:l})}),(0,Q.jsx)(fM.Item,{label:`素材步骤ID`,children:r.material?.materialStepId||`-`}),(0,Q.jsx)(fM.Item,{label:`参考素材项目名`,children:r.material?.sourceProjectName||`-`}),(0,Q.jsx)(fM.Item,{label:`生成项目名称`,children:r.material?.targetProjectName||`-`}),(0,Q.jsx)(fM.Item,{label:`核心内容点`,span:2,children:r.material?.coreContentPoint||`-`})]}),(0,Q.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:16},children:[(0,Q.jsx)(NA,{size:`small`,title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(c0,{}),`素材视频`]}),children:(0,Q.jsx)(P7,{type:`video`,url:r.material?.materialVideoUrl,emptyDescription:`暂无素材视频`})}),(0,Q.jsx)(NA,{size:`small`,title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(fX,{}),`素材图片`]}),children:(0,Q.jsx)(P7,{type:`image`,url:r.material?.materialImageUrl,emptyDescription:`暂无素材图片`})})]}),n9(p?.errorMessage),(0,Q.jsx)(e9,{step:p})]})},{key:`image_prompt_optimize`,label:(0,Q.jsx)(t9,{index:2,stepCode:`image_prompt_optimize`,step:m,current:r.currentStepCode===`image_prompt_optimize`}),children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:2,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`提词步骤ID`,children:r.imageGeneration?.promptStepId||`-`}),(0,Q.jsx)(fM.Item,{label:`步骤状态`,children:(0,Q.jsx)(V7,{status:m?.status||r.imageGeneration?.status})}),(0,Q.jsx)(fM.Item,{label:`图片提示词`,span:2,children:lWe(r.imageGeneration?.prompt,`暂无图片提示词`)})]}),n9(m?.errorMessage||r.imageGeneration?.errorMessage),(0,Q.jsx)(e9,{step:m})]})},{key:`image_generate`,label:(0,Q.jsx)(t9,{index:3,stepCode:`image_generate`,step:h,current:r.currentStepCode===`image_generate`}),children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`生成步骤ID`,children:r.imageGeneration?.generateStepId||`-`}),(0,Q.jsx)(fM.Item,{label:`Chat任务ID`,children:r.imageGeneration?.chatTaskId||`-`}),(0,Q.jsx)(fM.Item,{label:`状态`,children:(0,Q.jsx)(V7,{status:r.imageGeneration?.status||h?.status})}),(0,Q.jsx)(fM.Item,{label:`图片引擎ID`,children:r.imageGeneration?.engineId||`-`}),(0,Q.jsx)(fM.Item,{label:`图片引擎名称`,children:r.imageGeneration?.engineName||`-`}),(0,Q.jsx)(fM.Item,{label:`生成参数`,span:3,children:(0,Q.jsx)(N7,{value:r.imageGeneration?.params||{},maxHeight:160})})]}),n9(r.imageGeneration?.errorMessage||h?.errorMessage),(0,Q.jsx)(NA,{size:`small`,title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(fX,{}),`图片结果`]}),children:(0,Q.jsx)(P7,{type:`image`,url:v,height:360,emptyDescription:h?.status===`failed`||r.imageGeneration?.errorMessage?`图片生成失败,未返回图片地址`:`暂无图片结果`,errorDescription:`图片资源加载失败,可能图片文件不存在、签名过期或访问权限受限。`})}),(0,Q.jsx)(e9,{step:h})]})},{key:`video_prompt_optimize`,label:(0,Q.jsx)(t9,{index:4,stepCode:`video_prompt_optimize`,step:g,current:r.currentStepCode===`video_prompt_optimize`}),children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`提词步骤ID`,children:r.videoGeneration?.promptStepId||`-`}),(0,Q.jsx)(fM.Item,{label:`步骤状态`,children:(0,Q.jsx)(V7,{status:g?.status})}),(0,Q.jsx)(fM.Item,{label:`提词参数`,span:3,children:(0,Q.jsx)(N7,{value:r.videoGeneration?.promptParams||{},maxHeight:160})})]}),n9(g?.errorMessage||r.videoGeneration?.errorMessage),(0,Q.jsx)(iWe,{schema:r.videoGeneration?.promptSchema,finalPrompt:r.videoGeneration?.finalPrompt,schemaConfigSnapshot:r.videoGeneration?.schemaConfigSnapshot,schemaConfigSource:r.videoGeneration?.schemaConfigSource,schemaConfigVersion:r.videoGeneration?.schemaConfigVersion,schemaConfigIsFallback:r.videoGeneration?.schemaConfigIsFallback}),(0,Q.jsx)(e9,{step:g})]})},{key:`video_generate`,label:(0,Q.jsx)(t9,{index:5,stepCode:`video_generate`,step:_,current:r.currentStepCode===`video_generate`}),children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`生成步骤ID`,children:r.videoGeneration?.generateStepId||`-`}),(0,Q.jsx)(fM.Item,{label:`Chat任务ID`,children:r.videoGeneration?.chatTaskId||`-`}),(0,Q.jsx)(fM.Item,{label:`状态`,children:(0,Q.jsx)(V7,{status:r.videoGeneration?.status||_?.status})}),(0,Q.jsx)(fM.Item,{label:`视频引擎ID`,children:r.videoGeneration?.engineId||`-`}),(0,Q.jsx)(fM.Item,{label:`视频引擎名称`,children:r.videoGeneration?.engineName||`-`}),(0,Q.jsx)(fM.Item,{label:`生成参数`,span:3,children:(0,Q.jsx)(N7,{value:r.videoGeneration?.params||{},maxHeight:160})})]}),n9(r.videoGeneration?.errorMessage||_?.errorMessage),(0,Q.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:16},children:[(0,Q.jsx)(NA,{size:`small`,title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(fX,{}),`视频封面`]}),children:(0,Q.jsx)(P7,{type:`image`,url:y,emptyDescription:_?.status===`failed`||r.videoGeneration?.errorMessage?`视频生成失败,未返回封面`:`暂无视频封面`,errorDescription:`视频封面加载失败,可能文件不存在、签名过期或访问权限受限。`})}),(0,Q.jsx)(NA,{size:`small`,title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)($6,{}),`最终视频`]}),children:(0,Q.jsx)(P7,{type:`video`,url:b,emptyDescription:_?.status===`failed`||r.videoGeneration?.errorMessage?`视频生成失败,未返回视频地址`:`暂无最终视频`,errorDescription:`视频资源加载失败,可能文件不存在、签名过期或访问权限受限。`})})]}),(0,Q.jsx)(e9,{step:_})]})}];return(0,Q.jsx)(`div`,{style:{padding:24},children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(OM,{wrap:!0,style:{justifyContent:`space-between`,width:`100%`},children:[(0,Q.jsxs)(OM,{wrap:!0,children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(AH,{}),onClick:()=>n(-1),children:`返回`}),(0,Q.jsxs)(Z.Title,{level:3,style:{margin:0},children:[u,`项目详情`]}),(0,Q.jsx)(V7,{status:r.status}),r.module&&r.module!==e?(0,Q.jsxs)(xR,{color:`gold`,children:[`接口模块:`,z7(r.module)]}):null]}),(0,Q.jsx)(XS,{onClick:s,loading:a,children:`刷新`})]}),(0,Q.jsx)(NA,{children:(0,Q.jsxs)(fM,{title:`基础信息`,column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`项目ID`,children:r.id}),(0,Q.jsx)(fM.Item,{label:`模块类型`,children:(0,Q.jsx)(V7,{status:l})}),(0,Q.jsx)(fM.Item,{label:`用户ID`,children:r.userId||`-`}),(0,Q.jsx)(fM.Item,{label:`用户名`,children:r.userName||`-`}),(0,Q.jsx)(fM.Item,{label:`标题`,children:r.title||`-`}),(0,Q.jsx)(fM.Item,{label:`当前步骤`,children:(0,Q.jsx)(fx,{title:r.currentStepCode||``,children:B7(r.currentStepCode)})}),(0,Q.jsx)(fM.Item,{label:`状态`,children:(0,Q.jsx)(V7,{status:r.status})}),(0,Q.jsx)(fM.Item,{label:`创建时间`,children:Q7(r.createdAt)}),(0,Q.jsx)(fM.Item,{label:`更新时间`,children:Q7(r.updatedAt)}),(0,Q.jsx)(fM.Item,{label:`完成时间`,children:Q7(r.completedAt)}),r.errorMessage?(0,Q.jsx)(fM.Item,{label:`错误信息`,span:3,children:(0,Q.jsx)(cf,{type:`error`,showIcon:!0,message:r.errorMessage})}):null]})}),(0,Q.jsx)(NA,{title:`步骤进度`,children:(0,Q.jsx)(uhe,{items:d})}),(0,Q.jsx)(NA,{title:`最终结果预览`,children:(0,Q.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(280px, 1fr))`,gap:16},children:[(0,Q.jsx)(NA,{size:`small`,title:`最终图片`,children:(0,Q.jsx)(P7,{type:`image`,url:r.finalImageUrl||r.imageGeneration?.resultImageUrl,height:220,emptyDescription:`暂无最终图片`})}),(0,Q.jsx)(NA,{size:`small`,title:`最终视频封面`,children:(0,Q.jsx)(P7,{type:`image`,url:r.finalVideoCoverUrl||r.videoGeneration?.resultVideoCoverUrl,height:220,emptyDescription:`暂无最终视频封面`})}),(0,Q.jsx)(NA,{size:`small`,title:`最终视频`,children:(0,Q.jsx)(P7,{type:`video`,url:r.finalVideoUrl||r.videoGeneration?.resultVideoUrl,height:220,emptyDescription:`暂无最终视频`})})]})}),(0,Q.jsx)(Hh,{defaultActiveKey:f,items:x}),(0,Q.jsx)(Hh,{items:[{key:`steps-table`,label:`完整步骤列表`,children:(0,Q.jsx)(cR,{rowKey:`id`,size:`small`,pagination:!1,dataSource:r.steps||[],scroll:{x:1100},columns:[{title:`序号`,dataIndex:`stepIndex`,width:70},{title:`步骤`,dataIndex:`stepCode`,width:160,render:e=>(0,Q.jsx)(fx,{title:e,children:B7(e)})},{title:`状态`,dataIndex:`status`,width:120,render:e=>(0,Q.jsx)(V7,{status:e})},{title:`版本`,dataIndex:`version`,width:70},{title:`当前有效`,dataIndex:`isCurrent`,width:90,render:e=>e?(0,Q.jsx)(xR,{color:`success`,children:`是`}):(0,Q.jsx)(xR,{children:`否`})},{title:`Chat任务`,dataIndex:`chatTaskId`,width:160,render:e=>(0,Q.jsx)(fx,{title:e||``,children:$7(e)})},{title:`创建时间`,dataIndex:`createdAt`,width:170,render:Q7},{title:`完成时间`,dataIndex:`completedAt`,width:170,render:Q7},{title:`错误`,dataIndex:`errorMessage`,ellipsis:!0,render:e=>e||`-`}]})},{key:`raw-detail`,label:`完整详情原始 JSON`,children:(0,Q.jsx)(N7,{value:r,maxHeight:520})}]})]})})},uWe=()=>(0,Q.jsx)(r9,{moduleType:`hot_opening_replicate`}),i9=20,dWe=[{value:`pending_analysis`,label:`等待分析`},{value:`analyzing`,label:`分析中`},{value:`analysis_completed`,label:`分析完成`},{value:`analysis_failed`,label:`分析失败`},{value:`splitting`,label:`拆镜中`},{value:`split_completed`,label:`拆镜完成`},{value:`partial_failed`,label:`部分失败`},{value:`failed`,label:`失败`}],fWe=[{value:`pending`,label:`待分析`},{value:`processing`,label:`分析中`},{value:`completed`,label:`分析完成`},{value:`failed`,label:`分析失败`}],pWe=[{value:`none`,label:`未拆镜`},{value:`pending`,label:`待拆镜`},{value:`processing`,label:`拆镜中`},{value:`completed`,label:`拆镜完成`},{value:`failed`,label:`拆镜失败`},{value:`retry_waiting`,label:`等待重试`}],mWe={pending_analysis:{color:`default`,text:`等待分析`},analyzing:{color:`processing`,text:`分析中`},analysis_completed:{color:`success`,text:`分析完成`},analysis_failed:{color:`error`,text:`分析失败`},splitting:{color:`warning`,text:`拆镜中`},split_completed:{color:`success`,text:`拆镜完成`},partial_failed:{color:`orange`,text:`部分失败`},failed:{color:`error`,text:`失败`},none:{color:`default`,text:`未拆镜`},pending:{color:`default`,text:`待处理`},processing:{color:`warning`,text:`处理中`},completed:{color:`success`,text:`完成`},retry_waiting:{color:`orange`,text:`等待重试`}},a9=e=>e?E5(e):`-`,o9=e=>e?e.length>16?`${e.slice(0,10)}...`:e:`-`,s9=({status:e})=>{if(!e)return(0,Q.jsx)(xR,{children:`-`});let t=mWe[e]||{color:`blue`,text:e};return(0,Q.jsx)(xR,{color:t.color,children:t.text})},hWe=()=>{let e=Ze(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)(0),[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(1),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(``),[y,b]=(0,C.useState)(``),[x,S]=(0,C.useState)(null),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(``),[O,k]=(0,C.useState)(``),[A,j]=(0,C.useState)(null),[M,N]=(0,C.useState)(0),P=(0,C.useCallback)(async()=>{o(!0);try{let e=await FVe({status:l||void 0,analysisStatus:d||void 0,splitStatus:p||void 0,keyword:w||void 0,userId:E||void 0,userName:O||void 0,createdStart:A?.[0]?.toISOString?.(),createdEnd:A?.[1]?.toISOString?.(),page:s,pageSize:i9});n(e.items||[]),i(e.total||0)}catch(e){yP.error(e?.message||`加载拆镜复刻任务失败`)}finally{o(!1)}},[d,s,A,w,E,O,p,l]);(0,C.useEffect)(()=>{P()},[P,M]);let F=()=>{T(h.trim()),D(_.trim()),k(y.trim()),j(x),c(1)};return(0,Q.jsx)(`div`,{style:{padding:24},children:(0,Q.jsx)(NA,{children:(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(OM,{align:`center`,style:{justifyContent:`space-between`,width:`100%`},children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Title,{level:3,style:{marginBottom:4},children:`拆镜复刻`}),(0,Q.jsx)(Z.Text,{type:`secondary`,children:`只读排查页面:查看拆镜总任务、AI 分析结果、切片列表和关联复刻项目。`})]}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>N(e=>e+1),children:`刷新`})]}),(0,Q.jsxs)(OM,{wrap:!0,children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`总任务状态`,style:{width:150},value:l||void 0,onChange:e=>{u(e||``),c(1)},options:dWe}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`分析状态`,style:{width:140},value:d||void 0,onChange:e=>{f(e||``),c(1)},options:fWe}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`拆镜状态`,style:{width:140},value:p||void 0,onChange:e=>{m(e||``),c(1)},options:pWe}),(0,Q.jsx)(LN,{allowClear:!0,prefix:(0,Q.jsx)(_b,{}),placeholder:`关键词:标题/内容/分类/受众`,style:{width:260},value:h,onChange:e=>g(e.target.value),onPressEnter:F}),(0,Q.jsx)(LN,{allowClear:!0,placeholder:`用户ID(管理员)`,style:{width:190},value:_,onChange:e=>v(e.target.value),onPressEnter:F}),(0,Q.jsx)(LN,{allowClear:!0,placeholder:`用户名(管理员)`,style:{width:230},value:y,onChange:e=>b(e.target.value),onPressEnter:F}),(0,Q.jsx)(cM.RangePicker,{showTime:!0,value:x,onChange:S,placeholder:[`创建开始`,`创建结束`]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(_b,{}),onClick:F,children:`搜索`}),(0,Q.jsx)(XS,{onClick:()=>{u(``),f(``),m(``),g(``),v(``),b(``),S(null),T(``),D(``),k(``),j(null),c(1),N(e=>e+1)},children:`重置`})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:a,dataSource:t,pagination:{current:s,pageSize:i9,total:r,showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:c},scroll:{x:1500},columns:[{title:`任务集ID`,dataIndex:`id`,width:150,render:e=>(0,Q.jsx)(fx,{title:e,children:o9(e)})},{title:`用户`,width:180,render:(e,t)=>(0,Q.jsxs)(OM,{direction:`vertical`,size:0,children:[(0,Q.jsx)(Z.Text,{children:t.userName||`-`}),(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12},children:o9(t.userId)})]})},{title:`任务信息`,width:300,render:(e,t)=>(0,Q.jsxs)(OM,{direction:`vertical`,size:2,children:[(0,Q.jsx)(Z.Text,{strong:!0,children:t.title||`-`}),(0,Q.jsxs)(Z.Text,{type:`secondary`,ellipsis:!0,style:{maxWidth:280},children:[`分类:`,t.originalVideoCategory||`-`]}),(0,Q.jsxs)(Z.Text,{type:`secondary`,ellipsis:!0,style:{maxWidth:280},children:[`受众:`,t.originalVideoAudience||`-`]})]})},{title:`总状态`,dataIndex:`status`,width:120,render:e=>(0,Q.jsx)(s9,{status:e})},{title:`分析状态`,dataIndex:`analysisStatus`,width:110,render:e=>(0,Q.jsx)(s9,{status:e})},{title:`拆镜状态`,dataIndex:`splitStatus`,width:110,render:e=>(0,Q.jsx)(s9,{status:e})},{title:`切片进度`,width:180,render:(e,t)=>{let n=t.segmentCount||0,r=t.completedSegmentCount||0;return(0,Q.jsx)(FP,{size:`small`,percent:n?Math.round(r/n*100):0,format:()=>`${r}/${n}`})}},{title:`失败片段`,dataIndex:`failedSegmentCount`,width:90,render:e=>e?(0,Q.jsx)(xR,{color:`error`,children:e}):(0,Q.jsx)(xR,{children:`0`})},{title:`视频时长`,dataIndex:`videoDurationSeconds`,width:100,render:e=>`${Number(e||0).toFixed(1)}s`},{title:`创建时间`,dataIndex:`createdAt`,width:170,render:a9},{title:`更新时间`,dataIndex:`updatedAt`,width:170,render:a9},{title:`操作`,fixed:`right`,width:120,render:(t,n)=>(0,Q.jsx)(XS,{type:`link`,icon:(0,Q.jsx)(ON,{}),onClick:()=>e(`/shot-replications/task-sets/${n.id}`),children:`查看切片`})}]})]})})})},gWe=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``),c9=20,_We=[{value:`ai_suggestion`,label:`AI 建议`},{value:`custom`,label:`自定义`}],vWe=[{value:`none`,label:`未拆镜`},{value:`pending`,label:`待拆镜`},{value:`processing`,label:`拆镜中`},{value:`completed`,label:`拆镜完成`},{value:`failed`,label:`拆镜失败`},{value:`retry_waiting`,label:`等待重试`}],yWe=[{value:`not_required`,label:`无需分析`},{value:`pending`,label:`待分析`},{value:`processing`,label:`分析中`},{value:`completed`,label:`分析完成`},{value:`failed`,label:`分析失败`}],bWe=[{value:`not_started`,label:`未复刻`},{value:`project_created`,label:`已创建项目`},{value:`processing`,label:`复刻中`},{value:`completed`,label:`复刻完成`},{value:`failed`,label:`复刻失败`}],xWe={pending_analysis:{color:`default`,text:`等待分析`},analyzing:{color:`processing`,text:`分析中`},analysis_completed:{color:`success`,text:`分析完成`},analysis_failed:{color:`error`,text:`分析失败`},splitting:{color:`warning`,text:`拆镜中`},split_completed:{color:`success`,text:`拆镜完成`},partial_failed:{color:`orange`,text:`部分失败`},failed:{color:`error`,text:`失败`},none:{color:`default`,text:`未拆镜`},pending:{color:`default`,text:`待处理`},processing:{color:`warning`,text:`处理中`},completed:{color:`success`,text:`完成`},retry_waiting:{color:`orange`,text:`等待重试`},not_required:{color:`default`,text:`无需分析`},not_started:{color:`default`,text:`未复刻`},project_created:{color:`processing`,text:`已创建项目`}},SWe=e=>{if(!e)return``;let t=String(e).trim();return t?/^(https?:)?\/\//i.test(t)||/^(blob|data):/i.test(t)?t:`${gWe}${t.startsWith(`/`)?t:`/${t}`}`:``},l9=e=>e?E5(e):`-`,u9=e=>e?e.length>16?`${e.slice(0,10)}...`:e:`-`,d9=({status:e})=>{if(!e)return(0,Q.jsx)(xR,{children:`-`});let t=xWe[e]||{color:`blue`,text:e};return(0,Q.jsx)(xR,{color:t.color,children:t.text})},f9=({value:e,maxHeight:t=420})=>(0,Q.jsx)(`pre`,{style:{margin:0,padding:12,maxHeight:t,overflow:`auto`,background:`#0f172a`,color:`#e2e8f0`,borderRadius:8,fontSize:12,lineHeight:1.6},children:JSON.stringify(e??{},null,2)}),p9=({url:e,height:t=280})=>e?(0,Q.jsx)(`video`,{src:SWe(e),controls:!0,preload:`metadata`,style:{width:`100%`,maxHeight:t,borderRadius:12,background:`#0f172a`}}):(0,Q.jsx)(Ky,{description:`暂无视频`,image:Ky.PRESENTED_IMAGE_SIMPLE}),CWe=({items:e=[]})=>(0,Q.jsx)(cR,{rowKey:`index`,size:`small`,pagination:!1,dataSource:e,scroll:{x:!0},columns:[{title:`序号`,dataIndex:`index`,width:70},{title:`时间节点`,dataIndex:`timeNode`,width:120},{title:`开始`,dataIndex:`startSecond`,width:80,render:e=>`${Number(e||0).toFixed(2)}s`},{title:`结束`,dataIndex:`endSecond`,width:80,render:e=>`${Number(e||0).toFixed(2)}s`},{title:`内容`,dataIndex:`content`,ellipsis:!0},{title:`分类`,dataIndex:`category`,width:140},{title:`受众`,dataIndex:`audience`,ellipsis:!0}]}),wWe=()=>{let{taskSetId:e}=tt(),t=Ze(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)([]),[o,s]=(0,C.useState)(0),[c,l]=(0,C.useState)(1),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(0),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(``),[T,E]=(0,C.useState)(!1),[D,O]=(0,C.useState)(null),k=(0,C.useCallback)(async()=>{if(e){d(!0);try{r(await IVe(e))}catch(e){yP.error(e?.message||`加载拆镜任务详情失败`)}finally{d(!1)}}},[e]),A=(0,C.useCallback)(async()=>{if(e){p(!0);try{let t=await LVe(e,{sourceMode:g||void 0,splitStatus:v||void 0,analysisStatus:b||void 0,replicateStatus:S||void 0,page:c,pageSize:c9});a(t.items||[]),s(t.total||0)}catch(e){yP.error(e?.message||`加载拆镜片段失败`)}finally{p(!1)}}},[b,c,S,g,v,e]);(0,C.useEffect)(()=>{k()},[k,m]),(0,C.useEffect)(()=>{A()},[A,m]);let j=async e=>{E(!0),O(null);try{O(await RVe(e))}catch(e){yP.error(e?.message||`加载片段详情失败`)}};return u&&!n?(0,Q.jsx)(`div`,{style:{padding:64,textAlign:`center`},children:(0,Q.jsx)(cP,{size:`large`})}):n?(0,Q.jsxs)(`div`,{style:{padding:24},children:[(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(OM,{style:{justifyContent:`space-between`,width:`100%`},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(AH,{}),onClick:()=>t(`/shot-replications`),children:`返回列表`}),(0,Q.jsx)(Z.Title,{level:3,style:{margin:0},children:`拆镜任务详情`}),(0,Q.jsx)(d9,{status:n.status})]}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>h(e=>e+1),children:`刷新`})]}),(0,Q.jsx)(NA,{children:(0,Q.jsxs)(fM,{title:`总任务信息`,column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`任务集ID`,children:n.id}),(0,Q.jsx)(fM.Item,{label:`用户ID`,children:n.userId||`-`}),(0,Q.jsx)(fM.Item,{label:`用户名`,children:n.userName||`-`}),(0,Q.jsx)(fM.Item,{label:`标题`,children:n.title||`-`}),(0,Q.jsxs)(fM.Item,{label:`视频时长`,children:[Number(n.videoDurationSeconds||0).toFixed(2),`s`]}),(0,Q.jsx)(fM.Item,{label:`总状态`,children:(0,Q.jsx)(d9,{status:n.status})}),(0,Q.jsx)(fM.Item,{label:`分析状态`,children:(0,Q.jsx)(d9,{status:n.analysisStatus})}),(0,Q.jsx)(fM.Item,{label:`拆镜状态`,children:(0,Q.jsx)(d9,{status:n.splitStatus})}),(0,Q.jsxs)(fM.Item,{label:`片段数量`,children:[n.completedSegmentCount,`/`,n.segmentCount,`,失败 `,n.failedSegmentCount]}),(0,Q.jsx)(fM.Item,{label:`原视频分类`,children:n.originalVideoCategory||`-`}),(0,Q.jsx)(fM.Item,{label:`创建时间`,children:l9(n.createdAt)}),(0,Q.jsx)(fM.Item,{label:`更新时间`,children:l9(n.updatedAt)}),(0,Q.jsx)(fM.Item,{label:`原视频内容`,span:3,children:n.originalVideoContent||`-`}),(0,Q.jsx)(fM.Item,{label:`原视频受众`,span:3,children:n.originalVideoAudience||`-`}),n.analysisErrorMessage?(0,Q.jsx)(fM.Item,{label:`分析错误`,span:3,children:(0,Q.jsx)(cf,{type:`error`,message:n.analysisErrorMessage})}):null,n.splitErrorMessage?(0,Q.jsx)(fM.Item,{label:`拆镜错误`,span:3,children:(0,Q.jsx)(cf,{type:`error`,message:n.splitErrorMessage})}):null]})}),(0,Q.jsx)(NA,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(c0,{}),`原视频预览`]}),children:(0,Q.jsx)(p9,{url:n.videoUrl,height:360})}),(0,Q.jsxs)(NA,{title:`AI 建议拆镜列表`,children:[n.aiSuggestions?.length?(0,Q.jsx)(CWe,{items:n.aiSuggestions}):(0,Q.jsx)(Ky,{description:`暂无 AI 建议拆镜`}),(0,Q.jsx)(Hh,{size:`small`,ghost:!0,style:{marginTop:12},items:[{key:`raw`,label:`查看原视频分析完整 JSON`,children:(0,Q.jsx)(f9,{value:n.analysisResultJson})}]})]}),(0,Q.jsxs)(NA,{title:`片段列表`,children:[(0,Q.jsxs)(OM,{wrap:!0,style:{marginBottom:16},children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`片段来源`,style:{width:140},value:g||void 0,options:_We,onChange:e=>{_(e||``),l(1)}}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`切割状态`,style:{width:140},value:v||void 0,options:vWe,onChange:e=>{y(e||``),l(1)}}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`分析状态`,style:{width:140},value:b||void 0,options:yWe,onChange:e=>{x(e||``),l(1)}}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`复刻状态`,style:{width:150},value:S||void 0,options:bWe,onChange:e=>{w(e||``),l(1)}}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(_b,{}),onClick:()=>h(e=>e+1),children:`筛选`}),(0,Q.jsx)(XS,{onClick:()=>{_(``),y(``),x(``),w(``),l(1),h(e=>e+1)},children:`重置`})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:f,dataSource:i,pagination:{current:c,pageSize:c9,total:o,showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:l},scroll:{x:1550},columns:[{title:`片段ID`,dataIndex:`id`,width:150,render:e=>(0,Q.jsx)(fx,{title:e,children:u9(e)})},{title:`序号`,dataIndex:`segmentIndex`,width:70},{title:`来源`,dataIndex:`sourceMode`,width:100,render:e=>e===`ai_suggestion`?(0,Q.jsx)(xR,{color:`purple`,children:`AI建议`}):(0,Q.jsx)(xR,{color:`cyan`,children:`自定义`})},{title:`时间节点`,dataIndex:`timeNode`,width:130},{title:`时长`,dataIndex:`durationSeconds`,width:90,render:e=>`${Number(e||0).toFixed(2)}s`},{title:`切割`,dataIndex:`splitStatus`,width:100,render:e=>(0,Q.jsx)(d9,{status:e})},{title:`分析`,dataIndex:`analysisStatus`,width:100,render:e=>(0,Q.jsx)(d9,{status:e})},{title:`复刻`,dataIndex:`replicateStatus`,width:110,render:e=>(0,Q.jsx)(d9,{status:e})},{title:`片段内容`,dataIndex:`segmentContent`,width:260,ellipsis:!0,render:e=>e||`-`},{title:`分类`,dataIndex:`segmentCategory`,width:120,render:e=>e||`-`},{title:`关联项目`,width:220,render:(e,n)=>n.moduleProjectId?(0,Q.jsxs)(OM,{direction:`vertical`,size:0,children:[(0,Q.jsx)(XS,{type:`link`,style:{padding:0},onClick:()=>t(`/shot-replications/projects/${n.moduleProjectId}`),children:u9(n.moduleProjectId)}),(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12},children:n.moduleProjectTitle||B7(n.moduleProjectCurrentStepCode)}),(0,Q.jsx)(d9,{status:n.moduleProjectStatus})]}):(0,Q.jsx)(xR,{children:`未创建`})},{title:`错误`,dataIndex:`splitLastError`,width:220,ellipsis:!0,render:(e,t)=>e||t.analysisErrorMessage||`-`},{title:`创建时间`,dataIndex:`createdAt`,width:170,render:l9},{title:`操作`,fixed:`right`,width:100,render:(e,t)=>(0,Q.jsx)(XS,{type:`link`,icon:(0,Q.jsx)(ON,{}),onClick:()=>j(t.id),children:`详情`})}]})]})]}),(0,Q.jsx)(Lde,{title:`片段详情`,width:720,open:T,onClose:()=>E(!1),destroyOnClose:!0,children:D?(0,Q.jsxs)(OM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(fM,{column:2,bordered:!0,size:`small`,children:[(0,Q.jsx)(fM.Item,{label:`片段ID`,span:2,children:D.id}),(0,Q.jsx)(fM.Item,{label:`时间节点`,children:D.timeNode}),(0,Q.jsxs)(fM.Item,{label:`时长`,children:[Number(D.durationSeconds||0).toFixed(2),`s`]}),(0,Q.jsx)(fM.Item,{label:`切割状态`,children:(0,Q.jsx)(d9,{status:D.splitStatus})}),(0,Q.jsx)(fM.Item,{label:`分析状态`,children:(0,Q.jsx)(d9,{status:D.analysisStatus})}),(0,Q.jsx)(fM.Item,{label:`复刻状态`,children:(0,Q.jsx)(d9,{status:D.replicateStatus})}),(0,Q.jsx)(fM.Item,{label:`关联项目`,children:D.moduleProjectId?(0,Q.jsx)(XS,{type:`link`,onClick:()=>t(`/shot-replications/projects/${D.moduleProjectId}`),children:D.moduleProjectId}):`-`}),(0,Q.jsx)(fM.Item,{label:`片段内容`,span:2,children:D.segmentContent||`-`}),(0,Q.jsx)(fM.Item,{label:`片段分类`,children:D.segmentCategory||`-`}),(0,Q.jsx)(fM.Item,{label:`片段受众`,children:D.segmentAudience||`-`})]}),(0,Q.jsx)(NA,{size:`small`,title:`片段视频`,children:(0,Q.jsx)(p9,{url:D.segmentVideoUrl,height:300})}),D.splitLastError?(0,Q.jsx)(cf,{type:`error`,message:`切割错误`,description:D.splitLastError}):null,D.analysisErrorMessage?(0,Q.jsx)(cf,{type:`error`,message:`分析错误`,description:D.analysisErrorMessage}):null,(0,Q.jsx)(Hh,{size:`small`,items:[{key:`analysis`,label:`片段分析 JSON`,children:(0,Q.jsx)(f9,{value:D.analysisJson})},{key:`suggestion`,label:`AI 建议原始 JSON`,children:(0,Q.jsx)(f9,{value:D.aiSuggestionJson})}]})]}):(0,Q.jsx)(cP,{})})]}):(0,Q.jsx)(NA,{style:{margin:24},children:(0,Q.jsx)(Ky,{description:`未找到拆镜任务详情`})})},{Title:TWe,Text:m9,Paragraph:EWe}=Z,{TextArea:h9}=LN,g9=[{label:`对象`,value:`object`},{label:`数组`,value:`array`},{label:`字符串`,value:`string`},{label:`数字`,value:`number`},{label:`布尔`,value:`boolean`},{label:`流程数组`,value:`flow`}],_9=`画面属性`,DWe=new Set([`视频时长`,`视频比例`,`清晰度`,`帧率`,`推荐分辨率`]);function v9(e,t){return e===_9&&!!t&&DWe.has(t)}function y9(e){return e===_9}function OWe(e){return JSON.parse(JSON.stringify(e??null))}function b9(e,t,n,r){return!e||typeof e!=`object`?r:e[t]===void 0?e[n]===void 0?r:e[n]:e[t]}function kWe(e){return{key:String(e?.key||e?.label||`新流程字段`),label:String(e?.label||e?.key||`新流程字段`),enabled:e?.enabled??!0,editable:e?.editable??!0,maxLength:Number(b9(e,`maxLength`,`max_length`,800)||800),value:e?.value??``}}function x9(e){let t=String(e?.type||`string`),n={key:String(e?.key||e?.label||`新字段`),label:String(e?.label||e?.key||`新字段`),type:t,enabled:e?.enabled??!0,editable:e?.editable??!0,maxLength:Number(b9(e,`maxLength`,`max_length`,t===`flow`?800:1e3)||(t===`flow`?800:1e3))};if(t===`object`)n.children=Array.isArray(e?.children)?e.children.map(x9):[];else if(t===`flow`){n.contentKey=String(b9(e,`contentKey`,`content_key`,e?.key===`镜头流程`?`镜头内容`:`动作内容`));let t=b9(e,`contentAliases`,`content_aliases`,[]);n.contentAliases=Array.isArray(t)?t.map(e=>String(e)).filter(Boolean):[];let r=b9(e,`itemFields`,`item_fields`,[]);n.itemFields=Array.isArray(r)&&r.length>0?r.map(kWe):[{key:n.contentKey,label:n.contentKey,enabled:!0,editable:!0,maxLength:n.maxLength||800,value:``}]}else n.value=e?.value??(t===`array`?[]:t===`boolean`?!1:t===`number`?0:`无`);return n}function AWe(e){let t=Array.isArray(e?.segments)?e.segments:[],n=Array.isArray(e?.ratios)?e.ratios:[];return{minDuration:Number(b9(e,`minDuration`,`min_duration`,1)||1),maxDuration:Number(b9(e,`maxDuration`,`max_duration`,5)||5),ratios:n.map(e=>Number(e||0)),segments:t.map(e=>({stage:String(e?.stage||`新阶段`),description:String(e?.description||e?.desc||`阶段说明`)}))}}function S9(e){let t=Array.isArray(e?.sections)?e.sections:[],n=Array.isArray(e?.timePlanRules)?e.timePlanRules:Array.isArray(e?.time_plan_rules)?e.time_plan_rules:[];return{version:e?.version||`video_prompt_schema_config_v1`,enabled:e?.enabled??!0,sections:t.map(x9),timePlanRules:n.map(AWe)}}function C9(e,t){let n=y9(e.key),r=v9(t,e.key),i={key:e.key,label:e.label,type:r?`string`:e.type,enabled:n||r?!0:!!e.enabled,editable:r?!1:!!e.editable,max_length:e.maxLength};return e.type===`object`?i.children=(e.children||[]).map(t=>C9(t,e.key)):e.type===`flow`?(i.content_key=e.contentKey,i.content_aliases=e.contentAliases||[],i.item_fields=(e.itemFields||[]).map(e=>({key:e.key,label:e.label,enabled:!!e.enabled,editable:!!e.editable,max_length:e.maxLength,value:e.value??``}))):i.value=e.value,i}function w9(e,t){return{version:e.version,enabled:t,sections:(e.sections||[]).map(e=>C9(e)),time_plan_rules:(e.timePlanRules||[]).map(e=>({min_duration:e.minDuration,max_duration:e.maxDuration,ratios:e.ratios||[],segments:(e.segments||[]).map(e=>({stage:e.stage,description:e.description}))}))}}function T9(e){return e?.runtimeSchema||e?.runtime_schema||{}}function E9(e){let t=e?.timePlan||e?.time_plan||T9(e)?.动态时间规划||[];return Array.isArray(t)?t:[]}function jWe(e){return e?.schemaConfigSnapshot||e?.schema_config_snapshot||{}}function MWe(e,t){let n=new Blob([JSON.stringify(t,null,2)],{type:`application/json;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}var D9=(e=`string`)=>({key:`新字段`,label:`新字段`,type:e,enabled:!0,editable:!0,maxLength:e===`flow`?800:1e3,value:e===`array`?[]:e===`boolean`?!1:e===`number`?0:`无`,children:e===`object`?[]:void 0,contentKey:e===`flow`?`动作内容`:void 0,contentAliases:e===`flow`?[`动作内容`,`动作`,`动作说明`,`内容`,`说明`]:void 0,itemFields:e===`flow`?[{key:`动作内容`,label:`动作内容`,enabled:!0,editable:!0,maxLength:800,value:``}]:void 0}),NWe=()=>({minDuration:1,maxDuration:5,ratios:[.2,.4,.4],segments:[{stage:`开场吸引`,description:`快速吸引注意力`},{stage:`核心展示`,description:`展示主体动作、核心卖点或主要视觉内容`},{stage:`收尾引导`,description:`给出行动引导并稳定落版`}]}),PWe=()=>{let[e,t]=(0,C.useState)(!1),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(!1),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(null),[g]=X.useForm(),_=(0,C.useRef)(null),v=c?.sections||[],y=c?.timePlanRules||[],b=async()=>{t(!0);try{let e=await BVe();a(!!(e.isEnabled??e.is_enabled??e.data?.enabled??!1)),s(!!(e.usingDefault??e.using_default??!1)),l(S9(e.data)),d(S9(e.defaultData??e.default_data))}catch(e){yP.error(e?.message||`加载失败`)}finally{t(!1)}};(0,C.useEffect)(()=>{b()},[]);let x=e=>{l(t=>{let n=S9(OWe(t));return e(n),n})},S=async()=>{if(c){r(!0);try{let e=await VVe({is_enabled:i,data:w9(c,i)});l(S9(e.data)),a(!!(e.isEnabled??e.is_enabled??e.data?.enabled??!1)),s(!!(e.usingDefault??e.using_default??!1)),yP.success(`保存成功`)}catch(e){yP.error(e?.message||`保存失败`)}finally{r(!1)}}},w=async()=>{r(!0);try{let e=await HVe();l(S9(e.data)),d(S9(e.defaultData??e.default_data)),a(!!(e.isEnabled??e.is_enabled??e.data?.enabled??!1)),s(!!(e.usingDefault??e.using_default??!1)),yP.success(`已恢复默认配置`)}catch(e){yP.error(e?.message||`恢复默认失败`)}finally{r(!1)}},T=async()=>{try{MWe(`video_prompt_schema_config.json`,await UVe())}catch(e){yP.error(e?.message||`导出失败`)}},E=async e=>{let t=e.target.files?.[0];if(e.target.value=``,t)try{let e=await t.text(),n=JSON.parse(e),r=n.data||n,o=await WVe({is_enabled:!!(n.isEnabled??n.is_enabled??i),data:r});l(S9(o.data)),a(!!(o.isEnabled??o.is_enabled??o.data?.enabled??!1)),s(!!(o.usingDefault??o.using_default??!1)),yP.success(`导入成功`)}catch(e){yP.error(e?.message||`导入失败,请检查 JSON 格式`)}},D=()=>{g.setFieldsValue({duration:8,aspectRatio:`9:16`,resolution:`1080p`,frameRate:`30fps`}),h(null),p(!0)},O=async()=>{if(!c)return;let e=await g.validateFields();try{h(await GVe({is_enabled:i,data:w9(c,i),duration:Number(e.duration||8),aspect_ratio:e.aspectRatio,resolution:e.resolution,frame_rate:e.frameRate}))}catch(e){yP.error(e?.message||`预览失败`)}},k=()=>{x(e=>{e.sections.push(D9(`object`))})},A=(e,t)=>{x(n=>{let r=n.sections[e];y9(r?.key)&&(delete t.key,delete t.type,delete t.enabled),n.sections[e]={...n.sections[e],...t},t.type===`object`&&(n.sections[e].children=n.sections[e].children||[]),t.type===`flow`&&(n.sections[e].contentKey=n.sections[e].contentKey||`动作内容`,n.sections[e].contentAliases=n.sections[e].contentAliases||[`动作内容`,`动作`,`动作说明`,`内容`,`说明`],n.sections[e].itemFields=n.sections[e].itemFields||[{key:`动作内容`,label:`动作内容`,enabled:!0,editable:!0,maxLength:800,value:``}])})},j=e=>{x(t=>{t.sections.splice(e,1)})},M=e=>{x(t=>{let n=t.sections[e];n.children=n.children||[],n.children.push(D9(`string`))})},N=(e,t,n)=>{x(r=>{let i=r.sections[e],a=i.children||[],o=a[t];v9(i?.key,o?.key)&&(delete n.key,delete n.type,delete n.enabled,n.editable=!1),a[t]={...a[t],...n},r.sections[e].children=a})},P=(e,t)=>{x(n=>{n.sections[e].children?.splice(t,1)})},F=e=>{x(t=>{let n=t.sections[e];n.itemFields=n.itemFields||[],n.itemFields.push({key:`新流程字段`,label:`新流程字段`,enabled:!0,editable:!0,maxLength:800,value:``})})},I=(e,t,n)=>{x(r=>{let i=r.sections[e].itemFields||[];i[t]={...i[t],...n},r.sections[e].itemFields=i})},L=(e,t)=>{x(n=>{n.sections[e].itemFields?.splice(t,1)})},R=()=>{x(e=>{e.timePlanRules.push(NWe())})},z=(e,t)=>{x(n=>{n.timePlanRules[e]={...n.timePlanRules[e],...t}})},B=e=>{x(t=>{t.timePlanRules.splice(e,1)})},V=(e,t,n)=>{x(r=>{let i=r.timePlanRules[e];n.ratio!==void 0&&(i.ratios[t]=Number(n.ratio||0)),n.stage!==void 0&&(i.segments[t].stage=n.stage),n.description!==void 0&&(i.segments[t].description=n.description)})},H=e=>{x(t=>{let n=t.timePlanRules[e];n.ratios.push(1),n.segments.push({stage:`新阶段`,description:`阶段说明`})})},U=(e,t)=>{x(n=>{let r=n.timePlanRules[e];r.ratios.splice(t,1),r.segments.splice(t,1)})},W=(0,C.useMemo)(()=>v.map((e,t)=>({key:`section-${t}`,label:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(m9,{strong:!0,children:e.label||e.key||`未命名分组`}),e.key&&e.key!==e.label&&(0,Q.jsxs)(xR,{color:`blue`,children:[`key: `,e.key]}),(0,Q.jsx)(xR,{children:e.type}),y9(e.key)&&(0,Q.jsx)(xR,{color:`red`,children:`系统锁定`}),!e.enabled&&!y9(e.key)&&(0,Q.jsx)(xR,{color:`default`,children:`已禁用`})]}),children:(0,Q.jsxs)(OM,{direction:`vertical`,style:{width:`100%`},size:`middle`,children:[(0,Q.jsxs)(BP,{gutter:12,align:`middle`,children:[(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(LN,{addonBefore:`key`,value:e.key,maxLength:64,placeholder:`传给 AI 的字段名`,disabled:y9(e.key),onChange:e=>A(t,{key:e.target.value})})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(LN,{addonBefore:`label`,value:e.label,maxLength:64,placeholder:`后台显示名称`,onChange:e=>A(t,{label:e.target.value})})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(Sb,{value:e.type,options:g9,style:{width:`100%`},disabled:y9(e.key),onChange:e=>A(t,{type:e})})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsxs)(OM,{children:[`启用`,(0,Q.jsx)(aF,{checked:y9(e.key)?!0:e.enabled,disabled:y9(e.key),onChange:e=>A(t,{enabled:e})})]})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsxs)(OM,{children:[`可编辑`,(0,Q.jsx)(aF,{checked:e.editable,onChange:e=>A(t,{editable:e})})]})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(Ej,{min:1,max:2e4,value:e.maxLength,addonBefore:`长度`,style:{width:`100%`},onChange:e=>A(t,{maxLength:Number(e||1e3)})})}),(0,Q.jsx)(nj,{span:2,style:{textAlign:`right`},children:(0,Q.jsx)(wP,{title:`确认删除该分组?`,disabled:y9(e.key),onConfirm:()=>j(t),children:(0,Q.jsx)(XS,{danger:!0,icon:(0,Q.jsx)(wR,{}),disabled:y9(e.key)})})})]}),e.type===`object`&&(0,Q.jsx)(NA,{size:`small`,title:`对象字段`,extra:(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(cA,{}),onClick:()=>M(t),children:`新增字段`}),children:(0,Q.jsx)(OM,{direction:`vertical`,style:{width:`100%`},children:(e.children||[]).map((n,r)=>(0,Q.jsxs)(BP,{gutter:8,align:`middle`,children:[(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(LN,{addonBefore:`key`,value:n.key,maxLength:64,placeholder:`传给 AI 的字段名`,disabled:v9(e.key,n.key),onChange:e=>N(t,r,{key:e.target.value})})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(LN,{addonBefore:`label`,value:n.label,maxLength:64,placeholder:`后台显示名称`,onChange:e=>N(t,r,{label:e.target.value})})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsx)(Sb,{value:n.type,options:g9.filter(e=>e.value!==`object`&&e.value!==`flow`),style:{width:`100%`},disabled:v9(e.key,n.key),onChange:e=>N(t,r,{type:e})})}),(0,Q.jsx)(nj,{span:2,children:(0,Q.jsxs)(OM,{children:[`启用`,(0,Q.jsx)(aF,{checked:v9(e.key,n.key)?!0:n.enabled,disabled:v9(e.key,n.key),onChange:e=>N(t,r,{enabled:e})})]})}),(0,Q.jsx)(nj,{span:2,children:(0,Q.jsxs)(OM,{children:[`编辑`,(0,Q.jsx)(aF,{checked:v9(e.key,n.key)?!1:n.editable,disabled:v9(e.key,n.key),onChange:e=>N(t,r,{editable:e})})]})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsx)(Ej,{min:1,max:2e4,value:n.maxLength,addonBefore:`长度`,style:{width:`100%`},onChange:e=>N(t,r,{maxLength:Number(e||1e3)})})}),(0,Q.jsx)(nj,{span:5,children:(0,Q.jsx)(LN,{value:Array.isArray(n.value)?n.value.join(`/`):String(n.value??``),maxLength:n.maxLength||1e3,placeholder:`默认值`,onChange:e=>N(t,r,{value:n.type===`array`?e.target.value.split(`/`).filter(Boolean):e.target.value})})}),(0,Q.jsx)(nj,{span:1,style:{textAlign:`right`},children:(0,Q.jsx)(XS,{danger:!0,size:`small`,icon:(0,Q.jsx)(wR,{}),disabled:v9(e.key,n.key),onClick:()=>P(t,r)})})]},`child-${t}-${r}`))})}),e.type===`flow`&&(0,Q.jsxs)(NA,{size:`small`,title:`流程数组对象字段`,extra:(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(cA,{}),onClick:()=>F(t),children:`新增流程字段`}),children:[(0,Q.jsxs)(BP,{gutter:12,style:{marginBottom:12},children:[(0,Q.jsx)(nj,{span:6,children:(0,Q.jsx)(LN,{addonBefore:`内容字段`,value:e.contentKey,maxLength:64,onChange:e=>A(t,{contentKey:e.target.value})})}),(0,Q.jsx)(nj,{span:18,children:(0,Q.jsx)(LN,{addonBefore:`别名 / 分隔`,value:(e.contentAliases||[]).join(`/`),onChange:e=>A(t,{contentAliases:e.target.value.split(`/`).map(e=>e.trim()).filter(Boolean)})})})]}),(0,Q.jsx)(OM,{direction:`vertical`,style:{width:`100%`},children:(e.itemFields||[]).map((e,n)=>(0,Q.jsxs)(BP,{gutter:8,align:`middle`,children:[(0,Q.jsx)(nj,{span:5,children:(0,Q.jsx)(LN,{addonBefore:`key`,value:e.key,maxLength:64,placeholder:`流程对象字段名`,onChange:e=>I(t,n,{key:e.target.value})})}),(0,Q.jsx)(nj,{span:5,children:(0,Q.jsx)(LN,{addonBefore:`label`,value:e.label,maxLength:64,placeholder:`后台显示名称`,onChange:e=>I(t,n,{label:e.target.value})})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsxs)(OM,{children:[`启用`,(0,Q.jsx)(aF,{checked:e.enabled,onChange:e=>I(t,n,{enabled:e})})]})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsxs)(OM,{children:[`编辑`,(0,Q.jsx)(aF,{checked:e.editable,onChange:e=>I(t,n,{editable:e})})]})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(Ej,{min:1,max:2e4,value:e.maxLength,addonBefore:`长度`,style:{width:`100%`},onChange:e=>I(t,n,{maxLength:Number(e||800)})})}),(0,Q.jsx)(nj,{span:3,children:(0,Q.jsx)(LN,{value:String(e.value??``),maxLength:e.maxLength||800,placeholder:`默认值`,onChange:e=>I(t,n,{value:e.target.value})})}),(0,Q.jsx)(nj,{span:1,style:{textAlign:`right`},children:(0,Q.jsx)(XS,{danger:!0,size:`small`,icon:(0,Q.jsx)(wR,{}),onClick:()=>L(t,n)})})]},`flow-${t}-${n}`))})]}),e.type!==`object`&&e.type!==`flow`&&(0,Q.jsx)(NA,{size:`small`,title:`默认值`,children:(0,Q.jsx)(h9,{rows:3,value:Array.isArray(e.value)?e.value.join(` `):String(e.value??``),maxLength:e.maxLength||1e3,showCount:!0,onChange:n=>A(t,{value:e.type===`array`?n.target.value.split(` `).filter(Boolean):n.target.value})})})]})})),[v]);return e||!c?(0,Q.jsx)(cP,{}):(0,Q.jsxs)(`div`,{style:{padding:24},children:[(0,Q.jsx)(NA,{children:(0,Q.jsxs)(OM,{direction:`vertical`,style:{width:`100%`},size:`large`,children:[(0,Q.jsxs)(BP,{justify:`space-between`,align:`middle`,children:[(0,Q.jsxs)(nj,{children:[(0,Q.jsx)(TWe,{level:3,style:{margin:0},children:`视频提词 Schema 配置`}),(0,Q.jsx)(EWe,{type:`secondary`,style:{marginBottom:0},children:`配置会被爆款开头复刻和拆镜复刻第 4 步视频 AI 提词共同复用。传给 AI 时只保留纯键值 schema,不携带显示名、启用、可编辑等管理字段。`})]}),(0,Q.jsx)(nj,{children:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(m9,{children:`启用自定义配置`}),(0,Q.jsx)(aF,{checked:i,onChange:a}),o&&(0,Q.jsx)(xR,{color:`orange`,children:`当前使用默认配置兜底`}),u&&(0,Q.jsxs)(xR,{children:[`默认分组 `,u.sections.length]})]})})]}),(0,Q.jsx)(cf,{type:`info`,showIcon:!0,message:`长度限制策略`,description:`只对管理后台字段和用户可编辑字段做长度校验,不会自动裁剪 AI 生成结果或第 5 步最终视频 prompt。若供应商因为 prompt 过长拒绝,会按真实失败进入现有日志/退款/重试流程。`}),(0,Q.jsx)(cf,{type:`warning`,showIcon:!0,message:`预览说明`,description:`预览会跟随右上角「启用自定义配置」开关。关闭时会按默认 CLIENT_SCHEMA_V1 兜底预览;打开后才会按当前页面编辑的 sections 和秒数切片规则预览。`}),(0,Q.jsxs)(OM,{wrap:!0,children:[(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(W2,{}),loading:n,onClick:S,children:`保存配置`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(ON,{}),onClick:D,children:`预览运行时 Schema`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(lB,{}),onClick:T,children:`导出 JSON`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(P6,{}),onClick:()=>_.current?.click(),children:`导入 JSON`}),(0,Q.jsx)(wP,{title:`确认恢复默认配置?`,description:`会用 CLIENT_SCHEMA_V1 生成的默认配置覆盖当前配置。`,onConfirm:w,children:(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),children:`恢复默认`})}),(0,Q.jsx)(`input`,{ref:_,type:`file`,accept:`application/json,.json`,style:{display:`none`},onChange:E})]}),(0,Q.jsx)(jA,{items:[{key:`fields`,label:`Schema 字段配置`,children:(0,Q.jsxs)(OM,{direction:`vertical`,style:{width:`100%`},size:`middle`,children:[(0,Q.jsx)(cf,{type:`warning`,showIcon:!0,message:`字段说明`,description:`key 是最终传给 AI 和保存到 prompt_schema 的真实字段名,例如「素材理解」「动作流程」;label 只用于管理后台显示,帮助运营/管理员理解这个字段,不会传给 AI;启用关闭后该字段不会进入运行时 schema;可编辑关闭后用户在第 4 步修改时不能改这个字段。「画面属性」里的视频时长、视频比例、清晰度、帧率、推荐分辨率属于系统锁定参数,不能改 key、不能禁用、不能开放用户编辑。`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(cA,{}),onClick:k,children:`新增一级分组`}),(0,Q.jsx)(Hh,{items:W})]})},{key:`time`,label:`秒数切片规则`,children:(0,Q.jsxs)(OM,{direction:`vertical`,style:{width:`100%`},size:`middle`,children:[(0,Q.jsx)(cf,{type:`info`,showIcon:!0,message:`切片规则说明`,description:`这里决定指定视频时长会被拆成几段,以及每段的阶段名称和说明。运行时会同步生成「动态时间规划」「动作流程」「镜头流程」三个数组,三者时间段保持一致。`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(cA,{}),onClick:R,children:`新增秒数规则`}),y.map((e,t)=>(0,Q.jsxs)(NA,{size:`small`,title:`${e.minDuration}-${e.maxDuration} 秒:${e.segments.length} 段`,extra:(0,Q.jsx)(XS,{danger:!0,size:`small`,icon:(0,Q.jsx)(wR,{}),onClick:()=>B(t),children:`删除规则`}),children:[(0,Q.jsxs)(BP,{gutter:12,style:{marginBottom:12},children:[(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(Ej,{min:1,value:e.minDuration,addonBefore:`最小秒`,style:{width:`100%`},onChange:e=>z(t,{minDuration:Number(e||1)})})}),(0,Q.jsx)(nj,{span:4,children:(0,Q.jsx)(Ej,{min:1,value:e.maxDuration,addonBefore:`最大秒`,style:{width:`100%`},onChange:e=>z(t,{maxDuration:Number(e||1)})})}),(0,Q.jsx)(nj,{span:16,children:(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(cA,{}),onClick:()=>H(t),children:`新增片段`})})]}),(0,Q.jsx)(OM,{direction:`vertical`,style:{width:`100%`},children:e.segments.map((n,r)=>(0,Q.jsxs)(BP,{gutter:8,align:`middle`,children:[(0,Q.jsx)(nj,{span:3,children:(0,Q.jsx)(Ej,{min:.01,step:.01,value:e.ratios[r],addonBefore:`比例`,style:{width:`100%`},onChange:e=>V(t,r,{ratio:Number(e||.01)})})}),(0,Q.jsx)(nj,{span:5,children:(0,Q.jsx)(LN,{value:n.stage,maxLength:64,placeholder:`阶段`,onChange:e=>V(t,r,{stage:e.target.value})})}),(0,Q.jsx)(nj,{span:15,children:(0,Q.jsx)(LN,{value:n.description,maxLength:300,placeholder:`说明`,onChange:e=>V(t,r,{description:e.target.value})})}),(0,Q.jsx)(nj,{span:1,children:(0,Q.jsx)(XS,{danger:!0,size:`small`,icon:(0,Q.jsx)(wR,{}),onClick:()=>U(t,r)})})]},r))})]},t))]})},{key:`json`,label:`JSON 高级查看`,children:(0,Q.jsx)(h9,{rows:24,value:JSON.stringify(w9(c,i),null,2),readOnly:!0})}]})]})}),(0,Q.jsxs)(xP,{title:`预览运行时 Schema`,open:f,onCancel:()=>p(!1),width:980,footer:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(XS,{onClick:()=>p(!1),children:`关闭`}),(0,Q.jsx)(XS,{type:`primary`,onClick:O,children:`生成预览`})]}),children:[(0,Q.jsxs)(X,{form:g,layout:`inline`,style:{marginBottom:16},children:[(0,Q.jsx)(X.Item,{name:`duration`,label:`时长`,rules:[{required:!0}],children:(0,Q.jsx)(Ej,{min:1,max:3600})}),(0,Q.jsx)(X.Item,{name:`aspectRatio`,label:`比例`,rules:[{required:!0}],children:(0,Q.jsx)(LN,{})}),(0,Q.jsx)(X.Item,{name:`resolution`,label:`清晰度`,rules:[{required:!0}],children:(0,Q.jsx)(LN,{})}),(0,Q.jsx)(X.Item,{name:`frameRate`,label:`帧率`,rules:[{required:!0}],children:(0,Q.jsx)(LN,{})})]}),(0,Q.jsx)(mue,{}),m?(0,Q.jsx)(jA,{items:[{key:`runtime`,label:`运行时 Schema`,children:(0,Q.jsx)(h9,{rows:24,value:JSON.stringify(T9(m),null,2),readOnly:!0})},{key:`timePlan`,label:`动态时间规划(${E9(m).length} 段)`,children:(0,Q.jsx)(h9,{rows:24,value:JSON.stringify(E9(m),null,2),readOnly:!0})},{key:`snapshot`,label:`配置快照`,children:(0,Q.jsx)(h9,{rows:24,value:JSON.stringify(jWe(m),null,2),readOnly:!0})}]}):(0,Q.jsx)(cf,{type:`info`,showIcon:!0,message:`点击生成预览后,可以看到传给 AI 的纯 schema、动态时间规划和本次配置快照。`})]})]})},FWe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(0),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(1),[c,l]=(0,C.useState)(10),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(null),[m,h]=(0,C.useState)(!1),{user:g}=S5(),_=async()=>{if(g?.isAdmin){a(!0);try{let e=new URLSearchParams;e.set(`page`,String(o)),e.set(`page_size`,String(c)),u!==null&&e.set(`is_handled`,String(u));let n=await X8.get(`/contact/requests?${e.toString()}`);t(n.items),r(n.total)}catch(e){yP.error(e?.message||`获取失败`)}finally{a(!1)}}};(0,C.useEffect)(()=>{_()},[o,c,u]);let v=async e=>{try{await X8.put(`/contact/requests/${e}/handle`),yP.success(`已标记为处理`),_()}catch(e){yP.error(e?.message||`操作失败`)}},y=async e=>{try{await X8.delete(`/contact/requests/${e}`),yP.success(`已删除`),_()}catch(e){yP.error(e?.message||`删除失败`)}},b=e=>{p(e),h(!0)};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(NA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(t1,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`联系请求管理`}),(0,Q.jsxs)(xR,{color:`purple`,children:[`共 `,n,` 条记录`]})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,Q.jsx)(XS,{type:u===null?`primary`:`default`,onClick:()=>d(null),icon:(0,Q.jsx)(BX,{}),size:`small`,children:`全部`}),(0,Q.jsx)(XS,{type:u===!1?`primary`:`default`,onClick:()=>d(!1),size:`small`,children:`待处理`}),(0,Q.jsx)(XS,{type:u===!0?`primary`:`default`,onClick:()=>d(!0),size:`small`,children:`已处理`})]})]}),i?(0,Q.jsx)(`div`,{style:{textAlign:`center`,padding:40},children:`加载中...`}):e.length===0?(0,Q.jsx)(Ky,{description:`暂无联系请求`,style:{padding:`40px 0`}}):(0,Q.jsx)(cR,{columns:[{title:`姓名`,dataIndex:`name`,key:`name`,width:100,render:e=>(0,Q.jsx)(Z.Text,{strong:!0,children:e})},{title:`手机号`,dataIndex:`phone`,key:`phone`,width:120},{title:`公司名称`,dataIndex:`companyName`,key:`companyName`,width:150,ellipsis:!0},{title:`行业`,dataIndex:`industry`,key:`industry`,width:120},{title:`状态`,dataIndex:`isHandled`,key:`isHandled`,width:80,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`orange`,children:e?`已处理`:`待处理`})},{title:`提交时间`,dataIndex:`createdAt`,key:`createdAt`,width:160,render:e=>E5(e)},{title:`操作`,key:`actions`,width:180,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(ON,{}),onClick:()=>b(t),children:`查看`}),!t.isHandled&&(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(db,{}),onClick:()=>v(t.id),children:`标记处理`}),(0,Q.jsx)(wP,{title:`确定删除该记录?`,onConfirm:()=>y(t.id),children:(0,Q.jsx)(XS,{type:`link`,danger:!0,size:`small`,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:i,pagination:{current:o,pageSize:c,total:n,onChange:(e,t)=>{s(e),l(t)},showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`},scroll:{x:900}})]}),(0,Q.jsx)(xP,{title:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(ON,{}),`联系请求详情`]}),open:m,onCancel:()=>h(!1),footer:null,width:500,children:f&&(0,Q.jsxs)(`div`,{style:{padding:8},children:[(0,Q.jsxs)(`div`,{style:{marginBottom:16},children:[(0,Q.jsxs)(Z.Title,{level:4,style:{marginBottom:16},children:[f.name,(0,Q.jsx)(xR,{color:f.isHandled?`green`:`orange`,style:{marginLeft:12},children:f.isHandled?`已处理`:`待处理`})]}),(0,Q.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`120px 1fr`,gap:12},children:[(0,Q.jsx)(Z.Text,{style:{color:`#64748b`},children:`手机号:`}),(0,Q.jsx)(Z.Text,{children:f.phone}),(0,Q.jsx)(Z.Text,{style:{color:`#64748b`},children:`公司名称:`}),(0,Q.jsx)(Z.Text,{children:f.companyName}),(0,Q.jsx)(Z.Text,{style:{color:`#64748b`},children:`行业:`}),(0,Q.jsx)(Z.Text,{children:f.industry}),(0,Q.jsx)(Z.Text,{style:{color:`#64748b`},children:`提交时间:`}),(0,Q.jsx)(Z.Text,{children:E5(f.createdAt)}),f.message&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Z.Text,{style:{color:`#64748b`},children:`留言:`}),(0,Q.jsx)(Z.Text,{children:f.message})]})]})]}),(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[!f.isHandled&&(0,Q.jsx)(XS,{type:`primary`,onClick:()=>{v(f.id),h(!1)},icon:(0,Q.jsx)(db,{}),children:`标记为已处理`}),(0,Q.jsx)(XS,{onClick:()=>h(!1),children:`关闭`})]})]})})]})},O9=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``).replace(/\/api\/?$/i,``).replace(/\/$/,``),IWe=e=>/^(https?:)?\/\//i.test(e)||/^(blob|data):/i.test(e),k9=e=>{if(!e)return``;let t=String(e).trim();return t?IWe(t)?t:O9?`${O9}${t.startsWith(`/`)?t:`/${t}`}`:t.startsWith(`/`)?t:`/${t}`:``},LWe=360,A9=280;function j9(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,e)):t}function RWe(e,t){let n=Math.max(0,e);if(!n)return{width:0,height:A9};if(!t?.width||!t?.height)return{width:n,height:A9};let r=Math.min(n/t.width,LWe/t.height);return{width:Math.max(1,Math.round(t.width*r)),height:Math.max(1,Math.round(t.height*r))}}function zWe(e,t){if(e.sizeMode===`px`&&e.widthPx)return j9(e.widthPx,1,Math.max(1,t));let n=j9(e.widthRatio??.18,.01,1);return Math.max(1,t*n)}function BWe(e){let t=e.marginX??24,n=e.marginY??24;switch(e.position){case`top_left`:return{left:t,top:n};case`top_center`:return{left:`50%`,top:n,transform:`translateX(-50%)`};case`top_right`:return{right:t,top:n};case`middle_left`:return{left:t,top:`50%`,transform:`translateY(-50%)`};case`center`:return{left:`50%`,top:`50%`,transform:`translate(-50%, -50%)`};case`middle_right`:return{right:t,top:`50%`,transform:`translateY(-50%)`};case`bottom_left`:return{left:t,bottom:n};case`bottom_center`:return{left:`50%`,bottom:n,transform:`translateX(-50%)`};default:return{right:t,bottom:n}}}function VWe(e){let t=e.textWatermark;return!t||!t.text?.trim()?null:{text:t.text.trim(),opacity_level:t.opacityLevel,font_size_px:t.fontSizePx,color:t.color,rotate_deg:t.rotateDeg,gap_x:t.gapX,gap_y:t.gapY,staggered:t.staggered}}var HWe=({mediaUrl:e,mediaType:t=`image`,watermarkUrl:n,config:r,onChange:i})=>{let a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useRef)({x:0,y:0}),l=(0,C.useRef)(0),[u,d]=(0,C.useState)(0),[f,p]=(0,C.useState)(null),[m,h]=(0,C.useState)({width:0,height:0}),[g,_]=(0,C.useState)(!1),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(!1),[S,w]=(0,C.useState)(``),T=(0,C.useMemo)(()=>k9(e),[e]),E=(0,C.useMemo)(()=>k9(n),[n]),D=(0,C.useMemo)(()=>RWe(u,f),[u,f]),O=(0,C.useMemo)(()=>zWe(r,D.width),[r,D.width]),k=r.watermarkType===`repeated_text`;(0,C.useLayoutEffect)(()=>{if(!a.current)return;let e=()=>d(a.current?.clientWidth||0);e();let t=new ResizeObserver(e);return t.observe(a.current),()=>t.disconnect()},[]),(0,C.useLayoutEffect)(()=>{if(!s.current)return;let e=()=>{let e=s.current?.getBoundingClientRect();e&&h({width:e.width,height:e.height})};e();let t=new ResizeObserver(e);return t.observe(s.current),()=>t.disconnect()},[E,O]),(0,C.useEffect)(()=>{p(null),y(``),w(``)},[T,t]),(0,C.useEffect)(()=>{if(!k){y(``),x(!1),w(``);return}let e=VWe(r);if(!f?.width||!f.height||!e){y(``);return}let t=++l.current;x(!0),w(``);let n=window.setTimeout(async()=>{try{let n=await sHe({width:f.width,height:f.height,text_watermark:e});l.current===t&&y(n.previewLayerDataUrl)}catch(e){l.current===t&&(y(``),w(e instanceof Error?e.message:`文字水印预览生成失败`))}finally{l.current===t&&x(!1)}},300);return()=>window.clearTimeout(n)},[r,k,f]),(0,C.useEffect)(()=>{let e=e=>{if(!g||!o.current||!i||k)return;let t=o.current.getBoundingClientRect(),n=m.width||O,r=m.height||1,a=Math.max(1,t.width-n),s=Math.max(1,t.height-r),l=j9(e.clientX-t.left-c.current.x,0,a),u=j9(e.clientY-t.top-c.current.y,0,s);i({position:`custom`,customXRatio:Number((l/a).toFixed(4)),customYRatio:Number((u/s).toFixed(4))})},t=()=>_(!1);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[g,k,i,m.height,m.width,O]);let A=(0,C.useMemo)(()=>{if(r.position!==`custom`)return BWe(r);let e=m.width||O,t=m.height||1,n=Math.max(0,D.width-e),i=Math.max(0,D.height-t),a=j9(r.customXRatio??.5,0,1),o=j9(r.customYRatio??.5,0,1);return{left:n*a,top:i*o,transform:`none`}},[r,D.height,D.width,m.height,m.width,O]);return(0,Q.jsx)(`div`,{ref:a,style:{position:`relative`,width:`100%`,minHeight:Math.max(A9,D.height),background:`#0f172a`,borderRadius:12,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#94a3b8`},children:T?(0,Q.jsxs)(`div`,{ref:o,style:{position:`relative`,width:D.width||`100%`,height:D.height||A9,maxWidth:`100%`,overflow:`hidden`,background:`#000`},children:[t===`video`?(0,Q.jsx)(`video`,{src:T,controls:!0,onLoadedMetadata:e=>{let t=e.currentTarget;t.videoWidth&&t.videoHeight&&p({width:t.videoWidth,height:t.videoHeight})},style:{width:`100%`,height:`100%`,objectFit:`fill`,display:`block`}}):(0,Q.jsx)(`img`,{src:T,alt:`素材预览`,onLoad:e=>{let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&p({width:t.naturalWidth,height:t.naturalHeight})},style:{width:`100%`,height:`100%`,objectFit:`fill`,display:`block`}}),k&&v&&(0,Q.jsx)(`img`,{src:v,alt:`重复文字水印预览`,draggable:!1,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`,objectFit:`fill`,zIndex:2,pointerEvents:`none`,userSelect:`none`}}),k&&(b||S)&&(0,Q.jsx)(`div`,{style:{position:`absolute`,left:12,bottom:12,zIndex:3,padding:`6px 10px`,borderRadius:8,background:`rgba(15, 23, 42, 0.82)`,color:`#e2e8f0`,fontSize:12},children:b?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cP,{size:`small`}),` 正在生成精准预览...`]}):S}),!k&&E&&(0,Q.jsx)(`img`,{ref:s,src:E,alt:`水印预览`,draggable:!1,onLoad:e=>{let t=e.currentTarget.getBoundingClientRect();h({width:t.width,height:t.height})},onPointerDown:e=>{if(!i)return;e.preventDefault();let t=e.currentTarget.getBoundingClientRect();c.current={x:e.clientX-t.left,y:e.clientY-t.top},_(!0)},style:{position:`absolute`,zIndex:2,cursor:i?`move`:`default`,width:O,opacity:(r.opacityLevel??6)/10,userSelect:`none`,touchAction:`none`,pointerEvents:i?`auto`:`none`,...A}})]}):(0,Q.jsx)(`span`,{children:`上传素材后可预览水印效果`})})},UWe=[{label:`左上角`,value:`top_left`},{label:`顶部居中`,value:`top_center`},{label:`右上角`,value:`top_right`},{label:`左侧居中`,value:`middle_left`},{label:`正中间`,value:`center`},{label:`右侧居中`,value:`middle_right`},{label:`左下角`,value:`bottom_left`},{label:`底部居中`,value:`bottom_center`},{label:`右下角`,value:`bottom_right`},{label:`拖拽自定义`,value:`custom`}],M9={text:`民众普康 AI`,opacityLevel:2,fontSizePx:28,color:`#ffffff`,rotateDeg:-30,gapX:220,gapY:140,staggered:!0},N9=({value:e,onChange:t,watermarks:n,mediaUrl:r,mediaType:i})=>{let a=n=>t({...e,...n}),o=t=>{a({textWatermark:{...M9,...e.textWatermark||{},...t}})},s=n.find(t=>t.id===e.watermarkId)?.fileUrl,c={...M9,...e.textWatermark||{}};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(X,{layout:`vertical`,children:[(0,Q.jsx)(X.Item,{label:`水印类型`,required:!0,children:(0,Q.jsxs)(Ik.Group,{value:e.watermarkType||`image`,onChange:e=>{let t=e.target.value;a({watermarkType:t,textWatermark:t===`repeated_text`?c:null})},children:[(0,Q.jsx)(Ik.Button,{value:`image`,children:`图片水印`}),(0,Q.jsx)(Ik.Button,{value:`repeated_text`,children:`重复文字水印`})]})}),e.watermarkType===`repeated_text`?(0,Q.jsxs)(BP,{gutter:16,children:[(0,Q.jsx)(nj,{span:24,children:(0,Q.jsx)(X.Item,{label:`水印文字`,required:!0,extra:`字体由后端固定开源可商用字体渲染,前端预览层和最终生成使用同一后端渲染逻辑。`,children:(0,Q.jsx)(LN,{maxLength:64,showCount:!0,value:c.text,onChange:e=>o({text:e.target.value}),placeholder:`请输入重复水印文字`})})}),(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`文字透明度:${c.opacityLevel}/10`,required:!0,children:(0,Q.jsx)(Jj,{min:1,max:10,step:1,value:c.opacityLevel,onChange:e=>o({opacityLevel:e})})})}),(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`字号(px)`,required:!0,children:(0,Q.jsx)(Ej,{min:8,max:160,style:{width:`100%`},value:c.fontSizePx,onChange:e=>o({fontSizePx:Number(e||28)})})})}),(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`文字颜色`,required:!0,children:(0,Q.jsx)(LN,{value:c.color,onChange:e=>o({color:e.target.value||`#ffffff`}),placeholder:`#ffffff`})})}),(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`旋转角度`,required:!0,children:(0,Q.jsx)(Ej,{min:-90,max:90,style:{width:`100%`},value:c.rotateDeg,onChange:e=>o({rotateDeg:Number(e??-30)})})})}),(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`横向间距`,required:!0,children:(0,Q.jsx)(Ej,{min:20,max:2e3,style:{width:`100%`},value:c.gapX,onChange:e=>o({gapX:Number(e||220)})})})}),(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`纵向间距`,required:!0,children:(0,Q.jsx)(Ej,{min:20,max:2e3,style:{width:`100%`},value:c.gapY,onChange:e=>o({gapY:Number(e||140)})})})}),(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`交错排列`,valuePropName:`checked`,children:(0,Q.jsx)(aF,{checked:c.staggered,onChange:e=>o({staggered:e})})})})]}):(0,Q.jsxs)(BP,{gutter:16,children:[(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`水印图片`,required:!0,children:(0,Q.jsx)(Sb,{placeholder:`请选择水印`,value:e.watermarkId||void 0,onChange:e=>a({watermarkId:e}),options:n.map(e=>({label:`${e.name}${e.isDefault?`(默认)`:``}`,value:e.id}))})})}),(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`透明度:${e.opacityLevel}/10`,required:!0,children:(0,Q.jsx)(Jj,{min:1,max:10,step:1,value:e.opacityLevel,onChange:e=>a({opacityLevel:e})})})}),(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`水印位置`,required:!0,children:(0,Q.jsx)(Sb,{value:e.position,onChange:e=>a({position:e}),options:UWe})})}),(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`大小模式`,required:!0,children:(0,Q.jsx)(Sb,{value:e.sizeMode,onChange:e=>a({sizeMode:e}),options:[{label:`按素材宽度比例`,value:`ratio`},{label:`固定像素宽度`,value:`px`}]})})}),e.sizeMode===`ratio`?(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`水印宽度比例`,required:!0,children:(0,Q.jsx)(Ej,{min:.01,max:1,step:.01,style:{width:`100%`},value:e.widthRatio??.18,onChange:e=>a({widthRatio:Number(e||.18)})})})}):(0,Q.jsx)(nj,{span:12,children:(0,Q.jsx)(X.Item,{label:`水印宽度(px)`,required:!0,children:(0,Q.jsx)(Ej,{min:1,max:1e4,style:{width:`100%`},value:e.widthPx??200,onChange:e=>a({widthPx:Number(e||200)})})})}),(0,Q.jsx)(nj,{span:6,children:(0,Q.jsx)(X.Item,{label:`横向边距`,children:(0,Q.jsx)(Ej,{min:0,max:2e3,style:{width:`100%`},value:e.marginX,onChange:e=>a({marginX:Number(e||0)})})})}),(0,Q.jsx)(nj,{span:6,children:(0,Q.jsx)(X.Item,{label:`纵向边距`,children:(0,Q.jsx)(Ej,{min:0,max:2e3,style:{width:`100%`},value:e.marginY,onChange:e=>a({marginY:Number(e||0)})})})})]})]}),(0,Q.jsx)(HWe,{mediaUrl:r,mediaType:i,watermarkUrl:s,config:e,onChange:e=>a(e)})]})},WWe={image:`图片`,video:`视频`,audio:`音频`};function P9(e){if(e.type.startsWith(`image/`))return`image`;if(e.type.startsWith(`video/`))return`video`;if(e.type.startsWith(`audio/`))return`audio`;let t=e.name.toLowerCase();return/\.(jpg|jpeg|png|webp|gif)$/.test(t)?`image`:/\.(mp4|mov|m4v|webm)$/.test(t)?`video`:/\.(mp3|wav|m4a|aac)$/.test(t)?`audio`:null}function GWe(e,t){return t!==`video`&&t!==`audio`?Promise.resolve(null):new Promise(n=>{let r=URL.createObjectURL(e),i=document.createElement(t===`video`?`video`:`audio`);i.preload=`metadata`,i.onloadedmetadata=()=>{let e=Number.isFinite(i.duration)?Number(i.duration.toFixed(3)):null;URL.revokeObjectURL(r),n(e)},i.onerror=()=>{URL.revokeObjectURL(r),n(null)},i.src=r})}var F9=({value:e,onChange:t,disabled:n})=>{let r=(0,C.useMemo)(()=>e||[],[e]),[i,a]=(0,C.useState)(!1),o=(e,n)=>{t(r.map((t,r)=>r===e?{...t,...n}:t))},s=e=>{t(r.filter((t,n)=>n!==e))},c=async e=>{let n=P9(e);if(!n||![`image`,`video`,`audio`].includes(n))return yP.warning(`附件仅支持图片、视频、音频`),hB.LIST_IGNORE;a(!0);try{let i=await GWe(e,n),a=(await r5(e,{scene:`home_material_reference`,resourceType:n,durationSeconds:i})).mediaReference;if(!a||![`image`,`video`,`audio`].includes(a.type))throw Error(`上传返回附件格式异常`);t([...r,{url:a.url,type:a.type,name:a.name||e.name,duration:a.duration??i,source:a.source,uploadResourceId:a.uploadResourceId,displayUrl:a.displayUrl||a.url,previewUrl:a.previewUrl||a.displayUrl||a.url,role:a.role||`reference_${a.type}`}]),yP.success(`附件上传成功`)}catch(e){yP.error(e?.message||`附件上传失败`)}finally{a(!1)}return hB.LIST_IGNORE};return(0,Q.jsxs)(OM,{direction:`vertical`,style:{width:`100%`},size:12,children:[(0,Q.jsx)(hB,{beforeUpload:e=>c(e),showUploadList:!1,disabled:n||i,accept:`image/*,video/*,audio/*`,children:(0,Q.jsx)(XS,{icon:(0,Q.jsx)(P6,{}),loading:i,disabled:n||i,children:`上传附件`})}),r.length===0?(0,Q.jsx)(`div`,{style:{color:`#999`,fontSize:13},children:`暂无附件。可上传图片、视频、音频,保存后会随前台素材接口返回。`}):(0,Q.jsx)(OM,{direction:`vertical`,style:{width:`100%`},size:10,children:r.map((e,t)=>{let r=k9(e.previewUrl||e.displayUrl||e.url),i=k9(e.displayUrl||e.url);return(0,Q.jsx)(NA,{size:`small`,bodyStyle:{padding:12},children:(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:12,alignItems:`flex-start`},children:[(0,Q.jsxs)(`div`,{style:{width:120,minHeight:72,flexShrink:0,borderRadius:8,overflow:`hidden`,background:`#f6f7fb`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[e.type===`image`&&(0,Q.jsx)(CN,{width:120,height:72,style:{objectFit:`cover`},src:r}),e.type===`video`&&(0,Q.jsx)(`video`,{src:i,style:{width:120,height:72,objectFit:`cover`,background:`#000`},controls:!0}),e.type===`audio`&&(0,Q.jsx)(`audio`,{src:i,controls:!0,style:{width:112}})]}),(0,Q.jsxs)(OM,{direction:`vertical`,style:{flex:1,minWidth:0},size:8,children:[(0,Q.jsxs)(OM,{wrap:!0,children:[(0,Q.jsx)(xR,{color:e.type===`image`?`blue`:e.type===`video`?`purple`:`green`,children:WWe[e.type]||e.type}),e.uploadResourceId&&(0,Q.jsxs)(xR,{children:[`资源ID:`,e.uploadResourceId]})]}),(0,Q.jsx)(LN,{size:`small`,value:e.name||``,placeholder:`附件名称`,disabled:n,onChange:e=>o(t,{name:e.target.value||null})}),(0,Q.jsx)(LN,{size:`small`,value:e.role||``,placeholder:`附件角色,如 reference_image`,disabled:n,onChange:e=>o(t,{role:e.target.value||null})}),(e.type===`video`||e.type===`audio`)&&(0,Q.jsx)(Ej,{size:`small`,min:0,precision:3,style:{width:180},value:e.duration??null,placeholder:`时长(秒)`,disabled:n,onChange:e=>o(t,{duration:e===null?null:Number(e)})}),(0,Q.jsx)(LN,{size:`small`,value:e.url,disabled:!0})]}),(0,Q.jsx)(XS,{danger:!0,size:`small`,icon:(0,Q.jsx)(wR,{}),disabled:n,onClick:()=>s(t),children:`删除`})]})},`${e.url}-${t}`)})})]})},I9={draft:{text:`草稿`,color:`default`},processing:{text:`处理中`,color:`processing`},success:{text:`成功`,color:`success`},failed:{text:`失败`,color:`error`}},L9={text:`民众普康 AI`,opacityLevel:2,fontSizePx:28,color:`#ffffff`,rotateDeg:-30,gapX:220,gapY:140,staggered:!0},KWe={watermarkType:`image`,watermarkId:null,opacityLevel:6,position:`bottom_right`,customXRatio:null,customYRatio:null,sizeMode:`ratio`,widthRatio:.18,widthPx:null,marginX:24,marginY:24,textWatermark:L9},qWe={image:`图片`,video:`视频`,audio:`音频`};function JWe(e){return{text:e?.text||L9.text,opacityLevel:e?.opacityLevel??e?.opacity_level??L9.opacityLevel,fontSizePx:e?.fontSizePx??e?.font_size_px??L9.fontSizePx,color:e?.color||L9.color,rotateDeg:e?.rotateDeg??e?.rotate_deg??L9.rotateDeg,gapX:e?.gapX??e?.gap_x??L9.gapX,gapY:e?.gapY??e?.gap_y??L9.gapY,staggered:e?.staggered??L9.staggered}}function R9(e,t){let n=e||{},r=n.watermarkType||n.watermark_type||`image`;return{watermarkType:r,watermarkId:r===`repeated_text`?null:n.watermarkId||n.watermark_id||t||null,opacityLevel:n.opacityLevel||n.opacity_level||6,position:n.position||`bottom_right`,customXRatio:n.customXRatio??n.custom_x_ratio??null,customYRatio:n.customYRatio??n.custom_y_ratio??null,sizeMode:n.sizeMode||n.size_mode||`ratio`,widthRatio:n.widthRatio??n.width_ratio??.18,widthPx:n.widthPx??n.width_px??null,marginX:n.marginX??n.margin_x??24,marginY:n.marginY??n.margin_y??24,textWatermark:JWe(n.textWatermark||n.text_watermark)}}function z9(e){return e.watermarkType===`repeated_text`?!!e.textWatermark?.text?.trim():!!e.watermarkId}function YWe(e,t=48){let n=(e||``).trim();return n?n.length>t?`${n.slice(0,t)}...`:n:``}function XWe(e){let t=e||[];return t.length===0?(0,Q.jsx)(Z.Text,{type:`secondary`,children:`暂无附件`}):(0,Q.jsx)(OM,{direction:`vertical`,style:{width:`100%`},size:12,children:t.map((e,t)=>{let n=k9(e.displayUrl||e.url),r=k9(e.previewUrl||e.displayUrl||e.url);return(0,Q.jsxs)(`div`,{style:{border:`1px solid #f0f0f5`,borderRadius:8,padding:12,display:`flex`,gap:12},children:[(0,Q.jsxs)(`div`,{style:{width:140,minHeight:80,flexShrink:0,background:`#f6f7fb`,borderRadius:8,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[e.type===`image`&&(0,Q.jsx)(CN,{width:140,height:80,style:{objectFit:`cover`},src:r}),e.type===`video`&&(0,Q.jsx)(`video`,{src:n,controls:!0,style:{width:140,height:80,objectFit:`cover`,background:`#000`}}),e.type===`audio`&&(0,Q.jsx)(`audio`,{src:n,controls:!0,style:{width:132}})]}),(0,Q.jsxs)(OM,{direction:`vertical`,size:6,style:{flex:1,minWidth:0},children:[(0,Q.jsxs)(OM,{wrap:!0,children:[(0,Q.jsx)(xR,{children:qWe[e.type]||e.type}),e.duration!==void 0&&e.duration!==null&&(0,Q.jsxs)(xR,{children:[e.duration,`s`]}),e.role&&(0,Q.jsx)(xR,{children:e.role})]}),(0,Q.jsx)(Z.Text,{strong:!0,children:e.name||`未命名附件`}),(0,Q.jsx)(Z.Text,{copyable:!0,ellipsis:!0,style:{maxWidth:620},children:e.url})]})]},`${e.url}-${t}`)})})}var ZWe=({categories:e,watermarks:t,reloadKey:n})=>{let[r,i]=(0,C.useState)([]),[a,o]=(0,C.useState)(0),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)({page:1,pageSize:20}),[d,f]=(0,C.useState)(null),[p,m]=(0,C.useState)(null),[h,g]=(0,C.useState)(KWe),[_,v]=(0,C.useState)(!1),[y,b]=(0,C.useState)(null),[x,S]=(0,C.useState)(``),[w,T]=(0,C.useState)([]),[E,D]=(0,C.useState)(!1),O=async()=>{c(!0);try{let e=await nHe(l);i(e.items),o(e.total)}finally{c(!1)}};(0,C.useEffect)(()=>{O()},[l,n]),(0,C.useEffect)(()=>{let e=r.filter(e=>e.status===`processing`);if(e.length===0)return;let t=window.setInterval(async()=>{(await Promise.all(e.map(e=>rHe(e.id).catch(()=>null)))).some(e=>e&&e.status!==`processing`)&&O()},2500);return()=>window.clearInterval(t)},[r]);let k=e=>{m(e),g(R9(e.watermarkConfig,e.watermarkId))},A=e=>{b(e),S(e.generationPrompt||``),T(e.mediaReferences||[])},j=e=>e.mediaType===`image`?k9(e.watermarkedUrl||e.originalUrl):k9(e.coverUrl||``),M=e=>k9(e.watermarkedUrl||e.originalUrl),N=e=>{xP.confirm({title:`确认删除该素材?`,content:e.title||e.id,okText:`删除`,okButtonProps:{danger:!0},cancelText:`取消`,async onOk(){await lHe(e.id),yP.success(`删除成功`),await O()}})};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(OM,{style:{marginBottom:16},wrap:!0,children:[(0,Q.jsx)(Sb,{allowClear:!0,style:{width:180},placeholder:`行业`,value:l.categoryId,onChange:e=>u(t=>({...t,categoryId:e,page:1})),options:e.map(e=>({label:e.name,value:e.id}))}),(0,Q.jsx)(Sb,{allowClear:!0,style:{width:140},placeholder:`素材类型`,value:l.mediaType,onChange:e=>u(t=>({...t,mediaType:e,page:1})),options:[{label:`图片`,value:`image`},{label:`视频`,value:`video`}]}),(0,Q.jsx)(Sb,{allowClear:!0,style:{width:140},placeholder:`处理状态`,value:l.status,onChange:e=>u(t=>({...t,status:e,page:1})),options:Object.entries(I9).map(([e,t])=>({value:e,label:t.text}))}),(0,Q.jsx)(XS,{onClick:O,children:`刷新`})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:s,dataSource:r,pagination:{current:l.page,pageSize:l.pageSize,total:a,onChange:(e,t)=>u(n=>({...n,page:e,pageSize:t}))},scroll:{x:1380},columns:[{title:`预览`,width:110,render:(e,t)=>{let n=j(t);if(t.mediaType===`image`)return n?(0,Q.jsx)(CN,{width:86,height:64,style:{objectFit:`cover`,borderRadius:6},src:n}):`-`;let r=M(t),i=k9(t.coverUrl||``);return r?(0,Q.jsx)(`video`,{src:r,poster:i||void 0,muted:!0,preload:`metadata`,style:{width:100,height:64,objectFit:`cover`,borderRadius:6,background:`#000`}}):`-`}},{title:`标题`,dataIndex:`title`,render:e=>e||(0,Q.jsx)(`span`,{style:{color:`#999`},children:`未命名素材`})},{title:`行业`,dataIndex:`categoryName`},{title:`类型`,dataIndex:`mediaType`,render:e=>e===`image`?`图片`:`视频`},{title:`状态`,dataIndex:`status`,render:e=>(0,Q.jsx)(xR,{color:I9[e]?.color,children:I9[e]?.text||e})},{title:`生成提词`,width:210,render:(e,t)=>t.generationPrompt?(0,Q.jsx)(fx,{title:t.generationPrompt,children:(0,Q.jsx)(Z.Text,{children:YWe(t.generationPrompt)})}):(0,Q.jsx)(Z.Text,{type:`secondary`,children:`未设置`})},{title:`附件`,width:90,render:(e,t)=>(0,Q.jsx)(xR,{color:(t.mediaReferences?.length||0)>0?`blue`:`default`,children:t.mediaReferences?.length||0})},{title:`水印`,render:(e,t)=>R9(t.watermarkConfig,t.watermarkId).watermarkType===`repeated_text`?`重复文字水印`:t.watermarkName||`图片水印`},{title:`排序`,dataIndex:`sortOrder`},{title:`错误`,dataIndex:`errorMessage`,ellipsis:!0},{title:`操作`,width:170,align:`center`,render:(e,t)=>(0,Q.jsxs)(OM,{size:8,children:[(0,Q.jsx)(XS,{size:`small`,onClick:()=>f(t),children:`查看`}),(0,Q.jsx)(AM,{trigger:[`click`],menu:{items:[{key:`generation_config`,icon:(0,Q.jsx)(DR,{}),label:`编辑生成配置`},{key:`regenerate`,icon:(0,Q.jsx)(LP,{}),label:`重新生成水印`},{key:`delete`,icon:(0,Q.jsx)(wR,{}),label:`删除素材`,danger:!0}],onClick:({key:e})=>{e===`generation_config`&&A(t),e===`regenerate`&&k(t),e===`delete`&&N(t)}},children:(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(x1,{}),children:`更多`})})]})}]}),(0,Q.jsx)(xP,{title:`素材详情`,open:!!d,onCancel:()=>f(null),footer:null,width:960,destroyOnHidden:!0,children:d&&(0,Q.jsxs)(OM,{direction:`vertical`,style:{width:`100%`},size:`large`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`b`,{children:`原素材:`}),d.originalUrl?k9(d.originalUrl):`-`]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`b`,{children:`水印素材:`}),d.watermarkedUrl?k9(d.watermarkedUrl):`-`]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`b`,{children:`生成提词:`}),(0,Q.jsx)(`div`,{style:{marginTop:8,padding:12,borderRadius:8,background:`#f8fafc`,whiteSpace:`pre-wrap`},children:d.generationPrompt||`未设置`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`b`,{children:`附件 / 参考素材:`}),(0,Q.jsx)(`div`,{style:{marginTop:8},children:XWe(d.mediaReferences)})]}),d.mediaType===`image`?(0,Q.jsx)(CN,{src:k9(d.watermarkedUrl||d.originalUrl)}):(0,Q.jsx)(`video`,{src:M(d),poster:k9(d.coverUrl||``)||void 0,controls:!0,style:{width:`100%`,background:`#000`}})]})}),(0,Q.jsx)(xP,{title:`编辑生成配置`,open:!!y,onCancel:()=>!E&&b(null),onOk:async()=>{if(!(!y||E)){D(!0);try{await oHe(y.id,{category_id:y.categoryId,title:y.title||null,is_active:y.isActive,sort_order:y.sortOrder,generation_prompt:x.trim()||null,media_references:w}),yP.success(`生成配置已保存`),b(null),await O()}finally{D(!1)}}},confirmLoading:E,cancelButtonProps:{disabled:E},width:920,destroyOnHidden:!0,children:(0,Q.jsxs)(OM,{direction:`vertical`,style:{width:`100%`},size:16,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,children:`生成提词`}),(0,Q.jsx)(LN.TextArea,{rows:6,maxLength:8e3,showCount:!0,value:x,disabled:E,placeholder:`请输入用于生成该素材的提示词`,onChange:e=>S(e.target.value),style:{marginTop:8}})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,children:`附件 / 参考素材`}),(0,Q.jsx)(`div`,{style:{marginTop:8},children:(0,Q.jsx)(F9,{value:w,onChange:T,disabled:E})})]})]})}),(0,Q.jsx)(xP,{title:`重新生成水印`,open:!!p,onCancel:()=>!_&&m(null),onOk:async()=>{if(!(!p||_)){if(!z9(h)){yP.warning(h.watermarkType===`repeated_text`?`请输入重复文字水印内容`:`请选择水印图片`);return}v(!0);try{await cHe(p.id,{watermark_type:h.watermarkType,watermark_id:h.watermarkType===`image`?h.watermarkId:null,opacity_level:h.opacityLevel,position:h.position,custom_x_ratio:h.customXRatio,custom_y_ratio:h.customYRatio,size_mode:h.sizeMode,width_ratio:h.widthRatio,width_px:h.widthPx,margin_x:h.marginX,margin_y:h.marginY,text_watermark:h.watermarkType===`repeated_text`&&h.textWatermark?{text:h.textWatermark.text,opacity_level:h.textWatermark.opacityLevel,font_size_px:h.textWatermark.fontSizePx,color:h.textWatermark.color,rotate_deg:h.textWatermark.rotateDeg,gap_x:h.textWatermark.gapX,gap_y:h.textWatermark.gapY,staggered:h.textWatermark.staggered}:null,wait:!1}),yP.success(`已提交重新生成`),m(null),await O()}finally{v(!1)}}},confirmLoading:_,okButtonProps:{disabled:_||!z9(h)},cancelButtonProps:{disabled:_},width:980,destroyOnHidden:!0,children:p&&(0,Q.jsx)(N9,{value:h,onChange:g,watermarks:t,mediaUrl:k9(p.originalUrl||p.watermarkedUrl),mediaType:p.mediaType})})]})},QWe=mBe,$We=[{label:`通用应用`,value:`AppstoreOutlined`},{label:`图片素材`,value:`PictureOutlined`},{label:`视频素材`,value:`VideoCameraOutlined`},{label:`电商购物`,value:`ShoppingOutlined`},{label:`门店商铺`,value:`ShopOutlined`},{label:`美妆护肤`,value:`SkinOutlined`},{label:`餐饮食品`,value:`CoffeeOutlined`},{label:`家居生活`,value:`HomeOutlined`},{label:`汽车出行`,value:`CarOutlined`},{label:`医疗健康`,value:`MedicineBoxOutlined`},{label:`教育培训`,value:`BookOutlined`},{label:`数码科技`,value:`LaptopOutlined`},{label:`旅游定位`,value:`EnvironmentOutlined`},{label:`摄影影像`,value:`CameraOutlined`},{label:`礼品活动`,value:`GiftOutlined`},{label:`热门爆款`,value:`FireOutlined`},{label:`品牌服务`,value:`CustomerServiceOutlined`},{label:`营销增长`,value:`RocketOutlined`},{label:`机构企业`,value:`BankOutlined`},{label:`娱乐休闲`,value:`SmileOutlined`}];function B9(e,t){if(!e)return(0,Q.jsx)(`span`,{style:{color:`#999`},children:`未设置`});let n=QWe[e];return(0,Q.jsxs)(OM,{size:6,children:[n?(0,Q.jsx)(n,{}):null,(0,Q.jsx)(`span`,{children:t||e}),(0,Q.jsx)(`span`,{style:{color:`#999`},children:e})]})}var eGe=({onChanged:e})=>{let[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)(0),[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(1),[l,u]=(0,C.useState)(!1),[d,f]=(0,C.useState)(null),[p]=X.useForm(),m=async()=>{o(!0);try{let e=await b5({page:s,pageSize:20});n(e.items),i(e.total)}finally{o(!1)}};(0,C.useEffect)(()=>{m()},[s]);let h=e=>{f(e||null),p.setFieldsValue(e?{name:e.name,key:e.key,description:e.description,icon:e.icon,is_active:e.isActive,sort_order:e.sortOrder}:{is_active:!0,sort_order:0}),u(!0)};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`},children:[(0,Q.jsx)(`div`,{}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>h(),children:`新增行业`})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:a,dataSource:t,pagination:{current:s,total:r,pageSize:20,onChange:c},columns:[{title:`行业名称`,dataIndex:`name`},{title:`Key`,dataIndex:`key`},{title:`图标`,dataIndex:`icon`,render:e=>B9(e)},{title:`启用`,dataIndex:`isActive`,render:e=>e?`启用`:`禁用`},{title:`素材数`,dataIndex:`assetCount`},{title:`图片/视频`,render:(e,t)=>`${t.imageCount}/${t.videoCount}`},{title:`排序`,dataIndex:`sortOrder`},{title:`操作`,render:(t,n)=>(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>h(n),children:`编辑`}),(0,Q.jsx)(wP,{title:`确认删除该行业?`,onConfirm:async()=>{await QVe(n.id),yP.success(`删除成功`),await m(),e?.()},children:(0,Q.jsx)(XS,{size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}]}),(0,Q.jsx)(xP,{title:d?`编辑行业`:`新增行业`,open:l,onOk:async()=>{await ZVe({...await p.validateFields(),id:d?.id}),yP.success(`保存成功`),u(!1),await m(),e?.()},onCancel:()=>u(!1),destroyOnHidden:!0,children:(0,Q.jsxs)(X,{form:p,layout:`vertical`,children:[(0,Q.jsx)(X.Item,{name:`name`,label:`行业名称`,rules:[{required:!0,message:`请输入行业名称`}],children:(0,Q.jsx)(LN,{})}),(0,Q.jsx)(X.Item,{name:`key`,label:`行业Key`,rules:[{required:!0,message:`请输入行业Key`},{pattern:/^[A-Za-z0-9_-]+$/,message:`只允许字母、数字、下划线、中划线`}],children:(0,Q.jsx)(LN,{})}),(0,Q.jsx)(X.Item,{name:`description`,label:`描述`,children:(0,Q.jsx)(LN.TextArea,{rows:3})}),(0,Q.jsx)(X.Item,{name:`icon`,label:`图标`,children:(0,Q.jsx)(Sb,{allowClear:!0,showSearch:!0,placeholder:`请选择行业图标`,optionFilterProp:`searchText`,filterOption:(e,t)=>{let n=String(t?.searchText||``).toLowerCase(),r=String(t?.value||``).toLowerCase(),i=e.toLowerCase();return n.includes(i)||r.includes(i)},options:$We.map(e=>({value:e.value,searchText:`${e.label} ${e.value}`,label:B9(e.value,e.label)}))})}),(0,Q.jsx)(X.Item,{name:`sort_order`,label:`排序`,children:(0,Q.jsx)(Ej,{min:0,style:{width:`100%`}})}),(0,Q.jsx)(X.Item,{name:`is_active`,label:`启用`,valuePropName:`checked`,children:(0,Q.jsx)(aF,{})})]})})]})},V9={watermarkType:`image`,watermarkId:null,opacityLevel:6,position:`bottom_right`,customXRatio:null,customYRatio:null,sizeMode:`ratio`,widthRatio:.18,widthPx:null,marginX:24,marginY:24,textWatermark:{text:`民众普康 AI`,opacityLevel:2,fontSizePx:28,color:`#ffffff`,rotateDeg:-30,gapX:220,gapY:140,staggered:!0}};function tGe(e){return e.watermarkType===`repeated_text`?!!e.textWatermark?.text?.trim():!!e.watermarkId}var nGe=({open:e,onClose:t,categories:n,watermarks:r,onSuccess:i})=>{let[a]=X.useForm(),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)([]),[u,d]=(0,C.useState)(`image`),[f,p]=(0,C.useState)(V9),[m,h]=(0,C.useState)(!1),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)([]),b=()=>{s(null),l([]),d(`image`),_(``),h(!1),y([])};(0,C.useEffect)(()=>{if(e){b();let e=r.find(e=>e.isDefault)||r[0];p({...V9,watermarkId:e?.id||null}),a.setFieldsValue({media_type:`image`,is_active:!0,sort_order:0,title:void 0,generation_prompt:void 0})}},[e,r,a]),(0,C.useEffect)(()=>()=>{g.startsWith(`blob:`)&&URL.revokeObjectURL(g)},[g]);let x=(0,C.useMemo)(()=>g||void 0,[g]),S=e=>{let t=e.type.startsWith(`image/`),n=e.type.startsWith(`video/`);if(u===`image`&&!t)return yP.warning(`当前素材类型为图片,请选择图片文件`),hB.LIST_IGNORE;if(u===`video`&&!n)return yP.warning(`当前素材类型为视频,请选择视频文件`),hB.LIST_IGNORE;g.startsWith(`blob:`)&&URL.revokeObjectURL(g);let r=URL.createObjectURL(e);return s(e),_(r),l([{uid:e.name,name:e.name,status:`done`,originFileObj:e}]),!1},w=()=>{s(null),l([]),g.startsWith(`blob:`)&&URL.revokeObjectURL(g),_(``)};return(0,Q.jsxs)(xP,{title:`上传首页素材`,open:e,onCancel:()=>{m||t()},onOk:async()=>{if(m)return;let e=await a.validateFields();if(!o){yP.warning(`请选择素材文件`);return}if(f.watermarkType===`image`&&!f.watermarkId){yP.warning(`请选择水印图片`);return}if(f.watermarkType===`repeated_text`&&!f.textWatermark?.text?.trim()){yP.warning(`请输入重复文字水印内容`);return}h(!0);try{let n=await aHe({categoryId:e.category_id,file:o,mediaType:u,title:e.title?.trim()||null,generationPrompt:e.generation_prompt?.trim()||null,mediaReferences:v,watermarkType:f.watermarkType,watermarkId:f.watermarkType===`image`?f.watermarkId:null,opacityLevel:f.opacityLevel,position:f.position,customXRatio:f.customXRatio,customYRatio:f.customYRatio,sizeMode:f.sizeMode,widthRatio:f.widthRatio,widthPx:f.widthPx,marginX:f.marginX,marginY:f.marginY,textWatermark:f.watermarkType===`repeated_text`?f.textWatermark:null,isActive:e.is_active,sortOrder:e.sort_order,wait:!1});yP.success(n.message||`已提交水印处理`),i(),t()}finally{h(!1)}},confirmLoading:m,okButtonProps:{disabled:m||!o||!tGe(f)},cancelButtonProps:{disabled:m},width:980,destroyOnHidden:!0,children:[(0,Q.jsxs)(X,{form:a,layout:`vertical`,children:[(0,Q.jsx)(X.Item,{name:`category_id`,label:`行业`,rules:[{required:!0,message:`请选择行业`}],children:(0,Q.jsx)(Sb,{options:n.map(e=>({label:e.name,value:e.id})),disabled:m})}),(0,Q.jsx)(X.Item,{name:`media_type`,label:`素材类型`,rules:[{required:!0}],children:(0,Q.jsx)(Sb,{value:u,onChange:e=>{d(e),w()},disabled:m,options:[{label:`图片`,value:`image`},{label:`视频`,value:`video`}]})}),(0,Q.jsx)(X.Item,{label:`素材文件`,required:!0,children:(0,Q.jsx)(hB,{beforeUpload:e=>S(e),onRemove:w,fileList:c,maxCount:1,accept:u===`image`?`image/*`:`video/*`,disabled:m,children:(0,Q.jsxs)(XS,{icon:(0,Q.jsx)(P6,{}),loading:m,disabled:m,children:[`选择`,u===`image`?`图片`:`视频`]})})}),(0,Q.jsx)(X.Item,{name:`title`,label:`素材标题`,extra:`选填;不填时后台显示“未命名素材”,不会再自动使用文件名作为标题。`,children:(0,Q.jsx)(LN,{disabled:m})}),(0,Q.jsx)(X.Item,{name:`generation_prompt`,label:`生成提词`,extra:`选填;会随前台素材接口返回。`,children:(0,Q.jsx)(LN.TextArea,{rows:5,maxLength:8e3,showCount:!0,disabled:m,placeholder:`请输入用于生成该素材的提示词`})}),(0,Q.jsx)(X.Item,{label:`附件 / 参考素材`,children:(0,Q.jsx)(F9,{value:v,onChange:y,disabled:m})}),(0,Q.jsx)(X.Item,{name:`sort_order`,label:`排序`,children:(0,Q.jsx)(Ej,{min:0,style:{width:`100%`},disabled:m})}),(0,Q.jsx)(X.Item,{name:`is_active`,label:`前台展示`,valuePropName:`checked`,children:(0,Q.jsx)(aF,{disabled:m})})]}),(0,Q.jsx)(N9,{value:f,onChange:p,watermarks:r,mediaUrl:x,mediaType:u})]})},rGe=({open:e=!0,onClose:t,embedded:n=!1,onChanged:r})=>{let[i,a]=(0,C.useState)([]),[o,s]=(0,C.useState)(!1),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(null),[m,h]=(0,C.useState)([]),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)(!1),[b]=X.useForm(),x=async()=>{s(!0);try{a((await x5({page:1,pageSize:200})).items)}finally{s(!1)}};(0,C.useEffect)(()=>{e&&x()},[e]),(0,C.useEffect)(()=>()=>{g.startsWith(`blob:`)&&URL.revokeObjectURL(g)},[g]);let S=()=>{p(null),h([]),_(``),y(!1)},w=()=>{d(null),S(),b.setFieldsValue({name:``,is_default:!1,is_active:!0}),l(!0)},T=e=>{d(e),S(),_(k9(e.fileUrl)),b.setFieldsValue({name:e.name,is_default:e.isDefault,is_active:e.isActive}),l(!0)},E=()=>{v||(l(!1),S())},D=e=>{if(!e.type.startsWith(`image/`))return yP.warning(`请选择图片文件`),hB.LIST_IGNORE;g.startsWith(`blob:`)&&URL.revokeObjectURL(g);let t=URL.createObjectURL(e);return p(e),_(t),h([{uid:e.name,name:e.name,status:`done`,originFileObj:e}]),!1},O=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`},children:[(0,Q.jsx)(`div`,{}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:w,children:`上传水印`})]}),(0,Q.jsx)(cR,{rowKey:`id`,loading:o,dataSource:i,pagination:{pageSize:20},columns:[{title:`预览`,dataIndex:`fileUrl`,render:e=>(0,Q.jsx)(CN,{width:80,src:k9(e)})},{title:`名称`,dataIndex:`name`},{title:`尺寸`,render:(e,t)=>t.width&&t.height?`${t.width}×${t.height}`:`-`},{title:`默认`,dataIndex:`isDefault`,render:e=>e?`是`:`否`},{title:`启用`,dataIndex:`isActive`,render:e=>e?`启用`:`禁用`},{title:`操作`,render:(e,t)=>(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(DR,{}),onClick:()=>T(t),children:`编辑`}),(0,Q.jsx)(wP,{title:`确认删除该水印?`,onConfirm:async()=>{await tHe(t.id),yP.success(`删除成功`),await x(),r?.()},children:(0,Q.jsx)(XS,{size:`small`,danger:!0,icon:(0,Q.jsx)(wR,{}),children:`删除`})})]})}]}),(0,Q.jsx)(xP,{title:u?`编辑水印`:`上传水印`,open:c,onOk:async()=>{if(v)return;let e=await b.validateFields();if(!u&&!f){yP.warning(`请选择水印图片`);return}y(!0);try{u?await eHe(u.id,{name:e.name,is_default:e.is_default,is_active:e.is_active}):f&&await $Ve(f,e.name,e.is_default),yP.success(`保存成功`),l(!1),S(),await x(),r?.()}finally{y(!1)}},onCancel:E,confirmLoading:v,okButtonProps:{disabled:v||!u&&!f},cancelButtonProps:{disabled:v},destroyOnHidden:!0,children:(0,Q.jsxs)(X,{form:b,layout:`vertical`,children:[!u&&(0,Q.jsxs)(X.Item,{label:`水印图片`,required:!0,children:[(0,Q.jsx)(hB,{beforeUpload:e=>D(e),onRemove:()=>{p(null),h([]),g.startsWith(`blob:`)&&URL.revokeObjectURL(g),_(``)},fileList:m,maxCount:1,accept:`image/png,image/jpeg,image/webp`,disabled:v,children:(0,Q.jsx)(XS,{icon:(0,Q.jsx)(P6,{}),loading:v,disabled:v,children:`选择图片`})}),g&&(0,Q.jsx)(`div`,{style:{marginTop:12},children:(0,Q.jsx)(CN,{src:g,alt:`水印预览`,width:180,style:{maxHeight:120,objectFit:`contain`,background:`#0f172a`,borderRadius:8,padding:8}})})]}),u&&g&&(0,Q.jsx)(X.Item,{label:`当前水印`,children:(0,Q.jsx)(CN,{src:g,alt:`当前水印`,width:180,style:{maxHeight:120,objectFit:`contain`,background:`#0f172a`,borderRadius:8,padding:8}})}),(0,Q.jsx)(X.Item,{name:`name`,label:`水印名称`,rules:[{required:!0,message:`请输入水印名称`}],children:(0,Q.jsx)(LN,{disabled:v})}),(0,Q.jsx)(X.Item,{name:`is_default`,label:`默认水印`,valuePropName:`checked`,children:(0,Q.jsx)(aF,{disabled:v})}),(0,Q.jsx)(X.Item,{name:`is_active`,label:`启用`,valuePropName:`checked`,children:(0,Q.jsx)(aF,{disabled:v})})]})})]});return n?O:(0,Q.jsx)(xP,{title:`水印库`,open:e,onCancel:t,footer:null,width:900,destroyOnHidden:!0,children:O})},iGe=()=>{let[e]=X.useForm(),[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)([]),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(0),d=async()=>{let[e,t]=await Promise.all([b5({page:1,pageSize:200}),x5({page:1,pageSize:200,isActive:!0})]);i(e.items),o(t.items)},f=async()=>{n(!0);try{let t=await YVe();e.setFieldsValue(t)}finally{n(!1)}};(0,C.useEffect)(()=>{f(),d()},[]);let p=async()=>{await XVe(await e.validateFields()),yP.success(`配置已保存`)},m=async()=>{await d(),u(e=>e+1)};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(NA,{style:{marginBottom:16},loading:t,children:(0,Q.jsxs)(X,{form:e,layout:`inline`,initialValues:{enabled:!1,title:`行业素材案例`,subtitle:`精选图片与视频素材展示`,showOriginalInAdmin:!0},children:[(0,Q.jsx)(X.Item,{name:`enabled`,label:`首页展示`,valuePropName:`checked`,children:(0,Q.jsx)(aF,{})}),(0,Q.jsx)(X.Item,{name:`title`,label:`标题`,rules:[{required:!0,message:`请输入标题`}],children:(0,Q.jsx)(LN,{style:{width:220}})}),(0,Q.jsx)(X.Item,{name:`subtitle`,label:`副标题`,children:(0,Q.jsx)(LN,{style:{width:320}})}),(0,Q.jsx)(X.Item,{name:`showOriginalInAdmin`,label:`后台展示原素材`,valuePropName:`checked`,children:(0,Q.jsx)(aF,{})}),(0,Q.jsx)(X.Item,{children:(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(W2,{}),onClick:p,children:`保存配置`})})]})}),(0,Q.jsx)(NA,{title:`首页素材行业装修`,extra:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(XS,{onClick:m,children:`刷新`}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(cA,{}),onClick:()=>c(!0),children:`上传素材`})]}),children:(0,Q.jsx)(jA,{items:[{key:`assets`,label:`素材管理`,children:(0,Q.jsx)(ZWe,{categories:r,watermarks:a,reloadKey:l})},{key:`categories`,label:`行业类别`,children:(0,Q.jsx)(eGe,{onChanged:m})},{key:`watermarks`,label:`水印库`,children:(0,Q.jsx)(rGe,{embedded:!0,onChanged:m})}]})}),(0,Q.jsx)(nGe,{open:s,onClose:()=>c(!1),categories:r,watermarks:a,onSuccess:m})]})},H9=e=>{if(!e)return``;let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`},{Text:aGe}=Z,oGe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(1),[o,s]=(0,C.useState)(10),[c,l]=(0,C.useState)(0),[u,d]=(0,C.useState)(``),[f,p]=(0,C.useState)(``),[m,h]=(0,C.useState)(),g=[{title:`序号`,dataIndex:`index`,key:`index`,width:60,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:e})},{title:`ID`,dataIndex:`id`,key:`id`},{title:`手机号`,dataIndex:`phone`,key:`phone`,width:150},{title:`受众年龄`,dataIndex:`audienceAge`,key:`audienceAge`,width:100},{title:`受众性别`,dataIndex:`audienceGender`,key:`audienceGender`,width:100},{title:`受众网络`,dataIndex:`audienceNetwork`,key:`audienceNetwork`,width:100},{title:`受众区域`,dataIndex:`audienceRegion`,key:`audienceRegion`,width:100},{title:`预算`,dataIndex:`budget`,key:`budget`,width:100},{title:`成本上限`,dataIndex:`costCap`,key:`costCap`,width:100},{title:`CPA预算`,dataIndex:`cpaBid`,key:`cpaBid`,width:100},{title:`CPC预算`,dataIndex:`cpcBid`,key:`cpcBid`,width:100},{title:`客户名称`,dataIndex:`cusName`,key:`cusName`,width:150},{title:`外部操作`,dataIndex:`externalAction`,key:`externalAction`,width:100},{title:`名称`,dataIndex:`name`,key:`name`,width:150},{title:`名称`,dataIndex:`nobid`,key:`nobid`,width:150},{title:`备注`,dataIndex:`note`,key:`note`,width:150},{title:`平台`,dataIndex:`platform`,key:`platform`,width:100},{title:`定价类型`,dataIndex:`pricingType`,key:`pricingType`,width:100},{title:`目标成本`,dataIndex:`targetCost`,key:`targetCost`,width:100},{title:`用户ID`,dataIndex:`userId`,key:`userId`,width:100},{title:`用户手机号`,dataIndex:`userPhone`,key:`userPhone`,width:150},{title:`是否默认`,dataIndex:`isDefault`,key:`isDefault`,width:100,render:e=>(0,Q.jsx)(xR,{color:e?`green`:`red`,children:e?`是`:`否`})},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,width:180,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:H9(e)})},{title:`更新时间`,dataIndex:`updatedAt`,key:`updatedAt`,width:180,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:H9(e)})}],_=async()=>{r(!0);try{let e=await fHe({id:u||void 0,phone:f||void 0,created_at:m?[m[0].format(`YYYY-MM-DD`),m[1].format(`YYYY-MM-DD`)]:void 0,page:i,page_size:o});t((e.data||[]).map((e,t)=>({...e,index:(i-1)*o+t+1}))),l(e.pagination.total||0)}catch(e){console.error(`加载数据失败:`,e)}finally{r(!1)}};(0,C.useEffect)(()=>{_()},[i,o]);let v=(e,t)=>{a(e),s(t)},y=()=>{a(1),_()};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,Q.jsx)(MM,{style:{color:`#6366f1`,fontSize:16}}),(0,Q.jsx)(aGe,{strong:!0,style:{fontSize:16},children:`素材前测模板`})]}),(0,Q.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16},children:(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:12,alignItems:`center`},children:[(0,Q.jsx)(LN,{placeholder:`ID`,value:u,onChange:e=>d(e.target.value),style:{width:160},allowClear:!0,onPressEnter:y}),(0,Q.jsx)(LN,{placeholder:`手机号`,value:f,onChange:e=>p(e.target.value),style:{width:160},allowClear:!0,onPressEnter:y}),(0,Q.jsx)(cM.RangePicker,{placeholder:[`开始日期`,`结束日期`],value:m,onChange:e=>{e&&e[0]&&e[1]?h([e[0],e[1]]):h(void 0)},style:{width:260}}),(0,Q.jsx)(XS,{type:`primary`,onClick:y,children:`搜索`})]})}),(0,Q.jsxs)(`div`,{style:{background:`#fff`,borderRadius:16,boxShadow:`0 4px 20px rgba(0,0,0,0.04)`,overflow:`hidden`},children:[(0,Q.jsx)(cR,{dataSource:e,columns:g,loading:n,pagination:!1,rowKey:`id`,bordered:!1,scroll:{x:`max-content`},onRow:()=>({style:{cursor:`pointer`,transition:`background-color 0.15s`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`#f8fafc`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`transparent`}})}),(0,Q.jsx)(`div`,{style:{padding:`16px`,textAlign:`right`},children:(0,Q.jsx)($N,{current:i,pageSize:o,total:c,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,pageSizeOptions:[`10`,`20`,`50`,`100`],onChange:v,size:`small`})})]})]})},U9=e=>{if(!e)return``;let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`},{Text:sGe}=Z,cGe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(1),[o,s]=(0,C.useState)(10),[c,l]=(0,C.useState)(0),[u,d]=(0,C.useState)(``),[f,p]=(0,C.useState)(``),[m,h]=(0,C.useState)({}),[g,_]=(0,C.useState)([]),[v,y]=(0,C.useState)(void 0),b=[{title:`序号`,dataIndex:`index`,key:`index`,width:60,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:e})},{title:`ID`,dataIndex:`id`,key:`id`},{title:`前台用户ID`,dataIndex:`userId`,key:`userId`},{title:`前台用户手机号`,dataIndex:`userPhone`,key:`userPhone`},{title:`授权应用ID`,dataIndex:`appid`,key:`appid`},{title:`授权绑定账户ID`,dataIndex:`accountId`,key:`accountId`},{title:`授权绑定账户名称`,dataIndex:`accountName`,key:`accountName`},{title:`授权绑定账户角色`,dataIndex:`accountRole`,key:`accountRole`,render:e=>({ADVERTISER:`客户`,CUSTOMER_ADMIN:`普通版工作台-管理员`,CUSTOMER_OPERATOR:`普通版工作台-协作者`,AGENT:`代理商`,CHILD_AGENT:`二级代理商`,PLATFORM_ROLE_STAR:`星图账户`,PLATFORM_ROLE_SHOP_ACCOUNT:`抖音店铺账户`,PLATFORM_ROLE_QIANCHUAN_AGENT:`千川代理商`,PLATFORM_ROLE_STAR_AGENT:`星图代理商`,PLATFORM_ROLE_AWEME:`抖音号`,PLATFORM_ROLE_STAR_MCN:`星图MCN机构`,PLATFORM_ROLE_STAR_ISV:`星图服务商`,AGENT_SYSTEM_ACCOUNT:`代理商系统账户`,PLATFORM_ROLE_LOCAL_AGENT:`本地推代理商`,PLATFORM_ROLE_YUNTU_BRAND_ISV_ADMIN:`云图品牌服务商管理员`,PLATFORM_ROLE_LIFE:`抖音来客账户`,PLATFORM_ROLE_ENTERPRISE_BP_ADMIN:`升级版工作台管理员`,PLATFORM_ROLE_ENTERPRISE_BP_OPERATOR:`升级版工作台协作者`})[e]||e},{title:`授权登录账户用户ID`,dataIndex:`accountUserid`,key:`accountUserid`},{title:`授权登录账户用户名`,dataIndex:`accountUsername`,key:`accountUsername`},{title:`开户方式`,dataIndex:`openType`,key:`openType`,width:120,render:e=>(0,Q.jsx)(`span`,{style:{color:`#1e293b`},children:m[e]||e})},{title:`平台端口`,dataIndex:`portType`,key:`portType`,render:e=>({1:`巨量`,2:`磁力`,3:`巨量星图`,4:`服务单`,5:`腾讯`})[e]||e},{title:`授权刷新Token`,dataIndex:`refreshToken`,key:`refreshToken`},{title:`刷新Token过期时间`,dataIndex:`refreshTokenExpired`,key:`refreshTokenExpired`,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:U9(e)})},{title:`授权Token`,dataIndex:`accessToken`,key:`accessToken`},{title:`Token过期时间`,dataIndex:`accessTokenExpired`,key:`accessTokenExpired`,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:U9(e)})},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,width:180,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:U9(e)})},{title:`更新时间`,dataIndex:`updatedAt`,key:`updatedAt`,width:180,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:U9(e)})}],x=async()=>{try{let e=(await g5()).data||[],t={},n=[];e.forEach(e=>{t[e.openType]=e.typeName,n.push({value:e.openType,label:e.typeName})}),h(t),_(n)}catch(e){console.error(`加载开户方式列表失败:`,e)}},S=async()=>{r(!0);try{let e=await uHe({account_id:u||void 0,account_userid:f||void 0,open_type:v,page:i,page_size:o});t((e.data||[]).map((e,t)=>({...e,index:(i-1)*o+t+1}))),l(e.pagination?.total||0)}catch(e){console.error(`加载数据失败:`,e)}finally{r(!1)}};(0,C.useEffect)(()=>{x(),S()},[i,o]);let w=()=>{a(1),S()};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,Q.jsx)(C$,{style:{color:`#6366f1`,fontSize:16}}),(0,Q.jsx)(sGe,{strong:!0,style:{fontSize:16},children:`投放平台授权列表`})]}),(0,Q.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16},children:(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:12,alignItems:`center`},children:[(0,Q.jsx)(LN,{placeholder:`授权绑定账户ID`,value:u,onChange:e=>d(e.target.value),style:{width:180},allowClear:!0,prefix:(0,Q.jsx)(_b,{}),onPressEnter:w}),(0,Q.jsx)(LN,{placeholder:`授权登录账户用户ID`,value:f,onChange:e=>p(e.target.value),style:{width:180},allowClear:!0,prefix:(0,Q.jsx)(_b,{}),onPressEnter:w}),(0,Q.jsx)(Sb,{placeholder:`开户方式`,value:v,onChange:e=>y(e),style:{width:140},allowClear:!0,options:g}),(0,Q.jsx)(XS,{type:`primary`,onClick:w,children:`搜索`})]})}),(0,Q.jsx)(`div`,{style:{background:`#fff`,borderRadius:12,boxShadow:`0 1px 3px rgba(0,0,0,0.05)`},children:(0,Q.jsx)(cR,{dataSource:e,columns:b,loading:n,rowKey:`id`,bordered:!1,scroll:{x:`max-content`},pagination:{current:i,pageSize:o,total:c,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{a(e),s(t)}}})})]})},W9=[{key:`is_ad_high_quality_material`,label:`AD优质`,noLabel:`AD非优质素材`,unknownLabel:`AD未知`,yesColor:`green`,noColor:`red`,unknownColor:`default`},{key:`is_ecp_high_quality_material`,label:`千川优质`,noLabel:`千川非优质素材`,unknownLabel:`千川未知`,yesColor:`green`,noColor:`red`,unknownColor:`default`},{key:`is_local_high_quality_material`,label:`本地推优质`,noLabel:`本地推非优质`,unknownLabel:`本地推未知`,yesColor:`green`,noColor:`red`,unknownColor:`default`},{key:`is_inefficient_material`,label:`低效`,noLabel:`非低效`,unknownLabel:`是否低效未知`,yesColor:`red`,noColor:`green`,unknownColor:`default`},{key:`is_first_publish_material`,label:`首发`,noLabel:`非首发`,unknownLabel:`是否首发未知`,yesColor:`blue`,noColor:`default`,unknownColor:`default`}],lGe=({preResult:e})=>{let[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(!1);if(C.useEffect(()=>{if(!e){n(null),i(!1);return}try{n(JSON.parse(e)),i(!1)}catch{n(null),i(!0)}},[e]),!e||r||!t)return(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:`-`});let a=e=>{let n=W9.find(t=>t.key===e);if(!n)return null;let r=t[e],i=r===`YES`,a=r===`NO`;if(r===`UNKNOWN`)return null;let o,s;return i?(o=n.label,s=n.yesColor):a&&(o=n.noLabel,s=n.noColor),{tag:(0,Q.jsx)(xR,{color:s,style:{marginRight:6,fontSize:12,borderRadius:4},children:o},e),detail:{label:n.label.replace(`优质`,`优质素材`),value:o,color:s}}};return(0,Q.jsx)(yx,{content:(0,Q.jsxs)(`div`,{style:{maxWidth:500,padding:`8px 0`},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:14,display:`block`,marginBottom:12,color:`#1e293b`},children:`前测结果详情`}),(0,Q.jsxs)(fM,{column:1,size:`small`,style:{marginBottom:12},children:[(0,Q.jsx)(fM.Item,{label:`视频ID`,labelStyle:{fontWeight:500,color:`#64748b`},contentStyle:{color:`#1e293b`},children:t.video_id}),(0,Q.jsx)(fM.Item,{label:`广告主ID`,labelStyle:{fontWeight:500,color:`#64748b`},contentStyle:{color:`#1e293b`},children:t.advertiser_id}),(0,Q.jsx)(fM.Item,{label:`素材ID`,labelStyle:{fontWeight:500,color:`#64748b`},contentStyle:{color:`#1e293b`},children:t.material_id})]}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:8},children:`质量评估`}),(0,Q.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8,marginBottom:12},children:W9.map(e=>{let n=t[e.key],r=n===`YES`,i=n===`NO`;if(n===`UNKNOWN`)return null;let a,o;return r?(a=e.label,o=e.yesColor):i&&(a=e.noLabel,o=e.noColor),(0,Q.jsx)(xR,{color:o,style:{fontSize:12,borderRadius:4},children:a},e.key)})}),t.not_ad_high_quality_reason&&t.not_ad_high_quality_reason.length>0&&(0,Q.jsxs)(`div`,{style:{marginBottom:12},children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:12,color:`#ef4444`,display:`block`,marginBottom:8},children:`AD非优质原因`}),(0,Q.jsx)(dP,{dataSource:t.not_ad_high_quality_reason,renderItem:(e,t)=>(0,Q.jsxs)(dP.Item,{style:{padding:`4px 0`,fontSize:12,color:`#64748b`},children:[t+1,`. `,e]},t),size:`small`})]}),t.not_ecp_high_quality_reason&&t.not_ecp_high_quality_reason.length>0&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:12,color:`#ef4444`,display:`block`,marginBottom:8},children:`千川非优质原因`}),(0,Q.jsx)(dP,{dataSource:t.not_ecp_high_quality_reason,renderItem:(e,t)=>(0,Q.jsxs)(dP.Item,{style:{padding:`4px 0`,fontSize:12,color:`#64748b`},children:[t+1,`. `,e]},t),size:`small`})]})]}),title:null,trigger:`hover`,placement:`topLeft`,overlayStyle:{borderRadius:12,boxShadow:`0 8px 24px rgba(0,0,0,0.12)`},children:(0,Q.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:4},children:W9.map(e=>a(e.key)?.tag)})})},G9=e=>{if(!e)return``;let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`},{Text:uGe}=Z,dGe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(1),[o,s]=(0,C.useState)(10),[c,l]=(0,C.useState)(0),[u,d]=(0,C.useState)(``),[f,p]=(0,C.useState)(``),[m,h]=(0,C.useState)(``),g=[{title:`序号`,dataIndex:`index`,key:`index`,width:60,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:e})},{title:`ID`,dataIndex:`id`,key:`id`},{title:`广告主账户ID`,dataIndex:`advertiserId`,key:`advertiserId`},{title:`备注`,dataIndex:`note`,key:`note`,width:200,render:e=>(0,Q.jsx)(LN.TextArea,{value:e||``,readOnly:!0,autoSize:{minRows:1,maxRows:4},style:{color:`#94a3b8`,resize:`none`,border:`none`,background:`transparent`,padding:0},placeholder:`-`})},{title:`授权ID`,dataIndex:`oauthId`,key:`oauthId`},{title:`预测试结果`,dataIndex:`preResult`,key:`preResult`,width:120,render:e=>(0,Q.jsx)(lGe,{preResult:e})},{title:`预测试模板ID`,dataIndex:`preTestTemplateId`,key:`preTestTemplateId`},{title:`目标标ID`,dataIndex:`targetId`,key:`targetId`},{title:`目标表`,dataIndex:`targetTable`,key:`targetTable`},{title:`任务ID`,dataIndex:`taskId`,key:`taskId`},{title:`用户ID`,dataIndex:`userId`,key:`userId`},{title:`素材ID`,dataIndex:`materialId`,key:`materialId`,width:180},{title:`上传ID`,dataIndex:`uploadId`,key:`uploadId`,render:e=>{if(!e)return`-`;let t=e.length>12?`${e.slice(0,6)}...${e.slice(-4)}`:e;return(0,Q.jsx)(fx,{title:e,placement:`topLeft`,children:(0,Q.jsx)(Z.Text,{style:{fontSize:12},children:t})})}},{title:`资源类型`,dataIndex:`resourceType`,key:`resourceType`,width:100,render:e=>(0,Q.jsx)(xR,{color:e===`video`?`blue`:`green`,children:e===`video`?`视频`:`图片`})},{title:`状态`,dataIndex:`status`,key:`status`,width:100,render:e=>(0,Q.jsx)(xR,{color:e===`SUCCESS`?`green`:e===`PENDING`?`orange`:`red`,children:e===`SUCCESS`?`成功`:e===`PENDING`?`处理中`:`失败`})},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,width:180,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:G9(e)})},{title:`更新时间`,dataIndex:`updatedAt`,key:`updatedAt`,width:180,render:e=>(0,Q.jsx)(`span`,{style:{color:`#64748b`},children:G9(e)})}],_=async()=>{r(!0);try{let e=await dHe({material_id:u||void 0,upload_id:f||void 0,resource_type:m||void 0,page:i,page_size:o});t((e.data||[]).map((e,t)=>({...e,index:(i-1)*o+t+1}))),l(e.pagination?.total||0)}catch(e){console.error(`加载数据失败:`,e)}finally{r(!1)}};(0,C.useEffect)(()=>{_()},[i,o]);let v=()=>{a(1),_()};return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,Q.jsx)(MM,{style:{color:`#6366f1`,fontSize:16}}),(0,Q.jsx)(uGe,{strong:!0,style:{fontSize:16},children:`素材ID列表`})]}),(0,Q.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16},children:(0,Q.jsxs)(`div`,{style:{display:`flex`,gap:12,alignItems:`center`},children:[(0,Q.jsx)(LN,{placeholder:`素材ID`,value:u,onChange:e=>d(e.target.value),style:{width:160},allowClear:!0,onPressEnter:v}),(0,Q.jsx)(LN,{placeholder:`上传ID`,value:f,onChange:e=>p(e.target.value),style:{width:160},allowClear:!0,onPressEnter:v}),(0,Q.jsx)(LN,{placeholder:`文件名`,value:m,onChange:e=>h(e.target.value),style:{width:140},allowClear:!0,onPressEnter:v}),(0,Q.jsx)(Sb,{placeholder:`资源类型`,value:m,onChange:e=>h(e),style:{width:120},allowClear:!0,options:[{value:`image`,label:`图片`},{value:`video`,label:`视频`}]}),(0,Q.jsx)(XS,{type:`primary`,onClick:v,children:`搜索`})]})}),(0,Q.jsxs)(`div`,{style:{background:`#fff`,borderRadius:12,boxShadow:`0 1px 3px rgba(0,0,0,0.05)`},children:[(0,Q.jsx)(cR,{dataSource:e,columns:g,loading:n,pagination:!1,rowKey:`id`,bordered:!1,scroll:{x:`max-content`}}),(0,Q.jsx)(`div`,{style:{padding:`16px`,textAlign:`right`},children:(0,Q.jsx)($N,{current:i,pageSize:o,total:c,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{a(e),s(t)},size:`small`})})]})]})},{Title:fGe,Text:K9}=Z,q9=20,pGe=[{label:`全部素材库`,value:``},{label:`真人认证`,value:`real_person`},{label:`虚拟人像`,value:`aigc_virtual`}],mGe=[{label:`全部类型`,value:``},{label:`图片`,value:`Image`},{label:`视频`,value:`Video`}],hGe=[{label:`全部项目状态`,value:``},{label:`可用`,value:`active`},{label:`认证中`,value:`validating`},{label:`认证失败`,value:`validate_failed`},{label:`创建远端组中`,value:`creating_remote_group`},{label:`创建远端组失败`,value:`create_group_failed`},{label:`已删除`,value:`deleted`}],gGe=[{label:`全部素材状态`,value:``},{label:`创建中`,value:`creating`},{label:`处理中`,value:`Processing`},{label:`可用`,value:`Active`},{label:`失败`,value:`Failed`},{label:`本地已删`,value:`local_deleted`},{label:`远端已删`,value:`remote_deleted`},{label:`删除失败`,value:`delete_failed`}],J9=e=>e===`real_person`?`真人认证`:e===`aigc_virtual`?`虚拟人像`:e||`-`,Y9=e=>e===`real_person`?`purple`:e===`aigc_virtual`?`cyan`:`default`,X9=e=>e===`Active`||e===`active`?`green`:e===`Processing`||e===`creating_remote_group`||e===`validating`||e===`creating`?`blue`:e===`Failed`||e===`failed`||e===`delete_failed`||e===`validate_failed`||e===`create_group_failed`?`red`:(e?.includes(`deleted`),`default`),_Ge=e=>e===`Image`?`图片`:e===`Video`?`视频`:e||`-`,Z9=(e,t=10)=>e?e.length<=t*2+3?e:`${e.slice(0,t)}...${e.slice(-t)}`:`-`,Q9=async e=>{e&&(await navigator.clipboard?.writeText(e),yP.success(`已复制`))},$9=e=>{if(!e)return``;let t=String(e).trim();return!t||t.startsWith(`asset://`)?``:k9(t)},vGe=({asset:e})=>{let t=$9(e.displayUrl||e.previewUrl||e.remoteUrl||e.sourceUrl),n=$9(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.sourceUrl);return e.assetType===`Video`?(0,Q.jsxs)(`div`,{style:{width:72,height:52,borderRadius:10,overflow:`hidden`,background:`#f5f3ff`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[n?(0,Q.jsx)(`img`,{src:n,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,Q.jsx)(c0,{style:{fontSize:24,color:`#8b5cf6`}}),t?(0,Q.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,style:{position:`absolute`,inset:0}}):null,(0,Q.jsx)(c0,{style:{position:`absolute`,color:`#fff`,fontSize:22,filter:`drop-shadow(0 1px 3px rgba(0,0,0,.45))`}})]}):t?(0,Q.jsx)(CN,{width:72,height:52,src:t,style:{objectFit:`cover`,borderRadius:10}}):(0,Q.jsx)(`div`,{style:{width:72,height:52,borderRadius:10,background:`#f5f5f5`}})},yGe=()=>{let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)([]),[i,a]=(0,C.useState)(0),[o,s]=(0,C.useState)(0),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(``),[m,h]=(0,C.useState)(``),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(),[T,E]=(0,C.useState)(1),[D,O]=(0,C.useState)(1),k=(0,C.useMemo)(()=>({keyword:f.trim()||void 0,libraryType:m||void 0,assetType:g||void 0,projectStatus:v||void 0,assetStatus:b||void 0}),[f,m,g,v,b]),A=async()=>{l(!0);try{let e=await pHe({keyword:k.keyword,libraryType:k.libraryType,status:k.projectStatus,page:T,pageSize:q9});t(e.items||[]),a(e.total||0)}catch(e){yP.error(e?.message||`加载私域人像素材项目失败`)}finally{l(!1)}},j=async()=>{d(!0);try{let e=await mHe({projectId:S,keyword:k.keyword,libraryType:k.libraryType,assetType:k.assetType,status:k.assetStatus,page:D,pageSize:q9});r(e.items||[]),s(e.total||0)}catch(e){yP.error(e?.message||`加载私域人像素材失败`)}finally{d(!1)}};(0,C.useEffect)(()=>{A()},[T,k.libraryType,k.projectStatus]),(0,C.useEffect)(()=>{j()},[S,D,k.libraryType,k.assetType,k.assetStatus]);let M=()=>{E(1),O(1),setTimeout(()=>{A(),j()},0)},N=()=>{p(``),h(``),_(``),y(``),x(``),w(void 0),E(1),O(1)},P=(0,C.useMemo)(()=>e.reduce((e,t)=>(e.asset+=t.assetCount||0,e.image+=t.imageAssetCount||0,e.video+=t.videoAssetCount||0,e.active+=t.activeAssetCount||0,e),{asset:0,image:0,video:0,active:0}),[e]),F=[{title:`项目名称`,dataIndex:`name`,width:200,fixed:`left`,render:(e,t)=>(0,Q.jsx)(XS,{type:`link`,onClick:()=>{w(t.id),O(1)},children:e})},{title:`类型`,dataIndex:`libraryType`,width:110,render:e=>(0,Q.jsx)(xR,{color:Y9(e),children:J9(e)})},{title:`用户ID`,dataIndex:`userId`,width:170,render:e=>(0,Q.jsx)(K9,{code:!0,copyable:!!e,children:e||`-`})},{title:`状态`,dataIndex:`status`,width:130,render:e=>(0,Q.jsx)(xR,{color:X9(e),children:e})},{title:`素材`,width:170,render:(e,t)=>(0,Q.jsxs)(OM,{size:4,children:[(0,Q.jsxs)(xR,{children:[`总 `,t.assetCount||0]}),(0,Q.jsxs)(xR,{color:`blue`,children:[`图 `,t.imageAssetCount||0]}),(0,Q.jsxs)(xR,{color:`geekblue`,children:[`视 `,t.videoAssetCount||0]})]})},{title:`Active`,dataIndex:`activeAssetCount`,width:90},{title:`ProjectName`,dataIndex:`remoteProjectName`,width:180,render:e=>(0,Q.jsx)(K9,{code:!0,copyable:!!e,children:e||`-`})},{title:`创建时间`,dataIndex:`createdAt`,width:170,render:E5},{title:`更新时间`,dataIndex:`updatedAt`,width:170,render:E5}],I=[{title:`预览`,width:100,fixed:`left`,render:(e,t)=>(0,Q.jsx)(vGe,{asset:t})},{title:`素材名称`,dataIndex:`name`,width:180,render:(e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K9,{strong:!0,children:e||`未命名素材`}),(0,Q.jsx)(`br`,{}),(0,Q.jsx)(K9,{type:`secondary`,children:_Ge(t.assetType)})]})},{title:`库类型`,dataIndex:`libraryType`,width:110,render:e=>(0,Q.jsx)(xR,{color:Y9(e),children:J9(e)})},{title:`用户ID`,dataIndex:`userId`,width:170,render:e=>(0,Q.jsx)(K9,{code:!0,copyable:!!e,children:e||`-`})},{title:`本地项目`,dataIndex:`projectName`,width:160,render:e=>e||`-`},{title:`状态`,dataIndex:`status`,width:120,render:e=>(0,Q.jsx)(xR,{color:X9(e),children:e})},{title:`AssetId`,dataIndex:`remoteAssetId`,width:190,render:e=>(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(K9,{code:!0,children:Z9(e)}),e?(0,Q.jsx)(XS,{size:`small`,type:`text`,icon:(0,Q.jsx)(XR,{}),onClick:()=>Q9(e)}):null]})},{title:`GroupId`,dataIndex:`remoteGroupId`,width:190,render:e=>(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(K9,{code:!0,children:Z9(e)}),e?(0,Q.jsx)(XS,{size:`small`,type:`text`,icon:(0,Q.jsx)(XR,{}),onClick:()=>Q9(e)}):null]})},{title:`轮询`,width:160,render:(e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(K9,{children:[`次数:`,t.pollCount||0]}),(0,Q.jsx)(`br`,{}),(0,Q.jsxs)(K9,{type:`secondary`,children:[`下次:`,E5(t.nextPollAt)]})]})},{title:`错误`,dataIndex:`errorMessage`,width:240,ellipsis:!0,render:e=>e?(0,Q.jsx)(fx,{title:e,children:(0,Q.jsx)(K9,{type:`danger`,children:e})}):`-`},{title:`创建时间`,dataIndex:`createdAt`,width:170,render:E5}];return(0,Q.jsxs)(`div`,{style:{padding:24,background:`#f7f7fb`,minHeight:`100%`},children:[(0,Q.jsxs)(OM,{style:{width:`100%`,justifyContent:`space-between`,marginBottom:16},align:`start`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(fGe,{level:3,style:{margin:0},children:`私域人像素材库`}),(0,Q.jsx)(K9,{type:`secondary`,children:`统一查看真人认证素材与虚拟人像素材,支持图片/视频资产状态排查。`})]}),(0,Q.jsxs)(OM,{wrap:!0,children:[(0,Q.jsx)(LN,{allowClear:!0,prefix:(0,Q.jsx)(_b,{}),placeholder:`搜索项目/素材`,value:f,onChange:e=>p(e.target.value),onPressEnter:M,style:{width:240}}),(0,Q.jsx)(Sb,{value:m,onChange:e=>{h(e),E(1),O(1)},options:pGe,style:{width:150}}),(0,Q.jsx)(Sb,{value:g,onChange:e=>{_(e),O(1)},options:mGe,style:{width:130}}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(_b,{}),type:`primary`,onClick:M,children:`查询`}),(0,Q.jsx)(XS,{onClick:N,children:`重置`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(LP,{}),onClick:()=>{A(),j()},children:`刷新`})]})]}),(0,Q.jsxs)(OM,{size:16,wrap:!0,style:{marginBottom:16},children:[(0,Q.jsx)(NA,{style:{width:180},children:(0,Q.jsx)(UP,{title:`项目数`,value:i})}),(0,Q.jsx)(NA,{style:{width:180},children:(0,Q.jsx)(UP,{title:`当前页素材`,value:P.asset})}),(0,Q.jsx)(NA,{style:{width:180},children:(0,Q.jsx)(UP,{title:`图片`,value:P.image})}),(0,Q.jsx)(NA,{style:{width:180},children:(0,Q.jsx)(UP,{title:`视频`,value:P.video})}),(0,Q.jsx)(NA,{style:{width:180},children:(0,Q.jsx)(UP,{title:`Active`,value:P.active})})]}),(0,Q.jsx)(NA,{title:`项目组`,style:{marginBottom:16,borderRadius:14},extra:(0,Q.jsx)(Sb,{value:v,onChange:e=>{y(e),E(1)},options:hGe,style:{width:180}}),children:(0,Q.jsx)(cR,{rowKey:`id`,columns:F,dataSource:e,loading:c,pagination:{current:T,pageSize:q9,total:i,onChange:E},size:`small`,scroll:{x:1350}})}),(0,Q.jsx)(NA,{title:S?`项目素材明细`:`全部素材明细`,style:{borderRadius:14},extra:(0,Q.jsxs)(OM,{children:[(0,Q.jsx)(Sb,{value:b,onChange:e=>{x(e),O(1)},options:gGe,style:{width:170}}),S?(0,Q.jsx)(XS,{size:`small`,onClick:()=>w(void 0),children:`查看全部`}):null]}),children:(0,Q.jsx)(cR,{rowKey:`id`,columns:I,dataSource:n,loading:u,pagination:{current:D,pageSize:q9,total:o,onChange:O},size:`small`,scroll:{x:1700}})})]})},bGe=({children:e})=>{let{user:t,loading:n,checkAuth:r}=S5();return(0,C.useEffect)(()=>{!localStorage.getItem(`auth_token`)&&!n&&!t&&(window.location.href=`/login`)},[t,n]),n?(0,Q.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`},children:(0,Q.jsx)(cP,{size:`large`})}):t?(0,Q.jsx)(Q.Fragment,{children:e}):(window.location.href=`/login`,null)};(0,v.createRoot)(document.getElementById(`root`)).render((0,Q.jsx)(()=>{let{checkAuth:e}=S5();return(0,C.useEffect)(()=>{e()},[]),(0,Q.jsx)($p,{locale:N8.default,theme:{token:{colorPrimary:`#6366f1`,borderRadius:8},components:{Button:{controlHeight:36,controlHeightLG:44},Card:{boxShadow:`0 1px 3px rgba(0,0,0,0.04)`},Table:{headerBg:`#fafbfc`}}},children:(0,Q.jsx)(Lv,{children:(0,Q.jsx)(_n,{children:(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(Dt,{path:`/login`,element:(0,Q.jsx)(THe,{})}),(0,Q.jsxs)(Dt,{path:`/`,element:(0,Q.jsx)(bGe,{children:(0,Q.jsx)(bHe,{})}),children:[(0,Q.jsx)(Dt,{index:!0,element:(0,Q.jsx)(EHe,{})}),(0,Q.jsx)(Dt,{path:`users`,element:(0,Q.jsx)(AHe,{})}),(0,Q.jsx)(Dt,{path:`teams`,element:(0,Q.jsx)(PHe,{})}),(0,Q.jsx)(Dt,{path:`credit-records`,element:(0,Q.jsx)(aUe,{})}),(0,Q.jsx)(Dt,{path:`models`,element:(0,Q.jsx)(FHe,{})}),(0,Q.jsx)(Dt,{path:`credit-ratios`,element:(0,Q.jsx)(yUe,{})}),(0,Q.jsx)(Dt,{path:`video-engines`,element:(0,Q.jsx)(pUe,{})}),(0,Q.jsx)(Dt,{path:`image-engines`,element:(0,Q.jsx)(gUe,{})}),(0,Q.jsx)(Dt,{path:`industries`,element:(0,Q.jsx)(fUe,{})}),(0,Q.jsx)(Dt,{path:`menu-configs`,element:(0,Q.jsx)(CUe,{})}),(0,Q.jsx)(Dt,{path:`recharge-packages`,element:(0,Q.jsx)(EUe,{})}),(0,Q.jsx)(Dt,{path:`payment`,element:(0,Q.jsx)(oUe,{})}),(0,Q.jsx)(Dt,{path:`payment-stats`,element:(0,Q.jsx)(cUe,{})}),(0,Q.jsx)(Dt,{path:`settings`,element:(0,Q.jsx)(LHe,{})}),(0,Q.jsx)(Dt,{path:`video-prompt-schema-config`,element:(0,Q.jsx)(PWe,{})}),(0,Q.jsx)(Dt,{path:`notifications`,element:(0,Q.jsx)(RHe,{})}),(0,Q.jsx)(Dt,{path:`oauthapp-list`,element:(0,Q.jsx)(kUe,{})}),(0,Q.jsx)(Dt,{path:`operation-logs`,element:(0,Q.jsx)(OUe,{})}),(0,Q.jsx)(Dt,{path:`generation-records`,element:(0,Q.jsx)(PUe,{})}),(0,Q.jsx)(Dt,{path:`generation-ai`,element:(0,Q.jsx)(zUe,{})}),(0,Q.jsx)(Dt,{path:`hot-opening-replications`,element:(0,Q.jsx)(WUe,{})}),(0,Q.jsx)(Dt,{path:`hot-opening-replications/:projectId`,element:(0,Q.jsx)(uWe,{})}),(0,Q.jsx)(Dt,{path:`shot-replications`,element:(0,Q.jsx)(hWe,{})}),(0,Q.jsx)(Dt,{path:`shot-replications/task-sets/:taskSetId`,element:(0,Q.jsx)(wWe,{})}),(0,Q.jsx)(Dt,{path:`shot-replications/projects/:projectId`,element:(0,Q.jsx)(r9,{moduleType:`shot_replicate`})}),(0,Q.jsx)(Dt,{path:`authoriza`,element:(0,Q.jsx)(SHe,{})}),(0,Q.jsx)(Dt,{path:`consume`,element:(0,Q.jsx)(wHe,{})}),(0,Q.jsx)(Dt,{path:`platform`,element:(0,Q.jsx)(DHe,{})}),(0,Q.jsx)(Dt,{path:`contact-requests`,element:(0,Q.jsx)(FWe,{})}),(0,Q.jsx)(Dt,{path:`home-materials`,element:(0,Q.jsx)(iGe,{})}),(0,Q.jsx)(Dt,{path:`pretest-templates`,element:(0,Q.jsx)(oGe,{})}),(0,Q.jsx)(Dt,{path:`oauth-list`,element:(0,Q.jsx)(cGe,{})}),(0,Q.jsx)(Dt,{path:`material-list`,element:(0,Q.jsx)(dGe,{})}),(0,Q.jsx)(Dt,{path:`private-portrait-projects`,element:(0,Q.jsx)(yGe,{})})]}),(0,Q.jsx)(Dt,{path:`*`,element:(0,Q.jsx)(Tt,{to:`/`,replace:!0})})]})})})})},{})); \ No newline at end of file diff --git a/video-gen-admin/dist/index.html b/video-gen-admin/dist/index.html index 5079d021..3befa67d 100644 --- a/video-gen-admin/dist/index.html +++ b/video-gen-admin/dist/index.html @@ -1,37 +1,37 @@ - - - - - - - - - - 后台管理 - - + + + + + + + + + + 后台管理 + + - - -
- - + + +
+ + diff --git a/video-gen-admin/src/pages/AdminCreditRatios.tsx b/video-gen-admin/src/pages/AdminCreditRatios.tsx index 81008aab..f593794a 100644 --- a/video-gen-admin/src/pages/AdminCreditRatios.tsx +++ b/video-gen-admin/src/pages/AdminCreditRatios.tsx @@ -25,6 +25,9 @@ interface CreditRatio { inputVideoRatio: number; inputVideoBaseCredits: number; inputVideoPerSecondCredits: number; + inputImageRatio: number; + inputImageBaseCredits: number; + inputImagePerImageCredits: number; } interface CreditRatioFormValues { @@ -37,6 +40,9 @@ interface CreditRatioFormValues { inputVideoRatio?: number; inputVideoBaseCredits?: number; inputVideoPerSecondCredits?: number; + inputImageRatio?: number; + inputImageBaseCredits?: number; + inputImagePerImageCredits?: number; } const DEFAULT_IMAGE_SIZES = ['2K', '4K']; @@ -136,6 +142,9 @@ const AdminCreditRatios: React.FC = () => { payload.input_video_base_credits = values.inputVideoBaseCredits ?? 0; payload.input_video_per_second_credits = values.inputVideoPerSecondCredits ?? 0; } + payload.input_image_ratio = values.inputImageRatio ?? 1.0; + payload.input_image_base_credits = values.inputImageBaseCredits ?? 0; + payload.input_image_per_image_credits = values.inputImagePerImageCredits ?? 0; if (modal.ratio) { await saveCreditRatio({ id: modal.ratio.id, ...payload }); message.success('已更新'); @@ -188,6 +197,9 @@ const AdminCreditRatios: React.FC = () => { inputVideoRatio: ratio.inputVideoRatio, inputVideoBaseCredits: ratio.inputVideoBaseCredits, inputVideoPerSecondCredits: ratio.inputVideoPerSecondCredits, + inputImageRatio: ratio.inputImageRatio, + inputImageBaseCredits: ratio.inputImageBaseCredits, + inputImagePerImageCredits: ratio.inputImagePerImageCredits, }); } else { form.resetFields(); @@ -199,6 +211,9 @@ const AdminCreditRatios: React.FC = () => { inputVideoRatio: 1.0, inputVideoBaseCredits: 0, inputVideoPerSecondCredits: 0.5, + inputImageRatio: 1.0, + inputImageBaseCredits: 0, + inputImagePerImageCredits: 0.5, }); } }; @@ -238,31 +253,60 @@ const AdminCreditRatios: React.FC = () => { ), }, { - title: '视频倍率', dataIndex: 'inputVideoRatio', width: 100, - render: (v: number, r: CreditRatio) => ( - {r.genType === 'image' ? '-' : ( - = 2 ? '#ef4444' : v >= 1.5 ? '#f59e0b' : '#10b981' }}>x{v} - )} - ), + title: '传入视频', + children: [ + { + title: '倍率', dataIndex: 'inputVideoRatio', width: 90, + render: (v: number, r: CreditRatio) => ( + {r.genType === 'image' ? '-' : ( + = 2 ? '#ef4444' : v >= 1.5 ? '#f59e0b' : '#10b981' }}>x{v} + )} + ), + }, + { + title: '基础积分', dataIndex: 'inputVideoBaseCredits', width: 100, + render: (v: number, r: CreditRatio) => ( + {r.genType === 'image' ? '-' : `${v} 积分`} + ), + }, + { + title: '每秒积分', dataIndex: 'inputVideoPerSecondCredits', width: 100, + render: (v: number, r: CreditRatio) => ( + {r.genType === 'image' ? '-' : `${v} 积分/秒`} + ), + }, + ], }, { - title: '视频基础积分', dataIndex: 'inputVideoBaseCredits', width: 110, - render: (v: number, r: CreditRatio) => ( - {r.genType === 'image' ? '-' : `${v} 积分`} - ), + title: '传入图片', + children: [ + { + title: '倍率', dataIndex: 'inputImageRatio', width: 90, + render: (v: number) => ( + = 2 ? '#ef4444' : v >= 1.5 ? '#f59e0b' : '#10b981' }}>x{v} + ), + }, + { + title: '基础积分', dataIndex: 'inputImageBaseCredits', width: 100, + render: (v: number) => {v} 积分, + }, + { + title: '每张积分', dataIndex: 'inputImagePerImageCredits', width: 100, + render: (v: number) => {v} 积分/张, + }, + ], }, { - title: '视频每秒积分', dataIndex: 'inputVideoPerSecondCredits', width: 110, - render: (v: number, r: CreditRatio) => ( - {r.genType === 'image' ? '-' : `${v} 积分/秒`} - ), - }, - { - title: '示例计算(视频15秒,上传视频15秒)', key: 'example', width: 140, + title: '示例计算', key: 'example', width: 160, render: (_: any, r: CreditRatio) => { let total: number; if (r.genType === 'image') { total = Math.round(r.baseCredits * r.ratio); + if (r.inputImageRatio && r.inputImagePerImageCredits) { + total += Math.round( + (r.inputImageBaseCredits + r.inputImagePerImageCredits * 3) * r.inputImageRatio + ); + } } else { total = Math.round((r.baseCredits + r.perSecondCredits * 15) * r.ratio); if (r.inputVideoRatio && r.inputVideoPerSecondCredits) { @@ -270,6 +314,11 @@ const AdminCreditRatios: React.FC = () => { (r.inputVideoBaseCredits + r.inputVideoPerSecondCredits * 15) * r.inputVideoRatio ); } + if (r.inputImageRatio && r.inputImagePerImageCredits) { + total += Math.round( + (r.inputImageBaseCredits + r.inputImagePerImageCredits * 3) * r.inputImageRatio + ); + } } return {total} 积分; }, @@ -346,7 +395,7 @@ const AdminCreditRatios: React.FC = () => { rowKey="id" loading={loading} pagination={false} - scroll={{ x: 1180 }} + scroll={{ x: 1500 }} /> @@ -421,6 +470,29 @@ const AdminCreditRatios: React.FC = () => { )} + +
+ + 传入图片价格 + +
+ + + + + + + + + +
+
diff --git a/video-gen-api/alembic/versions/2026070901_add_credits_ratio_增加上传图片积分规则.py b/video-gen-api/alembic/versions/2026070901_add_credits_ratio_增加上传图片积分规则.py new file mode 100644 index 00000000..8de07457 --- /dev/null +++ b/video-gen-api/alembic/versions/2026070901_add_credits_ratio_增加上传图片积分规则.py @@ -0,0 +1,37 @@ +"""2026070901_add_credits_ratio_增加上传图片积分规则 + +Revision ID: 2026070901 +Revises: 6c1aaf036f43 +Create Date: 2026-07-01 00:00:00.000000 + +该文件包含 2026-07-01 的数据库迁移内容: +1. 积分规则表增加传入视频计费字段(input_video_ratio, input_video_base_credits, input_video_per_second_credits) +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +revision: str = '2026070901' +down_revision: Union[str, None] = '6c1aaf036f43' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ======================================== + # 2026-07-01 - 积分规则表增加传入图片计费字段 + # ======================================== + op.add_column('credit_ratios', sa.Column('input_image_ratio', sa.Float(), server_default='1.0', nullable=False)) + op.add_column('credit_ratios', sa.Column('input_image_base_credits', sa.Float(), server_default='0.0', nullable=False)) + op.add_column('credit_ratios', sa.Column('input_image_per_image_credits', sa.Float(), server_default='0.5', nullable=False)) + + +def downgrade() -> None: + # ======================================== + # 2026-07-01 - 积分规则表增加传入图片计费字段(回滚) + # ======================================== + op.drop_column('credit_ratios', 'input_image_per_image_credits') + op.drop_column('credit_ratios', 'input_image_base_credits') + op.drop_column('credit_ratios', 'input_image_ratio') diff --git a/video-gen-api/app/api/v1/admin.py b/video-gen-api/app/api/v1/admin.py index 1a96bc87..f37562c2 100644 --- a/video-gen-api/app/api/v1/admin.py +++ b/video-gen-api/app/api/v1/admin.py @@ -1383,6 +1383,7 @@ async def create_credit_ratio( ensure_ascii=False, ), ) + await db.commit() return ratio @@ -1422,6 +1423,7 @@ async def update_credit_ratio( ensure_ascii=False, ), ) + await db.commit() return ratio @@ -1455,6 +1457,7 @@ async def delete_credit_ratio( ensure_ascii=False, ), ) + await db.commit() return {"message": "ok"} diff --git a/video-gen-api/app/main.py b/video-gen-api/app/main.py index 20b31be7..6fe1afae 100644 --- a/video-gen-api/app/main.py +++ b/video-gen-api/app/main.py @@ -29,7 +29,7 @@ async def lifespan(app: FastAPI): os.makedirs(settings.UPLOAD_LOCAL_PATH, exist_ok=True) await init_database() await init_redis() - await _seed_data() + # await _seed_data() # Start task queue (handles both video and image generation) from app.services.video_queue import task_queue diff --git a/video-gen-api/app/models/credit_ratio.py b/video-gen-api/app/models/credit_ratio.py index eae249e2..2fe02905 100644 --- a/video-gen-api/app/models/credit_ratio.py +++ b/video-gen-api/app/models/credit_ratio.py @@ -25,3 +25,6 @@ class CreditRatio(Base, TimestampMixin): input_video_ratio: Mapped[float] = mapped_column(Float, default=1.0) input_video_base_credits: Mapped[float] = mapped_column(Float, default=0.0) input_video_per_second_credits: Mapped[float] = mapped_column(Float, default=0.5) + input_image_ratio: Mapped[float] = mapped_column(Float, default=1.0) + input_image_base_credits: Mapped[float] = mapped_column(Float, default=0.0) + input_image_per_image_credits: Mapped[float] = mapped_column(Float, default=0.0) diff --git a/video-gen-api/app/schemas/credit_ratio.py b/video-gen-api/app/schemas/credit_ratio.py index e9defa29..c1ccca73 100644 --- a/video-gen-api/app/schemas/credit_ratio.py +++ b/video-gen-api/app/schemas/credit_ratio.py @@ -61,6 +61,24 @@ class CreditRatioCreate(BaseModel): description="传入视频每秒积分。视频生成时,用户上传参考视频每秒消耗的积分", examples=[0.5], ) + input_image_ratio: float = Field( + default=1.0, + ge=0, + description="传入图片积分倍率。图片生成时,用户上传参考图片的额外积分倍率", + examples=[1.0], + ) + input_image_base_credits: float = Field( + default=0.0, + ge=0, + description="传入图片基础积分。图片生成时,用户上传参考图片的基础积分", + examples=[0.0], + ) + input_image_per_image_credits: float = Field( + default=0.0, + ge=0, + description="传入图片每张积分。图片生成时,用户上传参考图片每张消耗的积分", + examples=[0.0], + ) class CreditRatioOut(CreditRatioCreate): diff --git a/video-gen-api/app/services/credits.py b/video-gen-api/app/services/credits.py index 2ea842a4..94564ec5 100644 --- a/video-gen-api/app/services/credits.py +++ b/video-gen-api/app/services/credits.py @@ -66,6 +66,7 @@ async def calc_video_credits( resolution: str, engine_id: str | None = None, input_video_duration: float | None = None, + input_image_count: int | None = None, ) -> float: """Calculate video credits using CreditRatio table, with fallback to hardcoded. @@ -75,6 +76,7 @@ async def calc_video_credits( 3. 原硬编码默认算法。 input_video_duration: 用户上传的参考视频总时长(秒),不为空时额外计费 + input_image_count: 用户上传的参考图片数量,不为空时额外计费 """ if not engine_id: video_engines_result = await db.execute( @@ -97,6 +99,11 @@ async def calc_video_credits( ratio.input_video_base_credits + ratio.input_video_per_second_credits * input_video_duration ) * ratio.input_video_ratio base_cost += input_video_cost + if input_image_count and input_image_count > 0: + input_image_cost = ( + ratio.input_image_base_credits + ratio.input_image_per_image_credits * input_image_count + ) * ratio.input_image_ratio + base_cost += input_image_cost return round(base_cost, 2) base = 60.0 @@ -105,6 +112,8 @@ async def calc_video_credits( total = (base + duration_cost) * multiplier if input_video_duration and input_video_duration > 0: total += input_video_duration * 0.5 * multiplier + if input_image_count and input_image_count > 0: + total += input_image_count * 0.5 * multiplier return round(total, 2) @@ -120,6 +129,7 @@ async def calc_image_credits( db: AsyncSession, image_size: str, engine_id: str | None = None, + input_image_count: int | None = None, ) -> float: """Calculate image credits using CreditRatio table, with fallback to hardcoded. @@ -127,6 +137,8 @@ async def calc_image_credits( 1. gen_type=image + engine_id + image_size 精确规则; 2. gen_type=image + image_size 下 base_credits/per_second_credits 最高规则; 3. 原硬编码默认算法。 + + input_image_count: 用户上传的参考图片数量,不为空时额外计费 """ # 如果engine_id为空,默认查询权重最高的图片引擎积分规则 if not engine_id: @@ -144,12 +156,21 @@ async def calc_image_credits( engine_id=engine_id, ) if ratio: - return round(ratio.base_credits * ratio.ratio, 2) + base_cost = ratio.base_credits * ratio.ratio + if input_image_count and input_image_count > 0: + input_image_cost = ( + ratio.input_image_base_credits + ratio.input_image_per_image_credits * input_image_count + ) * ratio.input_image_ratio + base_cost += input_image_cost + return round(base_cost, 2) # Fallback multiplier = {"4K": 2.0, "2K": 1.0}.get(image_size, 1.0) base_cost = 4.0 - return round(base_cost * multiplier, 2) + total = base_cost * multiplier + if input_image_count and input_image_count > 0: + total += input_image_count * 0.5 * multiplier + return round(total, 2) async def _get_existing_credit_record_by_biz_key( diff --git a/video-gen-app/dist/assets/index-CYMIldpb.js b/video-gen-app/dist/assets/index-DGh1eEOO.js similarity index 98% rename from video-gen-app/dist/assets/index-CYMIldpb.js rename to video-gen-app/dist/assets/index-DGh1eEOO.js index e04dd63f..fec13884 100644 --- a/video-gen-app/dist/assets/index-CYMIldpb.js +++ b/video-gen-app/dist/assets/index-DGh1eEOO.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); } } `})]})},j7=({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)(d3,{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)(d3,{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`}})})]})]})},M7={HomeOutlined:(0,$.jsx)(q3,{}),DashboardOutlined:(0,$.jsx)(c3,{}),CodeOutlined:(0,$.jsx)(W4,{}),PlayCircleOutlined:(0,$.jsx)(c8,{}),WalletOutlined:(0,$.jsx)(y5,{}),SettingOutlined:(0,$.jsx)(R8,{}),BellOutlined:(0,$.jsx)(a4,{}),UserOutlined:(0,$.jsx)(h5,{}),AppstoreOutlined:(0,$.jsx)(M2,{}),FileTextOutlined:(0,$.jsx)(AH,{}),StarOutlined:(0,$.jsx)(e5,{}),HeartOutlined:(0,$.jsx)(R3,{}),CameraOutlined:(0,$.jsx)(b4,{}),RobotOutlined:(0,$.jsx)(C8,{}),CalculatorOutlined:(0,$.jsx)(_4,{}),DollarOutlined:(0,$.jsx)(m3,{}),GiftOutlined:(0,$.jsx)(M3,{}),ThunderboltOutlined:(0,$.jsx)(o5,{}),FireOutlined:(0,$.jsx)(E3,{}),CloudOutlined:(0,$.jsx)(F4,{}),SmileOutlined:(0,$.jsx)(X8,{}),TrophyOutlined:(0,$.jsx)(l5,{}),RocketOutlined:(0,$.jsx)(E8,{}),BulbOutlined:(0,$.jsx)(m4,{}),PictureOutlined:(0,$.jsx)($6,{}),VideoCameraOutlined:(0,$.jsx)(_5,{}),AudioOutlined:(0,$.jsx)(q2,{}),MailOutlined:(0,$.jsx)(C6,{}),PhoneOutlined:(0,$.jsx)(X6,{}),GlobalOutlined:(0,$.jsx)(F3,{}),ShoppingCartOutlined:(0,$.jsx)(V8,{}),TeamOutlined:(0,$.jsx)(i5,{}),BarChartOutlined:(0,$.jsx)(n4,{}),PieChartOutlined:(0,$.jsx)(n8,{}),LineChartOutlined:(0,$.jsx)(d6,{}),SecurityScanOutlined:(0,$.jsx)(F8,{}),ApiOutlined:(0,$.jsx)(k2,{}),DatabaseOutlined:(0,$.jsx)(d3,{}),CloudServerOutlined:(0,$.jsx)(R4,{})},Mae=240,N7=[{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(Xq,{})},{gradient:`linear-gradient(135deg, #4a5568, #2d3748)`,shadow:`rgba(74,85,104,0.25)`,icon:(0,$.jsx)(C3,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(n3,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(X2,{})}],Nae=()=>{let e=Ye(),t=Ke(),{user:n,logout:r}=k7(),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u]=yU.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]=yU.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),[G,ee]=(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)(()=>{K5().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(()=>{}),R5().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=()=>{Y5().then(e=>{v(e)}).catch(()=>{})};(0,S.useEffect)(()=>{(async()=>{let e=localStorage.getItem(me);if(e)try{let t=JSON.parse(e),n=await Q5(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(`支付成功!积分已到账`),k7.getState().refreshUser(),localStorage.removeItem(me)):localStorage.removeItem(me)}catch{localStorage.removeItem(me)}})()},[]),(0,S.useEffect)(()=>{fie().then(e=>{m(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),pie().then(e=>{g(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),mie().then(e=>{se(e),e.alipay?ee(`alipay`):e.wechat&&ee(`wechat`)}).catch(()=>{}),ve()},[n]);let ye=t.pathname.startsWith(`/records`)?`/records`:t.pathname,be=Mae,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)(h5,{}),label:`账号: ${n?.username}`,disabled:!0},{key:`credits`,icon:(0,$.jsx)(y5,{style:{color:`#c9a96e`}}),label:`积分: ${n?.credits??0}`,disabled:!0},{type:`divider`},...n?.isTeamManager?[{key:`teamManagement`,icon:(0,$.jsx)(i5,{style:{color:`#6366f1`}}),label:`团队管理`}]:[],{key:`myCredits`,icon:(0,$.jsx)(y5,{}),label:`积分明细`},{key:`orderRecords`,icon:(0,$.jsx)(AH,{}),label:`订单记录`},{key:`messages`,icon:(0,$.jsx)(a4,{}),label:`消息中心${_>0?`(${_})`:``}`},...fe?[{key:`manual`,icon:(0,$.jsx)(AH,{}),label:`操作手册`}]:[],{type:`divider`},{key:`changePwd`,icon:(0,$.jsx)(m6,{}),label:`修改密码`},{type:`divider`},{key:`logout`,icon:(0,$.jsx)(b6,{}),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 z5(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 Jie({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 Q5(e);t.status===`paid`?(ke(),q.current=null,localStorage.removeItem(me),Z.success(`支付成功!积分已到账`),k7.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&&=($5(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=M7[t.icon]||(0,$.jsx)(q3,{}),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)(lG,{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)(o5,{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)(pL,{style:{fontSize:16}}),(0,$.jsx)(`span`,{children:`充值积分`})]}),(0,$.jsx)(j7,{data:ce}),(0,$.jsx)(`div`,{style:{padding:`16px 16px`,flexShrink:0,paddingTop:0},children:(0,$.jsx)(DH,{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)(Nw,{size:36,icon:(0,$.jsx)(h5,{}),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)(k6,{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)(y5,{}),(0,$.jsx)(`span`,{children:n?.credits||0})]})})]})}),(0,$.jsx)(`div`,{className:`mobile-content`,children:ue&&(0,$.jsx)(wt,{})}),(0,$.jsxs)(gH,{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)(o5,{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)(Nw,{size:44,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0},children:(0,$.jsx)(h5,{})}),(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)(y5,{style:{color:`#f59e0b`,marginRight:4}}),`积分: `,(0,$.jsx)(`span`,{style:{color:`#f59e0b`,fontWeight:600},children:n?.credits??0})]})]})]})}),(0,$.jsx)(j7,{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=M7[e.icon]||(0,$.jsx)(q3,{});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=M7[e.icon]||(0,$.jsx)(q3,{});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)(y5,{})}),(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)(AH,{})}),(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)(a4,{})}),(0,$.jsxs)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:[`消息中心`,_>0&&(0,$.jsx)(m$,{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)(m6,{})}),(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)(pL,{})}),(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)(b6,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#ef4444`},children:`退出登录`})]})]})]}),(0,$.jsx)(MK,{title:(0,$.jsxs)(TH,{children:[(0,$.jsx)(m6,{}),`修改密码`]}),open:i,onOk:Ee,onCancel:()=>{a(!1),u.resetFields()},okText:`确认修改`,cancelText:`取消`,width:440,children:(0,$.jsxs)(yU,{form:u,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(yU.Item,{name:`oldPwd`,label:`原密码`,rules:[{required:!0,message:`请输入原密码`}],children:(0,$.jsx)(eG.Password,{placeholder:`请输入原密码`,size:`large`,prefix:(0,$.jsx)(m6,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(yU.Item,{name:`newPwd`,label:`新密码`,rules:[{required:!0,message:`请输入新密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(eG.Password,{placeholder:`请输入新密码(至少6位)`,size:`large`,prefix:(0,$.jsx)(m6,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(yU.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)(eG.Password,{placeholder:`请再次输入新密码`,size:`large`,prefix:(0,$.jsx)(m6,{style:{color:`#94a3b8`,marginRight:8}})})})]})}),(0,$.jsx)(MK,{title:(0,$.jsxs)(TH,{children:[(0,$.jsx)(M3,{}),`积分充值`]}),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 hie(e.id,G),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(`充值成功!积分已到账`),k7.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)(TH,{style:{marginBottom:16},children:[(0,$.jsx)(y5,{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)(VI.Group,{value:G,onChange:e=>ee(e.target.value),style:{display:`flex`,gap:12},children:[oe.alipay&&(0,$.jsxs)(VI.Button,{value:`alipay`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:G===`alipay`?`#1677ff`:void 0,color:G===`alipay`?`#1677ff`:void 0},children:[(0,$.jsx)(E2,{style:{fontSize:16,marginRight:6}}),`支付宝`]}),oe.wechat&&(0,$.jsxs)(VI.Button,{value:`wechat`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:G===`wechat`?`#07c160`:void 0,color:G===`wechat`?`#07c160`:void 0},children:[(0,$.jsx)(S5,{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)($3,{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=N7[t%N7.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)(m$,{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)(MK,{open:V,onCancel:async()=>{if(ke(),q.current){try{await $5(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)(E2,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(S5,{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)(C2,{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 $5(q.current)}catch{}q.current=null}localStorage.removeItem(me),H(!1),W(null),f(null)},style:{borderRadius:10},children:`取消支付`})})]})}),(0,$.jsx)(jae,{}),(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)(M6,{style:{fontSize:20}})})]})}),(0,$.jsx)(MK,{title:(0,$.jsxs)(TH,{children:[(0,$.jsx)(M6,{}),`联系我们`]}),open:c,onCancel:()=>{l(!1),w.resetFields()},footer:null,width:480,className:`contact-modal`,children:(0,$.jsxs)(`div`,{style:{marginTop:8},children:[(0,$.jsxs)(yU,{form:w,layout:`vertical`,children:[(0,$.jsx)(yU.Item,{name:`name`,label:`姓名`,rules:[{required:!0,message:`请输入姓名`}],children:(0,$.jsx)(eG,{placeholder:`请输入您的姓名`,size:`large`})}),(0,$.jsx)(yU.Item,{name:`phone`,label:`手机号`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1[3-9]\d{9}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(eG,{placeholder:`请输入您的手机号`,size:`large`})}),(0,$.jsx)(yU.Item,{name:`companyName`,label:`公司名称`,rules:[{required:!0,message:`请输入公司名称`}],children:(0,$.jsx)(eG,{placeholder:`请输入公司名称`,size:`large`})}),(0,$.jsx)(yU.Item,{name:`industry`,label:`您的行业`,rules:[{required:!0,message:`请输入您的行业`}],children:(0,$.jsx)(eG,{placeholder:`请输入您的行业`,size:`large`})}),(0,$.jsx)(yU.Item,{name:`message`,label:`留言(选填)`,children:(0,$.jsx)(eG.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:`提交`})]})]})})]})},Pae=`http://localhost:8000/api`,Fae=()=>{let{checkAuth:e}=k7(),[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}=k7(),[B]=yU.useForm(),[V]=yU.useForm(),[H]=yU.useForm();(0,S.useEffect)(()=>{K5().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),G=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)}},ee=async()=>{if(W())try{let t=V.getFieldsValue();if(!t.phone||!t.code){Z.error(`请填写手机号和验证码`);return}n(!0),await Zre(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 Qre(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 q5(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 q5(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)(m4,{}),title:`AI 智能优化`,desc:`输入原始提示词,AI 自动为您生成专业级视频、图片描述`},{icon:(0,$.jsx)(c8,{}),title:`一键生成视频、图片`,desc:`支持多种规格生成视频、图片`},{icon:(0,$.jsx)(W3,{}),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(`${Pae.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)(TH,{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)(o5,{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)(LL,{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)(yU,{form:B,size:`large`,layout:`vertical`,onFinish:G,children:[(0,$.jsx)(yU.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(eG,{prefix:(0,$.jsx)(F6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,style:q})}),(0,$.jsx)(yU.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,$.jsx)(eG.Password,{prefix:(0,$.jsx)(m6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入密码`,style:q})}),(0,$.jsx)(yU.Item,{name:`rememberMe`,valuePropName:`checked`,style:{marginBottom:12},children:(0,$.jsx)(az,{children:`记住我的登录状态`})}),(0,$.jsx)(yU.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)(yU,{form:V,size:`large`,layout:`vertical`,children:[(0,$.jsx)(yU.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(eG,{prefix:(0,$.jsx)(F6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:q})}),(0,$.jsx)(yU.Item,{name:`code`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(TH.Compact,{style:{width:`100%`},children:[(0,$.jsx)(eG,{prefix:(0,$.jsx)(k8,{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)(yU.Item,{style:{marginBottom:12},children:(0,$.jsx)(P7,{onSuccess:re,isVerified:b})},C),(0,$.jsx)(yU.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:ee,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`register`&&(0,$.jsxs)(yU,{form:H,size:`large`,layout:`vertical`,children:[(0,$.jsx)(yU.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(eG,{prefix:(0,$.jsx)(F6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:q})}),(0,$.jsx)(yU.Item,{name:`regCode`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(TH.Compact,{style:{width:`100%`},children:[(0,$.jsx)(eG,{prefix:(0,$.jsx)(k8,{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)(yU.Item,{style:{marginBottom:12},children:(0,$.jsx)(P7,{onSuccess:re,isVerified:v})},C),(0,$.jsx)(yU.Item,{name:`password`,rules:[{required:!0,message:`请设置密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(eG.Password,{prefix:(0,$.jsx)(m6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请设置密码(至少6位)`,style:q})}),(0,$.jsx)(yU.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)(az,{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})})]})]})},P7=({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:[]}),F7=D5((e,t)=>({projects:[],records:Iae(),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 eie(),loading:!1})}catch{e({loading:!1})}},createProject:async(n,r)=>{let i=await tie(n,r);return e({projects:[i,...t().projects]}),i},deleteProject:async n=>{await nie(n),e({projects:t().projects.filter(e=>e.id!==n)})},fetchRecords:async(t={})=>{e({loading:!0});try{e({records:await B5(t),loading:!1})}catch{e({loading:!1})}},optimizePrompt:async(n,r)=>{let i=await rie(n,r);try{await k7.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 lie(n,r);try{await k7.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 I7(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 L7=[`#f97316`,`#3b82f6`,`#8b5cf6`,`#10b981`,`#eab308`,`#6366f1`,`#ef4444`,`#06b6d4`,`#64748b`,`#78716c`],R7={ShoppingCartOutlined:(0,$.jsx)(V8,{}),BookOutlined:(0,$.jsx)(c4,{}),HomeOutlined:(0,$.jsx)(q3,{}),FireOutlined:(0,$.jsx)(E3,{}),RocketOutlined:(0,$.jsx)(E8,{}),SkinOutlined:(0,$.jsx)(fre,{}),CompassOutlined:(0,$.jsx)($4,{}),HeartOutlined:(0,$.jsx)(R3,{}),CarOutlined:(0,$.jsx)(C4,{}),CameraOutlined:(0,$.jsx)(b4,{}),CloudOutlined:(0,$.jsx)(F4,{}),StarOutlined:(0,$.jsx)(e5,{}),TrophyOutlined:(0,$.jsx)(l5,{}),ThunderboltOutlined:(0,$.jsx)(o5,{}),BulbOutlined:(0,$.jsx)(m4,{}),CoffeeOutlined:(0,$.jsx)(q4,{}),CrownOutlined:(0,$.jsx)(a3,{}),DashboardOutlined:(0,$.jsx)(c3,{}),FlagOutlined:(0,$.jsx)(k3,{}),GlobalOutlined:(0,$.jsx)(F3,{}),GiftOutlined:(0,$.jsx)(M3,{}),LaptopOutlined:(0,$.jsx)(n6,{}),MobileOutlined:(0,$.jsx)(F6,{}),MonitorOutlined:(0,$.jsx)(R6,{}),PayCircleOutlined:(0,$.jsx)(q6,{}),PictureOutlined:(0,$.jsx)($6,{}),PlayCircleOutlined:(0,$.jsx)(c8,{}),SafetyOutlined:(0,$.jsx)(k8,{}),ShoppingOutlined:(0,$.jsx)(W8,{}),SmileOutlined:(0,$.jsx)(X8,{}),SoundOutlined:(0,$.jsx)(_re,{}),TagOutlined:(0,$.jsx)(Sre,{}),TeamOutlined:(0,$.jsx)(i5,{}),ToolOutlined:(0,$.jsx)(Ere,{}),TruckOutlined:(0,$.jsx)(kre,{}),VideoCameraOutlined:(0,$.jsx)(_5,{}),WalletOutlined:(0,$.jsx)(y5,{}),BankOutlined:(0,$.jsx)($2,{}),BuildOutlined:(0,$.jsx)(d4,{}),ExperimentOutlined:(0,$.jsx)(_3,{}),HighlightOutlined:(0,$.jsx)(V3,{}),IdcardOutlined:(0,$.jsx)(X3,{}),MedicineBoxOutlined:(0,$.jsx)(E6,{}),ReadOutlined:(0,$.jsx)(m8,{}),RestOutlined:(0,$.jsx)(_8,{}),SketchOutlined:(0,$.jsx)(q8,{}),SolutionOutlined:(0,$.jsx)(hre,{})},Lae=()=>{let[e,t]=(0,S.useState)(!1),[n]=yU.useForm(),r=Ye(),{projects:i,fetchProjects:a,createProject:o,deleteProject:s}=F7(),[c,l]=(0,S.useState)([]);(0,S.useEffect)(()=>{a(),Z5().then(l).catch(()=>{})},[]);let u=Object.fromEntries(c.map((e,t)=>[e.key,{label:e.label,color:L7[t%L7.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)(AH,{}),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)(pL,{}),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)(nC,{image:nC.PRESENTED_IMAGE_SIMPLE,description:`还没有项目,创建您的第一个视频项目`,style:{padding:`60px 0`},children:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(pL,{}),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:R7[u[e.industry]?.icon]||(0,$.jsx)(M2,{})}),(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)(m$,{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)(CV,{style:{fontSize:12,color:`#94a3b8`}}),(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`创建于 `,I7(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)(c8,{}),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)(IK,{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)(O$,{}),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)(MK,{title:(0,$.jsxs)(TH,{children:[(0,$.jsx)(M2,{}),`新建项目`]}),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)(yU,{form:n,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(yU.Item,{name:`name`,label:`项目名称`,rules:[{required:!0,message:`请输入项目名称`}],children:(0,$.jsx)(eG,{placeholder:`例如:618电商大促宣传片`,prefix:(0,$.jsx)(uZ,{}),size:`large`})}),(0,$.jsx)(yU.Item,{name:`industry`,label:`所属行业`,rules:[{required:!0,message:`请选择行业`}],children:(0,$.jsx)(MC,{placeholder:`选择项目所属行业`,size:`large`,children:c.map((e,t)=>(0,$.jsx)(MC.Option,{value:e.key,children:(0,$.jsxs)(TH,{children:[R7[e.icon]||(0,$.jsx)(M2,{}),` `,e.label]})},e.key))})})]})})]})},{Text:z7}=Q,Rae={real_person:{title:`选择真人素材库`,empty:`暂无可选 Active 真人素材`,projectError:`加载真人素材项目失败`,assetError:`加载真人素材失败`,fallbackName:`真人素材`},aigc_virtual:{title:`选择虚拟素材库`,empty:`暂无可选 Active 虚拟素材`,projectError:`加载虚拟素材项目失败`,assetError:`加载虚拟素材失败`,fallbackName:`虚拟素材`}},B7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,zae=e=>e.assetType===`Video`?B7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.providerUrl):B7(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.providerUrl),Bae=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},V7=({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=Rae[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`?O7:E7)({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`?_ae:uae)({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)(()=>{e&&setTimeout(()=>{N()},0)},[e,g,b,t]);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)(MK,{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)(TH,{style:{width:`100%`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(z7,{strong:!0,children:`项目组`}),(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(Hq,{}),onClick:M,loading:D})]}),(0,$.jsx)(sK,{spinning:D,children:(0,$.jsx)(hK,{dataSource:m,locale:{emptyText:(0,$.jsx)(nC,{image:nC.PRESENTED_IMAGE_SIMPLE,description:`暂无项目组`})},renderItem:e=>(0,$.jsx)(hK.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)(z7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),(0,$.jsx)(z7,{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)(TH,{style:{width:`100%`,marginBottom:12},children:[(0,$.jsx)(eG,{allowClear:!0,prefix:(0,$.jsx)(DC,{}),placeholder:`搜索素材名称`,value:v,onChange:e=>y(e.target.value),onPressEnter:N}),(0,$.jsx)(MC,{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)(Hq,{}),onClick:N,loading:k,children:`刷新`})]}),(0,$.jsx)(sK,{spinning:k,children:C.length===0?(0,$.jsx)(nC,{image:nC.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=zae(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)(_5,{style:{fontSize:32,color:`#94a3b8`}}):(0,$.jsx)($6,{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:Bae(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)(xC,{})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsx)(z7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name||`未命名素材`}),(0,$.jsxs)(TH,{wrap:!0,size:4,style:{marginTop:6},children:[(0,$.jsx)(m$,{color:a?`blue`:`default`,children:a?`视频`:`图片`}),(0,$.jsx)(m$,{children:e.projectName})]})]})]},e.id)})})})]})]})]})},{Text:H7}=Q,U7=()=>new Date().toISOString().slice(0,10),Vae=e=>e?/^(https?:|data:|blob:)/i.test(e)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,Hae=e=>e===`video`?(0,$.jsx)(_5,{}):e===`audio`?(0,$.jsx)(q2,{}):(0,$.jsx)($6,{}),Uae=e=>e===`video`?`视频`:e===`audio`?`音频`:`图片`,Wae=({open:e,onClose:t,onSelect:n,allowedTypes:r,selectedIds:i=[],title:a=`选择历史上传素材`})=>{let[o,s]=(0,S.useState)(U7()),[c,l]=(0,S.useState)(``),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)(1),[m,h]=(0,S.useState)(20),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)([]),[b,x]=(0,S.useState)(0),[C,w]=(0,S.useState)(new Map),T=(0,S.useMemo)(()=>new Set(i),[i]),E=(0,S.useMemo)(()=>new Set(r||[`image`,`video`,`audio`]),[r]),D=(0,S.useCallback)(async()=>{if(e){_(!0);try{let e=await T7(o,{resourceType:c||void 0,keyword:u||void 0,page:f,pageSize:m,scene:`picker`});y((e.items||[]).filter(e=>E.has(e.resourceType))),x(e.total||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),y([]),x(0)}finally{_(!1)}}},[o,E,u,e,f,m,c]);(0,S.useEffect)(()=>{e&&D()},[e,D]),(0,S.useEffect)(()=>{e&&w(new Map)},[e]);let O=e=>{if(T.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})},k=()=>{let e=Array.from(C.values());if(e.length===0){Z.warning(`请先选择历史素材`);return}n(e),w(new Map),t()},A=(0,S.useMemo)(()=>[{label:`全部`,value:``},{label:`图片`,value:`image`},{label:`视频`,value:`video`},{label:`音频`,value:`audio`}].filter(e=>!e.value||E.has(e.value)),[E]);return(0,$.jsxs)(MK,{title:a,open:e,onCancel:t,width:920,centered:!0,destroyOnHidden:!0,footer:[(0,$.jsx)(X,{onClick:t,children:`取消`},`cancel`),(0,$.jsxs)(X,{type:`primary`,onClick:k,style:{background:`#8b5cf6`},children:[`应用选择 (`,C.size,`)`]},`ok`)],children:[(0,$.jsxs)(TH,{wrap:!0,style:{width:`100%`,marginBottom:16},children:[(0,$.jsx)(eG,{type:`date`,value:o,onChange:e=>{s(e.target.value||U7()),p(1)},style:{width:160}}),(0,$.jsx)(MC,{value:c,options:A,style:{width:120},onChange:e=>{l(e),p(1)}}),(0,$.jsx)(eG,{allowClear:!0,value:u,prefix:(0,$.jsx)(DC,{}),placeholder:`搜索文件名`,style:{width:220},onChange:e=>d(e.target.value),onPressEnter:()=>{p(1),D()}}),(0,$.jsx)(X,{icon:(0,$.jsx)(Hq,{}),onClick:D,children:`刷新`})]}),(0,$.jsx)(sK,{spinning:g,children:v.length===0?(0,$.jsx)(nC,{description:`暂无可复用的历史上传素材`,style:{padding:`48px 0`}}):(0,$.jsxs)(`div`,{style:{height:`500px`,overflowY:`auto`},children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(150px, 1fr))`,gap:14},children:v.map(e=>{let t=C.has(e.id),n=T.has(e.id),r=Vae(e.previewUrl||e.displayUrl||e.resourceUrl);return(0,$.jsxs)(`div`,{onClick:()=>!n&&O(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)(q2,{})})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsxs)(TH,{size:6,style:{marginBottom:6},children:[(0,$.jsx)(m$,{color:`purple`,icon:Hae(e.resourceType),style:{margin:0},children:Uae(e.resourceType)}),e.durationSeconds?(0,$.jsxs)(m$,{style:{margin:0},children:[Number(e.durationSeconds).toFixed(1),`s`]}):null]}),(0,$.jsx)(H7,{ellipsis:!0,style:{display:`block`,fontSize:13,color:`#334155`},title:e.fileName||e.id,children:e.fileName||e.id}),(0,$.jsx)(H7,{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)(xC,{})}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8},children:(0,$.jsx)(m$,{children:`已选`})})]},e.id)})}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:16,paddingBottom:8},children:(0,$.jsx)(BG,{current:f,pageSize:m,total:b,showSizeChanger:!0,pageSizeOptions:[10,20,50,100],onChange:(e,t)=>{p(e),h(t)}})})]})})]})},W7=({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})=>{let h=(0,S.useRef)(null),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(`real_person`),[b,x]=(0,S.useState)(!1),[C,w]=(0,S.useState)(!1),T=()=>{w(!1),h.current?.click()},E=e=>{let t=e.target.files;t&&r&&r(Array.from(t)),h.current&&(h.current.value=``)},D=e=>{if(w(!1),a){y(e),_(!0);return}if(o){o(e);return}y(e),_(!0)},O=(0,$.jsxs)(`div`,{style:{padding:`4px 0`,minWidth:180},children:[(0,$.jsxs)(`div`,{onClick:()=>{T()},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)(uZ,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`本地上传`})]}),(0,$.jsxs)(`div`,{onClick:()=>{w(!1),x(!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)(d3,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`从资产中选择`})]}),(0,$.jsxs)(`div`,{onClick:()=>D(`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)(h5,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`真人素材库`})]}),(0,$.jsxs)(`div`,{onClick:()=>D(`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)(i5,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`虚拟素材库`})]})]});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:h,type:`file`,accept:t,multiple:n,onChange:E,style:{display:`none`}}),c?(0,$.jsx)(Sw,{title:c,children:(0,$.jsx)(Aw,{content:O,open:C,onOpenChange:w,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})})}):(0,$.jsx)(Aw,{content:O,open:C,onOpenChange:w,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})}),(0,$.jsx)(Wae,{open:b,onClose:()=>x(!1),onSelect:e=>{i?.(e),x(!1)},allowedTypes:t.includes(`audio`)?[`image`,`video`,`audio`]:t.includes(`video`)?[`image`,`video`]:[`image`]}),(0,$.jsx)(V7,{open:g,libraryType:v,onClose:()=>_(!1),onSelect:e=>{a?.(e),_(!1)},accept:t,maxCount:t===`image/*`&&!n?1:void 0,maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,usedVideoDuration:p,maxVideoDuration:m})]})};function Gae(){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 G7=({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)(c8,{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)})]})},Kae=()=>{let{projectId:e}=$e(),t=Ye(),[n]=yU.useForm(),{projects:r,records:i,fetchProjects:a,fetchRecords:o,optimizePrompt:s,generateVideo:c}=F7(),l=i.items,{user:u}=k7(),[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)({}),[G,ee]=(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);let c=t?H5:U5;try{let r=await c(e),o=t?`图片`:`视频`,l=t?i+1:a+1;N(e=>[...e,{url:r.url,type:t?`image`:`video`,name:`${o}${l}`,duration:n?s:void 0}]),Z.success(`${o}上传成功`)}catch{Z.error(`上传失败`)}finally{F(!1)}return!1};(0,S.useEffect)(()=>{if(_ie().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)(()=>{Z5().then(e=>{W(Object.fromEntries(e.map(e=>[e.key,e.label]))),ee(Object.fromEntries(e.map(e=>[e.key,e.optionGroups||[]])))}).catch(()=>{}),die().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(()=>{}),uie().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 B5({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=F7.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});F7.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&&G[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=Gae();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 B5({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=F7.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});F7.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 cie(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)(EV,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(Xm,{style:{animation:`spinSlow 1s linear infinite`}})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(k4,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(M4,{})}},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)(pQ,{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)(pQ,{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)(R2,{}),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)(m$,{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)(m$,{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)(VI.Group,{defaultValue:`video`,buttonStyle:`solid`,onChange:tt,children:[(0,$.jsxs)(VI.Button,{value:`video`,children:[(0,$.jsx)(_5,{style:{marginRight:6,fontSize:14}}),` `,`视频`]}),(0,$.jsxs)(VI.Button,{value:`image`,style:{zIndex:0},children:[(0,$.jsx)($6,{style:{marginRight:6,fontSize:14}}),` `,`图片`]})]})]}),xe===`video`&&[{icon:(0,$.jsx)(X$,{}),label:`描述视频+时长`,color:`#6366f1`},{icon:(0,$.jsx)(o5,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(E8,{}),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)(X$,{}),label:`描述图片+尺寸`,color:`#6366f1`},{icon:(0,$.jsx)(o5,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(E8,{}),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)(yU,{form:n,initialValues:{},children:[(0,$.jsx)(yU.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)(yW,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(G7,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`})}),(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),W5(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)(M4,{style:{color:`#fff`,fontSize:10}})})]},t)),(0,$.jsx)(W7,{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)(pL,{style:{fontSize:18,color:`#94a3b8`}})})})]}),(0,$.jsx)(`div`,{style:{padding:`8px 16px 4px`},children:(0,$.jsx)(eG.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)(c8,{style:{color:`#fff`,fontSize:14}})}),(0,$.jsx)(Q.Text,{style:{fontSize:13},children:e.name}),(0,$.jsx)(m$,{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)(pQ,{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)(eG,{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)(iW,{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)(eG,{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)(LL,{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)(k4,{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)(k4,{style:{color:`#10b981`,fontSize:18}}),w[h.id]===`failed`&&(0,$.jsx)(M4,{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)(TH,{size:4,children:[(0,$.jsx)(Sw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(y1,{}),onClick:()=>{navigator.clipboard.writeText(_),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(Sw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(X$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(eG.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)(TH,{size:4,children:[(0,$.jsx)(Sw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(y1,{}),onClick:()=>{navigator.clipboard.writeText(_),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(Sw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(X$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(eG.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)(yW,{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)(Sw,{title:bt?``:`积分不足`,children:(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(E8,{}),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)(yW,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(G7,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,width:64,height:64}),(0,$.jsx)(m$,{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)($6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(_5,{style:{color:`#2563eb`,fontSize:12}})}),i?(0,$.jsx)(pQ,{style:{color:`#6366f1`,fontSize:11,flexShrink:0}}):(0,$.jsx)(E4,{style:{color:`#cbd5e1`,fontSize:11,flexShrink:0}}),(0,$.jsx)(m$,{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)(m$,{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:I7(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:I7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(TH,{children:n===`failed`&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(c8,{}),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)(TH,{size:4,children:[(0,$.jsx)(Sw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(y1,{}),onClick:()=>{navigator.clipboard.writeText(r),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(n===`prompt_optimized`||n===`failed`)&&(0,$.jsx)(Sw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(X$,{}),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)(eG.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)(yW,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(G7,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,width:64,height:64})}),(0,$.jsx)(m$,{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(),W5(t.url).catch(()=>{});let i=e.references.filter((e,t)=>t!==r);F7.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)(M4,{style:{color:`#fff`,fontSize:10}})})]},r)),n===`failed`&&(0,$.jsx)(L0,{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?H5:U5)(t).then(r=>{let i={url:r.url,type:n?`image`:`video`,name:t.name||(n?`图片`:`视频`)},a=e.references||[];F7.getState().updateRecordReferences(e.id,[...a,i]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`)),!1)},children:(0,$.jsx)(Sw,{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)(pL,{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)(E8,{}),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)(c8,{}),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)(Sw,{title:`下载${a===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(j0,{}),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)(TH,{children:[a===`video`?(0,$.jsx)(_5,{style:{color:`#6366f1`,fontSize:13}}):(0,$.jsx)($6,{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:I7(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)(M4,{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)(EV,{style:{color:`#94a3b8`,fontSize:28}}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:a===`image`?`待生成图片`:n===`prompt_optimized`?`待配置视频参数`:`待生成视频`})]})]})]})})]},e.id)})})]}),(0,$.jsx)(MK,{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)(w5,{style:{color:`#fff`,fontSize:16}})})]})})]})},K7={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(Xm,{spin:!0})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(EV,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(Xm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(k4,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(M4,{})}},qae=()=>{let e=Ye(),{records:t,projects:n,fetchRecords:r,fetchProjects:i,generateVideo:a}=F7(),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)(R2,{}),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)(TH,{children:[(0,$.jsx)(b3,{style:{color:`#94a3b8`}}),(0,$.jsx)(MC,{placeholder:`全部项目`,allowClear:!0,style:{width:200},onChange:e=>{m(e),c(1)},children:n.map(e=>(0,$.jsx)(MC.Option,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(MC,{placeholder:`全部状态`,allowClear:!0,style:{width:140},onChange:e=>{g(e),c(1)},children:[(0,$.jsx)(MC.Option,{value:`prompt_optimized`,children:`待生成`}),(0,$.jsx)(MC.Option,{value:`generating`,children:`生成中`}),(0,$.jsx)(MC.Option,{value:`completed`,children:`已完成`}),(0,$.jsx)(MC.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)(nC,{image:nC.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)($6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(_5,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(pQ,{style:{color:`#6366f1`,fontSize:12,flexShrink:0}}):(0,$.jsx)(E4,{style:{color:`#cbd5e1`,fontSize:12,flexShrink:0}}),(0,$.jsx)(m$,{color:K7[e.status].color,icon:K7[e.status].icon,style:{margin:0},children:K7[e.status].text}),(0,$.jsx)(m$,{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:I7(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:I7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(TH,{children:[e.status===`prompt_optimized`&&(0,$.jsx)(X,{type:`primary`,size:`small`,icon:(0,$.jsx)(c8,{}),loading:i,onClick:()=>D(e),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`生成`}),e.status===`generating`&&(0,$.jsx)(m$,{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)(c8,{}),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)(TH,{size:4,children:[(0,$.jsx)(Sw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(y1,{}),onClick:()=>{navigator.clipboard.writeText(r),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),e.status===`prompt_optimized`&&(0,$.jsx)(Sw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(X$,{}),onClick:()=>{b(e.id),v(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt}))},style:{color:`#6366f1`}})})]})]}),n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(eG.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)(E8,{}),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)(c8,{}),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)(Sw,{title:`下载${o===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(j0,{}),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)(TH,{children:[o===`video`?(0,$.jsx)(_5,{style:{color:`#6366f1`}}):(0,$.jsx)($6,{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:[`生成于 `,I7(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)(M4,{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)(EV,{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)(BG,{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)(MK,{title:(0,$.jsxs)(TH,{children:[(0,$.jsx)(E8,{}),`生成视频`]}),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)(MC,{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)(MC,{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}))})]})]})})()})})]})},q7=({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()})},Jae=()=>{let{user:e}=k7(),[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 G5(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)(pJ,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(fz,{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)(TH,{style:{marginBottom:10},children:[(0,$.jsx)(y5,{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)(q7,{value:e?.credits??0})})]})]})}),(0,$.jsx)(fz,{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)(TH,{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)(W2,{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)(q7,{value:f})})]})}),(0,$.jsx)(fz,{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)(TH,{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)(F2,{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)(q7,{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)(o5,{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)(t$,{columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>(0,$.jsx)(m$,{color:e===`recharge`?`green`:`orange`,icon:e===`recharge`?(0,$.jsx)(W2,{}):(0,$.jsx)(F2,{}),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:I7(e)})}],dataSource:t,rowKey:`id`,loading:r,pagination:{current:a,pageSize:s,total:l,onChange:d,showSizeChanger:!0,showTotal:e=>`共 ${e} 条`},scroll:{x:500}})})]})]})},Yae=()=>{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 G5(c,u);r(e.records||[]),a(e.credits||0),s(e.total||0)}catch{r([])}t(!1)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(pJ,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(fz,{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)(y5,{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)(fz,{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)(d8,{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)(fz,{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)(o5,{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)(o5,{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)(sK,{spinning:e,children:n.length===0?(0,$.jsx)(nC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无积分变动记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t$,{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)`}}[e]||{color:`#64748b`,label:e,bg:`rgba(100,116,139,0.1)`};return(0,$.jsx)(m$,{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)(BG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})]})},Xae=()=>{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 gie(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)(AH,{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)(sK,{spinning:e,children:n.length===0?(0,$.jsx)(nC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无订单记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t$,{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)(E2,{style:{fontSize:16}}),label:`支付宝`,color:`#1677ff`},wechat:{icon:(0,$.jsx)(S5,{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)(m$,{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)(BG,{current:o,pageSize:c,total:i,onChange:e=>{s(e)},size:`small`})})]})})})]})})},Zae=()=>{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 J5(c,u);r(e.items||[]),s(e.total||0)}catch{r([])}t(!1)},f=async()=>{try{a(await Y5())}catch{a(0)}},p=async e=>{try{await X5(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)(a4,{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)(sK,{spinning:e,children:n.length===0?(0,$.jsx)(nC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无消息`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t$,{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)(R8,{style:{fontSize:14}})},credit:{color:`#f59e0b`,label:`积分`,bg:`rgba(245,158,11,0.1)`,icon:(0,$.jsx)(y5,{style:{fontSize:14}})},promo:{color:`#8b5cf6`,label:`活动`,bg:`rgba(139,92,246,0.1)`,icon:(0,$.jsx)(M3,{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)(m$,{color:`gray`,style:{background:`rgba(148,163,184,0.1)`},children:`已读`}):(0,$.jsx)(m$,{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)(BG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})})},J7=()=>{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)(FL,{activeKey:t,onChange:n,items:[{key:`credits`,label:`积分明细`},{key:`orders`,label:`订单记录`}],style:{marginBottom:24},size:`large`}),t===`credits`&&(0,$.jsx)(Yae,{}),t===`orders`&&(0,$.jsx)(Xae,{})]})},Qae=`/assets/bg1-CQh9PRPW.png`,{Text:Y7}=Q,$ae=({items:e,selectedId:t,onSelect:n})=>e.length?(0,$.jsx)(TH,{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)(TH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(Y7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(Y7,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(TH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(m$,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(m$,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(m$,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})}):(0,$.jsx)(nC,{description:`暂无项目组`}),eoe={Active:`green`,Processing:`processing`,Failed:`red`,local_deleted:`default`,remote_deleted:`default`,delete_failed:`red`},toe={Active:`入库成功`,Processing:`入库处理中`,Failed:`入库失败`,local_deleted:`本地已删除`,remote_deleted:`远程已删除`,delete_failed:`删除失败`},X7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,Z7=e=>e.assetType===`Video`?X7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):X7(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),noe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},roe=({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=Z7(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=Z7(e);return(0,$.jsx)(LL,{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)(_5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)($6,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(m$,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),r&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(MW,{}),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:noe(e.videoDuration)})]}),children:(0,$.jsxs)(TH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(Sw,{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)(TH,{wrap:!0,size:4,children:[(0,$.jsx)(m$,{color:eoe[e.status]||`default`,children:toe[e.status]||e.status}),(0,$.jsx)(m$,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(TH,{size:6,wrap:!0,children:(0,$.jsx)(IK,{title:`确认删除这个素材吗?`,onConfirm:()=>t(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(O$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(MK,{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)(nC,{description:`暂无素材`})},Q7=2,$7=15,ioe=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`},aoe=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}),ooe=e=>e==null||!Number.isFinite(e)||e<=0?(Z.error(`无法读取视频秒数,请检查视频文件是否损坏`),!1):e$7?(Z.error(`视频素材最长不能超过 ${$7} 秒`),!1):!0,soe=({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)(MK,{title:`上传真人素材`,open:t,onCancel:n,onOk:async()=>{let t=i[0]?.originFileObj;if(!t){Z.warning(`请先选择图片或视频素材`);return}let a=ioe(t);if(a===`Image`&&!t.type.startsWith(`image/`)){Z.error(`仅支持图片或视频素材`);return}l(!0);try{let i=a===`Video`?await aoe(t):null;if(a===`Video`&&!ooe(i))return;await sae(e,{url:(a===`Video`?await U5(t):await H5(t)).url,assetType:a,name:o.trim()||t.name,videoDuration:i,fileSize:t.size,mimeType:t.type||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)(TH,{direction:`vertical`,style:{width:`100%`},size:12,children:[(0,$.jsx)(eG,{value:o,onChange:e=>s(e.target.value),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsx)(L0,{accept:`image/*,video/*`,maxCount:1,fileList:i,beforeUpload:()=>!1,onChange:({fileList:e})=>a(e),listType:`picture`,children:(0,$.jsx)(X,{icon:(0,$.jsx)(f5,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12},children:[`当前开放图片和视频,音频暂不接入。视频素材必须在 `,Q7,`~`,$7,` 秒内;入库后会经过火山真人一致性校验,Active 后才可用于 AI 创作。`]})]})})},coe=({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 cae(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 lae(e),await x(h,_),n(),Z.success(`素材已删除`)}catch(e){Z.error(e?.message||`删除素材失败`)}},w=async()=>{try{await D7(e.id),Z.success(`项目组已删除`),t()}catch(e){Z.error(e?.message||`删除项目组失败`)}},T=e.status===`active`;return(0,$.jsxs)(LL,{title:(0,$.jsx)(TH,{children:(0,$.jsx)(`span`,{children:e.name})}),extra:(0,$.jsxs)(TH,{children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(f5,{}),disabled:!T,onClick:()=>c(!0),children:`上传素材`}),(0,$.jsx)(IK,{title:`确认删除这个真人素材项目组吗?`,onConfirm:w,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(O$,{}),children:`删除项目组`})})]}),style:{borderRadius:16},children:[!T&&(0,$.jsx)(Q.Paragraph,{style:{color:`#f97316`},children:`项目组未完成真人认证,暂不能上传素材。请重新创建项目组并完成手机扫码认证。`}),(0,$.jsxs)(TH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(eG.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:l,onChange:e=>u(e.target.value),onSearch:()=>x(1,_),style:{width:240}}),(0,$.jsx)(MC,{allowClear:!0,placeholder:`素材状态`,value:d,onChange:e=>f(e),style:{width:150},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(MC,{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)(sK,{spinning:a,children:r.length===0?(0,$.jsx)(nC,{description:`暂无素材,上传图片/视频后会异步入库`,style:{marginTop:80}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(roe,{items:r,loading:a,onDelete:C,onRefresh:()=>x(h,_)}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(BG,{current:h,pageSize:_,total:y,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>x(e,t)})})]})}),(0,$.jsx)(soe,{projectId:e.id,open:s,onClose:()=>c(!1),onSuccess:()=>{x(1,_),n()}})]})},e9=`group_active`,t9=2e3,loe=()=>{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]=yU.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 E7({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 E7({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 oae(e);if(p(n),n.status===e9){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||t9)),r()},w=async()=>{let e=await g.validateFields();l(!0);try{let t=`${window.location.origin}/private-portrait-authorized`,n=await aae({...e,callbackRedirectUrl:t});d(n.project),p(n.validateSession),Z.success(`请使用手机扫码完成人脸认证`),n.validateSession?.id&&C(n.validateSession.id,n.project.id,n.pollIntervalMs||t9)}catch(e){Z.error(e?.message||`创建项目组认证二维码失败`)}finally{l(!1)}},T=f?.h5Link||``,E=f?.status===e9;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`真人素材库`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`创建项目组时先完成真人认证,认证成功后项目组才会正式创建并可上传素材。`})]}),(0,$.jsxs)(pJ,{gutter:16,children:[(0,$.jsx)(fz,{xs:24,lg:7,children:(0,$.jsx)(LL,{title:(0,$.jsx)(`span`,{children:`真人素材项目组`}),extra:(0,$.jsx)(TH,{size:8,children:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(pL,{}),onClick:()=>s(!0),size:`small`,children:`新建项目组`})}),style:{borderRadius:16,minHeight:520},children:(0,$.jsx)(sK,{spinning:i,children:e.length===0?(0,$.jsx)(nC,{description:`暂无项目组`}):(0,$.jsx)($ae,{items:e,selectedId:n?.id,onSelect:r})})})}),(0,$.jsx)(fz,{xs:24,lg:17,children:n?(0,$.jsx)(coe,{project:n,onDeleted:()=>{r(null),b()},onChanged:b}):(0,$.jsx)(LL,{style:{borderRadius:16,minHeight:520,textAlign:`center`,color:`#94a3b8`},children:`请先创建或选择一个真人素材项目组`})})]}),(0,$.jsx)(MK,{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)(TH,{direction:`vertical`,align:`center`,size:16,style:{width:`100%`},children:[E?(0,$.jsx)(k4,{style:{fontSize:54,color:`#22c55e`}}):T?(0,$.jsx)(qq,{value:T,size:220}):(0,$.jsx)(sK,{}),(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)(yU,{form:g,layout:`vertical`,children:[(0,$.jsx)(yU.Item,{label:`项目组名称`,name:`name`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(eG,{placeholder:`例如:达人A、客户B、张三人像`})}),(0,$.jsx)(yU.Item,{label:`描述`,name:`description`,children:(0,$.jsx)(eG.TextArea,{rows:3,placeholder:`可选`})}),(0,$.jsx)(Q.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`点击后会生成真人认证二维码。手机扫码认证成功后,项目组才会出现在项目列表中。`})]})})]})},{Text:n9}=Q,r9=2,i9=15,uoe={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`}},doe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},a9=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,o9=e=>e.assetType===`Video`?a9(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):a9(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),foe=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`},poe=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}),moe=(e,t)=>e==null||!Number.isFinite(e)||e<=0?(t(`无法读取视频秒数,请检查视频文件是否损坏`),!1):ei9?(t(`视频素材最长不能超过 ${i9} 秒`),!1):!0,hoe=({status:e})=>{let t=e||`-`,n=uoe[t];return(0,$.jsx)(m$,{color:n?.color||`default`,children:n?.label||t})},goe=()=>{let{message:e}=qb.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]=yU.useForm(),U=(0,S.useRef)(null),W=(0,S.useMemo)(()=>t.find(e=>e.id===r)||null,[t,r]),G=async()=>{c(!0);try{let e=(await O7({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)}},ee=async(t=d,n=p)=>{if(!r){o([]),g(0);return}u(!0);try{let e=await hae(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 G()};(0,S.useEffect)(()=>{te()},[]),(0,S.useEffect)(()=>{r&&ee(1,p)},[r]),(0,S.useEffect)(()=>(a.some(e=>e.status!==`Failed`&&e.status!==`Active`)&&r?U.current||=window.setInterval(()=>{ee(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 fae(t);e.success(`虚拟人像项目组已创建`),T(!1),H.resetFields(),await G(),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=foe(t);if(n===`Image`&&!t.type.startsWith(`image/`)){e.error(`仅支持图片或视频素材`);return}j(!0);try{let i=n===`Video`?await poe(t):null;if(n===`Video`&&!moe(i,e.error))return;await mae(r,{url:(n===`Video`?await U5(t):await H5(t)).url,assetType:n,name:P.trim()||t.name,videoDuration:i,fileSize:t.size,mimeType:t.type||null}),e.success(n===`Video`?`视频素材已提交入库,处理中`:`图片素材已提交入库,处理中`),k(!1),N([]),F(``),await Promise.all([G(),ee(1,p)])}catch(t){e.error(t?.message||`上传素材失败`)}finally{j(!1)}},re=async t=>{try{await gae(t),e.success(`素材已删除,远端删除将异步执行`),await Promise.all([G(),ee(d,p)])}catch(t){e.error(t?.message||`删除素材失败`)}},ie=async()=>{if(r)try{await pae(r),e.success(`项目组已删除,远端资产组将异步删除`),i(void 0),await te()}catch(t){e.error(t?.message||`删除项目组失败`)}},ae=t=>{let n=o9(t);if(!n){e.warning(`暂无可预览地址`);return}z(n),V(t.assetType===`Video`?`Video`:`Image`),L(!0)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(pJ,{gutter:[16,16],children:[(0,$.jsx)(fz,{xs:24,lg:7,children:(0,$.jsx)(LL,{title:`虚拟人像项目组`,extra:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(pL,{}),onClick:()=>T(!0),children:`创建项目组`}),style:{borderRadius:16,minHeight:520},children:(0,$.jsx)(sK,{spinning:s,children:t.length===0?(0,$.jsx)(nC,{description:`暂无虚拟人像项目组`}):(0,$.jsx)(TH,{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)(TH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(n9,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(n9,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(TH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(m$,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(m$,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(m$,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})})})})}),(0,$.jsx)(fz,{xs:24,lg:17,children:(0,$.jsxs)(LL,{title:W?W.name:`素材资产`,extra:(0,$.jsxs)(TH,{wrap:!0,children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(f5,{}),disabled:!r,onClick:()=>k(!0),children:`上传图片/视频`}),r&&(0,$.jsx)(IK,{title:`确认删除当前虚拟人像项目组吗?`,onConfirm:ie,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(O$,{}),children:`删除项目组`})})]}),style:{borderRadius:16,minHeight:520},children:[(0,$.jsxs)(TH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(eG.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:_,onChange:e=>v(e.target.value),onSearch:()=>ee(1,p),style:{width:240}}),(0,$.jsx)(MC,{allowClear:!0,placeholder:`素材状态`,value:y,onChange:e=>b(e),style:{width:150},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(MC,{allowClear:!0,placeholder:`素材类型`,value:x,onChange:e=>C(e),style:{width:130},options:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{onClick:()=>ee(1,p),children:`筛选`})]}),(0,$.jsx)(sK,{spinning:l,children:r?a.length===0?(0,$.jsx)(nC,{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=o9(e),n=e.assetType===`Video`;return(0,$.jsx)(LL,{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)(_5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)($6,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(m$,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),t&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(MW,{}),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:doe(e.videoDuration)})]}),children:(0,$.jsxs)(TH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(Sw,{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)(TH,{wrap:!0,size:4,children:[(0,$.jsx)(hoe,{status:e.status}),(0,$.jsx)(m$,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(TH,{size:6,wrap:!0,children:(0,$.jsx)(IK,{title:`确认删除这个虚拟人像素材吗?`,onConfirm:()=>re(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(O$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(BG,{current:d,pageSize:p,total:h,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>ee(e,t)})})]}):(0,$.jsx)(nC,{description:`请先创建或选择项目组`,style:{marginTop:80}})})]})})]}),(0,$.jsx)(MK,{title:`创建虚拟人像项目组`,open:w,onCancel:()=>T(!1),onOk:ne,confirmLoading:E,okText:`创建并同步火山 Asset Group`,children:(0,$.jsxs)(yU,{form:H,layout:`vertical`,children:[(0,$.jsx)(yU.Item,{name:`name`,label:`项目组名称`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(eG,{placeholder:`例如:虚拟主播A / 品牌代言人B`,maxLength:128})}),(0,$.jsx)(yU.Item,{name:`description`,label:`描述`,children:(0,$.jsx)(eG.TextArea,{placeholder:`可填写人物设定、服装风格、素材要求等`,maxLength:2e3,rows:4})})]})}),(0,$.jsx)(MK,{title:`上传虚拟人像素材`,open:O,onCancel:()=>k(!1),onOk:K,confirmLoading:A,okText:`提交入库`,children:(0,$.jsxs)(TH,{direction:`vertical`,style:{width:`100%`},size:14,children:[(0,$.jsx)(eG,{value:P,onChange:e=>F(e.target.value),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsx)(L0,{accept:`image/*,video/*`,maxCount:1,fileList:M,beforeUpload:()=>!1,onChange:({fileList:e})=>N(e),listType:`picture`,children:(0,$.jsx)(X,{icon:(0,$.jsx)(f5,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{padding:12,background:`#f8fafc`,borderRadius:12,color:`#64748b`,fontSize:13},children:[`当前开放图片和视频,音频暂不接入。视频素材必须在 `,r9,`~`,i9,` 秒内;提交后会调用火山 CreateAsset 异步处理,状态变为 Active 后才可用于 AI 创作。`]})]})}),(0,$.jsx)(MK,{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:_oe,Text:s9,Paragraph:c9}=Q,l9=e=>e===`aigc_virtual`?`aigc_virtual`:`real_person`,voe=()=>{let[e,t]=On(),[n,r]=(0,S.useState)(()=>l9(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([dae(),O7({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([iae(),E7({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]);let u=(0,S.useMemo)(()=>o.find(e=>e.id===c)||null,[o,c]),d=(0,S.useMemo)(()=>i?`已用 ${i.usedAssetCount||0} / ${i.assetLimit||0} 个素材,剩余 ${i.remainingAssetCount||0}`:`额度加载中`,[i]),f=(0,S.useMemo)(()=>[{key:`real_person`,label:`真人素材`,children:(0,$.jsx)(loe,{})},{key:`aigc_virtual`,label:`虚拟素材`,children:(0,$.jsx)(goe,{})}],[]);return(0,$.jsxs)(`div`,{style:{padding:16},children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(_oe,{level:4,style:{margin:0},children:`私域素材库`}),(0,$.jsx)(s9,{type:`secondary`,children:`统一管理真人素材和虚拟素材。真人项目组需先完成人脸认证,虚拟项目组会同步创建火山 AIGC Asset Group。`})]}),(0,$.jsxs)(pJ,{gutter:[16,16],style:{marginBottom:16},children:[(0,$.jsx)(fz,{xs:24,md:8,children:(0,$.jsxs)(LL,{style:{borderRadius:16,background:`linear-gradient(135deg,#f5f3ff,#fff)`},children:[(0,$.jsx)(s9,{type:`secondary`,children:`素材总额度`}),(0,$.jsx)(`div`,{style:{fontSize:24,fontWeight:700,color:`#4f46e5`,marginTop:8},children:d}),(0,$.jsx)(c9,{style:{margin:`8px 0 0`,color:`#64748b`},children:`真人/虚拟共用,图片/视频共用;音频暂不开放。`})]})}),(0,$.jsx)(fz,{xs:24,md:8,children:(0,$.jsxs)(LL,{style:{borderRadius:16},children:[(0,$.jsx)(s9,{type:`secondary`,children:`项目组`}),(0,$.jsx)(`div`,{style:{fontSize:24,fontWeight:700,color:`#1e293b`,marginTop:8},children:o.length}),(0,$.jsx)(c9,{style:{margin:`8px 0 0`,color:`#64748b`},children:n===`aigc_virtual`?`虚拟人像项目会同步创建火山 AIGC Asset Group。`:`真人项目组需完成人脸认证后才可上传素材。`})]})}),(0,$.jsx)(fz,{xs:24,md:8,children:(0,$.jsxs)(LL,{style:{borderRadius:16},children:[(0,$.jsx)(s9,{type:`secondary`,children:`当前项目素材`}),(0,$.jsx)(`div`,{style:{fontSize:24,fontWeight:700,color:`#1e293b`,marginTop:8},children:u?.assetCount||0}),(0,$.jsx)(c9,{style:{margin:`8px 0 0`,color:`#64748b`},children:`仅 Active 状态素材可在 AI 创作中引用。`})]})})]}),(0,$.jsx)(FL,{activeKey:n,onChange:n=>{let i=l9(n);r(i);let a=new URLSearchParams(e);a.set(`filterType`,`private_portrait`),a.set(`portraitTab`,i),t(a,{replace:!0})},items:f,destroyInactiveTabPane:!1})]})},{Header:yoe,Sider:boe,Content:xoe}=lG,{TextArea:Soe}=eG,{Option:Coe}=MC,{Text:u9}=Q,woe=()=>{let{message:e}=qb.useApp(),[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(`1`),[a,o]=(0,S.useState)([]),{mediaType:s,countType:c,selectedRatio:l,selectedResolution:u,width:d,height:f,videoDuration:p,videoAspectRatio:m,videoResolution:h,engineOptions:g,enginesele:_,inputValue:v,setMediaType:y,setCountType:b,setSelectedRatio:x,setSelectedResolution:C,setWidth:w,setHeight:T,setVideoDuration:E,setVideoAspectRatio:D,setVideoResolution:O,setEngineOptions:k,setEnginesele:A,setInputValue:j,currentMedia:M,setCurrentMedia:N}=F7(),P=(s===`image`?_?.image:_?.video)?.find(e=>e.id===c),F=P?.maxImageCount??4,I=P?.maxVideoCount??1,[L,R]=(0,S.useState)(!1),[z,B]=(0,S.useState)(!1),[V,H]=(0,S.useState)(`universal`),[U,W]=(0,S.useState)(null),[G,ee]=(0,S.useState)(null),[te,ne]=(0,S.useState)(null),[K,re]=(0,S.useState)(!1),[ie,ae]=(0,S.useState)(!1),[q,oe]=(0,S.useState)(`real_person`),[se,ce]=(0,S.useState)(!1),le=(0,S.useRef)(null),ue=(0,S.useCallback)(()=>{le.current&&=(window.clearTimeout(le.current),null),ce(!0)},[]),de=(0,S.useCallback)(()=>{le.current&&window.clearTimeout(le.current),le.current=window.setTimeout(()=>{ce(!1),le.current=null},260)},[]),[fe,pe]=(0,S.useState)(!1),me=(0,S.useRef)(null),[he,ge]=(0,S.useState)({top:0,left:0}),_e=e=>{let t=0,n=0,r=0;return e.map(e=>e.type===`image`?(t++,`图片${t}`):e.type===`video`?(n++,`视频${n}`):(r++,`音频${r}`))},[ve,ye]=(0,S.useState)(!1),[be,xe]=(0,S.useState)(``),[Se,Ce]=(0,S.useState)(`image`),we=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(ve&&Se===`video`){let e=()=>{we.current&&we.current.play().catch(()=>{})};we.current&&(we.current.readyState>=2?e():we.current.addEventListener(`loadedmetadata`,e));let t=setTimeout(e,300);return()=>{clearTimeout(t),we.current&&(we.current.removeEventListener(`loadedmetadata`,e),we.current.pause())}}else we.current&&we.current.pause()},[ve,Se]);let[Te,Ee]=(0,S.useState)(new Set),De=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}}},Oe=e=>{let t=De(e);return t?Math.floor(Date.now()/1e3)>t:!1},[ke,Ae]=(0,S.useState)(!1),[je,Me]=(0,S.useState)(``),[Ne,Pe]=(0,S.useState)(`image`),[Fe,Ie]=(0,S.useState)(``),Le=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(ke&&Ne===`video`&&Le.current){let e=Le.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(!ke&&Le.current){let e=Le.current;e.pause(),e.muted=!0,e.currentTime=0}},[ke,Ne,je]);let[Re,ze]=(0,S.useState)(null),[Be,Ve]=(0,S.useState)(0),[He,Ue]=(0,S.useState)(!1),[We,Ge]=(0,S.useState)(null),[Ke,qe]=(0,S.useState)({x:0,y:0}),[Je,Ye]=(0,S.useState)(!1),[Xe,Ze]=(0,S.useState)(!1),[Qe,$e]=(0,S.useState)([]),[et,tt]=(0,S.useState)([]),[nt,rt]=(0,S.useState)({}),[it,at]=(0,S.useState)(!1),[ot,st]=(0,S.useState)(!1),[ct,lt]=(0,S.useState)([]),[ut,dt]=(0,S.useState)([]),[ft,pt]=(0,S.useState)([]),mt=()=>{let e={};if(e=ft.find(e=>e.modelConfigId===c&&e.genType===s&&e.resolution===(s===`video`?h:u)),e||(s===`video`?(e={perSecondCredits:2,baseCredits:60,ratio:1,inputVideoRatio:1,inputVideoBaseCredits:0,inputVideoPerSecondCredits:.5},h===`1080p`?e.ratio=2:h===`720p`?e.ratio=1.5:h===`480p`&&(e.ratio=1)):(e={perSecondCredits:.1,baseCredits:4,ratio:1},u===`2K`?e.ratio=1:u===`4K`&&(e.ratio=2))),s===`video`){let t=(p*e.perSecondCredits+e.baseCredits)*e.ratio,n=M.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}return Number(t.toFixed(2))}else return Number((e.baseCredits*e.ratio).toFixed(2))},ht=(0,S.useRef)(null),gt=(0,S.useRef)(null),_t=(0,S.useRef)(null);(0,S.useRef)(!0);let vt=(0,S.useRef)(!1),yt=(0,S.useRef)(0);a.find(e=>e.id===r);let[bt,xt]=(0,S.useState)([]),[St,Ct]=(0,S.useState)({page:1,pageSize:20}),[wt,Tt]=(0,S.useState)(0),[Et,Dt]=(0,S.useState)(!1);(0,S.useEffect)(()=>()=>{le.current&&window.clearTimeout(le.current)},[]);let Ot=(0,S.useCallback)((e=`instant`)=>{let t=gt.current;t&&(yt.current=Date.now(),requestAnimationFrame(()=>{t.scrollTo({top:t.scrollHeight,behavior:e})}))},[]);(0,S.useEffect)(()=>{if(bt.length>0&&!vt.current){let e=setTimeout(()=>{Ot(`smooth`),vt.current=!0},300);return()=>clearTimeout(e)}},[bt.length,Ot]),(0,S.useEffect)(()=>{let e=s===`image`?_.image:_.video;e&&e.length>0&&(e.some(e=>e.id===c)||b(e[0].id))},[s,_]),(0,S.useEffect)(()=>{let e=e=>{let t=e.target;ot&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&st(!1),it&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&at(!1),Je&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ye(!1),Xe&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ze(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[ot,it,Je,Xe]),(0,S.useEffect)(()=>{if(s!==`video`)return;let e=_?.video?.find(e=>e.id===c);if(!e)return;let t=e.supportsFirstLastFrame??!1,n=e.supportsUniversalReference??!0;H(e=>n?`universal`:e===`universal`&&!n&&t?`first_last_frame`:e)},[c,s,_]),(0,S.useEffect)(()=>{e7().then(e=>{if(A(e.engine),e.engine.video&&e.engine.video.length>0){let t=e.engine.video[0],n=e.engine.video.find(e=>e.id===c)||t;k({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(m)||D(n.supportedRatios?.[0]||`16:9`),n.supportedResolutions?.includes(h)||O(n.supportedResolutions?.[0]||`720p`),n.supportedDurations?.includes(p)||E(n.supportedDurations?.[0]||5),c===`请选择`&&b(n.id)}if(e.engine.image&&e.engine.image.length>0){let t=e.engine.image.find(e=>e.id===c)||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($e(a.map(e=>({value:e,label:e}))),rt(n),tt(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]/);w(Number(e)),T(Number(t)),x(a[0]),C(i)}c===`请选择`&&b(t.id)}}).catch(()=>{}),xie().then(e=>{pt(e)}),t7(St).then(e=>{let t=e.items,n=e.total;xt(t),Tt(n)})},[]),(0,S.useEffect)(()=>{if(_t.current&&=(clearInterval(_t.current),null),bt.some(e=>e.status===`generating`))return _t.current=window.setInterval(()=>{t7(St).then(e=>{xt(t=>t.map(t=>t.status===`generating`&&e.items.find(e=>e.id===t.id)||t)),Tt(e.total)}).catch(e=>{})},1e4),()=>{_t.current&&=(clearInterval(_t.current),null)}},[bt,St]),(0,S.useEffect)(()=>{if(!Je)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ye(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[Je]),(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]);let kt=e=>{let t=Object.keys(nt).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),n=nt[u]&&nt[u][e]?u:t.find(t=>nt[t]&&nt[t][e])||t[0];if(n&&nt[n]&&nt[n][e]){let[t,r]=nt[n][e].split(/[×x]/);w(Number(t)),T(Number(r)),x(e),C(n)}},At=e=>{nt[e]||(e=Object.keys(nt).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)})[0]||e);let t=nt[e]?Object.keys(nt[e]):[];$e(t.map(e=>({value:e,label:e})));let n=t.includes(l)?l:t[0]||``;if(n&&nt[e]&&nt[e][n]){let[t,r]=nt[e][n].split(/[×x]/);w(Number(t)),T(Number(r)),x(n),C(e)}},jt=()=>{w(f),T(d)},Mt=_?.video?.find(e=>e.id===c),Nt=Mt?.supportsFirstLastFrame??!1,Pt=Mt?.supportsUniversalReference??!0,Ft=e=>{e===`first_last_frame`&&!Nt||e===`universal`&&!Pt||(H(e),re(!1),N([]),j(``))},It=()=>{let e=U;W(G),ee(e)},Lt=()=>{W(null),ee(null)},Rt=()=>{ee(null)},zt=async()=>{let t=s===`video`&&V===`first_last_frame`;if(t){if(!v.trim()){e.warning(`请输入内容`);return}}else if(!v.trim()&&M.length===0){e.warning(`请输入内容或上传图片/视频`);return}let n;t?(n=[],U&&n.push({...U,role:`first_frame`}),G&&n.push({...G,role:`last_frame`}),n.length===0&&(n=void 0)):n=M.length>0?M.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:s,original_prompt:v.trim(),engine_id:c,idempotency_key:new Date().toLocaleString(`zh-CN`),media_references:n,...s===`image`&&{image_size:u,image_proportion:l,image_px:d+`x`+f},...s===`video`&&{duration:p,aspect_ratio:m,resolution:h}};B(!0),vie(r).then(()=>{j(``),N([]),W(null),ee(null);let e={...St,page:1};Ct(e),t7(e).then(e=>{xt(t=>[...t,e.items[e.items.length-1]]),Tt(e.total),setTimeout(()=>{ht.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(()=>{B(!1)}),setTimeout(()=>{B(!1)},3e3)},Bt=async()=>{if(bt.length>=wt)return;let e=gt.current;if(!e)return;let t=e.scrollTop,n=e.scrollHeight;Dt(!0);try{let r=St.page+1,i=await t7({...St,page:r}),a=Array.isArray(i)?{items:i,total:i.length}:i;a.total&&Tt(a.total),Ct(e=>({...e,page:r})),xt(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{Dt(!1)}},Vt=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)}),Ht=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)}),Ut=e=>{let t=e.startsWith(`http`)?e:`http://ceshi.apiforeign.minzhong.cn${e}`;if(Re===t){let e=document.getElementById(`audio-player`);e&&e.pause(),ze(null)}else ze(t)},Wt=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)}),Gt=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)}),Kt=(e,t)=>{if(e<300||e>6e3)return`图片宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`图片高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;return n<.4||n>2.5?`图片宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`:null},qt=(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},Jt=async(t,n)=>{let r=t.type.startsWith(`image/`),i=t.type.startsWith(`video/`);if(s===`video`&&V===`first_last_frame`){if(!r)return e.error(`首尾帧模式仅支持上传图片`),!1;if(t.size/1024/1024>10)return e.error(`图片大小不能超过10MB`),!1;let i=n||te;if(!i)return e.error(`请选择首帧或尾帧上传位置`),!1;R(!0);try{let n=await H5(t),r={name:t.name,type:`image`,url:n.url,role:i===`first`?`first_frame`:`last_frame`};i===`first`?W(r):ee(r),e.success(`图片上传成功`)}catch{e.error(`上传失败`)}finally{R(!1),ne(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(s===`image`&&(i||a))return e.error(`图片模式仅支持上传图片`),!1;if(a&&s!==`video`)return e.error(`仅视频模式支持上传音频`),!1;let o=i?100:a?50:10,c=i?`视频`:a?`音频`:`图片`;if(t.size/1024/1024>o)return e.error(`${c}大小不能超过${o}MB`),!1;if(r)try{let{width:n,height:r}=await Wt(t),i=Kt(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let l=M.filter(e=>e.type===`image`).length;if(r&&l>=yn)return e.error(`该引擎最多上传${yn}张图片`),!1;let u=M.filter(e=>e.type===`video`).length;if(i&&u>=bn)return e.error(`该引擎最多上传${bn}个视频`),!1;let d=M.filter(e=>e.type===`audio`).length;if(a&&d>=xn)return e.error(`该引擎最多上传${xn}个音频`),!1;let f=0,p=0;if(i)try{if(f=await Vt(t),f<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=M.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 Gt(t),a=qt(r,i);if(a)return e.error(a),!1}catch{return e.error(`无法获取视频信息,请检查文件是否损坏`),!1}if(a)try{if(p=await Ht(t),p<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=M.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}R(!0);try{let e=await(r?H5:a?V5:U5)(t),n=r?`image`:a?`audio`:`video`,o=[...M,{name:t.name,type:n,url:e.url,label:``,...i&&{duration:f},...a&&{duration:p}}],s=_e(o);N(o.map((e,t)=>({...e,label:s[t]})))}catch{e.error(`上传失败`)}finally{R(!1)}return!1},Yt=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}let o=0,s=0;if(r)try{if(o=await Vt(t),o<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=F7.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 Ht(t),s<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=F7.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=F7.getState().currentMedia;if(!Qt(u,[l]))return!1;try{let e=await(n?H5:i?V5:U5)(t);return{name:l.name,type:l.type,url:e.url,label:l.label||``,...l.duration!==void 0&&{duration:l.duration}}}catch{return e.error(`上传失败`),!1}},Xt=async t=>{let n=0,r=0;for(let e of t){R(!0);let t=await Yt(e);if(t){let e=[...F7.getState().currentMedia,t],r=_e(e);N(e.map((e,t)=>({...e,label:r[t]}))),n++}else r++;R(!1)}n>0&&e.success(`成功上传${n}个文件${r>0?`,${r}个文件上传失败`:``}`)},Zt=(e,t)=>e.filter(e=>e.type===t).reduce((e,t)=>e+(Number(t.duration)||0),0),Qt=(t,n)=>{if(!n.length)return!1;if(s===`image`&&n.some(e=>e.type!==`image`))return e.error(`图片模式仅支持添加图片素材`),!1;if(n.some(e=>e.type===`audio`)&&s!==`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,c=n.filter(e=>e.type===`video`).length,l=n.filter(e=>e.type===`audio`).length;if(r+o>yn)return e.error(`该引擎最多上传${yn}张图片,当前还能添加 ${Math.max(0,yn-r)} 张`),!1;if(i+c>bn)return e.error(`该引擎最多上传${bn}个视频,当前还能添加 ${Math.max(0,bn-i)} 个`),!1;if(a+l>xn)return e.error(`该引擎最多上传${xn}个音频,当前还能添加 ${Math.max(0,xn-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=Zt(t,`video`)+Zt(n,`video`);if(u>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${u.toFixed(1)} 秒`),!1;let d=Zt(t,`audio`)+Zt(n,`audio`);return d>15?(e.error(`所有音频素材总时长不能超过 15 秒,当前 ${d.toFixed(1)} 秒`),!1):!0},$t=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`&&s!==`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}:{}}},en=t=>{let n=t.map($t).filter(Boolean);if(!n.length)return;let r=F7.getState().currentMedia;if(!Qt(r,n))return;let i=[...r,...n],a=_e(i);N(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个历史上传素材参考`)},tn=t=>{if(t.assetType===`Audio`)return e.error(`音频私域素材暂不支持用于 AI 创作`),null;let n=t.assetType===`Video`?`video`:`image`,r=q===`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}}},nn=e=>{oe(e),ae(!0)},rn=t=>{let n=t.map(tn).filter(Boolean),r=F7.getState().currentMedia;if(!Qt(r,n))return;let i=[...r,...n],a=_e(i);N(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个${q===`aigc_virtual`?`虚拟`:`真人`}素材参考`)},an=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,on=e=>{let t=M.filter((t,n)=>n!==e),n=_e(t);N(t.map((e,t)=>({...e,label:n[t]})))},sn=(e,t)=>{let n=e.selectionStart;return t.slice(0,n).match(/@([^@\s]*)$/)&&M.length>0?(pe(!0),!0):(pe(!1),!1)},cn=e=>{let t=e.target.value;j(t);let n=e.target;sn(n,t)},ln=e=>{fe&&e.key===`Escape`&&pe(!1)},un=e=>{let t=me.current?.resizableTextArea?.textArea;if(!t)return;let n=t.selectionStart,r=v.slice(0,n),i=v.slice(n),a=r.lastIndexOf(`@`);if(a===-1){pe(!1);return}j(r.slice(0,a)+`@${e} `+i),pe(!1),setTimeout(()=>{let n=a+e.length+2;t.focus(),t.setSelectionRange(n,n)},0)},dn=()=>{ye(!1),xe(``),we.current&&we.current.pause()},fn=e=>{if(e.preventDefault(),e.stopPropagation(),!be)return;let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${be}&download=1`,t.download=Se===`image`?`image.png`:`video.mp4`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},pn=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`},mn=e=>e?/^https?:\/\//i.test(e)?e:`http://ceshi.apiforeign.minzhong.cn${e}`:``,hn=e=>{e?.url&&(Me(e.url),Pe(pn(e)),Ie(e.name||`附件`),Ae(!0))},gn=s===`video`&&V===`first_last_frame`,_n=gn?!!(v.trim()||U):!!(v.trim()||M.length>0),vn=s===`image`?`输入画面描述,或上传图片参考风格、构图、主体与光影。例:@图片1 参考色调,生成一张简洁高级的产品海报。`:gn?`首帧尾帧可以不传,如需传入建议描述首帧到尾帧的主体动作、镜头运动、节奏与转场。例:从首帧自然推进到尾帧,产品居中突出,动作平滑连贯。`:`上传最多12个参考素材,输入文字或 @ 引用参考内容,自由组合图、文、视频。例:@图片1 模仿 @视频1 的动作。`,yn=F,bn=I,xn=P?.maxAudioCount??1;return(0,$.jsxs)(lG,{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:Re||null,autoPlay:!0,onEnded:()=>ze(null),style:{display:`none`}}),!1,(0,$.jsxs)(lG,{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)(xoe,{style:{flex:1,margin:0,padding:`20px 24px 22px`,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,overflow:`hidden`,minHeight:0},children:[bt.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)(C8,{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:`输入想法、剧本或上传参考,开始你的创作之旅`})]}),bt.length>0&&(0,$.jsxs)(`div`,{ref:gt,className:`ai-create-scroll`,style:{flex:1,overflowY:`auto`,paddingRight:10,paddingBottom:18,background:`#fff`},onScroll:e=>{let t=e.currentTarget;!(Date.now()-yt.current<500)&&vt.current&&t.scrollTop<=50&&!Et&&bt.length{let e=Z;return bt.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)(C8,{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();qe({x:n.left,y:n.top-10}),Ge(t.id),Ue(!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(),j(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`);W(e?{...e,label:e.label||``}:null),ee(n?{...n,label:n.label||``}:null),N([]),H(`first_last_frame`)}else N(t.mediaReferences.map(e=>({name:e.name,type:e.type,url:e.url,label:e.label||``,role:e.role}))),W(null),ee(null),H(`universal`);else N([]),W(null),ee(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)(Hq,{style:{fontSize:12}}),`重新编辑`]}),(0,$.jsx)(IK,{title:`确定要删除吗?`,onConfirm:async()=>{try{await bie(t.id),e.success(`删除成功`),xt(e=>e.filter(e=>e.id!==t.id)),Tt(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)(O$,{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)(Lre,{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:()=>{xe(t.imageUrl),Ce(`image`),ye(!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:()=>{xe(t.videoUrl),Ce(`video`),ye(!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:ht})]}),He&&We&&(()=>{let e=bt.find(e=>e.id===We)?.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:()=>{Ue(!1),Ge(null)}}),(0,$.jsxs)(`div`,{className:`ai-reference-expanded-tray ai-attachment-popover`,style:{position:`fixed`,top:`max(84px, ${Ke.y-96}px)`,left:`max(24px, min(${Ke.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:()=>{Ue(!1),Ge(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=pn(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(),Ut(e.url)):(hn(e),Ue(!1),Ge(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:mn(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:mn(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:Re===(e.url.startsWith(`http`)?e.url:`http://ceshi.apiforeign.minzhong.cn${e.url}`)?(0,$.jsx)(W6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(q2,{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:()=>{hn(e),Ue(!1),Ge(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:gn?220:70,minWidth:gn?220:70,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`flex-start`,paddingTop:2,gap:8},children:s===`video`&&V===`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:`首帧(可选)`})}),U?(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64},children:[(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${U.url}`,alt:U.name,onClick:()=>{Me(U.url),Pe(`image`),Ie(U.name),Ae(!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:Lt,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)(O$,{style:{fontSize:9}})})]}):(0,$.jsx)(W7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&Jt(e[0],`first`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];W({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||``;W({name:n.name||`首帧图片`,type:`image`,url:r,role:`first_frame`,label:``}),e.success(`成功添加首帧`)}},uploading:L,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)(pL,{style:{fontSize:18,color:`#8b5cf6`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`上传首帧`})]})})]}),(0,$.jsx)(`button`,{onClick:It,disabled:!U||!G,title:`调换首尾帧`,style:{width:32,height:32,alignSelf:`center`,borderRadius:50,border:`1px solid rgba(231, 234, 240, 0.95)`,background:U&&G?`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`:`#F3F5F8`,cursor:U&&G?`pointer`:`not-allowed`,color:U&&G?`#fff`:`#98A2B3`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:U&&G?`0 6px 14px rgba(139, 92, 246, 0.24)`:`none`,transition:`all 0.2s ease`,flexShrink:0},onMouseEnter:e=>{U&&G&&(e.currentTarget.style.transform=`scale(1.06)`)},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:(0,$.jsx)(iW,{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:U?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:()=>{Me(G.url),Pe(`image`),Ie(G.name),Ae(!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:Rt,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)(O$,{style:{fontSize:9}})})]}):U?(0,$.jsx)(W7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&Jt(e[0],`last`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];ee({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||``;ee({name:n.name||`尾帧图片`,type:`image`,url:r,role:`last_frame`,label:``}),e.success(`成功添加尾帧`)}},uploading:L,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)(pL,{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)(pL,{style:{fontSize:18,color:`#cbd5e1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#94a3b8`,fontWeight:500},children:`请先上传首帧`})]})]})]}):(0,$.jsx)($.Fragment,{children:!(s===`video`&&V===`first_last_frame`)&&(0,$.jsxs)(`div`,{style:{position:`relative`,width:64,height:72,marginTop:`-10`},onMouseEnter:ue,onMouseLeave:de,children:[M.length===0&&(0,$.jsx)(W7,{accept:s===`image`?`image/*`:`image/*,video/*,audio/*`,onLocalSelect:Xt,onHistorySelect:en,onPortraitLibrarySelect:e=>{nn(e)},uploading:L,tooltipTitle:s===`image`?`图片${M.filter(e=>e.type===`image`).length}/${F}`:`图片${M.filter(e=>e.type===`image`).length}/${F}, +`)){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)(c8,{style:{color:`#fff`,fontSize:14}})}),(0,$.jsx)(Q.Text,{style:{fontSize:13},children:e.name}),(0,$.jsx)(m$,{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)(pQ,{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)(eG,{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)(iW,{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)(eG,{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)(LL,{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)(k4,{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)(k4,{style:{color:`#10b981`,fontSize:18}}),w[h.id]===`failed`&&(0,$.jsx)(M4,{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)(TH,{size:4,children:[(0,$.jsx)(Sw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(y1,{}),onClick:()=>{navigator.clipboard.writeText(_),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(Sw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(X$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(eG.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)(TH,{size:4,children:[(0,$.jsx)(Sw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(y1,{}),onClick:()=>{navigator.clipboard.writeText(_),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(Sw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(X$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(eG.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)(yW,{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)(Sw,{title:bt?``:`积分不足`,children:(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(E8,{}),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)(yW,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(G7,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,width:64,height:64}),(0,$.jsx)(m$,{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)($6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(_5,{style:{color:`#2563eb`,fontSize:12}})}),i?(0,$.jsx)(pQ,{style:{color:`#6366f1`,fontSize:11,flexShrink:0}}):(0,$.jsx)(E4,{style:{color:`#cbd5e1`,fontSize:11,flexShrink:0}}),(0,$.jsx)(m$,{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)(m$,{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:I7(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:I7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(TH,{children:n===`failed`&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(c8,{}),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)(TH,{size:4,children:[(0,$.jsx)(Sw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(y1,{}),onClick:()=>{navigator.clipboard.writeText(r),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),(n===`prompt_optimized`||n===`failed`)&&(0,$.jsx)(Sw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(X$,{}),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)(eG.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)(yW,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(G7,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,width:64,height:64})}),(0,$.jsx)(m$,{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(),W5(t.url).catch(()=>{});let i=e.references.filter((e,t)=>t!==r);F7.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)(M4,{style:{color:`#fff`,fontSize:10}})})]},r)),n===`failed`&&(0,$.jsx)(L0,{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?H5:U5)(t).then(r=>{let i={url:r.url,type:n?`image`:`video`,name:t.name||(n?`图片`:`视频`)},a=e.references||[];F7.getState().updateRecordReferences(e.id,[...a,i]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`)),!1)},children:(0,$.jsx)(Sw,{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)(pL,{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)(E8,{}),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)(c8,{}),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)(Sw,{title:`下载${a===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(j0,{}),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)(TH,{children:[a===`video`?(0,$.jsx)(_5,{style:{color:`#6366f1`,fontSize:13}}):(0,$.jsx)($6,{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:I7(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)(M4,{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)(EV,{style:{color:`#94a3b8`,fontSize:28}}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:a===`image`?`待生成图片`:n===`prompt_optimized`?`待配置视频参数`:`待生成视频`})]})]})]})})]},e.id)})})]}),(0,$.jsx)(MK,{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)(w5,{style:{color:`#fff`,fontSize:16}})})]})})]})},K7={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(Xm,{spin:!0})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(EV,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(Xm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(k4,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(M4,{})}},qae=()=>{let e=Ye(),{records:t,projects:n,fetchRecords:r,fetchProjects:i,generateVideo:a}=F7(),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)(R2,{}),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)(TH,{children:[(0,$.jsx)(b3,{style:{color:`#94a3b8`}}),(0,$.jsx)(MC,{placeholder:`全部项目`,allowClear:!0,style:{width:200},onChange:e=>{m(e),c(1)},children:n.map(e=>(0,$.jsx)(MC.Option,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(MC,{placeholder:`全部状态`,allowClear:!0,style:{width:140},onChange:e=>{g(e),c(1)},children:[(0,$.jsx)(MC.Option,{value:`prompt_optimized`,children:`待生成`}),(0,$.jsx)(MC.Option,{value:`generating`,children:`生成中`}),(0,$.jsx)(MC.Option,{value:`completed`,children:`已完成`}),(0,$.jsx)(MC.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)(nC,{image:nC.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)($6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(_5,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(pQ,{style:{color:`#6366f1`,fontSize:12,flexShrink:0}}):(0,$.jsx)(E4,{style:{color:`#cbd5e1`,fontSize:12,flexShrink:0}}),(0,$.jsx)(m$,{color:K7[e.status].color,icon:K7[e.status].icon,style:{margin:0},children:K7[e.status].text}),(0,$.jsx)(m$,{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:I7(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:I7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(TH,{children:[e.status===`prompt_optimized`&&(0,$.jsx)(X,{type:`primary`,size:`small`,icon:(0,$.jsx)(c8,{}),loading:i,onClick:()=>D(e),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`生成`}),e.status===`generating`&&(0,$.jsx)(m$,{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)(c8,{}),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)(TH,{size:4,children:[(0,$.jsx)(Sw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(y1,{}),onClick:()=>{navigator.clipboard.writeText(r),Z.success(`已复制`)},style:{color:`#94a3b8`}})}),e.status===`prompt_optimized`&&(0,$.jsx)(Sw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(X$,{}),onClick:()=>{b(e.id),v(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt}))},style:{color:`#6366f1`}})})]})]}),n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(eG.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)(E8,{}),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)(c8,{}),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)(Sw,{title:`下载${o===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(j0,{}),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)(TH,{children:[o===`video`?(0,$.jsx)(_5,{style:{color:`#6366f1`}}):(0,$.jsx)($6,{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:[`生成于 `,I7(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)(M4,{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)(EV,{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)(BG,{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)(MK,{title:(0,$.jsxs)(TH,{children:[(0,$.jsx)(E8,{}),`生成视频`]}),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)(MC,{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)(MC,{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}))})]})]})})()})})]})},q7=({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()})},Jae=()=>{let{user:e}=k7(),[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 G5(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)(pJ,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(fz,{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)(TH,{style:{marginBottom:10},children:[(0,$.jsx)(y5,{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)(q7,{value:e?.credits??0})})]})]})}),(0,$.jsx)(fz,{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)(TH,{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)(W2,{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)(q7,{value:f})})]})}),(0,$.jsx)(fz,{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)(TH,{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)(F2,{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)(q7,{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)(o5,{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)(t$,{columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>(0,$.jsx)(m$,{color:e===`recharge`?`green`:`orange`,icon:e===`recharge`?(0,$.jsx)(W2,{}):(0,$.jsx)(F2,{}),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:I7(e)})}],dataSource:t,rowKey:`id`,loading:r,pagination:{current:a,pageSize:s,total:l,onChange:d,showSizeChanger:!0,showTotal:e=>`共 ${e} 条`},scroll:{x:500}})})]})]})},Yae=()=>{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 G5(c,u);r(e.records||[]),a(e.credits||0),s(e.total||0)}catch{r([])}t(!1)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(pJ,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(fz,{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)(y5,{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)(fz,{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)(d8,{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)(fz,{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)(o5,{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)(o5,{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)(sK,{spinning:e,children:n.length===0?(0,$.jsx)(nC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无积分变动记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t$,{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)`}}[e]||{color:`#64748b`,label:e,bg:`rgba(100,116,139,0.1)`};return(0,$.jsx)(m$,{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)(BG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})]})},Xae=()=>{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 gie(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)(AH,{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)(sK,{spinning:e,children:n.length===0?(0,$.jsx)(nC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无订单记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t$,{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)(E2,{style:{fontSize:16}}),label:`支付宝`,color:`#1677ff`},wechat:{icon:(0,$.jsx)(S5,{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)(m$,{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)(BG,{current:o,pageSize:c,total:i,onChange:e=>{s(e)},size:`small`})})]})})})]})})},Zae=()=>{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 J5(c,u);r(e.items||[]),s(e.total||0)}catch{r([])}t(!1)},f=async()=>{try{a(await Y5())}catch{a(0)}},p=async e=>{try{await X5(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)(a4,{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)(sK,{spinning:e,children:n.length===0?(0,$.jsx)(nC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无消息`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t$,{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)(R8,{style:{fontSize:14}})},credit:{color:`#f59e0b`,label:`积分`,bg:`rgba(245,158,11,0.1)`,icon:(0,$.jsx)(y5,{style:{fontSize:14}})},promo:{color:`#8b5cf6`,label:`活动`,bg:`rgba(139,92,246,0.1)`,icon:(0,$.jsx)(M3,{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)(m$,{color:`gray`,style:{background:`rgba(148,163,184,0.1)`},children:`已读`}):(0,$.jsx)(m$,{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)(BG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})})},J7=()=>{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)(FL,{activeKey:t,onChange:n,items:[{key:`credits`,label:`积分明细`},{key:`orders`,label:`订单记录`}],style:{marginBottom:24},size:`large`}),t===`credits`&&(0,$.jsx)(Yae,{}),t===`orders`&&(0,$.jsx)(Xae,{})]})},Qae=`/assets/bg1-CQh9PRPW.png`,{Text:Y7}=Q,$ae=({items:e,selectedId:t,onSelect:n})=>e.length?(0,$.jsx)(TH,{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)(TH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(Y7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(Y7,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(TH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(m$,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(m$,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(m$,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})}):(0,$.jsx)(nC,{description:`暂无项目组`}),eoe={Active:`green`,Processing:`processing`,Failed:`red`,local_deleted:`default`,remote_deleted:`default`,delete_failed:`red`},toe={Active:`入库成功`,Processing:`入库处理中`,Failed:`入库失败`,local_deleted:`本地已删除`,remote_deleted:`远程已删除`,delete_failed:`删除失败`},X7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,Z7=e=>e.assetType===`Video`?X7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):X7(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),noe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},roe=({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=Z7(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=Z7(e);return(0,$.jsx)(LL,{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)(_5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)($6,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(m$,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),r&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(MW,{}),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:noe(e.videoDuration)})]}),children:(0,$.jsxs)(TH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(Sw,{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)(TH,{wrap:!0,size:4,children:[(0,$.jsx)(m$,{color:eoe[e.status]||`default`,children:toe[e.status]||e.status}),(0,$.jsx)(m$,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(TH,{size:6,wrap:!0,children:(0,$.jsx)(IK,{title:`确认删除这个素材吗?`,onConfirm:()=>t(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(O$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(MK,{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)(nC,{description:`暂无素材`})},Q7=2,$7=15,ioe=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`},aoe=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}),ooe=e=>e==null||!Number.isFinite(e)||e<=0?(Z.error(`无法读取视频秒数,请检查视频文件是否损坏`),!1):e$7?(Z.error(`视频素材最长不能超过 ${$7} 秒`),!1):!0,soe=({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)(MK,{title:`上传真人素材`,open:t,onCancel:n,onOk:async()=>{let t=i[0]?.originFileObj;if(!t){Z.warning(`请先选择图片或视频素材`);return}let a=ioe(t);if(a===`Image`&&!t.type.startsWith(`image/`)){Z.error(`仅支持图片或视频素材`);return}l(!0);try{let i=a===`Video`?await aoe(t):null;if(a===`Video`&&!ooe(i))return;await sae(e,{url:(a===`Video`?await U5(t):await H5(t)).url,assetType:a,name:o.trim()||t.name,videoDuration:i,fileSize:t.size,mimeType:t.type||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)(TH,{direction:`vertical`,style:{width:`100%`},size:12,children:[(0,$.jsx)(eG,{value:o,onChange:e=>s(e.target.value),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsx)(L0,{accept:`image/*,video/*`,maxCount:1,fileList:i,beforeUpload:()=>!1,onChange:({fileList:e})=>a(e),listType:`picture`,children:(0,$.jsx)(X,{icon:(0,$.jsx)(f5,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{color:`#64748b`,fontSize:12},children:[`当前开放图片和视频,音频暂不接入。视频素材必须在 `,Q7,`~`,$7,` 秒内;入库后会经过火山真人一致性校验,Active 后才可用于 AI 创作。`]})]})})},coe=({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 cae(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 lae(e),await x(h,_),n(),Z.success(`素材已删除`)}catch(e){Z.error(e?.message||`删除素材失败`)}},w=async()=>{try{await D7(e.id),Z.success(`项目组已删除`),t()}catch(e){Z.error(e?.message||`删除项目组失败`)}},T=e.status===`active`;return(0,$.jsxs)(LL,{title:(0,$.jsx)(TH,{children:(0,$.jsx)(`span`,{children:e.name})}),extra:(0,$.jsxs)(TH,{children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(f5,{}),disabled:!T,onClick:()=>c(!0),children:`上传素材`}),(0,$.jsx)(IK,{title:`确认删除这个真人素材项目组吗?`,onConfirm:w,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(O$,{}),children:`删除项目组`})})]}),style:{borderRadius:16},children:[!T&&(0,$.jsx)(Q.Paragraph,{style:{color:`#f97316`},children:`项目组未完成真人认证,暂不能上传素材。请重新创建项目组并完成手机扫码认证。`}),(0,$.jsxs)(TH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(eG.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:l,onChange:e=>u(e.target.value),onSearch:()=>x(1,_),style:{width:240}}),(0,$.jsx)(MC,{allowClear:!0,placeholder:`素材状态`,value:d,onChange:e=>f(e),style:{width:150},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(MC,{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)(sK,{spinning:a,children:r.length===0?(0,$.jsx)(nC,{description:`暂无素材,上传图片/视频后会异步入库`,style:{marginTop:80}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(roe,{items:r,loading:a,onDelete:C,onRefresh:()=>x(h,_)}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(BG,{current:h,pageSize:_,total:y,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>x(e,t)})})]})}),(0,$.jsx)(soe,{projectId:e.id,open:s,onClose:()=>c(!1),onSuccess:()=>{x(1,_),n()}})]})},e9=`group_active`,t9=2e3,loe=()=>{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]=yU.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 E7({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 E7({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 oae(e);if(p(n),n.status===e9){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||t9)),r()},w=async()=>{let e=await g.validateFields();l(!0);try{let t=`${window.location.origin}/private-portrait-authorized`,n=await aae({...e,callbackRedirectUrl:t});d(n.project),p(n.validateSession),Z.success(`请使用手机扫码完成人脸认证`),n.validateSession?.id&&C(n.validateSession.id,n.project.id,n.pollIntervalMs||t9)}catch(e){Z.error(e?.message||`创建项目组认证二维码失败`)}finally{l(!1)}},T=f?.h5Link||``,E=f?.status===e9;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`真人素材库`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`创建项目组时先完成真人认证,认证成功后项目组才会正式创建并可上传素材。`})]}),(0,$.jsxs)(pJ,{gutter:16,children:[(0,$.jsx)(fz,{xs:24,lg:7,children:(0,$.jsx)(LL,{title:(0,$.jsx)(`span`,{children:`真人素材项目组`}),extra:(0,$.jsx)(TH,{size:8,children:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(pL,{}),onClick:()=>s(!0),size:`small`,children:`新建项目组`})}),style:{borderRadius:16,minHeight:520},children:(0,$.jsx)(sK,{spinning:i,children:e.length===0?(0,$.jsx)(nC,{description:`暂无项目组`}):(0,$.jsx)($ae,{items:e,selectedId:n?.id,onSelect:r})})})}),(0,$.jsx)(fz,{xs:24,lg:17,children:n?(0,$.jsx)(coe,{project:n,onDeleted:()=>{r(null),b()},onChanged:b}):(0,$.jsx)(LL,{style:{borderRadius:16,minHeight:520,textAlign:`center`,color:`#94a3b8`},children:`请先创建或选择一个真人素材项目组`})})]}),(0,$.jsx)(MK,{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)(TH,{direction:`vertical`,align:`center`,size:16,style:{width:`100%`},children:[E?(0,$.jsx)(k4,{style:{fontSize:54,color:`#22c55e`}}):T?(0,$.jsx)(qq,{value:T,size:220}):(0,$.jsx)(sK,{}),(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)(yU,{form:g,layout:`vertical`,children:[(0,$.jsx)(yU.Item,{label:`项目组名称`,name:`name`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(eG,{placeholder:`例如:达人A、客户B、张三人像`})}),(0,$.jsx)(yU.Item,{label:`描述`,name:`description`,children:(0,$.jsx)(eG.TextArea,{rows:3,placeholder:`可选`})}),(0,$.jsx)(Q.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`点击后会生成真人认证二维码。手机扫码认证成功后,项目组才会出现在项目列表中。`})]})})]})},{Text:n9}=Q,r9=2,i9=15,uoe={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`}},doe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},a9=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,o9=e=>e.assetType===`Video`?a9(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):a9(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),foe=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`},poe=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}),moe=(e,t)=>e==null||!Number.isFinite(e)||e<=0?(t(`无法读取视频秒数,请检查视频文件是否损坏`),!1):ei9?(t(`视频素材最长不能超过 ${i9} 秒`),!1):!0,hoe=({status:e})=>{let t=e||`-`,n=uoe[t];return(0,$.jsx)(m$,{color:n?.color||`default`,children:n?.label||t})},goe=()=>{let{message:e}=qb.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]=yU.useForm(),U=(0,S.useRef)(null),W=(0,S.useMemo)(()=>t.find(e=>e.id===r)||null,[t,r]),G=async()=>{c(!0);try{let e=(await O7({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)}},ee=async(t=d,n=p)=>{if(!r){o([]),g(0);return}u(!0);try{let e=await hae(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 G()};(0,S.useEffect)(()=>{te()},[]),(0,S.useEffect)(()=>{r&&ee(1,p)},[r]),(0,S.useEffect)(()=>(a.some(e=>e.status!==`Failed`&&e.status!==`Active`)&&r?U.current||=window.setInterval(()=>{ee(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 fae(t);e.success(`虚拟人像项目组已创建`),T(!1),H.resetFields(),await G(),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=foe(t);if(n===`Image`&&!t.type.startsWith(`image/`)){e.error(`仅支持图片或视频素材`);return}j(!0);try{let i=n===`Video`?await poe(t):null;if(n===`Video`&&!moe(i,e.error))return;await mae(r,{url:(n===`Video`?await U5(t):await H5(t)).url,assetType:n,name:P.trim()||t.name,videoDuration:i,fileSize:t.size,mimeType:t.type||null}),e.success(n===`Video`?`视频素材已提交入库,处理中`:`图片素材已提交入库,处理中`),k(!1),N([]),F(``),await Promise.all([G(),ee(1,p)])}catch(t){e.error(t?.message||`上传素材失败`)}finally{j(!1)}},re=async t=>{try{await gae(t),e.success(`素材已删除,远端删除将异步执行`),await Promise.all([G(),ee(d,p)])}catch(t){e.error(t?.message||`删除素材失败`)}},ie=async()=>{if(r)try{await pae(r),e.success(`项目组已删除,远端资产组将异步删除`),i(void 0),await te()}catch(t){e.error(t?.message||`删除项目组失败`)}},ae=t=>{let n=o9(t);if(!n){e.warning(`暂无可预览地址`);return}z(n),V(t.assetType===`Video`?`Video`:`Image`),L(!0)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(pJ,{gutter:[16,16],children:[(0,$.jsx)(fz,{xs:24,lg:7,children:(0,$.jsx)(LL,{title:`虚拟人像项目组`,extra:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(pL,{}),onClick:()=>T(!0),children:`创建项目组`}),style:{borderRadius:16,minHeight:520},children:(0,$.jsx)(sK,{spinning:s,children:t.length===0?(0,$.jsx)(nC,{description:`暂无虚拟人像项目组`}):(0,$.jsx)(TH,{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)(TH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(n9,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(n9,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(TH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(m$,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(m$,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(m$,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})})})})}),(0,$.jsx)(fz,{xs:24,lg:17,children:(0,$.jsxs)(LL,{title:W?W.name:`素材资产`,extra:(0,$.jsxs)(TH,{wrap:!0,children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(f5,{}),disabled:!r,onClick:()=>k(!0),children:`上传图片/视频`}),r&&(0,$.jsx)(IK,{title:`确认删除当前虚拟人像项目组吗?`,onConfirm:ie,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(O$,{}),children:`删除项目组`})})]}),style:{borderRadius:16,minHeight:520},children:[(0,$.jsxs)(TH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(eG.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:_,onChange:e=>v(e.target.value),onSearch:()=>ee(1,p),style:{width:240}}),(0,$.jsx)(MC,{allowClear:!0,placeholder:`素材状态`,value:y,onChange:e=>b(e),style:{width:150},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(MC,{allowClear:!0,placeholder:`素材类型`,value:x,onChange:e=>C(e),style:{width:130},options:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{onClick:()=>ee(1,p),children:`筛选`})]}),(0,$.jsx)(sK,{spinning:l,children:r?a.length===0?(0,$.jsx)(nC,{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=o9(e),n=e.assetType===`Video`;return(0,$.jsx)(LL,{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)(_5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)($6,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(m$,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),t&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(MW,{}),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:doe(e.videoDuration)})]}),children:(0,$.jsxs)(TH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(Sw,{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)(TH,{wrap:!0,size:4,children:[(0,$.jsx)(hoe,{status:e.status}),(0,$.jsx)(m$,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(TH,{size:6,wrap:!0,children:(0,$.jsx)(IK,{title:`确认删除这个虚拟人像素材吗?`,onConfirm:()=>re(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(O$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(BG,{current:d,pageSize:p,total:h,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>ee(e,t)})})]}):(0,$.jsx)(nC,{description:`请先创建或选择项目组`,style:{marginTop:80}})})]})})]}),(0,$.jsx)(MK,{title:`创建虚拟人像项目组`,open:w,onCancel:()=>T(!1),onOk:ne,confirmLoading:E,okText:`创建并同步火山 Asset Group`,children:(0,$.jsxs)(yU,{form:H,layout:`vertical`,children:[(0,$.jsx)(yU.Item,{name:`name`,label:`项目组名称`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(eG,{placeholder:`例如:虚拟主播A / 品牌代言人B`,maxLength:128})}),(0,$.jsx)(yU.Item,{name:`description`,label:`描述`,children:(0,$.jsx)(eG.TextArea,{placeholder:`可填写人物设定、服装风格、素材要求等`,maxLength:2e3,rows:4})})]})}),(0,$.jsx)(MK,{title:`上传虚拟人像素材`,open:O,onCancel:()=>k(!1),onOk:K,confirmLoading:A,okText:`提交入库`,children:(0,$.jsxs)(TH,{direction:`vertical`,style:{width:`100%`},size:14,children:[(0,$.jsx)(eG,{value:P,onChange:e=>F(e.target.value),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsx)(L0,{accept:`image/*,video/*`,maxCount:1,fileList:M,beforeUpload:()=>!1,onChange:({fileList:e})=>N(e),listType:`picture`,children:(0,$.jsx)(X,{icon:(0,$.jsx)(f5,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{padding:12,background:`#f8fafc`,borderRadius:12,color:`#64748b`,fontSize:13},children:[`当前开放图片和视频,音频暂不接入。视频素材必须在 `,r9,`~`,i9,` 秒内;提交后会调用火山 CreateAsset 异步处理,状态变为 Active 后才可用于 AI 创作。`]})]})}),(0,$.jsx)(MK,{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:_oe,Text:s9,Paragraph:c9}=Q,l9=e=>e===`aigc_virtual`?`aigc_virtual`:`real_person`,voe=()=>{let[e,t]=On(),[n,r]=(0,S.useState)(()=>l9(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([dae(),O7({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([iae(),E7({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]);let u=(0,S.useMemo)(()=>o.find(e=>e.id===c)||null,[o,c]),d=(0,S.useMemo)(()=>i?`已用 ${i.usedAssetCount||0} / ${i.assetLimit||0} 个素材,剩余 ${i.remainingAssetCount||0}`:`额度加载中`,[i]),f=(0,S.useMemo)(()=>[{key:`real_person`,label:`真人素材`,children:(0,$.jsx)(loe,{})},{key:`aigc_virtual`,label:`虚拟素材`,children:(0,$.jsx)(goe,{})}],[]);return(0,$.jsxs)(`div`,{style:{padding:16},children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(_oe,{level:4,style:{margin:0},children:`私域素材库`}),(0,$.jsx)(s9,{type:`secondary`,children:`统一管理真人素材和虚拟素材。真人项目组需先完成人脸认证,虚拟项目组会同步创建火山 AIGC Asset Group。`})]}),(0,$.jsxs)(pJ,{gutter:[16,16],style:{marginBottom:16},children:[(0,$.jsx)(fz,{xs:24,md:8,children:(0,$.jsxs)(LL,{style:{borderRadius:16,background:`linear-gradient(135deg,#f5f3ff,#fff)`},children:[(0,$.jsx)(s9,{type:`secondary`,children:`素材总额度`}),(0,$.jsx)(`div`,{style:{fontSize:24,fontWeight:700,color:`#4f46e5`,marginTop:8},children:d}),(0,$.jsx)(c9,{style:{margin:`8px 0 0`,color:`#64748b`},children:`真人/虚拟共用,图片/视频共用;音频暂不开放。`})]})}),(0,$.jsx)(fz,{xs:24,md:8,children:(0,$.jsxs)(LL,{style:{borderRadius:16},children:[(0,$.jsx)(s9,{type:`secondary`,children:`项目组`}),(0,$.jsx)(`div`,{style:{fontSize:24,fontWeight:700,color:`#1e293b`,marginTop:8},children:o.length}),(0,$.jsx)(c9,{style:{margin:`8px 0 0`,color:`#64748b`},children:n===`aigc_virtual`?`虚拟人像项目会同步创建火山 AIGC Asset Group。`:`真人项目组需完成人脸认证后才可上传素材。`})]})}),(0,$.jsx)(fz,{xs:24,md:8,children:(0,$.jsxs)(LL,{style:{borderRadius:16},children:[(0,$.jsx)(s9,{type:`secondary`,children:`当前项目素材`}),(0,$.jsx)(`div`,{style:{fontSize:24,fontWeight:700,color:`#1e293b`,marginTop:8},children:u?.assetCount||0}),(0,$.jsx)(c9,{style:{margin:`8px 0 0`,color:`#64748b`},children:`仅 Active 状态素材可在 AI 创作中引用。`})]})})]}),(0,$.jsx)(FL,{activeKey:n,onChange:n=>{let i=l9(n);r(i);let a=new URLSearchParams(e);a.set(`filterType`,`private_portrait`),a.set(`portraitTab`,i),t(a,{replace:!0})},items:f,destroyInactiveTabPane:!1})]})},{Header:yoe,Sider:boe,Content:xoe}=lG,{TextArea:Soe}=eG,{Option:Coe}=MC,{Text:u9}=Q,woe=()=>{let{message:e}=qb.useApp(),[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(`1`),[a,o]=(0,S.useState)([]),{mediaType:s,countType:c,selectedRatio:l,selectedResolution:u,width:d,height:f,videoDuration:p,videoAspectRatio:m,videoResolution:h,engineOptions:g,enginesele:_,inputValue:v,setMediaType:y,setCountType:b,setSelectedRatio:x,setSelectedResolution:C,setWidth:w,setHeight:T,setVideoDuration:E,setVideoAspectRatio:D,setVideoResolution:O,setEngineOptions:k,setEnginesele:A,setInputValue:j,currentMedia:M,setCurrentMedia:N}=F7(),P=(s===`image`?_?.image:_?.video)?.find(e=>e.id===c),F=P?.maxImageCount??4,I=P?.maxVideoCount??1,[L,R]=(0,S.useState)(!1),[z,B]=(0,S.useState)(!1),[V,H]=(0,S.useState)(`universal`),[U,W]=(0,S.useState)(null),[G,ee]=(0,S.useState)(null),[te,ne]=(0,S.useState)(null),[K,re]=(0,S.useState)(!1),[ie,ae]=(0,S.useState)(!1),[q,oe]=(0,S.useState)(`real_person`),[se,ce]=(0,S.useState)(!1),le=(0,S.useRef)(null),ue=(0,S.useCallback)(()=>{le.current&&=(window.clearTimeout(le.current),null),ce(!0)},[]),de=(0,S.useCallback)(()=>{le.current&&window.clearTimeout(le.current),le.current=window.setTimeout(()=>{ce(!1),le.current=null},260)},[]),[fe,pe]=(0,S.useState)(!1),me=(0,S.useRef)(null),[he,ge]=(0,S.useState)({top:0,left:0}),_e=e=>{let t=0,n=0,r=0;return e.map(e=>e.type===`image`?(t++,`图片${t}`):e.type===`video`?(n++,`视频${n}`):(r++,`音频${r}`))},[ve,ye]=(0,S.useState)(!1),[be,xe]=(0,S.useState)(``),[Se,Ce]=(0,S.useState)(`image`),we=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(ve&&Se===`video`){let e=()=>{we.current&&we.current.play().catch(()=>{})};we.current&&(we.current.readyState>=2?e():we.current.addEventListener(`loadedmetadata`,e));let t=setTimeout(e,300);return()=>{clearTimeout(t),we.current&&(we.current.removeEventListener(`loadedmetadata`,e),we.current.pause())}}else we.current&&we.current.pause()},[ve,Se]);let[Te,Ee]=(0,S.useState)(new Set),De=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}}},Oe=e=>{let t=De(e);return t?Math.floor(Date.now()/1e3)>t:!1},[ke,Ae]=(0,S.useState)(!1),[je,Me]=(0,S.useState)(``),[Ne,Pe]=(0,S.useState)(`image`),[Fe,Ie]=(0,S.useState)(``),Le=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(ke&&Ne===`video`&&Le.current){let e=Le.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(!ke&&Le.current){let e=Le.current;e.pause(),e.muted=!0,e.currentTime=0}},[ke,Ne,je]);let[Re,ze]=(0,S.useState)(null),[Be,Ve]=(0,S.useState)(0),[He,Ue]=(0,S.useState)(!1),[We,Ge]=(0,S.useState)(null),[Ke,qe]=(0,S.useState)({x:0,y:0}),[Je,Ye]=(0,S.useState)(!1),[Xe,Ze]=(0,S.useState)(!1),[Qe,$e]=(0,S.useState)([]),[et,tt]=(0,S.useState)([]),[nt,rt]=(0,S.useState)({}),[it,at]=(0,S.useState)(!1),[ot,st]=(0,S.useState)(!1),[ct,lt]=(0,S.useState)([]),[ut,dt]=(0,S.useState)([]),[ft,pt]=(0,S.useState)([]),mt=()=>{let e={};if(e=ft.find(e=>e.modelConfigId===c&&e.genType===s&&e.resolution===(s===`video`?h:u)),e||(s===`video`?(e={perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},(h===`1080p`||h===`720p`||h===`480p`)&&(e.ratio=1.3)):(e={perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},(u===`2K`||u===`4K`||u===`1K`)&&(e.ratio=3))),s===`video`){let t=(p*e.perSecondCredits+e.baseCredits)*e.ratio,n=M.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=M.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=M.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))}},ht=(0,S.useRef)(null),gt=(0,S.useRef)(null),_t=(0,S.useRef)(null);(0,S.useRef)(!0);let vt=(0,S.useRef)(!1),yt=(0,S.useRef)(0);a.find(e=>e.id===r);let[bt,xt]=(0,S.useState)([]),[St,Ct]=(0,S.useState)({page:1,pageSize:20}),[wt,Tt]=(0,S.useState)(0),[Et,Dt]=(0,S.useState)(!1);(0,S.useEffect)(()=>()=>{le.current&&window.clearTimeout(le.current)},[]);let Ot=(0,S.useCallback)((e=`instant`)=>{let t=gt.current;t&&(yt.current=Date.now(),requestAnimationFrame(()=>{t.scrollTo({top:t.scrollHeight,behavior:e})}))},[]);(0,S.useEffect)(()=>{if(bt.length>0&&!vt.current){let e=setTimeout(()=>{Ot(`smooth`),vt.current=!0},300);return()=>clearTimeout(e)}},[bt.length,Ot]),(0,S.useEffect)(()=>{let e=s===`image`?_.image:_.video;e&&e.length>0&&(e.some(e=>e.id===c)||b(e[0].id))},[s,_]),(0,S.useEffect)(()=>{let e=e=>{let t=e.target;ot&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&st(!1),it&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&at(!1),Je&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ye(!1),Xe&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ze(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[ot,it,Je,Xe]),(0,S.useEffect)(()=>{if(s!==`video`)return;let e=_?.video?.find(e=>e.id===c);if(!e)return;let t=e.supportsFirstLastFrame??!1,n=e.supportsUniversalReference??!0;H(e=>n?`universal`:e===`universal`&&!n&&t?`first_last_frame`:e)},[c,s,_]),(0,S.useEffect)(()=>{e7().then(e=>{if(A(e.engine),e.engine.video&&e.engine.video.length>0){let t=e.engine.video[0],n=e.engine.video.find(e=>e.id===c)||t;k({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(m)||D(n.supportedRatios?.[0]||`16:9`),n.supportedResolutions?.includes(h)||O(n.supportedResolutions?.[0]||`720p`),n.supportedDurations?.includes(p)||E(n.supportedDurations?.[0]||5),c===`请选择`&&b(n.id)}if(e.engine.image&&e.engine.image.length>0){let t=e.engine.image.find(e=>e.id===c)||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($e(a.map(e=>({value:e,label:e}))),rt(n),tt(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]/);w(Number(e)),T(Number(t)),x(a[0]),C(i)}c===`请选择`&&b(t.id)}}).catch(()=>{}),xie().then(e=>{pt(e)}),t7(St).then(e=>{let t=e.items,n=e.total;xt(t),Tt(n)})},[]),(0,S.useEffect)(()=>{if(_t.current&&=(clearInterval(_t.current),null),bt.some(e=>e.status===`generating`))return _t.current=window.setInterval(()=>{t7(St).then(e=>{xt(t=>t.map(t=>t.status===`generating`&&e.items.find(e=>e.id===t.id)||t)),Tt(e.total)}).catch(e=>{})},1e4),()=>{_t.current&&=(clearInterval(_t.current),null)}},[bt,St]),(0,S.useEffect)(()=>{if(!Je)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ye(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[Je]),(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]);let kt=e=>{let t=Object.keys(nt).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),n=nt[u]&&nt[u][e]?u:t.find(t=>nt[t]&&nt[t][e])||t[0];if(n&&nt[n]&&nt[n][e]){let[t,r]=nt[n][e].split(/[×x]/);w(Number(t)),T(Number(r)),x(e),C(n)}},At=e=>{nt[e]||(e=Object.keys(nt).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)})[0]||e);let t=nt[e]?Object.keys(nt[e]):[];$e(t.map(e=>({value:e,label:e})));let n=t.includes(l)?l:t[0]||``;if(n&&nt[e]&&nt[e][n]){let[t,r]=nt[e][n].split(/[×x]/);w(Number(t)),T(Number(r)),x(n),C(e)}},jt=()=>{w(f),T(d)},Mt=_?.video?.find(e=>e.id===c),Nt=Mt?.supportsFirstLastFrame??!1,Pt=Mt?.supportsUniversalReference??!0,Ft=e=>{e===`first_last_frame`&&!Nt||e===`universal`&&!Pt||(H(e),re(!1),N([]),j(``))},It=()=>{let e=U;W(G),ee(e)},Lt=()=>{W(null),ee(null)},Rt=()=>{ee(null)},zt=async()=>{let t=s===`video`&&V===`first_last_frame`;if(t){if(!v.trim()){e.warning(`请输入内容`);return}}else if(!v.trim()&&M.length===0){e.warning(`请输入内容或上传图片/视频`);return}let n;t?(n=[],U&&n.push({...U,role:`first_frame`}),G&&n.push({...G,role:`last_frame`}),n.length===0&&(n=void 0)):n=M.length>0?M.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:s,original_prompt:v.trim(),engine_id:c,idempotency_key:new Date().toLocaleString(`zh-CN`),media_references:n,...s===`image`&&{image_size:u,image_proportion:l,image_px:d+`x`+f},...s===`video`&&{duration:p,aspect_ratio:m,resolution:h}};B(!0),vie(r).then(()=>{j(``),N([]),W(null),ee(null);let e={...St,page:1};Ct(e),t7(e).then(e=>{xt(t=>[...t,e.items[e.items.length-1]]),Tt(e.total),setTimeout(()=>{ht.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(()=>{B(!1)}),setTimeout(()=>{B(!1)},3e3)},Bt=async()=>{if(bt.length>=wt)return;let e=gt.current;if(!e)return;let t=e.scrollTop,n=e.scrollHeight;Dt(!0);try{let r=St.page+1,i=await t7({...St,page:r}),a=Array.isArray(i)?{items:i,total:i.length}:i;a.total&&Tt(a.total),Ct(e=>({...e,page:r})),xt(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{Dt(!1)}},Vt=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)}),Ht=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)}),Ut=e=>{let t=e.startsWith(`http`)?e:`http://ceshi.apiforeign.minzhong.cn${e}`;if(Re===t){let e=document.getElementById(`audio-player`);e&&e.pause(),ze(null)}else ze(t)},Wt=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)}),Gt=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)}),Kt=(e,t)=>{if(e<300||e>6e3)return`图片宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`图片高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;return n<.4||n>2.5?`图片宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`:null},qt=(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},Jt=async(t,n)=>{let r=t.type.startsWith(`image/`),i=t.type.startsWith(`video/`);if(s===`video`&&V===`first_last_frame`){if(!r)return e.error(`首尾帧模式仅支持上传图片`),!1;if(t.size/1024/1024>10)return e.error(`图片大小不能超过10MB`),!1;let i=n||te;if(!i)return e.error(`请选择首帧或尾帧上传位置`),!1;R(!0);try{let n=await H5(t),r={name:t.name,type:`image`,url:n.url,role:i===`first`?`first_frame`:`last_frame`};i===`first`?W(r):ee(r),e.success(`图片上传成功`)}catch{e.error(`上传失败`)}finally{R(!1),ne(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(s===`image`&&(i||a))return e.error(`图片模式仅支持上传图片`),!1;if(a&&s!==`video`)return e.error(`仅视频模式支持上传音频`),!1;let o=i?100:a?50:10,c=i?`视频`:a?`音频`:`图片`;if(t.size/1024/1024>o)return e.error(`${c}大小不能超过${o}MB`),!1;if(r)try{let{width:n,height:r}=await Wt(t),i=Kt(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let l=M.filter(e=>e.type===`image`).length;if(r&&l>=yn)return e.error(`该引擎最多上传${yn}张图片`),!1;let u=M.filter(e=>e.type===`video`).length;if(i&&u>=bn)return e.error(`该引擎最多上传${bn}个视频`),!1;let d=M.filter(e=>e.type===`audio`).length;if(a&&d>=xn)return e.error(`该引擎最多上传${xn}个音频`),!1;let f=0,p=0;if(i)try{if(f=await Vt(t),f<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=M.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 Gt(t),a=qt(r,i);if(a)return e.error(a),!1}catch{return e.error(`无法获取视频信息,请检查文件是否损坏`),!1}if(a)try{if(p=await Ht(t),p<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=M.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}R(!0);try{let e=await(r?H5:a?V5:U5)(t),n=r?`image`:a?`audio`:`video`,o=[...M,{name:t.name,type:n,url:e.url,label:``,...i&&{duration:f},...a&&{duration:p}}],s=_e(o);N(o.map((e,t)=>({...e,label:s[t]})))}catch{e.error(`上传失败`)}finally{R(!1)}return!1},Yt=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}let o=0,s=0;if(r)try{if(o=await Vt(t),o<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=F7.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 Ht(t),s<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=F7.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=F7.getState().currentMedia;if(!Qt(u,[l]))return!1;try{let e=await(n?H5:i?V5:U5)(t);return{name:l.name,type:l.type,url:e.url,label:l.label||``,...l.duration!==void 0&&{duration:l.duration}}}catch{return e.error(`上传失败`),!1}},Xt=async t=>{let n=0,r=0;for(let e of t){R(!0);let t=await Yt(e);if(t){let e=[...F7.getState().currentMedia,t],r=_e(e);N(e.map((e,t)=>({...e,label:r[t]}))),n++}else r++;R(!1)}n>0&&e.success(`成功上传${n}个文件${r>0?`,${r}个文件上传失败`:``}`)},Zt=(e,t)=>e.filter(e=>e.type===t).reduce((e,t)=>e+(Number(t.duration)||0),0),Qt=(t,n)=>{if(!n.length)return!1;if(s===`image`&&n.some(e=>e.type!==`image`))return e.error(`图片模式仅支持添加图片素材`),!1;if(n.some(e=>e.type===`audio`)&&s!==`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,c=n.filter(e=>e.type===`video`).length,l=n.filter(e=>e.type===`audio`).length;if(r+o>yn)return e.error(`该引擎最多上传${yn}张图片,当前还能添加 ${Math.max(0,yn-r)} 张`),!1;if(i+c>bn)return e.error(`该引擎最多上传${bn}个视频,当前还能添加 ${Math.max(0,bn-i)} 个`),!1;if(a+l>xn)return e.error(`该引擎最多上传${xn}个音频,当前还能添加 ${Math.max(0,xn-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=Zt(t,`video`)+Zt(n,`video`);if(u>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${u.toFixed(1)} 秒`),!1;let d=Zt(t,`audio`)+Zt(n,`audio`);return d>15?(e.error(`所有音频素材总时长不能超过 15 秒,当前 ${d.toFixed(1)} 秒`),!1):!0},$t=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`&&s!==`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}:{}}},en=t=>{let n=t.map($t).filter(Boolean);if(!n.length)return;let r=F7.getState().currentMedia;if(!Qt(r,n))return;let i=[...r,...n],a=_e(i);N(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个历史上传素材参考`)},tn=t=>{if(t.assetType===`Audio`)return e.error(`音频私域素材暂不支持用于 AI 创作`),null;let n=t.assetType===`Video`?`video`:`image`,r=q===`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}}},nn=e=>{oe(e),ae(!0)},rn=t=>{let n=t.map(tn).filter(Boolean),r=F7.getState().currentMedia;if(!Qt(r,n))return;let i=[...r,...n],a=_e(i);N(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个${q===`aigc_virtual`?`虚拟`:`真人`}素材参考`)},an=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,on=e=>{let t=M.filter((t,n)=>n!==e),n=_e(t);N(t.map((e,t)=>({...e,label:n[t]})))},sn=(e,t)=>{let n=e.selectionStart;return t.slice(0,n).match(/@([^@\s]*)$/)&&M.length>0?(pe(!0),!0):(pe(!1),!1)},cn=e=>{let t=e.target.value;j(t);let n=e.target;sn(n,t)},ln=e=>{fe&&e.key===`Escape`&&pe(!1)},un=e=>{let t=me.current?.resizableTextArea?.textArea;if(!t)return;let n=t.selectionStart,r=v.slice(0,n),i=v.slice(n),a=r.lastIndexOf(`@`);if(a===-1){pe(!1);return}j(r.slice(0,a)+`@${e} `+i),pe(!1),setTimeout(()=>{let n=a+e.length+2;t.focus(),t.setSelectionRange(n,n)},0)},dn=()=>{ye(!1),xe(``),we.current&&we.current.pause()},fn=e=>{if(e.preventDefault(),e.stopPropagation(),!be)return;let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${be}&download=1`,t.download=Se===`image`?`image.png`:`video.mp4`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},pn=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`},mn=e=>e?/^https?:\/\//i.test(e)?e:`http://ceshi.apiforeign.minzhong.cn${e}`:``,hn=e=>{e?.url&&(Me(e.url),Pe(pn(e)),Ie(e.name||`附件`),Ae(!0))},gn=s===`video`&&V===`first_last_frame`,_n=gn?!!(v.trim()||U):!!(v.trim()||M.length>0),vn=s===`image`?`输入画面描述,或上传图片参考风格、构图、主体与光影。例:@图片1 参考色调,生成一张简洁高级的产品海报。`:gn?`首帧尾帧可以不传,如需传入建议描述首帧到尾帧的主体动作、镜头运动、节奏与转场。例:从首帧自然推进到尾帧,产品居中突出,动作平滑连贯。`:`上传最多12个参考素材,输入文字或 @ 引用参考内容,自由组合图、文、视频。例:@图片1 模仿 @视频1 的动作。`,yn=F,bn=I,xn=P?.maxAudioCount??1;return(0,$.jsxs)(lG,{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:Re||null,autoPlay:!0,onEnded:()=>ze(null),style:{display:`none`}}),!1,(0,$.jsxs)(lG,{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)(xoe,{style:{flex:1,margin:0,padding:`20px 24px 22px`,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,overflow:`hidden`,minHeight:0},children:[bt.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)(C8,{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:`输入想法、剧本或上传参考,开始你的创作之旅`})]}),bt.length>0&&(0,$.jsxs)(`div`,{ref:gt,className:`ai-create-scroll`,style:{flex:1,overflowY:`auto`,paddingRight:10,paddingBottom:18,background:`#fff`},onScroll:e=>{let t=e.currentTarget;!(Date.now()-yt.current<500)&&vt.current&&t.scrollTop<=50&&!Et&&bt.length{let e=Z;return bt.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)(C8,{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();qe({x:n.left,y:n.top-10}),Ge(t.id),Ue(!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(),j(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`);W(e?{...e,label:e.label||``}:null),ee(n?{...n,label:n.label||``}:null),N([]),H(`first_last_frame`)}else N(t.mediaReferences.map(e=>({name:e.name,type:e.type,url:e.url,label:e.label||``,role:e.role}))),W(null),ee(null),H(`universal`);else N([]),W(null),ee(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)(Hq,{style:{fontSize:12}}),`重新编辑`]}),(0,$.jsx)(IK,{title:`确定要删除吗?`,onConfirm:async()=>{try{await bie(t.id),e.success(`删除成功`),xt(e=>e.filter(e=>e.id!==t.id)),Tt(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)(O$,{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)(Lre,{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:()=>{xe(t.imageUrl),Ce(`image`),ye(!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:()=>{xe(t.videoUrl),Ce(`video`),ye(!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:ht})]}),He&&We&&(()=>{let e=bt.find(e=>e.id===We)?.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:()=>{Ue(!1),Ge(null)}}),(0,$.jsxs)(`div`,{className:`ai-reference-expanded-tray ai-attachment-popover`,style:{position:`fixed`,top:`max(84px, ${Ke.y-96}px)`,left:`max(24px, min(${Ke.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:()=>{Ue(!1),Ge(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=pn(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(),Ut(e.url)):(hn(e),Ue(!1),Ge(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:mn(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:mn(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:Re===(e.url.startsWith(`http`)?e.url:`http://ceshi.apiforeign.minzhong.cn${e.url}`)?(0,$.jsx)(W6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(q2,{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:()=>{hn(e),Ue(!1),Ge(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:gn?220:70,minWidth:gn?220:70,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`flex-start`,paddingTop:2,gap:8},children:s===`video`&&V===`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:`首帧(可选)`})}),U?(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64},children:[(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${U.url}`,alt:U.name,onClick:()=>{Me(U.url),Pe(`image`),Ie(U.name),Ae(!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:Lt,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)(O$,{style:{fontSize:9}})})]}):(0,$.jsx)(W7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&Jt(e[0],`first`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];W({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||``;W({name:n.name||`首帧图片`,type:`image`,url:r,role:`first_frame`,label:``}),e.success(`成功添加首帧`)}},uploading:L,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)(pL,{style:{fontSize:18,color:`#8b5cf6`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`上传首帧`})]})})]}),(0,$.jsx)(`button`,{onClick:It,disabled:!U||!G,title:`调换首尾帧`,style:{width:32,height:32,alignSelf:`center`,borderRadius:50,border:`1px solid rgba(231, 234, 240, 0.95)`,background:U&&G?`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`:`#F3F5F8`,cursor:U&&G?`pointer`:`not-allowed`,color:U&&G?`#fff`:`#98A2B3`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:U&&G?`0 6px 14px rgba(139, 92, 246, 0.24)`:`none`,transition:`all 0.2s ease`,flexShrink:0},onMouseEnter:e=>{U&&G&&(e.currentTarget.style.transform=`scale(1.06)`)},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:(0,$.jsx)(iW,{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:U?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:()=>{Me(G.url),Pe(`image`),Ie(G.name),Ae(!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:Rt,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)(O$,{style:{fontSize:9}})})]}):U?(0,$.jsx)(W7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&Jt(e[0],`last`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];ee({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||``;ee({name:n.name||`尾帧图片`,type:`image`,url:r,role:`last_frame`,label:``}),e.success(`成功添加尾帧`)}},uploading:L,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)(pL,{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)(pL,{style:{fontSize:18,color:`#cbd5e1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#94a3b8`,fontWeight:500},children:`请先上传首帧`})]})]})]}):(0,$.jsx)($.Fragment,{children:!(s===`video`&&V===`first_last_frame`)&&(0,$.jsxs)(`div`,{style:{position:`relative`,width:64,height:72,marginTop:`-10`},onMouseEnter:ue,onMouseLeave:de,children:[M.length===0&&(0,$.jsx)(W7,{accept:s===`image`?`image/*`:`image/*,video/*,audio/*`,onLocalSelect:Xt,onHistorySelect:en,onPortraitLibrarySelect:e=>{nn(e)},uploading:L,tooltipTitle:s===`image`?`图片${M.filter(e=>e.type===`image`).length}/${F}`:`图片${M.filter(e=>e.type===`image`).length}/${F}, 视频${M.filter(e=>e.type===`video`).length}/${I}${xn>0?`, 音频${M.filter(e=>e.type===`audio`).length}/${xn}`:``}`,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:L?(0,$.jsx)(Xm,{style:{fontSize:17,color:`#667085`}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pL,{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:`容`})]})]})]})})}),M.length>0&&(0,$.jsx)($.Fragment,{children:M.map((e,t)=>{let n=Math.min(M.length,3)-1-t,r=se?t*58:t<3?t*6:18,i=se?!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:se?`scale(1) rotate(0deg)`:`scale(${t<3?1-n*.08:0}) rotate(${t<3?-3+t*1.5:0}deg)`,opacity:i?se?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:an(e.url),alt:e.name,onClick:()=>{Me(e.url),Pe(`image`),Ie(e.name),Ae(!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:an(e.url),muted:!0,onClick:()=>{Me(e.url),Pe(`video`),Ie(e.name),Ae(!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(),Ut(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:Re===an(e.url)?(0,$.jsx)(W6,{style:{fontSize:20,color:`#fff`}}):(0,$.jsx)(q2,{style:{fontSize:20,color:`#fff`}})}),(0,$.jsx)(`button`,{onClick:()=>on(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)(O$,{style:{fontSize:10}})})]})},`stack-${t}`)})}),M.length>0&&(0,$.jsx)(W7,{accept:s===`image`?`image/*`:`image/*,video/*,audio/*`,onLocalSelect:Xt,onHistorySelect:en,onPortraitLibrarySelect:e=>{nn(e)},uploading:L,tooltipTitle:s===`image`?`图片${M.filter(e=>e.type===`image`).length}/${F}`:`图片${M.filter(e=>e.type===`image`).length}/${F}, 视频${M.filter(e=>e.type===`video`).length}/${I}${xn>0?`, @@ -480,8 +480,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } `})]}):e===`failed`?(0,$.jsx)(`span`,{style:{fontSize:11,color:`#ef4444`},children:`失败`}):e===`completed`&&t.finalVideoUrl?(0,$.jsx)(`span`,{style:{fontSize:11,color:`#10b981`},children:`任务完成`}):null})()]})]})]},t.id))}),(0,$.jsx)(`div`,{style:{paddingTop:20,paddingBottom:20,display:`flex`,justifyContent:`center`},children:(0,$.jsx)(BG,{current:p,pageSize:h,total:_,onChange:K,showSizeChanger:!1,showQuickJumper:!1,showTotal:e=>`共 ${e} 条`,itemRender:(e,t,n)=>t===`prev`?(0,$.jsx)(`button`,{style:{minWidth:32,height:32,border:`1px solid #e5e7eb`,borderRadius:6,background:p===1?`#f9fafb`:`#fff`,cursor:p===1?`not-allowed`:`pointer`,color:p===1?`#d1d5db`:`#6b7280`,fontSize:14},disabled:p===1,children:`‹`}):t===`next`?(0,$.jsx)(`button`,{style:{minWidth:32,height:32,border:`1px solid #e5e7eb`,borderRadius:6,background:p>=Math.ceil(_/h)?`#f9fafb`:`#fff`,cursor:p>=Math.ceil(_/h)?`not-allowed`:`pointer`,color:p>=Math.ceil(_/h)?`#d1d5db`:`#6b7280`,fontSize:14},disabled:p>=Math.ceil(_/h),children:`›`}):t===`page`?(0,$.jsx)(`button`,{style:{minWidth:32,height:32,border:`none`,borderRadius:6,background:e===p?`#6366f1`:`#fff`,color:e===p?`#fff`:`#374151`,fontWeight:e===p?500:400,cursor:`pointer`,fontSize:14},children:e}):n})})]}):(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:`40px`},children:[(0,$.jsxs)(`div`,{style:{width:120,height:120,display:`flex`,alignItems:`center`,justifyContent:`center`,marginBottom:24,position:`relative`},children:[(0,$.jsx)(`div`,{style:{width:60,height:60,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%)`,borderRadius:20,position:`absolute`,bottom:0,right:10}}),(0,$.jsx)(`div`,{style:{width:50,height:50,border:`2px solid rgba(99, 102, 241, 0.2)`,borderRadius:16,position:`absolute`,top:0,left:10}}),(0,$.jsx)(`div`,{style:{width:56,height:56,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,borderRadius:18,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 8px 24px rgba(99, 102, 241, 0.25)`},children:(0,$.jsx)(_5,{style:{fontSize:28,color:`#fff`}})})]}),(0,$.jsx)(`h3`,{style:{margin:0,fontSize:16,fontWeight:600,color:`#1e293b`,marginBottom:8},children:`暂无生成内容`}),(0,$.jsx)(`p`,{style:{margin:0,fontSize:13,color:`#64748b`,textAlign:`center`,padding:`0 40px`,lineHeight:1.6},children:`请完善素材与卖点,生成专属爆款复刻视频`})]})})]}),(0,$.jsx)(`div`,{className:`replication-form`,style:{flex:1,overflow:`auto`,width:`28%`,background:`rgba(255,255,255,0.85)`,backdropFilter:`blur(20px)`,borderRadius:20,border:`1px solid rgba(99, 102, 241, 0.1)`,boxShadow:`0 8px 32px rgba(99, 102, 241, 0.08)`,position:`relative`,zIndex:10},children:(0,$.jsxs)(`div`,{className:`replication-form-content`,style:{width:`100%`,height:`100%`,background:`rgba(248, 250, 252, 0.5)`,padding:24,overflowY:`auto`},children:[(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(`p`,{style:{margin:0,fontSize:14,fontWeight:600,color:`#1e293b`,marginBottom:10},children:`上传复刻视频`}),O?(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(`video`,{src:d9(O),controls:!0,style:{width:`100%`,borderRadius:12,maxHeight:200,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.08)`}}),(0,$.jsx)(`button`,{onClick:()=>{O&&URL.revokeObjectURL(O),D(null),k(``)},style:{position:`absolute`,top:8,right:8,width:28,height:28,border:`none`,background:`rgba(239, 68, 68, 0.9)`,borderRadius:`50%`,cursor:`pointer`,color:`#fff`,fontSize:16,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:10,transition:`all 0.2s`},children:`×`}),(0,$.jsxs)(`div`,{style:{marginTop:10,display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(_5,{style:{color:`#6366f1`,fontSize:14}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#475569`},children:E?.name}),(0,$.jsxs)(`span`,{style:{fontSize:11,color:`#94a3b8`},children:[`(`,E?.size?(E.size/1024/1024).toFixed(2):0,`MB)`]})]})]}):(0,$.jsx)(L0,{style:{width:`100%`},beforeUpload:async e=>{if(!e.type.startsWith(`video/`))return Z.error(`只能上传视频文件`),!1;if(!(e.size/1024/1024<50))return Z.error(`视频大小不能超过50MB`),!1;let t=document.createElement(`video`);return t.preload=`metadata`,new Promise(n=>{t.onloadedmetadata=async()=>{if(t.duration<2){Z.error(`视频时长不能少于2秒`),URL.revokeObjectURL(t.src),n(!1);return}if(t.duration>=16){Z.error(`视频时长不能超过15秒`),URL.revokeObjectURL(t.src),n(!1);return}V(!0);try{let r=await aie(e,t.duration);D(e),k(r.url),j(r.resource_id||``),N(t.duration),Z.success(`视频上传成功`),n(!1)}catch(e){let t=``;if(e instanceof Error)try{t=JSON.parse(e.message).detail||e.message}catch{t=e.message}Z.error(t||`视频上传失败`),n(!1)}finally{V(!1),URL.revokeObjectURL(t.src)}},t.onerror=()=>{Z.error(`视频文件无效`),URL.revokeObjectURL(t.src),n(!1)},t.src=URL.createObjectURL(e)})},showUploadList:!1,accept:`video/mp4,video/quicktime,.mp4,.mov`,children:(0,$.jsx)(`div`,{style:{border:`2px dashed rgba(99, 102, 241, 0.3)`,borderRadius:12,padding:24,textAlign:`center`,cursor:`pointer`,transition:`all 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,background:`rgba(99, 102, 241, 0.02)`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6366f1`,e.currentTarget.style.background=`rgba(99, 102, 241, 0.05)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.3)`,e.currentTarget.style.background=`rgba(99, 102, 241, 0.02)`},children:B?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{width:40,height:40,margin:`0 auto 12px`,border:`3px solid rgba(99, 102, 241, 0.2)`,borderTopColor:`#6366f1`,borderRadius:`50%`,animation:`spin 1s linear infinite`}}),(0,$.jsx)(`p`,{style:{margin:0,fontSize:13,color:`#6366f1`,fontWeight:500},children:`上传中...`}),(0,$.jsx)(`p`,{style:{margin:0,fontSize:11,color:`#94a3b8`,marginTop:4},children:`支持的文件类型:MP4、MOV | 视频最大时长:15 秒 | 最大大小:50M`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{width:48,height:48,margin:`0 auto 12px`,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%)`,borderRadius:16,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(_5,{style:{fontSize:24,color:`#6366f1`}})}),(0,$.jsx)(`p`,{style:{margin:0,fontSize:13,color:`#475569`,fontWeight:500},children:`点击或拖拽上传视频`}),(0,$.jsx)(`p`,{style:{margin:0,fontSize:11,color:`#94a3b8`,marginTop:4},children:`支持的文件类型:MP4、MOV | 视频最大时长:15 秒 | 最大大小:50M`})]})})})]}),(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(`p`,{style:{margin:0,fontSize:14,fontWeight:600,color:`#1e293b`,marginBottom:10},children:`上传产品图片`}),I?(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(`img`,{src:d9(I),alt:`产品图片`,style:{width:`100%`,borderRadius:12,maxHeight:200,objectFit:`contain`,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.08)`}}),(0,$.jsx)(`button`,{onClick:()=>{I&&URL.revokeObjectURL(I),F(null),L(``)},style:{position:`absolute`,top:8,right:8,width:28,height:28,border:`none`,background:`rgba(239, 68, 68, 0.9)`,borderRadius:`50%`,cursor:`pointer`,color:`#fff`,fontSize:16,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:10,transition:`all 0.2s`},children:`×`}),(0,$.jsxs)(`div`,{style:{marginTop:10,display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)($6,{style:{color:`#6366f1`,fontSize:14}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#475569`},children:P?.name}),(0,$.jsxs)(`span`,{style:{fontSize:11,color:`#94a3b8`},children:[`(`,P?.size?(P.size/1024/1024).toFixed(2):0,`MB)`]})]})]}):(0,$.jsx)(L0,{style:{width:`100%`},beforeUpload:async e=>{if(!e.type.startsWith(`image/`))return Z.error(`只能上传图片文件`),!1;if(!(e.size/1024/1024<10))return Z.error(`图片大小不能超过10MB`),!1;let t=new Image;return new Promise(n=>{t.onload=async()=>{let r=t.width/t.height;Math.abs(r-.75)<.1||Math.abs(r-.5625),U(!0);try{let t=await iie(e);F(e),L(t.url),z(t.resource_id||``),Z.success(`图片上传成功`),n(!1)}catch(e){let t=``;if(e instanceof Error)try{t=JSON.parse(e.message).detail||e.message}catch{t=e.message}Z.error(t||`图片上传失败`),n(!1)}finally{U(!1),URL.revokeObjectURL(t.src)}},t.onerror=()=>{Z.error(`图片文件无效`),URL.revokeObjectURL(t.src),n(!1)},t.src=URL.createObjectURL(e)})},showUploadList:!1,accept:`image/jpeg,image/jpg,image/png,.jpg,.jpeg,.png`,children:(0,$.jsx)(`div`,{style:{border:`2px dashed rgba(99, 102, 241, 0.3)`,borderRadius:12,padding:20,textAlign:`center`,cursor:`pointer`,transition:`all 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,background:`rgba(99, 102, 241, 0.02)`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6366f1`,e.currentTarget.style.background=`rgba(99, 102, 241, 0.05)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.3)`,e.currentTarget.style.background=`rgba(99, 102, 241, 0.02)`},children:H?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{width:36,height:36,margin:`0 auto 10px`,border:`3px solid rgba(99, 102, 241, 0.2)`,borderTopColor:`#6366f1`,borderRadius:`50%`,animation:`spin 1s linear infinite`}}),(0,$.jsx)(`p`,{style:{margin:0,fontSize:13,color:`#6366f1`,fontWeight:500},children:`上传中...`}),(0,$.jsx)(`p`,{style:{margin:0,fontSize:11,color:`#94a3b8`,marginTop:4},children:`支持 JPG, JPEG, PNG 格式,图片比例为 3:4 或 9:16 效果最佳`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{width:44,height:44,margin:`0 auto 10px`,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%)`,borderRadius:14,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)($6,{style:{fontSize:22,color:`#6366f1`}})}),(0,$.jsx)(`p`,{style:{margin:0,fontSize:13,color:`#475569`,fontWeight:500},children:`+ 点击上传`}),(0,$.jsx)(`p`,{style:{margin:0,fontSize:11,color:`#94a3b8`,marginTop:4},children:`支持 JPG, JPEG, PNG 格式,图片比例为 3:4 或 9:16 效果最佳`})]})})})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(`p`,{style:{margin:0,fontSize:13,fontWeight:500,color:`#475569`,marginBottom:8},children:`原视频产品名称`}),(0,$.jsx)(eG,{value:y,onChange:e=>b(e.target.value),placeholder:`请输入原视频产品名称`,style:{borderRadius:10,height:40,fontSize:13,border:`1px solid rgba(99, 102, 241, 0.15)`,background:`rgba(255,255,255,0.8)`},maxLength:10,suffix:(0,$.jsxs)(`span`,{style:{color:`#94a3b8`,fontSize:12},children:[y.length,`/10`]})})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(`p`,{style:{margin:0,fontSize:13,fontWeight:500,color:`#475569`,marginBottom:8},children:`自有产品名称`}),(0,$.jsx)(eG,{value:x,onChange:e=>C(e.target.value),placeholder:`请输入自有产品名称`,style:{borderRadius:10,height:40,fontSize:13,border:`1px solid rgba(99, 102, 241, 0.15)`,background:`rgba(255,255,255,0.8)`},maxLength:10,suffix:(0,$.jsxs)(`span`,{style:{color:`#94a3b8`,fontSize:12},children:[x.length,`/10`]})})]}),(0,$.jsxs)(`div`,{style:{marginBottom:24},children:[(0,$.jsx)(`p`,{style:{margin:0,fontSize:13,fontWeight:500,color:`#475569`,marginBottom:8},children:`产品卖点`}),(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(Doe,{value:w,onChange:e=>T(e.target.value),placeholder:`请输入产品卖点`,style:{borderRadius:10,fontSize:13,height:80,resize:`none`,border:`1px solid rgba(99, 102, 241, 0.15)`,background:`rgba(255,255,255,0.8)`},rows:3,maxLength:30}),(0,$.jsxs)(`span`,{style:{position:`absolute`,right:10,bottom:8,color:`#94a3b8`,fontSize:12},children:[w.length,`/30`]})]})]}),(0,$.jsx)(X,{type:`primary`,block:!0,size:`large`,onClick:()=>{if(!O){Z.warning(`请上传复刻视频`);return}if(!I){Z.warning(`请上传产品图片`);return}if(!y.trim()){Z.warning(`请输入原视频产品名称`);return}if(!x.trim()){Z.warning(`请输入自有产品名称`);return}if(!w.trim()){Z.warning(`请输入产品卖点`);return}Sie({material_video_url:O,material_image_url:I,material_video_resource_id:A||void 0,material_image_resource_id:R||void 0,material_video_duration_seconds:M||void 0,source_project_name:y,target_project_name:x,core_content_point:w,idempotency_key:Date.now().toString()}).then(t=>{let r=``,i=``;k(``),j(``),N(null),L(``),z(``),b(``),C(``),T(``),ne(1,8),r7(1,20).then(t=>{if(t.items){let a=t.items[0].id;n(t.items),i7(t.items[0].id).then(t=>{r=t.id,i=t.steps[0].id,Cie(r,i).then(t=>{Z.loading(`创建中...`,3),setTimeout(()=>{e(`/initial/${a}/initialinfo`)},3e3)})}).catch(e=>{})}}).catch(e=>{})}).catch(e=>{Z.error(`视频开头复刻失败`)})},style:{borderRadius:12,height:44,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%)`,border:`none`,fontSize:15,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.3)`,transition:`all 0.25s cubic-bezier(0.4, 0, 0.2, 1)`},children:`立即生成+`})]})}),(0,$.jsxs)(MK,{title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:4,height:20,background:`linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%)`,borderRadius:2}}),(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`创作记录`})]}),open:W,onCancel:()=>G(!1),width:850,footer:null,style:{borderRadius:20},styles:{body:{height:580,display:`flex`,flexDirection:`column`,padding:0},header:{background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,borderBottom:`1px solid rgba(99, 102, 241, 0.08)`,padding:`16px 24px`}},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,margin:`16px 24px`,flexShrink:0},children:[(0,$.jsx)(eG,{placeholder:`搜索产品名称`,value:l,onChange:e=>u(e.target.value),onPressEnter:ae,style:{width:220,borderRadius:10,marginRight:10,border:`1px solid rgba(99, 102, 241, 0.15)`,background:`rgba(255,255,255,0.8)`}}),(0,$.jsx)(X,{type:`primary`,onClick:ae,style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`},children:`搜索`})]}),(0,$.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:`0 24px 24px`},children:(0,$.jsx)(`div`,{style:{background:`rgba(255,255,255,0.85)`,backdropFilter:`blur(10px)`,borderRadius:16,overflow:`hidden`,border:`1px solid rgba(99, 102, 241, 0.08)`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.06)`},children:(0,$.jsx)(t$,{columns:[{title:`产品名称`,dataIndex:`targetProjectName`,key:`targetProjectName`,align:`center`,width:100,render:e=>(0,$.jsx)(`span`,{style:{fontSize:13,color:`#1e293b`,fontWeight:500},children:e||`-`})},{title:`状态`,dataIndex:`status`,key:`status`,align:`center`,width:220,render:(e,t)=>{let n=e,r=t.current_step_code||t.currentStepCode,i=(()=>{if(r===`image_prompt_optimize`)switch(n){case`waiting_user`:return{text:`等待融合图生成`,color:`#f59e0b`};case`processing`:return{text:`图片提示词生成中`,color:`#f59e0b`};case`completed`:return{text:`图片提示词生成成功`,color:`#10b981`};case`failed`:return{text:`图片提示词生成失败`,color:`#ef4444`};default:return{text:n||`-`,color:`#64748b`}}else if(r===`image_generate`)switch(n){case`waiting_user`:return{text:`等待生成视频提示词`,color:`#f59e0b`};case`processing`:return{text:`融合图生成中`,color:`#f59e0b`};case`completed`:return{text:`融合图生成成功`,color:`#10b981`};case`failed`:return{text:`融合图生成失败`,color:`#ef4444`};default:return{text:n||`-`,color:`#64748b`}}else if(r===`video_prompt_optimize`)switch(n){case`waiting_user`:return{text:`等待最终视频生成`,color:`#f59e0b`};case`processing`:return{text:`视频提示词生成中`,color:`#f59e0b`};case`completed`:return{text:`视频提示词生成成功`,color:`#10b981`};case`failed`:return{text:`视频提示词生成失败`,color:`#ef4444`};default:return{text:n||`-`,color:`#64748b`}}else if(r===`video_generate`)switch(n){case`waiting_user`:return{text:``,color:`#64748b`};case`processing`:return{text:`最终视频生成中`,color:`#f59e0b`};case`completed`:return{text:`任务完成`,color:`#10b981`};case`failed`:return{text:`最终视频生成失败`,color:`#ef4444`};default:return{text:n||`-`,color:`#64748b`}}else if(r===`material_input`)switch(n){case`waiting_user`:return{text:`等待生成图片提示词`,color:`#f59e0b`};case`processing`:return{text:`素材处理中`,color:`#f59e0b`};case`completed`:return{text:`素材上传成功`,color:`#10b981`};case`failed`:return{text:`素材上传失败`,color:`#ef4444`};default:return{text:n||`-`,color:`#64748b`}}else return{pending:{text:`子任务待处理`,color:`#f59e0b`},waiting_user:{text:`等待用户确认或触发`,color:`#f59e0b`},processing:{text:`子任务处理中`,color:`#f59e0b`},completed:{text:`子任务完成`,color:`#10b981`},failed:{text:`子任务失败`,color:`#ef4444`},cancelled:{text:`子任务取消`,color:`#94a3b8`}}[n]||{text:n||`-`,color:`#64748b`}})();return(0,$.jsx)(`span`,{style:{fontSize:12,color:i.color,fontWeight:500},children:i.text})}},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,align:`center`,width:200,render:e=>{if(!e)return`-`;let t=new Date(e);return(0,$.jsx)(`span`,{style:{fontSize:12,color:`#64748b`},children:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`})}},{title:`操作`,key:`action`,align:`center`,width:220,render:(t,n)=>(0,$.jsxs)(TH,{children:[(0,$.jsx)(`button`,{onClick:()=>e(`/initial/${n.id}/initialinfo`),style:{color:`#6366f1`,textDecoration:`none`,fontSize:13,border:`none`,background:`rgba(99, 102, 241, 0.08)`,padding:`4px 12px`,borderRadius:8,cursor:`pointer`,transition:`all 0.2s`},children:`查看详情`}),(0,$.jsx)(IK,{title:`确认删除这个爆款开头复刻任务吗?`,onConfirm:async()=>{try{await Uie(n.id),Z.success(`删除成功`),re(1,a,!1,l)}catch{Z.error(`删除失败`)}},children:(0,$.jsx)(`button`,{style:{color:`#ef4444`,textDecoration:`none`,fontSize:13,border:`none`,background:`rgba(239, 68, 68, 0.08)`,padding:`4px 12px`,borderRadius:8,cursor:`pointer`,transition:`all 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(239, 68, 68, 0.12)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(239, 68, 68, 0.08)`},children:`删除`})})]})}],dataSource:t,rowKey:`id`,pagination:{current:r,pageSize:a,total:s,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`,onChange:ie,itemRender:(e,t,n)=>t===`prev`?(0,$.jsx)(`button`,{style:{minWidth:32,height:32,border:`1px solid rgba(99, 102, 241, 0.15)`,borderRadius:8,background:r===1?`rgba(243, 244, 246, 0.5)`:`#fff`,cursor:r===1?`not-allowed`:`pointer`,color:r===1?`#94a3b8`:`#6366f1`,fontSize:14},disabled:r===1,children:`‹`}):t===`next`?(0,$.jsx)(`button`,{style:{minWidth:32,height:32,border:`1px solid rgba(99, 102, 241, 0.15)`,borderRadius:8,background:r>=Math.ceil(s/a)?`rgba(243, 244, 246, 0.5)`:`#fff`,cursor:r>=Math.ceil(s/a)?`not-allowed`:`pointer`,color:r>=Math.ceil(s/a)?`#94a3b8`:`#6366f1`,fontSize:14},disabled:r>=Math.ceil(s/a),children:`›`}):t===`page`?(0,$.jsx)(`button`,{style:{minWidth:32,height:32,border:`none`,borderRadius:8,background:e===r?`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`:`#fff`,color:e===r?`#fff`:`#475569`,fontWeight:e===r?600:400,cursor:`pointer`,fontSize:14},children:e}):n},style:{fontSize:13},scroll:{y:350}})})})]})]})};function f9(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function p9(e,...t){for(let n of t){let t=e[n];if(t!=null&&String(t).trim()!==``)return String(t)}return``}function m9(e,t,...n){for(let t of n){let n=e[t];if(n===!0||n===!1)return n;if(n===`true`)return!0;if(n===`false`)return!1}return t}function Aoe(e,...t){for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t)&&t>0)return t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e)&&e>0)return e}}}function h9(e){if(!f9(e))return null;let t=p9(e,`key`);return t?{key:t,label:p9(e,`label`)||t,type:p9(e,`type`)||void 0,enabled:m9(e,!0,`enabled`),editable:m9(e,!0,`editable`),maxLength:Aoe(e,`maxLength`,`max_length`)}:null}function g9(e){if(!f9(e))return null;let t=e.data;return f9(t)?t:Array.isArray(e.sections)?e:null}function joe(e){return!!g9(e)}function _9(e){let t=g9(e);return(Array.isArray(t?.sections)?t.sections:[]).map(e=>{let t=h9(e);if(!t||!f9(e))return null;let n=Array.isArray(e.children)?e.children.map(h9).filter(Boolean):[],r=Array.isArray(e.itemFields)?e.itemFields.map(h9).filter(Boolean):Array.isArray(e.item_fields)?e.item_fields.map(h9).filter(Boolean):[];return{...t,contentKey:p9(e,`contentKey`,`content_key`)||void 0,children:n,itemFields:r}}).filter(e=>!!e&&e.enabled)}function v9(e){if(e==null)return``;if(typeof e==`object`)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}function y9(e){let t=v9(e);return t.length>40||t.includes(` `)||t.includes(`,`)||t.includes(`。`)||t.includes(`;`)||t.includes(`;`)}function b9(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function x9(e,t,n,r){let i=b9(e||{});return f9(i[t])||(i[t]={}),i[t][n]=r,i}function S9(e,t,n,r,i){let a=b9(e||{});return Array.isArray(a[t])||(a[t]=[]),f9(a[t][n])||(a[t][n]={}),a[t][n][r]=i,a}function C9(e,t){if(!f9(e))return`视频提示词不能为空`;let n=_9(t);if(!n.length)return`视频提词配置缺失,无法保存`;for(let t of n){if(!t.editable)continue;let n=e[t.key];if(t.type===`object`){if(!f9(n))continue;for(let e of t.children)if(!(!e.enabled||!e.editable||!e.maxLength)&&v9(n[e.key]).length>e.maxLength)return`字段【${t.label}.${e.label}】长度不能超过 ${e.maxLength} 个字符`;continue}if(t.type===`flow`){if(!Array.isArray(n))continue;for(let e=0;en.maxLength)return`字段【${t.label} 第 ${e+1} 项.${n.label}】长度不能超过 ${n.maxLength} 个字符`}}continue}if(t.editable&&t.maxLength&&v9(n).length>t.maxLength)return`字段【${t.label}】长度不能超过 ${t.maxLength} 个字符`}return null}var{Text:w9}=Q,{TextArea:T9}=eG;function E9(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function D9({value:e}){let t=e===`true`?`是`:e===`false`?`否`:v9(e);return y9(e)?(0,$.jsx)(T9,{value:t,rows:Math.min(6,Math.max(2,Math.ceil(t.length/42))),disabled:!0,style:{borderRadius:8,color:`#64748b`}}):(0,$.jsx)(eG,{value:t,disabled:!0,style:{borderRadius:8,color:`#64748b`}})}function O9({value:e,maxLength:t,onChange:n}){let r=v9(e),i={value:r,maxLength:t,showCount:!!t,onChange:e=>n(e.target.value),style:{borderRadius:8}};return y9(e)?(0,$.jsx)(T9,{...i,rows:Math.min(8,Math.max(3,Math.ceil(r.length/42)))}):(0,$.jsx)(eG,{...i})}function k9({value:e,onChange:t}){let n=e===!0||e===`true`;return(0,$.jsxs)(VI.Group,{value:n,onChange:e=>t(e.target.value),style:{display:`flex`,gap:24},children:[(0,$.jsx)(VI,{value:!0,style:{fontSize:14,color:`#475569`},children:`是`}),(0,$.jsx)(VI,{value:!1,style:{fontSize:14,color:`#475569`},children:`否`})]})}var A9=({value:e,schemaConfigSnapshot:t,onChange:n})=>{let r=E9(e)?e:{},i=_9(t);if(!joe(t))return(0,$.jsxs)(TH,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,$.jsx)(Jf,{type:`warning`,showIcon:!0,message:`视频提词配置缺失,暂不能编辑`,description:`请刷新详情后重试;如果仍然缺失,请联系管理员排查第4步 schema_config_snapshot 返回。`}),Object.keys(r).length?(0,$.jsx)(`pre`,{style:{margin:0,padding:12,borderRadius:10,background:`#f8fafc`,maxHeight:420,overflow:`auto`,color:`#475569`},children:JSON.stringify(r,null,2)}):null]});if(!i.length)return(0,$.jsx)(Jf,{type:`warning`,showIcon:!0,message:`视频提词配置为空`,description:`当前 Schema 配置没有可展示字段。`});let a=e=>{let t=E9(r[e.key])?r[e.key]:{},i=e.children.filter(e=>e.enabled);return i.length?(0,$.jsxs)(`div`,{style:{marginBottom:18},children:[(0,$.jsx)(TH,{style:{marginBottom:8},children:(0,$.jsx)(w9,{strong:!0,style:{color:`#334155`,fontSize:13},children:e.label})}),(0,$.jsx)(`div`,{style:{borderLeft:`3px solid #6366f1`,paddingLeft:12,marginLeft:4},children:i.map(i=>(0,$.jsxs)(`div`,{style:{marginBottom:12},children:[(0,$.jsx)(TH,{style:{marginBottom:4},children:(0,$.jsx)(w9,{style:{color:`#64748b`,fontSize:12},children:i.label})}),i.editable?i.type===`boolean`?(0,$.jsx)(k9,{value:t[i.key],onChange:t=>n(x9(r,e.key,i.key,t))}):(0,$.jsx)(O9,{value:t[i.key],maxLength:i.maxLength,onChange:t=>n(x9(r,e.key,i.key,t))}):(0,$.jsx)(D9,{value:t[i.key]})]},i.key))})]},e.key):null},o=e=>{let t=Array.isArray(r[e.key])?r[e.key]:[],i=[{key:`时间段`,label:`时间段`,enabled:!0,editable:!1},...e.itemFields.filter(e=>e.enabled)];return(0,$.jsxs)(`div`,{style:{marginBottom:18},children:[(0,$.jsxs)(TH,{style:{marginBottom:8},children:[(0,$.jsx)(w9,{strong:!0,style:{color:`#334155`,fontSize:13},children:e.label}),(0,$.jsx)(m$,{color:`default`,children:`锁定条目和时间段`})]}),(0,$.jsx)(`div`,{style:{border:`1px solid #e5e7eb`,borderRadius:10,padding:12,background:`#fff`},children:t.length===0?(0,$.jsx)(w9,{style:{color:`#94a3b8`,fontSize:12},children:`暂无内容`}):t.map((a,o)=>{let s=E9(a)?a:{};return(0,$.jsxs)(`div`,{style:{marginBottom:o===t.length-1?0:14,paddingBottom:o===t.length-1?0:14,borderBottom:o===t.length-1?`none`:`1px dashed #e2e8f0`},children:[(0,$.jsxs)(w9,{strong:!0,style:{display:`block`,marginBottom:8,color:`#475569`,fontSize:12},children:[`第 `,o+1,` 段`]}),i.map(t=>(0,$.jsxs)(`div`,{style:{marginBottom:10},children:[(0,$.jsx)(TH,{style:{marginBottom:4},children:(0,$.jsx)(w9,{style:{color:`#64748b`,fontSize:12},children:t.label})}),t.editable?t.type===`boolean`?(0,$.jsx)(k9,{value:s[t.key],onChange:i=>n(S9(r,e.key,o,t.key,i))}):(0,$.jsx)(O9,{value:s[t.key],maxLength:t.maxLength,onChange:i=>n(S9(r,e.key,o,t.key,i))}):(0,$.jsx)(D9,{value:s[t.key]})]},t.key))]},`${e.key}-${o}`)})})]},e.key)},s=e=>e.key in r?(0,$.jsxs)(`div`,{style:{marginBottom:18},children:[(0,$.jsx)(TH,{style:{marginBottom:8},children:(0,$.jsx)(w9,{strong:!0,style:{color:`#334155`,fontSize:13},children:e.label})}),e.editable?(0,$.jsx)(O9,{value:r[e.key],maxLength:e.maxLength,onChange:t=>{let i=b9(r);i[e.key]=t,n(i)}}):(0,$.jsx)(D9,{value:r[e.key]})]},e.key):null;return(0,$.jsx)(`div`,{children:i.map(e=>e.key in r?e.type===`object`?a(e):e.type===`flow`?o(e):s(e):null)})},{Title:Moe,Text:j9}=Q,{TextArea:Noe}=eG;function Poe(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function Foe(){let e=Ye(),{creatID:t}=$e(),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(`image`),[u,d]=(0,S.useState)({}),[f,p]=(0,S.useState)(null),[m,h]=(0,S.useState)(``),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(null),[b,x]=(0,S.useState)({}),[C,w]=(0,S.useState)(``),[T,E]=(0,S.useState)(``),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(5),[N,P]=(0,S.useState)(`16:9`),[F,I]=(0,S.useState)(`480p`),[L,R]=(0,S.useState)({ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`480p`,`720p`,`1080p`],durations:[5,8,10,12,15]}),[z,B]=(0,S.useState)([]),[V,H]=(0,S.useState)(1),[U,W]=(0,S.useState)(20),[G,ee]=(0,S.useState)(0),[te,ne]=(0,S.useState)(``),[K,re]=(0,S.useState)({}),[ie,ae]=(0,S.useState)([]),[q,oe]=(0,S.useState)([]),[se,ce]=(0,S.useState)(!1),[le,ue]=(0,S.useState)(``),[de,fe]=(0,S.useState)(`image`),pe=S.useRef(null);(0,S.useEffect)(()=>{if(se&&de===`video`){let e=()=>{pe.current&&pe.current.play().catch(()=>{})};pe.current&&(pe.current.readyState>=2?e():pe.current.addEventListener(`loadedmetadata`,e));let t=setTimeout(e,300);return()=>{clearTimeout(t),pe.current&&(pe.current.removeEventListener(`loadedmetadata`,e),pe.current.pause())}}else pe.current&&pe.current.pause()},[se,de]);let me=(e,t)=>{console.log(e,t),ue(e),fe(t),ce(!0)},he=()=>{ce(!1),ue(``),pe.current&&pe.current.pause()},ge=e=>{if(e.preventDefault(),e.stopPropagation(),!le)return;let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${le}&download=1`,t.download=de===`image`?`image.png`:`video.mp4`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},_e=[{id:1,title:`原始素材`,description:`上传原始视频素材`,childId:1},{id:2,title:`生成提示词`,description:`根据素材生成描述词`,childId:2},{id:3,title:`生成产品融合图`,description:`生成产品与场景融合图`,childId:3},{id:4,title:`生成视频提示词`,description:`生成视频生成提示词`,childId:4},{id:5,title:`生成最终视频`,description:`合成最终视频`,childId:5}].map((e,t)=>({...e,status:ie[t]?.status||``,id:ie[t]?.id||t,output:ie[t]?.output||``,engineId:ie[t]?.input?.payload?.videoConfig?.engineId||``}));(0,S.useEffect)(()=>{let e=new Set;q.forEach(t=>{let n=_e.find(e=>String(e.childId)===t);n&&(n.status===`completed`||n.status===`failed`)&&e.add(t)});for(let t=_e.length-1;t>=0;t--)if(_e[t].status===`completed`||_e[t].status===`failed`){e.add(String(_e[t].childId));break}e.size>0?oe(Array.from(e)):oe([])},[ie]);let ve=(e,t,n)=>{r7(e,t,n).then(e=>{e.items&&B(e.items),e.total!==void 0&&ee(e.total)}).catch(e=>{})},ye=(e,t)=>{H(e),W(t),ve(e,t,te)},be=()=>{H(1),ve(1,U,te)};(0,S.useEffect)(()=>{ve(V,U)},[]),(0,S.useEffect)(()=>{e7().then(e=>{if(x(e.engine||{}),e.engine?.video&&e.engine.video.length>0){w(e.engine.video[0].id);let t=e.engine.video[0];R({ratios:t.supportedRatios||[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:t.supportedResolutions||[`480p`,`720p`,`1080p`],durations:t.supportedDurations||[5,8,10,12,15]})}e.engine?.image&&e.engine.image.length>0&&E(e.engine.image[0].id)}).catch(e=>{})},[]),(0,S.useEffect)(()=>()=>{v&&(clearInterval(v),y(null))},[v]),(0,S.useEffect)(()=>{let e=e=>{let t=e.target;!t.closest(`.image-settings-trigger`)&&!t.closest(`.image-settings-popover`)&&(O(!1),A(!1))};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,S.useEffect)(()=>{t&&i7(t).then(e=>{re(e),e.steps&&ae(e.steps)}).catch(e=>{})},[t]),(0,S.useEffect)(()=>{let e=_e[4];e&&e.status!==`completed`&&e.status!==`failed`?v||y(setInterval(Ce,15e3)):e&&v&&(clearInterval(v),y(null))},[_e]);let xe=(e,t,n,i)=>{l(t||`image`),h(n?String(n):``),t===`video`?(p(i||null),d(e&&typeof e==`object`?Poe(e):{}),a(``)):(p(null),a(e||``),d({})),r(!0)},Se=async()=>{if(c===`image`){if(!K?.id||!m){Z.warning(`缺少任务或步骤 ID,无法保存图片提示词`);return}if(!i||!i.trim()){Z.warning(`图片提示词不能为空`);return}_(!0);try{await wie(K.id,m,{prompt:i.trim()}),Z.success(`图片提示词已保存`),we(),r(!1),h(``)}catch(e){Z.error(e?.message||`保存图片提示词失败`)}finally{_(!1)}return}if(!K?.id||!m){Z.warning(`缺少任务或步骤 ID,无法保存视频提示词`);return}if(!u||typeof u!=`object`||Object.keys(u).length===0){Z.warning(`视频提示词不能为空`);return}if(!f){Z.warning(`视频提词配置缺失,暂不能保存`);return}let e=C9(u,f);if(e){Z.warning(e);return}_(!0);try{await Aie(K.id,m,{prompt_schema:u}),Z.success(`视频提示词已保存`),we(),r(!1),h(``)}catch(e){Z.error(e?.message||`保存视频提示词失败`)}finally{_(!1)}},Ce=()=>{t&&i7(t).then(e=>{re(e),e.steps&&ae(e.steps)}).catch(e=>{})},we=()=>{t&&i7(t).then(e=>{re(e),e.steps&&ae(e.steps)}).catch(e=>{})},Te=e=>{let t={engine_id:T,image_proportion:`1:1`,image_px:`2048x2048`,image_size:`2K`};a7(K.id,e.toString(),t).then(e=>{Z.info(`正在生成图片,请稍候...`),we()}).catch(e=>{let t=e?.message?.split(`: `)?.[1]||e?.message||`生成失败`;Z.error(t)})},Ee=()=>{let e={engine_id:T,image_proportion:`1:1`,image_px:`2048x2048`,image_size:`2K`};a7(K.id,_e[1].id.toString(),e).then(e=>{Z.info(`正在生成图片,请稍候...`),we()}).catch(e=>{let t=e?.message?.split(`: `)?.[1]||e?.message||`生成失败`;Z.error(t)})},De=e=>{let t={engine_id:C,duration:j,aspect_ratio:N,resolution:F,target_platform:`抖音`};Tie(K.id,e.toString(),t).then(e=>{we(),Z.info(`正在生成视频提示词,请稍候...`)}).catch(e=>{let t=e?.message?.split(`: `)?.[1]||e?.message||`生成失败`;Z.error(t)})},Oe=(e,t)=>{o7(K.id,e.toString(),{engine_id:``}).then(e=>{Z.info(`正在生成视频,请稍候...`),we()}).catch(e=>{let t=e?.message?.split(`: `)?.[1]||e?.message||`生成失败`;Z.error(t)})},ke=()=>{o7(K.id,_e[3].id.toString(),{engine_id:``}).then(e=>{Z.info(`正在生成视频,请稍候...`),we()}).catch(e=>{})};return(0,$.jsxs)(S.Fragment,{children:[(0,$.jsx)(`div`,{className:`initialinfo-container`,style:{margin:`-24px -32px -32px`,height:`calc(100vh - 34px)`,position:`relative`,boxSizing:`border-box`,overflow:`hidden`,display:`flex`,flexDirection:`column`},children:(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,justifyContent:`space-between`,alignItems:`stretch`,gap:`2%`,position:`relative`,zIndex:1,minHeight:0},children:[(0,$.jsxs)(`div`,{className:`replication-preview`,style:{flex:4,background:`rgba(255,255,255,0.85)`,backdropFilter:`blur(20px)`,borderRadius:20,overflow:`hidden`,border:`1px solid rgba(99, 102, 241, 0.1)`,boxShadow:`0 8px 32px rgba(99, 102, 241, 0.08)`,display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,$.jsxs)(`div`,{style:{borderBottom:`1px solid rgba(99, 102, 241, 0.08)`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`16px 24px`,background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,boxSizing:`border-box`},children:[(0,$.jsx)(X,{icon:(0,$.jsx)(R2,{}),onClick:()=>e(-1),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,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #6366f1, #8b5cf6, transparent)`,borderRadius:1}}),(0,$.jsx)(`h3`,{style:{margin:0,fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`爆款复刻 - 任务详情`}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #8b5cf6, #6366f1, transparent)`,borderRadius:1}})]}),(0,$.jsx)(X,{type:`primary`,ghost:!0,style:{borderRadius:10,padding:`4px 16px`,fontSize:13,background:`rgba(99, 102, 241, 0.1)`,borderColor:`rgba(99, 102, 241, 0.2)`,color:`#6366f1`},onClick:()=>s(!0),children:`创作记录`})]}),(0,$.jsx)(`div`,{style:{flex:1,overflowY:`auto`},children:(0,$.jsxs)(`div`,{className:`material_box`,children:[(0,$.jsxs)(`div`,{style:{display:`flex`,gap:24,flexWrap:`wrap`,alignItems:`flex-start`},children:[(0,$.jsxs)(`div`,{style:{flex:1,minWidth:250},children:[(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:`#1e293b`,marginBottom:10,display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(`span`,{style:{width:3,height:14,background:`linear-gradient(180deg, #6366f1, #8b5cf6)`,borderRadius:2,display:`inline-block`}}),`视频`]}),(0,$.jsx)(`div`,{className:`medio_box`,style:{aspectRatio:`16/9`,background:`linear-gradient(135deg, rgba(248,250,252,0.8) 0%, rgba(238,242,255,0.6) 100%)`,borderRadius:14,overflow:`hidden`,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.06)`,border:`1px solid rgba(99, 102, 241, 0.08)`,cursor:K?.material?.materialVideoUrl?`pointer`:`default`},onClick:()=>K?.material?.materialVideoUrl&&me(K.material.materialVideoUrl,`video`),children:K?.material?.materialVideoUrl?(0,$.jsx)(`video`,{src:K.material.materialVideoUrl,style:{width:`100%`,height:`100%`,objectFit:`contain`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#94a3b8`,fontSize:13},children:`暂无视频`})})]}),(0,$.jsxs)(`div`,{className:`product_img`,style:{flex:1,minWidth:250},children:[(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:`#1e293b`,marginBottom:10,display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(`span`,{style:{width:3,height:14,background:`linear-gradient(180deg, #6366f1, #8b5cf6)`,borderRadius:2,display:`inline-block`}}),`产品图片`]}),(0,$.jsx)(`div`,{className:`medio_box`,style:{aspectRatio:`1/1`,background:`linear-gradient(135deg, rgba(248,250,252,0.8) 0%, rgba(238,242,255,0.6) 100%)`,borderRadius:14,overflow:`hidden`,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.06)`,border:`1px solid rgba(99, 102, 241, 0.08)`,cursor:K?.material?.materialImageUrl?`pointer`:`default`},onClick:()=>K?.material?.materialImageUrl&&me(K.material.materialImageUrl,`image`),children:K?.material?.materialImageUrl?(0,$.jsx)(`img`,{src:K.material.materialImageUrl,alt:``,style:{width:`100%`,height:`100%`,objectFit:`contain`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#94a3b8`,fontSize:13},children:`暂无图片`})})]})]}),(0,$.jsx)(`div`,{style:{margin:`20px 0`,height:1,background:`linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.15), transparent)`,borderRadius:.5}}),K?.finalImageUrl&&(0,$.jsx)(`div`,{style:{marginTop:16},children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:`#1e293b`,marginBottom:10,display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(`span`,{style:{width:3,height:14,background:`linear-gradient(180deg, #6366f1, #8b5cf6)`,borderRadius:2,display:`inline-block`}}),`生成图片`]}),(0,$.jsx)(`div`,{className:`medio_box`,style:{aspectRatio:`1/1`,background:`linear-gradient(135deg, rgba(248,250,252,0.8) 0%, rgba(238,242,255,0.6) 100%)`,borderRadius:14,overflow:`hidden`,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.06)`,border:`1px solid rgba(99, 102, 241, 0.08)`,cursor:`pointer`},onClick:()=>me(K.finalImageUrl,`image`),children:(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${K.finalImageUrl}`,alt:``,style:{width:`100%`,height:`100%`,objectFit:`contain`}})})]})}),K?.finalVideoUrl&&(0,$.jsx)(`div`,{style:{marginTop:16},children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:`#1e293b`,marginBottom:10,display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(`span`,{style:{width:3,height:14,background:`linear-gradient(180deg, #6366f1, #8b5cf6)`,borderRadius:2,display:`inline-block`}}),`生成视频`]}),(0,$.jsx)(`div`,{className:`medio_box`,style:{aspectRatio:`16/9`,background:`linear-gradient(135deg, rgba(248,250,252,0.8) 0%, rgba(238,242,255,0.6) 100%)`,borderRadius:14,overflow:`hidden`,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.06)`,border:`1px solid rgba(99, 102, 241, 0.08)`,cursor:`pointer`},onClick:()=>me(K.finalVideoUrl,`video`),children:(0,$.jsx)(`video`,{src:`http://ceshi.apiforeign.minzhong.cn${K.finalVideoUrl}`,style:{width:`100%`,height:`100%`,objectFit:`contain`}})})]})})]})})]}),(0,$.jsxs)(`div`,{className:`replication-form`,style:{flex:1,minWidth:`450px`,background:`rgba(255,255,255,0.85)`,backdropFilter:`blur(20px)`,borderRadius:20,overflow:`hidden`,border:`1px solid rgba(99, 102, 241, 0.1)`,boxShadow:`0 8px 32px rgba(99, 102, 241, 0.08)`,display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,$.jsxs)(`div`,{style:{padding:`16px 24px`,borderBottom:`1px solid rgba(99, 102, 241, 0.08)`,display:`flex`,alignItems:`center`,gap:10,background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`},children:[(0,$.jsx)(`div`,{style:{width:4,height:18,background:`linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%)`,borderRadius:2}}),(0,$.jsx)(`span`,{style:{fontSize:15,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`生成步骤`})]}),(0,$.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`8px 16px 16px`},children:(0,$.jsx)($g,{activeKey:q,onChange:oe,ghost:!0,bordered:!1,style:{background:`transparent`},expandIconPlacement:`end`,items:_e.map(e=>({key:String(e.childId),label:(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,justifyContent:`space-between`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:16,height:16},children:e.status===`completed`?(0,$.jsx)(k4,{style:{fontSize:16,color:`#22c55e`}}):e.status===`processing`?(0,$.jsx)(`div`,{style:{width:16,height:16,borderRadius:`50%`,border:`2px solid #e2e8f0`,borderTopColor:`#6366f1`,animation:`spinSlow 1s linear infinite`}}):e.status===`failed`?(0,$.jsx)(`div`,{style:{width:16,height:16,borderRadius:`50%`,background:`#ef4444`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`span`,{style:{color:`#fff`,fontSize:10},children:`×`})}):(0,$.jsx)(`div`,{style:{width:8,height:8,borderRadius:`50%`,background:`#cbd5e1`}})}),(0,$.jsx)(`span`,{style:{fontSize:14,color:e.status===`processing`||e.status===`waiting_user`?`#6366f1`:`#1e293b`,fontWeight:500},children:e.title}),(e.status===`processing`||e.status===`waiting_user`)&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#6366f1`,marginLeft:8},children:`生成中`}),e.status===`failed`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#ef4444`,marginLeft:8},children:`失败`}),e.status===``&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#717d8b`,marginLeft:8},children:`待生成`})]})}),children:(0,$.jsxs)(`div`,{style:{padding:`16px`,background:`linear-gradient(135deg, rgba(248,250,252,0.6) 0%, rgba(238,242,255,0.4) 100%)`,borderRadius:12,marginTop:8,border:`1px solid rgba(99, 102, 241, 0.06)`},children:[e.childId===1&&(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`div`,{style:{display:`flex`,gap:20,marginBottom:20,alignItems:`flex-start`,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{flex:1,minWidth:200},children:[(0,$.jsx)(j9,{style:{color:`#475569`,fontSize:13,marginBottom:10,display:`block`,fontWeight:500},children:`原视频`}),(0,$.jsx)(`div`,{style:{height:180,borderRadius:12,background:`linear-gradient(135deg, rgba(248,250,252,0.8) 0%, rgba(238,242,255,0.6) 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,border:`1px solid rgba(99, 102, 241, 0.08)`,boxShadow:`0 2px 8px rgba(99, 102, 241, 0.04)`},children:K?.material?.materialVideoUrl?(0,$.jsx)(`video`,{src:K.material.materialVideoUrl,style:{maxWidth:`100%`,maxHeight:`100%`,objectFit:`contain`,borderRadius:10},controls:!0}):(0,$.jsxs)(`div`,{style:{textAlign:`center`,color:`#94a3b8`},children:[(0,$.jsxs)(`svg`,{width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,style:{marginBottom:8},children:[(0,$.jsx)(`rect`,{x:`2`,y:`2`,width:`20`,height:`16`,rx:`2`,ry:`2`}),(0,$.jsx)(`path`,{d:`M8 12l4 2 4-2`})]}),(0,$.jsx)(`div`,{style:{fontSize:13},children:`暂无视频`})]})})]}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:200},children:[(0,$.jsx)(j9,{style:{color:`#64748b`,fontSize:13,marginBottom:10,display:`block`,fontWeight:500},children:`产品图片`}),(0,$.jsx)(`div`,{style:{height:180,borderRadius:10,background:`#f1f5f9`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K?.material?.materialImageUrl?(0,$.jsx)(`img`,{src:K.material.materialImageUrl,alt:`产品图片`,style:{maxWidth:`100%`,maxHeight:`100%`,objectFit:`contain`,borderRadius:10}}):(0,$.jsxs)(`div`,{style:{textAlign:`center`,color:`#94a3b8`},children:[(0,$.jsxs)(`svg`,{width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,style:{marginBottom:8},children:[(0,$.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,$.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`,fill:`currentColor`}),(0,$.jsx)(`path`,{d:`M21 15l-5-5L5 21`})]}),(0,$.jsx)(`div`,{style:{fontSize:13},children:`暂无图片`})]})})]})]})}),e.childId===2&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{padding:`12px 14px`,background:`rgba(255,255,255,0.6)`,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.08)`,marginBottom:4},children:(0,$.jsx)(j9,{style:{color:`#475569`,fontSize:13,lineHeight:1.8,whiteSpace:`pre-wrap`},children:e?.output?.payload?.prompt||`暂无提示词`})}),(0,$.jsxs)(TH,{style:{marginTop:16,gap:12,width:`100%`},children:[(0,$.jsx)(X,{type:`default`,icon:(0,$.jsx)(X$,{}),onClick:()=>xe(e?.output?.payload?.prompt,`image`,e.id),style:{flex:1,borderRadius:10,borderColor:`rgba(99, 102, 241, 0.3)`,color:`#6366f1`,height:36,fontWeight:500,background:`rgba(99, 102, 241, 0.04)`},disabled:e.status!==`completed`,children:`修改提示词`}),(0,$.jsx)(X,{onClick:()=>{Te(e.id)},type:`primary`,style:{flex:1,borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,height:36,fontWeight:500,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`},disabled:e.status!==`completed`,children:`下一步:生成图片`})]})]}),e.childId===3&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{borderRadius:12,overflow:`hidden`,marginBottom:16,background:`linear-gradient(135deg, rgba(248,250,252,0.8) 0%, rgba(238,242,255,0.6) 100%)`,border:`1px solid rgba(99, 102, 241, 0.08)`,boxShadow:`0 2px 8px rgba(99, 102, 241, 0.04)`,position:`relative`},children:[K.finalImageUrl?(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${K.finalImageUrl}`,alt:`融合图`,style:{width:`100%`,height:180,objectFit:`cover`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:180,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#94a3b8`,fontSize:14},children:`暂无融合图`}),(0,$.jsx)(X,{type:`default`,icon:(0,$.jsx)(X$,{}),onClick:()=>Ee(),disabled:e.status!==`completed`,style:{position:`absolute`,bottom:8,left:8,borderRadius:8,borderColor:`rgba(99, 102, 241, 0.3)`,color:`#6366f1`,height:30,fontWeight:500,background:`rgba(255,255,255,0.85)`,backdropFilter:`blur(4px)`,padding:`0 12px`,fontSize:12},children:`重新生成`})]}),(0,$.jsx)(`p`,{style:{marginBottom:6,fontSize:14,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`视频参数选择:`}),(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>{O(!D),A(!1)},className:`image-settings-trigger`,style:{width:`100%`,padding:`4px 12px`,height:34,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.15)`,backgroundColor:`rgba(255,255,255,0.7)`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:6,transition:`all 0.2s`},children:[(0,$.jsx)(R8,{style:{fontSize:14,color:`#6366f1`}}),(0,$.jsx)(j9,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:b.video?.find(e=>e.id===C)?.name||`选择引擎`})]}),D&&(0,$.jsx)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:-10,width:350,backgroundColor:`#fff`,borderRadius:16,boxShadow:`0 10px 40px rgba(0,0,0,0.15)`,padding:16,border:`none`,zIndex:9999},onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(`div`,{style:{marginBottom:8},children:[(0,$.jsx)(j9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择引擎`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:b.video?.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{w(e.id),R({ratios:e.supportedRatios||[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:e.supportedResolutions||[`480p`,`720p`,`1080p`],durations:e.supportedDurations||[5,8,10,12,15]}),e.supportedRatios?.includes(N)||P(e.supportedRatios?.[0]||`16:9`),e.supportedResolutions?.includes(F)||I(e.supportedResolutions?.[0]||`720p`),e.supportedDurations?.includes(j)||M(e.supportedDurations?.[0]||5),O(!1)},style:{flex:1,minHeight:48,borderRadius:8,border:C===e.id?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:C===e.id?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`flex-start`,padding:`8px 12px`,transition:`all 0.2s`,textAlign:`left`},children:[(0,$.jsx)(`span`,{style:{fontSize:13,fontWeight:C===e.id?600:500,color:C===e.id?`#6366f1`:`#4b5563`,marginBottom:2},children:e.name}),(0,$.jsx)(`span`,{style:{fontSize:11,color:`#9ca3af`}})]},e.id))})]})})]}),(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>{A(!k),O(!1)},className:`image-settings-trigger`,style:{width:`100%`,padding:`4px 12px`,height:34,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.15)`,backgroundColor:`rgba(255,255,255,0.7)`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:6,transition:`all 0.2s`},children:[(0,$.jsx)(a6,{style:{fontSize:14,color:`#6366f1`}}),(0,$.jsxs)(j9,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:[N,` · `,j,`s · `,F]})]}),k&&(0,$.jsxs)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:-160,width:350,backgroundColor:`#fff`,borderRadius:16,boxShadow:`0 10px 40px rgba(0,0,0,0.15)`,padding:16,border:`none`,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(j9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:L.ratios.map(e=>(0,$.jsxs)(`button`,{onClick:()=>P(e),style:{flex:`0 0 calc(14.28% - 4px)`,minWidth:44,height:52,borderRadius:6,border:N===e?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:N===e?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{width:18,height:18,border:`2px solid ${N===e?`#6366f1`:`#9ca3af`}`,borderRadius:2,marginBottom:2}}),(0,$.jsx)(`span`,{style:{fontSize:9,color:N===e?`#6366f1`:`#6b7280`,fontWeight:N===e?600:400},children:e})]},e))})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(j9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择时长`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`,height:24,display:`flex`,alignItems:`center`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:0,right:0,height:6,borderRadius:3,background:`#e5e7eb`,transform:`translateY(-50%)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:0,height:6,borderRadius:3,background:`#6366f1`,width:`${(j-Math.min(...L.durations))/(Math.max(...L.durations)-Math.min(...L.durations))*100}%`,transform:`translateY(-50%)`}}),(0,$.jsx)(`input`,{type:`range`,min:Math.min(...L.durations),max:Math.max(...L.durations),value:j,onChange:e=>M(Number(e.target.value)),style:{position:`relative`,width:`100%`,height:24,borderRadius:3,background:`transparent`,outline:`none`,appearance:`none`,cursor:`pointer`,zIndex:1}})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 12px`,backgroundColor:`#f1f5f9`,borderRadius:6},children:[(0,$.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:`#64748b`},children:j}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#9ca3af`},children:`秒`})]})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(j9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:6},children:L.resolutions.map(e=>(0,$.jsx)(`button`,{onClick:()=>I(e),style:{flex:1,height:42,borderRadius:6,border:F===e?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:F===e?`#6366f1`:`#f9fafb`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:(0,$.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:F===e?`#fff`:`#4b5563`},children:e})},e))})]})]})]})]}),(0,$.jsx)(X,{type:`primary`,style:{width:`100%`,borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,height:36,fontWeight:500,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`},onClick:()=>{De(e.id)},disabled:e.status!==`completed`,children:`下一步:生成视频提示词`})]}),e.childId===4&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{padding:`12px 14px`,background:`rgba(255,255,255,0.6)`,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.08)`,marginBottom:4},children:(0,$.jsx)(j9,{style:{color:`#64748b`,fontSize:13,lineHeight:1.8},children:`视频提词已生成,可点击按钮查看/修改`})}),(0,$.jsxs)(TH,{style:{marginTop:16,gap:12,width:`100%`},children:[(0,$.jsx)(X,{type:`default`,icon:(0,$.jsx)(X$,{}),onClick:()=>xe(K?.videoGeneration?.promptSchema,`video`,e.id,K?.videoGeneration?.schemaConfigSnapshot),style:{flex:1,borderRadius:10,borderColor:`rgba(99, 102, 241, 0.3)`,color:`#6366f1`,height:36,fontWeight:500,background:`rgba(99, 102, 241, 0.04)`},disabled:e.status!==`completed`||!K?.videoGeneration?.promptSchema||!K?.videoGeneration?.schemaConfigSnapshot,children:`查看/修改视频提词`}),(0,$.jsx)(X,{onClick:()=>{Oe(e.id,e.engineId)},type:`primary`,style:{flex:1,borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,height:36,fontWeight:500,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`},disabled:e.status!==`completed`,children:`下一步:生成视频`})]})]}),e.childId===5&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{borderRadius:12,overflow:`hidden`,marginBottom:16,position:`relative`,background:`linear-gradient(135deg, rgba(248,250,252,0.8) 0%, rgba(238,242,255,0.6) 100%)`,border:`1px solid rgba(99, 102, 241, 0.08)`,boxShadow:`0 2px 8px rgba(99, 102, 241, 0.04)`},children:e.status===`completed`&&K?.finalVideoUrl?(0,$.jsx)(`video`,{src:`http://ceshi.apiforeign.minzhong.cn${K.finalVideoUrl}`,style:{width:`100%`,height:180,objectFit:`cover`},controls:!0}):e.status===`processing`?(0,$.jsxs)(`div`,{style:{width:`100%`,height:180,display:`flex`,alignItems:`center`,justifyContent:`center`,flexDirection:`column`,gap:8},children:[(0,$.jsx)(`div`,{style:{width:20,height:20,borderRadius:`50%`,border:`2px solid #e2e8f0`,borderTopColor:`#6366f1`,animation:`spinSlow 1s linear infinite`}}),(0,$.jsx)(`span`,{style:{color:`#6366f1`,fontSize:14},children:`视频生成中...`})]}):e.status===`failed`?(0,$.jsx)(`div`,{style:{width:`100%`,height:180,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#ef4444`,fontSize:14},children:`视频生成失败`}):(0,$.jsx)(`div`,{style:{width:`100%`,height:180,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#94a3b8`,fontSize:14},children:`暂无视频`})}),(0,$.jsxs)(TH,{style:{width:`100%`,gap:12},children:[(0,$.jsx)(X,{onClick:()=>ke(),type:`default`,icon:(0,$.jsx)(X$,{}),style:{flex:1,borderRadius:10,borderColor:`rgba(99, 102, 241, 0.3)`,color:`#6366f1`,height:36,fontWeight:500,background:`rgba(99, 102, 241, 0.04)`},disabled:e.status!==`completed`,children:`重新生成`}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(j0,{}),style:{flex:1,borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,height:36,fontWeight:500,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`},disabled:e.status!==`completed`,onClick:()=>{let e=`http://ceshi.apiforeign.minzhong.cn${K?.finalVideoUrl}&download=1`,t=document.createElement(`a`);t.href=e,t.download=`video_${Date.now()}.mp4`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},children:`下载视频`})]})]})]})}))})})]})]})}),(0,$.jsx)(MK,{title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:4,height:18,background:`linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%)`,borderRadius:2}}),(0,$.jsx)(`span`,{style:{fontSize:15,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:c===`video`?`查看/编辑视频提词`:`修改提示词`})]}),open:n,onCancel:()=>{g||r(!1)},footer:[(0,$.jsx)(X,{onClick:()=>r(!1),disabled:g,style:{borderRadius:8},children:`取消`},`cancel`),(0,$.jsx)(X,{type:`primary`,onClick:Se,loading:g,disabled:g,style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`},children:`确认`},`confirm`)],width:800,style:{borderRadius:16},styles:{header:{background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,borderBottom:`1px solid rgba(99, 102, 241, 0.08)`,padding:`16px 24px`},body:{background:`linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #f0f9ff 100%)`,padding:`20px 24px`}},children:c===`image`?(0,$.jsx)(Noe,{value:i,onChange:e=>a(e.target.value),rows:8,style:{width:`100%`,height:300,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.15)`,background:`rgba(255,255,255,0.8)`},placeholder:`请输入提示词`}):(0,$.jsx)(`div`,{style:{maxHeight:500,overflowY:`auto`,paddingRight:10},children:(0,$.jsx)(A9,{value:u,schemaConfigSnapshot:f,onChange:d})})}),(0,$.jsxs)(MK,{title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:4,height:20,background:`linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%)`,borderRadius:2}}),(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`创作记录`})]}),open:o,onCancel:()=>s(!1),width:850,footer:null,style:{borderRadius:20},styles:{body:{height:580,display:`flex`,flexDirection:`column`,padding:0},header:{background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,borderBottom:`1px solid rgba(99, 102, 241, 0.08)`,padding:`16px 24px`}},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,margin:`16px 24px`,flexShrink:0},children:[(0,$.jsx)(eG,{placeholder:`搜索产品名称`,value:te,onChange:e=>ne(e.target.value),onPressEnter:be,style:{width:220,borderRadius:10,marginRight:10,border:`1px solid rgba(99, 102, 241, 0.15)`,background:`rgba(255,255,255,0.8)`}}),(0,$.jsx)(X,{type:`primary`,onClick:be,style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`},children:`搜索`})]}),(0,$.jsx)(t$,{columns:[{title:`产品名称`,dataIndex:`targetProjectName`,key:`targetProjectName`,align:`center`},{title:`状态`,dataIndex:`status`,key:`status`,align:`center`,render:(e,t)=>{let n=e,r=t.current_step_code||t.currentStepCode,i=(()=>{if(r===`image_prompt_optimize`)switch(n){case`waiting_user`:return{text:`等待融合图生成`,color:`#f59e0b`};case`processing`:return{text:`图片提示词生成中`,color:`#f59e0b`};case`completed`:return{text:`图片提示词生成成功`,color:`#10b981`};case`failed`:return{text:`图片提示词生成失败`,color:`#ef4444`};default:return{text:n||`-`,color:`#666`}}else if(r===`image_generate`)switch(n){case`waiting_user`:return{text:`等待生成视频提示词`,color:`#f59e0b`};case`processing`:return{text:`融合图生成中`,color:`#f59e0b`};case`completed`:return{text:`融合图生成成功`,color:`#10b981`};case`failed`:return{text:`融合图生成失败`,color:`#ef4444`};default:return{text:n||`-`,color:`#666`}}else if(r===`video_prompt_optimize`)switch(n){case`waiting_user`:return{text:`等待最终视频生成`,color:`#f59e0b`};case`processing`:return{text:`视频提示词生成中`,color:`#f59e0b`};case`completed`:return{text:`视频提示词生成成功`,color:`#10b981`};case`failed`:return{text:`视频提示词生成失败`,color:`#ef4444`};default:return{text:n||`-`,color:`#666`}}else if(r===`video_generate`)switch(n){case`waiting_user`:return{text:``,color:`#666`};case`processing`:return{text:`最终视频生成中`,color:`#f59e0b`};case`completed`:return{text:`任务完成`,color:`#10b981`};case`failed`:return{text:`最终视频生成失败`,color:`#ef4444`};default:return{text:n||`-`,color:`#666`}}else if(r===`material_input`)switch(n){case`waiting_user`:return{text:`等待生成图片提示词`,color:`#f59e0b`};case`processing`:return{text:`素材处理中`,color:`#f59e0b`};case`completed`:return{text:`素材上传成功`,color:`#10b981`};case`failed`:return{text:`素材上传失败`,color:`#ef4444`};default:return{text:n||`-`,color:`#666`}}else return{pending:{text:`子任务待处理`,color:`#f59e0b`},waiting_user:{text:`等待用户确认或触发`,color:`#f59e0b`},processing:{text:`子任务处理中`,color:`#f59e0b`},completed:{text:`子任务完成`,color:`#10b981`},failed:{text:`子任务失败`,color:`#ef4444`},cancelled:{text:`子任务取消`,color:`#94a3b8`}}[n]||{text:n||`-`,color:`#666`}})();return typeof i==`string`?(0,$.jsx)(`span`,{style:{fontSize:12,color:`#666`,fontWeight:500},children:i}):(0,$.jsx)(`span`,{style:{fontSize:12,color:i.color,fontWeight:500},children:i.text})}},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,align:`center`,render:e=>{if(!e)return`-`;let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`}},{title:`操作`,key:`action`,align:`center`,render:(t,n)=>(0,$.jsx)(`button`,{onClick:()=>e(`/initial/${n.id}/initialinfo`),style:{color:`#6366f1`,textDecoration:`none`,fontSize:12,border:`none`,background:`rgba(99, 102, 241, 0.08)`,padding:`4px 12px`,borderRadius:8,cursor:`pointer`,transition:`all 0.2s`,fontWeight:500},children:`查看详情`})}],dataSource:z,rowKey:`id`,pagination:{current:V,pageSize:U,total:G,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`,onChange:ye},style:{fontSize:13},scroll:{y:350}})]}),(0,$.jsx)(MK,{open:se,title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:4,height:20,background:`linear-gradient(180deg, #8b5cf6 0%, #ddd6fe 100%)`,borderRadius:2}}),(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:700,color:`#8b5cf6`,letterSpacing:.4},children:`预览`})]}),onCancel:he,width:800,footer:(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:12,padding:`16px 24px`,background:`rgba(255,255,255,0.6)`,borderTop:`1px solid rgba(139, 92, 246, 0.08)`},children:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(j0,{}),onClick:ge,style:{borderRadius:10,background:`linear-gradient(135deg, #8b5cf6 0%, #ddd6fe 100%)`,border:`none`,boxShadow:`0 8px 18px rgba(47, 52, 64, 0.15)`},children:`下载`})}),centered:!0,style:{borderRadius:16},styles:{body:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:`400px`},header:{background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,borderBottom:`1px solid rgba(139, 92, 246, 0.08)`,padding:`16px 24px`}},children:(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:`100%`,height:`100%`},children:de===`image`?(0,$.jsx)(`img`,{src:le.startsWith(`http`)?le:`http://ceshi.apiforeign.minzhong.cn${le}`,alt:`预览`,style:{width:`100%`,maxHeight:`400px`,objectFit:`contain`}}):(0,$.jsx)(`video`,{ref:pe,src:le.startsWith(`http`)?le:`http://ceshi.apiforeign.minzhong.cn${le}`,controls:!0,style:{maxWidth:`100%`,maxHeight:`400px`}})})})]})}var Ioe={pending_analysis:{label:`等待分析`,color:`default`},analyzing:{label:`分析中`,color:`processing`},analysis_completed:{label:`分析完成`,color:`blue`},analysis_failed:{label:`分析失败`,color:`red`},splitting:{label:`拆镜中`,color:`processing`},split_completed:{label:`拆镜完成`,color:`green`},partial_failed:{label:`部分失败`,color:`orange`},failed:{label:`失败`,color:`red`},deleted:{label:`已软删`,color:`default`}},Loe=e=>{let t=Ioe[e]||{label:e,color:`default`};return(0,$.jsx)(m$,{color:t.color,children:t.label})};function Roe(){let e=Ye(),[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)(``),[d,f]=(0,S.useState)(0),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)([]),[_,v]=(0,S.useState)(1),[y,b]=(0,S.useState)(10),[x,C]=(0,S.useState)(0),[w,T]=(0,S.useState)(``),E=(0,S.useRef)(null),D=(0,S.useRef)(null),O=(0,S.useCallback)(()=>{t&&URL.revokeObjectURL(t),n(``),i(``),o(``),f(0),u(``)},[t]),k=async e=>{if(!e.type.startsWith(`video/`))return o(`请选择视频文件`),!1;if(e.size>100*1024*1024)return o(`视频文件大小不能超过 100MB`),!1;let t=await new Promise(t=>{let n=document.createElement(`video`);n.preload=`metadata`,n.onloadedmetadata=()=>{t(n.duration),URL.revokeObjectURL(n.src)},n.onerror=()=>{t(0)},n.src=URL.createObjectURL(e)});if(t>60)return o(`视频时长不能超过 1分钟`),!1;O(),m(!0);try{let r=await sie(e,t);n(r.url),i(r.resource_id||``),o(``),Z.success(`视频上传成功`)}catch{o(`视频上传失败,请重试`),Z.error(`视频上传失败`)}finally{m(!1)}return!1},A=(0,S.useCallback)(()=>{E.current&&f(E.current.duration)},[]),j=async()=>{if(!t||!l.trim()){Z.warning(`请先上传视频并输入产品名称`);return}m(!0);try{jie({video_url:t,video_duration_seconds:d,video_resource_id:r||void 0,title:l.trim(),idempotency_key:`shot_${Date.now()}`}).then(t=>{f7(1,20,w).then(t=>{Z.loading(`创建中...`,3),setTimeout(()=>{e(`/removelens/${t.items[0].id}/removeinfo`)},3e3)})}),O()}catch{Z.error(`任务创建失败,请重试`)}finally{m(!1)}},M=async(e,t,n)=>{try{let r=await f7(e,t,n);g(r.items||[]),C(r.total||0),v(e),b(t)}catch{Z.error(`获取列表失败`)}},N=(e,t)=>{M(e,t,w)},P=()=>{M(1,10,w)};return(0,$.jsx)(`div`,{style:{margin:`-24px -32px -32px`,borderRadius:20,minHeight:`calc(100vh - 34px)`,overflow:`auto`,background:`linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #f0f9ff 100%)`,position:`relative`,padding:`20px 32px`,backgroundImage:`url(${Qae})`,backgroundRepeat:`no-repeat`,backgroundSize:`100% 100%`,backgroundPosition:`center`},children:(0,$.jsxs)(`div`,{style:{maxWidth:1200,margin:`0 auto`,position:`relative`,zIndex:10},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:`AI视频拆镜工作台`}),(0,$.jsx)(`p`,{style:{fontSize:13,color:`#64748b`,margin:`4px 0 0 0`},children:`精细化镜头复刻工具,拆分参考视频单镜头独立复刻,提升素材原创度,规避素材同质化`})]})}),(0,$.jsx)(X,{type:`primary`,ghost:!0,icon:(0,$.jsx)(AH,{}),onClick:()=>{c(!0),M(1,10,w)},style:{borderRadius:10,padding:`6px 16px`,fontSize:13,background:`rgba(99, 102, 241, 0.1)`,borderColor:`rgba(99, 102, 241, 0.2)`,color:`#6366f1`},children:`创作记录`})]}),(0,$.jsxs)(`div`,{style:{width:`100%`,maxWidth:720,margin:`0 auto`},children:[a&&(0,$.jsx)(`div`,{style:{background:`linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(239, 68, 68, 0.2)`,borderRadius:12,padding:`14px 20px`,marginBottom:24,color:`#ef4444`,fontSize:14,textAlign:`center`,fontWeight:500},children:a}),!t&&(0,$.jsxs)(`div`,{style:{background:`linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 100%)`,backdropFilter:`blur(20px)`,borderRadius:24,border:`1px solid rgba(99, 102, 241, 0.1)`,boxShadow:`0 8px 32px rgba(99, 102, 241, 0.08)`,position:`relative`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:-50,right:-50,width:200,height:200,background:`radial-gradient(circle, rgba(99,102,241,0.05) 0%, transparent 70%)`,borderRadius:`50%`}}),(0,$.jsx)(L0.Dragger,{accept:`video/*`,beforeUpload:k,showUploadList:!1,disabled:p,style:{background:p?`rgba(243, 244, 246, 0.3)`:`transparent`,border:`2px dashed ${p?`rgba(209, 213, 219, 0.5)`:`rgba(99, 102, 241, 0.3)`}`,borderRadius:24,padding:`56px 20px`,cursor:p?`not-allowed`:`pointer`,margin:0},children:p?(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`},children:[(0,$.jsx)(`div`,{style:{width:100,height:100,margin:`0 auto 20px`,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%)`,borderRadius:24,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`div`,{style:{width:40,height:40,border:`4px solid #6366f1`,borderTopColor:`transparent`,borderRadius:`50%`,animation:`spin 1s linear infinite`}})}),(0,$.jsx)(`p`,{style:{fontSize:16,color:`#6366f1`,margin:`0 0 8px 0`,fontWeight:600},children:`上传中...`}),(0,$.jsx)(`p`,{style:{fontSize:13,color:`#64748b`,margin:0},children:`请稍候,视频正在上传`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{width:100,height:100,margin:`0 auto 20px`,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%)`,borderRadius:24,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(V4,{style:{fontSize:40,color:`#6366f1`}})}),(0,$.jsx)(`p`,{style:{fontSize:16,color:`#1e293b`,margin:`0 0 8px 0`,fontWeight:600},children:`点击或拖拽到此上传视频文件`}),(0,$.jsx)(`p`,{style:{fontSize:13,color:`#64748b`,margin:0},children:`支持 MP4、MOV 格式视频,最大支持 100MB 的文件,支持上传 1 分钟内的视频`})]})})]}),t&&(0,$.jsxs)(`div`,{style:{background:`linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 100%)`,backdropFilter:`blur(20px)`,borderRadius:24,border:`1px solid rgba(99, 102, 241, 0.1)`,boxShadow:`0 8px 32px rgba(99, 102, 241, 0.08)`,overflow:`hidden`,position:`relative`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:-50,right:-50,width:200,height:200,background:`radial-gradient(circle, rgba(99,102,241,0.05) 0%, transparent 70%)`,borderRadius:`50%`}}),(0,$.jsxs)(`div`,{style:{borderRadius:22,background:`#ffffff`,padding:`24px`,position:`relative`,zIndex:1},children:[(0,$.jsx)(IK,{title:`确定要删除吗?`,okText:`确定`,cancelText:`取消`,onConfirm:O,children:(0,$.jsx)(`button`,{style:{position:`absolute`,top:20,right:20,width:36,height:36,border:`1px solid rgba(99, 102, 241, 0.2)`,background:`rgba(99, 102, 241, 0.05)`,borderRadius:10,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:16,color:`#6366f1`,zIndex:10,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(239, 68, 68, 0.1)`,e.currentTarget.style.borderColor=`rgba(239, 68, 68, 0.3)`,e.currentTarget.style.color=`#ef4444`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(99, 102, 241, 0.05)`,e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.2)`,e.currentTarget.style.color=`#6366f1`},children:`🗑️`})}),(0,$.jsx)(`div`,{style:{textAlign:`center`,marginBottom:20},children:(0,$.jsx)(`video`,{ref:E,src:`http://ceshi.apiforeign.minzhong.cn${t}`,controls:!0,onLoadedMetadata:A,style:{maxWidth:`100%`,maxHeight:320,borderRadius:12,background:`#000`,boxShadow:`0 4px 16px rgba(0,0,0,0.1)`}})}),(0,$.jsxs)(`div`,{style:{marginBottom:24},children:[(0,$.jsxs)(`label`,{style:{display:`block`,fontSize:14,fontWeight:500,color:`#334155`,marginBottom:8},children:[`产品名称 `,(0,$.jsx)(`span`,{style:{color:`#ef4444`},children:`*`})]}),(0,$.jsx)(eG,{placeholder:`请输入产品名称`,value:l,onChange:e=>u(e.target.value),style:{width:`100%`,height:44,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.2)`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.4)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.2)`}})]}),(0,$.jsx)(`div`,{style:{textAlign:`center`,marginTop:16},children:(0,$.jsx)(`button`,{onClick:j,disabled:!t||!l.trim()||p,style:{padding:`14px 56px`,background:t&&l.trim()&&!p?`linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%)`:`#e2e8f0`,color:`white`,border:`none`,borderRadius:12,fontSize:15,fontWeight:600,cursor:t&&l.trim()&&!p?`pointer`:`not-allowed`,boxShadow:t&&l.trim()&&!p?`0 6px 20px rgba(99, 102, 241, 0.3)`:`none`,display:`inline-flex`,alignItems:`center`,gap:10,transition:`all 0.3s ease`},onMouseEnter:e=>{t&&l.trim()&&!p&&(e.currentTarget.style.transform=`translateY(-2px)`,e.currentTarget.style.boxShadow=`0 8px 25px rgba(99, 102, 241, 0.4)`)},onMouseLeave:e=>{t&&l.trim()&&!p&&(e.currentTarget.style.transform=`translateY(0)`,e.currentTarget.style.boxShadow=`0 6px 20px rgba(99, 102, 241, 0.3)`)},children:(0,$.jsx)(`span`,{children:p?`创建中...`:`创建`})})})]})]}),(0,$.jsx)(`canvas`,{ref:D,style:{display:`none`}}),(0,$.jsxs)(MK,{title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:4,height:20,background:`linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%)`,borderRadius:2}}),(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`创作记录`})]}),open:s,onCancel:()=>c(!1),width:850,footer:null,style:{borderRadius:20},styles:{body:{height:580,display:`flex`,flexDirection:`column`,padding:0},header:{background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,borderBottom:`1px solid rgba(99, 102, 241, 0.08)`,padding:`16px 24px`}},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,margin:`16px 24px`,flexShrink:0},children:[(0,$.jsx)(eG,{placeholder:`搜索产品名称`,value:w,onChange:e=>T(e.target.value),onPressEnter:P,style:{width:220,borderRadius:10,marginRight:10,border:`1px solid rgba(99, 102, 241, 0.15)`,background:`rgba(255,255,255,0.8)`}}),(0,$.jsx)(X,{type:`primary`,onClick:P,style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`},children:`搜索`})]}),(0,$.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:`0 24px 24px`},children:(0,$.jsx)(`div`,{style:{background:`rgba(255,255,255,0.85)`,backdropFilter:`blur(10px)`,borderRadius:16,overflow:`hidden`,border:`1px solid rgba(99, 102, 241, 0.08)`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.06)`},children:(0,$.jsx)(t$,{columns:[{title:`产品名称`,dataIndex:`title`,key:`title`,render:e=>(0,$.jsx)(`span`,{style:{fontSize:14,color:`#1e293b`,fontWeight:500},children:e})},{title:`状态`,dataIndex:`status`,key:`status`,render:e=>Loe(e)},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,render:e=>{if(!e)return`-`;let t=new Date(e);return(0,$.jsx)(`span`,{style:{fontSize:13,color:`#64748b`},children:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`})}},{title:`操作`,key:`action`,align:`center`,render:t=>(0,$.jsxs)(TH,{children:[(0,$.jsx)(X,{type:`text`,onClick:()=>e(`/removelens/${t.id}/removeinfo`),style:{color:`#6366f1`,fontSize:13,padding:`4px 12px`,borderRadius:6,background:`rgba(99, 102, 241, 0.1)`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(99, 102, 241, 0.15)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(99, 102, 241, 0.1)`},children:`查看详情`}),(0,$.jsx)(IK,{title:`确认删除这个拆镜项目吗?`,onConfirm:async()=>{try{await Hie(t.id),Z.success(`删除成功`),M(_,y,w)}catch{Z.error(`删除失败`)}},children:(0,$.jsx)(X,{type:`text`,danger:!0,style:{color:`#ef4444`,fontSize:13,padding:`4px 12px`,borderRadius:6,background:`rgba(239, 68, 68, 0.1)`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(239, 68, 68, 0.15)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(239, 68, 68, 0.1)`},children:`删除`})})]})}],dataSource:h,rowKey:`id`,pagination:{current:_,pageSize:y,total:x,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`,onChange:N,style:{padding:`16px 24px`,borderTop:`1px solid rgba(99, 102, 241, 0.1)`}},style:{fontSize:13},scroll:{y:350},components:{body:{row:({className:e,style:t,...n})=>(0,$.jsx)(`tr`,{...n,className:e,style:{...t,transition:`all 0.2s ease`,borderBottom:`1px solid rgba(99, 102, 241, 0.05)`}}),cell:({className:e,style:t,...n})=>(0,$.jsx)(`td`,{...n,className:e,style:{...t,padding:`16px 24px`}})},header:{cell:({className:e,style:t,...n})=>(0,$.jsx)(`th`,{...n,className:e,style:{...t,background:`rgba(99, 102, 241, 0.03)`,color:`#64748b`,fontWeight:500,fontSize:13,padding:`16px 24px`,borderBottom:`none`}})}}})})})]})]})]})})}var zoe=c(o(((e,t)=>{(function(n){typeof e==`object`&&t!==void 0?t.exports=n():typeof define==`function`&&define.amd?define([],n):(typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this).JSZip=n()})(function(){return function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var c=typeof l==`function`&&l;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var u=Error(`Cannot find module '`+o+`'`);throw u.code=`MODULE_NOT_FOUND`,u}var d=n[o]={exports:{}};t[o][0].call(d.exports,function(e){var n=t[o][1][e];return i(n||e)},d,d.exports,e,t,n,r)}return n[o].exports}for(var a=typeof l==`function`&&l,o=0;o>2,s=(3&t)<<4|n>>4,c=1>6:64,l=2>4,n=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),f[u++]=t,s!==64&&(f[u++]=n),c!==64&&(f[u++]=r);return f}},{"./support":30,"./utils":32}],2:[function(e,t,n){var r=e(`./external`),i=e(`./stream/DataWorker`),a=e(`./stream/Crc32Probe`),o=e(`./stream/DataLengthProbe`);function s(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}s.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o(`data_length`)),t=this;return e.on(`end`,function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw Error(`Bug : uncompressed data size mismatch`)}),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo(`compressedSize`,this.compressedSize).withStreamInfo(`uncompressedSize`,this.uncompressedSize).withStreamInfo(`crc32`,this.crc32).withStreamInfo(`compression`,this.compression)}},s.createWorkerFrom=function(e,t,n){return e.pipe(new a).pipe(new o(`uncompressedSize`)).pipe(t.compressWorker(n)).pipe(new o(`compressedSize`)).withStreamInfo(`compression`,t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var r=e(`./stream/GenericWorker`);n.STORE={magic:`\0\0`,compressWorker:function(){return new r(`STORE compression`)},uncompressWorker:function(){return new r(`STORE decompression`)}},n.DEFLATE=e(`./flate`)},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var r=e(`./utils`),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return e!==void 0&&e.length?r.getTypeOf(e)===`string`?function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t[s])];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var r=null;r=typeof Promise<`u`?Promise:e(`lie`),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){var r=typeof Uint8Array<`u`&&typeof Uint16Array<`u`&&typeof Uint32Array<`u`,i=e(`pako`),a=e(`./utils`),o=e(`./stream/GenericWorker`),s=r?`uint8array`:`array`;function c(e,t){o.call(this,`FlateWorker/`+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic=`\b\0`,a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new c(`Deflate`,e)},n.uncompressWorker=function(){return new c(`Inflate`,{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function r(e,t){var n,r=``;for(n=0;n>>=8;return r}function i(e,t,n,i,o,u){var d,f,p=e.file,m=e.compression,h=u!==s.utf8encode,g=a.transformTo(`string`,u(p.name)),_=a.transformTo(`string`,s.utf8encode(p.name)),v=p.comment,y=a.transformTo(`string`,u(v)),b=a.transformTo(`string`,s.utf8encode(v)),x=_.length!==p.name.length,S=b.length!==v.length,C=``,w=``,T=``,E=p.dir,D=p.date,O={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(O.crc32=e.crc32,O.compressedSize=e.compressedSize,O.uncompressedSize=e.uncompressedSize);var k=0;t&&(k|=8),h||!x&&!S||(k|=2048);var A=0,j=0;E&&(A|=16),o===`UNIX`?(j=798,A|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,E)):(j=20,A|=function(e){return 63&(e||0)}(p.dosPermissions)),d=D.getUTCHours(),d<<=6,d|=D.getUTCMinutes(),d<<=5,d|=D.getUTCSeconds()/2,f=D.getUTCFullYear()-1980,f<<=4,f|=D.getUTCMonth()+1,f<<=5,f|=D.getUTCDate(),x&&(w=r(1,1)+r(c(g),4)+_,C+=`up`+r(w.length,2)+w),S&&(T=r(1,1)+r(c(y),4)+b,C+=`uc`+r(T.length,2)+T);var M=``;return M+=` -\0`,M+=r(k,2),M+=m.magic,M+=r(d,2),M+=r(f,2),M+=r(O.crc32,4),M+=r(O.compressedSize,4),M+=r(O.uncompressedSize,4),M+=r(g.length,2),M+=r(C.length,2),{fileRecord:l.LOCAL_FILE_HEADER+M+g+C,dirRecord:l.CENTRAL_FILE_HEADER+r(j,2)+M+r(y.length,2)+`\0\0\0\0`+r(A,4)+r(i,4)+g+C+y}}var a=e(`../utils`),o=e(`../stream/GenericWorker`),s=e(`../utf8`),c=e(`../crc32`),l=e(`../signature`);function u(e,t,n,r){o.call(this,`ZipFileWorker`),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo(`string`,this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e(`./Uint8ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e(`./DataReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e(`./ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array;var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e(`../utils`),i=e(`../support`),a=e(`./ArrayReader`),o=e(`./StringReader`),s=e(`./NodeBufferReader`),c=e(`./Uint8ArrayReader`);t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),t!==`string`||i.uint8array?t===`nodebuffer`?new s(e):i.uint8array?new c(r.transformTo(`uint8array`,e)):new a(r.transformTo(`array`,e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER=`PK`,n.CENTRAL_FILE_HEADER=`PK`,n.CENTRAL_DIRECTORY_END=`PK`,n.ZIP64_CENTRAL_DIRECTORY_LOCATOR=`PK\x07`,n.ZIP64_CENTRAL_DIRECTORY_END=`PK`,n.DATA_DESCRIPTOR=`PK\x07\b`},{}],24:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../utils`);function a(e){r.call(this,`ConvertWorker to `+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../crc32`);function a(){r.call(this,`Crc32Probe`),this.withStreamInfo(`crc32`,0)}e(`../utils`).inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataLengthProbe for `+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataWorker`);var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=``,this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case`string`:e=this.data.substring(this.index,t);break;case`uint8array`:e=this.data.subarray(this.index,t);break;case`array`:case`nodebuffer`:e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||`default`,this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit(`data`,e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(`end`),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(`error`,e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(`error`,e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n `+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e(`../utils`),i=e(`./ConvertWorker`),a=e(`./GenericWorker`),o=e(`../base64`),s=e(`../support`),c=e(`../external`),l=null;if(s.nodestream)try{l=e(`../nodejs/NodejsStreamOutputAdapter`)}catch{}function u(e,t){return new c.Promise(function(n,i){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on(`data`,function(e,n){a.push(e),t&&t(n)}).on(`error`,function(e){a=[],i(e)}).on(`end`,function(){try{n(function(e,t,n){switch(e){case`blob`:return r.newBlob(r.transformTo(`arraybuffer`,t),n);case`base64`:return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var n,r=0,i=null,a=0;for(n=0;n`u`)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:`application/zip`}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=i.getBlob(`application/zip`).size===0}catch{n.blob=!1}}}try{n.nodestream=!!e(`readable-stream`).Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e(`./utils`),i=e(`./support`),a=e(`./nodejsUtils`),o=e(`./stream/GenericWorker`),s=Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;s[254]=s[254]=1;function l(){o.call(this,`utf-8 decode`),this.leftOver=null}function u(){o.call(this,`utf-8 encode`)}n.utf8encode=function(e){return i.nodebuffer?a.newBufferFrom(e,`utf-8`):function(e){var t,n,r,a,o,s=e.length,c=0;for(a=0;a>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo(`nodebuffer`,e).toString(`utf-8`):function(e){var t,n,i,a,o=e.length,c=Array(2*o);for(t=n=0;t>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(e=r.transformTo(i.uint8array?`uint8array`:`array`,e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?`uint8array`:`array`,e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+s[e[n]]>t?n:t}(t),c=t;o!==t.length&&(i.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e(`./support`),i=e(`./base64`),a=e(`./nodejsUtils`),o=e(`./external`);function s(e){return e}function c(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),e==0&&(this.dosPermissions=63&this.externalFileAttributes),e==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!==`/`||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||={};e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,l[r++]=56320|1023&i)}return c(l,r)},n.utf8border=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;n!==0;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e(`../utils/common`),a=e(`./trees`),o=e(`./adler32`),s=e(`./crc32`),c=e(`./messages`),l=0,u=4,d=0,f=-2,p=-1,m=4,h=2,g=8,_=9,v=286,y=30,b=19,x=2*v+1,S=15,C=3,w=258,T=w+C+1,E=42,D=113,O=1,k=2,A=3,j=4;function M(e,t){return e.msg=c[t],t}function N(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),n!==0&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))}function I(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function R(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function z(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+w,p=l[a+o-1],m=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(l[(n=t)+o]===m&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do;while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ac&&--i!=0);return o<=e.lookahead?o:e.lookahead}function B(e){var t,n,r,a,c,l,u,d,f,p,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-T)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);a+=m}if(e.strm.avail_in===0)break;if(l=e.strm,u=e.window,d=e.strstart+e.lookahead,f=a,p=void 0,p=l.avail_in,f=C)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-C),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=C){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-C,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-C),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(B(e),e.lookahead===0&&t===l)return O;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,I(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-T&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):(e.strstart>e.block_start&&(I(e,!1),e.strm.avail_out),O)}),new U(4,4,8,4,V),new U(4,5,16,8,V),new U(4,6,32,32,V),new U(4,4,16,16,H),new U(8,16,32,32,H),new U(8,16,128,128,H),new U(8,32,128,256,H),new U(32,128,258,1024,H),new U(32,258,258,4096,H)],n.deflateInit=function(e,t){return te(e,t,g,15,8,0)},n.deflateInit2=te,n.deflateReset=ee,n.deflateResetKeep=G,n.deflateSetHeader=function(e,t){return e&&e.state&&e.state.wrap===2?(e.state.gzhead=t,d):f},n.deflate=function(e,t){var n,i,o,c;if(!e||!e.state||5>8&255),L(i,i.gzhead.time>>16&255),L(i,i.gzhead.time>>24&255),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(L(i,255&i.gzhead.extra.length),L(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(L(i,0),L(i,0),L(i,0),L(i,0),L(i,0),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,3),i.status=D);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:i.level===6?2:3)<<6,i.strstart!==0&&(p|=32),p+=31-p%31,i.status=D,R(i,p),i.strstart!==0&&(R(i,e.adler>>>16),R(i,65535&e.adler)),e.adler=1}if(i.status===69)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending!==i.pending_buf_size));)L(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(i.status===73)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.gzindex=0,i.status=91)}else i.status=91;if(i.status===91)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.status=103)}else i.status=103;if(i.status===103&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&F(e),i.pending+2<=i.pending_buf_size&&(L(i,255&e.adler),L(i,e.adler>>8&255),e.adler=0,i.status=D)):i.status=D),i.pending!==0){if(F(e),e.avail_out===0)return i.last_flush=-1,d}else if(e.avail_in===0&&N(t)<=N(n)&&t!==u)return M(e,-5);if(i.status===666&&e.avail_in!==0)return M(e,-5);if(e.avail_in!==0||i.lookahead!==0||t!==l&&i.status!==666){var m=i.strategy===2?function(e,t){for(var n;;){if(e.lookahead===0&&(B(e),e.lookahead===0)){if(t===l)return O;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):i.strategy===3?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===l)return O;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=C&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=C?(n=a._tr_tally(e,1,e.match_length-C),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):r[i.level].func(i,t);if(m!==A&&m!==j||(i.status=666),m===O||m===A)return e.avail_out===0&&(i.last_flush=-1),d;if(m===k&&(t===1?a._tr_align(i):t!==5&&(a._tr_stored_block(i,0,0,!1),t===3&&(P(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),F(e),e.avail_out===0))return i.last_flush=-1,d}return t===u?i.wrap<=0?1:(i.wrap===2?(L(i,255&e.adler),L(i,e.adler>>8&255),L(i,e.adler>>16&255),L(i,e.adler>>24&255),L(i,255&e.total_in),L(i,e.total_in>>8&255),L(i,e.total_in>>16&255),L(i,e.total_in>>24&255)):(R(i,e.adler>>>16),R(i,65535&e.adler)),F(e),0=n.w_size&&(s===0&&(P(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,m-n.w_size,n.w_size,0),t=p,m=n.w_size),c=e.avail_in,l=e.next_in,u=e.input,e.avail_in=m,e.next_in=0,e.input=t,B(n);n.lookahead>=C;){for(r=n.strstart,a=n.lookahead-(C-1);n.ins_h=(n.ins_h<>>=b=y>>>24,m-=b,(b=y>>>16&255)==0)E[a++]=65535&y;else{if(!(16&b)){if(!(64&b)){y=h[(65535&y)+(p&(1<>>=b,m-=b),m<15&&(p+=T[r++]<>>=b=y>>>24,m-=b,!(16&(b=y>>>16&255))){if(!(64&b)){y=g[(65535&y)+(p&(1<>>=b,m-=b,(b=a-o)>3,p&=(1<<(m-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=1&t.wrap),t.mode=f,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(m),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):d}function y(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,B,2,0),x=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg=`incorrect header check`,n.mode=30;break}if((15&b)!=8){e.msg=`unknown compression method`,n.mode=30;break}if(x-=4,F=8+(15&(b>>>=4)),n.wbits===0)n.wbits=F;else if(F>n.wbits){e.msg=`invalid window size`,n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=3;case 3:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>8&255,B[2]=b>>>16&255,B[3]=b>>>24&255,n.check=a(n.check,B,4,0)),x=b=0,n.mode=4;case 4:for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>8),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=5;case 5:if(1024&n.flags){for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>>8&255,n.check=a(n.check,B,2,0)),x=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(E=n.length)&&(E=v),E&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,E,F)),512&n.flags&&(n.check=a(n.check,p,E,g)),v-=E,g+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(v===0)break e;for(E=0;F=p[g+ E++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F)),F&&E>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>=7&x,x-=7&x,n.mode=27;break}for(;x<3;){if(v===0)break e;v--,b+=p[g++]<>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,t!==6)break;b>>>=2,x-=2;break e;case 2:n.mode=17;break;case 3:e.msg=`invalid block type`,n.mode=30}b>>>=2,x-=2;break;case 14:for(b>>>=7&x,x-=7&x;x<32;){if(v===0)break e;v--,b+=p[g++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=30;break}if(n.length=65535&b,x=b=0,n.mode=15,t===6)break e;case 15:n.mode=16;case 16:if(E=n.length){if(v>>=5,x-=5,n.ndist=1+(31&b),b>>>=5,x-=5,n.ncode=4+(15&b),b>>>=4,x-=4,286>>=3,x-=3}for(;n.have<19;)n.lens[V[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},I=s(0,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid code lengths set`,n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=k,x-=k,n.lens[n.have++]=j;else{if(j===16){for(R=k+2;x>>=k,x-=k,n.have===0){e.msg=`invalid bit length repeat`,n.mode=30;break}F=n.lens[n.have-1],E=3+(3&b),b>>>=2,x-=2}else if(j===17){for(R=k+3;x>>=k)),b>>>=3,x-=3}else{for(R=k+7;x>>=k)),b>>>=7,x-=7}if(n.have+E>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=30;break}for(;E--;)n.lens[n.have++]=F}}if(n.mode===30)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=30;break}if(n.lenbits=9,L={bits:n.lenbits},I=s(c,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid literal/lengths set`,n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},I=s(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,I){e.msg=`invalid distances set`,n.mode=30;break}if(n.mode=20,t===6)break e;case 20:n.mode=21;case 21:if(6<=v&&258<=y){e.next_out=_,e.avail_out=y,e.next_in=g,e.avail_in=v,n.hold=b,n.bits=x,o(e,C),_=e.next_out,m=e.output,y=e.avail_out,g=e.next_in,p=e.input,v=e.avail_in,b=n.hold,x=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;A=(z=n.lencode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,n.length=j,A===0){n.mode=26;break}if(32&A){n.back=-1,n.mode=12;break}if(64&A){e.msg=`invalid literal/length code`,n.mode=30;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(z=n.distcode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,64&A){e.msg=`invalid distance code`,n.mode=30;break}n.offset=j,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=30;break}n.mode=25;case 25:if(y===0)break e;if(E=C-y,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break}D=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),O=n.window}else O=m,D=_-n.offset,E=n.length;for(yv?(b=L[R+d[w]],N[P+d[w]]):(b=96,0),p=1<>k)+(m-=p)]=y<<24|b<<16|x|0,m!==0;);for(p=1<>=1;if(p===0?M=0:(M&=p-1,M+=p),w++,--F[C]==0){if(C===E)break;C=t[n+d[w]]}if(D>>7)]}function L(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function R(e,t,n){e.bi_valid>h-n?(e.bi_buf|=t<>h-e.bi_valid,e.bi_valid+=n-h):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function V(e,t,n){var r,i,a=Array(m+1),o=0;for(r=1;r<=m;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];s!==0&&(e[2*i]=B(a[s]++,s))}}function H(e){var t;for(t=0;t>1;1<=n;n--)G(e,a,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,G(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,g=t.stat_desc.max_length,_=0;for(a=0;a<=m;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&e.dyn_ltree[2*t]!==0)return i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&t!==-1?ie(e,t,n,r):e.strategy===4||s===o?(R(e,2+ +!!r,3),ee(e,T,E)):(R(e,4+ +!!r,3),function(e,t,n,r){var i;for(R(e,t-257,5),R(e,n-1,5),R(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,t===0?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(O[n]+l+1)]++,e.dyn_dtree[2*I(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){R(e,2,3),z(e,_,T),function(e){e.bi_valid===16?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){(function(e,t){if(!e.setImmediate){var n,r,i,a,o=1,s={},c=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n={}.toString.call(e.process)===`[object process]`?function(e){process.nextTick(function(){f(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}()?(a=`setImmediate$`+Math.random()+`$`,e.addEventListener?e.addEventListener(`message`,p,!1):e.attachEvent(`onmessage`,p),function(t){e.postMessage(a+t,`*`)}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){f(e.data)},function(e){i.port2.postMessage(e)}):l&&`onreadystatechange`in l.createElement(`script`)?(r=l.documentElement,function(e){var t=l.createElement(`script`);t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(f,0,e)},u.setImmediate=function(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),r=0;r`u`?e===void 0?this:e:self)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{}]},{},[10])(10)})}))(),1),{Text:Boe}=Q,M9=e=>e?/^(https?:|data:|blob:)/i.test(e)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,Voe=e=>e===`video`?(0,$.jsx)(_5,{}):e===`audio`?(0,$.jsx)(q2,{}):(0,$.jsx)($6,{}),Hoe=e=>e===`video`?`视频`:e===`audio`?`音频`:`图片`,N9=e=>{let t=Number(e||0);return t>=1024*1024?`${(t/1024/1024).toFixed(1)} MB`:t>=1024?`${(t/1024).toFixed(1)} KB`:`${t} B`},Uoe=()=>{let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(1),[o,s]=(0,S.useState)(10),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)([]),[f,p]=(0,S.useState)(0),[m,h]=(0,S.useState)(new Set),[g,_]=(0,S.useState)(null),v=(0,S.useMemo)(()=>u.flatMap(e=>e.items||[]),[u]),y=(0,S.useCallback)(async()=>{l(!0);try{let t=await nae({resourceType:e||void 0,keyword:n||void 0,page:i,pageSize:o,scene:`record`});d(t.groups||[]),p(t.totalDays||0),h(new Set)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),d([]),p(0)}finally{l(!1)}},[n,i,o,e]);(0,S.useEffect)(()=>{y()},[y]);let b=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},x=()=>{let e=v.map(e=>e.id);h(t=>t.size===e.length?new Set:new Set(e))},C=async t=>{let r=(t.page||1)+1;try{let i=await T7(t.generatedDate,{resourceType:e||void 0,keyword:n||void 0,page:r,pageSize:10,scene:`record`});d(e=>e.map(e=>e.generatedDate===t.generatedDate?{...e,page:r,items:[...e.items,...i.items||[]]}:e))}catch(e){Z.error(e?.message||`加载更多失败`)}},w=e=>{MK.confirm({title:`确认删除历史上传素材`,content:`确定删除 ${e.fileName||e.id} 吗?删除后会释放上传容量,并在提交成功后清理真实文件。`,okText:`删除`,okButtonProps:{danger:!0},cancelText:`取消`,onOk:async()=>{try{await W5(e.resourceUrl),Z.success(`删除成功`),y()}catch(e){Z.error(e?.message||`删除失败`)}}})},T=()=>{if(m.size===0){Z.warning(`请先选择要删除的上传素材`);return}if(m.size>30){Z.warning(`一次最多删除 30 条上传素材`);return}let e=Array.from(m);MK.confirm({title:`确认批量删除历史上传素材`,content:`确定删除选中的 ${e.length} 条上传素材吗?删除后会释放上传容量,并在提交成功后清理真实文件。`,okText:`删除`,okButtonProps:{danger:!0},cancelText:`取消`,onOk:async()=>{try{let t=await rae(e);Z.success(`删除成功,释放 ${N9(t?.releasedSizeBytes||0)}`),y()}catch(e){Z.error(e?.message||`批量删除失败`)}}})},E=e=>{let t=document.createElement(`a`);t.href=M9(e.resourceUrl),t.download=e.fileName||e.id,document.body.appendChild(t),t.click(),document.body.removeChild(t)},D=(e,t=`card`)=>{let n=M9(e.previewUrl||e.displayUrl||e.resourceUrl),r=t===`card`?{width:`100%`,height:130,objectFit:`cover`}:{width:`100%`,maxHeight:620,objectFit:`contain`};return e.resourceType===`image`?(0,$.jsx)(`img`,{src:n,alt:e.fileName||e.id,style:r}):e.resourceType===`video`?(0,$.jsx)(`video`,{src:n,controls:t===`preview`,muted:t===`card`,style:r}):(0,$.jsx)(`audio`,{src:n,controls:!0,style:{width:`100%`}})};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:12,alignItems:`center`,marginBottom:16,flexWrap:`wrap`},children:[(0,$.jsxs)(TH,{wrap:!0,children:[(0,$.jsx)(MC,{value:e,style:{width:120},options:[{label:`全部`,value:``},{label:`图片`,value:`image`},{label:`视频`,value:`video`},{label:`音频`,value:`audio`}],onChange:e=>{t(e),a(1)}}),(0,$.jsx)(eG,{allowClear:!0,value:n,prefix:(0,$.jsx)(DC,{}),placeholder:`搜索文件名或URL`,style:{width:240},onChange:e=>r(e.target.value),onPressEnter:()=>{a(1),y()}}),(0,$.jsx)(X,{icon:(0,$.jsx)(Hq,{}),onClick:y,children:`刷新`})]}),(0,$.jsxs)(TH,{children:[(0,$.jsx)(X,{onClick:x,children:m.size&&m.size===v.length?`取消全选`:`全选`}),(0,$.jsxs)(X,{danger:!0,icon:(0,$.jsx)(O$,{}),onClick:T,children:[`批量删除 (`,m.size,`)`]})]})]}),(0,$.jsx)(sK,{spinning:c,children:u.length===0?(0,$.jsx)(nC,{description:`暂无可展示的历史上传素材`,style:{padding:`60px 0`}}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:28},children:u.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(`div`,{style:{fontSize:18,fontWeight:700,color:`#1e293b`},children:e.generatedDate}),(0,$.jsxs)(Boe,{type:`secondary`,children:[`共 `,e.total,` 个素材`]})]}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,justifyContent:`flex-start`},children:e.items.map(e=>{let t=m.has(e.id);return(0,$.jsxs)(`div`,{style:{width:`17%`,minWidth:240,margin:16,border:t?`2px solid #8b5cf6`:`1px solid #e2e8f0`,borderRadius:16,overflow:`hidden`,background:`#fff`,boxShadow:`0 10px 24px rgba(15,23,42,0.06)`},children:[(0,$.jsxs)(`div`,{style:{position:`relative`,background:`#f1f5f9`},children:[D(e),(0,$.jsx)(az,{checked:t,onChange:()=>b(e.id),style:{position:`absolute`,top:10,left:10,background:`#fff`,borderRadius:6,padding:4}}),(0,$.jsx)(m$,{color:`purple`,icon:Voe(e.resourceType),style:{position:`absolute`,top:10,right:10,margin:0},children:Hoe(e.resourceType)})]}),(0,$.jsxs)(`div`,{style:{padding:12,paddingTop:0},children:[(0,$.jsxs)(TH,{size:4,wrap:!0,style:{marginTop:8},children:[(0,$.jsx)(m$,{style:{margin:0},children:e.moduleLabel}),(0,$.jsx)(m$,{style:{margin:0},children:N9(e.fileSizeBytes)}),e.durationSeconds?(0,$.jsxs)(m$,{style:{margin:0},children:[Number(e.durationSeconds).toFixed(1),`s`]}):null]}),(0,$.jsxs)(TH,{style:{marginTop:12},children:[(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(MW,{}),onClick:()=>_(e),children:`预览`}),(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(j0,{}),onClick:()=>E(e),children:`下载`}),(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(O$,{}),onClick:()=>w(e),children:`删除`})]})]})]},e.id)})}),e.items.lengthC(e),children:`加载更多`})})]},e.generatedDate))})}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:24},children:(0,$.jsx)(BG,{current:i,pageSize:o,total:f,showSizeChanger:!0,pageSizeOptions:[5,10],onChange:(e,t)=>{a(e),s(t)}})}),(0,$.jsx)(MK,{open:!!g,title:`预览`,footer:null,width:900,centered:!0,destroyOnHidden:!0,onCancel:()=>_(null),children:g?D(g,`preview`):null})]})},{Search:Woe}=eG,{Text:Goe}=Q,Koe=e=>{let t=S.useRef(!1);(0,S.useEffect)(()=>{if(t.current)return;let n=()=>{t.current||(t.current=!0,e?.())};return document.readyState===`complete`?n():window.addEventListener(`load`,n),()=>{window.removeEventListener(`load`,n)}},[e])},qoe=()=>{let[e,t]=(0,S.useState)(!1);Koe(()=>{t(!0)});let[n]=On(),[r,i]=(0,S.useState)(n.get(`filterType`)===`private_portrait`?`private_portrait`:n.get(`filterType`)===`upload_resource`?`upload_resource`:`project`),[a,o]=(0,S.useState)(`video`),[s,c]=(0,S.useState)([]),[l,u]=(0,S.useState)({page:1,pageSize:10}),[d,f]=(0,S.useState)(0),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(new Set),[_,v]=(0,S.useState)(!1),[y,b]=(0,S.useState)(null),x=S.createRef(),[C,w]=(0,S.useState)(``),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)([[]]),[j,M]=(0,S.useState)([``]),[N,P]=(0,S.useState)([]),[F,I]=(0,S.useState)(!1),[L,R]=(0,S.useState)(0),[z,B]=(0,S.useState)([void 0]),[V,H]=(0,S.useState)(new Map),[U,W]=(0,S.useState)(``),[G,ee]=(0,S.useState)(new Map),te=(0,S.useRef)(new Map);(0,S.useEffect)(()=>()=>{te.current.forEach(e=>clearTimeout(e)),te.current.clear()},[]);let[ne,K]=(0,S.useState)(1),[re,ie]=(0,S.useState)(10),[ae,q]=(0,S.useState)([!1]),[oe,se]=(0,S.useState)(`new`),[ce,le]=(0,S.useState)([]),[ue,de]=(0,S.useState)(!1),[fe,pe]=(0,S.useState)([]),[me,he]=(0,S.useState)({}),[ge,_e]=(0,S.useState)(`2`),[ve,ye]=(0,S.useState)(``),[be,xe]=(0,S.useState)([]),[Se,Ce]=(0,S.useState)(!1),[we,Te]=(0,S.useState)(!1),[Ee,De]=(0,S.useState)([]),[Oe,ke]=(0,S.useState)(0),[Ae,je]=(0,S.useState)(1),[Me,Ne]=(0,S.useState)(10),[Pe,Fe]=(0,S.useState)(!1),[Ie,Le]=(0,S.useState)(``),[Re,ze]=(0,S.useState)(!1),[Be,Ve]=(0,S.useState)(new Set),He=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}}},Ue=e=>{let t=He(e);return t?Math.floor(Date.now()/1e3)>t:!1},We=(e,t=!1)=>{let n=`http://ceshi.apiforeign.minzhong.cn`,r=e.startsWith(`/`)?e.slice(1):e,i=n.endsWith(`/`)?n.slice(0,-1):n;return t?`${i}/static/${r}&w=300&q=50`:`${i}/${r}`},Ge=e=>{b(e),v(!0),window.dispatchEvent(new Event(`previewOpen`))},Ke=()=>{x.current&&(x.current.pause(),x.current.currentTime=0),document.querySelectorAll(`video`).forEach(e=>{e.pause(),e.currentTime=0}),v(!1)},qe=e=>e.generatedResourceId||e.id,Je=e=>!!e.generatedResourceId,Ye=e=>{if(!e)return!0;let t=e.match(/^(\d+)x(\d+)$/);if(!t)return!0;let n=parseInt(t[1],10),r=parseInt(t[2],10),i=n/r;return n>=r?n>=480&&n<=2560&&r>=270&&r<=1440&&i>=1.775&&i<=1.784:n>=270&&n<=1440&&r>=480&&r<=2560&&i>=.555&&i<=.564},Xe=e=>{Ve(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ze=()=>{let e=s.flatMap(e=>e.items.map(e=>qe(e)));Be.size===e.length?Ve(new Set):Ve(new Set(e))},Qe=async()=>{if(Be.size===0){Z.warning(`请先选择要下载的媒体`);return}if(Be.size>30){Z.warning(`最多只能单次下载30个文件`);return}let e=[];s.forEach(t=>{t.items.forEach(t=>{Be.has(qe(t))&&e.push(t)})});let t=new zoe.default,n=`http://ceshi.apiforeign.minzhong.cn`,r=t.folder(`downloads`),i=!1,a=0;Z.loading({content:`下载中,请稍候...`,key:`downloadProgress`});for(let t of e){let e=`${n}${t.videoUrl||t.imageUrl}`,o=((t.videoUrl||t.imageUrl).split(`/`).pop()||`file_${Date.now()}`).split(`?`)[0];try{let t=await fetch(e);if(!t.ok)throw Error(`Network response was not ok`);let n=await t.blob();r?.file(o,n),a++}catch{console.warn(`文件下载失败(CORS限制): ${o},将使用备用方式下载`),i=!0;break}}if(i){Z.destroy(`downloadProgress`),Z.info(`由于跨域限制,将逐个下载文件`),e.forEach((e,t)=>{setTimeout(()=>{let t=`${n}${e.videoUrl||e.imageUrl}&download=1`,r=document.createElement(`a`);r.href=t,r.download=``,document.body.appendChild(r),r.click(),document.body.removeChild(r)},t*500)});return}let o=await t.generateAsync({type:`blob`}),c=document.createElement(`a`);c.href=URL.createObjectURL(o),c.download=`downloads_${Date.now()}.zip`,c.click(),URL.revokeObjectURL(c.href),Z.destroy(`downloadProgress`),Z.success(`下载完成,共 ${a} 个文件`),ze(!1),Ve(new Set)},$e=async()=>{if(Be.size===0){Z.warning(`请先选择要删除的媒体`);return}if(Be.size>30){Z.warning(`最多只能单次删除30个文件`);return}let e=s.flatMap(e=>e.items.filter(e=>Be.has(qe(e)))),t=``;t=r===`shot_replicate`?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{marginBottom:8},children:`以下内容所连带的图片和视频都将被删除:`}),(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:20},children:e.map((e,t)=>(0,$.jsxs)(`li`,{style:{marginBottom:4,color:`#334155`},children:[e.shotReplicateProjectTitle,`— —`,e.shotSegmentLabel]},t))}),(0,$.jsx)(`div`,{style:{marginTop:12},children:`确定删除吗?`})]}):r===`hot_opening_replicate`?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{marginBottom:8},children:`爆款开头复刻中以下内容所连带的图片和视频都将被删除:`}),(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:20},children:e.map((e,t)=>(0,$.jsx)(`li`,{style:{marginBottom:4,color:`#334155`},children:e.moduleProjectTitle},t))}),(0,$.jsx)(`div`,{style:{marginTop:12},children:`确定删除吗?`})]}):`确定删除选中的 ${Be.size} 条记录吗?`,MK.confirm({title:`确认删除`,content:t,okText:`确定删除`,cancelText:`取消`,okButtonProps:{danger:!0},onOk:async()=>{let e=``;r===`project`?e=`generation_record`:r===`creation`?e=`chat_task`:r===`hot_opening_replicate`?e=`hot_opening_replicate`:r===`shot_replicate`&&(e=`shot_replicate`);let t=[];s.forEach(e=>{e.items.forEach(e=>{Be.has(qe(e))&&t.push(e)})});let n=[];e===`generation_record`||e===`chat_task`?n=t.map(e=>e.id):e===`hot_opening_replicate`?n=t.map(e=>e.moduleProjectId):e===`shot_replicate`&&(n=t.map(e=>e.shotSegmentId));let i={history_source:e,ids:n};try{await C7(i),Z.success(`删除成功`),ze(!1),Ve(new Set),u(e=>({...e,page:1})),mt()}catch{Z.error(`删除失败,请重试`)}}})},et=async()=>{Ce(!0);try{let e=await l7({page:1,pageSize:100});xe(e.data?.data||e.data||[])}catch(e){console.error(`加载前测模板失败:`,e)}finally{Ce(!1)}},tt=()=>{if(Be.size===0){Z.warning(`请先选择要推送的媒体`);return}A([[]]),M([``]),B([void 0]),_e(`2`),ye(``),et(),O(!0)},nt=()=>{if(!y)return;let e=qe(y);Ve(new Set([e])),A([[]]),M([``]),B([void 0]),H(new Map),W(``),_e(`2`),ye(``),et(),O(!0)},rt=async(e,t)=>{I(!0);try{let n=await c7({page:e,page_size:t});P(n?.data||n||[]),R(n.pagination.total||0)}catch(e){console.error(`加载授权列表失败:`,e),P([]),R(0)}finally{I(!1)}},it=async()=>{de(!0);try{let[e,t]=await Promise.all([$ie(),x7()]);le(e?.data||[]);let n=t?.data||[],r={};n.forEach(e=>{r[e.openType]=e.typeName}),he(r)}catch(e){console.error(`加载历史授权账户列表失败:`,e),le([]),he({})}finally{de(!1)}},at=async()=>{Fe(!0);try{let e=await Gie({status:Ie||void 0,page:Ae,pageSize:Me});De(e?.data||e||[]),ke(e.pagination?.total||e.total||0)}catch(e){console.error(`加载推送历史失败:`,e),De([]),ke(0)}finally{Fe(!1)}},ot=()=>{Te(!0),je(1),Le(``),at()},st=()=>{je(1),at()},ct=(e,t)=>{je(e),Ne(t),at()},lt=async()=>{if(Be.size===0){Z.warning(`请先选择要推送的媒体`);return}let e=new Map;s.forEach(t=>{t.items.forEach(t=>{let n=qe(t);e.set(n,t)})});let t=[];if(oe===`new`){let n=z.filter(e=>e!==void 0);if(n.length===0){Z.warning(`请先选择授权账户`);return}for(let r=0;re.accountId)||[];if(a.length===0){Z.warning(`第 ${r+1} 组授权账户未设置账户ID,已跳过`);continue}let o=new Map;for(let t of Be){let n=e.get(t),r;n&&Je(n)&&(r=`generated_resources`),o.has(r)||o.set(r,[]),o.get(r).push(t)}o.forEach((e,n)=>{t.push({advertiser_ids:a,resource_ids:e,oauth_id:i.value,source_model:n,is_pre_test:ge,pre_test_template:ve})})}}else{if(fe.length===0){Z.warning(`请先选择历史账户`);return}for(let n of fe){let i=new Map;for(let t of Be){let n=e.get(t),a;a=n&&Je(n)?`generated_resources`:r===`project`?`generation_records`:`chat_generation_tasks`,i.has(a)||i.set(a,[]),i.get(a).push(t)}i.forEach((e,r)=>{t.push({advertiser_ids:[n.advertiserId],resource_ids:e,oauth_id:String(n.oauthId),source_model:r,is_pre_test:ge,pre_test_template:ve})})}}E(!0);try{let e=await Wie({tasks:t});e.errors?.length>0?Z.warning(e.message):e.code===0?Z.success(e.message):Z.error(e.message),ze(!1),Ve(new Set),O(!1),A([[]]),M([``]),B([void 0]),pe([]),H(new Map),W(``),_e(`2`),ye(``)}catch(e){console.error(`批量推送失败:`,e),Z.error(e.message||`批量推送失败`)}finally{E(!1)}},ut=async(e,t)=>{if(t.trim())try{let n=(await y7({filenames:[{source_id:e,file_name:t}]}))?.results?.find(t=>t.source_id===e)?.new_file_name||t;c(t=>t.map(t=>({...t,items:t.items.map(t=>qe(t)===e?{...t,fileName:n}:t)}))),Z.success(`文件名更新成功`)}catch(e){console.error(`文件名更新失败:`,e),Z.error(e.message||`文件名更新失败`)}},dt=async(e,t)=>{if(!(!t.trim()||e.length===0))try{let n=await y7({filenames:e.map(e=>({source_id:e,file_name:t}))}),r=new Map;n?.results?.forEach(e=>{e.success&&e.newFileName&&r.set(e.sourceId,e.newFileName)}),c(n=>{let i=new Set(e);return n.map(e=>({...e,items:e.items.map(e=>{let n=qe(e);if(i.has(n)){let i=r.get(n)||t;return{...e,fileName:i}}return e})}))}),console.log(n);let i=n?.successCount||0;Z.success(`已更新 ${i} 个文件名`)}catch(e){console.error(`文件名更新失败:`,e),Z.error(e.message||`文件名更新失败`)}},ft=e=>{w(e)},pt=e=>new Promise(t=>{let n=document.createElement(`video`),r=`http://ceshi.apiforeign.minzhong.cn`,i=e.startsWith(`/`)?e.slice(1):e;n.src=`${r.endsWith(`/`)?r.slice(0,-1):r}/${i}`,n.crossOrigin=`anonymous`,n.onloadedmetadata=()=>{let e=n.videoWidth,r=n.videoHeight;n.remove(),t(`${e}x${r}`)},n.onerror=()=>{n.remove(),t(``)},n.onabort=()=>{n.remove(),t(``)},setTimeout(()=>{n.remove(),t(``)},5e3)}),mt=()=>{if(r===`private_portrait`||r===`upload_resource`){m(!1),c([]);return}m(!0);let t=``;r===`project`?t=`generation_record`:r===`hot_opening_replicate`?t=`hot_opening_replicate`:r===`shot_replicate`&&(t=`shot_replicate`);let n=`?gen_type=${a}&page=${l.page}&page_size=${l.pageSize}`;if(t&&(n=`?gen_type=${a}&history_source=${t}&page=${l.page}&page_size=${l.pageSize}`),C){let n=`${C}?gen_type=${a}&page=${l.page}&page_size=${l.pageSize}`;t&&(n=`${C}?gen_type=${a}&history_source=${t}&page=${l.page}&page_size=${l.pageSize}`),n7(n).then(t=>{let n=Array.isArray(t)?t:t?.items||[],r=[{generatedDate:t.generatedDate,items:n,total:t.total,page:t.page}];r&&r[0].items.length>0?c(r):c([]),e&&n.forEach(async e=>{if(e.videoUrl&&e.videoUrl.trim()){let t=await pt(e.videoUrl);t&&c(n=>n.map(n=>({...n,items:n.items.map(n=>n.id===e.id?{...n,imagePx:t}:n)})))}})}).catch(e=>{}).finally(()=>{m(!1)})}else yie(n).then(t=>{let n=Array.isArray(t)?t:t?.groups||[];n.forEach(e=>{e.page=1}),l.page===1?c(n):c(e=>[...e,...n]),f(t?.totalDays||0),e&&n.forEach(e=>{e.items.forEach(async e=>{if(e.videoUrl&&e.videoUrl.trim()){let t=await pt(e.videoUrl);t&&c(n=>n.map(n=>({...n,items:n.items.map(n=>n.id===e.id?{...n,imagePx:t}:n)})))}})})}).catch(e=>{l.page===1&&c([])}).finally(()=>{m(!1)})};(0,S.useEffect)(()=>{mt()},[r,a,l.page,C]);let ht=()=>{p||u(e=>({...e,page:e.page+1}))},gt=async(e,t,n)=>{if(h.has(t))return;g(e=>new Set([...e,t]));let i=n+1,o=``;r===`project`?o=`generation_record`:r===`hot_opening_replicate`?o=`hot_opening_replicate`:r===`shot_replicate`&&(o=`shot_replicate`);let s=`${e}?gen_type=${a}&page=${i}&page_size=${l.pageSize}`;o&&(s=`${e}?gen_type=${a}&history_source=${o}&page=${i}&page_size=${l.pageSize}`);try{let t=(await n7(s)).items||[];t&&t.length>0&&c(n=>n.map(n=>n.generatedDate===e?{...n,items:[...n.items,...t],page:i}:n))}catch{}finally{g(e=>{let n=new Set(e);return n.delete(t),n})}};return(0,S.useEffect)(()=>{u(e=>({...e,page:1}))},[r,a]),(0,$.jsxs)(`div`,{className:`content_box`,children:[(0,$.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:12,marginBottom:16,padding:`12px 16px`,borderRadius:12,background:`#fff`,border:`1px solid #f0f0f5`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexWrap:`wrap`},children:[(0,$.jsx)(b3,{style:{color:`#090a0cff`,fontSize:14}}),(0,$.jsxs)(TH,{size:8,wrap:!0,children:[(0,$.jsx)(X,{type:r===`project`?`primary`:`default`,onClick:()=>{i(`project`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`project`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`project`?`none`:`1px solid #e2e8f0`,color:r===`project`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(uZ,{}),children:`项目记录`}),(0,$.jsx)(X,{type:r===`creation`?`primary`:`default`,onClick:()=>{i(`creation`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`creation`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`creation`?`none`:`1px solid #e2e8f0`,color:r===`creation`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(AH,{}),children:`创作记录`}),(0,$.jsx)(X,{type:r===`hot_opening_replicate`?`primary`:`default`,onClick:()=>{i(`hot_opening_replicate`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`hot_opening_replicate`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`hot_opening_replicate`?`none`:`1px solid #e2e8f0`,color:r===`hot_opening_replicate`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(e5,{}),children:`爆款复刻`}),(0,$.jsx)(X,{type:r===`shot_replicate`?`primary`:`default`,onClick:()=>{i(`shot_replicate`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`shot_replicate`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`shot_replicate`?`none`:`1px solid #e2e8f0`,color:r===`shot_replicate`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(c8,{}),children:`拆镜复刻`}),(0,$.jsx)(X,{type:r===`private_portrait`?`primary`:`default`,onClick:()=>{i(`private_portrait`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`private_portrait`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`private_portrait`?`none`:`1px solid #e2e8f0`,color:r===`private_portrait`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(h5,{}),children:`私域素材库`}),(0,$.jsx)(X,{type:r===`upload_resource`?`primary`:`default`,onClick:()=>{i(`upload_resource`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`upload_resource`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`upload_resource`?`none`:`1px solid #e2e8f0`,color:r===`upload_resource`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(f5,{}),children:`历史素材`})]})]}),r!==`private_portrait`&&r!==`upload_resource`&&(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexWrap:`wrap`},children:Re?(0,$.jsxs)(TH,{size:8,wrap:!0,children:[(0,$.jsx)(X,{onClick:Ze,style:{borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,color:`#222222ff`,fontWeight:600},children:Be.size===s.reduce((e,t)=>e+t.items.length,0)?`取消全选`:`全选`}),(0,$.jsx)(X,{onClick:()=>{ze(!1),Ve(new Set)},style:{borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,color:`#64748b`,fontWeight:600},children:`取消选择`}),(0,$.jsxs)(X,{onClick:()=>$e(),style:{borderRadius:8,background:`linear-gradient(135deg, #bf0b0a 0%, #ff8165 100%)`,fontWeight:600,padding:`8px 24px`,color:`#fff`},children:[`删除 (`,Be.size,`)`]}),(0,$.jsxs)(X,{onClick:()=>Qe(),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,color:`#fff`,fontWeight:600},children:[`下载 (`,Be.size,`)`]}),(0,$.jsx)(X,{type:`primary`,onClick:tt,loading:T,disabled:T||Be.size===0,style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,color:`#fff`,fontWeight:600},children:T?`推送中...`:`推送至账户 (${Be.size})`})]}):(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(f5,{}),onClick:()=>ze(!0),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,fontWeight:600},children:`批量操作`})})]}),r===`private_portrait`?(0,$.jsx)(voe,{}):r===`upload_resource`?(0,$.jsx)(Uoe,{}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`,gap:12,marginBottom:24,padding:`12px 16px`,borderRadius:12,background:`#fff`,border:`1px solid #f0f0f5`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:14},children:`媒体类型:`}),(0,$.jsxs)(TH,{size:8,wrap:!0,children:[(0,$.jsx)(X,{type:a===`video`?`primary`:`default`,onClick:()=>{o(`video`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:a===`video`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:a===`video`?`none`:`1px solid #e2e8f0`,color:a===`video`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(_5,{}),children:`视频`}),(0,$.jsx)(X,{type:a===`image`?`primary`:`default`,onClick:()=>{o(`image`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:a===`image`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:a===`image`?`none`:`1px solid #e2e8f0`,color:a===`image`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)($6,{}),children:`图片`}),(0,$.jsx)(NV,{picker:`date`,value:C?(0,AE.default)(C):void 0,onChange:(e,t)=>ft(t||``),format:`YYYY-MM-DD`,style:{width:160,borderRadius:8,border:`1px solid #e2e8f0`},placeholder:`选择日期`}),C&&(0,$.jsx)(X,{type:`text`,onClick:()=>ft(``),style:{color:`#94a3b8`,fontSize:12},children:`清除`})]})]}),(0,$.jsx)(X,{icon:(0,$.jsx)(EV,{}),onClick:ot,style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,color:`#ffffff`,fontWeight:600,boxShadow:`0 4px 15px rgba(102, 126, 234, 0.4)`,transition:`all 0.3s ease`},onMouseEnter:e=>{e.currentTarget.style.transform=`translateY(-2px)`,e.currentTarget.style.boxShadow=`0 6px 20px rgba(102, 126, 234, 0.6)`},onMouseLeave:e=>{e.currentTarget.style.transform=`translateY(0)`,e.currentTarget.style.boxShadow=`0 4px 15px rgba(102, 126, 234, 0.4)`},children:`查询推送任务历史`})]}),p?(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:`400px`},children:(0,$.jsx)(sK,{indicator:(0,$.jsx)(Xm,{style:{fontSize:24,color:`#64748b`},spin:!0}),tip:`加载中...`,size:`large`})}):s.length===0?(0,$.jsx)(nC,{image:nC.PRESENTED_IMAGE_SIMPLE,description:`暂无生成记录`,style:{padding:`60px 0`}}):(0,$.jsxs)(`div`,{style:{padding:`0 4px`},children:[s.map((e,t)=>(0,$.jsxs)(`div`,{style:{marginBottom:32},children:[(0,$.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:`#64748b`,marginBottom:12,paddingLeft:8},children:e.generatedDate}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:e.items.map(e=>{let t=a===`video`&&e.videoCoverUrl?We(e.videoCoverUrl,!0):We(a===`video`?e.videoUrl:e.imageUrl,!0),n=a===`video`&&e.videoCoverUrl||a===`image`,r=Be.has(qe(e));return(0,$.jsxs)(`div`,{className:`media-card`,style:{width:160,height:120,position:`relative`,borderRadius:4,cursor:`pointer`,overflow:`hidden`,boxShadow:`0 2px 8px rgba(0,0,0,0.1)`,transition:`transform 0.2s, box-shadow 0.2s`},onClick:()=>Re?Xe(qe(e)):Ge(e),onMouseEnter:e=>{Re||(e.currentTarget.style.transform=`scale(1.05)`,e.currentTarget.style.boxShadow=`0 4px 16px rgba(0,0,0,0.2)`)},onMouseLeave:e=>{Re||(e.currentTarget.style.transform=`scale(1)`,e.currentTarget.style.boxShadow=`0 2px 8px rgba(0,0,0,0.1)`)},children:[n?(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,position:`relative`},children:[(0,$.jsx)(`img`,{src:t,alt:`预览`,style:{width:`100%`,height:`100%`,objectFit:`cover`,opacity:+(G.get(qe(e))===`loaded`),transition:`opacity 0.3s`},onLoad:()=>{ee(t=>{let n=new Map(t);return n.set(qe(e),`loaded`),n})},onError:()=>{ee(t=>{let n=new Map(t);return n.set(qe(e),`error`),n})}}),G.get(qe(e))!==`loaded`&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%)`},children:(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,backgroundColor:`#cbd5e1`,display:`flex`,alignItems:`center`,justifyContent:`center`,animation:G.get(qe(e))===`loading`?`pulse 1.5s infinite`:`none`},children:e.mediaType===`video`?(0,$.jsx)(_5,{style:{color:`#64748b`,fontSize:16}}):(0,$.jsx)($6,{style:{color:`#64748b`,fontSize:16}})})})]}):(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,backgroundColor:`#1e293b`},children:[(0,$.jsx)(_5,{style:{color:`#64748b`,fontSize:24}}),(0,$.jsx)(Goe,{style:{fontSize:12,color:`#94a3b8`,marginTop:4},children:`暂无封面`})]}),Re&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,left:8,width:20,height:20,borderRadius:`50%`,backgroundColor:r?`#10b981`:`rgba(255,255,255,0.9)`,border:r?`2px solid #10b981`:`2px solid #d1d5db`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,zIndex:10},onClick:t=>{t.stopPropagation(),Xe(qe(e))},children:r&&(0,$.jsx)(`svg`,{width:12,height:12,viewBox:`0 0 12 12`,fill:`none`,children:(0,$.jsx)(`path`,{d:`M10 3L4.5 8.5L2 6`,stroke:`white`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`})})}),r&&a===`video`&&e.imagePx&&!Ye(e.imagePx)&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:36,left:8,right:8,padding:`4px 8px`,backgroundColor:`rgba(239, 68, 68, 0.9)`,color:`#fff`,fontSize:12,borderRadius:4,zIndex:10},children:`视频实际尺寸可能不符合平台推送要求`})]}),!Re&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,background:`linear-gradient(transparent, rgba(0,0,0,0.5))`,padding:`8px`,color:`#fff`,fontSize:12,opacity:0,transition:`opacity 0.2s`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0`},children:`点击预览`}),(0,$.jsx)(`div`,{className:`media-download-btn`,children:(0,$.jsx)(Sw,{title:`下载`,children:(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:`50%`,background:`rgba(0,0,0,0.5)`,backdropFilter:`blur(4px)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`background 0.15s`},onClick:t=>{t.stopPropagation();let n=`http://ceshi.apiforeign.minzhong.cn${e.videoUrl||e.imageUrl}&download=1`,r=document.createElement(`a`);r.href=n,r.download=``,document.body.appendChild(r),r.click(),document.body.removeChild(r)},children:(0,$.jsx)(j0,{style:{color:`#fff`,fontSize:14}})})})})]}),Re&&r&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,bottom:0,border:`3px solid #10b981`,borderRadius:4,pointerEvents:`none`,zIndex:5}})]},qe(e))})}),e.total&&e.total>e.items.length&&(0,$.jsx)(`div`,{style:{padding:`12px 0`,textAlign:`left`},children:(0,$.jsx)(X,{onClick:()=>gt(e.generatedDate,e.items,e.page),loading:h.has(e.generatedDate),disabled:h.has(e.generatedDate),size:`small`,style:{borderRadius:6,background:`transparent`,border:`1px dashed #cbd5e1`,color:`#64748b`,fontSize:12},children:h.has(e.date)?`加载中...`:`查看全部 (${e.total})`})})]},t)),s.length>0&&d>s.length&&(0,$.jsx)(`div`,{style:{textAlign:`center`,padding:`20px 0`},children:(0,$.jsx)(X,{onClick:ht,loading:p,disabled:p,style:{borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,color:`#64748b`,fontWeight:500},children:p?`加载中...`:`加载更多`})})]})]}),(0,$.jsxs)(MK,{title:`推送任务历史`,open:we,onCancel:()=>Te(!1),footer:null,width:800,style:{borderRadius:8},mask:{closable:!1},children:[(0,$.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,gap:4},children:[(0,$.jsx)(MC,{value:Ie,onChange:e=>Le(e),placeholder:`选择状态`,style:{width:200,marginRight:12},options:[{value:`1`,label:`待推送`},{value:`2`,label:`推送中`},{value:`3`,label:`推送成功`},{value:`4`,label:`推送失败`}],allowClear:!0}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:4},children:[(0,$.jsx)(X,{type:`primary`,onClick:st,style:{borderRadius:8},children:`查询`}),(0,$.jsx)(X,{icon:(0,$.jsx)(Hq,{}),onClick:st,style:{borderRadius:8},children:`刷新`})]})]}),(0,$.jsx)(t$,{dataSource:Ee,columns:[{title:`素材名称`,dataIndex:`fileName`,key:`fileName`,width:200},{title:`账户ID`,dataIndex:`advertiserId`,key:`advertiserId`,width:180},{title:`状态`,dataIndex:`status`,key:`status`,width:100,render:e=>(0,$.jsx)(m$,{color:{1:`#f59e0b`,2:`#6366f1`,3:`#10b981`,4:`#ef4444`}[e]||`#64748b`,style:{borderRadius:4},children:{1:`待推送`,2:`推送中`,3:`推送成功`,4:`推送失败`}[e]||e})},{title:`备注`,dataIndex:`note`,key:`note`,width:160,ellipsis:!0,render:e=>(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:e||`-`})},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,width:180,render:e=>F9(e)},{title:`更新时间`,dataIndex:`updatedAt`,key:`updatedAt`,width:180,render:e=>F9(e)}],loading:Pe,scroll:{x:`max-content`},pagination:{current:Ae,pageSize:Me,total:Oe,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:ct},rowKey:(e,t)=>e.task_id||e.resource_id||t,size:`small`})]}),_&&y&&(0,$.jsx)(MK,{title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:4,height:20,background:`linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%)`,borderRadius:2}}),(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:y.title||`预览`})]}),open:_,onCancel:Ke,width:1200,footer:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:12,padding:`16px 24px`,background:`#fff`,borderTop:`1px solid #f1f5f9`},children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(j0,{}),onClick:()=>{x.current&&x.current.pause();let e=`http://ceshi.apiforeign.minzhong.cn${y.videoUrl||y.imageUrl}&download=1`,t=document.createElement(`a`);t.href=e,t.download=``,document.body.appendChild(t),t.click(),document.body.removeChild(t)},style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.35)`,fontWeight:600,padding:`8px 24px`},disabled:Ue(y.videoUrl||y.imageUrl),children:Ue(y.videoUrl||y.imageUrl)?`资源已过期`:`下载`}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(O$,{}),onClick:()=>{let e=``,t=``;if(r===`shot_replicate`?(e=y.shotSegmentId,t=(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{marginBottom:8},children:`以下内容所连带的图片和视频都将被删除:`}),(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:20},children:(0,$.jsxs)(`li`,{style:{marginBottom:4,color:`#334155`},children:[y.shotReplicateProjectTitle,`— —`,y.shotSegmentLabel]})}),(0,$.jsx)(`div`,{style:{marginTop:12},children:`确定删除吗?`})]})):r===`hot_opening_replicate`?(e=y.moduleProjectId,t=(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{marginBottom:8},children:`爆款开头复刻中以下内容所连带的图片和视频都将被删除:`}),(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:20},children:(0,$.jsx)(`li`,{style:{marginBottom:4,color:`#334155`},children:y.moduleProjectTitle})}),(0,$.jsx)(`div`,{style:{marginTop:12},children:`确定删除吗?`})]})):(e=y.id,t=`确定删除该记录吗?`),!e){Z.warning(`无法获取删除ID`);return}MK.confirm({title:`确认删除`,content:t,okText:`确定删除`,cancelText:`取消`,okButtonProps:{danger:!0},onOk:async()=>{let t=``;r===`project`?t=`generation_record`:r===`creation`?t=`chat_task`:r===`hot_opening_replicate`?t=`hot_opening_replicate`:r===`shot_replicate`&&(t=`shot_replicate`);let n={history_source:t,ids:[e]};try{await C7(n),Z.success(`删除成功`),Ke(),u(e=>({...e,page:1})),mt()}catch{Z.error(`删除失败,请重试`)}}})},style:{borderRadius:8,background:`linear-gradient(135deg, #bf0b0a 0%, #ff8165 100%)`,fontWeight:600,padding:`8px 24px`},disabled:Ue(y.videoUrl||y.imageUrl),children:`删除`}),(0,$.jsx)(X,{onClick:nt,style:{borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,color:`#64748b`,fontWeight:600,padding:`8px 24px`},disabled:Ue(y.videoUrl||y.imageUrl),children:`推送媒体后台`})]}),style:{borderRadius:16,overflow:`hidden`},styles:{body:{height:500,display:`flex`,flexDirection:`column`,padding:0},header:{background:`#fff`,borderBottom:`1px solid #f1f5f9`,padding:`16px 24px`},mask:{backgroundColor:`rgba(0, 0, 0, 0.5)`}},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,height:`100%`,background:`#f8fafc`},children:[(0,$.jsx)(`div`,{style:{width:`70%`,height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`,padding:20},children:Ue(y.videoUrl||y.imageUrl)?(0,$.jsxs)(`div`,{style:{textAlign:`center`,padding:`40px`,backgroundColor:`#fff`,borderRadius:12},children:[(0,$.jsx)(`div`,{style:{fontSize:48,marginBottom:16},children:`⚠️`}),(0,$.jsx)(`p`,{style:{fontSize:15,color:`#ef4444`,fontWeight:500,marginBottom:8},children:`资源已过期`}),(0,$.jsx)(`p`,{style:{fontSize:13,color:`#94a3b8`},children:`请刷新页面重新加载`})]}):a===`video`?(0,$.jsx)(`video`,{ref:x,src:`http://ceshi.apiforeign.minzhong.cn${y.videoUrl}`,controls:!0,autoPlay:!0,style:{maxWidth:`100%`,maxHeight:`100%`,borderRadius:12,objectFit:`contain`}}):(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn/static${y.imageUrl}&w=300&q=50`,alt:`预览`,style:{maxWidth:`100%`,maxHeight:`100%`,objectFit:`contain`,borderRadius:12}})}),(0,$.jsxs)(`div`,{style:{width:`30%`,height:`100%`,overflowY:`auto`,scrollbarWidth:`none`,backgroundColor:`#fff`,padding:24,borderLeft:`1px solid #f1f5f9`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:20},children:[(0,$.jsx)(`div`,{style:{width:2,height:18,background:`linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%)`,borderRadius:1}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,color:`#1e293b`,fontWeight:600},children:`文件信息`})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:14},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`类型`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:a===`video`?`视频`:`图片`})]}),r===`hot_opening_replicate`&&(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:4},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`类属`}),(0,$.jsxs)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:500,wordBreak:`break-all`,lineHeight:`1.5`},children:[`爆款复刻——`,y.moduleProjectTitle]})]}),r===`shot_replicate`&&(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:4},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`类属`}),(0,$.jsxs)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:500,wordBreak:`break-all`,lineHeight:`1.5`},children:[y.shotReplicateProjectTitle,`— —`,y.shotSegmentLabel]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`请求`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:500,wordBreak:`break-all`,lineHeight:`1.5`},children:y.originalPrompt})]}),a===`image`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`比例`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.imageProportion})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`分辨率`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.imageSize})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`尺寸`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.imagePx})]})]}),a===`video`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`比例`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.aspectRatio})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`分辨率`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.resolution})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`时长`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:`${y.duration}秒`||`-`})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`创建时间`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:F9(y.createdAt||y.generatedDate)})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`生成引擎`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.engine||y.engineName||`-`})]})]}),(0,$.jsx)(`div`,{style:{borderTop:`1px solid #f1f5f9`,margin:`20px 0`}}),y.mediaReferences&&y.mediaReferences.length>0&&![`hot_opening_replicate`,`shot_replicate`].includes(r)&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:16},children:[(0,$.jsx)(`div`,{style:{width:2,height:18,background:`linear-gradient(180deg, #3b82f6 0%, #60a5fa 100%)`,borderRadius:1}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,color:`#1e293b`,fontWeight:600},children:`依靠附件`})]}),y.mediaReferences.map((e,t)=>(0,$.jsxs)(`div`,{onClick:()=>{x.current&&x.current.pause();let t=`http://ceshi.apiforeign.minzhong.cn${e.url}`;window.open(t,`_blank`)},style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 12px`,borderRadius:8,cursor:`pointer`,backgroundColor:`#f8fafc`,marginBottom:8,transition:`all 0.25s ease`,border:`1px solid transparent`},onMouseEnter:e=>{let t=e.currentTarget;t.style.backgroundColor=`#e0f2fe`,t.style.borderColor=`#bae6fd`},onMouseLeave:e=>{let t=e.currentTarget;t.style.backgroundColor=`#f8fafc`,t.style.borderColor=`transparent`},children:[e.type===`image`?(0,$.jsx)($6,{style:{color:`#3b82f6`,fontSize:16}}):(0,$.jsx)(_5,{style:{color:`#f59e0b`,fontSize:16}}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:500},children:e.name||`媒体${t+1}`})]},e.url))]})]})]})}),(0,$.jsx)(MK,{title:Be.size===1?`推送配置`:`批量推送配置`,open:D,onCancel:()=>{O(!1),A([[]]),M([``]),B([void 0]),H(new Map),W(``)},footer:null,width:900,mask:{closable:!1},children:(0,$.jsxs)(`div`,{style:{padding:`16px 0`},children:[(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14,color:`#475569`,marginBottom:8,display:`block`},children:[`选中素材 (`,Be.size,`个)`]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:12,alignItems:`center`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#64748b`},children:`统一修改名称:`}),(0,$.jsx)(eG,{value:U,onChange:e=>W(e.target.value),placeholder:`输入名称后点击应用`,style:{flex:1,borderRadius:8},size:`small`}),(0,$.jsx)(X,{type:`primary`,size:`small`,onClick:()=>{U.trim()&&Be.size>0&&dt(Array.from(Be),U)},disabled:!U.trim()||Be.size===0,style:{borderRadius:8},children:`应用`})]}),(0,$.jsx)(`div`,{style:{maxHeight:300,overflow:`auto`,border:`1px solid #f0f0f0`,borderRadius:8,padding:12},children:(()=>{let e=new Map;return s.forEach(t=>{t.items.forEach(t=>{let n=qe(t);e.set(n,t)})}),Array.from(Be).map(t=>{let n=e.get(t);return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 0`,borderBottom:`1px solid #f5f5f5`},children:[(0,$.jsx)(`div`,{style:{width:60,height:40,borderRadius:4,backgroundColor:`#f5f5f5`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`,flexShrink:0},children:(()=>{let e=a===`video`?n?.videoCoverUrl:n?.imageUrl;if(!e)return(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:`预览`});let t=`http://ceshi.apiforeign.minzhong.cn`,r=e.startsWith(`/`)?e.slice(1):e;return(0,$.jsx)(`img`,{src:`${t.endsWith(`/`)?t.slice(0,-1):t}/static/${r}&w=300&q=50`,alt:``,style:{width:`100%`,height:`100%`,objectFit:`cover`}})})()}),(0,$.jsx)(`div`,{style:{flex:1,minWidth:0},children:(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#1e293b`},children:n?.fileName||`素材 ${n.id}`})}),(0,$.jsx)(eG,{value:V.has(t)?V.get(t):n?.fileName||``,onChange:e=>{let n=e.target.value,r=new Map(V);r.set(t,n),H(r)},onBlur:()=>{let e=V.get(t)||n?.fileName||``;e.trim()&&ut(t,e)},onKeyDown:e=>{if(e.key===`Enter`){let e=V.get(t)||n?.fileName||``;e.trim()&&ut(t,e)}},placeholder:`输入新名称`,style:{width:200,borderRadius:4},size:`small`})]},t)})})()})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginBottom:16},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(Q.Text,{style:{fontSize:14,color:`#475569`},children:`是否开启前测:`}),(0,$.jsx)(MC,{value:ge,onChange:e=>{_e(e),e===`1`?d7().then(e=>{ye(e?.data?.id||``)}).catch(()=>{}):ye(``)},style:{width:120},options:[{value:`1`,label:`是`},{value:`2`,label:`否`}]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(Q.Text,{style:{fontSize:14,color:`#475569`},children:`前测模板:`}),(0,$.jsx)(MC,{value:ve,onChange:e=>ye(e),style:{width:200},disabled:ge!==`1`,loading:Se,placeholder:ge===`1`?`选择前测模板`:`请先开启前测`,options:be.map(e=>({value:e.id,label:e.name}))})]})]}),(0,$.jsx)(FL,{size:`small`,activeKey:oe,onChange:e=>{se(e),e===`history`&&it()},items:[{key:`new`,label:`新增账户`},{key:`history`,label:`历史账户`}]}),oe===`new`&&(0,$.jsxs)(`div`,{children:[z.map((e,t)=>(0,$.jsxs)(`div`,{style:{marginBottom:16,padding:12,border:`1px solid #e2e8f0`,borderRadius:8},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14,color:`#475569`},children:[`授权账户 `,t+1]}),z.length>1&&(0,$.jsx)(X,{type:`text`,danger:!0,onClick:()=>{let e=[...z],n=[...j],r=[...k],i=[...ae];e.splice(t,1),n.splice(t,1),r.splice(t,1),i.splice(t,1),B(e),M(n),A(r),q(i)},children:`删除`})]}),(0,$.jsx)(MC,{value:e,onChange:e=>{let n=[...z];n[t]=e,B(n)},placeholder:`点击选择授权账户`,style:{width:`100%`,marginBottom:12,borderRadius:8},popupRender:()=>(0,$.jsx)(`div`,{style:{padding:8,width:800,maxHeight:500,overflow:`auto`},children:(0,$.jsx)(t$,{dataSource:N,columns:[{title:`授权账户ID`,dataIndex:`accountId`,key:`accountId`,width:120},{title:`授权账户名称`,dataIndex:`accountName`,key:`accountName`,width:120},{title:`授权账户角色`,dataIndex:`accountRole`,key:`accountRole`,width:160,render:e=>({ADVERTISER:`客户`,CUSTOMER_ADMIN:`普通版工作台-管理员`,CUSTOMER_OPERATOR:`普通版工作台-协作者`,AGENT:`代理商`,CHILD_AGENT:`二级代理商`,PLATFORM_ROLE_STAR:`星图账户`,PLATFORM_ROLE_SHOP_ACCOUNT:`抖音店铺账户`,PLATFORM_ROLE_QIANCHUAN_AGENT:`千川代理商`,PLATFORM_ROLE_STAR_AGENT:`星图代理商`,PLATFORM_ROLE_AWEME:`抖音号`,PLATFORM_ROLE_STAR_MCN:`星图MCN机构`,PLATFORM_ROLE_STAR_ISV:`星图服务商`,AGENT_SYSTEM_ACCOUNT:`代理商系统账户`,PLATFORM_ROLE_LOCAL_AGENT:`本地推代理商`,PLATFORM_ROLE_YUNTU_BRAND_ISV_ADMIN:`云图品牌服务商管理员`,PLATFORM_ROLE_LIFE:`抖音来客账户`,PLATFORM_ROLE_ENTERPRISE_BP_ADMIN:`升级版工作台管理员`,PLATFORM_ROLE_ENTERPRISE_BP_OPERATOR:`升级版工作台协作者`})[e]||e},{title:`授权账户用户名`,dataIndex:`accountUsername`,key:`accountUsername`,width:120,render:e=>(0,$.jsx)(`span`,{style:{color:e?`#1e293b`:`#94a3b8`},children:e||`-`})},{title:`授权用户ID`,dataIndex:`accountUserid`,key:`accountUserid`,width:120}],loading:F,pagination:{current:ne,pageSize:re,total:L,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{K(e),ie(t),rt(e,t)}},rowKey:`id`,size:`small`,scroll:{x:`max-content`},onRow:n=>({onClick:()=>{let e=String(n.id),r=[...z];r[t]={value:e,label:String(n.accountId)+`-`+(n.accountName||`-`)},B(r);let i=[...ae];i[t]=!1,q(i)},style:{cursor:`pointer`,backgroundColor:e?.value===String(n.id)?`#e6f7ff`:void 0}})})}),open:ae[t],onOpenChange:e=>{let n=[...ae];n[t]=e,q(n),e&&rt(1,re)},labelInValue:!0,fieldNames:{label:`accountUserid`,value:`id`}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#475569`,marginBottom:8,display:`block`},children:`粘贴账户ID(每行一个或用逗号分隔)`}),(0,$.jsx)(eG.TextArea,{value:j[t],onChange:e=>{let n=e.target.value,r=[...j];r[t]=n,M(r);let i=n.split(/[\n,]/).map(e=>e.trim()).filter(e=>e.length>0),a=[...new Set(i)].map(e=>({accountId:e})),o=new Set,s=a.filter(e=>o.has(e.accountId)?!1:(o.add(e.accountId),!0)),c=[...k];c[t]=s,A(c)},placeholder:`粘贴账户ID,每行一个或用逗号分隔,例如: - 10001,10002,10003 +\0`,M+=r(k,2),M+=m.magic,M+=r(d,2),M+=r(f,2),M+=r(O.crc32,4),M+=r(O.compressedSize,4),M+=r(O.uncompressedSize,4),M+=r(g.length,2),M+=r(C.length,2),{fileRecord:l.LOCAL_FILE_HEADER+M+g+C,dirRecord:l.CENTRAL_FILE_HEADER+r(j,2)+M+r(y.length,2)+`\0\0\0\0`+r(A,4)+r(i,4)+g+C+y}}var a=e(`../utils`),o=e(`../stream/GenericWorker`),s=e(`../utf8`),c=e(`../crc32`),l=e(`../signature`);function u(e,t,n,r){o.call(this,`ZipFileWorker`),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo(`string`,this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e(`./Uint8ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e(`./DataReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e(`./ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array;var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e(`../utils`),i=e(`../support`),a=e(`./ArrayReader`),o=e(`./StringReader`),s=e(`./NodeBufferReader`),c=e(`./Uint8ArrayReader`);t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),t!==`string`||i.uint8array?t===`nodebuffer`?new s(e):i.uint8array?new c(r.transformTo(`uint8array`,e)):new a(r.transformTo(`array`,e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER=`PK`,n.CENTRAL_FILE_HEADER=`PK`,n.CENTRAL_DIRECTORY_END=`PK`,n.ZIP64_CENTRAL_DIRECTORY_LOCATOR=`PK\x07`,n.ZIP64_CENTRAL_DIRECTORY_END=`PK`,n.DATA_DESCRIPTOR=`PK\x07\b`},{}],24:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../utils`);function a(e){r.call(this,`ConvertWorker to `+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../crc32`);function a(){r.call(this,`Crc32Probe`),this.withStreamInfo(`crc32`,0)}e(`../utils`).inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataLengthProbe for `+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataWorker`);var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=``,this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case`string`:e=this.data.substring(this.index,t);break;case`uint8array`:e=this.data.subarray(this.index,t);break;case`array`:case`nodebuffer`:e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||`default`,this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit(`data`,e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(`end`),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(`error`,e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(`error`,e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n `+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e(`../utils`),i=e(`./ConvertWorker`),a=e(`./GenericWorker`),o=e(`../base64`),s=e(`../support`),c=e(`../external`),l=null;if(s.nodestream)try{l=e(`../nodejs/NodejsStreamOutputAdapter`)}catch{}function u(e,t){return new c.Promise(function(n,i){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on(`data`,function(e,n){a.push(e),t&&t(n)}).on(`error`,function(e){a=[],i(e)}).on(`end`,function(){try{n(function(e,t,n){switch(e){case`blob`:return r.newBlob(r.transformTo(`arraybuffer`,t),n);case`base64`:return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var n,r=0,i=null,a=0;for(n=0;n`u`)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:`application/zip`}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=i.getBlob(`application/zip`).size===0}catch{n.blob=!1}}}try{n.nodestream=!!e(`readable-stream`).Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e(`./utils`),i=e(`./support`),a=e(`./nodejsUtils`),o=e(`./stream/GenericWorker`),s=Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;s[254]=s[254]=1;function l(){o.call(this,`utf-8 decode`),this.leftOver=null}function u(){o.call(this,`utf-8 encode`)}n.utf8encode=function(e){return i.nodebuffer?a.newBufferFrom(e,`utf-8`):function(e){var t,n,r,a,o,s=e.length,c=0;for(a=0;a>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo(`nodebuffer`,e).toString(`utf-8`):function(e){var t,n,i,a,o=e.length,c=Array(2*o);for(t=n=0;t>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(e=r.transformTo(i.uint8array?`uint8array`:`array`,e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?`uint8array`:`array`,e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+s[e[n]]>t?n:t}(t),c=t;o!==t.length&&(i.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e(`./support`),i=e(`./base64`),a=e(`./nodejsUtils`),o=e(`./external`);function s(e){return e}function c(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),e==0&&(this.dosPermissions=63&this.externalFileAttributes),e==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!==`/`||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||={};e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,l[r++]=56320|1023&i)}return c(l,r)},n.utf8border=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;n!==0;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e(`../utils/common`),a=e(`./trees`),o=e(`./adler32`),s=e(`./crc32`),c=e(`./messages`),l=0,u=4,d=0,f=-2,p=-1,m=4,h=2,g=8,_=9,v=286,y=30,b=19,x=2*v+1,S=15,C=3,w=258,T=w+C+1,E=42,D=113,O=1,k=2,A=3,j=4;function M(e,t){return e.msg=c[t],t}function N(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),n!==0&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))}function I(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function R(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function z(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+w,p=l[a+o-1],m=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(l[(n=t)+o]===m&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do;while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ac&&--i!=0);return o<=e.lookahead?o:e.lookahead}function B(e){var t,n,r,a,c,l,u,d,f,p,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-T)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);a+=m}if(e.strm.avail_in===0)break;if(l=e.strm,u=e.window,d=e.strstart+e.lookahead,f=a,p=void 0,p=l.avail_in,f=C)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-C),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=C){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-C,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-C),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(B(e),e.lookahead===0&&t===l)return O;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,I(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-T&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):(e.strstart>e.block_start&&(I(e,!1),e.strm.avail_out),O)}),new U(4,4,8,4,V),new U(4,5,16,8,V),new U(4,6,32,32,V),new U(4,4,16,16,H),new U(8,16,32,32,H),new U(8,16,128,128,H),new U(8,32,128,256,H),new U(32,128,258,1024,H),new U(32,258,258,4096,H)],n.deflateInit=function(e,t){return te(e,t,g,15,8,0)},n.deflateInit2=te,n.deflateReset=ee,n.deflateResetKeep=G,n.deflateSetHeader=function(e,t){return e&&e.state&&e.state.wrap===2?(e.state.gzhead=t,d):f},n.deflate=function(e,t){var n,i,o,c;if(!e||!e.state||5>8&255),L(i,i.gzhead.time>>16&255),L(i,i.gzhead.time>>24&255),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(L(i,255&i.gzhead.extra.length),L(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(L(i,0),L(i,0),L(i,0),L(i,0),L(i,0),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,3),i.status=D);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:i.level===6?2:3)<<6,i.strstart!==0&&(p|=32),p+=31-p%31,i.status=D,R(i,p),i.strstart!==0&&(R(i,e.adler>>>16),R(i,65535&e.adler)),e.adler=1}if(i.status===69)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending!==i.pending_buf_size));)L(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(i.status===73)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.gzindex=0,i.status=91)}else i.status=91;if(i.status===91)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.status=103)}else i.status=103;if(i.status===103&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&F(e),i.pending+2<=i.pending_buf_size&&(L(i,255&e.adler),L(i,e.adler>>8&255),e.adler=0,i.status=D)):i.status=D),i.pending!==0){if(F(e),e.avail_out===0)return i.last_flush=-1,d}else if(e.avail_in===0&&N(t)<=N(n)&&t!==u)return M(e,-5);if(i.status===666&&e.avail_in!==0)return M(e,-5);if(e.avail_in!==0||i.lookahead!==0||t!==l&&i.status!==666){var m=i.strategy===2?function(e,t){for(var n;;){if(e.lookahead===0&&(B(e),e.lookahead===0)){if(t===l)return O;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):i.strategy===3?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===l)return O;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=C&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=C?(n=a._tr_tally(e,1,e.match_length-C),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):r[i.level].func(i,t);if(m!==A&&m!==j||(i.status=666),m===O||m===A)return e.avail_out===0&&(i.last_flush=-1),d;if(m===k&&(t===1?a._tr_align(i):t!==5&&(a._tr_stored_block(i,0,0,!1),t===3&&(P(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),F(e),e.avail_out===0))return i.last_flush=-1,d}return t===u?i.wrap<=0?1:(i.wrap===2?(L(i,255&e.adler),L(i,e.adler>>8&255),L(i,e.adler>>16&255),L(i,e.adler>>24&255),L(i,255&e.total_in),L(i,e.total_in>>8&255),L(i,e.total_in>>16&255),L(i,e.total_in>>24&255)):(R(i,e.adler>>>16),R(i,65535&e.adler)),F(e),0=n.w_size&&(s===0&&(P(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,m-n.w_size,n.w_size,0),t=p,m=n.w_size),c=e.avail_in,l=e.next_in,u=e.input,e.avail_in=m,e.next_in=0,e.input=t,B(n);n.lookahead>=C;){for(r=n.strstart,a=n.lookahead-(C-1);n.ins_h=(n.ins_h<>>=b=y>>>24,m-=b,(b=y>>>16&255)==0)E[a++]=65535&y;else{if(!(16&b)){if(!(64&b)){y=h[(65535&y)+(p&(1<>>=b,m-=b),m<15&&(p+=T[r++]<>>=b=y>>>24,m-=b,!(16&(b=y>>>16&255))){if(!(64&b)){y=g[(65535&y)+(p&(1<>>=b,m-=b,(b=a-o)>3,p&=(1<<(m-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=1&t.wrap),t.mode=f,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(m),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):d}function y(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,B,2,0),x=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg=`incorrect header check`,n.mode=30;break}if((15&b)!=8){e.msg=`unknown compression method`,n.mode=30;break}if(x-=4,F=8+(15&(b>>>=4)),n.wbits===0)n.wbits=F;else if(F>n.wbits){e.msg=`invalid window size`,n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=3;case 3:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>8&255,B[2]=b>>>16&255,B[3]=b>>>24&255,n.check=a(n.check,B,4,0)),x=b=0,n.mode=4;case 4:for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>8),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=5;case 5:if(1024&n.flags){for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>>8&255,n.check=a(n.check,B,2,0)),x=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(E=n.length)&&(E=v),E&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,E,F)),512&n.flags&&(n.check=a(n.check,p,E,g)),v-=E,g+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(v===0)break e;for(E=0;F=p[g+ E++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F)),F&&E>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>=7&x,x-=7&x,n.mode=27;break}for(;x<3;){if(v===0)break e;v--,b+=p[g++]<>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,t!==6)break;b>>>=2,x-=2;break e;case 2:n.mode=17;break;case 3:e.msg=`invalid block type`,n.mode=30}b>>>=2,x-=2;break;case 14:for(b>>>=7&x,x-=7&x;x<32;){if(v===0)break e;v--,b+=p[g++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=30;break}if(n.length=65535&b,x=b=0,n.mode=15,t===6)break e;case 15:n.mode=16;case 16:if(E=n.length){if(v>>=5,x-=5,n.ndist=1+(31&b),b>>>=5,x-=5,n.ncode=4+(15&b),b>>>=4,x-=4,286>>=3,x-=3}for(;n.have<19;)n.lens[V[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},I=s(0,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid code lengths set`,n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=k,x-=k,n.lens[n.have++]=j;else{if(j===16){for(R=k+2;x>>=k,x-=k,n.have===0){e.msg=`invalid bit length repeat`,n.mode=30;break}F=n.lens[n.have-1],E=3+(3&b),b>>>=2,x-=2}else if(j===17){for(R=k+3;x>>=k)),b>>>=3,x-=3}else{for(R=k+7;x>>=k)),b>>>=7,x-=7}if(n.have+E>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=30;break}for(;E--;)n.lens[n.have++]=F}}if(n.mode===30)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=30;break}if(n.lenbits=9,L={bits:n.lenbits},I=s(c,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid literal/lengths set`,n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},I=s(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,I){e.msg=`invalid distances set`,n.mode=30;break}if(n.mode=20,t===6)break e;case 20:n.mode=21;case 21:if(6<=v&&258<=y){e.next_out=_,e.avail_out=y,e.next_in=g,e.avail_in=v,n.hold=b,n.bits=x,o(e,C),_=e.next_out,m=e.output,y=e.avail_out,g=e.next_in,p=e.input,v=e.avail_in,b=n.hold,x=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;A=(z=n.lencode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,n.length=j,A===0){n.mode=26;break}if(32&A){n.back=-1,n.mode=12;break}if(64&A){e.msg=`invalid literal/length code`,n.mode=30;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(z=n.distcode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,64&A){e.msg=`invalid distance code`,n.mode=30;break}n.offset=j,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=30;break}n.mode=25;case 25:if(y===0)break e;if(E=C-y,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break}D=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),O=n.window}else O=m,D=_-n.offset,E=n.length;for(yv?(b=L[R+d[w]],N[P+d[w]]):(b=96,0),p=1<>k)+(m-=p)]=y<<24|b<<16|x|0,m!==0;);for(p=1<>=1;if(p===0?M=0:(M&=p-1,M+=p),w++,--F[C]==0){if(C===E)break;C=t[n+d[w]]}if(D>>7)]}function L(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function R(e,t,n){e.bi_valid>h-n?(e.bi_buf|=t<>h-e.bi_valid,e.bi_valid+=n-h):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function V(e,t,n){var r,i,a=Array(m+1),o=0;for(r=1;r<=m;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];s!==0&&(e[2*i]=B(a[s]++,s))}}function H(e){var t;for(t=0;t>1;1<=n;n--)G(e,a,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,G(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,g=t.stat_desc.max_length,_=0;for(a=0;a<=m;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&e.dyn_ltree[2*t]!==0)return i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&t!==-1?ie(e,t,n,r):e.strategy===4||s===o?(R(e,2+ +!!r,3),ee(e,T,E)):(R(e,4+ +!!r,3),function(e,t,n,r){var i;for(R(e,t-257,5),R(e,n-1,5),R(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,t===0?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(O[n]+l+1)]++,e.dyn_dtree[2*I(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){R(e,2,3),z(e,_,T),function(e){e.bi_valid===16?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){(function(e,t){if(!e.setImmediate){var n,r,i,a,o=1,s={},c=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n={}.toString.call(e.process)===`[object process]`?function(e){process.nextTick(function(){f(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}()?(a=`setImmediate$`+Math.random()+`$`,e.addEventListener?e.addEventListener(`message`,p,!1):e.attachEvent(`onmessage`,p),function(t){e.postMessage(a+t,`*`)}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){f(e.data)},function(e){i.port2.postMessage(e)}):l&&`onreadystatechange`in l.createElement(`script`)?(r=l.documentElement,function(e){var t=l.createElement(`script`);t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(f,0,e)},u.setImmediate=function(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),r=0;r`u`?e===void 0?this:e:self)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{}]},{},[10])(10)})}))(),1),{Text:Boe}=Q,M9=e=>e?/^(https?:|data:|blob:)/i.test(e)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,Voe=e=>e===`video`?(0,$.jsx)(_5,{}):e===`audio`?(0,$.jsx)(q2,{}):(0,$.jsx)($6,{}),Hoe=e=>e===`video`?`视频`:e===`audio`?`音频`:`图片`,N9=e=>{let t=Number(e||0);return t>=1024*1024?`${(t/1024/1024).toFixed(1)} MB`:t>=1024?`${(t/1024).toFixed(1)} KB`:`${t} B`},Uoe=()=>{let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(1),[o,s]=(0,S.useState)(10),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)([]),[f,p]=(0,S.useState)(0),[m,h]=(0,S.useState)(new Set),[g,_]=(0,S.useState)(null),v=(0,S.useMemo)(()=>u.flatMap(e=>e.items||[]),[u]),y=(0,S.useCallback)(async()=>{l(!0);try{let t=await nae({resourceType:e||void 0,keyword:n||void 0,page:i,pageSize:o,scene:`record`});d(t.groups||[]),p(t.totalDays||0),h(new Set)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),d([]),p(0)}finally{l(!1)}},[n,i,o,e]);(0,S.useEffect)(()=>{y()},[y]);let b=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},x=()=>{let e=v.map(e=>e.id);h(t=>t.size===e.length?new Set:new Set(e))},C=async t=>{let r=(t.page||1)+1;try{let i=await T7(t.generatedDate,{resourceType:e||void 0,keyword:n||void 0,page:r,pageSize:10,scene:`record`});d(e=>e.map(e=>e.generatedDate===t.generatedDate?{...e,page:r,items:[...e.items,...i.items||[]]}:e))}catch(e){Z.error(e?.message||`加载更多失败`)}},w=e=>{MK.confirm({title:`确认删除历史上传素材`,content:`确定删除 ${e.fileName||e.id} 吗?删除后会释放上传容量,并在提交成功后清理真实文件。`,okText:`删除`,okButtonProps:{danger:!0},cancelText:`取消`,onOk:async()=>{try{await W5(e.resourceUrl),Z.success(`删除成功`),y()}catch(e){Z.error(e?.message||`删除失败`)}}})},T=()=>{if(m.size===0){Z.warning(`请先选择要删除的上传素材`);return}if(m.size>30){Z.warning(`一次最多删除 30 条上传素材`);return}let e=Array.from(m);MK.confirm({title:`确认批量删除历史上传素材`,content:`确定删除选中的 ${e.length} 条上传素材吗?删除后会释放上传容量,并在提交成功后清理真实文件。`,okText:`删除`,okButtonProps:{danger:!0},cancelText:`取消`,onOk:async()=>{try{let t=await rae(e);Z.success(`删除成功,释放 ${N9(t?.releasedSizeBytes||0)}`),y()}catch(e){Z.error(e?.message||`批量删除失败`)}}})},E=e=>{let t=document.createElement(`a`);t.href=M9(e.resourceUrl),t.download=e.fileName||e.id,document.body.appendChild(t),t.click(),document.body.removeChild(t)},D=(e,t=`card`)=>{let n=M9(e.previewUrl||e.displayUrl||e.resourceUrl),r=t===`card`?{width:`100%`,height:130,objectFit:`cover`}:{width:`100%`,maxHeight:620,objectFit:`contain`};return e.resourceType===`image`?(0,$.jsx)(`img`,{src:n,alt:e.fileName||e.id,style:r}):e.resourceType===`video`?(0,$.jsx)(`video`,{src:n,controls:t===`preview`,muted:t===`card`,style:r}):(0,$.jsx)(`audio`,{src:n,controls:!0,style:{width:`100%`}})};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:12,alignItems:`center`,marginBottom:16,flexWrap:`wrap`},children:[(0,$.jsxs)(TH,{wrap:!0,children:[(0,$.jsx)(MC,{value:e,style:{width:120},options:[{label:`全部`,value:``},{label:`图片`,value:`image`},{label:`视频`,value:`video`},{label:`音频`,value:`audio`}],onChange:e=>{t(e),a(1)}}),(0,$.jsx)(eG,{allowClear:!0,value:n,prefix:(0,$.jsx)(DC,{}),placeholder:`搜索文件名或URL`,style:{width:240},onChange:e=>r(e.target.value),onPressEnter:()=>{a(1),y()}}),(0,$.jsx)(X,{icon:(0,$.jsx)(Hq,{}),onClick:y,children:`刷新`})]}),(0,$.jsxs)(TH,{children:[(0,$.jsx)(X,{onClick:x,children:m.size&&m.size===v.length?`取消全选`:`全选`}),(0,$.jsxs)(X,{danger:!0,icon:(0,$.jsx)(O$,{}),onClick:T,children:[`批量删除 (`,m.size,`)`]})]})]}),(0,$.jsx)(sK,{spinning:c,children:u.length===0?(0,$.jsx)(nC,{description:`暂无可展示的历史上传素材`,style:{padding:`60px 0`}}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:28},children:u.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(`div`,{style:{fontSize:18,fontWeight:700,color:`#1e293b`},children:e.generatedDate}),(0,$.jsxs)(Boe,{type:`secondary`,children:[`共 `,e.total,` 个素材`]})]}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,justifyContent:`flex-start`},children:e.items.map(e=>{let t=m.has(e.id);return(0,$.jsxs)(`div`,{style:{width:`17%`,minWidth:240,margin:16,border:t?`2px solid #8b5cf6`:`1px solid #e2e8f0`,borderRadius:16,overflow:`hidden`,background:`#fff`,boxShadow:`0 10px 24px rgba(15,23,42,0.06)`},children:[(0,$.jsxs)(`div`,{style:{position:`relative`,background:`#f1f5f9`},children:[D(e),(0,$.jsx)(az,{checked:t,onChange:()=>b(e.id),style:{position:`absolute`,top:10,left:10,background:`#fff`,borderRadius:6,padding:4}}),(0,$.jsx)(m$,{color:`purple`,icon:Voe(e.resourceType),style:{position:`absolute`,top:10,right:10,margin:0},children:Hoe(e.resourceType)})]}),(0,$.jsxs)(`div`,{style:{padding:12,paddingTop:0},children:[(0,$.jsxs)(TH,{size:4,wrap:!0,style:{marginTop:8},children:[(0,$.jsx)(m$,{style:{margin:0},children:e.moduleLabel}),(0,$.jsx)(m$,{style:{margin:0},children:N9(e.fileSizeBytes)}),e.durationSeconds?(0,$.jsxs)(m$,{style:{margin:0},children:[Number(e.durationSeconds).toFixed(1),`s`]}):null]}),(0,$.jsxs)(TH,{style:{marginTop:12},children:[(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(MW,{}),onClick:()=>_(e),children:`预览`}),(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(j0,{}),onClick:()=>E(e),children:`下载`}),(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(O$,{}),onClick:()=>w(e),children:`删除`})]})]})]},e.id)})}),e.items.lengthC(e),children:`加载更多`})})]},e.generatedDate))})}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:24},children:(0,$.jsx)(BG,{current:i,pageSize:o,total:f,showSizeChanger:!0,pageSizeOptions:[5,10],onChange:(e,t)=>{a(e),s(t)}})}),(0,$.jsx)(MK,{open:!!g,title:`预览`,footer:null,width:900,centered:!0,destroyOnHidden:!0,onCancel:()=>_(null),children:g?D(g,`preview`):null})]})},{Search:Woe}=eG,{Text:Goe}=Q,Koe=e=>{let t=S.useRef(!1);(0,S.useEffect)(()=>{if(t.current)return;let n=()=>{t.current||(t.current=!0,e?.())};return document.readyState===`complete`?n():window.addEventListener(`load`,n),()=>{window.removeEventListener(`load`,n)}},[e])},qoe=()=>{let[e,t]=(0,S.useState)(!1);Koe(()=>{t(!0)});let[n]=On(),[r,i]=(0,S.useState)(n.get(`filterType`)===`private_portrait`?`private_portrait`:n.get(`filterType`)===`upload_resource`?`upload_resource`:`project`),[a,o]=(0,S.useState)(`video`),[s,c]=(0,S.useState)([]),[l,u]=(0,S.useState)({page:1,pageSize:10}),[d,f]=(0,S.useState)(0),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(new Set),[_,v]=(0,S.useState)(!1),[y,b]=(0,S.useState)(null),x=S.createRef(),[C,w]=(0,S.useState)(``),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)([[]]),[j,M]=(0,S.useState)([``]),[N,P]=(0,S.useState)([]),[F,I]=(0,S.useState)(!1),[L,R]=(0,S.useState)(0),[z,B]=(0,S.useState)([void 0]),[V,H]=(0,S.useState)(new Map),[U,W]=(0,S.useState)(``),[G,ee]=(0,S.useState)(new Map),te=(0,S.useRef)(new Map);(0,S.useEffect)(()=>()=>{te.current.forEach(e=>clearTimeout(e)),te.current.clear()},[]);let[ne,K]=(0,S.useState)(1),[re,ie]=(0,S.useState)(10),[ae,q]=(0,S.useState)([!1]),[oe,se]=(0,S.useState)(`new`),[ce,le]=(0,S.useState)([]),[ue,de]=(0,S.useState)(!1),[fe,pe]=(0,S.useState)([]),[me,he]=(0,S.useState)({}),[ge,_e]=(0,S.useState)(`2`),[ve,ye]=(0,S.useState)(``),[be,xe]=(0,S.useState)([]),[Se,Ce]=(0,S.useState)(!1),[we,Te]=(0,S.useState)(!1),[Ee,De]=(0,S.useState)([]),[Oe,ke]=(0,S.useState)(0),[Ae,je]=(0,S.useState)(1),[Me,Ne]=(0,S.useState)(10),[Pe,Fe]=(0,S.useState)(!1),[Ie,Le]=(0,S.useState)(``),[Re,ze]=(0,S.useState)(!1),[Be,Ve]=(0,S.useState)(new Set),He=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}}},Ue=e=>{let t=He(e);return t?Math.floor(Date.now()/1e3)>t:!1},We=(e,t=!1)=>{let n=`http://ceshi.apiforeign.minzhong.cn`,r=e.startsWith(`/`)?e.slice(1):e,i=n.endsWith(`/`)?n.slice(0,-1):n;return t?`${i}/static/${r}&w=300&q=50`:`${i}/${r}`},Ge=e=>{b(e),v(!0),window.dispatchEvent(new Event(`previewOpen`))},Ke=()=>{x.current&&(x.current.pause(),x.current.currentTime=0),document.querySelectorAll(`video`).forEach(e=>{e.pause(),e.currentTime=0}),v(!1)},qe=e=>e.generatedResourceId||e.id,Je=e=>!!e.generatedResourceId,Ye=e=>{if(!e)return!0;let t=e.match(/^(\d+)x(\d+)$/);if(!t)return!0;let n=parseInt(t[1],10),r=parseInt(t[2],10),i=n/r;return n>=r?n>=480&&n<=2560&&r>=270&&r<=1440&&i>=1.775&&i<=1.784:n>=270&&n<=1440&&r>=480&&r<=2560&&i>=.555&&i<=.564},Xe=e=>{Ve(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ze=()=>{let e=s.flatMap(e=>e.items.map(e=>qe(e)));Be.size===e.length?Ve(new Set):Ve(new Set(e))},Qe=async()=>{if(Be.size===0){Z.warning(`请先选择要下载的媒体`);return}if(Be.size>30){Z.warning(`最多只能单次下载30个文件`);return}let e=[];s.forEach(t=>{t.items.forEach(t=>{Be.has(qe(t))&&e.push(t)})});let t=new zoe.default,n=`http://ceshi.apiforeign.minzhong.cn`,r=t.folder(`downloads`),i=!1,a=0;Z.loading({content:`下载中,请稍候...`,key:`downloadProgress`});for(let t of e){let e=`${n}${t.videoUrl||t.imageUrl}`,o=((t.videoUrl||t.imageUrl).split(`/`).pop()||`file_${Date.now()}`).split(`?`)[0];try{let t=await fetch(e);if(!t.ok)throw Error(`Network response was not ok`);let n=await t.blob();r?.file(o,n),a++}catch{console.warn(`文件下载失败(CORS限制): ${o},将使用备用方式下载`),i=!0;break}}if(i){Z.destroy(`downloadProgress`),Z.info(`由于跨域限制,将逐个下载文件`),e.forEach((e,t)=>{setTimeout(()=>{let t=`${n}${e.videoUrl||e.imageUrl}&download=1`,r=document.createElement(`a`);r.href=t,r.download=``,document.body.appendChild(r),r.click(),document.body.removeChild(r)},t*500)});return}let o=await t.generateAsync({type:`blob`}),c=document.createElement(`a`);c.href=URL.createObjectURL(o),c.download=`downloads_${Date.now()}.zip`,c.click(),URL.revokeObjectURL(c.href),Z.destroy(`downloadProgress`),Z.success(`下载完成,共 ${a} 个文件`),ze(!1),Ve(new Set)},$e=async()=>{if(Be.size===0){Z.warning(`请先选择要删除的媒体`);return}if(Be.size>30){Z.warning(`最多只能单次删除30个文件`);return}let e=s.flatMap(e=>e.items.filter(e=>Be.has(qe(e)))),t=``;t=r===`shot_replicate`?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{marginBottom:8},children:`以下内容所连带的图片和视频都将被删除:`}),(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:20},children:e.map((e,t)=>(0,$.jsxs)(`li`,{style:{marginBottom:4,color:`#334155`},children:[e.shotReplicateProjectTitle,`— —`,e.shotSegmentLabel]},t))}),(0,$.jsx)(`div`,{style:{marginTop:12},children:`确定删除吗?`})]}):r===`hot_opening_replicate`?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{marginBottom:8},children:`爆款开头复刻中以下内容所连带的图片和视频都将被删除:`}),(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:20},children:e.map((e,t)=>(0,$.jsx)(`li`,{style:{marginBottom:4,color:`#334155`},children:e.moduleProjectTitle},t))}),(0,$.jsx)(`div`,{style:{marginTop:12},children:`确定删除吗?`})]}):`确定删除选中的 ${Be.size} 条记录吗?`,MK.confirm({title:`确认删除`,content:t,okText:`确定删除`,cancelText:`取消`,okButtonProps:{danger:!0},onOk:async()=>{let e=``;r===`project`?e=`generation_record`:r===`creation`?e=`chat_task`:r===`hot_opening_replicate`?e=`hot_opening_replicate`:r===`shot_replicate`&&(e=`shot_replicate`);let t=[];s.forEach(e=>{e.items.forEach(e=>{Be.has(qe(e))&&t.push(e)})});let n=[];e===`generation_record`||e===`chat_task`?n=t.map(e=>e.id):e===`hot_opening_replicate`?n=t.map(e=>e.moduleProjectId):e===`shot_replicate`&&(n=t.map(e=>e.shotSegmentId));let i={history_source:e,ids:n};try{await C7(i),Z.success(`删除成功`),ze(!1),Ve(new Set),u(e=>({...e,page:1})),mt()}catch{Z.error(`删除失败,请重试`)}}})},et=async()=>{Ce(!0);try{let e=await l7({page:1,pageSize:100});xe(e.data?.data||e.data||[])}catch(e){console.error(`加载前测模板失败:`,e)}finally{Ce(!1)}},tt=()=>{if(Be.size===0){Z.warning(`请先选择要推送的媒体`);return}A([[]]),M([``]),B([void 0]),_e(`2`),ye(``),et(),O(!0)},nt=()=>{if(!y)return;let e=qe(y);Ve(new Set([e])),A([[]]),M([``]),B([void 0]),H(new Map),W(``),_e(`2`),ye(``),et(),O(!0)},rt=async(e,t)=>{I(!0);try{let n=await c7({page:e,page_size:t});P(n?.data||n||[]),R(n.pagination.total||0)}catch(e){console.error(`加载授权列表失败:`,e),P([]),R(0)}finally{I(!1)}},it=async()=>{de(!0);try{let[e,t]=await Promise.all([$ie(),x7()]);le(e?.data||[]);let n=t?.data||[],r={};n.forEach(e=>{r[e.openType]=e.typeName}),he(r)}catch(e){console.error(`加载历史授权账户列表失败:`,e),le([]),he({})}finally{de(!1)}},at=async()=>{Fe(!0);try{let e=await Gie({status:Ie||void 0,page:Ae,pageSize:Me});De(e?.data||e||[]),ke(e.pagination?.total||e.total||0)}catch(e){console.error(`加载推送历史失败:`,e),De([]),ke(0)}finally{Fe(!1)}},ot=()=>{Te(!0),je(1),Le(``),at()},st=()=>{je(1),at()},ct=(e,t)=>{je(e),Ne(t),at()},lt=async()=>{if(Be.size===0){Z.warning(`请先选择要推送的媒体`);return}let e=new Map;s.forEach(t=>{t.items.forEach(t=>{let n=qe(t);e.set(n,t)})});let t=[];if(oe===`new`){let n=z.filter(e=>e!==void 0);if(n.length===0){Z.warning(`请先选择授权账户`);return}for(let r=0;re.accountId)||[];if(a.length===0){Z.warning(`第 ${r+1} 组授权账户未设置账户ID,已跳过`);continue}let o=new Map;for(let t of Be){let n=e.get(t),r;n&&Je(n)&&(r=`generated_resources`),o.has(r)||o.set(r,[]),o.get(r).push(t)}o.forEach((e,n)=>{t.push({advertiser_ids:a,resource_ids:e,oauth_id:i.value,source_model:n,is_pre_test:ge,pre_test_template:ve})})}}else{if(fe.length===0){Z.warning(`请先选择历史账户`);return}for(let n of fe){let i=new Map;for(let t of Be){let n=e.get(t),a;a=n&&Je(n)?`generated_resources`:r===`project`?`generation_records`:`chat_generation_tasks`,i.has(a)||i.set(a,[]),i.get(a).push(t)}i.forEach((e,r)=>{t.push({advertiser_ids:[n.advertiserId],resource_ids:e,oauth_id:String(n.oauthId),source_model:r,is_pre_test:ge,pre_test_template:ve})})}}E(!0);try{let e=await Wie({tasks:t});e.errors?.length>0?Z.warning(e.message):e.code===0?Z.success(e.message):Z.error(e.message),ze(!1),Ve(new Set),O(!1),A([[]]),M([``]),B([void 0]),pe([]),H(new Map),W(``),_e(`2`),ye(``)}catch(e){console.error(`批量推送失败:`,e),Z.error(e.message||`批量推送失败`)}finally{E(!1)}},ut=async(e,t)=>{if(t.trim())try{let n=(await y7({filenames:[{source_id:e,file_name:t}]}))?.results?.find(t=>t.source_id===e)?.new_file_name||t;c(t=>t.map(t=>({...t,items:t.items.map(t=>qe(t)===e?{...t,fileName:n}:t)}))),Z.success(`文件名更新成功`)}catch(e){console.error(`文件名更新失败:`,e),Z.error(e.message||`文件名更新失败`)}},dt=async(e,t)=>{if(!(!t.trim()||e.length===0))try{let n=await y7({filenames:e.map(e=>({source_id:e,file_name:t}))}),r=new Map;n?.results?.forEach(e=>{e.success&&e.newFileName&&r.set(e.sourceId,e.newFileName)}),c(n=>{let i=new Set(e);return n.map(e=>({...e,items:e.items.map(e=>{let n=qe(e);if(i.has(n)){let i=r.get(n)||t;return{...e,fileName:i}}return e})}))}),console.log(n);let i=n?.successCount||0;Z.success(`已更新 ${i} 个文件名`)}catch(e){console.error(`文件名更新失败:`,e),Z.error(e.message||`文件名更新失败`)}},ft=e=>{w(e)},pt=e=>new Promise(t=>{let n=document.createElement(`video`),r=`http://ceshi.apiforeign.minzhong.cn`,i=e.startsWith(`/`)?e.slice(1):e;n.src=`${r.endsWith(`/`)?r.slice(0,-1):r}/${i}`,n.crossOrigin=`anonymous`,n.onloadedmetadata=()=>{let e=n.videoWidth,r=n.videoHeight;n.remove(),t(`${e}x${r}`)},n.onerror=()=>{n.remove(),t(``)},n.onabort=()=>{n.remove(),t(``)},setTimeout(()=>{n.remove(),t(``)},5e3)}),mt=()=>{if(r===`private_portrait`||r===`upload_resource`){m(!1),c([]);return}m(!0);let t=``;r===`project`?t=`generation_record`:r===`hot_opening_replicate`?t=`hot_opening_replicate`:r===`shot_replicate`&&(t=`shot_replicate`);let n=`?gen_type=${a}&page=${l.page}&page_size=${l.pageSize}`;if(t&&(n=`?gen_type=${a}&history_source=${t}&page=${l.page}&page_size=${l.pageSize}`),C){let n=`${C}?gen_type=${a}&page=${l.page}&page_size=${l.pageSize}`;t&&(n=`${C}?gen_type=${a}&history_source=${t}&page=${l.page}&page_size=${l.pageSize}`),n7(n).then(t=>{let n=Array.isArray(t)?t:t?.items||[],r=[{generatedDate:t.generatedDate,items:n,total:t.total,page:t.page}];r&&r[0].items.length>0?c(r):c([]),e&&n.forEach(async e=>{if(e.videoUrl&&e.videoUrl.trim()){let t=await pt(e.videoUrl);t&&c(n=>n.map(n=>({...n,items:n.items.map(n=>n.id===e.id?{...n,imagePx:t}:n)})))}})}).catch(e=>{}).finally(()=>{m(!1)})}else yie(n).then(t=>{let n=Array.isArray(t)?t:t?.groups||[];n.forEach(e=>{e.page=1}),l.page===1?c(n):c(e=>[...e,...n]),f(t?.totalDays||0),e&&n.forEach(e=>{e.items.forEach(async e=>{if(e.videoUrl&&e.videoUrl.trim()){let t=await pt(e.videoUrl);t&&c(n=>n.map(n=>({...n,items:n.items.map(n=>n.id===e.id?{...n,imagePx:t}:n)})))}})})}).catch(e=>{l.page===1&&c([])}).finally(()=>{m(!1)})};(0,S.useEffect)(()=>{mt()},[r,a,l.page,C]);let ht=()=>{p||u(e=>({...e,page:e.page+1}))},gt=async(e,t,n)=>{if(h.has(t))return;g(e=>new Set([...e,t]));let i=n+1,o=``;r===`project`?o=`generation_record`:r===`hot_opening_replicate`?o=`hot_opening_replicate`:r===`shot_replicate`&&(o=`shot_replicate`);let s=`${e}?gen_type=${a}&page=${i}&page_size=${l.pageSize}`;o&&(s=`${e}?gen_type=${a}&history_source=${o}&page=${i}&page_size=${l.pageSize}`);try{let t=(await n7(s)).items||[];t&&t.length>0&&c(n=>n.map(n=>n.generatedDate===e?{...n,items:[...n.items,...t],page:i}:n))}catch{}finally{g(e=>{let n=new Set(e);return n.delete(t),n})}};return(0,S.useEffect)(()=>{u(e=>({...e,page:1}))},[r,a]),(0,$.jsxs)(`div`,{className:`content_box`,children:[(0,$.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:12,marginBottom:16,padding:`12px 16px`,borderRadius:12,background:`#fff`,border:`1px solid #f0f0f5`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexWrap:`wrap`},children:[(0,$.jsx)(b3,{style:{color:`#090a0cff`,fontSize:14}}),(0,$.jsxs)(TH,{size:8,wrap:!0,children:[(0,$.jsx)(X,{type:r===`project`?`primary`:`default`,onClick:()=>{i(`project`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`project`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`project`?`none`:`1px solid #e2e8f0`,color:r===`project`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(uZ,{}),children:`项目记录`}),(0,$.jsx)(X,{type:r===`creation`?`primary`:`default`,onClick:()=>{i(`creation`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`creation`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`creation`?`none`:`1px solid #e2e8f0`,color:r===`creation`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(AH,{}),children:`创作记录`}),(0,$.jsx)(X,{type:r===`hot_opening_replicate`?`primary`:`default`,onClick:()=>{i(`hot_opening_replicate`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`hot_opening_replicate`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`hot_opening_replicate`?`none`:`1px solid #e2e8f0`,color:r===`hot_opening_replicate`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(e5,{}),children:`爆款复刻`}),(0,$.jsx)(X,{type:r===`shot_replicate`?`primary`:`default`,onClick:()=>{i(`shot_replicate`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`shot_replicate`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`shot_replicate`?`none`:`1px solid #e2e8f0`,color:r===`shot_replicate`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(c8,{}),children:`拆镜复刻`}),(0,$.jsx)(X,{type:r===`private_portrait`?`primary`:`default`,onClick:()=>{i(`private_portrait`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`private_portrait`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`private_portrait`?`none`:`1px solid #e2e8f0`,color:r===`private_portrait`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(h5,{}),children:`私域素材库`}),(0,$.jsx)(X,{type:r===`upload_resource`?`primary`:`default`,onClick:()=>{i(`upload_resource`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:r===`upload_resource`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:r===`upload_resource`?`none`:`1px solid #e2e8f0`,color:r===`upload_resource`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(f5,{}),children:`历史素材`})]})]}),r!==`private_portrait`&&r!==`upload_resource`&&(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexWrap:`wrap`},children:Re?(0,$.jsxs)(TH,{size:8,wrap:!0,children:[(0,$.jsx)(X,{onClick:Ze,style:{borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,color:`#222222ff`,fontWeight:600},children:Be.size===s.reduce((e,t)=>e+t.items.length,0)?`取消全选`:`全选`}),(0,$.jsx)(X,{onClick:()=>{ze(!1),Ve(new Set)},style:{borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,color:`#64748b`,fontWeight:600},children:`取消选择`}),(0,$.jsxs)(X,{onClick:()=>$e(),style:{borderRadius:8,background:`linear-gradient(135deg, #bf0b0a 0%, #ff8165 100%)`,fontWeight:600,padding:`8px 24px`,color:`#fff`},children:[`删除 (`,Be.size,`)`]}),(0,$.jsxs)(X,{onClick:()=>Qe(),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,color:`#fff`,fontWeight:600},children:[`下载 (`,Be.size,`)`]}),(0,$.jsx)(X,{type:`primary`,onClick:tt,loading:T,disabled:T||Be.size===0,style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,color:`#fff`,fontWeight:600},children:T?`推送中...`:`推送至账户 (${Be.size})`})]}):(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(f5,{}),onClick:()=>ze(!0),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,fontWeight:600},children:`批量操作`})})]}),r===`private_portrait`?(0,$.jsx)(voe,{}):r===`upload_resource`?(0,$.jsx)(Uoe,{}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`,gap:12,marginBottom:24,padding:`12px 16px`,borderRadius:12,background:`#fff`,border:`1px solid #f0f0f5`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:14},children:`媒体类型:`}),(0,$.jsxs)(TH,{size:8,wrap:!0,children:[(0,$.jsx)(X,{type:a===`video`?`primary`:`default`,onClick:()=>{o(`video`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:a===`video`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:a===`video`?`none`:`1px solid #e2e8f0`,color:a===`video`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)(_5,{}),children:`视频`}),(0,$.jsx)(X,{type:a===`image`?`primary`:`default`,onClick:()=>{o(`image`),ze(!1),Ve(new Set)},style:{borderRadius:8,background:a===`image`?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#f8f9fc`,border:a===`image`?`none`:`1px solid #e2e8f0`,color:a===`image`?`#fff`:`#64748b`,fontWeight:600},icon:(0,$.jsx)($6,{}),children:`图片`}),(0,$.jsx)(NV,{picker:`date`,value:C?(0,AE.default)(C):void 0,onChange:(e,t)=>ft(t||``),format:`YYYY-MM-DD`,style:{width:160,borderRadius:8,border:`1px solid #e2e8f0`},placeholder:`选择日期`}),C&&(0,$.jsx)(X,{type:`text`,onClick:()=>ft(``),style:{color:`#94a3b8`,fontSize:12},children:`清除`})]})]}),(0,$.jsx)(X,{icon:(0,$.jsx)(EV,{}),onClick:ot,style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,color:`#ffffff`,fontWeight:600,boxShadow:`0 4px 15px rgba(102, 126, 234, 0.4)`,transition:`all 0.3s ease`},onMouseEnter:e=>{e.currentTarget.style.transform=`translateY(-2px)`,e.currentTarget.style.boxShadow=`0 6px 20px rgba(102, 126, 234, 0.6)`},onMouseLeave:e=>{e.currentTarget.style.transform=`translateY(0)`,e.currentTarget.style.boxShadow=`0 4px 15px rgba(102, 126, 234, 0.4)`},children:`查询推送任务历史`})]}),p?(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:`400px`},children:(0,$.jsx)(sK,{indicator:(0,$.jsx)(Xm,{style:{fontSize:24,color:`#64748b`},spin:!0}),tip:`加载中...`,size:`large`})}):s.length===0?(0,$.jsx)(nC,{image:nC.PRESENTED_IMAGE_SIMPLE,description:`暂无生成记录`,style:{padding:`60px 0`}}):(0,$.jsxs)(`div`,{style:{padding:`0 4px`},children:[s.map((e,t)=>(0,$.jsxs)(`div`,{style:{marginBottom:32},children:[(0,$.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:`#64748b`,marginBottom:12,paddingLeft:8},children:e.generatedDate}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:e.items.map(e=>{let t=a===`video`&&e.videoCoverUrl?We(e.videoCoverUrl,!0):We(a===`video`?e.videoUrl:e.imageUrl,!0),n=a===`video`&&e.videoCoverUrl||a===`image`,r=Be.has(qe(e));return(0,$.jsxs)(`div`,{className:`media-card`,style:{width:160,height:120,position:`relative`,borderRadius:4,cursor:`pointer`,overflow:`hidden`,boxShadow:`0 2px 8px rgba(0,0,0,0.1)`,transition:`transform 0.2s, box-shadow 0.2s`},onClick:()=>Re?Xe(qe(e)):Ge(e),onMouseEnter:e=>{Re||(e.currentTarget.style.transform=`scale(1.05)`,e.currentTarget.style.boxShadow=`0 4px 16px rgba(0,0,0,0.2)`)},onMouseLeave:e=>{Re||(e.currentTarget.style.transform=`scale(1)`,e.currentTarget.style.boxShadow=`0 2px 8px rgba(0,0,0,0.1)`)},children:[n?(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,position:`relative`},children:[(0,$.jsx)(`img`,{src:t,alt:`预览`,style:{width:`100%`,height:`100%`,objectFit:`cover`,opacity:+(G.get(qe(e))===`loaded`),transition:`opacity 0.3s`},onLoad:()=>{ee(t=>{let n=new Map(t);return n.set(qe(e),`loaded`),n})},onError:()=>{ee(t=>{let n=new Map(t);return n.set(qe(e),`error`),n})}}),G.get(qe(e))!==`loaded`&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%)`},children:(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,backgroundColor:`#cbd5e1`,display:`flex`,alignItems:`center`,justifyContent:`center`,animation:G.get(qe(e))===`loading`?`pulse 1.5s infinite`:`none`},children:e.mediaType===`video`?(0,$.jsx)(_5,{style:{color:`#64748b`,fontSize:16}}):(0,$.jsx)($6,{style:{color:`#64748b`,fontSize:16}})})})]}):(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,backgroundColor:`#1e293b`},children:[(0,$.jsx)(_5,{style:{color:`#64748b`,fontSize:24}}),(0,$.jsx)(Goe,{style:{fontSize:12,color:`#94a3b8`,marginTop:4},children:`暂无封面`})]}),Re&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,left:8,width:20,height:20,borderRadius:`50%`,backgroundColor:r?`#10b981`:`rgba(255,255,255,0.9)`,border:r?`2px solid #10b981`:`2px solid #d1d5db`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,zIndex:10},onClick:t=>{t.stopPropagation(),Xe(qe(e))},children:r&&(0,$.jsx)(`svg`,{width:12,height:12,viewBox:`0 0 12 12`,fill:`none`,children:(0,$.jsx)(`path`,{d:`M10 3L4.5 8.5L2 6`,stroke:`white`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`})})}),r&&a===`video`&&e.imagePx&&!Ye(e.imagePx)&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:36,left:8,right:8,padding:`4px 8px`,backgroundColor:`rgba(239, 68, 68, 0.9)`,color:`#fff`,fontSize:12,borderRadius:4,zIndex:10},children:`视频实际尺寸可能不符合平台推送要求`})]}),!Re&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,background:`linear-gradient(transparent, rgba(0,0,0,0.5))`,padding:`8px`,color:`#fff`,fontSize:12,opacity:0,transition:`opacity 0.2s`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0`},children:`点击预览`}),(0,$.jsx)(`div`,{className:`media-download-btn`,children:(0,$.jsx)(Sw,{title:`下载`,children:(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:`50%`,background:`rgba(0,0,0,0.5)`,backdropFilter:`blur(4px)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`background 0.15s`},onClick:t=>{t.stopPropagation();let n=`http://ceshi.apiforeign.minzhong.cn${e.videoUrl||e.imageUrl}&download=1`,r=document.createElement(`a`);r.href=n,r.download=``,document.body.appendChild(r),r.click(),document.body.removeChild(r)},children:(0,$.jsx)(j0,{style:{color:`#fff`,fontSize:14}})})})})]}),Re&&r&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,bottom:0,border:`3px solid #10b981`,borderRadius:4,pointerEvents:`none`,zIndex:5}})]},qe(e))})}),e.total&&e.total>e.items.length&&(0,$.jsx)(`div`,{style:{padding:`12px 0`,textAlign:`left`},children:(0,$.jsx)(X,{onClick:()=>gt(e.generatedDate,e.items,e.page),loading:h.has(e.generatedDate),disabled:h.has(e.generatedDate),size:`small`,style:{borderRadius:6,background:`transparent`,border:`1px dashed #cbd5e1`,color:`#64748b`,fontSize:12},children:h.has(e.date)?`加载中...`:`查看全部 (${e.total})`})})]},t)),s.length>0&&d>s.length&&(0,$.jsx)(`div`,{style:{textAlign:`center`,padding:`20px 0`},children:(0,$.jsx)(X,{onClick:ht,loading:p,disabled:p,style:{borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,color:`#64748b`,fontWeight:500},children:p?`加载中...`:`加载更多`})})]})]}),(0,$.jsxs)(MK,{title:`推送任务历史`,open:we,onCancel:()=>Te(!1),footer:null,width:800,style:{borderRadius:8},mask:{closable:!1},children:[(0,$.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,gap:4},children:[(0,$.jsx)(MC,{value:Ie,onChange:e=>Le(e),placeholder:`选择状态`,style:{width:200,marginRight:12},options:[{value:`1`,label:`待推送`},{value:`2`,label:`推送中`},{value:`3`,label:`推送成功`},{value:`4`,label:`推送失败`}],allowClear:!0}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:4},children:[(0,$.jsx)(X,{type:`primary`,onClick:st,style:{borderRadius:8},children:`查询`}),(0,$.jsx)(X,{icon:(0,$.jsx)(Hq,{}),onClick:st,style:{borderRadius:8},children:`刷新`})]})]}),(0,$.jsx)(t$,{dataSource:Ee,columns:[{title:`素材名称`,dataIndex:`fileName`,key:`fileName`,width:200},{title:`账户ID`,dataIndex:`advertiserId`,key:`advertiserId`,width:180},{title:`状态`,dataIndex:`status`,key:`status`,width:100,render:e=>(0,$.jsx)(m$,{color:{1:`#f59e0b`,2:`#6366f1`,3:`#10b981`,4:`#ef4444`}[e]||`#64748b`,style:{borderRadius:4},children:{1:`待推送`,2:`推送中`,3:`推送成功`,4:`推送失败`}[e]||e})},{title:`备注`,dataIndex:`note`,key:`note`,width:160,ellipsis:!0,render:e=>(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:e||`-`})},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,width:180,render:e=>F9(e)},{title:`更新时间`,dataIndex:`updatedAt`,key:`updatedAt`,width:180,render:e=>F9(e)}],loading:Pe,scroll:{x:`max-content`},pagination:{current:Ae,pageSize:Me,total:Oe,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:ct},rowKey:(e,t)=>e.task_id||e.resource_id||t,size:`small`})]}),_&&y&&(0,$.jsx)(MK,{title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:4,height:20,background:`linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%)`,borderRadius:2}}),(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:y.title||`预览`})]}),open:_,onCancel:Ke,width:1200,footer:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:12,padding:`16px 24px`,background:`#fff`,borderTop:`1px solid #f1f5f9`},children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(j0,{}),onClick:()=>{x.current&&x.current.pause();let e=`http://ceshi.apiforeign.minzhong.cn${y.videoUrl||y.imageUrl}&download=1`,t=document.createElement(`a`);t.href=e,t.download=``,document.body.appendChild(t),t.click(),document.body.removeChild(t)},style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.35)`,fontWeight:600,padding:`8px 24px`},disabled:Ue(y.videoUrl||y.imageUrl),children:Ue(y.videoUrl||y.imageUrl)?`资源已过期`:`下载`}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(O$,{}),onClick:()=>{let e=``,t=``;if(r===`shot_replicate`?(e=y.shotSegmentId,t=(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{marginBottom:8},children:`以下内容所连带的图片和视频都将被删除:`}),(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:20},children:(0,$.jsxs)(`li`,{style:{marginBottom:4,color:`#334155`},children:[y.shotReplicateProjectTitle,`— —`,y.shotSegmentLabel]})}),(0,$.jsx)(`div`,{style:{marginTop:12},children:`确定删除吗?`})]})):r===`hot_opening_replicate`?(e=y.moduleProjectId,t=(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{marginBottom:8},children:`爆款开头复刻中以下内容所连带的图片和视频都将被删除:`}),(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:20},children:(0,$.jsx)(`li`,{style:{marginBottom:4,color:`#334155`},children:y.moduleProjectTitle})}),(0,$.jsx)(`div`,{style:{marginTop:12},children:`确定删除吗?`})]})):(e=y.id,t=`确定删除该记录吗?`),!e){Z.warning(`无法获取删除ID`);return}MK.confirm({title:`确认删除`,content:t,okText:`确定删除`,cancelText:`取消`,okButtonProps:{danger:!0},onOk:async()=>{let t=``;r===`project`?t=`generation_record`:r===`creation`?t=`chat_task`:r===`hot_opening_replicate`?t=`hot_opening_replicate`:r===`shot_replicate`&&(t=`shot_replicate`);let n={history_source:t,ids:[e]};try{await C7(n),Z.success(`删除成功`),Ke(),u(e=>({...e,page:1})),mt()}catch{Z.error(`删除失败,请重试`)}}})},style:{borderRadius:8,background:`linear-gradient(135deg, #bf0b0a 0%, #ff8165 100%)`,fontWeight:600,padding:`8px 24px`},disabled:Ue(y.videoUrl||y.imageUrl),children:`删除`}),(0,$.jsx)(X,{onClick:nt,style:{borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,color:`#64748b`,fontWeight:600,padding:`8px 24px`},disabled:Ue(y.videoUrl||y.imageUrl),children:`推送媒体后台`})]}),style:{borderRadius:16,overflow:`hidden`},styles:{body:{height:500,display:`flex`,flexDirection:`column`,padding:0},header:{background:`#fff`,borderBottom:`1px solid #f1f5f9`,padding:`16px 24px`},mask:{backgroundColor:`rgba(0, 0, 0, 0.5)`}},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,height:`100%`,background:`#f8fafc`},children:[(0,$.jsx)(`div`,{style:{width:`70%`,height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`,padding:20},children:Ue(y.videoUrl||y.imageUrl)?(0,$.jsxs)(`div`,{style:{textAlign:`center`,padding:`40px`,backgroundColor:`#fff`,borderRadius:12},children:[(0,$.jsx)(`div`,{style:{fontSize:48,marginBottom:16},children:`⚠️`}),(0,$.jsx)(`p`,{style:{fontSize:15,color:`#ef4444`,fontWeight:500,marginBottom:8},children:`资源已过期`}),(0,$.jsx)(`p`,{style:{fontSize:13,color:`#94a3b8`},children:`请刷新页面重新加载`})]}):a===`video`?(0,$.jsx)(`video`,{ref:x,src:`http://ceshi.apiforeign.minzhong.cn${y.videoUrl}`,controls:!0,autoPlay:!0,style:{maxWidth:`100%`,maxHeight:`100%`,borderRadius:12,objectFit:`contain`}}):(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn/static${y.imageUrl}&w=300&q=50`,alt:`预览`,style:{maxWidth:`100%`,maxHeight:`100%`,objectFit:`contain`,borderRadius:12}})}),(0,$.jsxs)(`div`,{style:{width:`30%`,height:`100%`,overflowY:`auto`,scrollbarWidth:`none`,backgroundColor:`#fff`,padding:24,borderLeft:`1px solid #f1f5f9`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:20},children:[(0,$.jsx)(`div`,{style:{width:2,height:18,background:`linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%)`,borderRadius:1}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,color:`#1e293b`,fontWeight:600},children:`文件信息`})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:14},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`类型`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:a===`video`?`视频`:`图片`})]}),r===`hot_opening_replicate`&&(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:4},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`类属`}),(0,$.jsxs)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:500,wordBreak:`break-all`,lineHeight:`1.5`},children:[`爆款复刻——`,y.moduleProjectTitle]})]}),r===`shot_replicate`&&(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:4},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`类属`}),(0,$.jsxs)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:500,wordBreak:`break-all`,lineHeight:`1.5`},children:[y.shotReplicateProjectTitle,`— —`,y.shotSegmentLabel]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`请求`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:500,wordBreak:`break-all`,lineHeight:`1.5`},children:y.originalPrompt})]}),a===`image`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`比例`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.imageProportion})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`分辨率`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.imageSize})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`尺寸`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.imagePx})]})]}),a===`video`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`比例`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.aspectRatio})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`分辨率`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.resolution})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`时长`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:`${y.duration}秒`||`-`})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`创建时间`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:F9(y.createdAt||y.generatedDate)})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:13,fontWeight:500},children:`生成引擎`}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:600},children:y.engine||y.engineName||`-`})]})]}),(0,$.jsx)(`div`,{style:{borderTop:`1px solid #f1f5f9`,margin:`20px 0`}}),y.mediaReferences&&y.mediaReferences.length>0&&![`hot_opening_replicate`,`shot_replicate`].includes(r)&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:16},children:[(0,$.jsx)(`div`,{style:{width:2,height:18,background:`linear-gradient(180deg, #3b82f6 0%, #60a5fa 100%)`,borderRadius:1}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,color:`#1e293b`,fontWeight:600},children:`依靠附件`})]}),y.mediaReferences.map((e,t)=>(0,$.jsxs)(`div`,{onClick:()=>{x.current&&x.current.pause();let t=`http://ceshi.apiforeign.minzhong.cn${e.url}`;window.open(t,`_blank`)},style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 12px`,borderRadius:8,cursor:`pointer`,backgroundColor:`#f8fafc`,marginBottom:8,transition:`all 0.25s ease`,border:`1px solid transparent`},onMouseEnter:e=>{let t=e.currentTarget;t.style.backgroundColor=`#e0f2fe`,t.style.borderColor=`#bae6fd`},onMouseLeave:e=>{let t=e.currentTarget;t.style.backgroundColor=`#f8fafc`,t.style.borderColor=`transparent`},children:[e.type===`image`?(0,$.jsx)($6,{style:{color:`#3b82f6`,fontSize:16}}):(0,$.jsx)(_5,{style:{color:`#f59e0b`,fontSize:16}}),(0,$.jsx)(`span`,{style:{color:`#334155`,fontSize:13,fontWeight:500},children:e.name||`媒体${t+1}`})]},e.url))]})]})]})}),(0,$.jsx)(MK,{title:Be.size===1?`推送配置`:`批量推送配置`,open:D,onCancel:()=>{O(!1),A([[]]),M([``]),B([void 0]),H(new Map),W(``)},footer:null,width:900,mask:{closable:!1},children:(0,$.jsxs)(`div`,{style:{padding:`16px 0`},children:[(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14,color:`#475569`,marginBottom:8,display:`block`},children:[`选中素材 (`,Be.size,`个)`]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:12,alignItems:`center`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#64748b`},children:`统一修改名称:`}),(0,$.jsx)(eG,{value:U,onChange:e=>W(e.target.value),placeholder:`输入名称后点击应用`,style:{flex:1,borderRadius:8},size:`small`}),(0,$.jsx)(X,{type:`primary`,size:`small`,onClick:()=>{U.trim()&&Be.size>0&&dt(Array.from(Be),U)},disabled:!U.trim()||Be.size===0,style:{borderRadius:8},children:`应用`})]}),(0,$.jsx)(`div`,{style:{maxHeight:300,overflow:`auto`,border:`1px solid #f0f0f0`,borderRadius:8,padding:12},children:(()=>{let e=new Map;return s.forEach(t=>{t.items.forEach(t=>{let n=qe(t);e.set(n,t)})}),Array.from(Be).map(t=>{let n=e.get(t);return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 0`,borderBottom:`1px solid #f5f5f5`},children:[(0,$.jsx)(`div`,{style:{width:60,height:40,borderRadius:4,backgroundColor:`#f5f5f5`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`,flexShrink:0},children:(()=>{let e=a===`video`?n?.videoCoverUrl:n?.imageUrl;if(!e)return(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:`预览`});let t=`http://ceshi.apiforeign.minzhong.cn`,r=e.startsWith(`/`)?e.slice(1):e;return(0,$.jsx)(`img`,{src:`${t.endsWith(`/`)?t.slice(0,-1):t}/static/${r}&w=300&q=50`,alt:``,style:{width:`100%`,height:`100%`,objectFit:`cover`}})})()}),(0,$.jsx)(`div`,{style:{flex:1,minWidth:0},children:(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#1e293b`},children:n?.fileName||`素材 ${n.id}`})}),(0,$.jsx)(eG,{value:V.has(t)?V.get(t):n?.fileName||``,onChange:e=>{let n=e.target.value,r=new Map(V);r.set(t,n),H(r)},onBlur:()=>{let e=V.get(t)||n?.fileName||``;e.trim()&&ut(t,e)},onKeyDown:e=>{if(e.key===`Enter`){let e=V.get(t)||n?.fileName||``;e.trim()&&ut(t,e)}},placeholder:`输入新名称`,style:{width:200,borderRadius:4},size:`small`})]},t)})})()})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginBottom:16},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(Q.Text,{style:{fontSize:14,color:`#475569`},children:`是否开启前测:`}),(0,$.jsx)(MC,{value:ge,onChange:e=>{_e(e),e===`1`?d7().then(e=>{ye(e?.data?.id||``)}).catch(()=>{}):ye(``)},style:{width:120},options:[{value:`1`,label:`是`},{value:`2`,label:`否`}]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(Q.Text,{style:{fontSize:14,color:`#475569`},children:`前测模板:`}),(0,$.jsx)(MC,{value:ve,onChange:e=>ye(e),style:{width:200},disabled:ge!==`1`,loading:Se,placeholder:ge===`1`?`选择前测模板`:`请先开启前测`,options:be.map(e=>({value:e.id,label:e.name}))})]})]}),(0,$.jsx)(FL,{size:`small`,activeKey:oe,onChange:e=>{se(e),e===`history`&&it()},items:[{key:`new`,label:`新增账户`},{key:`history`,label:`历史账户`}]}),oe===`new`&&(0,$.jsxs)(`div`,{children:[z.map((e,t)=>(0,$.jsxs)(`div`,{style:{marginBottom:16,padding:12,border:`1px solid #e2e8f0`,borderRadius:8},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14,color:`#475569`},children:[`授权账户 `,t+1]}),z.length>1&&(0,$.jsx)(X,{type:`text`,danger:!0,onClick:()=>{let e=[...z],n=[...j],r=[...k],i=[...ae];e.splice(t,1),n.splice(t,1),r.splice(t,1),i.splice(t,1),B(e),M(n),A(r),q(i)},children:`删除`})]}),(0,$.jsx)(MC,{value:e,onChange:e=>{let n=[...z];n[t]=e,B(n)},placeholder:`点击选择授权账户`,style:{width:`100%`,marginBottom:12,borderRadius:8},popupRender:()=>(0,$.jsx)(`div`,{style:{padding:8,width:800,maxHeight:500,overflow:`auto`},children:(0,$.jsx)(t$,{dataSource:N,columns:[{title:`授权账户ID`,dataIndex:`accountId`,key:`accountId`,width:120},{title:`授权账户名称`,dataIndex:`accountName`,key:`accountName`,width:120},{title:`授权账户角色`,dataIndex:`accountRole`,key:`accountRole`,width:160,render:e=>({ADVERTISER:`客户`,CUSTOMER_ADMIN:`普通版工作台-管理员`,CUSTOMER_OPERATOR:`普通版工作台-协作者`,AGENT:`代理商`,CHILD_AGENT:`二级代理商`,PLATFORM_ROLE_STAR:`星图账户`,PLATFORM_ROLE_SHOP_ACCOUNT:`抖音店铺账户`,PLATFORM_ROLE_QIANCHUAN_AGENT:`千川代理商`,PLATFORM_ROLE_STAR_AGENT:`星图代理商`,PLATFORM_ROLE_AWEME:`抖音号`,PLATFORM_ROLE_STAR_MCN:`星图MCN机构`,PLATFORM_ROLE_STAR_ISV:`星图服务商`,AGENT_SYSTEM_ACCOUNT:`代理商系统账户`,PLATFORM_ROLE_LOCAL_AGENT:`本地推代理商`,PLATFORM_ROLE_YUNTU_BRAND_ISV_ADMIN:`云图品牌服务商管理员`,PLATFORM_ROLE_LIFE:`抖音来客账户`,PLATFORM_ROLE_ENTERPRISE_BP_ADMIN:`升级版工作台管理员`,PLATFORM_ROLE_ENTERPRISE_BP_OPERATOR:`升级版工作台协作者`})[e]||e},{title:`授权账户用户名`,dataIndex:`accountUsername`,key:`accountUsername`,width:120,render:e=>(0,$.jsx)(`span`,{style:{color:e?`#1e293b`:`#94a3b8`},children:e||`-`})},{title:`授权用户ID`,dataIndex:`accountUserid`,key:`accountUserid`,width:120}],loading:F,pagination:{current:ne,pageSize:re,total:L,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{K(e),ie(t),rt(e,t)}},rowKey:`id`,size:`small`,scroll:{x:`max-content`},onRow:n=>({onClick:()=>{let e=String(n.id),r=[...z];r[t]={value:e,label:String(n.accountId)+`-`+(n.accountName||`-`)},B(r);let i=[...ae];i[t]=!1,q(i)},style:{cursor:`pointer`,backgroundColor:e?.value===String(n.id)?`#e6f7ff`:void 0}})})}),open:ae[t],onOpenChange:e=>{let n=[...ae];n[t]=e,q(n),e&&rt(1,re)},labelInValue:!0,fieldNames:{label:`accountUserid`,value:`id`}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#475569`,marginBottom:8,display:`block`},children:`粘贴账户ID(每行一个或用逗号分隔)`}),(0,$.jsx)(eG.TextArea,{value:j[t],onChange:e=>{let n=e.target.value,r=[...j];r[t]=n,M(r);let i=n.split(/[\n,]/).map(e=>e.trim()).filter(e=>e.length>0),a=[...new Set(i)].map(e=>({accountId:e})),o=new Set,s=a.filter(e=>o.has(e.accountId)?!1:(o.add(e.accountId),!0)),c=[...k];c[t]=s,A(c)},placeholder:`粘贴账户ID,每行一个或用逗号分隔,例如:\r + 10001,10002,10003\r 10004`,rows:3,style:{borderRadius:8}})]},t)),(0,$.jsx)(X,{type:`dashed`,block:!0,onClick:()=>{B([...z,void 0]),M([...j,``]),A([...k,[]]),q([...ae,!1])},style:{borderRadius:8,marginBottom:16},children:`+ 新增授权账户组`})]}),oe===`history`&&(0,$.jsx)(`div`,{style:{padding:8},children:ue?(0,$.jsx)(`div`,{style:{textAlign:`center`,padding:40},children:`加载中...`}):ce.length===0?(0,$.jsx)(nC,{description:`暂无可选账户`}):(0,$.jsx)(q$,{style:{width:`100%`},dataSource:ce.filter(e=>e.advertiserId).map((e,t)=>({key:String(e.advertiserId)||`item-${t}`,title:String(e.advertiserId),description:e.advertiserName||``,...e})),targetKeys:fe.filter(e=>e.advertiserId).map(e=>String(e.advertiserId)),onChange:e=>{pe(ce.filter(t=>t.advertiserId&&e.includes(String(t.advertiserId))))},titles:[`可选账户列表`,`已选账户列表`],showSearch:!0,filterOption:(e,t)=>String(t.advertiserId).toLowerCase().includes(e.toLowerCase())||t.advertiserName&&t.advertiserName.toLowerCase().includes(e.toLowerCase()),children:({direction:e,filteredItems:t,onItemSelect:n,onItemSelectAll:r,selectedKeys:i,disabled:a})=>(0,$.jsx)(t$,{rowSelection:{getCheckboxProps:()=>({disabled:a}),onChange:e=>{r(e,`replace`)},selectedRowKeys:i,selections:[t$.SELECTION_ALL,t$.SELECTION_INVERT,t$.SELECTION_NONE]},columns:[{title:`账户ID`,dataIndex:`advertiserId`,key:`advertiserId`,width:120},{title:`账户名称`,dataIndex:`advertiserName`,key:`advertiserName`,width:150}],dataSource:t,size:`small`,style:{pointerEvents:a?`none`:void 0},pagination:!1,scroll:{x:`max-content`,y:400},onRow:({key:e,disabled:t})=>({onClick:()=>{t||a||n(e,!i.includes(e))}})})})}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12,justifyContent:`flex-end`},children:[(0,$.jsx)(X,{onClick:()=>{O(!1),A([[]]),M([``]),B([void 0]),H(new Map),W(``)},style:{borderRadius:8},children:`取消`}),(0,$.jsx)(X,{type:`primary`,onClick:lt,loading:T,disabled:T||(oe===`new`?k.every(e=>e.length===0):fe.length===0),style:{borderRadius:8},children:T?`推送中...`:`开始推送`})]})]})})]})},P9=document.createElement(`style`);P9.textContent=` @keyframes spin { from { transform: rotate(0deg); } diff --git a/video-gen-app/dist/index.html b/video-gen-app/dist/index.html index 14ebbd7d..e1df11ff 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/GenerateConver.tsx b/video-gen-app/src/pages/GenerateConver.tsx index e6edd8af..1a5580c8 100644 --- a/video-gen-app/src/pages/GenerateConver.tsx +++ b/video-gen-app/src/pages/GenerateConver.tsx @@ -382,30 +382,38 @@ const AIChatPage: React.FC = () => { config = { perSecondCredits: 2, baseCredits: 60, - ratio: 1, - inputVideoRatio: 1, + ratio: 1.3, + inputVideoRatio: 1.3, inputVideoBaseCredits: 0, - inputVideoPerSecondCredits: 0.5, + inputVideoPerSecondCredits: 15, + inputImageRatio: 1, + inputImageBaseCredits: 0, + inputImagePerImageCredits: 0.0, }; if (videoResolution === '1080p') { - config.ratio = 2; + config.ratio = 1.3; } else if (videoResolution === '720p') { - config.ratio = 1.5; + config.ratio = 1.3; } else if (videoResolution === '480p') { - config.ratio = 1; + config.ratio = 1.3; } } else { // 如果没有找到对应的配置,则使用默认配置 config = { perSecondCredits: 0.1, - baseCredits: 4, - ratio: 1, + baseCredits: 2, + ratio: 3, + inputImageRatio: 1, + inputImageBaseCredits: 0, + inputImagePerImageCredits: 0.0, }; if (selectedResolution === '2K') { - config.ratio = 1; + config.ratio = 3; } else if (selectedResolution === '4K') { - config.ratio = 2; + config.ratio = 3; + } else if (selectedResolution === '1K') { + config.ratio = 3; } } } @@ -422,10 +430,27 @@ const AIChatPage: React.FC = () => { const inputVideoCost = ((config.inputVideoBaseCredits || 0) + (config.inputVideoPerSecondCredits || 0) * inputVideoDuration) * (config.inputVideoRatio || 1); total += inputVideoCost; } + // 传入图片积分 + const inputImageCount = currentMedia + .filter((m) => m.type === 'image') + .length; + if (inputImageCount > 0) { + const inputImageCost = ((config.inputImageBaseCredits || 0) + (config.inputImagePerImageCredits || 0) * inputImageCount) * (config.inputImageRatio || 1); + total += inputImageCost; + } return Number(total.toFixed(2)); } else { // 图片:baseCredits × ratio - return Number((config.baseCredits * config.ratio).toFixed(2)); + let total = config.baseCredits * config.ratio; + // 传入图片积分 + const inputImageCount = currentMedia + .filter((m) => m.type === 'image') + .length; + if (inputImageCount > 0) { + const inputImageCost = ((config.inputImageBaseCredits || 0) + (config.inputImagePerImageCredits || 0) * inputImageCount) * (config.inputImageRatio || 1); + total += inputImageCost; + } + return Number(total.toFixed(2)); } };