free-short-video 5.7.3 → 5.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,19 +1,16 @@
1
1
  ---
2
2
 
3
- # What's New in v5.7.3
3
+ # What's New in v5.7.4
4
4
 
5
5
  ## What's New
6
6
 
7
- ### Features & Improvements
8
-
9
- - **Mode-level analytics for generated videos** — the `task_completed` and `task_failed` GA4 events now include the `mode` parameter for simple video tasks (`t2v` / `i2v` / `ti2vid` / `keyframes`). Combined with the existing `task_type` and `mode` dimensions on `create_task`, GA4 reports can now show both usage counts (tasks started) and generated-video counts (tasks completed) per task type and per video mode. This lets you answer questions like "how many keyframes videos were generated this week".
10
-
11
7
  ### Bug Fixes
12
8
 
13
- - None.
9
+ - **Blank page after v5.7.3 upgrade fixed** — during the merge of the analytics changes into `master`, git auto-merge treated the new minified JS bundle as a rename of the old one and injected `<<<<<<<<` / `>>>>>>>>` conflict markers into the shipped bundle. Browsers failed to parse the file with `SyntaxError: Unexpected end of input`, leaving a white screen. The production bundle is now restored byte-for-byte from the original build output, and the page renders normally.
14
10
 
15
11
  ---
16
12
 
13
+
17
14
  ---
18
15
 
19
16
  ## Quick Start (npm)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "free-short-video",
3
- "version": "5.7.3",
3
+ "version": "5.7.4",
4
4
  "description": "Free AI short-video generator — run the full free-short-video service locally with one command. Text-to-video, image generation, Edge-TTS narration, subtitles, and compositing, all free. Official site: https://video.lichuanyang.top",
