From fed6ba2e19e5b6070dd589cf0e74d404e5969c44 Mon Sep 17 00:00:00 2001 From: wwwwwwwww <526125649@qq.com> Date: Sat, 11 Jul 2026 15:41:23 +0800 Subject: [PATCH] 1 --- .../{index-BzY_VVvl.js => index-tEZsB6Nw.js} | 2 +- video-gen-admin/dist/index.html | 2 +- .../src/pages/AdminPaymentStats.tsx | 34 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) rename video-gen-admin/dist/assets/{index-BzY_VVvl.js => index-tEZsB6Nw.js} (99%) diff --git a/video-gen-admin/dist/assets/index-BzY_VVvl.js b/video-gen-admin/dist/assets/index-tEZsB6Nw.js similarity index 99% rename from video-gen-admin/dist/assets/index-BzY_VVvl.js rename to video-gen-admin/dist/assets/index-tEZsB6Nw.js index 8e6808bd..4a561f91 100644 --- a/video-gen-admin/dist/assets/index-BzY_VVvl.js +++ b/video-gen-admin/dist/assets/index-tEZsB6Nw.js @@ -541,7 +541,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC...\r `,disabled:!i})}),(0,Q.jsx)(X.Item,{name:`alipay_public_key`,label:`支付宝公钥`,extra:`从支付宝开放平台获取的支付宝公钥`,children:(0,Q.jsx)(IN.TextArea,{rows:4,placeholder:`\r MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...\r - `,disabled:!i})}),(0,Q.jsx)(X.Item,{name:`alipay_gateway`,label:`网关地址`,children:(0,Q.jsx)(IN,{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)(IN,{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)(U2,{}),onClick:async()=>{try{let e=await u.validateFields();t(!0),await iVe({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)}),vP.success(`支付配置已保存`),d()}catch{vP.error(`保存失败`)}finally{t(!1)}},loading:e,size:`large`,style:{borderRadius:8,minWidth:160,height:44,fontSize:15},children:`保存配置`})})]})},{Option:U5}=Sb,{RangePicker:cUe}=sM,lUe=()=>{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([aVe(u),oVe({...u,phone:u.phone,page:i,pageSize:o})]);r({...e,recent:n.items||[]}),l(n.total)}catch{vP.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`)}),a(1)},h=async e=>{try{t(!0),await sVe(e),vP.success(`退款成功`),await f()}catch(e){vP.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)(FK,{})},pending:{color:`gold`,label:`待支付`,icon:(0,Q.jsx)(rM,{})},cancelled:{color:`default`,label:`已取消`,icon:(0,Q.jsx)(sq,{})},refunded:{color:`red`,label:`已退款`,icon:(0,Q.jsx)(b6,{})}},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:`phone`,key:`phone`,width:120,render:e=>e||`-`},{title:`支付方式`,dataIndex:`paymentMethod`,key:`paymentMethod`,width:100,render:e=>{let t=v[e]||{color:`default`,label:e};return(0,Q.jsx)(bR,{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)(bR,{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)(CP,{title:`确认要退款该订单吗?`,description:`退款后积分会扣除,金额会原路返回`,onConfirm:()=>h(t.orderNo),okText:`确认`,cancelText:`取消`,children:(0,Q.jsx)(XS,{type:`link`,danger:!0,size:`small`,icon:(0,Q.jsx)(b6,{}),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:M8.default,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(zP,{gutter:[16,16],style:{marginBottom:24},children:[(0,Q.jsx)(tj,{xs:24,sm:12,lg:12,children:(0,Q.jsxs)(MA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsx)(HP,{title:`今日收入`,value:n.today.paidAmount,precision:2,prefix:(0,Q.jsx)(XJ,{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)(tj,{xs:24,sm:12,lg:12,children:(0,Q.jsxs)(MA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsx)(HP,{title:`本月累计`,value:E.paidAmount,precision:2,prefix:(0,Q.jsx)(XJ,{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)(MA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`,marginBottom:16},title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(XJ,{}),`订单状态分布`]}),children:(0,Q.jsx)(zP,{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)(tj,{span:6,children:(0,Q.jsxs)(`div`,{style:{padding:16,borderRadius:10,background:`#fafbff`,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(bR,{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)(MA,{bordered:!1,style:{borderRadius:12,border:`1px solid #f0f0f5`},title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(XJ,{}),`订单列表`]}),children:[(0,Q.jsxs)(zP,{gutter:[16,16],align:`middle`,style:{marginBottom:24},children:[(0,Q.jsxs)(tj,{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)(tj,{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)(tj,{xs:24,sm:12,md:5,children:[(0,Q.jsx)(`span`,{style:{marginRight:8},children:`手机号:`}),(0,Q.jsx)(IN,{placeholder:`搜索手机号`,allowClear:!0,value:u.phone,onChange:e=>d(t=>({...t,phone:e.target.value})),onPressEnter:()=>{a(1),f()},suffix:(0,Q.jsx)(_b,{style:{color:`#94a3b8`}}),style:{width:180}})]}),(0,Q.jsxs)(tj,{xs:24,sm:12,md:6,children:[(0,Q.jsx)(`span`,{style:{marginRight:8},children:`日期范围:`}),(0,Q.jsx)(cUe,{value:[(0,QS.default)(u.startDate),(0,QS.default)(u.endDate)],onChange:g})]}),(0,Q.jsx)(tj,{xs:24,sm:12,md:3,children:(0,Q.jsx)(XS,{icon:(0,Q.jsx)(IP,{}),onClick:m,children:`重置`})})]}),(0,Q.jsx)(sR,{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)(p4,{})},{name:`BookOutlined`,label:`书籍`,component:(0,Q.jsx)(dW,{})},{name:`HomeOutlined`,label:`房产`,component:(0,Q.jsx)(fQ,{})},{name:`FireOutlined`,label:`火`,component:(0,Q.jsx)(UX,{})},{name:`RocketOutlined`,label:`科技`,component:(0,Q.jsx)(j2,{})},{name:`SkinOutlined`,label:`时尚`,component:(0,Q.jsx)(k4,{})},{name:`CompassOutlined`,label:`指南`,component:(0,Q.jsx)(Bq,{})},{name:`HeartOutlined`,label:`健康`,component:(0,Q.jsx)(tQ,{})},{name:`CarOutlined`,label:`汽车`,component:(0,Q.jsx)(aK,{})},{name:`CameraOutlined`,label:`相机`,component:(0,Q.jsx)(XG,{})},{name:`CloudOutlined`,label:`云`,component:(0,Q.jsx)(hq,{})},{name:`StarOutlined`,label:`星`,component:(0,Q.jsx)(o3,{})},{name:`TrophyOutlined`,label:`奖杯`,component:(0,Q.jsx)(c6,{})},{name:`ThunderboltOutlined`,label:`闪电`,component:(0,Q.jsx)(G3,{})},{name:`BulbOutlined`,label:`灯泡`,component:(0,Q.jsx)(EG,{})},{name:`CoffeeOutlined`,label:`咖啡`,component:(0,Q.jsx)(Pq,{})},{name:`CrownOutlined`,label:`皇冠`,component:(0,Q.jsx)(dJ,{})},{name:`DashboardOutlined`,label:`仪表`,component:(0,Q.jsx)(yJ,{})},{name:`FlagOutlined`,label:`旗帜`,component:(0,Q.jsx)(qX,{})},{name:`GlobalOutlined`,label:`全球`,component:(0,Q.jsx)(LZ,{})},{name:`GiftOutlined`,label:`礼物`,component:(0,Q.jsx)(AZ,{})},{name:`LaptopOutlined`,label:`笔记本`,component:(0,Q.jsx)(ZQ,{})},{name:`MobileOutlined`,label:`手机`,component:(0,Q.jsx)(u1,{})},{name:`MonitorOutlined`,label:`显示器`,component:(0,Q.jsx)(g1,{})},{name:`PayCircleOutlined`,label:`支付`,component:(0,Q.jsx)(V1,{})},{name:`PictureOutlined`,label:`图片`,component:(0,Q.jsx)(Q1,{})},{name:`PlayCircleOutlined`,label:`播放`,component:(0,Q.jsx)(s0,{})},{name:`SafetyOutlined`,label:`安全`,component:(0,Q.jsx)(B2,{})},{name:`ShoppingOutlined`,label:`商店`,component:(0,Q.jsx)(g4,{})},{name:`SmileOutlined`,label:`笑脸`,component:(0,Q.jsx)(U4,{})},{name:`SoundOutlined`,label:`声音`,component:(0,Q.jsx)(e3,{})},{name:`TagOutlined`,label:`标签`,component:(0,Q.jsx)(M3,{})},{name:`TeamOutlined`,label:`团队`,component:(0,Q.jsx)(H3,{})},{name:`ToolOutlined`,label:`工具`,component:(0,Q.jsx)(Q3,{})},{name:`TruckOutlined`,label:`物流`,component:(0,Q.jsx)(f6,{})},{name:`VideoCameraOutlined`,label:`视频`,component:(0,Q.jsx)(Q6,{})},{name:`WalletOutlined`,label:`钱包`,component:(0,Q.jsx)(n8,{})},{name:`BankOutlined`,label:`银行`,component:(0,Q.jsx)(mU,{})},{name:`BuildOutlined`,label:`建筑`,component:(0,Q.jsx)(_G,{})},{name:`ExperimentOutlined`,label:`实验`,component:(0,Q.jsx)(NY,{})},{name:`HighlightOutlined`,label:`高亮`,component:(0,Q.jsx)(oQ,{})},{name:`IdcardOutlined`,label:`名片`,component:(0,Q.jsx)(SQ,{})},{name:`MedicineBoxOutlined`,label:`医药`,component:(0,Q.jsx)(I$,{})},{name:`ReadOutlined`,label:`阅读`,component:(0,Q.jsx)(r2,{})},{name:`RestOutlined`,label:`休息`,component:(0,Q.jsx)(g2,{})},{name:`SketchOutlined`,label:`钻石`,component:(0,Q.jsx)(T4,{})},{name:`SolutionOutlined`,label:`方案`,component:(0,Q.jsx)(Y4,{})}],uUe=Object.fromEntries(W5.map(e=>[e.name,e.component]));function G5(e){return uUe[e]||(0,Q.jsx)(_H,{})}function dUe(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 fUe=({value:e,onChange:t})=>{let n=W5.find(t=>t.name===e);return(0,Q.jsx)(kM,{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`}})]})})},pUe=()=>{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 YBe()).map(e=>{let{skillItems:t,optionGroups:n}=dUe(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{vP.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 a5({id:o.item.id,...r}),vP.success(`已更新`)):(await a5(r),vP.success(`已添加`)),s({open:!1,item:null}),c.resetFields(),l()}catch(e){if(e?.errorFields)return;vP.error(e?.message||`保存失败`)}finally{a(!1)}},d=async e=>{try{await XBe(e),vP.success(`已删除`),l()}catch(e){vP.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)(MA,{style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(_H,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`行业与技能配置`}),(0,Q.jsxs)(bR,{color:`purple`,children:[e.length,` 个行业`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(sA,{}),onClick:()=>f(),style:{borderRadius:8},children:`添加行业`})]}),(0,Q.jsx)(sR,{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)(bR,{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)(bR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(DM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(ER,{}),onClick:()=>f(t),children:`编辑`}),(0,Q.jsx)(CP,{title:`确定删除该行业?`,onConfirm:()=>d(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(CR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:900}})]}),(0,Q.jsx)(bP,{title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(_H,{}),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)(IN,{placeholder:`例如:ecommerce`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`label`,label:`行业名称`,style:{flex:1},rules:[{required:!0,message:`请输入名称`}],children:(0,Q.jsx)(IN,{placeholder:`例如:电商`,size:`large`})})]}),(0,Q.jsx)(X.Item,{name:`icon`,label:`行业图标`,children:(0,Q.jsx)(fUe,{})}),(0,Q.jsx)(X.Item,{name:`description`,label:`行业描述`,children:(0,Q.jsx)(IN.TextArea,{rows:2,placeholder:`行业描述`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`skills_wentutujie`,label:`文图理解生成视频提示词`,extra:`用于LLM优化视频提示词的系统指令,根据行业特点引导AI理解文案与画面的关系`,children:(0,Q.jsx)(IN.TextArea,{rows:3,placeholder:`请输入文图理解生成视频提示词,例如: + `,disabled:!i})}),(0,Q.jsx)(X.Item,{name:`alipay_gateway`,label:`网关地址`,children:(0,Q.jsx)(IN,{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)(IN,{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)(U2,{}),onClick:async()=>{try{let e=await u.validateFields();t(!0),await iVe({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)}),vP.success(`支付配置已保存`),d()}catch{vP.error(`保存失败`)}finally{t(!1)}},loading:e,size:`large`,style:{borderRadius:8,minWidth:160,height:44,fontSize:15},children:`保存配置`})})]})},{Option:U5}=Sb,{RangePicker:cUe}=sM,lUe=()=>{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([aVe(u),oVe({...u,phone:u.phone,page:i,pageSize:o})]);r({...e,recent:n.items||[]}),l(n.total)}catch{vP.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`)}),a(1)},h=async e=>{try{t(!0),await sVe(e),vP.success(`退款成功`),await f()}catch(e){vP.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)(FK,{})},pending:{color:`gold`,label:`待支付`,icon:(0,Q.jsx)(rM,{})},cancelled:{color:`default`,label:`已取消`,icon:(0,Q.jsx)(sq,{})},refunded:{color:`red`,label:`已退款`,icon:(0,Q.jsx)(b6,{})}},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:`phone`,key:`phone`,width:120,render:e=>e||`-`},{title:`支付方式`,dataIndex:`paymentMethod`,key:`paymentMethod`,width:100,render:e=>{let t=v[e]||{color:`default`,label:e};return(0,Q.jsx)(bR,{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)(bR,{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)(CP,{title:`确认要退款该订单吗?`,description:`退款后积分会扣除,金额会原路返回`,onConfirm:()=>h(t.orderNo),okText:`确认`,cancelText:`取消`,children:(0,Q.jsx)(XS,{type:`link`,danger:!0,size:`small`,icon:(0,Q.jsx)(b6,{}),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:M8.default,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(zP,{gutter:[16,16],style:{marginBottom:24},children:[(0,Q.jsx)(tj,{xs:24,sm:12,lg:12,children:(0,Q.jsxs)(MA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsx)(HP,{title:`今日收入`,value:n.today.paidAmount,precision:2,prefix:(0,Q.jsx)(XJ,{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)(tj,{xs:24,sm:12,lg:12,children:(0,Q.jsxs)(MA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsx)(HP,{title:`本月累计`,value:E.paidAmount,precision:2,prefix:(0,Q.jsx)(XJ,{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)(MA,{variant:`outlined`,style:{borderRadius:12,border:`1px solid #f0f0f5`,marginBottom:16},title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(XJ,{}),`订单状态分布`]}),children:(0,Q.jsx)(zP,{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)(tj,{span:6,children:(0,Q.jsxs)(`div`,{style:{padding:16,borderRadius:10,background:`#fafbff`,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(bR,{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)(MA,{bordered:!1,style:{borderRadius:12,border:`1px solid #f0f0f5`},title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(XJ,{}),`订单列表`]}),children:[(0,Q.jsxs)(zP,{gutter:[16,16],style:{marginBottom:24},children:[(0,Q.jsxs)(tj,{xs:24,sm:8,md:4,children:[(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:4},children:`支付方式`}),(0,Q.jsxs)(Sb,{placeholder:`全部`,allowClear:!0,style:{width:`100%`},value:u.paymentMethod,onChange:e=>{d(t=>({...t,paymentMethod:e})),a(1)},children:[(0,Q.jsx)(U5,{value:`alipay`,children:`支付宝`}),(0,Q.jsx)(U5,{value:`wechat`,children:`微信`})]})]}),(0,Q.jsxs)(tj,{xs:24,sm:8,md:4,children:[(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:4},children:`状态`}),(0,Q.jsxs)(Sb,{placeholder:`全部`,allowClear:!0,style:{width:`100%`},value:u.status,onChange:e=>{d(t=>({...t,status:e})),a(1)},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)(tj,{xs:24,sm:8,md:5,children:[(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:4},children:`手机号`}),(0,Q.jsx)(IN,{placeholder:`搜索手机号`,allowClear:!0,value:u.phone,onChange:e=>d(t=>({...t,phone:e.target.value})),onPressEnter:()=>{a(1),f()},suffix:(0,Q.jsx)(_b,{style:{color:`#94a3b8`}})})]}),(0,Q.jsxs)(tj,{xs:24,sm:12,md:7,children:[(0,Q.jsx)(Z.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:4},children:`日期范围`}),(0,Q.jsx)(cUe,{style:{width:`100%`},value:[(0,QS.default)(u.startDate),(0,QS.default)(u.endDate)],onChange:g})]}),(0,Q.jsx)(tj,{xs:24,sm:12,md:4,style:{display:`flex`,alignItems:`flex-end`},children:(0,Q.jsx)(XS,{icon:(0,Q.jsx)(IP,{}),onClick:m,style:{marginBottom:0},children:`重置筛选`})})]}),(0,Q.jsx)(sR,{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)(p4,{})},{name:`BookOutlined`,label:`书籍`,component:(0,Q.jsx)(dW,{})},{name:`HomeOutlined`,label:`房产`,component:(0,Q.jsx)(fQ,{})},{name:`FireOutlined`,label:`火`,component:(0,Q.jsx)(UX,{})},{name:`RocketOutlined`,label:`科技`,component:(0,Q.jsx)(j2,{})},{name:`SkinOutlined`,label:`时尚`,component:(0,Q.jsx)(k4,{})},{name:`CompassOutlined`,label:`指南`,component:(0,Q.jsx)(Bq,{})},{name:`HeartOutlined`,label:`健康`,component:(0,Q.jsx)(tQ,{})},{name:`CarOutlined`,label:`汽车`,component:(0,Q.jsx)(aK,{})},{name:`CameraOutlined`,label:`相机`,component:(0,Q.jsx)(XG,{})},{name:`CloudOutlined`,label:`云`,component:(0,Q.jsx)(hq,{})},{name:`StarOutlined`,label:`星`,component:(0,Q.jsx)(o3,{})},{name:`TrophyOutlined`,label:`奖杯`,component:(0,Q.jsx)(c6,{})},{name:`ThunderboltOutlined`,label:`闪电`,component:(0,Q.jsx)(G3,{})},{name:`BulbOutlined`,label:`灯泡`,component:(0,Q.jsx)(EG,{})},{name:`CoffeeOutlined`,label:`咖啡`,component:(0,Q.jsx)(Pq,{})},{name:`CrownOutlined`,label:`皇冠`,component:(0,Q.jsx)(dJ,{})},{name:`DashboardOutlined`,label:`仪表`,component:(0,Q.jsx)(yJ,{})},{name:`FlagOutlined`,label:`旗帜`,component:(0,Q.jsx)(qX,{})},{name:`GlobalOutlined`,label:`全球`,component:(0,Q.jsx)(LZ,{})},{name:`GiftOutlined`,label:`礼物`,component:(0,Q.jsx)(AZ,{})},{name:`LaptopOutlined`,label:`笔记本`,component:(0,Q.jsx)(ZQ,{})},{name:`MobileOutlined`,label:`手机`,component:(0,Q.jsx)(u1,{})},{name:`MonitorOutlined`,label:`显示器`,component:(0,Q.jsx)(g1,{})},{name:`PayCircleOutlined`,label:`支付`,component:(0,Q.jsx)(V1,{})},{name:`PictureOutlined`,label:`图片`,component:(0,Q.jsx)(Q1,{})},{name:`PlayCircleOutlined`,label:`播放`,component:(0,Q.jsx)(s0,{})},{name:`SafetyOutlined`,label:`安全`,component:(0,Q.jsx)(B2,{})},{name:`ShoppingOutlined`,label:`商店`,component:(0,Q.jsx)(g4,{})},{name:`SmileOutlined`,label:`笑脸`,component:(0,Q.jsx)(U4,{})},{name:`SoundOutlined`,label:`声音`,component:(0,Q.jsx)(e3,{})},{name:`TagOutlined`,label:`标签`,component:(0,Q.jsx)(M3,{})},{name:`TeamOutlined`,label:`团队`,component:(0,Q.jsx)(H3,{})},{name:`ToolOutlined`,label:`工具`,component:(0,Q.jsx)(Q3,{})},{name:`TruckOutlined`,label:`物流`,component:(0,Q.jsx)(f6,{})},{name:`VideoCameraOutlined`,label:`视频`,component:(0,Q.jsx)(Q6,{})},{name:`WalletOutlined`,label:`钱包`,component:(0,Q.jsx)(n8,{})},{name:`BankOutlined`,label:`银行`,component:(0,Q.jsx)(mU,{})},{name:`BuildOutlined`,label:`建筑`,component:(0,Q.jsx)(_G,{})},{name:`ExperimentOutlined`,label:`实验`,component:(0,Q.jsx)(NY,{})},{name:`HighlightOutlined`,label:`高亮`,component:(0,Q.jsx)(oQ,{})},{name:`IdcardOutlined`,label:`名片`,component:(0,Q.jsx)(SQ,{})},{name:`MedicineBoxOutlined`,label:`医药`,component:(0,Q.jsx)(I$,{})},{name:`ReadOutlined`,label:`阅读`,component:(0,Q.jsx)(r2,{})},{name:`RestOutlined`,label:`休息`,component:(0,Q.jsx)(g2,{})},{name:`SketchOutlined`,label:`钻石`,component:(0,Q.jsx)(T4,{})},{name:`SolutionOutlined`,label:`方案`,component:(0,Q.jsx)(Y4,{})}],uUe=Object.fromEntries(W5.map(e=>[e.name,e.component]));function G5(e){return uUe[e]||(0,Q.jsx)(_H,{})}function dUe(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 fUe=({value:e,onChange:t})=>{let n=W5.find(t=>t.name===e);return(0,Q.jsx)(kM,{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`}})]})})},pUe=()=>{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 YBe()).map(e=>{let{skillItems:t,optionGroups:n}=dUe(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{vP.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 a5({id:o.item.id,...r}),vP.success(`已更新`)):(await a5(r),vP.success(`已添加`)),s({open:!1,item:null}),c.resetFields(),l()}catch(e){if(e?.errorFields)return;vP.error(e?.message||`保存失败`)}finally{a(!1)}},d=async e=>{try{await XBe(e),vP.success(`已删除`),l()}catch(e){vP.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)(MA,{style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(_H,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`行业与技能配置`}),(0,Q.jsxs)(bR,{color:`purple`,children:[e.length,` 个行业`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(sA,{}),onClick:()=>f(),style:{borderRadius:8},children:`添加行业`})]}),(0,Q.jsx)(sR,{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)(bR,{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)(bR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(DM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(ER,{}),onClick:()=>f(t),children:`编辑`}),(0,Q.jsx)(CP,{title:`确定删除该行业?`,onConfirm:()=>d(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(CR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:900}})]}),(0,Q.jsx)(bP,{title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(_H,{}),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)(IN,{placeholder:`例如:ecommerce`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`label`,label:`行业名称`,style:{flex:1},rules:[{required:!0,message:`请输入名称`}],children:(0,Q.jsx)(IN,{placeholder:`例如:电商`,size:`large`})})]}),(0,Q.jsx)(X.Item,{name:`icon`,label:`行业图标`,children:(0,Q.jsx)(fUe,{})}),(0,Q.jsx)(X.Item,{name:`description`,label:`行业描述`,children:(0,Q.jsx)(IN.TextArea,{rows:2,placeholder:`行业描述`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`skills_wentutujie`,label:`文图理解生成视频提示词`,extra:`用于LLM优化视频提示词的系统指令,根据行业特点引导AI理解文案与画面的关系`,children:(0,Q.jsx)(IN.TextArea,{rows:3,placeholder:`请输入文图理解生成视频提示词,例如: 你是一位专业的电商视频文案专家,擅长将产品卖点转化为视觉语言`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`skills_wentutujie_image`,label:`文图理解生成图片提示词`,extra:`用于LLM优化图片提示词的系统指令,根据行业特点引导AI理解文案与画面的关系`,children:(0,Q.jsx)(IN.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)(IN,{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)(i1,{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)(sA,{}),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)(iF,{})}),(0,Q.jsx)(X.Item,{name:`sort_order`,label:`排序`,initialValue:0,style:{flex:1},children:(0,Q.jsx)(IN,{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 mUe=()=>{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 ZBe()).map(e=>({...e,supportedRatios:K5(e.supportedRatios),supportedResolutions:K5(e.supportedResolutions),supportedDurations:K5(e.supportedDurations)})))}catch{vP.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 o5({id:i.engine.id,...t}),vP.success(`已更新`)):(await o5(t),vP.success(`已添加`)),a({open:!1,engine:null}),o.resetFields(),s()}catch(e){if(e?.errorFields)return;vP.error(e?.message||`保存失败`)}},l=async e=>{try{await QBe(e),vP.success(`已删除`),s()}catch{vP.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)(MA,{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)(DM,{children:[(0,Q.jsx)(s0,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`视频引擎配置`}),(0,Q.jsxs)(bR,{color:`purple`,children:[e.length,` 个引擎`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(sA,{}),onClick:()=>u(),style:{borderRadius:8},children:`添加引擎`})]}),(0,Q.jsx)(sR,{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)(s0,{})}),(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)(DM,{size:2,wrap:!0,children:e.map(e=>(0,Q.jsx)(bR,{children:e},e))})},{title:`支持分辨率`,dataIndex:`supportedResolutions`,width:150,render:e=>(0,Q.jsx)(DM,{size:2,wrap:!0,children:e.map(e=>(0,Q.jsx)(bR,{color:`blue`,children:e},e))})},{title:`支持时长`,dataIndex:`supportedDurations`,width:120,render:e=>(0,Q.jsx)(bR,{color:`orange`,children:e?.length?`${Math.min(...e)}-${Math.max(...e)}s`:`-`})},{title:`最大图片`,dataIndex:`maxImageCount`,width:100,render:e=>(0,Q.jsxs)(bR,{color:`purple`,children:[e,` 张`]})},{title:`最大视频`,dataIndex:`maxVideoCount`,width:100,render:e=>(0,Q.jsxs)(bR,{color:`cyan`,children:[e,` 个`]})},{title:`最大音频`,dataIndex:`maxAudioCount`,width:100,render:e=>(0,Q.jsxs)(bR,{color:e>0?`geekblue`:`default`,children:[e||0,` 段`]})},{title:`首尾帧`,dataIndex:`supportsFirstLastFrame`,width:90,render:e=>(0,Q.jsx)(bR,{color:e?`green`:`default`,children:e?`支持`:`不支持`})},{title:`全能参考`,dataIndex:`supportsUniversalReference`,width:100,render:e=>(0,Q.jsx)(bR,{color:e?`purple`:`default`,children:e?`支持`:`不支持`})},{title:`状态`,dataIndex:`isActive`,width:80,render:e=>(0,Q.jsx)(bR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(DM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(ER,{}),onClick:()=>u(t),children:`编辑`}),(0,Q.jsx)(CP,{title:`确定删除?`,onConfirm:()=>l(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(CR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:1200}})]}),(0,Q.jsx)(bP,{title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(s0,{}),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)(IN,{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)(IN,{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)(IN.Password,{placeholder:`sk-****`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`modelName`,label:`模型名称`,children:(0,Q.jsx)(IN,{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)(IN,{type:`number`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`maxImageCount`,label:`最大图片数量`,style:{flex:1},children:(0,Q.jsx)(IN,{type:`number`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`maxVideoCount`,label:`最大视频数量`,style:{flex:1},children:(0,Q.jsx)(IN,{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)(IN,{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)(iF,{checkedChildren:`支持`,unCheckedChildren:`不支持`})}),(0,Q.jsx)(X.Item,{name:`supportsUniversalReference`,label:`全能参考模式`,valuePropName:`checked`,style:{paddingTop:30,flex:1},children:(0,Q.jsx)(iF,{checkedChildren:`支持`,unCheckedChildren:`不支持`})}),(0,Q.jsx)(X.Item,{name:`isActive`,label:`启用状态`,valuePropName:`checked`,style:{paddingTop:30,flex:1},children:(0,Q.jsx)(iF,{})})]}),(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 hUe(e){if(Array.isArray(e))return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return[]}function gUe(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`],_Ue=()=>{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 $Be()).map(e=>({...e,supportedModels:hUe(e.supportedModels),supportedSizes:gUe(e.supportedSizes)})))}catch{vP.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 s5({id:i.engine.id,...n}),vP.success(`已更新`)):(await s5(n),vP.success(`已添加`)),a({open:!1,engine:null}),o.resetFields(),s()}catch(e){if(e?.errorFields)return;vP.error(e?.message||`保存失败`)}},l=async e=>{try{await eVe(e),vP.success(`已删除`),s()}catch{vP.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)(MA,{style:{borderRadius:12,border:`1px solid #f0f0f5`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:16},children:[(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(Q1,{style:{fontSize:18,color:`#10b981`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`图片引擎配置`}),(0,Q.jsxs)(bR,{color:`green`,children:[e.length,` 个引擎`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(sA,{}),onClick:()=>u(),style:{borderRadius:8},children:`添加引擎`})]}),(0,Q.jsx)(sR,{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)(Q1,{})}),(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)(DM,{size:2,wrap:!0,children:n.map(e=>(0,Q.jsxs)(bR,{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)(DM,{size:2,wrap:!0,children:n.map(e=>(0,Q.jsxs)(bR,{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)(DM,{size:2,wrap:!0,children:n.map(e=>(0,Q.jsxs)(bR,{color:`purple`,children:[e,` `,t.supportedSizes[`4K`][e]]},e))})}},{title:`最大图片`,dataIndex:`maxImageCount`,width:100,render:e=>(0,Q.jsxs)(bR,{color:`purple`,children:[e,` 张`]})},{title:`状态`,dataIndex:`isActive`,width:80,render:e=>(0,Q.jsx)(bR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(DM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(ER,{}),onClick:()=>u(t),children:`编辑`}),(0,Q.jsx)(CP,{title:`确定删除?`,onConfirm:()=>l(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(CR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:1e3}})]}),(0,Q.jsx)(bP,{title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(Q1,{}),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)(IN,{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)(IN,{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)(IN.Password,{placeholder:`sk-****`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`modelName`,label:`默认模型`,children:(0,Q.jsx)(IN,{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)(YA.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)(YA,{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)(IN,{type:`number`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`generateUrl`,label:`生成接口地址`,children:(0,Q.jsx)(IN,{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)(iF,{})})]})]})})]})},vUe=[`2K`,`4K`],yUe=[`480p`,`720p`,`1080p`],bUe=()=>{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([tVe(),e5(),MVe()]),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{vP.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:vUe).map(e=>({value:e,label:e}))}let e=y?.supportedResolutions||[];return(e.length?e:yUe).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 c5({id:o.ratio.id,...t}),vP.success(`已更新`)):(await c5(t),vP.success(`已添加`)),s({open:!1,ratio:null}),c.resetFields(),_()}catch(e){if(e?.errorFields)return;vP.error(e?.message||`保存失败`)}},w=async e=>{try{await nVe(e),vP.success(`已删除`),_()}catch{vP.error(`删除失败`)}},T=async()=>{if(d){m(!0);try{await t5(d.id,String(l)),vP.success(`文字积分费率已更新`)}catch(e){vP.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)(MA,{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)(DM,{children:[(0,Q.jsx)(aZ,{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)(DM.Compact,{style:{width:160},children:[(0,Q.jsx)(Tj,{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)(MA,{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)(DM,{children:[(0,Q.jsx)(FG,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`积分比例配置`}),(0,Q.jsxs)(bR,{color:`purple`,children:[e.length,` 条规则`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(sA,{}),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)(sR,{columns:[{title:`类型`,dataIndex:`genType`,width:80,render:e=>(0,Q.jsx)(bR,{color:e===`image`?`cyan`:`orange`,children:e===`image`?`图片`:`视频`})},{title:`引擎`,dataIndex:`modelConfigId`,width:180,render:(e,t)=>(0,Q.jsx)(bR,{color:t.genType===`image`?`cyan`:`purple`,children:x(e,t.genType)})},{title:`分辨率/尺寸`,dataIndex:`resolution`,width:110,render:e=>(0,Q.jsx)(bR,{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)(DM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(ER,{}),onClick:()=>E(t),children:`编辑`}),(0,Q.jsx)(CP,{title:`确定删除?`,onConfirm:()=>w(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(CR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:i,pagination:!1,scroll:{x:1500}})]}),(0,Q.jsx)(bP,{title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(FG,{}),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)(Tj,{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)(Tj,{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)(Tj,{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)(Tj,{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)(Tj,{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)(Tj,{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)(Tj,{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)(Tj,{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)(Tj,{min:0,max:50,style:{width:`100%`},size:`large`})})]})]})]})})]})},Y5={HomeOutlined:(0,Q.jsx)(fQ,{}),PlayCircleOutlined:(0,Q.jsx)(s0,{}),WalletOutlined:(0,Q.jsx)(n8,{}),RobotOutlined:(0,Q.jsx)(O2,{}),SettingOutlined:(0,Q.jsx)(a4,{}),BellOutlined:(0,Q.jsx)(VU,{}),UserOutlined:(0,Q.jsx)(B6,{}),AppstoreOutlined:(0,Q.jsx)(_H,{}),FileTextOutlined:(0,Q.jsx)(jM,{}),StarOutlined:(0,Q.jsx)(o3,{}),HeartOutlined:(0,Q.jsx)(tQ,{}),CameraOutlined:(0,Q.jsx)(XG,{}),DashboardOutlined:(0,Q.jsx)(yJ,{}),CalculatorOutlined:(0,Q.jsx)(FG,{}),DollarOutlined:(0,Q.jsx)(XJ,{}),GiftOutlined:(0,Q.jsx)(AZ,{}),ThunderboltOutlined:(0,Q.jsx)(G3,{}),FireOutlined:(0,Q.jsx)(UX,{}),CloudOutlined:(0,Q.jsx)(hq,{}),SmileOutlined:(0,Q.jsx)(U4,{}),TrophyOutlined:(0,Q.jsx)(c6,{}),RocketOutlined:(0,Q.jsx)(j2,{}),BulbOutlined:(0,Q.jsx)(EG,{}),CodeOutlined:(0,Q.jsx)(wq,{}),PictureOutlined:(0,Q.jsx)(Q1,{}),VideoCameraOutlined:(0,Q.jsx)(Q6,{}),AudioOutlined:(0,Q.jsx)(qH,{}),MailOutlined:(0,Q.jsx)(j$,{}),PhoneOutlined:(0,Q.jsx)(G1,{}),GlobalOutlined:(0,Q.jsx)(LZ,{}),ShoppingCartOutlined:(0,Q.jsx)(p4,{}),TeamOutlined:(0,Q.jsx)(H3,{}),BarChartOutlined:(0,Q.jsx)(bU,{}),PieChartOutlined:(0,Q.jsx)(t0,{}),LineChartOutlined:(0,Q.jsx)(d$,{}),SecurityScanOutlined:(0,Q.jsx)(Q2,{}),ApiOutlined:(0,Q.jsx)($V,{}),DatabaseOutlined:(0,Q.jsx)(CJ,{}),CloudServerOutlined:(0,Q.jsx)(_q,{}),MenuOutlined:(0,Q.jsx)(q$,{})},xUe=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`,``)]})})),SUe={page:`blue`,group:`purple`},CUe={page:`页面`,group:`分组`},wUe=()=>{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 l5())}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 u5({...t,id:o.menu.id}):await u5(t),vP.success(o.menu?.id?`菜单已更新`:`菜单已添加`),s({open:!1,menu:null}),c.resetFields(),l()}catch{}},d=async e=>{try{await fVe(e),vP.success(`菜单已删除`),l()}catch(e){vP.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)(bR,{color:SUe[e]||`default`,children:CUe[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)(bR,{color:`green`,children:`默认`}):(0,Q.jsx)(Z.Text,{type:`secondary`,children:`-`})}]:[],{title:`操作`,key:`action`,width:150,render:(e,t)=>(0,Q.jsxs)(DM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(ER,{}),onClick:()=>f(t),children:`编辑`}),(0,Q.jsx)(CP,{title:`确定删除该菜单?`,onConfirm:()=>d(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(CR,{}),children:`删除`})})]})}];return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(MA,{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)(DM,{children:[(0,Q.jsx)(q$,{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)(sA,{}),onClick:()=>f(),style:{borderRadius:8},children:`添加菜单`})]}),(0,Q.jsx)(AA,{activeKey:i,onChange:a,items:[{key:`frontend`,label:`前台菜单`},{key:`admin`,label:`后台菜单`}]}),(0,Q.jsx)(sR,{columns:v,dataSource:h,rowKey:`id`,loading:n,pagination:!1,scroll:{x:900}})]}),(0,Q.jsx)(bP,{title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(q$,{}),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)(IN,{placeholder:`例如:我的项目`,size:`large`})}),(0,Q.jsx)(X.Item,{name:`path`,label:`路由路径`,tooltip:`分组类型可留空`,children:(0,Q.jsx)(IN,{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:xUe})}),(0,Q.jsx)(X.Item,{name:`sortOrder`,label:`排序`,style:{flex:1},children:(0,Q.jsx)(Tj,{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)(iF,{})}),(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)(iF,{})})})]})})]})},TUe={normal:`blue`,gift:`green`,promo:`purple`},EUe={normal:`常规`,gift:`赠送`,promo:`促销`},DUe=()=>{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 vVe()).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{vP.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 f5({id:i.item.id,...t}),vP.success(`已更新`)):(await f5(t),vP.success(`已添加`)),a({open:!1,item:null}),o.resetFields(),s()}catch{}},l=async e=>{try{await yVe(e),vP.success(`已删除`),s()}catch(e){vP.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)(MA,{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)(DM,{children:[(0,Q.jsx)(AZ,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`充值套餐管理`}),(0,Q.jsxs)(bR,{color:`purple`,children:[e.length,` 个套餐`]})]}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(sA,{}),onClick:()=>u(),style:{borderRadius:8},children:`添加套餐`})]}),(0,Q.jsx)(sR,{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)(bR,{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)(bR,{color:TUe[e]||`default`,children:EUe[e]||e})},{title:`状态`,dataIndex:`isActive`,width:80,render:e=>(0,Q.jsx)(bR,{color:e?`green`:`default`,children:e?`启用`:`停用`})},{title:`操作`,key:`action`,width:150,fixed:`right`,render:(e,t)=>(0,Q.jsxs)(DM,{size:4,children:[(0,Q.jsx)(XS,{type:`link`,size:`small`,icon:(0,Q.jsx)(ER,{}),onClick:()=>u(t),children:`编辑`}),(0,Q.jsx)(CP,{title:`确定删除?`,onConfirm:()=>l(t.id),children:(0,Q.jsx)(XS,{type:`link`,size:`small`,danger:!0,icon:(0,Q.jsx)(CR,{}),children:`删除`})})]})}],dataSource:e,rowKey:`id`,loading:n,pagination:!1,scroll:{x:900}})]}),(0,Q.jsx)(bP,{title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(AZ,{}),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)(IN,{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)(Tj,{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)(Tj,{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)(Tj,{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)(IN,{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)(iF,{})}),(0,Q.jsx)(X.Item,{name:`isGift`,label:`是否赠送`,valuePropName:`checked`,initialValue:!1,style:{flex:1},children:(0,Q.jsx)(iF,{})}),(0,Q.jsx)(X.Item,{name:`sortOrder`,label:`排序`,initialValue:0,style:{flex:1},children:(0,Q.jsx)(Tj,{size:`large`,style:{width:`100%`}})})]})]})})]})},OUe={POST:`green`,PUT:`blue`,DELETE:`red`},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=async e=>{a(!0);try{let n=await bVe(e||o);t(n.items||[]),r(n.total||0)}catch{vP.error(`加载操作日志失败`)}finally{a(!1)}};return(0,C.useEffect)(()=>{c()},[]),(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(MA,{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)(DM,{children:[(0,Q.jsx)(lQ,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`操作日志`})]}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(IP,{}),onClick:()=>c(),children:`刷新`})]}),(0,Q.jsx)(sR,{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)(bR,{color:OUe[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}})]})})},AUe=()=>{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 xVe(e||o);t(n.items||[]),r(n.total||0)}catch{vP.error(`加载应用管理列表失败`)}finally{a(!1)}},y=async()=>{try{let e=await g.validateFields();await SVe({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}),vP.success(`创建成功`),l(!1),g.resetFields(),v()}catch(e){vP.error(e?.message||`创建失败`)}},b=async e=>{try{h(await p5(e)),d(!0)}catch(e){vP.error(e?.message||`获取详情失败`)}},x=async e=>{try{let t=await p5(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){vP.error(e?.message||`获取详情失败`)}},S=async()=>{if(m)try{let e=await _.validateFields();await CVe(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}),vP.success(`更新成功`),p(!1),_.resetFields(),v()}catch(e){vP.error(e?.message||`更新失败`)}},w=e=>{bP.confirm({title:`确认删除`,content:`确定要删除这个应用管理吗?`,okText:`删除`,okType:`danger`,cancelText:`取消`,onOk:async()=>{try{await wVe(e),vP.success(`删除成功`),v()}catch(e){vP.error(e?.message||`删除失败`)}}})};return(0,C.useEffect)(()=>{v()},[]),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(MA,{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)(DM,{children:[(0,Q.jsx)(q$,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`应用管理列表`})]}),(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(IP,{}),onClick:()=>v(),children:`刷新`}),(0,Q.jsx)(XS,{type:`primary`,icon:(0,Q.jsx)(sA,{}),onClick:()=>l(!0),children:`创建`})]})]}),(0,Q.jsx)(sR,{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)(bR,{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)(DM,{children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(DN,{}),size:`small`,onClick:()=>b(t.id),children:`详情`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(ER,{}),size:`small`,onClick:()=>x(t.id),children:`更新`}),(0,Q.jsx)(XS,{icon:(0,Q.jsx)(CR,{}),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)(bP,{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)(IN,{placeholder:`请输入应用ID`})}),(0,Q.jsx)(X.Item,{name:`secret`,label:`应用密钥`,rules:[{required:!0,message:`请输入应用密钥`},{max:256,message:`应用密钥不能超过256个字符`}],children:(0,Q.jsx)(IN,{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)(Tj,{min:1,placeholder:`应用最大可以授权多少个用户`})}),(0,Q.jsx)(X.Item,{name:`auth_url`,label:`应用授权链接`,children:(0,Q.jsx)(IN,{placeholder:`请输入应用授权链接`})}),(0,Q.jsx)(X.Item,{name:`company`,label:`应用归属公司名称`,rules:[{max:256,message:`公司名称不能超过256个字符`}],children:(0,Q.jsx)(IN,{placeholder:`请输入应用归属公司名称`})})]})}),(0,Q.jsx)(bP,{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)(bP,{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)(IN,{placeholder:`请输入应用ID`})}),(0,Q.jsx)(X.Item,{name:`secret`,label:`应用密钥`,rules:[{required:!0,message:`请输入应用密钥`},{max:256,message:`应用密钥不能超过256个字符`}],children:(0,Q.jsx)(IN,{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)(Tj,{min:1,placeholder:`应用最大可以授权多少个用户`})}),(0,Q.jsx)(X.Item,{name:`authUrl`,label:`应用授权链接`,children:(0,Q.jsx)(IN,{placeholder:`请输入应用授权链接`})}),(0,Q.jsx)(X.Item,{name:`company`,label:`应用归属公司名称`,rules:[{max:256,message:`公司名称不能超过256个字符`}],children:(0,Q.jsx)(IN,{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)(rM,{})},generating:{color:`warning`,text:`生成中`,icon:(0,Q.jsx)(fm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,Q.jsx)(FK,{})},failed:{color:`error`,text:`失败`,icon:(0,Q.jsx)(sq,{})}},$5={image:{text:`图片`,color:`purple`,icon:(0,Q.jsx)(dX,{})},video:{text:`视频`,color:`geekblue`,icon:(0,Q.jsx)(Q6,{})}},jUe=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?jUe(t)?t:X5?`${X5}${t.startsWith(`/`)?t:`/${t}`}`:t.startsWith(`/`)?t:`/${t}`:``},MUe=e=>e?e.length>12?`${e.slice(0,8)}...`:e:`-`,n7=e=>e?E5(e):`-`,NUe=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},PUe=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:NUe(t)?`-`:t})]}),FUe=()=>{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 kVe({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{vP.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){vP.warning(`${t}链接为空,暂无法查看`);return}if(e7(e)){vP.warning(`本地临时素材已失效,暂无法查看`);return}if(r7(e)){vP.warning(`${t}链接已超时,请刷新列表或重新搜索后再查看`);return}window.open(t7(e),`_blank`,`noopener,noreferrer`)},P=()=>{if(h?.videoUrl){if(r7(h.videoUrl)){j({video:`invalid`}),vP.warning(`视频链接已超时,请刷新列表或重新搜索后再查看`);return}b(!0),window.setTimeout(()=>{x.current?.play().catch(()=>{b(!1),j({video:`invalid`}),vP.warning(`视频播放失败,请确认资源链接是否仍然有效`)})},0)}},F=async(e,t,n)=>{w(e);try{await AVe(e,t,n),vP.success(`状态已更新`),D()}catch(e){vP.error(e?.message||`更新失败`)}finally{w(null)}},I=async()=>{if(T){w(T.record.id);try{await jVe(T.record.id,T.ratio,T.resolution,T.image_size),vP.success(`已提交${T.record.genType===`video`?`视频`:`图片`}生成`),E(null),D()}catch(e){vP.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:MUe(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)(bR,{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)(bR,{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)(DM,{size:4,wrap:!0,children:[t.duration?(0,Q.jsxs)(bR,{children:[t.duration,`s`]}):null,t.aspectRatio?(0,Q.jsx)(bR,{children:t.aspectRatio}):null,t.resolution?(0,Q.jsx)(bR,{children:t.resolution}):null]}):(0,Q.jsx)(bR,{color:`default`,children:`待配置`}):t.imageSize||t.imageProportion||t.imagePx?(0,Q.jsxs)(DM,{size:4,wrap:!0,children:[t.imageSize?(0,Q.jsx)(bR,{children:t.imageSize}):null,t.imageProportion?(0,Q.jsx)(bR,{children:t.imageProportion}):null,t.imagePx?(0,Q.jsx)(bR,{children:t.imagePx}):null]}):(0,Q.jsx)(bR,{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)(bR,{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)(DM,{size:4,wrap:!0,children:[(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(DN,{}),onClick:()=>k(t),children:`详情`}),t.status===`generating`?(0,Q.jsx)(XS,{size:`small`,danger:!0,loading:S===t.id,onClick:()=>{bP.confirm({title:`确认操作`,icon:(0,Q.jsx)(EY,{}),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:()=>{bP.confirm({title:`确认操作`,icon:(0,Q.jsx)(EY,{}),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)(s0,{}),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=PUe(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)(s0,{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)(MA,{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)(DM,{children:[(0,Q.jsx)(Q6,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`生成记录管理`}),(0,Q.jsxs)(bR,{color:`purple`,children:[n,` 条记录`]})]}),(0,Q.jsxs)(DM,{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)(IN,{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)(sR,{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)(bP,{title:(0,Q.jsxs)(DM,{children:[h?.genType===`video`?(0,Q.jsx)(Q6,{}):(0,Q.jsx)(dX,{}),(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)(DM,{size:4,wrap:!0,children:[R?(0,Q.jsx)(bR,{color:R.color,icon:R.icon,children:R.text}):null,z?(0,Q.jsx)(bR,{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)(bR,{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)(bR,{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)(bP,{title:(0,Q.jsxs)(DM,{children:[T&&(T.record.genType===`video`?(0,Q.jsx)(s0,{}):(0,Q.jsx)(dX,{})),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:IUe}=sM,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)(rM,{})},generating:{color:`warning`,text:`生成中`,icon:(0,Q.jsx)(fm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,Q.jsx)(FK,{})},failed:{color:`error`,text:`失败`,icon:(0,Q.jsx)(sq,{})}},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)(dX,{})},video:{text:`视频`,color:`geekblue`,icon:(0,Q.jsx)(Q6,{})}},LUe=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?LUe(t)?t:u7?`${u7}${t.startsWith(`/`)?t:`/${t}`}`:t.startsWith(`/`)?t:`/${t}`:``},RUe=e=>e?e.length>12?`${e.slice(0,8)}...`:e:`-`,y7=e=>e?E5(e):`-`,zUe=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:zUe(t)?`-`:t})]}),O7=()=>(0,QS.default)().startOf(`day`),k7=()=>(0,QS.default)().endOf(`day`),BUe=()=>{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 NVe({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){vP.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`}),vP.warning(`视频链接已超时,请刷新列表或重新搜索后再查看`);return}I(!0),window.setTimeout(()=>{L.current?.play().catch(()=>{I(!1),ee({video:`invalid`}),vP.warning(`视频播放失败,请确认资源链接是否仍然有效`)})},0)}},re=(e,t=`素材`)=>{if(!e){vP.warning(`${t}链接为空,暂无法查看`);return}if(_7(e)){vP.warning(`本地临时素材已失效,暂无法查看`);return}if(b7(e)){vP.warning(`${t}链接已超时,请刷新列表或重新搜索后再查看`);return}window.open(v7(e),`_blank`,`noopener,noreferrer`)},ie=(e,t,n)=>{if(_7(e)){vP.warning(`本地临时素材已失效,暂无法查看`);return}if(b7(e)){vP.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:RUe(t.userId)})]})},{title:`类型`,dataIndex:`genType`,width:90,render:e=>{let t=g7[e]||{text:e||`-`,color:`default`,icon:null};return(0,Q.jsx)(bR,{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)(bR,{icon:(0,Q.jsx)(O2,{}),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)(DM,{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)(Q6,{style:{color:`#6366f1`}}):r===`audio`?(0,Q.jsx)(qH,{style:{color:`#f59e0b`}}):(0,Q.jsx)(dX,{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)(s0,{}),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)(dX,{}),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)(DM,{size:4,wrap:!0,children:[t.duration?(0,Q.jsxs)(bR,{children:[t.duration,`s`]}):null,t.aspectRatio?(0,Q.jsx)(bR,{children:t.aspectRatio}):null,t.resolution?(0,Q.jsx)(bR,{children:t.resolution}):null]}):(0,Q.jsx)(bR,{color:`default`,children:`无参数`}):t.imageSize||t.imageProportion||t.imagePx?(0,Q.jsxs)(DM,{size:4,wrap:!0,children:[t.imageSize?(0,Q.jsx)(bR,{children:t.imageSize}):null,t.imageProportion?(0,Q.jsx)(bR,{children:t.imageProportion}):null,t.imagePx?(0,Q.jsx)(bR,{children:t.imagePx}):null]}):(0,Q.jsx)(bR,{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)(bR,{color:t.color,icon:t.icon,children:t.text})}},{title:`阶段`,dataIndex:`pipelineStage`,width:120,render:e=>(0,Q.jsx)(bR,{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)(DN,{}),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)(s0,{}),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)(s0,{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)(MA,{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)(DM,{children:[(0,Q.jsx)(s0,{style:{fontSize:18,color:`#6366f1`}}),(0,Q.jsx)(Z.Text,{strong:!0,style:{fontSize:16},children:`创作记录管理`}),(0,Q.jsxs)(bR,{color:`purple`,children:[n,` 条记录`]})]}),(0,Q.jsxs)(DM,{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)(IUe,{value:T,onChange:e=>{e&&e[0]&&e[1]?E([e[0].startOf(`day`),e[1].endOf(`day`)]):E(e)},placeholder:[`开始日期`,`结束日期`]}),(0,Q.jsx)(IN,{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)(IN,{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)(sR,{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)(bP,{title:(0,Q.jsxs)(DM,{children:[j?.genType===`video`?(0,Q.jsx)(Q6,{}):(0,Q.jsx)(dX,{}),(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)(bR,{color:oe.color,icon:oe.icon,children:oe.text}):null,K?(0,Q.jsx)(bR,{color:K.color,icon:K.icon,children:K.text}):null,j.pipelineStage?(0,Q.jsx)(bR,{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)(DM,{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)(s0,{}):(0,Q.jsx)(h$,{}),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)(s0,{}),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)(dX,{}),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)(bP,{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,VUe=[{value:`pending`,label:`已创建`},{value:`waiting_user`,label:`等待用户操作`},{value:`processing`,label:`处理中`},{value:`completed`,label:`已完成`},{value:`failed`,label:`失败`},{value:`cancelled`,label:`已取消`}],HUe={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:`已取消`}},UUe={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:`-`,WUe=({status:e})=>{if(!e)return(0,Q.jsx)(bR,{children:`-`});let t=HUe[e]||{color:`blue`,text:e};return(0,Q.jsx)(bR,{color:t.color,children:t.text})},GUe=()=>{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 PVe({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){vP.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)(MA,{children:(0,Q.jsxs)(DM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(DM,{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)(IP,{}),onClick:()=>k(e=>e+1),children:`刷新`})]}),(0,Q.jsxs)(DM,{wrap:!0,children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`任务状态`,style:{width:160},value:l||void 0,onChange:e=>{u(e||``),c(1)},options:VUe}),(0,Q.jsx)(IN,{allowClear:!0,prefix:(0,Q.jsx)(_b,{}),placeholder:`关键词:标题/项目名/核心点`,style:{width:260},value:d,onChange:e=>f(e.target.value),onPressEnter:j}),(0,Q.jsx)(IN,{allowClear:!0,placeholder:`用户ID(管理员)`,style:{width:190},value:p,onChange:e=>m(e.target.value),onPressEnter:j}),(0,Q.jsx)(IN,{allowClear:!0,placeholder:`用户名(管理员)`,style:{width:230},value:h,onChange:e=>g(e.target.value),onPressEnter:j}),(0,Q.jsx)(sM.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)(sR,{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)(DM,{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)(DM,{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)(WUe,{status:e})},{title:`当前步骤`,dataIndex:`currentStepCode`,width:140,render:e=>UUe[e]||e||`-`},{title:`图片结果`,dataIndex:`finalImageUrl`,width:90,render:e=>e?(0,Q.jsx)(bR,{color:`success`,children:`有`}):(0,Q.jsx)(bR,{children:`无`})},{title:`视频结果`,dataIndex:`finalVideoUrl`,width:90,render:e=>e?(0,Q.jsx)(bR,{color:`success`,children:`有`}):(0,Q.jsx)(bR,{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)(DN,{}),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)}),KUe=({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},qUe=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``);function JUe(e){if(!e)return``;let t=String(e).trim();return t?/^(https?:)?\/\//i.test(t)||/^(blob|data):/i.test(t)?t:`${qUe}${t.startsWith(`/`)?t:`/${t}`}`:``}var P7=({url:e,type:t,height:n=260,emptyDescription:r=`暂无资源`,errorDescription:i=`资源加载失败,可能文件不存在、签名过期或访问权限受限。`})=>{let a=(0,C.useMemo)(()=>JUe(e),[e]),[o,s]=(0,C.useState)(!1);(0,C.useEffect)(()=>{s(!1)},[a]);let c=a?(0,Q.jsxs)(DM,{wrap:!0,style:{marginTop:8},children:[(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(YR,{}),onClick:async()=>{if(a)try{await navigator.clipboard.writeText(a),vP.success(`资源地址已复制`)}catch{vP.error(`复制失败,请手动复制`)}},children:`复制地址`}),(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(h$,{}),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)(SN,{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 YUe(e){return e?F7[e]?.text||I7[e]||L7[e]||R7[e]?.text||e:`-`}function XUe(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)(bR,{children:`-`});let n=String(e),r=YUe(n),i=(0,Q.jsx)(bR,{color:XUe(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 ZUe(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:ZUe(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 QUe(e){return!!K7(e)}function $Ue(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 eWe(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)(bR,{color:`processing`,children:`可编辑`}):(0,Q.jsx)(bR,{color:`default`,children:`只读`}),Z7=(e,t)=>e[t],tWe=(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)(dM,{size:`small`,column:2,bordered:!0,children:r.map(e=>(0,Q.jsx)(dM.Item,{label:(0,Q.jsxs)(DM,{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})},nWe=(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}))},rWe=(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=nWe(t,r);return(0,Q.jsx)(sR,{size:`small`,rowKey:(e,n)=>`${t.key}-${n}`,columns:i.map(e=>({title:(0,Q.jsxs)(DM,{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`})},iWe=(e,t)=>Y7(Z7(e,t.key)),aWe=({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=QUe(n),l=(c?$Ue(n):eWe(s)).filter(e=>e.key in s).map(e=>({key:e.key,label:(0,Q.jsxs)(DM,{size:8,wrap:!0,children:[(0,Q.jsx)(`span`,{children:e.label}),X7(e.editable),c?null:(0,Q.jsx)(bR,{color:`warning`,children:`管理后台兜底展示`})]}),children:e.type===`object`?tWe(s,e):e.type===`flow`?rWe(s,e):iWe(s,e)}));return(0,Q.jsxs)(DM,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Q.jsx)(MA,{size:`small`,title:`Schema 配置来源`,children:(0,Q.jsxs)(dM,{size:`small`,column:3,bordered:!0,children:[(0,Q.jsx)(dM.Item,{label:`来源`,children:r||n?.source||(c?`-`:`viewer_fallback`)}),(0,Q.jsx)(dM.Item,{label:`版本`,children:i||n?.version||`-`}),(0,Q.jsx)(dM.Item,{label:`历史兜底`,children:a||!c?(0,Q.jsx)(bR,{color:`warning`,children:`是`}):(0,Q.jsx)(bR,{color:`success`,children:`否`})})]})}),t?(0,Q.jsx)(MA,{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)(MA,{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]})},oWe=[`material_input`,`image_prompt_optimize`,`image_generate`,`video_prompt_optimize`,`video_generate`],sWe={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:`-`,cWe=({text:e=`-`})=>(0,Q.jsx)(Z.Text,{type:`secondary`,children:e}),e9=({step:e})=>e?(0,Q.jsx)(KUe,{input:e.input,output:e.output}):null,t9=({index:e,stepCode:t,step:n,current:r})=>(0,Q.jsxs)(DM,{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)(bR,{color:`blue`,children:`当前步骤`}):null,(0,Q.jsx)(Z.Text,{type:`secondary`,children:sWe[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)(bR,{children:[`Chat:`,$7(n.chatTaskId)]})}):null]}),lWe=(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,uWe=(e,t=`暂无提词`)=>e?(0,Q.jsx)(Z.Paragraph,{style:{whiteSpace:`pre-wrap`,marginBottom:0},children:e}):(0,Q.jsx)(cWe,{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 FVe(t):await BVe(t))}catch(e){vP.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)(()=>oWe.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)(()=>lWe(r,c),[r,c]);if(a&&!r)return(0,Q.jsx)(`div`,{style:{padding:64,textAlign:`center`},children:(0,Q.jsx)(sP,{size:`large`})});if(!r)return(0,Q.jsx)(MA,{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)(DM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(dM,{column:2,bordered:!0,size:`small`,children:[(0,Q.jsx)(dM.Item,{label:`模块类型`,children:(0,Q.jsx)(V7,{status:l})}),(0,Q.jsx)(dM.Item,{label:`素材步骤ID`,children:r.material?.materialStepId||`-`}),(0,Q.jsx)(dM.Item,{label:`参考素材项目名`,children:r.material?.sourceProjectName||`-`}),(0,Q.jsx)(dM.Item,{label:`生成项目名称`,children:r.material?.targetProjectName||`-`}),(0,Q.jsx)(dM.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)(MA,{size:`small`,title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(s0,{}),`素材视频`]}),children:(0,Q.jsx)(P7,{type:`video`,url:r.material?.materialVideoUrl,emptyDescription:`暂无素材视频`})}),(0,Q.jsx)(MA,{size:`small`,title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(dX,{}),`素材图片`]}),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)(DM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(dM,{column:2,bordered:!0,size:`small`,children:[(0,Q.jsx)(dM.Item,{label:`提词步骤ID`,children:r.imageGeneration?.promptStepId||`-`}),(0,Q.jsx)(dM.Item,{label:`步骤状态`,children:(0,Q.jsx)(V7,{status:m?.status||r.imageGeneration?.status})}),(0,Q.jsx)(dM.Item,{label:`图片提示词`,span:2,children:uWe(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)(DM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(dM,{column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(dM.Item,{label:`生成步骤ID`,children:r.imageGeneration?.generateStepId||`-`}),(0,Q.jsx)(dM.Item,{label:`Chat任务ID`,children:r.imageGeneration?.chatTaskId||`-`}),(0,Q.jsx)(dM.Item,{label:`状态`,children:(0,Q.jsx)(V7,{status:r.imageGeneration?.status||h?.status})}),(0,Q.jsx)(dM.Item,{label:`图片引擎ID`,children:r.imageGeneration?.engineId||`-`}),(0,Q.jsx)(dM.Item,{label:`图片引擎名称`,children:r.imageGeneration?.engineName||`-`}),(0,Q.jsx)(dM.Item,{label:`生成参数`,span:3,children:(0,Q.jsx)(N7,{value:r.imageGeneration?.params||{},maxHeight:160})})]}),n9(r.imageGeneration?.errorMessage||h?.errorMessage),(0,Q.jsx)(MA,{size:`small`,title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(dX,{}),`图片结果`]}),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)(DM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(dM,{column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(dM.Item,{label:`提词步骤ID`,children:r.videoGeneration?.promptStepId||`-`}),(0,Q.jsx)(dM.Item,{label:`步骤状态`,children:(0,Q.jsx)(V7,{status:g?.status})}),(0,Q.jsx)(dM.Item,{label:`提词参数`,span:3,children:(0,Q.jsx)(N7,{value:r.videoGeneration?.promptParams||{},maxHeight:160})})]}),n9(g?.errorMessage||r.videoGeneration?.errorMessage),(0,Q.jsx)(aWe,{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)(DM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(dM,{column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(dM.Item,{label:`生成步骤ID`,children:r.videoGeneration?.generateStepId||`-`}),(0,Q.jsx)(dM.Item,{label:`Chat任务ID`,children:r.videoGeneration?.chatTaskId||`-`}),(0,Q.jsx)(dM.Item,{label:`状态`,children:(0,Q.jsx)(V7,{status:r.videoGeneration?.status||_?.status})}),(0,Q.jsx)(dM.Item,{label:`视频引擎ID`,children:r.videoGeneration?.engineId||`-`}),(0,Q.jsx)(dM.Item,{label:`视频引擎名称`,children:r.videoGeneration?.engineName||`-`}),(0,Q.jsx)(dM.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)(MA,{size:`small`,title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(dX,{}),`视频封面`]}),children:(0,Q.jsx)(P7,{type:`image`,url:y,emptyDescription:_?.status===`failed`||r.videoGeneration?.errorMessage?`视频生成失败,未返回封面`:`暂无视频封面`,errorDescription:`视频封面加载失败,可能文件不存在、签名过期或访问权限受限。`})}),(0,Q.jsx)(MA,{size:`small`,title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(Q6,{}),`最终视频`]}),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)(DM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(DM,{wrap:!0,style:{justifyContent:`space-between`,width:`100%`},children:[(0,Q.jsxs)(DM,{wrap:!0,children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(kH,{}),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)(bR,{color:`gold`,children:[`接口模块:`,z7(r.module)]}):null]}),(0,Q.jsx)(XS,{onClick:s,loading:a,children:`刷新`})]}),(0,Q.jsx)(MA,{children:(0,Q.jsxs)(dM,{title:`基础信息`,column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(dM.Item,{label:`项目ID`,children:r.id}),(0,Q.jsx)(dM.Item,{label:`模块类型`,children:(0,Q.jsx)(V7,{status:l})}),(0,Q.jsx)(dM.Item,{label:`用户ID`,children:r.userId||`-`}),(0,Q.jsx)(dM.Item,{label:`用户名`,children:r.userName||`-`}),(0,Q.jsx)(dM.Item,{label:`标题`,children:r.title||`-`}),(0,Q.jsx)(dM.Item,{label:`当前步骤`,children:(0,Q.jsx)(fx,{title:r.currentStepCode||``,children:B7(r.currentStepCode)})}),(0,Q.jsx)(dM.Item,{label:`状态`,children:(0,Q.jsx)(V7,{status:r.status})}),(0,Q.jsx)(dM.Item,{label:`创建时间`,children:Q7(r.createdAt)}),(0,Q.jsx)(dM.Item,{label:`更新时间`,children:Q7(r.updatedAt)}),(0,Q.jsx)(dM.Item,{label:`完成时间`,children:Q7(r.completedAt)}),r.errorMessage?(0,Q.jsx)(dM.Item,{label:`错误信息`,span:3,children:(0,Q.jsx)(cf,{type:`error`,showIcon:!0,message:r.errorMessage})}):null]})}),(0,Q.jsx)(MA,{title:`步骤进度`,children:(0,Q.jsx)(dhe,{items:d})}),(0,Q.jsx)(MA,{title:`最终结果预览`,children:(0,Q.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(280px, 1fr))`,gap:16},children:[(0,Q.jsx)(MA,{size:`small`,title:`最终图片`,children:(0,Q.jsx)(P7,{type:`image`,url:r.finalImageUrl||r.imageGeneration?.resultImageUrl,height:220,emptyDescription:`暂无最终图片`})}),(0,Q.jsx)(MA,{size:`small`,title:`最终视频封面`,children:(0,Q.jsx)(P7,{type:`image`,url:r.finalVideoCoverUrl||r.videoGeneration?.resultVideoCoverUrl,height:220,emptyDescription:`暂无最终视频封面`})}),(0,Q.jsx)(MA,{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)(sR,{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)(bR,{color:`success`,children:`是`}):(0,Q.jsx)(bR,{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})}]})]})})},dWe=()=>(0,Q.jsx)(r9,{moduleType:`hot_opening_replicate`}),i9=20,fWe=[{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:`失败`}],pWe=[{value:`pending`,label:`待分析`},{value:`processing`,label:`分析中`},{value:`completed`,label:`分析完成`},{value:`failed`,label:`分析失败`}],mWe=[{value:`none`,label:`未拆镜`},{value:`pending`,label:`待拆镜`},{value:`processing`,label:`拆镜中`},{value:`completed`,label:`拆镜完成`},{value:`failed`,label:`拆镜失败`},{value:`retry_waiting`,label:`等待重试`}],hWe={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)(bR,{children:`-`});let t=hWe[e]||{color:`blue`,text:e};return(0,Q.jsx)(bR,{color:t.color,children:t.text})},gWe=()=>{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 IVe({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){vP.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)(MA,{children:(0,Q.jsxs)(DM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(DM,{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)(IP,{}),onClick:()=>N(e=>e+1),children:`刷新`})]}),(0,Q.jsxs)(DM,{wrap:!0,children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`总任务状态`,style:{width:150},value:l||void 0,onChange:e=>{u(e||``),c(1)},options:fWe}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`分析状态`,style:{width:140},value:d||void 0,onChange:e=>{f(e||``),c(1)},options:pWe}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`拆镜状态`,style:{width:140},value:p||void 0,onChange:e=>{m(e||``),c(1)},options:mWe}),(0,Q.jsx)(IN,{allowClear:!0,prefix:(0,Q.jsx)(_b,{}),placeholder:`关键词:标题/内容/分类/受众`,style:{width:260},value:h,onChange:e=>g(e.target.value),onPressEnter:F}),(0,Q.jsx)(IN,{allowClear:!0,placeholder:`用户ID(管理员)`,style:{width:190},value:_,onChange:e=>v(e.target.value),onPressEnter:F}),(0,Q.jsx)(IN,{allowClear:!0,placeholder:`用户名(管理员)`,style:{width:230},value:y,onChange:e=>b(e.target.value),onPressEnter:F}),(0,Q.jsx)(sM.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)(sR,{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)(DM,{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)(DM,{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)(PP,{size:`small`,percent:n?Math.round(r/n*100):0,format:()=>`${r}/${n}`})}},{title:`失败片段`,dataIndex:`failedSegmentCount`,width:90,render:e=>e?(0,Q.jsx)(bR,{color:`error`,children:e}):(0,Q.jsx)(bR,{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)(DN,{}),onClick:()=>e(`/shot-replications/task-sets/${n.id}`),children:`查看切片`})}]})]})})})},_We=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``),c9=20,vWe=[{value:`ai_suggestion`,label:`AI 建议`},{value:`custom`,label:`自定义`}],yWe=[{value:`none`,label:`未拆镜`},{value:`pending`,label:`待拆镜`},{value:`processing`,label:`拆镜中`},{value:`completed`,label:`拆镜完成`},{value:`failed`,label:`拆镜失败`},{value:`retry_waiting`,label:`等待重试`}],bWe=[{value:`not_required`,label:`无需分析`},{value:`pending`,label:`待分析`},{value:`processing`,label:`分析中`},{value:`completed`,label:`分析完成`},{value:`failed`,label:`分析失败`}],xWe=[{value:`not_started`,label:`未复刻`},{value:`project_created`,label:`已创建项目`},{value:`processing`,label:`复刻中`},{value:`completed`,label:`复刻完成`},{value:`failed`,label:`复刻失败`}],SWe={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:`已创建项目`}},CWe=e=>{if(!e)return``;let t=String(e).trim();return t?/^(https?:)?\/\//i.test(t)||/^(blob|data):/i.test(t)?t:`${_We}${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)(bR,{children:`-`});let t=SWe[e]||{color:`blue`,text:e};return(0,Q.jsx)(bR,{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:CWe(e),controls:!0,preload:`metadata`,style:{width:`100%`,maxHeight:t,borderRadius:12,background:`#0f172a`}}):(0,Q.jsx)(Ky,{description:`暂无视频`,image:Ky.PRESENTED_IMAGE_SIMPLE}),wWe=({items:e=[]})=>(0,Q.jsx)(sR,{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}]}),TWe=()=>{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 LVe(e))}catch(e){vP.error(e?.message||`加载拆镜任务详情失败`)}finally{d(!1)}}},[e]),A=(0,C.useCallback)(async()=>{if(e){p(!0);try{let t=await RVe(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){vP.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 zVe(e))}catch(e){vP.error(e?.message||`加载片段详情失败`)}};return u&&!n?(0,Q.jsx)(`div`,{style:{padding:64,textAlign:`center`},children:(0,Q.jsx)(sP,{size:`large`})}):n?(0,Q.jsxs)(`div`,{style:{padding:24},children:[(0,Q.jsxs)(DM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(DM,{style:{justifyContent:`space-between`,width:`100%`},children:[(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(XS,{icon:(0,Q.jsx)(kH,{}),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)(IP,{}),onClick:()=>h(e=>e+1),children:`刷新`})]}),(0,Q.jsx)(MA,{children:(0,Q.jsxs)(dM,{title:`总任务信息`,column:3,bordered:!0,size:`small`,children:[(0,Q.jsx)(dM.Item,{label:`任务集ID`,children:n.id}),(0,Q.jsx)(dM.Item,{label:`用户ID`,children:n.userId||`-`}),(0,Q.jsx)(dM.Item,{label:`用户名`,children:n.userName||`-`}),(0,Q.jsx)(dM.Item,{label:`标题`,children:n.title||`-`}),(0,Q.jsxs)(dM.Item,{label:`视频时长`,children:[Number(n.videoDurationSeconds||0).toFixed(2),`s`]}),(0,Q.jsx)(dM.Item,{label:`总状态`,children:(0,Q.jsx)(d9,{status:n.status})}),(0,Q.jsx)(dM.Item,{label:`分析状态`,children:(0,Q.jsx)(d9,{status:n.analysisStatus})}),(0,Q.jsx)(dM.Item,{label:`拆镜状态`,children:(0,Q.jsx)(d9,{status:n.splitStatus})}),(0,Q.jsxs)(dM.Item,{label:`片段数量`,children:[n.completedSegmentCount,`/`,n.segmentCount,`,失败 `,n.failedSegmentCount]}),(0,Q.jsx)(dM.Item,{label:`原视频分类`,children:n.originalVideoCategory||`-`}),(0,Q.jsx)(dM.Item,{label:`创建时间`,children:l9(n.createdAt)}),(0,Q.jsx)(dM.Item,{label:`更新时间`,children:l9(n.updatedAt)}),(0,Q.jsx)(dM.Item,{label:`原视频内容`,span:3,children:n.originalVideoContent||`-`}),(0,Q.jsx)(dM.Item,{label:`原视频受众`,span:3,children:n.originalVideoAudience||`-`}),n.analysisErrorMessage?(0,Q.jsx)(dM.Item,{label:`分析错误`,span:3,children:(0,Q.jsx)(cf,{type:`error`,message:n.analysisErrorMessage})}):null,n.splitErrorMessage?(0,Q.jsx)(dM.Item,{label:`拆镜错误`,span:3,children:(0,Q.jsx)(cf,{type:`error`,message:n.splitErrorMessage})}):null]})}),(0,Q.jsx)(MA,{title:(0,Q.jsxs)(DM,{children:[(0,Q.jsx)(s0,{}),`原视频预览`]}),children:(0,Q.jsx)(p9,{url:n.videoUrl,height:360})}),(0,Q.jsxs)(MA,{title:`AI 建议拆镜列表`,children:[n.aiSuggestions?.length?(0,Q.jsx)(wWe,{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)(MA,{title:`片段列表`,children:[(0,Q.jsxs)(DM,{wrap:!0,style:{marginBottom:16},children:[(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`片段来源`,style:{width:140},value:g||void 0,options:vWe,onChange:e=>{_(e||``),l(1)}}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`切割状态`,style:{width:140},value:v||void 0,options:yWe,onChange:e=>{y(e||``),l(1)}}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`分析状态`,style:{width:140},value:b||void 0,options:bWe,onChange:e=>{x(e||``),l(1)}}),(0,Q.jsx)(Sb,{allowClear:!0,placeholder:`复刻状态`,style:{width:150},value:S||void 0,options:xWe,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)(sR,{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)(bR,{color:`purple`,children:`AI建议`}):(0,Q.jsx)(bR,{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)(DM,{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)(bR,{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)(DN,{}),onClick:()=>j(t.id),children:`详情`})}]})]})]}),(0,Q.jsx)(Rde,{title:`片段详情`,width:720,open:T,onClose:()=>E(!1),destroyOnClose:!0,children:D?(0,Q.jsxs)(DM,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Q.jsxs)(dM,{column:2,bordered:!0,size:`small`,children:[(0,Q.jsx)(dM.Item,{label:`片段ID`,span:2,children:D.id}),(0,Q.jsx)(dM.Item,{label:`时间节点`,children:D.timeNode}),(0,Q.jsxs)(dM.Item,{label:`时长`,children:[Number(D.durationSeconds||0).toFixed(2),`s`]}),(0,Q.jsx)(dM.Item,{label:`切割状态`,children:(0,Q.jsx)(d9,{status:D.splitStatus})}),(0,Q.jsx)(dM.Item,{label:`分析状态`,children:(0,Q.jsx)(d9,{status:D.analysisStatus})}),(0,Q.jsx)(dM.Item,{label:`复刻状态`,children:(0,Q.jsx)(d9,{status:D.replicateStatus})}),(0,Q.jsx)(dM.Item,{label:`关联项目`,children:D.moduleProjectId?(0,Q.jsx)(XS,{type:`link`,onClick:()=>t(`/shot-replications/projects/${D.moduleProjectId}`),children:D.moduleProjectId}):`-`}),(0,Q.jsx)(dM.Item,{label:`片段内容`,span:2,children:D.segmentContent||`-`}),(0,Q.jsx)(dM.Item,{label:`片段分类`,children:D.segmentCategory||`-`}),(0,Q.jsx)(dM.Item,{label:`片段受众`,children:D.segmentAudience||`-`})]}),(0,Q.jsx)(MA,{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)(sP,{})})]}):(0,Q.jsx)(MA,{style:{margin:24},children:(0,Q.jsx)(Ky,{description:`未找到拆镜任务详情`})})},{Title:EWe,Text:m9,Paragraph:DWe}=Z,{TextArea:h9}=IN,g9=[{label:`对象`,value:`object`},{label:`数组`,value:`array`},{label:`字符串`,value:`string`},{label:`数字`,value:`number`},{label:`布尔`,value:`boolean`},{label:`流程数组`,value:`flow`}],_9=`画面属性`,OWe=new Set([`视频时长`,`视频比例`,`清晰度`,`帧率`,`推荐分辨率`]);function v9(e,t){return e===_9&&!!t&&OWe.has(t)}function y9(e){return e===_9}function kWe(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 AWe(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(AWe):[{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 jWe(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(jWe)}}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 MWe(e){return e?.schemaConfigSnapshot||e?.schema_config_snapshot||{}}function NWe(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}),PWe=()=>({minDuration:1,maxDuration:5,ratios:[.2,.4,.4],segments:[{stage:`开场吸引`,description:`快速吸引注意力`},{stage:`核心展示`,description:`展示主体动作、核心卖点或主要视觉内容`},{stage:`收尾引导`,description:`给出行动引导并稳定落版`}]}),FWe=()=>{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 VVe();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){vP.error(e?.message||`加载失败`)}finally{t(!1)}};(0,C.useEffect)(()=>{b()},[]);let x=e=>{l(t=>{let n=S9(kWe(t));return e(n),n})},S=async()=>{if(c){r(!0);try{let e=await HVe({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)),vP.success(`保存成功`)}catch(e){vP.error(e?.message||`保存失败`)}finally{r(!1)}}},w=async()=>{r(!0);try{let e=await UVe();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)),vP.success(`已恢复默认配置`)}catch(e){vP.error(e?.message||`恢复默认失败`)}finally{r(!1)}},T=async()=>{try{NWe(`video_prompt_schema_config.json`,await WVe())}catch(e){vP.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 GVe({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)),vP.success(`导入成功`)}catch(e){vP.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 KVe({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){vP.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(PWe())})},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)(DM,{children:[(0,Q.jsx)(m9,{strong:!0,children:e.label||e.key||`未命名分组`}),e.key&&e.key!==e.label&&(0,Q.jsxs)(bR,{color:`blue`,children:[`key: `,e.key]}),(0,Q.jsx)(bR,{children:e.type}),y9(e.key)&&(0,Q.jsx)(bR,{color:`red`,children:`系统锁定`}),!e.enabled&&!y9(e.key)&&(0,Q.jsx)(bR,{color:`default`,children:`已禁用`})]}),children:(0,Q.jsxs)(DM,{direction:`vertical`,style:{width:`100%`},size:`middle`,children:[(0,Q.jsxs)(zP,{gutter:12,align:`middle`,children:[(0,Q.jsx)(tj,{span:4,children:(0,Q.jsx)(IN,{addonBefore:`key`,value:e.key,maxLength:64,placeholder:`传给 AI 的字段名`,disabled:y9(e.key),onChange:e=>A(t,{key:e.target.value})})}),(0,Q.jsx)(tj,{span:4,children:(0,Q.jsx)(IN,{addonBefore:`label`,value:e.label,maxLength:64,placeholder:`后台显示名称`,onChange:e=>A(t,{label:e.target.value})})}),(0,Q.jsx)(tj,{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)(tj,{span:3,children:(0,Q.jsxs)(DM,{children:[`启用`,(0,Q.jsx)(iF,{checked:y9(e.key)?!0:e.enabled,disabled:y9(e.key),onChange:e=>A(t,{enabled:e})})]})}),(0,Q.jsx)(tj,{span:3,children:(0,Q.jsxs)(DM,{children:[`可编辑`,(0,Q.jsx)(iF,{checked:e.editable,onChange:e=>A(t,{editable:e})})]})}),(0,Q.jsx)(tj,{span:4,children:(0,Q.jsx)(Tj,{min:1,max:2e4,value:e.maxLength,addonBefore:`长度`,style:{width:`100%`},onChange:e=>A(t,{maxLength:Number(e||1e3)})})}),(0,Q.jsx)(tj,{span:2,style:{textAlign:`right`},children:(0,Q.jsx)(CP,{title:`确认删除该分组?`,disabled:y9(e.key),onConfirm:()=>j(t),children:(0,Q.jsx)(XS,{danger:!0,icon:(0,Q.jsx)(CR,{}),disabled:y9(e.key)})})})]}),e.type===`object`&&(0,Q.jsx)(MA,{size:`small`,title:`对象字段`,extra:(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(sA,{}),onClick:()=>M(t),children:`新增字段`}),children:(0,Q.jsx)(DM,{direction:`vertical`,style:{width:`100%`},children:(e.children||[]).map((n,r)=>(0,Q.jsxs)(zP,{gutter:8,align:`middle`,children:[(0,Q.jsx)(tj,{span:4,children:(0,Q.jsx)(IN,{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)(tj,{span:4,children:(0,Q.jsx)(IN,{addonBefore:`label`,value:n.label,maxLength:64,placeholder:`后台显示名称`,onChange:e=>N(t,r,{label:e.target.value})})}),(0,Q.jsx)(tj,{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)(tj,{span:2,children:(0,Q.jsxs)(DM,{children:[`启用`,(0,Q.jsx)(iF,{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)(tj,{span:2,children:(0,Q.jsxs)(DM,{children:[`编辑`,(0,Q.jsx)(iF,{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)(tj,{span:3,children:(0,Q.jsx)(Tj,{min:1,max:2e4,value:n.maxLength,addonBefore:`长度`,style:{width:`100%`},onChange:e=>N(t,r,{maxLength:Number(e||1e3)})})}),(0,Q.jsx)(tj,{span:5,children:(0,Q.jsx)(IN,{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)(tj,{span:1,style:{textAlign:`right`},children:(0,Q.jsx)(XS,{danger:!0,size:`small`,icon:(0,Q.jsx)(CR,{}),disabled:v9(e.key,n.key),onClick:()=>P(t,r)})})]},`child-${t}-${r}`))})}),e.type===`flow`&&(0,Q.jsxs)(MA,{size:`small`,title:`流程数组对象字段`,extra:(0,Q.jsx)(XS,{size:`small`,icon:(0,Q.jsx)(sA,{}),onClick:()=>F(t),children:`新增流程字段`}),children:[(0,Q.jsxs)(zP,{gutter:12,style:{marginBottom:12},children:[(0,Q.jsx)(tj,{span:6,children:(0,Q.jsx)(IN,{addonBefore:`内容字段`,value:e.contentKey,maxLength:64,onChange:e=>A(t,{contentKey:e.target.value})})}),(0,Q.jsx)(tj,{span:18,children:(0,Q.jsx)(IN,{addonBefore:`别名 / 分隔`,value:(e.contentAliases||[]).join(`/`),onChange:e=>A(t,{contentAliases:e.target.value.split(`/`).map(e=>e.trim()).filter(Boolean)})})})]}),(0,Q.jsx)(DM,{direction:`vertical`,style:{width:`100%`},children:(e.itemFields||[]).map((e,n)=>(0,Q.jsxs)(zP,{gutter:8,align:`middle`,children:[(0,Q.jsx)(tj,{span:5,children:(0,Q.jsx)(IN,{addonBefore:`key`,value:e.key,maxLength:64,placeholder:`流程对象字段名`,onChange:e=>I(t,n,{key:e.target.value})})}),(0,Q.jsx)(tj,{span:5,children:(0,Q.jsx)(IN,{addonBefore:`label`,value:e.label,maxLength:64,placeholder:`后台显示名称`,onChange:e=>I(t,n,{label:e.target.value})})}),(0,Q.jsx)(tj,{span:3,children:(0,Q.jsxs)(DM,{children:[`启用`,(0,Q.jsx)(iF,{checked:e.enabled,onChange:e=>I(t,n,{enabled:e})})]})}),(0,Q.jsx)(tj,{span:3,children:(0,Q.jsxs)(DM,{children:[`编辑`,(0,Q.jsx)(iF,{checked:e.editable,onChange:e=>I(t,n,{editable:e})})]})}),(0,Q.jsx)(tj,{span:4,children:(0,Q.jsx)(Tj,{min:1,max:2e4,value:e.maxLength,addonBefore:`长度`,style:{width:`100%`},onChange:e=>I(t,n,{maxLength:Number(e||800)})})}),(0,Q.jsx)(tj,{span:3,children:(0,Q.jsx)(IN,{value:String(e.value??``),maxLength:e.maxLength||800,placeholder:`默认值`,onChange:e=>I(t,n,{value:e.target.value})})}),(0,Q.jsx)(tj,{span:1,style:{textAlign:`right`},children:(0,Q.jsx)(XS,{danger:!0,size:`small`,icon:(0,Q.jsx)(CR,{}),onClick:()=>L(t,n)})})]},`flow-${t}-${n}`))})]}),e.type!==`object`&&e.type!==`flow`&&(0,Q.jsx)(MA,{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(` diff --git a/video-gen-admin/dist/index.html b/video-gen-admin/dist/index.html index 73970082..7fe662e5 100644 --- a/video-gen-admin/dist/index.html +++ b/video-gen-admin/dist/index.html @@ -28,7 +28,7 @@ } })(); - + diff --git a/video-gen-admin/src/pages/AdminPaymentStats.tsx b/video-gen-admin/src/pages/AdminPaymentStats.tsx index 6af35282..1ded4565 100644 --- a/video-gen-admin/src/pages/AdminPaymentStats.tsx +++ b/video-gen-admin/src/pages/AdminPaymentStats.tsx @@ -241,28 +241,28 @@ const AdminPaymentStats: React.FC = () => { 订单列表}> {/* Filters */} - - - 支付方式: + + + 支付方式 - - 状态: + + 状态 - - 手机号: + + 手机号 { onChange={(e) => setFilters(prev => ({ ...prev, phone: e.target.value }))} onPressEnter={() => { setOrderPage(1); load(); }} suffix={} - style={{ width: 180 }} /> - - 日期范围: + + 日期范围 { onChange={handleDateChange} /> - -