5
5
  "bin": {
6
6
  "free-short-video": "bin/cli.js",
@@ -24,11 +24,7 @@
24
24
  `+n+`
25
25
 
26
26
  `+d("willResetSteps")+`:
27
- <<<<<<<< HEAD:static/assets/index-DvwFKz3J.js
28
- `+o;confirm(r)&&await Bp(t,e.artifact_id)}async function Bp(e,t){try{const a=await Uc(e,t);if(!a.ok)throw new Error(a.detail||"Delete failed");Object.keys(Ta).forEach(n=>delete Ta[n]);try{(await za(e)).task_type&&Bi()}catch{}}catch(a){alert(d("artifactDeleteFailed")+": "+a.message)}}function _r(){return{artifactsAreaVisible:nn,artifactGroups:yr,isRunning:Pr,imageModalUrl:ji,stepLabelMap:Vp,loadArtifacts:Bi,scheduleArtifactRefresh:Ep,artifactLabel:Hp,artifactIcon:Kp,artifactFileUrl:xr,formatSize:Rp,toggleArtifactPreview:Gp,openImageModal:$p,closeImageModal:zp,confirmDeleteArtifact:Np}}const jp=3e4,{trackTaskResultOnce:Wo}=ut(),{loadArtifacts:Op,scheduleArtifactRefresh:Yo}=_r(),Ar=U(!1),Oi=U(0),Rn=U(""),Ui=U(!1),Cr=U(""),yn=U([]),qi=U({}),wr=U(""),Wi=U(!1);let on=null;function Tr(e){yn.value=Mp(e);const t={};yn.value.forEach(a=>t[a.key]="pending"),qi.value=t}function Gn(e,t){qi.value[e]=t}function Yi(e){const t=e.task_type||T.currentTaskType||"creative";yn.value.forEach(a=>{Fp(e,a.key,t)&&Gn(a.key,"done")})}function Up(e){Rn.value=e}async function qp(e,t){Ar.value=!0,Wi.value=!1,Ui.value=!1,Oi.value=0;let a=null;try{a=await za(e),a&&a.task_type&&(T.currentTaskType=a.task_type)}catch{}if(Tr(T.currentTaskType),a){Yi(a);const o=(a.current_step||"").replace(/^step_/,""),r=a.current_status||"";o&&r==="running"&&Gn(o,"running")}const n=t?`<br><span class="text-muted text-xs">${d("dir")}: <span class="font-mono">${t}</span></span>`:"";Rn.value=`<span class="text-accent animate-pulse">${d("taskStarting")}</span><br><span class="text-muted">${d("task_")}: ${e}</span>${n}`,T.currentArtifactsTaskId=e,Op()}async function Ir(e){if(!(!T.isTaskRunning||!e))try{const t=await za(e);Oi.value=Math.round((t.current_progress||0)*100),t.current_message&&(Rn.value=t.current_message),Yi(t);const a=(t.current_step||"").replace(/^step_/,""),n=t.current_status||"";a&&n==="running"&&Gn(a,"running"),a&&Yo(),t.status==="completed"&&(Wo("task_completed",e,{task_type:t.task_type||T.currentTaskType}),Dr(t.final_video_file,e),yi(),Yo()),(t.status==="failed"||a==="error"&&n==="failed")&&(Wo("task_failed",e,{task_type:t.task_type||T.currentTaskType,error:(t.current_message||"").slice(0,120)}),yi(),Wi.value=!0,wr.value=t.current_message||d("genFailedMsg"))}catch{}}function Wp(e){Qi(),on=setInterval(()=>Ir(e),jp)}function Qi(){on&&(clearInterval(on),on=null)}function Dr(e,t){e&&t&&(Ui.value=!0,Cr.value="/api/video/"+t)}function Yp(e){T.isTaskRunning=!0,T.currentTaskId=e}function yi(){T.isTaskRunning=!1,T.currentTaskId=null,Qi()}function Vt(){return{progressVisible:Ar,progressPct:Oi,progressMessage:Rn,resultVideoVisible:Ui,resultVideoSrc:Cr,steps:yn,stepStates:qi,taskFailed:Wi,failedMessage:wr,showProgress:qp,pollTaskProgress:Ir,startPolling:Wp,stopPolling:Qi,showResult:Dr,setRunning:Yp,clearRunning:yi,markStep:Gn,markCompletedStepsFromState:Yi,resetSteps:Tr,setProgressMessageHtml:Up}}const{showToast:Ji}=At(),{trackEvent:Lr}=ut(),{setRunning:Mr,showProgress:Fr,showResult:Qp,startPolling:Er}=Vt(),Vr=U([]),Hr=U(!1);let Ia=null;async function $n(){try{const e=await Gc();Vr.value=e.tasks||[]}catch{Hr.value=!1}}function Jp(){Ia||(Ia=setInterval($n,5e3))}function Zp(){Ia&&(clearInterval(Ia),Ia=null)}async function Kr(e){try{const t=await za(e);return T.currentTaskType=t.task_type||"creative",await Fr(e,t.dir_name),t.final_video_file&&Qp(t.final_video_file,e),t}catch(t){return alert(d("failLoad")+": "+t.message),null}}async function Xp(e){await Kr(e)&&(Mr(e),await Er(e))}async function eu(e){try{const t=await $c(e);if(!t.ok)throw new Error(t.detail||d("failResume"));let a="creative";try{a=(await za(e)).task_type||"creative"}catch{}T.currentTaskType=a,Mr(e),T.currentDirName=t.dir_name,await Fr(e,t.dir_name),await Er(e),Ji(d("resumed"),5e3)}catch(t){alert(d("failResume")+": "+t.message)}}async function tu(e){if(confirm(d("stopConfirmById")))try{const t=await zc(e);if(!t.ok)throw new Error(t.detail||d("failStop"));Lr("task_stopped",{task_type:T.currentTaskType||"",source:"list"}),Ji(d("stoppedById"),3e3),$n()}catch(t){alert(d("failStop")+": "+t.message)}}async function au(e){if(confirm(d("deleteTaskConfirm")))try{const t=await Nc(e);if(!t.ok)throw new Error(t.detail||d("failDelete"));Lr("task_deleted",{task_type:T.currentTaskType||"",source:"list"}),Ji(d("deletedTask"),3e3),$n()}catch(t){alert(d("failDelete")+": "+t.message)}}const Rr=U(null);function nu(e,t){Rr.value=t}function Zi(){return{tasks:Vr,loading:Hr,detailState:Rr,loadTaskList:$n,startTaskListTimer:Jp,stopTaskListTimer:Zp,viewTask:Kr,viewRunningTask:Xp,resumeTask:eu,stopTaskById:tu,deleteTaskById:au,showTaskDetail:nu}}const iu={class:"glass-card rounded-2xl mb-6 overflow-hidden transition-all duration-300"},ou=["aria-expanded"],su={class:"flex items-center gap-3"},ru={class:"text-sm text-muted"},lu={class:"text-ink-2 font-medium"},du={key:1,class:"p-6 pt-4"},cu={class:"flex items-center justify-between mb-3"},pu={class:"text-lg font-semibold text-accent"},uu={class:"flex items-center gap-2"},mu={class:"flex gap-3 items-start"},gu=["placeholder"],fu={key:0,class:"mt-2 flex items-center gap-2 flex-wrap"},hu={class:"text-xs px-2 py-0.5 rounded-full bg-green-900 text-green-300"},bu={class:"opacity-70"},ku={key:0,class:"text-xs px-2 py-0.5 rounded-full bg-blue-900 text-blue-300"},Su={key:1,class:"mt-3 space-y-1.5"},vu={class:"flex-1 font-mono text-ink-2 truncate"},yu=["title","onClick"],Pu=["title"],xu={class:"flex flex-wrap items-center gap-x-5 gap-y-1.5 mt-3 text-xs"},_u={href:"https://platform.agnes-ai.com",target:"_blank",rel:"noopener",class:"text-accent hover:text-ink transition-colors"},Au={href:"https://video.lichuanyang.top/guides/api-key",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},Cu={href:"https://video.lichuanyang.top/demo",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},wu={class:"glass-card rounded-2xl mb-6 overflow-hidden transition-all duration-300"},Tu={class:"flex items-center gap-3"},Iu={class:"text-sm text-muted"},Du={class:"text-ink-2 font-medium"},Lu={key:0,class:"text-muted"},Mu={key:1,class:"text-muted"},Fu={key:1,class:"p-6 pt-4"},Eu={class:"flex items-center justify-between mb-3"},Vu={class:"text-lg font-semibold text-accent"},Hu={class:"flex items-center gap-2"},Ku={class:"text-xs px-2 py-1 rounded-full bg-paper-2 text-muted"},Ru={class:"text-xs text-muted mb-4"},Gu={class:"space-y-3"},$u={class:"block text-xs text-muted mb-1"},zu={class:"flex gap-3"},Nu=["value"],Bu={key:0,class:"text-xs text-accent mt-1.5"},ju={key:1,class:"text-xs text-amber-400 mt-1.5"},Ou={class:"block text-xs text-muted mb-1"},Uu={class:"block text-xs text-muted mb-1"},qu={class:"flex gap-3 mt-4"},Wu={key:0,class:"self-center text-xs text-green-400"},Yu={key:1,class:"self-center text-xs text-red-400"},Qu={class:"glass-card rounded-2xl mb-6 overflow-hidden transition-all duration-300"},Ju={class:"flex items-center gap-3"},Zu={class:"text-sm text-muted"},Xu={class:"text-ink-2 font-medium"},em={key:1,class:"p-6 pt-4"},tm={class:"flex items-center justify-between mb-3"},am={class:"text-lg font-semibold text-accent"},nm={class:"flex items-center gap-2"},im={class:"text-xs text-muted mb-4"},om={class:"space-y-3"},sm={class:"flex items-center gap-3 glass-input rounded-lg px-4 py-3 cursor-pointer hover:border-blue-500/40 transition"},rm={class:"text-xs text-muted ml-2"},lm={class:"flex items-center gap-3 glass-input rounded-lg px-4 py-3 cursor-pointer hover:border-blue-500/40 transition"},dm={class:"text-xs text-muted ml-2"},cm={class:"flex gap-3 mt-4"},pm={key:0,class:"self-center text-xs text-green-400"},um={key:1,class:"self-center text-xs text-red-400"},mm={class:"glass-card rounded-2xl mb-6 overflow-hidden transition-all duration-300"},gm={class:"flex items-center gap-3"},fm={class:"text-sm text-muted"},hm={class:"text-ink-2 font-medium"},bm={key:1,class:"p-6 pt-4"},km={class:"flex items-center justify-between mb-3"},Sm={class:"text-lg font-semibold text-accent"},vm={class:"flex items-center gap-2"},ym={key:0,class:"mb-3 text-xs text-accent bg-accent/15/30 rounded-lg px-3 py-2"},Pm={key:1,class:"mb-3 glass-input rounded-lg px-4 py-2.5"},xm={class:"text-xs text-muted mb-0.5"},_m={class:"text-sm text-green-300 font-medium"},Am={class:"text-xs text-muted font-mono truncate"},Cm={class:"flex gap-3 mb-4"},wm=["placeholder"],Tm=["placeholder"],Im={class:"flex items-center gap-2 mb-2"},Dm={class:"text-sm font-medium text-muted"},Lm={class:"text-xs text-muted"},Mm={class:"space-y-2"},Fm={class:"flex-1 min-w-0"},Em={class:"text-sm text-ink truncate"},Vm={class:"text-xs text-muted font-mono truncate"},Hm={class:"flex gap-2 ml-3"},Km={key:0,class:"text-xs px-2 py-1 rounded-full bg-green-900 text-green-300"},Rm=["onClick"],Gm=["onClick"],$m=Ke({__name:"ConfigPanel",setup(e){const{apiKeyStatus:t,keyCount:a,keySource:n,keyList:o,saveMultiKeys:r,loadKeyInfo:c,removeKey:p,clearApiKey:l,modelSaveStatus:h,modelErrorMsg:g,betaHintVisible:b,isBetaModel:y,isPaidModel:D,syncModels:w,saveModels:x,domainSaveStatus:v,domainErrorMsg:V,saveDomain:m,isRegression:S,wsDisplayName:_,activateWorkspace:F,removeWorkspaceEntry:K,browseDirectory:R,addWorkspace:Se}=$i(),O=He({apikey:!1,model:!1,domain:!1,workspace:!1});function J(){const ve=fr();["apikey","model","domain","workspace"].forEach(we=>{const Ct=ve[we+"_manual"];Ct!==void 0&&(O[we]=Ct)})}function ne(ve){O[ve]=!O[ve],Ac(ve+"_manual",O[ve])}const j=U(""),te=Be(()=>t.value!=="none");function ge(ve){return D(ve)?ve+d("modelPaidTag"):y(ve)?ve+d("modelBetaTag"):ve}async function be(){const ve=j.value.trim();if(!ve){alert(d("enterApiKey"));return}await r(ve)&&(j.value="")}c();const ee=U(""),se=U("");async function ue(){const ve=await R();ve&&(ee.value=ve)}async function mt(){await Se(ee.value.trim(),se.value.trim()),ee.value="",se.value=""}return J(),(ve,$)=>{var we,Ct;return A(),C(de,null,[i("div",iu,[O.apikey?(A(),C("div",{key:0,class:"flex items-center justify-between px-6 py-3 cursor-pointer hover:bg-paper-3 transition",role:"button",tabindex:"0","aria-expanded":!O.apikey,onClick:$[0]||($[0]=q=>ne("apikey"))},[i("div",su,[$[21]||($[21]=i("span",{class:"text-sm"},"🔑",-1)),i("span",ru,[i("span",lu,u(s(d)("apiKeyTitle")),1),$[20]||($[20]=i("span",{class:"text-muted mx-2"},"·",-1)),i("span",{class:Pe(s(t)!=="none"?"text-green-400":"text-muted")},u(s(t)==="env"?s(d)("apiKeyFromEnv"):s(t)==="configured"?s(d)("apiKeyConfigured"):s(d)("apiKeyNotConfigured")),3)])]),$[22]||($[22]=i("span",{class:"text-muted text-xs"},"▶",-1))],8,ou)):(A(),C("div",du,[i("div",cu,[i("h2",pu,u(s(d)("apiKeyTitle")),1),i("div",uu,[i("span",{class:Pe(["text-xs px-2 py-1 rounded-full",s(t)!=="none"?"bg-green-900 text-green-300":"bg-paper-2 text-muted"])},u(s(t)==="env"?s(d)("apiKeyFromEnv"):s(t)==="configured"?s(d)("apiKeyConfigured"):s(d)("apiKeyNotConfigured")),3),i("button",{class:"text-xs text-muted hover:text-ink-2 transition px-2 py-1 rounded",onClick:$[1]||($[1]=q=>ne("apikey"))},"▲")])]),i("div",mu,[N(i("textarea",{"onUpdate:modelValue":$[2]||($[2]=q=>j.value=q),rows:"2",placeholder:te.value?s(d)("apiKeyAppendPlaceholder"):s(d)("apiKeyPlaceholder"),class:"flex-1 glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted resize-y"},null,8,gu),[[ie,j.value]]),i("button",{class:"px-5 py-2.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-lg text-sm font-medium transition whitespace-nowrap",onClick:be},u(te.value?s(d)("addKey"):s(d)("save")),1),s(t)!=="none"?(A(),C("button",{key:0,class:"px-5 py-2.5 bg-red-600/80 hover:bg-red-500 rounded-lg text-sm font-medium transition whitespace-nowrap",onClick:$[3]||($[3]=(...q)=>s(l)&&s(l)(...q))},u(s(d)("clear")),1)):ae("",!0)]),s(a)>0?(A(),C("div",fu,[i("span",hu,[ct(u(s(d)("keyCountLabel"))+": "+u(s(a))+" ",1),i("span",bu,"("+u(s(n))+")",1)]),s(a)>1?(A(),C("span",ku,u(s(d)("multiKeyActive")),1)):ae("",!0)])):ae("",!0),s(o).length>0?(A(),C("div",Su,[(A(!0),C(de,null,Le(s(o),(q,pa)=>(A(),C("div",{key:q.id+pa,class:"flex items-center gap-2 rounded-lg px-3 py-1.5 bg-paper-3/70 text-xs"},[i("code",vu,u(q.mask),1),i("span",{class:Pe(["px-1.5 py-0.5 rounded text-[10px] uppercase",q.source==="env"?"bg-amber-900/60 text-amber-300":"bg-paper-3 text-muted"])},u(q.source==="env"?s(d)("keySrcEnv"):s(d)("keySrcConfig")),3),q.source!=="env"?(A(),C("button",{key:0,class:"text-red-300 hover:text-red-200 transition",title:s(d)("removeKeyBtn"),onClick:Jt=>s(p)(q.id)}," ✕ ",8,yu)):(A(),C("span",{key:1,class:"text-muted/50",title:s(d)("keySrcEnvHint")},"•",8,Pu))]))),128))])):ae("",!0),i("div",xu,[i("a",_u,"🚀 "+u(s(d)("apiKeyGetLink")),1),i("a",Au,"📖 "+u(s(d)("apiKeyGuideLink")),1),i("a",Cu,"⚡ "+u(s(d)("apiKeyDemoLink")),1)])]))]),i("div",wu,[O.model?(A(),C("div",{key:0,class:"flex items-center justify-between px-6 py-3 cursor-pointer hover:bg-paper-3 transition",role:"button",tabindex:"0",onClick:$[4]||($[4]=q=>ne("model"))},[i("div",Tu,[$[24]||($[24]=i("span",{class:"text-sm"},"🧠",-1)),i("span",Iu,[i("span",Du,u(s(d)("modelTitle")),1),$[23]||($[23]=i("span",{class:"text-muted mx-2"},"·",-1)),s(T).models.text||s(T).models.image||s(T).models.video?(A(),C("span",Lu,u(s(d)("modelTagText"))+" "+u(s(T).models.text)+" "+u(s(d)("modelTagImage"))+" "+u(s(T).models.image)+" "+u(s(d)("modelTagVideo"))+" "+u(s(T).models.video),1)):(A(),C("span",Mu,"—"))])]),$[25]||($[25]=i("span",{class:"text-muted text-xs"},"▶",-1))])):(A(),C("div",Fu,[i("div",Eu,[i("h2",Vu,u(s(d)("modelTitle")),1),i("div",Hu,[i("span",Ku,u(s(d)("modelSyncIdle")),1),i("button",{class:"text-xs text-muted hover:text-ink-2 transition px-2 py-1 rounded",onClick:$[5]||($[5]=q=>ne("model"))},"▲")])]),i("p",Ru,u(s(d)("modelHint")),1),i("div",Gu,[i("div",null,[i("label",$u,u(s(d)("modelTextLabel")),1),i("div",zu,[N(i("select",{"onUpdate:modelValue":$[6]||($[6]=q=>s(T).models.text=q),class:"flex-1 glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[(A(!0),C(de,null,Le(s(T).modelListCache.text,q=>(A(),C("option",{key:q,value:q},u(ge(q)),9,Nu))),128))],512),[[Ie,s(T).models.text]]),i("button",{class:"px-4 py-2.5 bg-paper-3 hover:bg-paper-3 rounded-lg text-sm font-medium transition whitespace-nowrap",onClick:$[7]||($[7]=(...q)=>s(w)&&s(w)(...q))},u(s(d)("modelSync")),1)]),s(b)?(A(),C("p",Bu,u(s(d)("modelBetaHint")),1)):ae("",!0),s(D)(s(T).models.text)?(A(),C("p",ju,u(s(d)("modelPaidHint")),1)):ae("",!0)]),i("div",null,[i("label",Ou,u(s(d)("modelImageLabel")),1),N(i("select",{"onUpdate:modelValue":$[8]||($[8]=q=>s(T).models.image=q),disabled:"",class:"flex-1 glass-input rounded-lg px-3 py-2.5 text-sm text-ink opacity-50 cursor-not-allowed"},null,512),[[Ie,s(T).models.image]])]),i("div",null,[i("label",Uu,u(s(d)("modelVideoLabel")),1),N(i("select",{"onUpdate:modelValue":$[9]||($[9]=q=>s(T).models.video=q),disabled:"",class:"flex-1 glass-input rounded-lg px-3 py-2.5 text-sm text-ink opacity-50 cursor-not-allowed"},null,512),[[Ie,s(T).models.video]])])]),i("div",qu,[i("button",{class:"px-5 py-2.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-lg text-sm font-medium transition",onClick:$[10]||($[10]=(...q)=>s(x)&&s(x)(...q))},u(s(d)("save")),1),s(h)==="ok"?(A(),C("span",Wu,u(s(d)("modelSaved")),1)):ae("",!0),s(h)==="error"?(A(),C("span",Yu,u(s(g)),1)):ae("",!0)])]))]),i("div",Qu,[O.domain?(A(),C("div",{key:0,class:"flex items-center justify-between px-6 py-3 cursor-pointer hover:bg-paper-3 transition",role:"button",tabindex:"0",onClick:$[11]||($[11]=q=>ne("domain"))},[i("div",Ju,[$[27]||($[27]=i("span",{class:"text-sm"},"🌐",-1)),i("span",Zu,[i("span",Xu,u(s(d)("domainTitle")),1),$[26]||($[26]=i("span",{class:"text-muted mx-2"},"·",-1)),i("span",{class:Pe(s(T).agnesDomain==="cn"?"text-green-400":"text-muted")},"apihub.agnes-ai."+u(s(T).agnesDomain),3)])]),$[28]||($[28]=i("span",{class:"text-muted text-xs"},"▶",-1))])):(A(),C("div",em,[i("div",tm,[i("h2",am,u(s(d)("domainTitle")),1),i("div",nm,[i("span",{class:Pe(["text-xs px-2 py-1 rounded-full",s(T).agnesDomain==="cn"?"bg-green-900/40 text-green-300":"bg-paper-2 text-muted"])}," apihub.agnes-ai."+u(s(T).agnesDomain),3),i("button",{class:"text-xs text-muted hover:text-ink-2 transition px-2 py-1 rounded",onClick:$[12]||($[12]=q=>ne("domain"))},"▲")])]),i("p",im,u(s(d)("domainHint")),1),i("div",om,[i("label",sm,[N(i("input",{"onUpdate:modelValue":$[13]||($[13]=q=>s(T).agnesDomain=q),type:"radio",name:"agnes-domain",value:"com",class:"accent-blue-500 w-4 h-4 cursor-pointer"},null,512),[[rt,s(T).agnesDomain]]),i("div",null,[$[29]||($[29]=i("span",{class:"text-sm text-ink-2 font-medium"},"apihub.agnes-ai.com",-1)),i("span",rm,u(s(d)("domainComLabel")),1)])]),i("label",lm,[N(i("input",{"onUpdate:modelValue":$[14]||($[14]=q=>s(T).agnesDomain=q),type:"radio",name:"agnes-domain",value:"cn",class:"accent-blue-500 w-4 h-4 cursor-pointer"},null,512),[[rt,s(T).agnesDomain]]),i("div",null,[$[30]||($[30]=i("span",{class:"text-sm text-ink-2 font-medium"},"apihub.agnes-ai.cn",-1)),i("span",dm,u(s(d)("domainCnLabel")),1)])])]),i("div",cm,[i("button",{class:"px-5 py-2.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-lg text-sm font-medium transition",onClick:$[15]||($[15]=(...q)=>s(m)&&s(m)(...q))},u(s(d)("save")),1),s(v)==="ok"?(A(),C("span",pm,u(s(d)("domainSaved")),1)):ae("",!0),s(v)==="error"?(A(),C("span",um,u(s(V)),1)):ae("",!0)])]))]),i("div",mm,[O.workspace?(A(),C("div",{key:0,class:"flex items-center justify-between px-6 py-3 cursor-pointer hover:bg-paper-3 transition",role:"button",tabindex:"0",onClick:$[16]||($[16]=q=>ne("workspace"))},[i("div",gm,[$[32]||($[32]=i("span",{class:"text-sm"},"📁",-1)),i("span",fm,[i("span",hm,u(s(d)("workspaceTitle")),1),$[31]||($[31]=i("span",{class:"text-muted mx-2"},"·",-1)),i("span",{class:Pe(s(T).activeWorkspace?"text-green-400":"text-muted")},u(s(T).activeWorkspace?((we=s(T).workspaces.find(q=>q.path===s(T).activeWorkspace))==null?void 0:we.name)||s(T).activeWorkspace:s(d)("workspaceNone")),3)])]),$[33]||($[33]=i("span",{class:"text-muted text-xs"},"▶",-1))])):(A(),C("div",bm,[i("div",km,[i("h2",Sm,u(s(d)("workspaceTitle")),1),i("div",vm,[i("span",{class:Pe(["text-xs px-2 py-1 rounded-full",s(T).activeWorkspace?"bg-green-900 text-green-300":"bg-paper-2 text-muted"])},u(s(T).activeWorkspace?s(d)("workspaceActive"):s(d)("workspaceNone")),3),i("button",{class:"text-xs text-muted hover:text-ink-2 transition px-2 py-1 rounded",onClick:$[17]||($[17]=q=>ne("workspace"))},"▲")])]),s(S)?(A(),C("div",ym,u(s(d)("workspaceRegressionHint")),1)):ae("",!0),s(T).activeWorkspace?(A(),C("div",Pm,[i("p",xm,u(s(d)("workspaceCurrentActive")),1),i("p",_m,u(((Ct=s(T).workspaces.find(q=>q.path===s(T).activeWorkspace))==null?void 0:Ct.name)||s(T).activeWorkspace),1),i("p",Am,u(s(T).activeWorkspace),1)])):ae("",!0),i("div",Cm,[N(i("input",{"onUpdate:modelValue":$[18]||($[18]=q=>ee.value=q),placeholder:s(d)("workspacePathPlaceholder"),readonly:"",class:"flex-1 glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,8,wm),[[ie,ee.value]]),N(i("input",{"onUpdate:modelValue":$[19]||($[19]=q=>se.value=q),placeholder:s(d)("workspaceNamePlaceholder"),class:"w-40 glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,8,Tm),[[ie,se.value]]),i("button",{class:"px-4 py-2.5 bg-paper-3 hover:bg-paper-3 rounded-lg text-sm font-medium transition",onClick:ue},u(s(d)("workspaceBrowse")),1),i("button",{class:"px-5 py-2.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-lg text-sm font-medium transition",onClick:mt},u(s(d)("workspaceAdd")),1)]),i("div",Im,[i("h3",Dm,u(s(d)("workspaceListTitle")),1),i("span",Lm,u(s(d)("workspaceListHint")),1)]),i("div",Mm,[(A(!0),C(de,null,Le(s(T).workspaces,q=>(A(),C("div",{key:q.path,class:"flex items-center justify-between glass-input rounded-lg px-4 py-2.5"},[i("div",Fm,[i("p",Em,u(s(_)(q)),1),i("p",Vm,u(q.path),1)]),i("div",Hm,[q.path===s(T).activeWorkspace?(A(),C("span",Km,u(s(d)("workspaceActiveBadge")),1)):(A(),C("button",{key:1,class:"px-3 py-1 bg-green-600 hover:bg-green-500 rounded-lg text-xs font-medium transition",onClick:pa=>s(F)(q.path)},u(s(d)("workspaceActivate")),9,Rm)),q.is_default?ae("",!0):(A(),C("button",{key:2,class:"px-3 py-1 bg-red-600/80 hover:bg-red-500 rounded-lg text-xs font-medium transition",onClick:pa=>s(K)(q.path)},u(s(d)("workspaceRemove")),9,Gm))])]))),128))])]))])],64)}}}),zm={class:"flex items-center justify-between px-1 py-2 mb-4"},Nm={class:"text-xs text-muted leading-relaxed mr-3"},Bm={class:"relative inline-flex items-center cursor-pointer flex-shrink-0",title:"Video Watermark"},jm=["checked"],ja=Ke({__name:"WatermarkToggle",setup(e){const{toggleWatermark:t}=$i();function a(n){t(n.target.checked)}return(n,o)=>(A(),C("div",zm,[i("p",Nm,u(s(d)("watermarkPromo")),1),i("label",Bm,[i("input",{type:"checkbox",class:"watermark-toggle sr-only peer",checked:s(T).watermarkEnabled,onChange:a},null,40,jm),o[0]||(o[0]=i("div",{class:"w-10 h-5 bg-paper-3 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-rule after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-accent"},null,-1))])]))}}),Om={class:"flex items-center gap-2 mb-4 text-xs text-muted"},Um={href:"https://video.lichuanyang.top/guides/prompt-examples-simple",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},qm={class:"glass-card rounded-xl p-3 mb-4 flex items-center gap-3"},Wm={class:"text-sm text-muted whitespace-nowrap"},Ym={value:"video"},Qm={value:"image"},Jm={key:0},Zm={class:"glass-card rounded-2xl p-6 mb-4"},Xm={class:"text-lg font-semibold text-accent mb-4"},eg={class:"mb-4"},tg={class:"block text-sm text-muted mb-1.5"},ag=["placeholder"],ng={class:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4"},ig={class:"block text-sm text-muted mb-1.5"},og={value:"t2v"},sg={value:"i2v"},rg={value:"keyframes"},lg={class:"block text-sm text-muted mb-1.5"},dg={class:"block text-sm text-muted mb-1.5"},cg={value:"768x1152"},pg={value:"1152x768"},ug={value:"1024x1024"},mg={key:0,class:"mb-4"},gg={class:"block text-sm text-muted mb-1.5"},fg={class:"flex items-center gap-4"},hg={class:"cursor-pointer px-4 py-2.5 glass-input rounded-lg text-sm transition inline-block hover:border-blue-500/30"},bg={class:"text-sm text-muted"},kg={key:1,class:"mb-4"},Sg={class:"block text-sm text-muted mb-1.5"},vg={class:"flex items-center gap-4"},yg={class:"cursor-pointer px-4 py-2.5 glass-input rounded-lg text-sm transition inline-block hover:border-blue-500/30"},Pg={class:"text-sm text-muted"},xg={class:"border-t border-rule/40 pt-4 mt-4"},_g={class:"text-sm text-muted"},Ag={class:"text-muted text-xs"},Cg={class:"mt-3"},wg={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Tg={class:"block text-sm text-muted mb-1.5"},Ig=["placeholder"],Dg={class:"block text-sm text-muted mb-1.5"},Lg=["placeholder"],Mg={class:"mt-4"},Fg={class:"block text-sm text-muted mb-1.5"},Eg=["placeholder"],Vg=["disabled"],Hg={key:1},Kg={class:"glass-card rounded-2xl p-6 mb-4"},Rg={class:"text-lg font-semibold text-accent mb-4"},Gg={class:"mb-4"},$g={class:"block text-sm text-muted mb-1.5"},zg=["placeholder"],Ng={class:"mb-4"},Bg={class:"block text-sm text-muted mb-1.5"},jg={value:"1024x1024"},Og={value:"768x1152"},Ug={value:"1152x768"},qg={value:"768x1344"},Wg={value:"1344x768"},Yg={value:"1024x1792"},Qg={value:"1792x1024"},Jg={class:"mb-4"},Zg={class:"block text-sm text-muted mb-1.5"},Xg={class:"flex items-center gap-4"},ef={class:"cursor-pointer px-4 py-2.5 glass-input rounded-lg text-sm transition inline-block hover:border-blue-500/30"},tf={class:"text-sm text-muted"},af={class:"text-xs text-muted mt-1"},nf={class:"border-t border-rule/40 pt-4 mt-4"},of={class:"text-sm text-muted"},sf={class:"text-muted text-xs"},rf={class:"mt-3"},lf={class:"block text-sm text-muted mb-1.5"},df=["placeholder"],cf={class:"mt-4"},pf={class:"block text-sm text-muted mb-1.5"},uf=["placeholder"],mf={key:0,class:"mt-4 p-4 glass-card rounded-lg"},gf={class:"text-green-400 text-sm font-medium mb-2"},ff=["src"],hf=Ke({__name:"SimpleForm",setup(e){const{trackEvent:t}=ut(),{setRunning:a,showProgress:n,startPolling:o}=Vt(),{showToast:r}=At(),c=U("video"),p=He({prompt:"",mode:"t2v",duration:"5",resolution:"768x1152",seed:"",negative:"",system:"",refImage:null,refName:"",endImage:null,endName:""}),l=He({prompt:"",size:"1024x1024",negative:"",system:"",refImage:null,refName:"",imageResultVisible:!1,imageResultSrc:""}),h=He({video:!0,image:!0}),g=U(!1);function b(V){h[V]=!h[V]}function y(V,m){var _;const S=((_=V.target.files)==null?void 0:_[0])||null;m==="video"?(p.refImage=S,p.refName=S?S.name:""):(l.refImage=S,l.refName=S?S.name:"")}function D(V){var S;const m=((S=V.target.files)==null?void 0:S[0])||null;p.endImage=m,p.endName=m?m.name:""}function w(V){const[m,S]=V.split("x").map(Number);return{width:m,height:S}}async function x(){const V=p.prompt.trim();if(!V){alert(d("enterPrompt"));return}g.value=!0;const m=new FormData;m.append("prompt",V),m.append("mode",p.mode),m.append("duration",p.duration);const S=w(p.resolution);m.append("video_width",String(S.width)),m.append("video_height",String(S.height)),p.seed&&m.append("seed",p.seed),p.negative&&m.append("negative_prompt",p.negative),p.system.trim()&&m.append("system_prompt",p.system.trim()),p.refImage&&m.append("reference_image",p.refImage),p.endImage&&m.append("end_frame_image",p.endImage);try{const _=await Wc(m);if(!_.ok)throw new Error(_.detail||d("failCreate"));t("create_task",{task_type:"simple",mode:p.mode,duration:p.duration,resolution:p.resolution}),T.currentTaskType="simple",a(_.task_id),T.currentDirName=_.dir_name,await n(_.task_id,_.dir_name),await o(_.task_id),r(d("submitted"),5e3)}catch(_){t("create_task_failed",{task_type:"simple",error:(_.message||"").slice(0,120)}),alert(d("failCreate")+": "+_.message)}finally{g.value=!1}}async function v(){const V=l.prompt.trim();if(!V){alert(d("enterImagePrompt"));return}const m=new FormData;m.append("prompt",V),m.append("size",l.size),l.negative&&m.append("negative_prompt",l.negative),l.system.trim()&&m.append("system_prompt",l.system.trim()),l.refImage&&m.append("reference_image",l.refImage);try{const S=await Xc(m);if(!S.ok)throw new Error(S.detail||d("failCreate"));t("create_task",{task_type:"image",size:l.size}),l.imageResultSrc="/api/image/"+S.task_id,l.imageResultVisible=!0,r(d("imgComplete"),5e3)}catch(S){t("create_task_failed",{task_type:"image",error:(S.message||"").slice(0,120)}),alert(d("failCreate")+": "+S.message)}}return(V,m)=>(A(),C("div",null,[i("div",Om,[m[16]||(m[16]=i("span",{class:"text-muted"},"💡",-1)),i("a",Um,u(s(d)("exampleLinkSimple")),1)]),i("div",qm,[i("label",Wm,u(s(d)("subModeLabel")),1),N(i("select",{"onUpdate:modelValue":m[0]||(m[0]=S=>c.value=S),class:"flex-1 glass-input rounded-lg px-3 py-2 text-sm text-ink"},[i("option",Ym,u(s(d)("subModeVideo")),1),i("option",Qm,u(s(d)("subModeImage")),1)],512),[[Ie,c.value]])]),c.value==="video"?(A(),C("div",Jm,[i("div",Zm,[i("h2",Xm,u(s(d)("simpleSettings")),1),i("div",eg,[i("label",tg,[ct(u(s(d)("promptLabel"))+" (prompt) ",1),m[17]||(m[17]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":m[1]||(m[1]=S=>p.prompt=S),rows:"3",placeholder:s(d)("promptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,ag),[[ie,p.prompt]])]),i("div",ng,[i("div",null,[i("label",ig,u(s(d)("genMode")),1),N(i("select",{"onUpdate:modelValue":m[2]||(m[2]=S=>p.mode=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",og,u(s(d)("modeT2v")),1),i("option",sg,u(s(d)("modeI2v")),1),i("option",rg,u(s(d)("modeKeyframesSimple")),1)],512),[[Ie,p.mode]])]),i("div",null,[i("label",lg,u(s(d)("duration")),1),N(i("select",{"onUpdate:modelValue":m[3]||(m[3]=S=>p.duration=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[...m[18]||(m[18]=[ir('<option value="5">5s</option><option value="10">10s</option><option value="15">15s</option><option value="18">18s</option><option value="20">20s</option>',5)])],512),[[Ie,p.duration]])]),i("div",null,[i("label",dg,u(s(d)("resolution")),1),N(i("select",{"onUpdate:modelValue":m[4]||(m[4]=S=>p.resolution=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",cg,u(s(d)("resPortrait")),1),i("option",pg,u(s(d)("resLandscape")),1),i("option",ug,u(s(d)("resSquare")),1)],512),[[Ie,p.resolution]])])]),p.mode!=="t2v"?(A(),C("div",mg,[i("label",gg,u(s(d)("refImageSimple")),1),i("div",fg,[i("label",hg,[i("span",null,u(s(d)("chooseImage")),1),i("input",{type:"file",accept:"image/*",class:"hidden",onChange:m[5]||(m[5]=S=>y(S,"video"))},null,32)]),i("span",bg,u(p.refName||s(d)("notSelected")),1)])])):ae("",!0),p.mode==="keyframes"?(A(),C("div",kg,[i("label",Sg,u(s(d)("endFrameImage")),1),i("div",vg,[i("label",yg,[i("span",null,u(s(d)("chooseImage")),1),i("input",{type:"file",accept:"image/*",class:"hidden",onChange:D},null,32)]),i("span",Pg,u(p.endName||s(d)("notSelected")),1)])])):ae("",!0),i("div",xg,[i("div",{class:"collapse-header flex items-center justify-between",onClick:m[6]||(m[6]=S=>b("video"))},[i("span",_g,u(s(d)("advancedSettings")),1),i("span",Ag,u(h.video?"▶":"▼"),1)]),N(i("div",Cg,[i("div",wg,[i("div",null,[i("label",Tg,"Seed ("+u(s(d)("optional"))+")",1),N(i("input",{"onUpdate:modelValue":m[7]||(m[7]=S=>p.seed=S),type:"number",placeholder:s(d)("seedPlaceholder"),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},null,8,Ig),[[ie,p.seed]])]),i("div",null,[i("label",Dg,"Negative Prompt ("+u(s(d)("optional"))+")",1),N(i("input",{"onUpdate:modelValue":m[8]||(m[8]=S=>p.negative=S),placeholder:s(d)("negativePlaceholder"),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},null,8,Lg),[[ie,p.negative]])])]),i("div",Mg,[i("label",Fg,u(s(d)("systemPrompt"))+" ("+u(s(d)("optional"))+")",1),N(i("textarea",{"onUpdate:modelValue":m[9]||(m[9]=S=>p.system=S),rows:"2",placeholder:s(d)("systemPromptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,Eg),[[ie,p.system]])])],512),[[ra,!h.video]])])]),ce(ja),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",disabled:g.value,onClick:x},u(g.value?s(d)("submitting"):s(d)("startGenerate")),9,Vg)])):(A(),C("div",Hg,[i("div",Kg,[i("h2",Rg,u(s(d)("imageSettings")),1),i("div",Gg,[i("label",$g,[ct(u(s(d)("imagePrompt"))+" (prompt) ",1),m[19]||(m[19]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":m[10]||(m[10]=S=>l.prompt=S),rows:"3",placeholder:s(d)("imagePromptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,zg),[[ie,l.prompt]])]),i("div",Ng,[i("label",Bg,u(s(d)("imageSize")),1),N(i("select",{"onUpdate:modelValue":m[11]||(m[11]=S=>l.size=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",jg,u(s(d)("resSquare"))+" (1024x1024)",1),i("option",Og,u(s(d)("resPortrait"))+" (768x1152)",1),i("option",Ug,u(s(d)("resLandscape"))+" (1152x768)",1),i("option",qg,u(s(d)("resPortraitHD"))+" (HD)",1),i("option",Wg,u(s(d)("resLandscapeHD"))+" (HD)",1),i("option",Yg,u(s(d)("resPortraitTall")),1),i("option",Qg,u(s(d)("resLandscapeWide")),1)],512),[[Ie,l.size]])]),i("div",Jg,[i("label",Zg,u(s(d)("refImageSimple")),1),i("div",Xg,[i("label",ef,[i("span",null,u(s(d)("chooseImage")),1),i("input",{type:"file",accept:"image/*",class:"hidden",onChange:m[12]||(m[12]=S=>y(S,"image"))},null,32)]),i("span",tf,u(l.refName||s(d)("notSelected")),1)]),i("p",af,u(s(d)("refImageHint")),1)]),i("div",nf,[i("div",{class:"collapse-header flex items-center justify-between",onClick:m[13]||(m[13]=S=>b("image"))},[i("span",of,u(s(d)("advancedSettings")),1),i("span",sf,u(h.image?"▶":"▼"),1)]),N(i("div",rf,[i("div",null,[i("label",lf,"Negative Prompt ("+u(s(d)("optional"))+")",1),N(i("input",{"onUpdate:modelValue":m[14]||(m[14]=S=>l.negative=S),placeholder:s(d)("negativePlaceholder"),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},null,8,df),[[ie,l.negative]])]),i("div",cf,[i("label",pf,u(s(d)("systemPrompt"))+" ("+u(s(d)("optional"))+")",1),N(i("textarea",{"onUpdate:modelValue":m[15]||(m[15]=S=>l.system=S),rows:"2",placeholder:s(d)("systemPromptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,uf),[[ie,l.system]])])],512),[[ra,!h.image]])])]),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",onClick:v},u(s(d)("imgGenerate")),1),l.imageResultVisible?(A(),C("div",mf,[i("p",gf,u(s(d)("imgComplete")),1),i("img",{src:l.imageResultSrc,class:"w-full rounded-lg max-h-96 object-contain"},null,8,ff)])):ae("",!0)]))]))}}),bf={class:"vs-main"},kf={class:"vs-name"},Sf={class:"vs-desc"},vf=Ke({__name:"VoiceSelector",props:{task:{}},setup(e){const t=e,{voiceName:a,voiceDescription:n,openVoicePicker:o}=Qt();return(r,c)=>(A(),C("div",{class:"voice-selector",role:"button",tabindex:"0",onClick:c[0]||(c[0]=p=>s(o)(t.task)),onKeydown:[c[1]||(c[1]=Go(kn(p=>s(o)(t.task),["prevent"]),["enter"])),c[2]||(c[2]=Go(kn(p=>s(o)(t.task),["prevent"]),["space"]))]},[i("span",bf,[i("span",kf,u(s(a)(t.task)),1),i("span",Sf,u(s(n)(t.task)||s(d)("voiceDefaultDesc")),1)]),c[3]||(c[3]=i("span",{class:"vs-arrow"},"▾",-1))],32))}}),yf={class:"glass-card rounded-2xl p-6 mb-4"},Pf={class:"text-lg font-semibold text-accent"},xf={class:"text-muted text-xs"},_f={class:"mt-4"},Af={class:"flex items-center gap-3 mb-4"},Cf={class:"flex items-center gap-2 text-sm text-ink-2 cursor-pointer"},wf={class:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4"},Tf={class:"block text-sm text-muted mb-1.5"},If={class:"block text-sm text-muted mb-1.5"},Df={value:"-30%"},Lf={value:"+0%"},Mf={value:"+30%"},Ff={class:"glass-card rounded-2xl p-6 mb-4"},Ef={class:"text-lg font-semibold text-accent"},Vf={class:"text-muted text-xs"},Hf={class:"mt-4"},Kf={class:"flex items-center gap-3 mb-4"},Rf={class:"flex items-center gap-2 text-sm text-ink-2 cursor-pointer"},Gf={key:0,class:"border-t border-rule/40 pt-4"},$f={class:"mb-4"},zf={class:"block text-sm text-muted mb-1.5"},Nf={value:"fixed"},Bf={value:"llm"},jf={key:0},Of={class:"text-sm text-muted mb-3"},Uf={class:"grid grid-cols-2 md:grid-cols-4 gap-3"},qf={class:"block text-xs text-muted mb-1"},Wf={class:"block text-xs text-muted mb-1"},Yf={class:"block text-xs text-muted mb-1"},Qf={class:"block text-xs text-muted mb-1"},Jf={value:"bottom"},Zf={value:"top"},Xf={class:"grid grid-cols-2 md:grid-cols-4 gap-3 mt-3"},eh={class:"block text-xs text-muted mb-1"},th={class:"block text-xs text-muted mb-1"},ah={class:"block text-xs text-muted mb-1"},nh={key:1},ih={class:"block text-sm text-muted mb-1.5"},oh=["placeholder"],sh={class:"text-xs text-muted mt-1"},rh={key:1,class:"text-xs text-muted"},zn=Ke({__name:"SubtitleConfig",props:{task:{},withStyle:{type:Boolean},defaultFontsize:{}},setup(e,{expose:t}){const a=e,n=U(!0),o=U(!0),r=U("+0%"),c=U("fixed"),p=He({font:"STHeitiMedium.ttc",color:"white",fontsize:a.defaultFontsize??48,position:"bottom",stroke_color:"black",stroke_width:2,bg_color:"black@0.5",hints:""}),l=He({audio:!0,subtitle:!0});function h(g){l[g]=!l[g]}return t({audioEnabled:n,subtitleEnabled:o,rate:r,styleMode:c,style:p}),(g,b)=>(A(),C(de,null,[i("div",yf,[i("div",{class:"collapse-header flex items-center justify-between",onClick:b[0]||(b[0]=y=>h("audio"))},[i("h2",Pf,u(s(d)("audioConfig")),1),i("span",xf,u(l.audio?"▶":"▼"),1)]),N(i("div",_f,[i("div",Af,[i("label",Cf,[N(i("input",{"onUpdate:modelValue":b[1]||(b[1]=y=>n.value=y),type:"checkbox",class:"rounded bg-paper-2 border-rule"},null,512),[[bn,n.value]]),i("span",null,u(s(d)("enableNarration")),1)])]),i("div",wf,[i("div",null,[i("label",Tf,u(s(d)("voiceRole")),1),ce(vf,{task:e.task},null,8,["task"])]),i("div",null,[i("label",If,u(s(d)("speechRate")),1),N(i("select",{"onUpdate:modelValue":b[2]||(b[2]=y=>r.value=y),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",Df,u(s(d)("rateSlow")),1),b[14]||(b[14]=i("option",{value:"-15%"},"-15%",-1)),i("option",Lf,u(s(d)("rateNormal")),1),b[15]||(b[15]=i("option",{value:"+15%"},"+15%",-1)),i("option",Mf,u(s(d)("rateFast")),1)],512),[[Ie,r.value]])])])],512),[[ra,!l.audio]])]),i("div",Ff,[i("div",{class:"collapse-header flex items-center justify-between",onClick:b[3]||(b[3]=y=>h("subtitle"))},[i("h2",Ef,u(s(d)("subtitleConfig")),1),i("span",Vf,u(l.subtitle?"▶":"▼"),1)]),N(i("div",Hf,[i("div",Kf,[i("label",Rf,[N(i("input",{"onUpdate:modelValue":b[4]||(b[4]=y=>o.value=y),type:"checkbox",class:"rounded bg-paper-2 border-rule"},null,512),[[bn,o.value]]),i("span",null,u(s(d)("enableSubtitle")),1)])]),e.withStyle?(A(),C("div",Gf,[i("div",$f,[i("label",zf,u(s(d)("subStyleMode")),1),N(i("select",{"onUpdate:modelValue":b[5]||(b[5]=y=>c.value=y),class:"w-full glass-input rounded-lg px-3 py-2 text-sm text-ink"},[i("option",Nf,u(s(d)("subStyleFixed")),1),i("option",Bf,u(s(d)("subStyleLLM")),1)],512),[[Ie,c.value]])]),c.value==="fixed"?(A(),C("div",jf,[i("p",Of,u(s(d)("subtitleStyle")),1),i("div",Uf,[i("div",null,[i("label",qf,u(s(d)("subFont")),1),N(i("input",{"onUpdate:modelValue":b[6]||(b[6]=y=>p.font=y),class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.font]])]),i("div",null,[i("label",Wf,u(s(d)("subColor")),1),N(i("input",{"onUpdate:modelValue":b[7]||(b[7]=y=>p.color=y),class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.color]])]),i("div",null,[i("label",Yf,u(s(d)("subSize")),1),N(i("input",{"onUpdate:modelValue":b[8]||(b[8]=y=>p.fontsize=y),type:"number",class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.fontsize,void 0,{number:!0}]])]),i("div",null,[i("label",Qf,u(s(d)("subPosition")),1),N(i("select",{"onUpdate:modelValue":b[9]||(b[9]=y=>p.position=y),class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},[i("option",Jf,u(s(d)("posBottom")),1),i("option",Zf,u(s(d)("posTop")),1)],512),[[Ie,p.position]])])]),i("div",Xf,[i("div",null,[i("label",eh,u(s(d)("subStrokeColor")),1),N(i("input",{"onUpdate:modelValue":b[10]||(b[10]=y=>p.stroke_color=y),class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.stroke_color]])]),i("div",null,[i("label",th,u(s(d)("subStrokeWidth")),1),N(i("input",{"onUpdate:modelValue":b[11]||(b[11]=y=>p.stroke_width=y),type:"number",class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.stroke_width,void 0,{number:!0}]])]),i("div",null,[i("label",ah,u(s(d)("subBgColor")),1),N(i("input",{"onUpdate:modelValue":b[12]||(b[12]=y=>p.bg_color=y),class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.bg_color]])])])])):(A(),C("div",nh,[i("label",ih,u(s(d)("subStyleHints")),1),N(i("textarea",{"onUpdate:modelValue":b[13]||(b[13]=y=>p.hints=y),rows:"3",class:"w-full glass-input rounded-lg px-3 py-2 text-sm text-ink placeholder-muted",placeholder:s(d)("subStyleHintsPlaceholder")},null,8,oh),[[ie,p.hints]]),i("p",sh,u(s(d)("subStyleHintsHint")),1)]))])):(A(),C("p",rh,u(s(d)("poetrySubtitleFixed")),1))],512),[[ra,!l.subtitle]])])],64))}}),lh={class:"flex items-center gap-2 mb-4 text-xs text-muted"},dh={href:"https://video.lichuanyang.top/guides/prompt-examples-creative",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},ch={class:"glass-card rounded-2xl p-6 mb-4"},ph={class:"text-lg font-semibold text-accent mb-4"},uh={class:"mb-4"},mh={class:"block text-sm text-muted mb-1.5"},gh=["placeholder"],fh={class:"mb-4"},hh={class:"block text-sm text-muted mb-1.5"},bh=["placeholder"],kh={class:"mb-4 p-4 rounded-xl bg-paper-2/30 border border-rule/50"},Sh={class:"text-sm font-medium text-accent mb-3"},vh={class:"mb-4"},yh={class:"block text-sm text-muted mb-2"},Ph={class:"flex gap-2"},xh={class:"flex-1 flex items-center gap-2 px-3 py-2.5 rounded-lg bg-paper-2/50 border border-rule cursor-pointer hover:border-blue-500/30 transition"},_h={class:"text-sm text-ink-2"},Ah={class:"flex-1 flex items-center gap-2 px-3 py-2.5 rounded-lg bg-paper-2/50 border border-rule cursor-pointer hover:border-blue-500/30 transition"},Ch={class:"text-sm text-ink-2"},wh={class:"text-xs text-muted mt-1.5"},Th={key:0},Ih={class:"mb-3"},Dh={class:"block text-xs text-muted mb-1"},Lh={class:"mb-3"},Mh={class:"block text-xs text-muted mb-1.5"},Fh={class:"flex gap-2 mb-2"},Eh={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},Vh={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},Hh={key:0},Kh={class:"text-xs text-muted ml-1"},Rh={key:1,class:"space-y-2"},Gh={class:"text-xs text-muted w-12"},$h=["onUpdate:modelValue"],zh={class:"text-xs text-muted"},Nh={class:"mb-4"},Bh={class:"block text-sm text-muted mb-1.5"},jh={class:"glass-card rounded-2xl p-6 mb-4"},Oh={class:"text-lg font-semibold text-accent mb-4"},Uh={class:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4"},qh={class:"block text-sm text-muted mb-1.5"},Wh={value:"keyframes"},Yh={value:"ti2vid"},Qh={value:"none"},Jh={class:"block text-sm text-muted mb-1.5"},Zh={value:"768x1152"},Xh={value:"1152x768"},eb={value:"1024x1024"},tb={class:"mb-4"},ab={class:"block text-sm text-muted mb-1.5"},nb={class:"flex items-center gap-4"},ib={class:"cursor-pointer px-4 py-2.5 glass-input rounded-lg text-sm transition inline-block hover:border-blue-500/30"},ob={class:"text-sm text-muted"},sb={class:"text-xs text-muted mt-2"},rb={class:"mb-4"},lb={class:"flex items-center justify-between mb-3"},db={class:"text-sm text-muted"},cb={class:"flex gap-3"},pb={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},ub={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},mb={key:0,class:"space-y-2"},gb={class:"text-xs text-muted mb-2"},fb={class:"space-y-2"},hb={class:"text-xs text-muted w-16"},bb=["onChange"],kb={class:"mb-4"},Sb={class:"block text-sm text-muted mb-1.5"},vb={class:"text-xs text-muted mb-2"},yb={class:"space-y-2"},Pb={class:"text-xs text-muted w-16"},xb=["onChange"],_b=["disabled"],Ab=Ke({__name:"CreativeForm",setup(e){const{trackEvent:t}=ut(),{setRunning:a,showProgress:n,startPolling:o}=Vt(),{showToast:r}=At(),{voiceSelections:c}=Qt(),p=U(),l=He({name:"",idea:"",durationSource:"manual",sceneCount:3,uniform:!0,uniformDuration:5,independentDurations:[],style:"电影质感写实风格",chaining:"keyframes",resolution:"768x1152",refImage:null,refName:"",useEndFrames:!1,genEndFromRef:!0,endFrames:[],sceneRefs:[]}),h=U(!1);function g(V){const[m,S]=V.split("x").map(Number);return{width:m,height:S}}function b(V){var S;const m=((S=V.target.files)==null?void 0:S[0])||null;l.refImage=m,l.refName=m?m.name:""}function y(){l.useEndFrames||(l.genEndFromRef=!1)}function D(){l.genEndFromRef&&(l.useEndFrames=!1)}function w(V,m){var _;const S=((_=V.target.files)==null?void 0:_[0])||null;S&&(l.endFrames[m]=S)}function x(V,m){var _;const S=((_=V.target.files)==null?void 0:_[0])||null;S&&(l.sceneRefs[m]=S)}async function v(){const V=l.idea.trim();if(!V){alert(d("enterIdea"));return}h.value=!0;const m=new FormData;if(m.append("idea",V),m.append("creative_name",l.name.trim()),m.append("style",l.style),m.append("chaining_mode",l.chaining),m.append("duration_source",l.durationSource),l.durationSource==="manual")if(m.append("scene_count",String(l.sceneCount)),m.append("uniform_duration",String(l.uniform)),l.uniform)m.append("scene_durations_json",JSON.stringify(Array(l.sceneCount).fill(l.uniformDuration)));else{const F=l.independentDurations.slice(0,l.sceneCount);m.append("scene_durations_json",JSON.stringify(F))}else m.append("scene_count","0"),m.append("uniform_duration","true"),m.append("scene_durations_json",JSON.stringify([]));const S=g(l.resolution);m.append("video_width",String(S.width)),m.append("video_height",String(S.height)),m.append("use_custom_end_frames",String(l.useEndFrames)),m.append("generate_end_frames_from_ref",String(l.genEndFromRef)),l.refImage&&m.append("reference_image",l.refImage),l.useEndFrames&&l.endFrames.forEach(F=>{F&&F.size>0&&m.append("end_frame_images",F)}),l.sceneRefs.length>0&&l.sceneRefs.forEach(F=>{F&&F.size>0&&m.append("scene_reference_images",F)});const _=p.value;_&&(m.append("audio_enabled",String(_.audioEnabled)),m.append("audio_voice",c.c),m.append("audio_lang","zh"),m.append("audio_rate",_.rate),m.append("subtitle_enabled",String(_.subtitleEnabled)),m.append("subtitle_style_mode",_.styleMode),m.append("subtitle_style_hints",_.style.hints),m.append("subtitle_font",_.style.font),m.append("subtitle_color",_.style.color),m.append("subtitle_fontsize",String(_.style.fontsize)),m.append("subtitle_position",_.style.position),m.append("subtitle_stroke_color",_.style.stroke_color),m.append("subtitle_stroke_width",String(_.style.stroke_width)),m.append("subtitle_bg_color",_.style.bg_color));try{const F=await Yc(m);if(!F.ok)throw new Error(F.detail||d("failCreate"));t("create_task",{task_type:"creative",style:l.style,chaining_mode:l.chaining,duration_source:l.durationSource,resolution:l.resolution,audio:_!=null&&_.audioEnabled?"on":"off",subtitle:_!=null&&_.subtitleEnabled?"on":"off"}),T.currentTaskType="creative",a(F.task_id),T.currentDirName=F.dir_name,await n(F.task_id,F.dir_name),await o(F.task_id),r(d("submitted"),5e3)}catch(F){t("create_task_failed",{task_type:"creative",error:(F.message||"").slice(0,120)}),alert(d("failCreate")+": "+F.message)}finally{h.value=!1}}return(V,m)=>(A(),C("div",null,[i("div",lh,[m[13]||(m[13]=i("span",{class:"text-muted"},"💡",-1)),i("a",dh,u(s(d)("exampleLinkCreative")),1)]),i("div",ch,[i("h2",ph,u(s(d)("creativeSettings")),1),i("div",uh,[i("label",mh,u(s(d)("taskName")),1),N(i("input",{"onUpdate:modelValue":m[0]||(m[0]=S=>l.name=S),placeholder:s(d)("taskNamePlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,8,gh),[[ie,l.name]])]),i("div",fh,[i("label",hh,[ct(u(s(d)("ideaLabel"))+" (idea) ",1),m[14]||(m[14]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":m[1]||(m[1]=S=>l.idea=S),rows:"4",placeholder:s(d)("ideaPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,bh),[[ie,l.idea]])]),i("div",kh,[i("h3",Sh,u(s(d)("sceneConfig")),1),i("div",vh,[i("label",yh,u(s(d)("durationSource")),1),i("div",Ph,[i("label",xh,[N(i("input",{"onUpdate:modelValue":m[2]||(m[2]=S=>l.durationSource=S),type:"radio",value:"manual",class:"text-accent"},null,512),[[rt,l.durationSource]]),i("span",_h,u(s(d)("sourceManual")),1)]),i("label",Ah,[N(i("input",{"onUpdate:modelValue":m[3]||(m[3]=S=>l.durationSource=S),type:"radio",value:"prompt",class:"text-accent"},null,512),[[rt,l.durationSource]]),i("span",Ch,u(s(d)("sourcePrompt")),1)])]),i("p",wh,u(l.durationSource==="manual"?s(d)("sourceManualHint"):s(d)("sourcePromptHint")),1)]),l.durationSource==="manual"?(A(),C("div",Th,[i("div",Ih,[i("label",Dh,u(s(d)("sceneCount")),1),N(i("input",{"onUpdate:modelValue":m[4]||(m[4]=S=>l.sceneCount=S),type:"number",min:"1",max:"30",class:"w-24 glass-input rounded-lg px-3 py-2 text-sm text-ink"},null,512),[[ie,l.sceneCount,void 0,{number:!0}]])]),i("div",Lh,[i("label",Mh,u(s(d)("durationMode")),1),i("div",Fh,[i("label",Eh,[N(i("input",{"onUpdate:modelValue":m[5]||(m[5]=S=>l.uniform=S),type:"radio",value:!0,class:"text-accent"},null,512),[[rt,l.uniform]]),i("span",null,u(s(d)("uniformDuration")),1)]),i("label",Vh,[N(i("input",{"onUpdate:modelValue":m[6]||(m[6]=S=>l.uniform=S),type:"radio",value:!1,class:"text-accent"},null,512),[[rt,l.uniform]]),i("span",null,u(s(d)("independentDuration")),1)])]),l.uniform?(A(),C("div",Hh,[N(i("input",{"onUpdate:modelValue":m[7]||(m[7]=S=>l.uniformDuration=S),type:"number",min:"2",max:"30",class:"w-24 glass-input rounded-lg px-3 py-2 text-sm text-ink"},null,512),[[ie,l.uniformDuration,void 0,{number:!0}]]),i("span",Kh,u(s(d)("seconds")),1)])):(A(),C("div",Rh,[(A(!0),C(de,null,Le(l.sceneCount,S=>(A(),C("div",{key:S,class:"flex items-center gap-2 mb-1.5"},[i("span",Gh,u(s(d)("scene_"))+u(S),1),N(i("input",{"onUpdate:modelValue":_=>l.independentDurations[S-1]=_,type:"number",min:"2",max:"30",class:"w-20 glass-input rounded-lg px-3 py-1.5 text-sm text-ink"},null,8,$h),[[ie,l.independentDurations[S-1],void 0,{number:!0}]]),i("span",zh,u(s(d)("seconds")),1)]))),128))]))])])):ae("",!0)]),i("div",Nh,[i("label",Bh,u(s(d)("visualStyle")),1),N(i("input",{"onUpdate:modelValue":m[8]||(m[8]=S=>l.style=S),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,512),[[ie,l.style]])])]),i("div",jh,[i("h2",Oh,u(s(d)("advancedSettings")),1),i("div",Uh,[i("div",null,[i("label",qh,u(s(d)("chainingMode")),1),N(i("select",{"onUpdate:modelValue":m[9]||(m[9]=S=>l.chaining=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",Wh,u(s(d)("modeKeyframes")),1),i("option",Yh,u(s(d)("modeTi2vid")),1),i("option",Qh,u(s(d)("modeNone")),1)],512),[[Ie,l.chaining]])]),i("div",null,[i("label",Jh,u(s(d)("resolution")),1),N(i("select",{"onUpdate:modelValue":m[10]||(m[10]=S=>l.resolution=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",Zh,u(s(d)("resPortrait")),1),i("option",Xh,u(s(d)("resLandscape")),1),i("option",eb,u(s(d)("resSquare")),1)],512),[[Ie,l.resolution]])])]),i("div",tb,[i("label",ab,u(s(d)("referenceImage")),1),i("div",nb,[i("label",ib,[i("span",null,u(s(d)("chooseImage")),1),i("input",{type:"file",accept:"image/*",class:"hidden",onChange:b},null,32)]),i("span",ob,u(l.refName||s(d)("notSelected")),1)]),i("p",sb,u(s(d)("refDescription")),1)]),i("div",rb,[i("div",lb,[i("label",db,u(s(d)("customEndFrames")),1),i("div",cb,[i("label",pb,[N(i("input",{"onUpdate:modelValue":m[11]||(m[11]=S=>l.useEndFrames=S),type:"checkbox",class:"rounded bg-paper-2 border-rule",onChange:y},null,544),[[bn,l.useEndFrames]]),i("span",null,u(s(d)("enableCustomEndFrames")),1)]),i("label",ub,[N(i("input",{"onUpdate:modelValue":m[12]||(m[12]=S=>l.genEndFromRef=S),type:"checkbox",class:"rounded bg-paper-2 border-rule",onChange:D},null,544),[[bn,l.genEndFromRef]]),i("span",null,u(s(d)("genEndFramesFromRef")),1)])])]),l.useEndFrames?(A(),C("div",mb,[i("p",gb,u(s(d)("endFrameDesc")),1),i("div",fb,[(A(!0),C(de,null,Le(l.sceneCount,S=>(A(),C("div",{key:S,class:"flex items-center gap-3 mb-2"},[i("span",hb,u(s(d)("scene_"))+" "+u(S),1),i("input",{type:"file",accept:"image/*",class:"end-frame-file flex-1 text-sm text-muted file:mr-3 file:py-1.5 file:px-3 file:rounded-lg file:border-0 file:text-sm file:bg-paper-3 file:text-ink-2 hover:file:bg-paper-3",onChange:_=>w(_,S-1)},null,40,bb)]))),128))])])):ae("",!0)]),i("div",kb,[i("label",Sb,u(s(d)("sceneReferenceImages")),1),i("p",vb,u(s(d)("sceneRefDesc")),1),i("div",yb,[(A(!0),C(de,null,Le(l.sceneCount,S=>(A(),C("div",{key:S,class:"flex items-center gap-3 mb-2"},[i("span",Pb,u(s(d)("scene_"))+" "+u(S),1),i("input",{type:"file",accept:"image/*",class:"scene-ref-file flex-1 text-sm text-muted file:mr-3 file:py-1.5 file:px-3 file:rounded-lg file:border-0 file:text-sm file:bg-paper-3 file:text-ink-2 hover:file:bg-paper-3",onChange:_=>x(_,S-1)},null,40,xb)]))),128))])])]),ce(zn,{ref_key:"subtitleRef",ref:p,task:"c","with-style":!0},null,512),ce(ja),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",disabled:h.value,onClick:v},u(h.value?s(d)("submitting"):s(d)("startGenerate")),9,_b)]))}}),Cb={class:"flex items-center gap-2 mb-4 text-xs text-muted"},wb={href:"https://video.lichuanyang.top/guides/prompt-examples-manuscript",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},Tb={class:"glass-card rounded-2xl p-6 mb-4"},Ib={class:"text-lg font-semibold text-accent mb-4"},Db={class:"mb-4"},Lb={class:"block text-sm text-muted mb-1.5"},Mb=["placeholder"],Fb={class:"mb-4"},Eb={class:"block text-sm text-muted mb-1.5"},Vb=["placeholder"],Hb={class:"text-xs text-muted mt-1"},Kb={class:"mb-4"},Rb={class:"block text-sm text-muted mb-1.5"},Gb={value:"768x1152"},$b={value:"1152x768"},zb={value:"1024x1024"},Nb=["disabled"],Bb=Ke({__name:"ManuscriptForm",setup(e){const{trackEvent:t}=ut(),{setRunning:a,showProgress:n,startPolling:o}=Vt(),{showToast:r}=At(),{voiceSelections:c}=Qt(),p=U(),l=He({name:"",text:"",resolution:"768x1152"}),h=Be(()=>l.text.length),g=U(!1);function b(D){const[w,x]=D.split("x").map(Number);return{width:w,height:x}}async function y(){const D=l.text.trim();if(!D){alert(d("enterText"));return}g.value=!0;const w=new FormData;w.append("manuscript_text",D),w.append("creative_name",l.name.trim());const x=b(l.resolution);w.append("video_width",String(x.width)),w.append("video_height",String(x.height));const v=p.value;v&&(w.append("audio_enabled",String(v.audioEnabled)),w.append("audio_voice",c.m),w.append("audio_lang","zh"),w.append("audio_rate",v.rate),w.append("subtitle_enabled",String(v.subtitleEnabled)),w.append("subtitle_style_mode",v.styleMode),w.append("subtitle_style_hints",v.style.hints),w.append("subtitle_font",v.style.font),w.append("subtitle_color",v.style.color),w.append("subtitle_fontsize",String(v.style.fontsize)),w.append("subtitle_position",v.style.position),w.append("subtitle_stroke_color",v.style.stroke_color),w.append("subtitle_stroke_width",String(v.style.stroke_width)),w.append("subtitle_bg_color",v.style.bg_color));try{const V=await Qc(w);if(!V.ok)throw new Error(V.detail||d("failCreate"));t("create_task",{task_type:"manuscript",resolution:l.resolution,text_len:D.length,audio:v!=null&&v.audioEnabled?"on":"off",subtitle:v!=null&&v.subtitleEnabled?"on":"off"}),T.currentTaskType="manuscript",a(V.task_id),T.currentDirName=V.dir_name,await n(V.task_id,V.dir_name),await o(V.task_id),r(d("submitted"),5e3)}catch(V){t("create_task_failed",{task_type:"manuscript",error:(V.message||"").slice(0,120)}),alert(d("failCreate")+": "+V.message)}finally{g.value=!1}}return(D,w)=>(A(),C("div",null,[i("div",Cb,[w[3]||(w[3]=i("span",{class:"text-muted"},"💡",-1)),i("a",wb,u(s(d)("exampleLinkManuscript")),1)]),i("div",Tb,[i("h2",Ib,u(s(d)("manuscriptSettings")),1),i("div",Db,[i("label",Lb,u(s(d)("taskName")),1),N(i("input",{"onUpdate:modelValue":w[0]||(w[0]=x=>l.name=x),placeholder:s(d)("taskNamePlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,8,Mb),[[ie,l.name]])]),i("div",Fb,[i("label",Eb,[ct(u(s(d)("manuscriptText"))+" ",1),w[4]||(w[4]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":w[1]||(w[1]=x=>l.text=x),rows:"10",placeholder:s(d)("manuscriptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted font-mono"},null,8,Vb),[[ie,l.text]]),i("p",Hb,u(s(d)("charCount"))+": "+u(h.value),1)]),i("div",Kb,[i("label",Rb,u(s(d)("resolution")),1),N(i("select",{"onUpdate:modelValue":w[2]||(w[2]=x=>l.resolution=x),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",Gb,u(s(d)("resPortrait")),1),i("option",$b,u(s(d)("resLandscape")),1),i("option",zb,u(s(d)("resSquare")),1)],512),[[Ie,l.resolution]])])]),ce(zn,{ref_key:"subtitleRef",ref:p,task:"m","with-style":!0},null,512),ce(ja),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",disabled:g.value,onClick:y},u(g.value?s(d)("submitting"):s(d)("startGenerate")),9,Nb)]))}}),jb={class:"flex items-center gap-2 mb-4 text-xs text-muted"},Ob={href:"https://video.lichuanyang.top/guides/prompt-examples-anchor",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},Ub={class:"glass-card rounded-2xl p-6 mb-4"},qb={class:"text-lg font-semibold text-accent mb-4"},Wb={class:"mb-4"},Yb={class:"block text-sm text-muted mb-1.5"},Qb=["placeholder"],Jb={class:"mb-4"},Zb={class:"block text-sm text-muted mb-1.5"},Xb={class:"flex items-center gap-4"},ek={class:"cursor-pointer px-4 py-2.5 glass-input rounded-lg text-sm transition inline-block hover:border-blue-500/30"},tk={class:"text-sm text-muted"},ak={class:"text-xs text-muted mt-1"},nk={class:"mb-4"},ik={class:"block text-sm text-muted mb-1.5"},ok=["placeholder"],sk={class:"text-xs text-muted mt-1"},rk={class:"mb-4"},lk={class:"block text-sm text-muted mb-1.5"},dk={value:"768x1344"},ck={value:"1152x768"},pk={value:"1024x1024"},uk={class:"glass-card rounded-2xl p-6 mb-4"},mk={class:"mb-4 p-3 bg-paper-2/50 rounded-lg border border-rule"},gk={class:"block text-sm text-muted mb-2"},fk={class:"flex flex-col gap-2"},hk={class:"flex items-start gap-3 cursor-pointer group"},bk={class:"text-sm text-ink-2 group-hover:text-ink transition"},kk={class:"text-xs text-muted mt-0.5"},Sk={class:"flex items-start gap-3 cursor-pointer group"},vk={class:"text-sm text-ink-2 group-hover:text-ink transition"},yk={class:"text-xs text-muted mt-0.5"},Pk=["disabled"],xk=Ke({__name:"AnchorForm",setup(e){const{trackEvent:t}=ut(),{setRunning:a,showProgress:n,startPolling:o}=Vt(),{showToast:r}=At(),{voiceSelections:c}=Qt(),p=U(),l=He({prompt:"",refImage:null,refName:"",script:"",resolution:"768x1344",audioSource:"post_stitch"}),h=Be(()=>l.script.length),g=U(!1);function b(w){const[x,v]=w.split("x").map(Number);return{width:x,height:v}}function y(w){var v;const x=((v=w.target.files)==null?void 0:v[0])||null;l.refImage=x,l.refName=x?x.name:""}async function D(){const w=l.script.trim();if(!w){alert(d("enterText"));return}g.value=!0;const x=new FormData;x.append("script_text",w);const v=l.prompt.trim();v&&x.append("anchor_prompt",v);const V=b(l.resolution);x.append("video_width",String(V.width)),x.append("video_height",String(V.height)),l.refImage&&x.append("anchor_reference_image",l.refImage),x.append("audio_source",l.audioSource);const m=p.value;m&&(x.append("audio_enabled",String(l.audioSource==="model"?!1:m.audioEnabled)),x.append("audio_voice",c.a),x.append("audio_lang","zh"),x.append("audio_rate",m.rate),x.append("subtitle_enabled",String(m.subtitleEnabled)),x.append("subtitle_style_mode",m.styleMode),x.append("subtitle_style_hints",m.style.hints),x.append("subtitle_font",m.style.font),x.append("subtitle_color",m.style.color),x.append("subtitle_fontsize",String(m.style.fontsize)),x.append("subtitle_position",m.style.position),x.append("subtitle_stroke_color",m.style.stroke_color),x.append("subtitle_stroke_width",String(m.style.stroke_width)),x.append("subtitle_bg_color",m.style.bg_color));try{const S=await Jc(x);if(!S.ok)throw new Error(S.detail||d("failCreate"));t("create_task",{task_type:"anchor",resolution:l.resolution,audio_source:l.audioSource,audio:l.audioSource==="model"?"off":m!=null&&m.audioEnabled?"on":"off",subtitle:m!=null&&m.subtitleEnabled?"on":"off"}),T.currentTaskType="anchor",a(S.task_id),T.currentDirName=S.dir_name,await n(S.task_id,S.dir_name),await o(S.task_id),r(d("submitted"),5e3)}catch(S){t("create_task_failed",{task_type:"anchor",error:(S.message||"").slice(0,120)}),alert(d("failCreate")+": "+S.message)}finally{g.value=!1}}return(w,x)=>(A(),C("div",null,[i("div",jb,[x[5]||(x[5]=i("span",{class:"text-muted"},"💡",-1)),i("a",Ob,u(s(d)("exampleLinkAnchor")),1)]),i("div",Ub,[i("h2",qb,u(s(d)("anchorSettings")),1),i("div",Wb,[i("label",Yb,u(s(d)("anchorPrompt")),1),N(i("textarea",{"onUpdate:modelValue":x[0]||(x[0]=v=>l.prompt=v),rows:"3",placeholder:s(d)("anchorPromptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,Qb),[[ie,l.prompt]])]),i("div",Jb,[i("label",Zb,u(s(d)("anchorRefImage")),1),i("div",Xb,[i("label",ek,[i("span",null,u(s(d)("chooseImage")),1),i("input",{type:"file",accept:"image/*",class:"hidden",onChange:y},null,32)]),i("span",tk,u(l.refName||s(d)("notSelected")),1)]),i("p",ak,u(s(d)("anchorRefImageHint")),1)]),i("div",nk,[i("label",ik,[ct(u(s(d)("scriptText"))+" ",1),x[6]||(x[6]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":x[1]||(x[1]=v=>l.script=v),rows:"8",placeholder:s(d)("scriptTextPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted font-mono"},null,8,ok),[[ie,l.script]]),i("p",sk,u(s(d)("charCount"))+": "+u(h.value),1)]),i("div",rk,[i("label",lk,u(s(d)("resolution")),1),N(i("select",{"onUpdate:modelValue":x[2]||(x[2]=v=>l.resolution=v),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",dk,u(s(d)("resPortraitHD")),1),i("option",ck,u(s(d)("resLandscape")),1),i("option",pk,u(s(d)("resSquare")),1)],512),[[Ie,l.resolution]])])]),i("div",uk,[i("div",mk,[i("label",gk,u(s(d)("audioSource")),1),i("div",fk,[i("label",hk,[N(i("input",{"onUpdate:modelValue":x[3]||(x[3]=v=>l.audioSource=v),type:"radio",name:"a_audio_source",value:"post_stitch",class:"mt-0.5 accent-blue-500"},null,512),[[rt,l.audioSource]]),i("div",null,[i("span",bk,u(s(d)("audioPostStitch")),1),i("p",kk,u(s(d)("audioPostStitchDesc")),1)])]),i("label",Sk,[N(i("input",{"onUpdate:modelValue":x[4]||(x[4]=v=>l.audioSource=v),type:"radio",name:"a_audio_source",value:"model",class:"mt-0.5 accent-blue-500"},null,512),[[rt,l.audioSource]]),i("div",null,[i("span",vk,u(s(d)("audioModel")),1),i("p",yk,u(s(d)("audioModelDesc")),1)])])])])]),i("div",{class:Pe({"opacity-40 pointer-events-none":l.audioSource==="model"})},[ce(zn,{ref_key:"subtitleRef",ref:p,task:"a","with-style":!0},null,512)],2),ce(ja),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",disabled:g.value,onClick:D},u(g.value?s(d)("submitting"):s(d)("startGenerate")),9,Pk)]))}}),_k={class:"glass-card rounded-2xl p-6 mb-4"},Ak={class:"text-lg font-semibold text-accent mb-4"},Ck={class:"mb-4"},wk={class:"block text-sm text-muted mb-1.5"},Tk=["placeholder"],Ik={class:"mb-4"},Dk={class:"block text-sm text-muted mb-1.5"},Lk=["placeholder"],Mk={class:"text-xs text-muted mt-1.5"},Fk={class:"mb-4 p-4 rounded-xl bg-paper-2/30 border border-rule/50"},Ek={class:"text-sm font-medium text-accent mb-3"},Vk={class:"text-xs text-muted mb-3"},Hk={class:"mb-3"},Kk={class:"block text-xs text-muted mb-1"},Rk={class:"mb-3"},Gk={class:"block text-xs text-muted mb-1.5"},$k={class:"flex gap-2 mb-2"},zk={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},Nk={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},Bk={key:0},jk={class:"text-xs text-muted ml-1"},Ok={key:1,class:"space-y-2"},Uk={class:"text-xs text-muted w-12"},qk=["onUpdate:modelValue"],Wk={class:"text-xs text-muted"},Yk={class:"mb-4"},Qk={class:"block text-sm text-muted mb-1.5"},Jk=["placeholder"],Zk={class:"text-xs text-muted mt-1.5"},Xk={class:"text-xs text-muted mt-1.5 font-mono bg-paper-2/40 rounded px-2 py-1"},eS={class:"mt-3 p-3 rounded-lg bg-paper-2/40 border border-rule/50"},tS={class:"flex items-center justify-between"},aS={class:"text-xs text-ink-2 font-medium"},nS={key:0,class:"mt-2"},iS={class:"text-xs text-muted mb-1.5"},oS={class:"text-[11px] text-ink-2 whitespace-pre-wrap bg-paper/60 rounded p-2 max-h-40 overflow-auto"},sS={class:"text-[11px] text-muted whitespace-pre-wrap bg-paper/60 rounded p-2 mt-1 max-h-40 overflow-auto"},rS={class:"mb-4"},lS={class:"block text-sm text-muted mb-1.5"},dS={class:"glass-card rounded-2xl p-6 mb-4"},cS={class:"text-lg font-semibold text-accent mb-4"},pS={class:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4"},uS={class:"block text-sm text-muted mb-1.5"},mS={value:"768x1152"},gS={value:"1152x768"},fS={value:"1024x1024"},hS=["disabled"],bS=Ke({__name:"PoetryForm",setup(e){const{trackEvent:t}=ut(),{setRunning:a,showProgress:n,startPolling:o}=Vt(),{showToast:r}=At(),{voiceSelections:c}=Qt(),p=U(),l=He({name:"",poem:"",sceneCount:3,uniform:!0,uniformDuration:5,independentDurations:[],scenePrompts:"",style:"电影质感写实风格",resolution:"768x1152"}),h=U(!1),g=U(!1),b=U(""),y=U(""),D=U("");function w(F){const[K,R]=F.split("x").map(Number);return{width:K,height:R}}function x(){const F=l.poem.trim(),K=l.sceneCount||3;let R=[];if(l.uniform)R=Array(K).fill(l.uniformDuration||5);else for(R=l.independentDurations.slice(0,K);R.length<K;)R.push(5);const Se=R.reduce((O,J)=>O+J,0)||30;return{poem:F,scene_count:K,scene_durations:R,total_duration:Se,style:l.style.trim()}}async function v(){try{const F=x(),K=await qc({poem:F.poem,scene_count:String(F.scene_count),scene_durations:JSON.stringify(F.scene_durations),total_duration:String(F.total_duration),style:F.style});b.value=K.system_prompt||"",y.value=K.user_prompt||""}catch(F){console.error("loadPoetryPrompt error:",F)}}async function V(){g.value=!g.value,g.value&&await v()}function m(F,K){const R=document.createElement("textarea");R.value=F,R.style.position="fixed",R.style.opacity="0",document.body.appendChild(R),R.select();try{document.execCommand("copy")}catch{}document.body.removeChild(R),K()}async function S(){await v();const F=b.value+`
29
- ========
30
27
  `+o;confirm(r)&&await Bp(t,e.artifact_id)}async function Bp(e,t){try{const a=await Uc(e,t);if(!a.ok)throw new Error(a.detail||"Delete failed");Object.keys(Ta).forEach(n=>delete Ta[n]);try{(await za(e)).task_type&&Bi()}catch{}}catch(a){alert(d("artifactDeleteFailed")+": "+a.message)}}function _r(){return{artifactsAreaVisible:nn,artifactGroups:yr,isRunning:Pr,imageModalUrl:ji,stepLabelMap:Vp,loadArtifacts:Bi,scheduleArtifactRefresh:Ep,artifactLabel:Hp,artifactIcon:Kp,artifactFileUrl:xr,formatSize:Rp,toggleArtifactPreview:Gp,openImageModal:$p,closeImageModal:zp,confirmDeleteArtifact:Np}}const jp=3e4,{trackTaskResultOnce:Wo}=ut(),{loadArtifacts:Op,scheduleArtifactRefresh:Yo}=_r(),Ar=U(!1),Oi=U(0),Rn=U(""),Ui=U(!1),Cr=U(""),yn=U([]),qi=U({}),wr=U(""),Wi=U(!1);let on=null;function Tr(e){yn.value=Mp(e);const t={};yn.value.forEach(a=>t[a.key]="pending"),qi.value=t}function Gn(e,t){qi.value[e]=t}function Yi(e){const t=e.task_type||T.currentTaskType||"creative";yn.value.forEach(a=>{Fp(e,a.key,t)&&Gn(a.key,"done")})}function Up(e){Rn.value=e}async function qp(e,t){Ar.value=!0,Wi.value=!1,Ui.value=!1,Oi.value=0;let a=null;try{a=await za(e),a&&a.task_type&&(T.currentTaskType=a.task_type)}catch{}if(Tr(T.currentTaskType),a){Yi(a);const o=(a.current_step||"").replace(/^step_/,""),r=a.current_status||"";o&&r==="running"&&Gn(o,"running")}const n=t?`<br><span class="text-muted text-xs">${d("dir")}: <span class="font-mono">${t}</span></span>`:"";Rn.value=`<span class="text-accent animate-pulse">${d("taskStarting")}</span><br><span class="text-muted">${d("task_")}: ${e}</span>${n}`,T.currentArtifactsTaskId=e,Op()}async function Ir(e){if(!(!T.isTaskRunning||!e))try{const t=await za(e);Oi.value=Math.round((t.current_progress||0)*100),t.current_message&&(Rn.value=t.current_message),Yi(t);const a=(t.current_step||"").replace(/^step_/,""),n=t.current_status||"";a&&n==="running"&&Gn(a,"running"),a&&Yo(),t.status==="completed"&&(Wo("task_completed",e,{task_type:t.task_type||T.currentTaskType,...t.mode?{mode:t.mode}:{}}),Dr(t.final_video_file,e),yi(),Yo()),(t.status==="failed"||a==="error"&&n==="failed")&&(Wo("task_failed",e,{task_type:t.task_type||T.currentTaskType,...t.mode?{mode:t.mode}:{},error:(t.current_message||"").slice(0,120)}),yi(),Wi.value=!0,wr.value=t.current_message||d("genFailedMsg"))}catch{}}function Wp(e){Qi(),on=setInterval(()=>Ir(e),jp)}function Qi(){on&&(clearInterval(on),on=null)}function Dr(e,t){e&&t&&(Ui.value=!0,Cr.value="/api/video/"+t)}function Yp(e){T.isTaskRunning=!0,T.currentTaskId=e}function yi(){T.isTaskRunning=!1,T.currentTaskId=null,Qi()}function Vt(){return{progressVisible:Ar,progressPct:Oi,progressMessage:Rn,resultVideoVisible:Ui,resultVideoSrc:Cr,steps:yn,stepStates:qi,taskFailed:Wi,failedMessage:wr,showProgress:qp,pollTaskProgress:Ir,startPolling:Wp,stopPolling:Qi,showResult:Dr,setRunning:Yp,clearRunning:yi,markStep:Gn,markCompletedStepsFromState:Yi,resetSteps:Tr,setProgressMessageHtml:Up}}const{showToast:Ji}=At(),{trackEvent:Lr}=ut(),{setRunning:Mr,showProgress:Fr,showResult:Qp,startPolling:Er}=Vt(),Vr=U([]),Hr=U(!1);let Ia=null;async function $n(){try{const e=await Gc();Vr.value=e.tasks||[]}catch{Hr.value=!1}}function Jp(){Ia||(Ia=setInterval($n,5e3))}function Zp(){Ia&&(clearInterval(Ia),Ia=null)}async function Kr(e){try{const t=await za(e);return T.currentTaskType=t.task_type||"creative",await Fr(e,t.dir_name),t.final_video_file&&Qp(t.final_video_file,e),t}catch(t){return alert(d("failLoad")+": "+t.message),null}}async function Xp(e){await Kr(e)&&(Mr(e),await Er(e))}async function eu(e){try{const t=await $c(e);if(!t.ok)throw new Error(t.detail||d("failResume"));let a="creative";try{a=(await za(e)).task_type||"creative"}catch{}T.currentTaskType=a,Mr(e),T.currentDirName=t.dir_name,await Fr(e,t.dir_name),await Er(e),Ji(d("resumed"),5e3)}catch(t){alert(d("failResume")+": "+t.message)}}async function tu(e){if(confirm(d("stopConfirmById")))try{const t=await zc(e);if(!t.ok)throw new Error(t.detail||d("failStop"));Lr("task_stopped",{task_type:T.currentTaskType||"",source:"list"}),Ji(d("stoppedById"),3e3),$n()}catch(t){alert(d("failStop")+": "+t.message)}}async function au(e){if(confirm(d("deleteTaskConfirm")))try{const t=await Nc(e);if(!t.ok)throw new Error(t.detail||d("failDelete"));Lr("task_deleted",{task_type:T.currentTaskType||"",source:"list"}),Ji(d("deletedTask"),3e3),$n()}catch(t){alert(d("failDelete")+": "+t.message)}}const Rr=U(null);function nu(e,t){Rr.value=t}function Zi(){return{tasks:Vr,loading:Hr,detailState:Rr,loadTaskList:$n,startTaskListTimer:Jp,stopTaskListTimer:Zp,viewTask:Kr,viewRunningTask:Xp,resumeTask:eu,stopTaskById:tu,deleteTaskById:au,showTaskDetail:nu}}const iu={class:"glass-card rounded-2xl mb-6 overflow-hidden transition-all duration-300"},ou=["aria-expanded"],su={class:"flex items-center gap-3"},ru={class:"text-sm text-muted"},lu={class:"text-ink-2 font-medium"},du={key:1,class:"p-6 pt-4"},cu={class:"flex items-center justify-between mb-3"},pu={class:"text-lg font-semibold text-accent"},uu={class:"flex items-center gap-2"},mu={class:"flex gap-3 items-start"},gu=["placeholder"],fu={key:0,class:"mt-2 flex items-center gap-2 flex-wrap"},hu={class:"text-xs px-2 py-0.5 rounded-full bg-green-900 text-green-300"},bu={class:"opacity-70"},ku={key:0,class:"text-xs px-2 py-0.5 rounded-full bg-blue-900 text-blue-300"},Su={key:1,class:"mt-3 space-y-1.5"},vu={class:"flex-1 font-mono text-ink-2 truncate"},yu=["title","onClick"],Pu=["title"],xu={class:"flex flex-wrap items-center gap-x-5 gap-y-1.5 mt-3 text-xs"},_u={href:"https://platform.agnes-ai.com",target:"_blank",rel:"noopener",class:"text-accent hover:text-ink transition-colors"},Au={href:"https://video.lichuanyang.top/guides/api-key",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},Cu={href:"https://video.lichuanyang.top/demo",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},wu={class:"glass-card rounded-2xl mb-6 overflow-hidden transition-all duration-300"},Tu={class:"flex items-center gap-3"},Iu={class:"text-sm text-muted"},Du={class:"text-ink-2 font-medium"},Lu={key:0,class:"text-muted"},Mu={key:1,class:"text-muted"},Fu={key:1,class:"p-6 pt-4"},Eu={class:"flex items-center justify-between mb-3"},Vu={class:"text-lg font-semibold text-accent"},Hu={class:"flex items-center gap-2"},Ku={class:"text-xs px-2 py-1 rounded-full bg-paper-2 text-muted"},Ru={class:"text-xs text-muted mb-4"},Gu={class:"space-y-3"},$u={class:"block text-xs text-muted mb-1"},zu={class:"flex gap-3"},Nu=["value"],Bu={key:0,class:"text-xs text-accent mt-1.5"},ju={key:1,class:"text-xs text-amber-400 mt-1.5"},Ou={class:"block text-xs text-muted mb-1"},Uu={class:"block text-xs text-muted mb-1"},qu={class:"flex gap-3 mt-4"},Wu={key:0,class:"self-center text-xs text-green-400"},Yu={key:1,class:"self-center text-xs text-red-400"},Qu={class:"glass-card rounded-2xl mb-6 overflow-hidden transition-all duration-300"},Ju={class:"flex items-center gap-3"},Zu={class:"text-sm text-muted"},Xu={class:"text-ink-2 font-medium"},em={key:1,class:"p-6 pt-4"},tm={class:"flex items-center justify-between mb-3"},am={class:"text-lg font-semibold text-accent"},nm={class:"flex items-center gap-2"},im={class:"text-xs text-muted mb-4"},om={class:"space-y-3"},sm={class:"flex items-center gap-3 glass-input rounded-lg px-4 py-3 cursor-pointer hover:border-blue-500/40 transition"},rm={class:"text-xs text-muted ml-2"},lm={class:"flex items-center gap-3 glass-input rounded-lg px-4 py-3 cursor-pointer hover:border-blue-500/40 transition"},dm={class:"text-xs text-muted ml-2"},cm={class:"flex gap-3 mt-4"},pm={key:0,class:"self-center text-xs text-green-400"},um={key:1,class:"self-center text-xs text-red-400"},mm={class:"glass-card rounded-2xl mb-6 overflow-hidden transition-all duration-300"},gm={class:"flex items-center gap-3"},fm={class:"text-sm text-muted"},hm={class:"text-ink-2 font-medium"},bm={key:1,class:"p-6 pt-4"},km={class:"flex items-center justify-between mb-3"},Sm={class:"text-lg font-semibold text-accent"},vm={class:"flex items-center gap-2"},ym={key:0,class:"mb-3 text-xs text-accent bg-accent/15/30 rounded-lg px-3 py-2"},Pm={key:1,class:"mb-3 glass-input rounded-lg px-4 py-2.5"},xm={class:"text-xs text-muted mb-0.5"},_m={class:"text-sm text-green-300 font-medium"},Am={class:"text-xs text-muted font-mono truncate"},Cm={class:"flex gap-3 mb-4"},wm=["placeholder"],Tm=["placeholder"],Im={class:"flex items-center gap-2 mb-2"},Dm={class:"text-sm font-medium text-muted"},Lm={class:"text-xs text-muted"},Mm={class:"space-y-2"},Fm={class:"flex-1 min-w-0"},Em={class:"text-sm text-ink truncate"},Vm={class:"text-xs text-muted font-mono truncate"},Hm={class:"flex gap-2 ml-3"},Km={key:0,class:"text-xs px-2 py-1 rounded-full bg-green-900 text-green-300"},Rm=["onClick"],Gm=["onClick"],$m=Ke({__name:"ConfigPanel",setup(e){const{apiKeyStatus:t,keyCount:a,keySource:n,keyList:o,saveMultiKeys:r,loadKeyInfo:c,removeKey:p,clearApiKey:l,modelSaveStatus:h,modelErrorMsg:g,betaHintVisible:b,isBetaModel:y,isPaidModel:D,syncModels:w,saveModels:x,domainSaveStatus:v,domainErrorMsg:V,saveDomain:m,isRegression:S,wsDisplayName:_,activateWorkspace:F,removeWorkspaceEntry:K,browseDirectory:R,addWorkspace:Se}=$i(),O=He({apikey:!1,model:!1,domain:!1,workspace:!1});function J(){const ve=fr();["apikey","model","domain","workspace"].forEach(we=>{const Ct=ve[we+"_manual"];Ct!==void 0&&(O[we]=Ct)})}function ne(ve){O[ve]=!O[ve],Ac(ve+"_manual",O[ve])}const j=U(""),te=Be(()=>t.value!=="none");function ge(ve){return D(ve)?ve+d("modelPaidTag"):y(ve)?ve+d("modelBetaTag"):ve}async function be(){const ve=j.value.trim();if(!ve){alert(d("enterApiKey"));return}await r(ve)&&(j.value="")}c();const ee=U(""),se=U("");async function ue(){const ve=await R();ve&&(ee.value=ve)}async function mt(){await Se(ee.value.trim(),se.value.trim()),ee.value="",se.value=""}return J(),(ve,$)=>{var we,Ct;return A(),C(de,null,[i("div",iu,[O.apikey?(A(),C("div",{key:0,class:"flex items-center justify-between px-6 py-3 cursor-pointer hover:bg-paper-3 transition",role:"button",tabindex:"0","aria-expanded":!O.apikey,onClick:$[0]||($[0]=q=>ne("apikey"))},[i("div",su,[$[21]||($[21]=i("span",{class:"text-sm"},"🔑",-1)),i("span",ru,[i("span",lu,u(s(d)("apiKeyTitle")),1),$[20]||($[20]=i("span",{class:"text-muted mx-2"},"·",-1)),i("span",{class:Pe(s(t)!=="none"?"text-green-400":"text-muted")},u(s(t)==="env"?s(d)("apiKeyFromEnv"):s(t)==="configured"?s(d)("apiKeyConfigured"):s(d)("apiKeyNotConfigured")),3)])]),$[22]||($[22]=i("span",{class:"text-muted text-xs"},"▶",-1))],8,ou)):(A(),C("div",du,[i("div",cu,[i("h2",pu,u(s(d)("apiKeyTitle")),1),i("div",uu,[i("span",{class:Pe(["text-xs px-2 py-1 rounded-full",s(t)!=="none"?"bg-green-900 text-green-300":"bg-paper-2 text-muted"])},u(s(t)==="env"?s(d)("apiKeyFromEnv"):s(t)==="configured"?s(d)("apiKeyConfigured"):s(d)("apiKeyNotConfigured")),3),i("button",{class:"text-xs text-muted hover:text-ink-2 transition px-2 py-1 rounded",onClick:$[1]||($[1]=q=>ne("apikey"))},"▲")])]),i("div",mu,[N(i("textarea",{"onUpdate:modelValue":$[2]||($[2]=q=>j.value=q),rows:"2",placeholder:te.value?s(d)("apiKeyAppendPlaceholder"):s(d)("apiKeyPlaceholder"),class:"flex-1 glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted resize-y"},null,8,gu),[[ie,j.value]]),i("button",{class:"px-5 py-2.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-lg text-sm font-medium transition whitespace-nowrap",onClick:be},u(te.value?s(d)("addKey"):s(d)("save")),1),s(t)!=="none"?(A(),C("button",{key:0,class:"px-5 py-2.5 bg-red-600/80 hover:bg-red-500 rounded-lg text-sm font-medium transition whitespace-nowrap",onClick:$[3]||($[3]=(...q)=>s(l)&&s(l)(...q))},u(s(d)("clear")),1)):ae("",!0)]),s(a)>0?(A(),C("div",fu,[i("span",hu,[ct(u(s(d)("keyCountLabel"))+": "+u(s(a))+" ",1),i("span",bu,"("+u(s(n))+")",1)]),s(a)>1?(A(),C("span",ku,u(s(d)("multiKeyActive")),1)):ae("",!0)])):ae("",!0),s(o).length>0?(A(),C("div",Su,[(A(!0),C(de,null,Le(s(o),(q,pa)=>(A(),C("div",{key:q.id+pa,class:"flex items-center gap-2 rounded-lg px-3 py-1.5 bg-paper-3/70 text-xs"},[i("code",vu,u(q.mask),1),i("span",{class:Pe(["px-1.5 py-0.5 rounded text-[10px] uppercase",q.source==="env"?"bg-amber-900/60 text-amber-300":"bg-paper-3 text-muted"])},u(q.source==="env"?s(d)("keySrcEnv"):s(d)("keySrcConfig")),3),q.source!=="env"?(A(),C("button",{key:0,class:"text-red-300 hover:text-red-200 transition",title:s(d)("removeKeyBtn"),onClick:Jt=>s(p)(q.id)}," ✕ ",8,yu)):(A(),C("span",{key:1,class:"text-muted/50",title:s(d)("keySrcEnvHint")},"•",8,Pu))]))),128))])):ae("",!0),i("div",xu,[i("a",_u,"🚀 "+u(s(d)("apiKeyGetLink")),1),i("a",Au,"📖 "+u(s(d)("apiKeyGuideLink")),1),i("a",Cu,"⚡ "+u(s(d)("apiKeyDemoLink")),1)])]))]),i("div",wu,[O.model?(A(),C("div",{key:0,class:"flex items-center justify-between px-6 py-3 cursor-pointer hover:bg-paper-3 transition",role:"button",tabindex:"0",onClick:$[4]||($[4]=q=>ne("model"))},[i("div",Tu,[$[24]||($[24]=i("span",{class:"text-sm"},"🧠",-1)),i("span",Iu,[i("span",Du,u(s(d)("modelTitle")),1),$[23]||($[23]=i("span",{class:"text-muted mx-2"},"·",-1)),s(T).models.text||s(T).models.image||s(T).models.video?(A(),C("span",Lu,u(s(d)("modelTagText"))+" "+u(s(T).models.text)+" "+u(s(d)("modelTagImage"))+" "+u(s(T).models.image)+" "+u(s(d)("modelTagVideo"))+" "+u(s(T).models.video),1)):(A(),C("span",Mu,"—"))])]),$[25]||($[25]=i("span",{class:"text-muted text-xs"},"▶",-1))])):(A(),C("div",Fu,[i("div",Eu,[i("h2",Vu,u(s(d)("modelTitle")),1),i("div",Hu,[i("span",Ku,u(s(d)("modelSyncIdle")),1),i("button",{class:"text-xs text-muted hover:text-ink-2 transition px-2 py-1 rounded",onClick:$[5]||($[5]=q=>ne("model"))},"▲")])]),i("p",Ru,u(s(d)("modelHint")),1),i("div",Gu,[i("div",null,[i("label",$u,u(s(d)("modelTextLabel")),1),i("div",zu,[N(i("select",{"onUpdate:modelValue":$[6]||($[6]=q=>s(T).models.text=q),class:"flex-1 glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[(A(!0),C(de,null,Le(s(T).modelListCache.text,q=>(A(),C("option",{key:q,value:q},u(ge(q)),9,Nu))),128))],512),[[Ie,s(T).models.text]]),i("button",{class:"px-4 py-2.5 bg-paper-3 hover:bg-paper-3 rounded-lg text-sm font-medium transition whitespace-nowrap",onClick:$[7]||($[7]=(...q)=>s(w)&&s(w)(...q))},u(s(d)("modelSync")),1)]),s(b)?(A(),C("p",Bu,u(s(d)("modelBetaHint")),1)):ae("",!0),s(D)(s(T).models.text)?(A(),C("p",ju,u(s(d)("modelPaidHint")),1)):ae("",!0)]),i("div",null,[i("label",Ou,u(s(d)("modelImageLabel")),1),N(i("select",{"onUpdate:modelValue":$[8]||($[8]=q=>s(T).models.image=q),disabled:"",class:"flex-1 glass-input rounded-lg px-3 py-2.5 text-sm text-ink opacity-50 cursor-not-allowed"},null,512),[[Ie,s(T).models.image]])]),i("div",null,[i("label",Uu,u(s(d)("modelVideoLabel")),1),N(i("select",{"onUpdate:modelValue":$[9]||($[9]=q=>s(T).models.video=q),disabled:"",class:"flex-1 glass-input rounded-lg px-3 py-2.5 text-sm text-ink opacity-50 cursor-not-allowed"},null,512),[[Ie,s(T).models.video]])])]),i("div",qu,[i("button",{class:"px-5 py-2.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-lg text-sm font-medium transition",onClick:$[10]||($[10]=(...q)=>s(x)&&s(x)(...q))},u(s(d)("save")),1),s(h)==="ok"?(A(),C("span",Wu,u(s(d)("modelSaved")),1)):ae("",!0),s(h)==="error"?(A(),C("span",Yu,u(s(g)),1)):ae("",!0)])]))]),i("div",Qu,[O.domain?(A(),C("div",{key:0,class:"flex items-center justify-between px-6 py-3 cursor-pointer hover:bg-paper-3 transition",role:"button",tabindex:"0",onClick:$[11]||($[11]=q=>ne("domain"))},[i("div",Ju,[$[27]||($[27]=i("span",{class:"text-sm"},"🌐",-1)),i("span",Zu,[i("span",Xu,u(s(d)("domainTitle")),1),$[26]||($[26]=i("span",{class:"text-muted mx-2"},"·",-1)),i("span",{class:Pe(s(T).agnesDomain==="cn"?"text-green-400":"text-muted")},"apihub.agnes-ai."+u(s(T).agnesDomain),3)])]),$[28]||($[28]=i("span",{class:"text-muted text-xs"},"▶",-1))])):(A(),C("div",em,[i("div",tm,[i("h2",am,u(s(d)("domainTitle")),1),i("div",nm,[i("span",{class:Pe(["text-xs px-2 py-1 rounded-full",s(T).agnesDomain==="cn"?"bg-green-900/40 text-green-300":"bg-paper-2 text-muted"])}," apihub.agnes-ai."+u(s(T).agnesDomain),3),i("button",{class:"text-xs text-muted hover:text-ink-2 transition px-2 py-1 rounded",onClick:$[12]||($[12]=q=>ne("domain"))},"▲")])]),i("p",im,u(s(d)("domainHint")),1),i("div",om,[i("label",sm,[N(i("input",{"onUpdate:modelValue":$[13]||($[13]=q=>s(T).agnesDomain=q),type:"radio",name:"agnes-domain",value:"com",class:"accent-blue-500 w-4 h-4 cursor-pointer"},null,512),[[rt,s(T).agnesDomain]]),i("div",null,[$[29]||($[29]=i("span",{class:"text-sm text-ink-2 font-medium"},"apihub.agnes-ai.com",-1)),i("span",rm,u(s(d)("domainComLabel")),1)])]),i("label",lm,[N(i("input",{"onUpdate:modelValue":$[14]||($[14]=q=>s(T).agnesDomain=q),type:"radio",name:"agnes-domain",value:"cn",class:"accent-blue-500 w-4 h-4 cursor-pointer"},null,512),[[rt,s(T).agnesDomain]]),i("div",null,[$[30]||($[30]=i("span",{class:"text-sm text-ink-2 font-medium"},"apihub.agnes-ai.cn",-1)),i("span",dm,u(s(d)("domainCnLabel")),1)])])]),i("div",cm,[i("button",{class:"px-5 py-2.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-lg text-sm font-medium transition",onClick:$[15]||($[15]=(...q)=>s(m)&&s(m)(...q))},u(s(d)("save")),1),s(v)==="ok"?(A(),C("span",pm,u(s(d)("domainSaved")),1)):ae("",!0),s(v)==="error"?(A(),C("span",um,u(s(V)),1)):ae("",!0)])]))]),i("div",mm,[O.workspace?(A(),C("div",{key:0,class:"flex items-center justify-between px-6 py-3 cursor-pointer hover:bg-paper-3 transition",role:"button",tabindex:"0",onClick:$[16]||($[16]=q=>ne("workspace"))},[i("div",gm,[$[32]||($[32]=i("span",{class:"text-sm"},"📁",-1)),i("span",fm,[i("span",hm,u(s(d)("workspaceTitle")),1),$[31]||($[31]=i("span",{class:"text-muted mx-2"},"·",-1)),i("span",{class:Pe(s(T).activeWorkspace?"text-green-400":"text-muted")},u(s(T).activeWorkspace?((we=s(T).workspaces.find(q=>q.path===s(T).activeWorkspace))==null?void 0:we.name)||s(T).activeWorkspace:s(d)("workspaceNone")),3)])]),$[33]||($[33]=i("span",{class:"text-muted text-xs"},"▶",-1))])):(A(),C("div",bm,[i("div",km,[i("h2",Sm,u(s(d)("workspaceTitle")),1),i("div",vm,[i("span",{class:Pe(["text-xs px-2 py-1 rounded-full",s(T).activeWorkspace?"bg-green-900 text-green-300":"bg-paper-2 text-muted"])},u(s(T).activeWorkspace?s(d)("workspaceActive"):s(d)("workspaceNone")),3),i("button",{class:"text-xs text-muted hover:text-ink-2 transition px-2 py-1 rounded",onClick:$[17]||($[17]=q=>ne("workspace"))},"▲")])]),s(S)?(A(),C("div",ym,u(s(d)("workspaceRegressionHint")),1)):ae("",!0),s(T).activeWorkspace?(A(),C("div",Pm,[i("p",xm,u(s(d)("workspaceCurrentActive")),1),i("p",_m,u(((Ct=s(T).workspaces.find(q=>q.path===s(T).activeWorkspace))==null?void 0:Ct.name)||s(T).activeWorkspace),1),i("p",Am,u(s(T).activeWorkspace),1)])):ae("",!0),i("div",Cm,[N(i("input",{"onUpdate:modelValue":$[18]||($[18]=q=>ee.value=q),placeholder:s(d)("workspacePathPlaceholder"),readonly:"",class:"flex-1 glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,8,wm),[[ie,ee.value]]),N(i("input",{"onUpdate:modelValue":$[19]||($[19]=q=>se.value=q),placeholder:s(d)("workspaceNamePlaceholder"),class:"w-40 glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,8,Tm),[[ie,se.value]]),i("button",{class:"px-4 py-2.5 bg-paper-3 hover:bg-paper-3 rounded-lg text-sm font-medium transition",onClick:ue},u(s(d)("workspaceBrowse")),1),i("button",{class:"px-5 py-2.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-lg text-sm font-medium transition",onClick:mt},u(s(d)("workspaceAdd")),1)]),i("div",Im,[i("h3",Dm,u(s(d)("workspaceListTitle")),1),i("span",Lm,u(s(d)("workspaceListHint")),1)]),i("div",Mm,[(A(!0),C(de,null,Le(s(T).workspaces,q=>(A(),C("div",{key:q.path,class:"flex items-center justify-between glass-input rounded-lg px-4 py-2.5"},[i("div",Fm,[i("p",Em,u(s(_)(q)),1),i("p",Vm,u(q.path),1)]),i("div",Hm,[q.path===s(T).activeWorkspace?(A(),C("span",Km,u(s(d)("workspaceActiveBadge")),1)):(A(),C("button",{key:1,class:"px-3 py-1 bg-green-600 hover:bg-green-500 rounded-lg text-xs font-medium transition",onClick:pa=>s(F)(q.path)},u(s(d)("workspaceActivate")),9,Rm)),q.is_default?ae("",!0):(A(),C("button",{key:2,class:"px-3 py-1 bg-red-600/80 hover:bg-red-500 rounded-lg text-xs font-medium transition",onClick:pa=>s(K)(q.path)},u(s(d)("workspaceRemove")),9,Gm))])]))),128))])]))])],64)}}}),zm={class:"flex items-center justify-between px-1 py-2 mb-4"},Nm={class:"text-xs text-muted leading-relaxed mr-3"},Bm={class:"relative inline-flex items-center cursor-pointer flex-shrink-0",title:"Video Watermark"},jm=["checked"],ja=Ke({__name:"WatermarkToggle",setup(e){const{toggleWatermark:t}=$i();function a(n){t(n.target.checked)}return(n,o)=>(A(),C("div",zm,[i("p",Nm,u(s(d)("watermarkPromo")),1),i("label",Bm,[i("input",{type:"checkbox",class:"watermark-toggle sr-only peer",checked:s(T).watermarkEnabled,onChange:a},null,40,jm),o[0]||(o[0]=i("div",{class:"w-10 h-5 bg-paper-3 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-rule after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-accent"},null,-1))])]))}}),Om={class:"flex items-center gap-2 mb-4 text-xs text-muted"},Um={href:"https://video.lichuanyang.top/guides/prompt-examples-simple",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},qm={class:"glass-card rounded-xl p-3 mb-4 flex items-center gap-3"},Wm={class:"text-sm text-muted whitespace-nowrap"},Ym={value:"video"},Qm={value:"image"},Jm={key:0},Zm={class:"glass-card rounded-2xl p-6 mb-4"},Xm={class:"text-lg font-semibold text-accent mb-4"},eg={class:"mb-4"},tg={class:"block text-sm text-muted mb-1.5"},ag=["placeholder"],ng={class:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4"},ig={class:"block text-sm text-muted mb-1.5"},og={value:"t2v"},sg={value:"i2v"},rg={value:"keyframes"},lg={class:"block text-sm text-muted mb-1.5"},dg={class:"block text-sm text-muted mb-1.5"},cg={value:"768x1152"},pg={value:"1152x768"},ug={value:"1024x1024"},mg={key:0,class:"mb-4"},gg={class:"block text-sm text-muted mb-1.5"},fg={class:"flex items-center gap-4"},hg={class:"cursor-pointer px-4 py-2.5 glass-input rounded-lg text-sm transition inline-block hover:border-blue-500/30"},bg={class:"text-sm text-muted"},kg={key:1,class:"mb-4"},Sg={class:"block text-sm text-muted mb-1.5"},vg={class:"flex items-center gap-4"},yg={class:"cursor-pointer px-4 py-2.5 glass-input rounded-lg text-sm transition inline-block hover:border-blue-500/30"},Pg={class:"text-sm text-muted"},xg={class:"border-t border-rule/40 pt-4 mt-4"},_g={class:"text-sm text-muted"},Ag={class:"text-muted text-xs"},Cg={class:"mt-3"},wg={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Tg={class:"block text-sm text-muted mb-1.5"},Ig=["placeholder"],Dg={class:"block text-sm text-muted mb-1.5"},Lg=["placeholder"],Mg={class:"mt-4"},Fg={class:"block text-sm text-muted mb-1.5"},Eg=["placeholder"],Vg=["disabled"],Hg={key:1},Kg={class:"glass-card rounded-2xl p-6 mb-4"},Rg={class:"text-lg font-semibold text-accent mb-4"},Gg={class:"mb-4"},$g={class:"block text-sm text-muted mb-1.5"},zg=["placeholder"],Ng={class:"mb-4"},Bg={class:"block text-sm text-muted mb-1.5"},jg={value:"1024x1024"},Og={value:"768x1152"},Ug={value:"1152x768"},qg={value:"768x1344"},Wg={value:"1344x768"},Yg={value:"1024x1792"},Qg={value:"1792x1024"},Jg={class:"mb-4"},Zg={class:"block text-sm text-muted mb-1.5"},Xg={class:"flex items-center gap-4"},ef={class:"cursor-pointer px-4 py-2.5 glass-input rounded-lg text-sm transition inline-block hover:border-blue-500/30"},tf={class:"text-sm text-muted"},af={class:"text-xs text-muted mt-1"},nf={class:"border-t border-rule/40 pt-4 mt-4"},of={class:"text-sm text-muted"},sf={class:"text-muted text-xs"},rf={class:"mt-3"},lf={class:"block text-sm text-muted mb-1.5"},df=["placeholder"],cf={class:"mt-4"},pf={class:"block text-sm text-muted mb-1.5"},uf=["placeholder"],mf={key:0,class:"mt-4 p-4 glass-card rounded-lg"},gf={class:"text-green-400 text-sm font-medium mb-2"},ff=["src"],hf=Ke({__name:"SimpleForm",setup(e){const{trackEvent:t}=ut(),{setRunning:a,showProgress:n,startPolling:o}=Vt(),{showToast:r}=At(),c=U("video"),p=He({prompt:"",mode:"t2v",duration:"5",resolution:"768x1152",seed:"",negative:"",system:"",refImage:null,refName:"",endImage:null,endName:""}),l=He({prompt:"",size:"1024x1024",negative:"",system:"",refImage:null,refName:"",imageResultVisible:!1,imageResultSrc:""}),h=He({video:!0,image:!0}),g=U(!1);function b(V){h[V]=!h[V]}function y(V,m){var _;const S=((_=V.target.files)==null?void 0:_[0])||null;m==="video"?(p.refImage=S,p.refName=S?S.name:""):(l.refImage=S,l.refName=S?S.name:"")}function D(V){var S;const m=((S=V.target.files)==null?void 0:S[0])||null;p.endImage=m,p.endName=m?m.name:""}function w(V){const[m,S]=V.split("x").map(Number);return{width:m,height:S}}async function x(){const V=p.prompt.trim();if(!V){alert(d("enterPrompt"));return}g.value=!0;const m=new FormData;m.append("prompt",V),m.append("mode",p.mode),m.append("duration",p.duration);const S=w(p.resolution);m.append("video_width",String(S.width)),m.append("video_height",String(S.height)),p.seed&&m.append("seed",p.seed),p.negative&&m.append("negative_prompt",p.negative),p.system.trim()&&m.append("system_prompt",p.system.trim()),p.refImage&&m.append("reference_image",p.refImage),p.endImage&&m.append("end_frame_image",p.endImage);try{const _=await Wc(m);if(!_.ok)throw new Error(_.detail||d("failCreate"));t("create_task",{task_type:"simple",mode:p.mode,duration:p.duration,resolution:p.resolution}),T.currentTaskType="simple",a(_.task_id),T.currentDirName=_.dir_name,await n(_.task_id,_.dir_name),await o(_.task_id),r(d("submitted"),5e3)}catch(_){t("create_task_failed",{task_type:"simple",error:(_.message||"").slice(0,120)}),alert(d("failCreate")+": "+_.message)}finally{g.value=!1}}async function v(){const V=l.prompt.trim();if(!V){alert(d("enterImagePrompt"));return}const m=new FormData;m.append("prompt",V),m.append("size",l.size),l.negative&&m.append("negative_prompt",l.negative),l.system.trim()&&m.append("system_prompt",l.system.trim()),l.refImage&&m.append("reference_image",l.refImage);try{const S=await Xc(m);if(!S.ok)throw new Error(S.detail||d("failCreate"));t("create_task",{task_type:"image",size:l.size}),l.imageResultSrc="/api/image/"+S.task_id,l.imageResultVisible=!0,r(d("imgComplete"),5e3)}catch(S){t("create_task_failed",{task_type:"image",error:(S.message||"").slice(0,120)}),alert(d("failCreate")+": "+S.message)}}return(V,m)=>(A(),C("div",null,[i("div",Om,[m[16]||(m[16]=i("span",{class:"text-muted"},"💡",-1)),i("a",Um,u(s(d)("exampleLinkSimple")),1)]),i("div",qm,[i("label",Wm,u(s(d)("subModeLabel")),1),N(i("select",{"onUpdate:modelValue":m[0]||(m[0]=S=>c.value=S),class:"flex-1 glass-input rounded-lg px-3 py-2 text-sm text-ink"},[i("option",Ym,u(s(d)("subModeVideo")),1),i("option",Qm,u(s(d)("subModeImage")),1)],512),[[Ie,c.value]])]),c.value==="video"?(A(),C("div",Jm,[i("div",Zm,[i("h2",Xm,u(s(d)("simpleSettings")),1),i("div",eg,[i("label",tg,[ct(u(s(d)("promptLabel"))+" (prompt) ",1),m[17]||(m[17]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":m[1]||(m[1]=S=>p.prompt=S),rows:"3",placeholder:s(d)("promptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,ag),[[ie,p.prompt]])]),i("div",ng,[i("div",null,[i("label",ig,u(s(d)("genMode")),1),N(i("select",{"onUpdate:modelValue":m[2]||(m[2]=S=>p.mode=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",og,u(s(d)("modeT2v")),1),i("option",sg,u(s(d)("modeI2v")),1),i("option",rg,u(s(d)("modeKeyframesSimple")),1)],512),[[Ie,p.mode]])]),i("div",null,[i("label",lg,u(s(d)("duration")),1),N(i("select",{"onUpdate:modelValue":m[3]||(m[3]=S=>p.duration=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[...m[18]||(m[18]=[ir('<option value="5">5s</option><option value="10">10s</option><option value="15">15s</option><option value="18">18s</option><option value="20">20s</option>',5)])],512),[[Ie,p.duration]])]),i("div",null,[i("label",dg,u(s(d)("resolution")),1),N(i("select",{"onUpdate:modelValue":m[4]||(m[4]=S=>p.resolution=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",cg,u(s(d)("resPortrait")),1),i("option",pg,u(s(d)("resLandscape")),1),i("option",ug,u(s(d)("resSquare")),1)],512),[[Ie,p.resolution]])])]),p.mode!=="t2v"?(A(),C("div",mg,[i("label",gg,u(s(d)("refImageSimple")),1),i("div",fg,[i("label",hg,[i("span",null,u(s(d)("chooseImage")),1),i("input",{type:"file",accept:"image/*",class:"hidden",onChange:m[5]||(m[5]=S=>y(S,"video"))},null,32)]),i("span",bg,u(p.refName||s(d)("notSelected")),1)])])):ae("",!0),p.mode==="keyframes"?(A(),C("div",kg,[i("label",Sg,u(s(d)("endFrameImage")),1),i("div",vg,[i("label",yg,[i("span",null,u(s(d)("chooseImage")),1),i("input",{type:"file",accept:"image/*",class:"hidden",onChange:D},null,32)]),i("span",Pg,u(p.endName||s(d)("notSelected")),1)])])):ae("",!0),i("div",xg,[i("div",{class:"collapse-header flex items-center justify-between",onClick:m[6]||(m[6]=S=>b("video"))},[i("span",_g,u(s(d)("advancedSettings")),1),i("span",Ag,u(h.video?"▶":"▼"),1)]),N(i("div",Cg,[i("div",wg,[i("div",null,[i("label",Tg,"Seed ("+u(s(d)("optional"))+")",1),N(i("input",{"onUpdate:modelValue":m[7]||(m[7]=S=>p.seed=S),type:"number",placeholder:s(d)("seedPlaceholder"),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},null,8,Ig),[[ie,p.seed]])]),i("div",null,[i("label",Dg,"Negative Prompt ("+u(s(d)("optional"))+")",1),N(i("input",{"onUpdate:modelValue":m[8]||(m[8]=S=>p.negative=S),placeholder:s(d)("negativePlaceholder"),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},null,8,Lg),[[ie,p.negative]])])]),i("div",Mg,[i("label",Fg,u(s(d)("systemPrompt"))+" ("+u(s(d)("optional"))+")",1),N(i("textarea",{"onUpdate:modelValue":m[9]||(m[9]=S=>p.system=S),rows:"2",placeholder:s(d)("systemPromptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,Eg),[[ie,p.system]])])],512),[[ra,!h.video]])])]),ce(ja),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",disabled:g.value,onClick:x},u(g.value?s(d)("submitting"):s(d)("startGenerate")),9,Vg)])):(A(),C("div",Hg,[i("div",Kg,[i("h2",Rg,u(s(d)("imageSettings")),1),i("div",Gg,[i("label",$g,[ct(u(s(d)("imagePrompt"))+" (prompt) ",1),m[19]||(m[19]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":m[10]||(m[10]=S=>l.prompt=S),rows:"3",placeholder:s(d)("imagePromptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,zg),[[ie,l.prompt]])]),i("div",Ng,[i("label",Bg,u(s(d)("imageSize")),1),N(i("select",{"onUpdate:modelValue":m[11]||(m[11]=S=>l.size=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",jg,u(s(d)("resSquare"))+" (1024x1024)",1),i("option",Og,u(s(d)("resPortrait"))+" (768x1152)",1),i("option",Ug,u(s(d)("resLandscape"))+" (1152x768)",1),i("option",qg,u(s(d)("resPortraitHD"))+" (HD)",1),i("option",Wg,u(s(d)("resLandscapeHD"))+" (HD)",1),i("option",Yg,u(s(d)("resPortraitTall")),1),i("option",Qg,u(s(d)("resLandscapeWide")),1)],512),[[Ie,l.size]])]),i("div",Jg,[i("label",Zg,u(s(d)("refImageSimple")),1),i("div",Xg,[i("label",ef,[i("span",null,u(s(d)("chooseImage")),1),i("input",{type:"file",accept:"image/*",class:"hidden",onChange:m[12]||(m[12]=S=>y(S,"image"))},null,32)]),i("span",tf,u(l.refName||s(d)("notSelected")),1)]),i("p",af,u(s(d)("refImageHint")),1)]),i("div",nf,[i("div",{class:"collapse-header flex items-center justify-between",onClick:m[13]||(m[13]=S=>b("image"))},[i("span",of,u(s(d)("advancedSettings")),1),i("span",sf,u(h.image?"▶":"▼"),1)]),N(i("div",rf,[i("div",null,[i("label",lf,"Negative Prompt ("+u(s(d)("optional"))+")",1),N(i("input",{"onUpdate:modelValue":m[14]||(m[14]=S=>l.negative=S),placeholder:s(d)("negativePlaceholder"),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},null,8,df),[[ie,l.negative]])]),i("div",cf,[i("label",pf,u(s(d)("systemPrompt"))+" ("+u(s(d)("optional"))+")",1),N(i("textarea",{"onUpdate:modelValue":m[15]||(m[15]=S=>l.system=S),rows:"2",placeholder:s(d)("systemPromptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,uf),[[ie,l.system]])])],512),[[ra,!h.image]])])]),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",onClick:v},u(s(d)("imgGenerate")),1),l.imageResultVisible?(A(),C("div",mf,[i("p",gf,u(s(d)("imgComplete")),1),i("img",{src:l.imageResultSrc,class:"w-full rounded-lg max-h-96 object-contain"},null,8,ff)])):ae("",!0)]))]))}}),bf={class:"vs-main"},kf={class:"vs-name"},Sf={class:"vs-desc"},vf=Ke({__name:"VoiceSelector",props:{task:{}},setup(e){const t=e,{voiceName:a,voiceDescription:n,openVoicePicker:o}=Qt();return(r,c)=>(A(),C("div",{class:"voice-selector",role:"button",tabindex:"0",onClick:c[0]||(c[0]=p=>s(o)(t.task)),onKeydown:[c[1]||(c[1]=Go(kn(p=>s(o)(t.task),["prevent"]),["enter"])),c[2]||(c[2]=Go(kn(p=>s(o)(t.task),["prevent"]),["space"]))]},[i("span",bf,[i("span",kf,u(s(a)(t.task)),1),i("span",Sf,u(s(n)(t.task)||s(d)("voiceDefaultDesc")),1)]),c[3]||(c[3]=i("span",{class:"vs-arrow"},"▾",-1))],32))}}),yf={class:"glass-card rounded-2xl p-6 mb-4"},Pf={class:"text-lg font-semibold text-accent"},xf={class:"text-muted text-xs"},_f={class:"mt-4"},Af={class:"flex items-center gap-3 mb-4"},Cf={class:"flex items-center gap-2 text-sm text-ink-2 cursor-pointer"},wf={class:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4"},Tf={class:"block text-sm text-muted mb-1.5"},If={class:"block text-sm text-muted mb-1.5"},Df={value:"-30%"},Lf={value:"+0%"},Mf={value:"+30%"},Ff={class:"glass-card rounded-2xl p-6 mb-4"},Ef={class:"text-lg font-semibold text-accent"},Vf={class:"text-muted text-xs"},Hf={class:"mt-4"},Kf={class:"flex items-center gap-3 mb-4"},Rf={class:"flex items-center gap-2 text-sm text-ink-2 cursor-pointer"},Gf={key:0,class:"border-t border-rule/40 pt-4"},$f={class:"mb-4"},zf={class:"block text-sm text-muted mb-1.5"},Nf={value:"fixed"},Bf={value:"llm"},jf={key:0},Of={class:"text-sm text-muted mb-3"},Uf={class:"grid grid-cols-2 md:grid-cols-4 gap-3"},qf={class:"block text-xs text-muted mb-1"},Wf={class:"block text-xs text-muted mb-1"},Yf={class:"block text-xs text-muted mb-1"},Qf={class:"block text-xs text-muted mb-1"},Jf={value:"bottom"},Zf={value:"top"},Xf={class:"grid grid-cols-2 md:grid-cols-4 gap-3 mt-3"},eh={class:"block text-xs text-muted mb-1"},th={class:"block text-xs text-muted mb-1"},ah={class:"block text-xs text-muted mb-1"},nh={key:1},ih={class:"block text-sm text-muted mb-1.5"},oh=["placeholder"],sh={class:"text-xs text-muted mt-1"},rh={key:1,class:"text-xs text-muted"},zn=Ke({__name:"SubtitleConfig",props:{task:{},withStyle:{type:Boolean},defaultFontsize:{}},setup(e,{expose:t}){const a=e,n=U(!0),o=U(!0),r=U("+0%"),c=U("fixed"),p=He({font:"STHeitiMedium.ttc",color:"white",fontsize:a.defaultFontsize??48,position:"bottom",stroke_color:"black",stroke_width:2,bg_color:"black@0.5",hints:""}),l=He({audio:!0,subtitle:!0});function h(g){l[g]=!l[g]}return t({audioEnabled:n,subtitleEnabled:o,rate:r,styleMode:c,style:p}),(g,b)=>(A(),C(de,null,[i("div",yf,[i("div",{class:"collapse-header flex items-center justify-between",onClick:b[0]||(b[0]=y=>h("audio"))},[i("h2",Pf,u(s(d)("audioConfig")),1),i("span",xf,u(l.audio?"▶":"▼"),1)]),N(i("div",_f,[i("div",Af,[i("label",Cf,[N(i("input",{"onUpdate:modelValue":b[1]||(b[1]=y=>n.value=y),type:"checkbox",class:"rounded bg-paper-2 border-rule"},null,512),[[bn,n.value]]),i("span",null,u(s(d)("enableNarration")),1)])]),i("div",wf,[i("div",null,[i("label",Tf,u(s(d)("voiceRole")),1),ce(vf,{task:e.task},null,8,["task"])]),i("div",null,[i("label",If,u(s(d)("speechRate")),1),N(i("select",{"onUpdate:modelValue":b[2]||(b[2]=y=>r.value=y),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",Df,u(s(d)("rateSlow")),1),b[14]||(b[14]=i("option",{value:"-15%"},"-15%",-1)),i("option",Lf,u(s(d)("rateNormal")),1),b[15]||(b[15]=i("option",{value:"+15%"},"+15%",-1)),i("option",Mf,u(s(d)("rateFast")),1)],512),[[Ie,r.value]])])])],512),[[ra,!l.audio]])]),i("div",Ff,[i("div",{class:"collapse-header flex items-center justify-between",onClick:b[3]||(b[3]=y=>h("subtitle"))},[i("h2",Ef,u(s(d)("subtitleConfig")),1),i("span",Vf,u(l.subtitle?"▶":"▼"),1)]),N(i("div",Hf,[i("div",Kf,[i("label",Rf,[N(i("input",{"onUpdate:modelValue":b[4]||(b[4]=y=>o.value=y),type:"checkbox",class:"rounded bg-paper-2 border-rule"},null,512),[[bn,o.value]]),i("span",null,u(s(d)("enableSubtitle")),1)])]),e.withStyle?(A(),C("div",Gf,[i("div",$f,[i("label",zf,u(s(d)("subStyleMode")),1),N(i("select",{"onUpdate:modelValue":b[5]||(b[5]=y=>c.value=y),class:"w-full glass-input rounded-lg px-3 py-2 text-sm text-ink"},[i("option",Nf,u(s(d)("subStyleFixed")),1),i("option",Bf,u(s(d)("subStyleLLM")),1)],512),[[Ie,c.value]])]),c.value==="fixed"?(A(),C("div",jf,[i("p",Of,u(s(d)("subtitleStyle")),1),i("div",Uf,[i("div",null,[i("label",qf,u(s(d)("subFont")),1),N(i("input",{"onUpdate:modelValue":b[6]||(b[6]=y=>p.font=y),class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.font]])]),i("div",null,[i("label",Wf,u(s(d)("subColor")),1),N(i("input",{"onUpdate:modelValue":b[7]||(b[7]=y=>p.color=y),class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.color]])]),i("div",null,[i("label",Yf,u(s(d)("subSize")),1),N(i("input",{"onUpdate:modelValue":b[8]||(b[8]=y=>p.fontsize=y),type:"number",class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.fontsize,void 0,{number:!0}]])]),i("div",null,[i("label",Qf,u(s(d)("subPosition")),1),N(i("select",{"onUpdate:modelValue":b[9]||(b[9]=y=>p.position=y),class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},[i("option",Jf,u(s(d)("posBottom")),1),i("option",Zf,u(s(d)("posTop")),1)],512),[[Ie,p.position]])])]),i("div",Xf,[i("div",null,[i("label",eh,u(s(d)("subStrokeColor")),1),N(i("input",{"onUpdate:modelValue":b[10]||(b[10]=y=>p.stroke_color=y),class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.stroke_color]])]),i("div",null,[i("label",th,u(s(d)("subStrokeWidth")),1),N(i("input",{"onUpdate:modelValue":b[11]||(b[11]=y=>p.stroke_width=y),type:"number",class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.stroke_width,void 0,{number:!0}]])]),i("div",null,[i("label",ah,u(s(d)("subBgColor")),1),N(i("input",{"onUpdate:modelValue":b[12]||(b[12]=y=>p.bg_color=y),class:"w-full glass-input rounded px-2 py-1.5 text-xs text-ink"},null,512),[[ie,p.bg_color]])])])])):(A(),C("div",nh,[i("label",ih,u(s(d)("subStyleHints")),1),N(i("textarea",{"onUpdate:modelValue":b[13]||(b[13]=y=>p.hints=y),rows:"3",class:"w-full glass-input rounded-lg px-3 py-2 text-sm text-ink placeholder-muted",placeholder:s(d)("subStyleHintsPlaceholder")},null,8,oh),[[ie,p.hints]]),i("p",sh,u(s(d)("subStyleHintsHint")),1)]))])):(A(),C("p",rh,u(s(d)("poetrySubtitleFixed")),1))],512),[[ra,!l.subtitle]])])],64))}}),lh={class:"flex items-center gap-2 mb-4 text-xs text-muted"},dh={href:"https://video.lichuanyang.top/guides/prompt-examples-creative",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},ch={class:"glass-card rounded-2xl p-6 mb-4"},ph={class:"text-lg font-semibold text-accent mb-4"},uh={class:"mb-4"},mh={class:"block text-sm text-muted mb-1.5"},gh=["placeholder"],fh={class:"mb-4"},hh={class:"block text-sm text-muted mb-1.5"},bh=["placeholder"],kh={class:"mb-4 p-4 rounded-xl bg-paper-2/30 border border-rule/50"},Sh={class:"text-sm font-medium text-accent mb-3"},vh={class:"mb-4"},yh={class:"block text-sm text-muted mb-2"},Ph={class:"flex gap-2"},xh={class:"flex-1 flex items-center gap-2 px-3 py-2.5 rounded-lg bg-paper-2/50 border border-rule cursor-pointer hover:border-blue-500/30 transition"},_h={class:"text-sm text-ink-2"},Ah={class:"flex-1 flex items-center gap-2 px-3 py-2.5 rounded-lg bg-paper-2/50 border border-rule cursor-pointer hover:border-blue-500/30 transition"},Ch={class:"text-sm text-ink-2"},wh={class:"text-xs text-muted mt-1.5"},Th={key:0},Ih={class:"mb-3"},Dh={class:"block text-xs text-muted mb-1"},Lh={class:"mb-3"},Mh={class:"block text-xs text-muted mb-1.5"},Fh={class:"flex gap-2 mb-2"},Eh={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},Vh={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},Hh={key:0},Kh={class:"text-xs text-muted ml-1"},Rh={key:1,class:"space-y-2"},Gh={class:"text-xs text-muted w-12"},$h=["onUpdate:modelValue"],zh={class:"text-xs text-muted"},Nh={class:"mb-4"},Bh={class:"block text-sm text-muted mb-1.5"},jh={class:"glass-card rounded-2xl p-6 mb-4"},Oh={class:"text-lg font-semibold text-accent mb-4"},Uh={class:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4"},qh={class:"block text-sm text-muted mb-1.5"},Wh={value:"keyframes"},Yh={value:"ti2vid"},Qh={value:"none"},Jh={class:"block text-sm text-muted mb-1.5"},Zh={value:"768x1152"},Xh={value:"1152x768"},eb={value:"1024x1024"},tb={class:"mb-4"},ab={class:"block text-sm text-muted mb-1.5"},nb={class:"flex items-center gap-4"},ib={class:"cursor-pointer px-4 py-2.5 glass-input rounded-lg text-sm transition inline-block hover:border-blue-500/30"},ob={class:"text-sm text-muted"},sb={class:"text-xs text-muted mt-2"},rb={class:"mb-4"},lb={class:"flex items-center justify-between mb-3"},db={class:"text-sm text-muted"},cb={class:"flex gap-3"},pb={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},ub={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},mb={key:0,class:"space-y-2"},gb={class:"text-xs text-muted mb-2"},fb={class:"space-y-2"},hb={class:"text-xs text-muted w-16"},bb=["onChange"],kb={class:"mb-4"},Sb={class:"block text-sm text-muted mb-1.5"},vb={class:"text-xs text-muted mb-2"},yb={class:"space-y-2"},Pb={class:"text-xs text-muted w-16"},xb=["onChange"],_b=["disabled"],Ab=Ke({__name:"CreativeForm",setup(e){const{trackEvent:t}=ut(),{setRunning:a,showProgress:n,startPolling:o}=Vt(),{showToast:r}=At(),{voiceSelections:c}=Qt(),p=U(),l=He({name:"",idea:"",durationSource:"manual",sceneCount:3,uniform:!0,uniformDuration:5,independentDurations:[],style:"电影质感写实风格",chaining:"keyframes",resolution:"768x1152",refImage:null,refName:"",useEndFrames:!1,genEndFromRef:!0,endFrames:[],sceneRefs:[]}),h=U(!1);function g(V){const[m,S]=V.split("x").map(Number);return{width:m,height:S}}function b(V){var S;const m=((S=V.target.files)==null?void 0:S[0])||null;l.refImage=m,l.refName=m?m.name:""}function y(){l.useEndFrames||(l.genEndFromRef=!1)}function D(){l.genEndFromRef&&(l.useEndFrames=!1)}function w(V,m){var _;const S=((_=V.target.files)==null?void 0:_[0])||null;S&&(l.endFrames[m]=S)}function x(V,m){var _;const S=((_=V.target.files)==null?void 0:_[0])||null;S&&(l.sceneRefs[m]=S)}async function v(){const V=l.idea.trim();if(!V){alert(d("enterIdea"));return}h.value=!0;const m=new FormData;if(m.append("idea",V),m.append("creative_name",l.name.trim()),m.append("style",l.style),m.append("chaining_mode",l.chaining),m.append("duration_source",l.durationSource),l.durationSource==="manual")if(m.append("scene_count",String(l.sceneCount)),m.append("uniform_duration",String(l.uniform)),l.uniform)m.append("scene_durations_json",JSON.stringify(Array(l.sceneCount).fill(l.uniformDuration)));else{const F=l.independentDurations.slice(0,l.sceneCount);m.append("scene_durations_json",JSON.stringify(F))}else m.append("scene_count","0"),m.append("uniform_duration","true"),m.append("scene_durations_json",JSON.stringify([]));const S=g(l.resolution);m.append("video_width",String(S.width)),m.append("video_height",String(S.height)),m.append("use_custom_end_frames",String(l.useEndFrames)),m.append("generate_end_frames_from_ref",String(l.genEndFromRef)),l.refImage&&m.append("reference_image",l.refImage),l.useEndFrames&&l.endFrames.forEach(F=>{F&&F.size>0&&m.append("end_frame_images",F)}),l.sceneRefs.length>0&&l.sceneRefs.forEach(F=>{F&&F.size>0&&m.append("scene_reference_images",F)});const _=p.value;_&&(m.append("audio_enabled",String(_.audioEnabled)),m.append("audio_voice",c.c),m.append("audio_lang","zh"),m.append("audio_rate",_.rate),m.append("subtitle_enabled",String(_.subtitleEnabled)),m.append("subtitle_style_mode",_.styleMode),m.append("subtitle_style_hints",_.style.hints),m.append("subtitle_font",_.style.font),m.append("subtitle_color",_.style.color),m.append("subtitle_fontsize",String(_.style.fontsize)),m.append("subtitle_position",_.style.position),m.append("subtitle_stroke_color",_.style.stroke_color),m.append("subtitle_stroke_width",String(_.style.stroke_width)),m.append("subtitle_bg_color",_.style.bg_color));try{const F=await Yc(m);if(!F.ok)throw new Error(F.detail||d("failCreate"));t("create_task",{task_type:"creative",style:l.style,chaining_mode:l.chaining,duration_source:l.durationSource,resolution:l.resolution,audio:_!=null&&_.audioEnabled?"on":"off",subtitle:_!=null&&_.subtitleEnabled?"on":"off"}),T.currentTaskType="creative",a(F.task_id),T.currentDirName=F.dir_name,await n(F.task_id,F.dir_name),await o(F.task_id),r(d("submitted"),5e3)}catch(F){t("create_task_failed",{task_type:"creative",error:(F.message||"").slice(0,120)}),alert(d("failCreate")+": "+F.message)}finally{h.value=!1}}return(V,m)=>(A(),C("div",null,[i("div",lh,[m[13]||(m[13]=i("span",{class:"text-muted"},"💡",-1)),i("a",dh,u(s(d)("exampleLinkCreative")),1)]),i("div",ch,[i("h2",ph,u(s(d)("creativeSettings")),1),i("div",uh,[i("label",mh,u(s(d)("taskName")),1),N(i("input",{"onUpdate:modelValue":m[0]||(m[0]=S=>l.name=S),placeholder:s(d)("taskNamePlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,8,gh),[[ie,l.name]])]),i("div",fh,[i("label",hh,[ct(u(s(d)("ideaLabel"))+" (idea) ",1),m[14]||(m[14]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":m[1]||(m[1]=S=>l.idea=S),rows:"4",placeholder:s(d)("ideaPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,bh),[[ie,l.idea]])]),i("div",kh,[i("h3",Sh,u(s(d)("sceneConfig")),1),i("div",vh,[i("label",yh,u(s(d)("durationSource")),1),i("div",Ph,[i("label",xh,[N(i("input",{"onUpdate:modelValue":m[2]||(m[2]=S=>l.durationSource=S),type:"radio",value:"manual",class:"text-accent"},null,512),[[rt,l.durationSource]]),i("span",_h,u(s(d)("sourceManual")),1)]),i("label",Ah,[N(i("input",{"onUpdate:modelValue":m[3]||(m[3]=S=>l.durationSource=S),type:"radio",value:"prompt",class:"text-accent"},null,512),[[rt,l.durationSource]]),i("span",Ch,u(s(d)("sourcePrompt")),1)])]),i("p",wh,u(l.durationSource==="manual"?s(d)("sourceManualHint"):s(d)("sourcePromptHint")),1)]),l.durationSource==="manual"?(A(),C("div",Th,[i("div",Ih,[i("label",Dh,u(s(d)("sceneCount")),1),N(i("input",{"onUpdate:modelValue":m[4]||(m[4]=S=>l.sceneCount=S),type:"number",min:"1",max:"30",class:"w-24 glass-input rounded-lg px-3 py-2 text-sm text-ink"},null,512),[[ie,l.sceneCount,void 0,{number:!0}]])]),i("div",Lh,[i("label",Mh,u(s(d)("durationMode")),1),i("div",Fh,[i("label",Eh,[N(i("input",{"onUpdate:modelValue":m[5]||(m[5]=S=>l.uniform=S),type:"radio",value:!0,class:"text-accent"},null,512),[[rt,l.uniform]]),i("span",null,u(s(d)("uniformDuration")),1)]),i("label",Vh,[N(i("input",{"onUpdate:modelValue":m[6]||(m[6]=S=>l.uniform=S),type:"radio",value:!1,class:"text-accent"},null,512),[[rt,l.uniform]]),i("span",null,u(s(d)("independentDuration")),1)])]),l.uniform?(A(),C("div",Hh,[N(i("input",{"onUpdate:modelValue":m[7]||(m[7]=S=>l.uniformDuration=S),type:"number",min:"2",max:"30",class:"w-24 glass-input rounded-lg px-3 py-2 text-sm text-ink"},null,512),[[ie,l.uniformDuration,void 0,{number:!0}]]),i("span",Kh,u(s(d)("seconds")),1)])):(A(),C("div",Rh,[(A(!0),C(de,null,Le(l.sceneCount,S=>(A(),C("div",{key:S,class:"flex items-center gap-2 mb-1.5"},[i("span",Gh,u(s(d)("scene_"))+u(S),1),N(i("input",{"onUpdate:modelValue":_=>l.independentDurations[S-1]=_,type:"number",min:"2",max:"30",class:"w-20 glass-input rounded-lg px-3 py-1.5 text-sm text-ink"},null,8,$h),[[ie,l.independentDurations[S-1],void 0,{number:!0}]]),i("span",zh,u(s(d)("seconds")),1)]))),128))]))])])):ae("",!0)]),i("div",Nh,[i("label",Bh,u(s(d)("visualStyle")),1),N(i("input",{"onUpdate:modelValue":m[8]||(m[8]=S=>l.style=S),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,512),[[ie,l.style]])])]),i("div",jh,[i("h2",Oh,u(s(d)("advancedSettings")),1),i("div",Uh,[i("div",null,[i("label",qh,u(s(d)("chainingMode")),1),N(i("select",{"onUpdate:modelValue":m[9]||(m[9]=S=>l.chaining=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",Wh,u(s(d)("modeKeyframes")),1),i("option",Yh,u(s(d)("modeTi2vid")),1),i("option",Qh,u(s(d)("modeNone")),1)],512),[[Ie,l.chaining]])]),i("div",null,[i("label",Jh,u(s(d)("resolution")),1),N(i("select",{"onUpdate:modelValue":m[10]||(m[10]=S=>l.resolution=S),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",Zh,u(s(d)("resPortrait")),1),i("option",Xh,u(s(d)("resLandscape")),1),i("option",eb,u(s(d)("resSquare")),1)],512),[[Ie,l.resolution]])])]),i("div",tb,[i("label",ab,u(s(d)("referenceImage")),1),i("div",nb,[i("label",ib,[i("span",null,u(s(d)("chooseImage")),1),i("input",{type:"file",accept:"image/*",class:"hidden",onChange:b},null,32)]),i("span",ob,u(l.refName||s(d)("notSelected")),1)]),i("p",sb,u(s(d)("refDescription")),1)]),i("div",rb,[i("div",lb,[i("label",db,u(s(d)("customEndFrames")),1),i("div",cb,[i("label",pb,[N(i("input",{"onUpdate:modelValue":m[11]||(m[11]=S=>l.useEndFrames=S),type:"checkbox",class:"rounded bg-paper-2 border-rule",onChange:y},null,544),[[bn,l.useEndFrames]]),i("span",null,u(s(d)("enableCustomEndFrames")),1)]),i("label",ub,[N(i("input",{"onUpdate:modelValue":m[12]||(m[12]=S=>l.genEndFromRef=S),type:"checkbox",class:"rounded bg-paper-2 border-rule",onChange:D},null,544),[[bn,l.genEndFromRef]]),i("span",null,u(s(d)("genEndFramesFromRef")),1)])])]),l.useEndFrames?(A(),C("div",mb,[i("p",gb,u(s(d)("endFrameDesc")),1),i("div",fb,[(A(!0),C(de,null,Le(l.sceneCount,S=>(A(),C("div",{key:S,class:"flex items-center gap-3 mb-2"},[i("span",hb,u(s(d)("scene_"))+" "+u(S),1),i("input",{type:"file",accept:"image/*",class:"end-frame-file flex-1 text-sm text-muted file:mr-3 file:py-1.5 file:px-3 file:rounded-lg file:border-0 file:text-sm file:bg-paper-3 file:text-ink-2 hover:file:bg-paper-3",onChange:_=>w(_,S-1)},null,40,bb)]))),128))])])):ae("",!0)]),i("div",kb,[i("label",Sb,u(s(d)("sceneReferenceImages")),1),i("p",vb,u(s(d)("sceneRefDesc")),1),i("div",yb,[(A(!0),C(de,null,Le(l.sceneCount,S=>(A(),C("div",{key:S,class:"flex items-center gap-3 mb-2"},[i("span",Pb,u(s(d)("scene_"))+" "+u(S),1),i("input",{type:"file",accept:"image/*",class:"scene-ref-file flex-1 text-sm text-muted file:mr-3 file:py-1.5 file:px-3 file:rounded-lg file:border-0 file:text-sm file:bg-paper-3 file:text-ink-2 hover:file:bg-paper-3",onChange:_=>x(_,S-1)},null,40,xb)]))),128))])])]),ce(zn,{ref_key:"subtitleRef",ref:p,task:"c","with-style":!0},null,512),ce(ja),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",disabled:h.value,onClick:v},u(h.value?s(d)("submitting"):s(d)("startGenerate")),9,_b)]))}}),Cb={class:"flex items-center gap-2 mb-4 text-xs text-muted"},wb={href:"https://video.lichuanyang.top/guides/prompt-examples-manuscript",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},Tb={class:"glass-card rounded-2xl p-6 mb-4"},Ib={class:"text-lg font-semibold text-accent mb-4"},Db={class:"mb-4"},Lb={class:"block text-sm text-muted mb-1.5"},Mb=["placeholder"],Fb={class:"mb-4"},Eb={class:"block text-sm text-muted mb-1.5"},Vb=["placeholder"],Hb={class:"text-xs text-muted mt-1"},Kb={class:"mb-4"},Rb={class:"block text-sm text-muted mb-1.5"},Gb={value:"768x1152"},$b={value:"1152x768"},zb={value:"1024x1024"},Nb=["disabled"],Bb=Ke({__name:"ManuscriptForm",setup(e){const{trackEvent:t}=ut(),{setRunning:a,showProgress:n,startPolling:o}=Vt(),{showToast:r}=At(),{voiceSelections:c}=Qt(),p=U(),l=He({name:"",text:"",resolution:"768x1152"}),h=Be(()=>l.text.length),g=U(!1);function b(D){const[w,x]=D.split("x").map(Number);return{width:w,height:x}}async function y(){const D=l.text.trim();if(!D){alert(d("enterText"));return}g.value=!0;const w=new FormData;w.append("manuscript_text",D),w.append("creative_name",l.name.trim());const x=b(l.resolution);w.append("video_width",String(x.width)),w.append("video_height",String(x.height));const v=p.value;v&&(w.append("audio_enabled",String(v.audioEnabled)),w.append("audio_voice",c.m),w.append("audio_lang","zh"),w.append("audio_rate",v.rate),w.append("subtitle_enabled",String(v.subtitleEnabled)),w.append("subtitle_style_mode",v.styleMode),w.append("subtitle_style_hints",v.style.hints),w.append("subtitle_font",v.style.font),w.append("subtitle_color",v.style.color),w.append("subtitle_fontsize",String(v.style.fontsize)),w.append("subtitle_position",v.style.position),w.append("subtitle_stroke_color",v.style.stroke_color),w.append("subtitle_stroke_width",String(v.style.stroke_width)),w.append("subtitle_bg_color",v.style.bg_color));try{const V=await Qc(w);if(!V.ok)throw new Error(V.detail||d("failCreate"));t("create_task",{task_type:"manuscript",resolution:l.resolution,text_len:D.length,audio:v!=null&&v.audioEnabled?"on":"off",subtitle:v!=null&&v.subtitleEnabled?"on":"off"}),T.currentTaskType="manuscript",a(V.task_id),T.currentDirName=V.dir_name,await n(V.task_id,V.dir_name),await o(V.task_id),r(d("submitted"),5e3)}catch(V){t("create_task_failed",{task_type:"manuscript",error:(V.message||"").slice(0,120)}),alert(d("failCreate")+": "+V.message)}finally{g.value=!1}}return(D,w)=>(A(),C("div",null,[i("div",Cb,[w[3]||(w[3]=i("span",{class:"text-muted"},"💡",-1)),i("a",wb,u(s(d)("exampleLinkManuscript")),1)]),i("div",Tb,[i("h2",Ib,u(s(d)("manuscriptSettings")),1),i("div",Db,[i("label",Lb,u(s(d)("taskName")),1),N(i("input",{"onUpdate:modelValue":w[0]||(w[0]=x=>l.name=x),placeholder:s(d)("taskNamePlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,8,Mb),[[ie,l.name]])]),i("div",Fb,[i("label",Eb,[ct(u(s(d)("manuscriptText"))+" ",1),w[4]||(w[4]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":w[1]||(w[1]=x=>l.text=x),rows:"10",placeholder:s(d)("manuscriptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted font-mono"},null,8,Vb),[[ie,l.text]]),i("p",Hb,u(s(d)("charCount"))+": "+u(h.value),1)]),i("div",Kb,[i("label",Rb,u(s(d)("resolution")),1),N(i("select",{"onUpdate:modelValue":w[2]||(w[2]=x=>l.resolution=x),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",Gb,u(s(d)("resPortrait")),1),i("option",$b,u(s(d)("resLandscape")),1),i("option",zb,u(s(d)("resSquare")),1)],512),[[Ie,l.resolution]])])]),ce(zn,{ref_key:"subtitleRef",ref:p,task:"m","with-style":!0},null,512),ce(ja),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",disabled:g.value,onClick:y},u(g.value?s(d)("submitting"):s(d)("startGenerate")),9,Nb)]))}}),jb={class:"flex items-center gap-2 mb-4 text-xs text-muted"},Ob={href:"https://video.lichuanyang.top/guides/prompt-examples-anchor",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},Ub={class:"glass-card rounded-2xl p-6 mb-4"},qb={class:"text-lg font-semibold text-accent mb-4"},Wb={class:"mb-4"},Yb={class:"block text-sm text-muted mb-1.5"},Qb=["placeholder"],Jb={class:"mb-4"},Zb={class:"block text-sm text-muted mb-1.5"},Xb={class:"flex items-center gap-4"},ek={class:"cursor-pointer px-4 py-2.5 glass-input rounded-lg text-sm transition inline-block hover:border-blue-500/30"},tk={class:"text-sm text-muted"},ak={class:"text-xs text-muted mt-1"},nk={class:"mb-4"},ik={class:"block text-sm text-muted mb-1.5"},ok=["placeholder"],sk={class:"text-xs text-muted mt-1"},rk={class:"mb-4"},lk={class:"block text-sm text-muted mb-1.5"},dk={value:"768x1344"},ck={value:"1152x768"},pk={value:"1024x1024"},uk={class:"glass-card rounded-2xl p-6 mb-4"},mk={class:"mb-4 p-3 bg-paper-2/50 rounded-lg border border-rule"},gk={class:"block text-sm text-muted mb-2"},fk={class:"flex flex-col gap-2"},hk={class:"flex items-start gap-3 cursor-pointer group"},bk={class:"text-sm text-ink-2 group-hover:text-ink transition"},kk={class:"text-xs text-muted mt-0.5"},Sk={class:"flex items-start gap-3 cursor-pointer group"},vk={class:"text-sm text-ink-2 group-hover:text-ink transition"},yk={class:"text-xs text-muted mt-0.5"},Pk=["disabled"],xk=Ke({__name:"AnchorForm",setup(e){const{trackEvent:t}=ut(),{setRunning:a,showProgress:n,startPolling:o}=Vt(),{showToast:r}=At(),{voiceSelections:c}=Qt(),p=U(),l=He({prompt:"",refImage:null,refName:"",script:"",resolution:"768x1344",audioSource:"post_stitch"}),h=Be(()=>l.script.length),g=U(!1);function b(w){const[x,v]=w.split("x").map(Number);return{width:x,height:v}}function y(w){var v;const x=((v=w.target.files)==null?void 0:v[0])||null;l.refImage=x,l.refName=x?x.name:""}async function D(){const w=l.script.trim();if(!w){alert(d("enterText"));return}g.value=!0;const x=new FormData;x.append("script_text",w);const v=l.prompt.trim();v&&x.append("anchor_prompt",v);const V=b(l.resolution);x.append("video_width",String(V.width)),x.append("video_height",String(V.height)),l.refImage&&x.append("anchor_reference_image",l.refImage),x.append("audio_source",l.audioSource);const m=p.value;m&&(x.append("audio_enabled",String(l.audioSource==="model"?!1:m.audioEnabled)),x.append("audio_voice",c.a),x.append("audio_lang","zh"),x.append("audio_rate",m.rate),x.append("subtitle_enabled",String(m.subtitleEnabled)),x.append("subtitle_style_mode",m.styleMode),x.append("subtitle_style_hints",m.style.hints),x.append("subtitle_font",m.style.font),x.append("subtitle_color",m.style.color),x.append("subtitle_fontsize",String(m.style.fontsize)),x.append("subtitle_position",m.style.position),x.append("subtitle_stroke_color",m.style.stroke_color),x.append("subtitle_stroke_width",String(m.style.stroke_width)),x.append("subtitle_bg_color",m.style.bg_color));try{const S=await Jc(x);if(!S.ok)throw new Error(S.detail||d("failCreate"));t("create_task",{task_type:"anchor",resolution:l.resolution,audio_source:l.audioSource,audio:l.audioSource==="model"?"off":m!=null&&m.audioEnabled?"on":"off",subtitle:m!=null&&m.subtitleEnabled?"on":"off"}),T.currentTaskType="anchor",a(S.task_id),T.currentDirName=S.dir_name,await n(S.task_id,S.dir_name),await o(S.task_id),r(d("submitted"),5e3)}catch(S){t("create_task_failed",{task_type:"anchor",error:(S.message||"").slice(0,120)}),alert(d("failCreate")+": "+S.message)}finally{g.value=!1}}return(w,x)=>(A(),C("div",null,[i("div",jb,[x[5]||(x[5]=i("span",{class:"text-muted"},"💡",-1)),i("a",Ob,u(s(d)("exampleLinkAnchor")),1)]),i("div",Ub,[i("h2",qb,u(s(d)("anchorSettings")),1),i("div",Wb,[i("label",Yb,u(s(d)("anchorPrompt")),1),N(i("textarea",{"onUpdate:modelValue":x[0]||(x[0]=v=>l.prompt=v),rows:"3",placeholder:s(d)("anchorPromptPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,Qb),[[ie,l.prompt]])]),i("div",Jb,[i("label",Zb,u(s(d)("anchorRefImage")),1),i("div",Xb,[i("label",ek,[i("span",null,u(s(d)("chooseImage")),1),i("input",{type:"file",accept:"image/*",class:"hidden",onChange:y},null,32)]),i("span",tk,u(l.refName||s(d)("notSelected")),1)]),i("p",ak,u(s(d)("anchorRefImageHint")),1)]),i("div",nk,[i("label",ik,[ct(u(s(d)("scriptText"))+" ",1),x[6]||(x[6]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":x[1]||(x[1]=v=>l.script=v),rows:"8",placeholder:s(d)("scriptTextPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted font-mono"},null,8,ok),[[ie,l.script]]),i("p",sk,u(s(d)("charCount"))+": "+u(h.value),1)]),i("div",rk,[i("label",lk,u(s(d)("resolution")),1),N(i("select",{"onUpdate:modelValue":x[2]||(x[2]=v=>l.resolution=v),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",dk,u(s(d)("resPortraitHD")),1),i("option",ck,u(s(d)("resLandscape")),1),i("option",pk,u(s(d)("resSquare")),1)],512),[[Ie,l.resolution]])])]),i("div",uk,[i("div",mk,[i("label",gk,u(s(d)("audioSource")),1),i("div",fk,[i("label",hk,[N(i("input",{"onUpdate:modelValue":x[3]||(x[3]=v=>l.audioSource=v),type:"radio",name:"a_audio_source",value:"post_stitch",class:"mt-0.5 accent-blue-500"},null,512),[[rt,l.audioSource]]),i("div",null,[i("span",bk,u(s(d)("audioPostStitch")),1),i("p",kk,u(s(d)("audioPostStitchDesc")),1)])]),i("label",Sk,[N(i("input",{"onUpdate:modelValue":x[4]||(x[4]=v=>l.audioSource=v),type:"radio",name:"a_audio_source",value:"model",class:"mt-0.5 accent-blue-500"},null,512),[[rt,l.audioSource]]),i("div",null,[i("span",vk,u(s(d)("audioModel")),1),i("p",yk,u(s(d)("audioModelDesc")),1)])])])])]),i("div",{class:Pe({"opacity-40 pointer-events-none":l.audioSource==="model"})},[ce(zn,{ref_key:"subtitleRef",ref:p,task:"a","with-style":!0},null,512)],2),ce(ja),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",disabled:g.value,onClick:D},u(g.value?s(d)("submitting"):s(d)("startGenerate")),9,Pk)]))}}),_k={class:"glass-card rounded-2xl p-6 mb-4"},Ak={class:"text-lg font-semibold text-accent mb-4"},Ck={class:"mb-4"},wk={class:"block text-sm text-muted mb-1.5"},Tk=["placeholder"],Ik={class:"mb-4"},Dk={class:"block text-sm text-muted mb-1.5"},Lk=["placeholder"],Mk={class:"text-xs text-muted mt-1.5"},Fk={class:"mb-4 p-4 rounded-xl bg-paper-2/30 border border-rule/50"},Ek={class:"text-sm font-medium text-accent mb-3"},Vk={class:"text-xs text-muted mb-3"},Hk={class:"mb-3"},Kk={class:"block text-xs text-muted mb-1"},Rk={class:"mb-3"},Gk={class:"block text-xs text-muted mb-1.5"},$k={class:"flex gap-2 mb-2"},zk={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},Nk={class:"flex items-center gap-2 text-sm text-muted cursor-pointer"},Bk={key:0},jk={class:"text-xs text-muted ml-1"},Ok={key:1,class:"space-y-2"},Uk={class:"text-xs text-muted w-12"},qk=["onUpdate:modelValue"],Wk={class:"text-xs text-muted"},Yk={class:"mb-4"},Qk={class:"block text-sm text-muted mb-1.5"},Jk=["placeholder"],Zk={class:"text-xs text-muted mt-1.5"},Xk={class:"text-xs text-muted mt-1.5 font-mono bg-paper-2/40 rounded px-2 py-1"},eS={class:"mt-3 p-3 rounded-lg bg-paper-2/40 border border-rule/50"},tS={class:"flex items-center justify-between"},aS={class:"text-xs text-ink-2 font-medium"},nS={key:0,class:"mt-2"},iS={class:"text-xs text-muted mb-1.5"},oS={class:"text-[11px] text-ink-2 whitespace-pre-wrap bg-paper/60 rounded p-2 max-h-40 overflow-auto"},sS={class:"text-[11px] text-muted whitespace-pre-wrap bg-paper/60 rounded p-2 mt-1 max-h-40 overflow-auto"},rS={class:"mb-4"},lS={class:"block text-sm text-muted mb-1.5"},dS={class:"glass-card rounded-2xl p-6 mb-4"},cS={class:"text-lg font-semibold text-accent mb-4"},pS={class:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4"},uS={class:"block text-sm text-muted mb-1.5"},mS={value:"768x1152"},gS={value:"1152x768"},fS={value:"1024x1024"},hS=["disabled"],bS=Ke({__name:"PoetryForm",setup(e){const{trackEvent:t}=ut(),{setRunning:a,showProgress:n,startPolling:o}=Vt(),{showToast:r}=At(),{voiceSelections:c}=Qt(),p=U(),l=He({name:"",poem:"",sceneCount:3,uniform:!0,uniformDuration:5,independentDurations:[],scenePrompts:"",style:"电影质感写实风格",resolution:"768x1152"}),h=U(!1),g=U(!1),b=U(""),y=U(""),D=U("");function w(F){const[K,R]=F.split("x").map(Number);return{width:K,height:R}}function x(){const F=l.poem.trim(),K=l.sceneCount||3;let R=[];if(l.uniform)R=Array(K).fill(l.uniformDuration||5);else for(R=l.independentDurations.slice(0,K);R.length<K;)R.push(5);const Se=R.reduce((O,J)=>O+J,0)||30;return{poem:F,scene_count:K,scene_durations:R,total_duration:Se,style:l.style.trim()}}async function v(){try{const F=x(),K=await qc({poem:F.poem,scene_count:String(F.scene_count),scene_durations:JSON.stringify(F.scene_durations),total_duration:String(F.total_duration),style:F.style});b.value=K.system_prompt||"",y.value=K.user_prompt||""}catch(F){console.error("loadPoetryPrompt error:",F)}}async function V(){g.value=!g.value,g.value&&await v()}function m(F,K){const R=document.createElement("textarea");R.value=F,R.style.position="fixed",R.style.opacity="0",document.body.appendChild(R),R.select();try{document.execCommand("copy")}catch{}document.body.removeChild(R),K()}async function S(){await v();const F=b.value+`
31
- >>>>>>>> v6.0-dev:static/assets/index-Da44GBbk.js
32
28
 
33
29
  `+y.value,K=()=>{const R=D.value;D.value=d("copied"),setTimeout(()=>D.value=R,1500)};navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(F).then(K).catch(()=>m(F,K)):m(F,K)}async function _(){const F=l.poem.trim();if(!F){alert(d("enterPoem"));return}h.value=!0;const K=l.scenePrompts.split(`
34
30
  `).map(J=>J.trim()).filter(Boolean),R=new FormData;R.append("poem_text",F),R.append("creative_name",l.name.trim()),R.append("user_scene_prompts_json",JSON.stringify(K)),R.append("style",l.style);const Se=w(l.resolution);R.append("video_width",String(Se.width)),R.append("video_height",String(Se.height)),R.append("video_duration","30"),R.append("duration_source","manual"),R.append("scene_count",String(l.sceneCount)),R.append("uniform_duration",String(l.uniform)),l.uniform?R.append("scene_durations_json",JSON.stringify(Array(l.sceneCount).fill(l.uniformDuration))):R.append("scene_durations_json",JSON.stringify(l.independentDurations.slice(0,l.sceneCount)));const O=p.value;O&&(R.append("audio_enabled",String(O.audioEnabled)),R.append("audio_voice",c.p),R.append("audio_lang","zh"),R.append("audio_rate",O.rate),R.append("subtitle_enabled",String(O.subtitleEnabled)));try{const J=await Zc(R);if(!J.ok)throw new Error(J.detail||d("failCreate"));t("create_task",{task_type:"poetry",style:l.style,scene_count:l.sceneCount,resolution:l.resolution,audio:O!=null&&O.audioEnabled?"on":"off",subtitle:O!=null&&O.subtitleEnabled?"on":"off"}),T.currentTaskType="poetry",a(J.task_id),T.currentDirName=J.dir_name,await n(J.task_id,J.dir_name),await o(J.task_id),r(d("submitted"),5e3)}catch(J){t("create_task_failed",{task_type:"poetry",error:(J.message||"").slice(0,120)}),alert(d("failCreate")+": "+J.message)}finally{h.value=!1}}return(F,K)=>(A(),C("div",null,[i("div",_k,[i("h2",Ak,u(s(d)("poetrySettings")),1),i("div",Ck,[i("label",wk,u(s(d)("taskName")),1),N(i("input",{"onUpdate:modelValue":K[0]||(K[0]=R=>l.name=R),placeholder:s(d)("taskNamePlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,8,Tk),[[ie,l.name]])]),i("div",Ik,[i("label",Dk,[ct(u(s(d)("poemLabel"))+" ",1),K[9]||(K[9]=i("span",{class:"text-red-400"},"*",-1))]),N(i("textarea",{"onUpdate:modelValue":K[1]||(K[1]=R=>l.poem=R),rows:"5",placeholder:s(d)("poemPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,Lk),[[ie,l.poem]]),i("p",Mk,u(s(d)("poemHint")),1)]),i("div",Fk,[i("h3",Ek,u(s(d)("sceneConfig")),1),i("p",Vk,u(s(d)("sourceManualHint")),1),i("div",Hk,[i("label",Kk,u(s(d)("sceneCount")),1),N(i("input",{"onUpdate:modelValue":K[2]||(K[2]=R=>l.sceneCount=R),type:"number",min:"1",max:"30",class:"w-24 glass-input rounded-lg px-3 py-2 text-sm text-ink"},null,512),[[ie,l.sceneCount,void 0,{number:!0}]])]),i("div",Rk,[i("label",Gk,u(s(d)("durationMode")),1),i("div",$k,[i("label",zk,[N(i("input",{"onUpdate:modelValue":K[3]||(K[3]=R=>l.uniform=R),type:"radio",value:!0,class:"text-accent"},null,512),[[rt,l.uniform]]),i("span",null,u(s(d)("uniformDuration")),1)]),i("label",Nk,[N(i("input",{"onUpdate:modelValue":K[4]||(K[4]=R=>l.uniform=R),type:"radio",value:!1,class:"text-accent"},null,512),[[rt,l.uniform]]),i("span",null,u(s(d)("independentDuration")),1)])]),l.uniform?(A(),C("div",Bk,[N(i("input",{"onUpdate:modelValue":K[5]||(K[5]=R=>l.uniformDuration=R),type:"number",min:"2",max:"30",class:"w-24 glass-input rounded-lg px-3 py-2 text-sm text-ink"},null,512),[[ie,l.uniformDuration,void 0,{number:!0}]]),i("span",jk,u(s(d)("seconds")),1)])):(A(),C("div",Ok,[(A(!0),C(de,null,Le(l.sceneCount,R=>(A(),C("div",{key:R,class:"flex items-center gap-2 mb-1.5"},[i("span",Uk,u(s(d)("scene_"))+u(R),1),N(i("input",{"onUpdate:modelValue":Se=>l.independentDurations[R-1]=Se,type:"number",min:"2",max:"30",class:"w-20 glass-input rounded-lg px-3 py-1.5 text-sm text-ink"},null,8,qk),[[ie,l.independentDurations[R-1],void 0,{number:!0}]]),i("span",Wk,u(s(d)("seconds")),1)]))),128))]))])]),i("div",Yk,[i("label",Qk,u(s(d)("scenePromptsOptional")),1),N(i("textarea",{"onUpdate:modelValue":K[6]||(K[6]=R=>l.scenePrompts=R),rows:"3",placeholder:s(d)("scenePromptsPlaceholder"),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm resize-y text-ink placeholder-muted"},null,8,Jk),[[ie,l.scenePrompts]]),i("p",Zk,u(s(d)("scenePromptsHint")),1),i("p",Xk,u(s(d)("scenePromptsExample")),1),i("div",eS,[i("div",tS,[i("span",aS,u(s(d)("scenePromptTool")),1),i("button",{type:"button",class:"text-xs text-accent hover:text-accent",onClick:V},u(s(d)("showPrompt")),1)]),g.value?(A(),C("div",nS,[i("p",iS,u(s(d)("scenePromptToolHint")),1),i("pre",oS,u(b.value),1),i("pre",sS,u(y.value),1),i("button",{type:"button",class:"mt-2 w-full text-xs text-accent bg-accent/15 hover:bg-accent/25 rounded px-3 py-1.5 transition",onClick:S},u(D.value||s(d)("copyPromptWithPoem")),1)])):ae("",!0)])]),i("div",rS,[i("label",lS,u(s(d)("visualStyle")),1),N(i("input",{"onUpdate:modelValue":K[7]||(K[7]=R=>l.style=R),class:"w-full glass-input rounded-lg px-4 py-2.5 text-sm text-ink placeholder-muted"},null,512),[[ie,l.style]])])]),i("div",dS,[i("h2",cS,u(s(d)("advancedSettings")),1),i("div",pS,[i("div",null,[i("label",uS,u(s(d)("resolution")),1),N(i("select",{"onUpdate:modelValue":K[8]||(K[8]=R=>l.resolution=R),class:"w-full glass-input rounded-lg px-3 py-2.5 text-sm text-ink"},[i("option",mS,u(s(d)("resPortrait")),1),i("option",gS,u(s(d)("resLandscape")),1),i("option",fS,u(s(d)("resSquare")),1)],512),[[Ie,l.resolution]])])])]),ce(zn,{ref_key:"subtitleRef",ref:p,task:"p","with-style":!1},null,512),ce(ja),i("button",{class:"w-full py-3.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-xl text-base font-semibold transition disabled:opacity-50 disabled:cursor-not-allowed glow-btn",disabled:h.value,onClick:_},u(h.value?s(d)("submitting"):s(d)("startGenerate")),9,hS)]))}}),kS={class:"flex gap-2 mb-4"},SS=["onClick"],vS={class:"text-lg"},yS={class:"flex flex-wrap items-center gap-x-4 gap-y-1 mb-4 text-xs text-muted"},PS={href:"https://video.lichuanyang.top/guides/prompt-tips",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},xS={href:"https://video.lichuanyang.top/api-docs",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},_S=Ke({__name:"CreatePanel",setup(e){const{trackEvent:t}=ut(),a=[{key:"simple",icon:"🎬🖼️",label:"ttSimple"},{key:"creative",icon:"🎥",label:"ttCreative"},{key:"manuscript",icon:"📝",label:"ttManuscript"},{key:"anchor",icon:"🎙️",label:"ttAnchor"},{key:"poetry",icon:"📜",label:"ttPoetry"}];function n(o){t("ui_action",{action:"switch_task_type",type:o}),T.currentTaskType=o}return(o,r)=>(A(),C("div",null,[i("div",kS,[(A(),C(de,null,Le(a,c=>i("button",{key:c.key,class:Pe(["ttype-btn flex-1 px-4 py-3 rounded-xl text-sm font-medium transition text-center",s(T).currentTaskType===c.key?"tab-active":"tab-inactive"]),onClick:p=>n(c.key)},[i("span",vS,u(c.icon),1),r[0]||(r[0]=i("br",null,null,-1)),i("span",null,u(s(d)(c.label)),1)],10,SS)),64))]),i("div",yS,[r[1]||(r[1]=i("span",{class:"text-muted"},"💡",-1)),i("a",PS,"🎯 "+u(s(d)("formTipTips")),1),r[2]||(r[2]=i("span",{class:"text-ink/10 select-none"},"·",-1)),i("a",xS,"🧠 "+u(s(d)("formTipModels")),1)]),s(T).currentTaskType==="simple"?(A(),zt(hf,{key:0})):s(T).currentTaskType==="creative"?(A(),zt(Ab,{key:1})):s(T).currentTaskType==="manuscript"?(A(),zt(Bb,{key:2})):s(T).currentTaskType==="anchor"?(A(),zt(xk,{key:3})):s(T).currentTaskType==="poetry"?(A(),zt(bS,{key:4})):ae("",!0)]))}}),AS={class:"space-y-3"},CS={key:0,class:"text-muted text-sm"},wS={class:"flex-1 min-w-0"},TS={class:"flex items-center gap-2 mb-1"},IS={class:"text-xs px-2 py-0.5 rounded-full bg-accent/15 text-accent"},DS={class:"text-sm font-medium truncate"},LS={class:"text-xs text-muted mt-0.5"},MS={key:0,class:"text-xs text-muted mt-1 truncate max-w-xs"},FS={class:"flex items-center gap-3 ml-3"},ES=["onClick"],VS=["onClick"],HS=["onClick"],KS=["onClick"],RS=Ke({__name:"TaskListPanel",setup(e){const{tasks:t,viewTask:a,viewRunningTask:n,resumeTask:o,stopTaskById:r,deleteTaskById:c}=Zi(),p={completed:"text-emerald-400",running:"text-yellow-400",failed:"text-red-400",pending:"text-muted",queued:"text-accent"},l={completed:"statusCompleted",running:"statusRunning",failed:"statusFailed",pending:"statusPending",queued:"statusQueued"},h={simple:"typeSimple",creative:"typeCreative",manuscript:"typeManuscript",anchor:"typeAnchor",poetry:"typePoetry",image:"typeImage"};function g(v){return v.idea||v.prompt||(v.manuscript_text||"").substring(0,80)||(v.script_text||"").substring(0,80)||""}function b(v){return v.scene_count?` · ${v.scene_count}${d("sceneUnit")}`:v.paragraph_count?` · ${v.paragraph_count}${d("paraUnit")}`:""}function y(v){return v.status==="running"||v.status==="queued"}function D(v){return v.status==="completed"}function w(v){return D(v)?d("btnView"):y(v)?d("btnViewProgress"):d("btnResume")}function x(v){D(v)?a(v.task_id):y(v)?n(v.task_id):o(v.task_id)}return(v,V)=>(A(),C("div",AS,[s(t).length?ae("",!0):(A(),C("p",CS,u(s(d)("noTasks")),1)),(A(!0),C(de,null,Le(s(t),m=>(A(),C("div",{key:m.task_id,class:"glass-card rounded-xl p-4 flex items-center justify-between"},[i("div",wS,[i("div",TS,[i("span",IS,u(s(d)(h[m.task_type||""]||"")||m.task_type),1),i("p",DS,u(m.creative_name||m.task_id),1)]),i("p",LS,u(m.task_id)+u(b(m)),1),g(m)?(A(),C("p",MS,u(g(m)),1)):ae("",!0)]),i("div",FS,[i("span",{class:Pe(["text-xs",p[m.status||""]||"text-muted"])},u(s(d)(l[m.status||""]||"")||m.status),3),!D(m)&&!y(m)?(A(),C("button",{key:0,class:"text-xs px-3 py-1.5 bg-paper-3 hover:bg-paper-3 rounded-lg transition",onClick:S=>s(a)(m.task_id)},u(s(d)("btnView")),9,ES)):ae("",!0),i("button",{class:"text-xs px-3 py-1.5 bg-accent text-accent-ink hover:bg-accent/90 rounded-lg transition",onClick:S=>x(m)},u(w(m)),9,VS),y(m)?(A(),C("button",{key:1,class:"text-xs px-3 py-1.5 bg-red-700 hover:bg-red-600 text-red-100 rounded-lg transition",onClick:S=>s(r)(m.task_id)},u(s(d)("btnStop")),9,HS)):ae("",!0),y(m)?ae("",!0):(A(),C("button",{key:2,class:"text-xs px-3 py-1.5 bg-red-900/60 hover:bg-red-700 text-red-200 rounded-lg transition",onClick:S=>s(c)(m.task_id)},u(s(d)("deleteTask")),9,KS))])]))),128))]))}}),GS={key:0,class:"glass-card rounded-2xl p-6 mt-6"},$S={class:"flex items-center justify-between mb-4"},zS={class:"text-lg font-semibold text-accent"},NS={class:"flex items-center gap-3"},BS={class:"text-sm text-muted"},jS={class:"w-full bg-paper-2/50 rounded-full h-2.5 mb-6 overflow-hidden"},OS={class:"space-y-2"},US={class:"mt-4 text-xs text-muted"},qS={href:"https://video.lichuanyang.top/learn",target:"_blank",rel:"noopener",class:"hover:text-accent transition-colors"},WS={key:0,class:"mt-4"},YS={class:"p-4 bg-red-950 border border-red-800 rounded-lg space-y-2"},QS={class:"text-red-400 font-medium"},JS={class:"text-muted text-xs"},ZS=["innerHTML"],XS={key:2,class:"mt-4 p-4 bg-paper/30 rounded-lg border border-rule/50"},ev={class:"flex items-center justify-between mb-3"},tv={class:"text-sm font-medium text-accent"},av={class:"space-y-2 max-h-96 overflow-y-auto"},nv={class:"text-xs text-muted mb-1"},iv={class:"space-y-1.5"},ov={class:"text-sm mt-0.5"},sv={class:"flex-1 min-w-0"},rv={class:"flex items-center gap-2 mb-1"},lv={class:"text-xs text-ink-2"},dv={class:"text-xs text-muted"},cv=["src","onClick"],pv=["src"],uv=["src"],mv=["onClick"],gv=["title","onClick"],fv={key:3,class:"mt-4 p-4 glass-card rounded-lg"},hv={class:"text-green-400 text-sm font-medium mb-2"},bv=["src"],kv={class:"flex flex-wrap items-center gap-x-4 gap-y-1 mt-3 text-xs"},Sv={href:"https://video.lichuanyang.top/learn",target:"_blank",rel:"noopener",class:"text-accent hover:text-ink transition-colors"},vv={href:"https://video.lichuanyang.top/learn",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},yv=["src"],Pv=Ke({__name:"ProgressPanel",setup(e){const{progressVisible:t,progressPct:a,progressMessage:n,resultVideoVisible:o,resultVideoSrc:r,steps:c,stepStates:p,taskFailed:l,failedMessage:h}=Vt(),{artifactsAreaVisible:g,artifactGroups:b,isRunning:y,imageModalUrl:D,stepLabelMap:w,loadArtifacts:x,artifactLabel:v,artifactIcon:V,artifactFileUrl:m,formatSize:S,toggleArtifactPreview:_,openImageModal:F,closeImageModal:K,confirmDeleteArtifact:R}=_r(),{stopTaskById:Se}=Zi();async function O(){T.currentTaskId&&confirm(d("stopConfirm"))&&await Se(T.currentTaskId)}function J(te){return te==="done"?"w-5 h-5 flex items-center justify-center rounded-full bg-green-900 text-green-300 text-xs":te==="running"?"w-5 h-5 flex items-center justify-center rounded-full bg-paper-3 text-accent text-xs animate-pulse-dot":"w-5 h-5 flex items-center justify-center rounded-full bg-paper-2 text-xs"}function ne(te){return te==="done"?"step-label text-green-400":te==="running"?"step-label text-accent":"step-label text-muted"}function j(te){return te==="done"?"✓":te==="running"?"◉":"○"}return(te,ge)=>(A(),C(de,null,[s(t)?(A(),C("div",GS,[i("div",$S,[i("h2",zS,u(s(d)("progress")),1),i("div",NS,[i("span",BS,u(s(a))+"%",1),s(T).isTaskRunning?(A(),C("button",{key:0,class:"text-xs px-3 py-1.5 bg-red-700/80 hover:bg-red-600 text-red-100 rounded-lg transition",onClick:O},u(s(d)("stopTask")),1)):ae("",!0)])]),i("div",jS,[i("div",{class:"bg-accent h-2.5 rounded-full transition-all duration-500",style:wn({width:s(a)+"%"})},null,4)]),i("div",OS,[(A(!0),C(de,null,Le(s(c),be=>(A(),C("div",{key:be.key,class:"step-item flex items-center gap-3 text-sm"},[i("span",{class:Pe(["step-icon",J(s(p)[be.key]||"pending")])},u(j(s(p)[be.key]||"pending")),3),i("span",{class:Pe(ne(s(p)[be.key]||"pending"))},u(s(d)(be.labelKey)),3)]))),128))]),i("p",US,[i("a",qS,u(s(d)("waitTip")),1)]),s(l)?(A(),C("div",WS,[i("div",YS,[i("p",QS,u(s(d)("genFailed")),1),i("p",JS,u(s(h)||s(d)("genFailedMsg")),1)])])):(A(),C("div",{key:1,class:"mt-4 text-sm text-muted",innerHTML:s(n)},null,8,ZS)),s(g)?(A(),C("div",XS,[i("div",ev,[i("h3",tv,u(s(d)("artTitle")),1),i("button",{class:"text-xs text-muted hover:text-ink-2 transition",onClick:ge[0]||(ge[0]=(...be)=>s(x)&&s(x)(...be))},"↻")]),i("div",av,[(A(!0),C(de,null,Le(s(b),be=>(A(),C("div",{key:be.stepKey,class:"mb-3"},[i("div",nv,u(s(d)(s(w)[be.stepKey]||be.stepKey)),1),i("div",iv,[(A(!0),C(de,null,Le(be.items,ee=>(A(),C("div",{key:ee.artifact_id,class:"artifact-card flex items-start gap-2 p-2 bg-paper-2/30 rounded"},[i("span",ov,u(s(V)(ee)),1),i("div",sv,[i("div",rv,[i("span",lv,u(s(v)(ee)),1),i("span",dv,u(s(S)(ee.size)),1)]),ee.category==="image"?(A(),C("img",{key:0,src:s(m)(ee),class:"max-h-32 rounded cursor-pointer border border-rule/50",loading:"lazy",onClick:se=>s(F)(s(m)(ee))},null,8,cv)):ee.category==="video"?(A(),C("video",{key:1,src:s(m)(ee),controls:"",playsinline:"",preload:"metadata",class:"w-full rounded border border-rule/50 bg-black",style:{"max-height":"360px","min-height":"200px"}},null,8,pv)):ee.category==="audio"?(A(),C("audio",{key:2,src:s(m)(ee),controls:"",class:"w-full",preload:"metadata"},null,8,uv)):(A(),C("pre",{key:3,class:"text-xs text-muted max-h-24 overflow-auto bg-paper/70 p-2 rounded border border-rule cursor-pointer",onClick:se=>s(_)(ee,se.currentTarget)},u(s(d)("clickToPreview")),9,mv))]),ee.deletable&&!s(y)?(A(),C("button",{key:0,class:"text-xs px-2 py-1 bg-red-700/50 hover:bg-red-600 text-red-100 rounded transition flex-shrink-0",title:s(d)("delete"),onClick:se=>s(R)(ee)}," ✕ ",8,gv)):ae("",!0)]))),128))])]))),128))])])):ae("",!0),s(o)?(A(),C("div",fv,[i("p",hv,u(s(d)("videoComplete")),1),i("video",{src:s(r),controls:"",class:"w-full rounded-lg max-h-96"},null,8,bv),i("div",kv,[ge[2]||(ge[2]=i("span",null,"🎉",-1)),i("a",Sv,u(s(d)("doneTipTiktok")),1),ge[3]||(ge[3]=i("span",{class:"text-ink/10 select-none"},"·",-1)),i("a",vv,u(s(d)("doneTipMore")),1)])])):ae("",!0)])):ae("",!0),s(D)?(A(),C("div",{key:1,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 cursor-pointer",onClick:ge[1]||(ge[1]=(...be)=>s(K)&&s(K)(...be))},[i("img",{src:s(D),class:"max-w-[90vw] max-h-[90vh] rounded-lg"},null,8,yv)])):ae("",!0)],64))}}),xv={class:"vp-modal",role:"dialog","aria-modal":"true"},_v={class:"vp-header"},Av={class:"vp-search"},Cv=["value","placeholder"],wv={class:"vp-tabs"},Tv=["onClick"],Iv={class:"vp-count"},Dv={class:"vp-grid"},Lv={key:0,class:"vp-empty"},Mv=["onClick"],Fv={class:"vp-card-top"},Ev={class:"vp-card-name"},Vv={class:"vp-card-region"},Hv={class:"vp-tags"},Kv=["onClick"],Rv={class:"vp-selection"},Gv={class:"vp-current"},$v={class:"vp-actions"},zv=Ke({__name:"VoicePickerModal",setup(e){const{pickerVisible:t,activeLang:a,query:n,selectedId:o,playingId:r,filteredVoices:c,closeVoicePicker:p,selectVoice:l,onVoiceSearch:h,previewVoice:g,confirmVoiceSelection:b}=Qt(),y=Be(()=>{const D=T.voiceIndex[o.value];return D?`${D.name}(${D.region})`:o.value||"—"});return(D,w)=>{var x;return s(t)?(A(),C("div",{key:0,class:"vp-overlay",onClick:w[4]||(w[4]=kn((...v)=>s(p)&&s(p)(...v),["self"]))},[i("div",xv,[i("div",_v,[i("h3",null,u(s(d)("selectVoice")),1),i("button",{class:"vp-close",onClick:w[0]||(w[0]=(...v)=>s(p)&&s(p)(...v))},"✕")]),i("div",Av,[i("input",{value:s(n),type:"text",placeholder:s(d)("searchVoice"),onInput:w[1]||(w[1]=v=>s(h)(v.target.value))},null,40,Cv)]),i("div",wv,[(A(!0),C(de,null,Le(((x=s(T).voiceCatalog)==null?void 0:x.languages)||[],v=>(A(),C("div",{key:v.code,class:Pe(["vp-tab",{active:v.code===s(a)}]),onClick:V=>a.value=v.code},[ct(u(v.label),1),i("span",Iv,u(v.count),1)],10,Tv))),128))]),i("div",Dv,[s(c).length?ae("",!0):(A(),C("div",Lv,u(s(d)("voiceEmpty")),1)),(A(!0),C(de,null,Le(s(c),v=>(A(),C("div",{key:v.id,class:Pe(["vp-card",{selected:v.id===s(o)}]),onClick:V=>s(l)(v.id)},[i("div",Fv,[i("span",Ev,u(v.name),1),i("span",Vv,u(v.region),1)]),i("div",Hv,[i("span",{class:Pe(["vp-tag","gender-"+v.gender])},u(v.gender==="female"?s(d)("voiceGenderFemale"):s(d)("voiceGenderMale")),3),(A(!0),C(de,null,Le((v.style_tags||[]).slice(0,3),(V,m)=>(A(),C("span",{key:m,class:"vp-tag"},u(V),1))),128))]),i("button",{class:Pe(["vp-preview-btn",{playing:s(r)===v.id}]),onClick:kn(V=>s(g)(v.id),["stop"])},u(s(r)===v.id?"⏸ "+s(d)("previewStop"):"▶ "+s(d)("previewPlay")),11,Kv)],10,Mv))),128))]),i("div",Rv,[i("div",Gv,[ct(u(s(d)("currentSelection"))+": ",1),i("b",null,u(y.value),1)]),i("div",$v,[i("button",{class:"vp-btn vp-btn-cancel",onClick:w[2]||(w[2]=(...v)=>s(p)&&s(p)(...v))},u(s(d)("cancel")),1),i("button",{class:"vp-btn vp-btn-confirm",onClick:w[3]||(w[3]=(...v)=>s(b)&&s(b)(...v))},u(s(d)("confirmSelection")),1)])])])])):ae("",!0)}}}),Nv={key:0,class:"fixed bottom-6 left-1/2 -translate-x-1/2 px-5 py-2.5 rounded-xl text-sm font-medium border border-rule z-50 bg-yellow-600 text-ink"},Bv=Ke({__name:"Toast",props:{visible:{type:Boolean},message:{}},setup(e){return(t,a)=>(A(),zt(Kd,{"enter-active-class":"transition-all duration-300","enter-from-class":"opacity-0 translate-y-4","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition-all duration-300","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 translate-y-4"},{default:Cs(()=>[e.visible?(A(),C("div",Nv,u(e.message),1)):ae("",!0)]),_:1}))}}),jv={class:"flex justify-center gap-3 px-4"},Ov={class:"hidden lg:block sticky top-[120px] self-start w-[130px] shrink-0 mt-8"},Uv={class:"sidebar-card"},qv={class:"stitle"},Wv={class:"text-muted text-xs leading-relaxed mb-2"},Yv={href:"https://github.com/lcy362/agnes-video-generator",target:"_blank",rel:"noopener"},Qv={class:"text-muted text-xs px-1 -mt-0.5 mb-1"},Jv={href:"https://video.lichuanyang.top",target:"_blank",rel:"noopener"},Zv={class:"text-muted text-xs px-1 -mt-0.5 mb-1"},Xv={href:"https://video.lichuanyang.top",target:"_blank",rel:"noopener"},ey={class:"text-muted text-xs px-1 -mt-0.5 mb-1"},ty={class:"text-muted text-xs mt-2 leading-relaxed"},ay={class:"max-w-4xl flex-1 min-w-0 py-8"},ny={class:"text-center mb-10"},iy={class:"flex items-center justify-end gap-2 mb-5"},oy=["title","aria-label"],sy={class:"w-4 h-4 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},ry=["d"],ly={class:"text-xs whitespace-nowrap"},dy=["value"],cy={class:"text-muted mt-2 text-sm tracking-wide"},py={class:"flex gap-2 mb-6"},uy={class:"text-center pb-8"},my={class:"border-t border-rule/30 pt-8 mt-4"},gy={class:"text-xs text-muted mb-3"},fy={class:"flex justify-center flex-wrap gap-x-5 gap-y-2 text-xs"},hy={href:"https://video.lichuanyang.top",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},by={href:"https://video.lichuanyang.top/demo",target:"_blank",rel:"noopener",class:"text-accent hover:text-ink transition-colors"},ky={href:"https://video.lichuanyang.top/guides/prompt-tips",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},Sy={href:"https://video.lichuanyang.top/faq",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},vy={href:"https://video.lichuanyang.top/api-docs",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},yy={href:"https://video.lichuanyang.top/learn",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},Py={class:"hidden lg:block sticky top-[120px] self-start w-[115px] shrink-0 mt-8"},xy={class:"sidebar-card"},_y={class:"stitle"},Ay={href:"https://video.lichuanyang.top/demo",target:"_blank",rel:"noopener"},Cy={href:"https://video.lichuanyang.top/guides/prompt-tips",target:"_blank",rel:"noopener"},wy={href:"https://video.lichuanyang.top/api-docs",target:"_blank",rel:"noopener"},Ty={href:"https://video.lichuanyang.top/api-docs",target:"_blank",rel:"noopener"},Iy={href:"https://video.lichuanyang.top/faq",target:"_blank",rel:"noopener"},Dy={href:"https://video.lichuanyang.top/api-docs",target:"_blank",rel:"noopener"},Ly={href:"https://video.lichuanyang.top/learn",target:"_blank",rel:"noopener"},My=Ke({__name:"App",setup(e){const{switchLang:t}=bc(),{themeIcon:a,themeLabel:n,cycleTheme:o}=mr(),{visible:r,message:c}=At(),{loadModels:p,renderWorkspaces:l}=$i(),{initVoiceSelector:h}=Qt(),{loadTaskList:g,startTaskListTimer:b,stopTaskListTimer:y}=Zi(),{showProgress:D,setRunning:w,startPolling:x}=Vt(),v=U("create");function V(_){v.value=_,_==="list"?(g(),b()):y()}const m=U(!1);Ei(async()=>{try{const _=await fetch("/api/config").then(F=>F.json());_.api_key&&(T.apiKeySource=_.source),await l(),_.watermark!==void 0&&(T.watermarkEnabled=!!_.watermark.enabled),_.agnes_domain&&(T.agnesDomain=_.agnes_domain),await p(),m.value=!0}catch(_){console.error("init config load error:",_)}try{await h()}catch(_){console.error("init voice selector error:",_)}S()});async function S(){try{const F=((await fetch("/api/tasks").then(K=>K.json())).tasks||[]).find(K=>K.status==="running"||K.status==="queued");F&&(T.currentTaskType=F.task_type||"creative",w(F.task_id),T.currentDirName=F.dir_name||F.task_id,await D(F.task_id,T.currentDirName),await x(F.task_id))}catch{}}return(_,F)=>(A(),C(de,null,[i("div",jv,[i("aside",Ov,[i("div",Uv,[i("div",qv,u(s(d)("adSupportTitle")),1),i("p",Wv,u(s(d)("adSupportDesc")),1),i("a",Yv,u(s(d)("adStar")),1),i("p",Qv,u(s(d)("adStarDesc")),1),i("a",Jv,u(s(d)("adAdblock")),1),i("p",Zv,u(s(d)("adAdblockDesc")),1),i("a",Xv,u(s(d)("adClick")),1),i("p",ey,u(s(d)("adClickDesc")),1),i("p",ty,u(s(d)("adThanks")),1)])]),i("div",ay,[i("div",ny,[i("div",iy,[i("button",{class:"glass-input rounded-lg px-3 py-1.5 text-sm cursor-pointer text-ink flex items-center gap-1.5 hover:border-accent/40 transition",title:s(n),"aria-label":s(n),onClick:F[0]||(F[0]=(...K)=>s(o)&&s(o)(...K))},[(A(),C("svg",sy,[i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.8",d:s(a)},null,8,ry)])),i("span",ly,u(s(n)),1)],8,oy),i("select",{class:"glass-input rounded-lg px-3 py-1.5 text-sm cursor-pointer text-ink",onChange:F[1]||(F[1]=K=>s(t)(K.target.value))},[(A(!0),C(de,null,Le(s(gc),K=>(A(),C("option",{key:K.code,value:K.code},u(K.label),9,dy))),128))],32)]),F[4]||(F[4]=i("h1",{class:"text-4xl font-bold text-ink",style:{position:"relative","z-index":"0"}},"Agnes Video Generator",-1)),i("p",cy,u(s(d)("subtitle")),1)]),F[6]||(F[6]=ir('<nav class="flex justify-center items-center gap-4 mb-8 text-xs tracking-wide"><a href="https://video.lichuanyang.top/demo" target="_blank" rel="noopener" class="flex items-center gap-1 text-accent hover:text-ink transition-colors">🎬 Demo</a><span class="text-ink/5 select-none">·</span><a href="https://video.lichuanyang.top" target="_blank" rel="noopener" class="flex items-center gap-1 text-muted hover:text-ink-2 transition-colors">🏠 Home</a><span class="text-ink/5 select-none">·</span><a href="https://video.lichuanyang.top/guides/prompt-tips" target="_blank" rel="noopener" class="flex items-center gap-1 text-muted hover:text-ink-2 transition-colors">📖 Guides</a><span class="text-ink/5 select-none">·</span><a href="https://video.lichuanyang.top/faq" target="_blank" rel="noopener" class="flex items-center gap-1 text-muted hover:text-ink-2 transition-colors">❓ FAQ</a><span class="text-ink/5 select-none">·</span><a href="https://github.com/lcy362/agnes-video-generator" target="_blank" rel="noopener" class="flex items-center gap-1 text-muted hover:text-ink-2 transition-colors">📖 GitHub</a></nav>',1)),ce($m),i("div",py,[i("button",{class:Pe(["px-5 py-2.5 rounded-lg text-sm font-medium transition",v.value==="create"?"tab-active":"tab-inactive"]),onClick:F[2]||(F[2]=K=>V("create"))},u(s(d)("tabCreate")),3),i("button",{class:Pe(["px-5 py-2.5 rounded-lg text-sm font-medium transition",v.value==="list"?"tab-active":"tab-inactive"]),onClick:F[3]||(F[3]=K=>V("list"))},u(s(d)("tabList")),3)]),N(i("div",null,[ce(_S)],512),[[ra,v.value==="create"]]),N(i("div",null,[ce(RS)],512),[[ra,v.value==="list"]]),ce(Pv),i("footer",uy,[i("div",my,[i("p",gy,u(s(d)("moreResources")),1),i("div",fy,[i("a",hy,u(s(d)("projectHome")),1),i("a",by,u(s(d)("onlineDemo")),1),i("a",ky,u(s(d)("usageGuide")),1),i("a",Sy,u(s(d)("faqTitle")),1),i("a",vy,u(s(d)("apiDocs")),1),i("a",yy,u(s(d)("appScenarios")),1),F[5]||(F[5]=i("a",{href:"https://github.com/lcy362/agnes-video-generator",target:"_blank",rel:"noopener",class:"text-muted hover:text-ink-2 transition-colors"},"📖 GitHub",-1))])])])]),i("aside",Py,[i("div",xy,[i("div",_y,u(s(d)("quickLinks")),1),i("a",Ay,u(s(d)("onlineDemo")),1),i("a",Cy,u(s(d)("promptTips")),1),i("a",wy,u(s(d)("modelOverview")),1),i("a",Ty,u(s(d)("apiCall")),1),i("a",Iy,u(s(d)("faqTitle")),1),i("a",Dy,u(s(d)("apiDocs")),1),i("a",Ly,u(s(d)("appScenarios")),1)])])]),ce(zv),ce(Bv,{visible:s(r),message:s(c)},null,8,["visible","message"])],64))}});fi(Ge.value);const{themeApply:Fy,themeStored:Ey,initThemeListener:Vy}=mr();Fy(Ey());Vy();const{initGA:Hy,initErrorListeners:Ky}=ut();Hy();Ky();pc(My).mount("#app");