1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ByQ2B-w5.js","./DIPkJ2CL.js","./BWOhMDMl.js","./Q_j6PVt_.js","./vendor-ui.DZX39J8a.css","./CE9BS92s.js","./entry.B0-FF5LN.css","./Bxws6qaV.js","./BmmIcEEf.js","./CbTr50rP.js","./Bkqwasvk.js","./BMBMEpUl.js","./BJe_UgZq.js","./index.C9HYMJlE.css","./Bn_0McXh.js","./mBgOAPjx.js","./BhF2BmJ_.js","./BDAAHRhR.js","./BQgqNRbW.js","./yxQ3o8tg.js","./D29voxhS.js","./oz93GNB2.js","./index.BfDX6CI-.css","./BI5ll1by.js","./FrfgPX6q.js","./B68CCy-Y.js","./Db7V3AX6.js","./DFQDv-L3.js","./d171lX1y.js","./tkaMIU3t.js","./7OEtKs0s.js","./DgS66Mk4.js","./BpIaAIzi.js","./BUpyn0pA.js","./BNraSyWw.js","./CxffvIKD.js","./B0G_Eo_h.js","./jbIFRJwm.js","./LLr1hMc9.js","./B8PJn02S.js","./BOFM1mbV.js","./e0YgEBrO.js","./ieVRqSlE.js","./vendor-swiper.u8XjYG7I.css","./index.CgIxXwIx.css","./Blgy2TMe.js","./index.Cn4c6Fhx.css","./index.BrraXpfl.css","./CMdrK2Eh.js","./useReferenceImageCrop.DbWO7xZG.css","./CkZqoXWX.js","./BQRp09Np.js","./index.BaABSMjO.css","./RoleCreateContent.ohAfZf6V.css","./index.D8gpb5qc.css","./DiNd14Ig.js","./DItd96x2.js","./yjaU2saa.js","./DezyhmtX.js","./TouchVideoPlayer.BljlSp7H.css","./BXIEZCng.js","./nXO59L6R.js","./B8-OihdI.js","./D2hyHcp_.js","./CdqaWibm.js","./DOBtXcsF.js","./Dwqy8xHs.js","./BblmiPWh.js","./index.CKkxtNoW.css","./DHqHSUIf.js","./index.1spLkd_N.css","./BYxIZp8c.js","./MvGenerateButton.B1ufYYRu.css","./DZ2B42tU.js","./index.BLSDB6IY.css","./DCDI7YRH.js","./index.D1MZzeZc.css","./DaeNX4ce.js","./DQ11ClMP.js","./BDcN7oEK.js","./B4RuHaP_.js","./index.BnX0bQOT.css","./DqLBvmmr.js","./LUp38OQj.js","./uAr-WD-T.js","./index.DqMPK4ZH.css"])))=>i.map(i=>d[i]); 2import{b as nt,_ as xn}from"./BWOhMDMl.js";import{ab as de,u as Ft,b as qt,c as Wa,ac as An,z as Ka,ad as Mn,ae as Dt,af as Wt,a as Ya,S as Un,ag as te,ah as na,g as Qa,ai as Pa,Z as Tt,$ as Et,x as Vn,aj as Ca,ak as On,al as Dn,o as La,M as xa,am as sa,an as Nn,v as Gn,ao as Bn,ap as zn,aq as Rn,ar as qn,as as zt,at as jn,au as Hn,av as Wn,aw as Xa,D as Kn,a7 as Yn,f as Qn,_ as Xn}from"./DIPkJ2CL.js";import{_ as Jn}from"./BblmiPWh.js";import{G as Ja}from"./DHqHSUIf.js";import{M as Nt}from"./BYxIZp8c.js";import{T as Zn}from"./DZ2B42tU.js";import{c as es,a as ma,b as fa,w as Ee,e as k,f as Q,g as Lt,a6 as ne,N as It,aa as xt,au as Xe,a0 as Za,av as d,as as Y,r as b,n as Ct,d as z,aB as ct,L as M,a1 as ve,a2 as Ae,D as o,aq as pe,a5 as le,A as en,z as tn,C as ga,aP as ts,b9 as an,ar as St,ba as pa,Q as Te,$ as nn,a7 as as,i as ns,aA as Aa,bb as ss,bc as rs,aF as Ma,a3 as Vt,a4 as Ot,x as at,b1 as ls}from"./Q_j6PVt_.js";import{u as Gt}from"./7OEtKs0s.js";import{T as Bt}from"./DCDI7YRH.js";import{r as Kt}from"./Db7V3AX6.js";import{u as os}from"./DaeNX4ce.js";import{i as is,r as us,f as sn,a as cs,s as ds,b as yt,c as vs,d as ms,e as Yt,g as fs,h as gs,p as ps,j as ys}from"./yxQ3o8tg.js";import{s as Ua}from"./BhF2BmJ_.js";import{S as ya,e as hs,I as bs,a as ws}from"./CkZqoXWX.js";import{u as ha,I as ba}from"./CMdrK2Eh.js";import{S as wa,P as Ss,u as rn,r as Is,b as Fs}from"./tkaMIU3t.js";import{M as $s,S as Pt,a as ln,r as ks}from"./DQ11ClMP.js";import{r as Ts}from"./BDcN7oEK.js";import Es from"./B4RuHaP_.js";import{s as _s,n as Ps}from"./DqLBvmmr.js";import{r as Va}from"./d171lX1y.js";import{i as ra,c as Cs}from"./LUp38OQj.js";import{registerMedia as Oa}from"./uAr-WD-T.js";const Ls=["onClick"],xs={class:"tab-label"},As={key:0,class:"pro-badge"},Ms={__name:"TabSwitch",props:{options:{type:Array,default:()=>[]},modelValue:[String,Number],type:{type:String,default:"default"},responsive:{type:Boolean,default:!1},background:{type:String,default:"rgba(255, 255, 255, 0.1)"},activeBackground:{type:String,default:"linear-gradient(90deg, #7f58f7 0%, #9b6bf7 100%)"},textColor:{type:String,default:"rgba(255, 255, 255, 0.6)"},activeTextColor:{type:String,default:"#fff"},fontSize:{type:String,default:"16px"},padding:{type:String,default:"7px 10px"},borderRadius:{type:String,default:"44px"},hoverColor:{type:String,default:"rgba(255, 255, 255, 0.8)"},containerStyle:{type:Object,default:()=>({})},itemStyle:{type:Object,default:()=>({})},activeItemStyle:{type:Object,default:()=>({})}},emits:["update:modelValue"],setup(e,{emit:r}){const n=e,i=r,g=b(null),u=b([]),w=b({x:0,y:0,width:0,height:0,ready:!1});let y;function E(D,x){D&&(u.value[x]=D)}function p(){Ct(()=>{const D=n.options.findIndex(h=>h.value===n.modelValue),x=u.value[D];if(!x){w.value.ready=!1;return}w.value={x:x.offsetLeft,y:x.offsetTop,width:x.offsetWidth,height:x.offsetHeight,ready:!0}})}const S=z(()=>{const D={display:"inline-flex",gap:"10px",...n.containerStyle};return n.type==="creation"?D:{...D,background:n.background,borderRadius:n.borderRadius,padding:"4px"}}),L=z(()=>
2{const D={flex:"none",position:"relative",cursor:"pointer",transition:"all 0.3s ease",...n.itemStyle};return n.type==="creation"?D:{...D,padding:n.padding,borderRadius:n.borderRadius,fontSize:n.fontSize,color:n.textColor}}),K=z(()=>n.type==="creation"?{...n.activeItemStyle}:{...L.value,color:n.activeTextColor,...n.activeItemStyle}),O=z(()=>w.value.ready),W=z(()=>{var h,$;const D=((h=n.activeItemStyle)==null?void 0:h.background)||(n.type==="creation"?"#5c4dbd":n.activeBackground),x=(($=n.activeItemStyle)==null?void 0:$.borderRadius)||(n.type==="creation"?"8px":n.borderRadius);return{width:`${w.value.width}px`,height:`${w.value.height}px`,transform:`translate(${w.value.x}px, ${w.value.y}px)`,background:D,borderRadius:x}});es(()=>{u.value=[]}),ma(()=>{p(),window.addEventListener("resize",p),typeof ResizeObserver<"u"&&g.value&&(y=new ResizeObserver(()=>p()),y.observe(g.value))}),fa(()=>{window.removeEventListener("resize",p),y&&y.disconnect()}),Ee(()=>[n.modelValue,n.type,n.options],()=>{p()},{deep:!0,immediate:!0});function U(D){D!==n.modelValue&&i("update:modelValue",D)}return(D,x)=>(k(),Q("div",{ref_key:"containerRef",ref:g,class:Xe(["tab-switch",[e.type,{responsive:n.responsive}]]),style:Lt(S.value)},[O.value?(k(),Q("div",{key:0,class:"active-indicator",style:Lt(W.value)},null,4)):ne("",!0),(k(!0),Q(It,null,xt(e.options,(h,$)=>(k(),Q("div",{key:h.value,ref_for:!0,ref:R=>E(R,$),class:Xe(["tab-item",{active:h.value===e.modelValue}]),style:Lt(e.type==="creation"?null:h.value===e.modelValue?K.value:L.value),onClick:R=>U(h.value)},[Za(D.$slots,"item",{opt:h,active:h.value===e.modelValue},()=>[d("span",xs,Y(h.label),1),h.badge?(k(),Q("span",As,Y(h.badge),1)):ne("",!0)],!0)],14,Ls))),128))],6))}},on=nt(Ms,[["__scopeId","data-v-d14be141"]]);function la(e){return Number(e==null?void 0:e.status)===de.Success&&!!`${(e==null?void 0:e.firstFrameImg)??""}`.trim()}function Sa(e){return e&&Number(e.status)===de.Success&&!`${e.firstFrameImg??""}`.trim()&&(e.status=de.Failed),e}function un(e,r){const n={...e,shotImgDesc:(e==null?void 0:e.shotImgDesc)||(r==null?void 0:r.shotImgDesc)||"",coverImage:(e==null?void 0:e.coverImage)||(r==null?void 0:r.coverImage)||""};return Sa(n)}const Us=["aria-label"],Vs={key:0,class:"statusText"},Os={__name:"StatusOverlay",props:{status:{type:[Number,String],default:0},loadingStatus:{type:[Number,String],default:de.Generating},errorStatus:{type:[Number,String],default:de.Failed},errorIconSrc:{type:String,default:"@/assets/mv/error.webp"},errorIconWidth:{type:String,default:"55px"},loadingText:{type:String,default:""},showLoadingText:{type:Boolean,default:!1}},setup(e){const r=e,{t:n}=Ft(),i=z(()=>r.loadingText||n("common.generating")),g=z(()=>r.status===r.loadingStatus),u=z(()=>r.status===r.errorStatus),w=z(()=>g.value||u.value);return(y,E)=>{const p=qt,S=ct("LazyImages");return w.value?(k(),Q("div",{key:0,class:"statusOverlay",role:"status","aria-label":g.value?i.value:y.$t("common.generationFailed")},[g.value?(k(),Q(It,{key:0},[M(p,{variant:"block",size:24}),e.showLoadingText?(k(),Q("span",Vs,Y(i.value),1)):ne("",!0)],64)):u.value?Za(y.$slots,"error",{},()=>[M(S,{src:e.errorIconSrc,width:e.errorIconWidth,alt:y.$t("common.generationFailed")},null,8,["src","width","alt"])],!0,1):ne("",!0)],8,Us)):ne("",!0)}}},Rt=nt(Os,[["__scopeId","data-v-57e1de27"]]),Ds=["aria-label"],Ns=["aria-selected","onClick","onKeydown"],Da="history-data-loading",Gs={__name:"HistoryList",props:{images:{type:Array,default:()=>[]},modelValue:{type:Object,default:()=>({id:0,firstFrameImg:""})},itemWidth:{type:String,default:"60px"},itemHeight:{type:String,default:"60px"},showNavigationButtons:{type:String,default:"none"},loading:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:r}){const n=e,i=r,g=b(n.modelValue),u=z(()=>n.loading&&(n.images||[]).length===0);Ee(()=>n.modelValue,y=>{g.value=y});const w=y=>{g.value=y,i("update:modelValue",y)};return(y,E)=>{const p=ct("LazyImages");return k(),ve(wa,{"show-navigation-buttons":!0,"navigation-button-type":e.showNavigationButtons,class:"historyFrameList","aria-busy":n.loading?"true":"false"},{default:Ae(()=>[u.value?(k(),Q("div",{key:0,class:"historyItem historyItemLoading",role:"status","aria-label":y.$t("common.loading"),style:Lt({width:n.itemWidth,height:n.itemHeight})},[M(Rt,{status:Da,"loading-status":Da,"error-status":o(de).Failed,"loading-text":y.$t("common.loading"),"error-icon-width":"50%"},null,8,["error-status","loading-text"])],12,Ds)):(k(!0),Q(It,{key:1},xt(e.images,S=>(k(),Q("div",{key:S.id,class:Xe(["historyItem",{activeFrame:g.value&&g.value.id===S.id,loading:S.status===o(de).Generating,success:S.status===o(de).Success,error:S.status===o(de).Failed}]),role:"option",tabindex:"0","aria-selected":g.value&&g.value.id===S.id,style:Lt({width:n.itemWidth,height:n.itemHeight}),onClick:L=>w(S),onKeydown:[pe(le(L=>w(S),["prevent"]),["enter"]),pe(le(L=>w(S),["prevent"]),["space"])]},[M(p,{src:S.firstFrameImg,width:"100%",height:"100%",alt:S.shotImgDesc||y.$t("mv.firstFrame")},null,8,["src","alt"]),M(Rt,{status:S.status,"loading-status":o(de).Generating,"error-status":o(de).Failed,"error-icon-width":"50%"},null,8,["status","loading-status","error-status"])],46,Ns))),128))]),_:1},8,["navigation-button-type","aria-busy"])}}},cn=nt(Gs,[["__scopeId","data-v-2b366469"]]),Bs=["aria-label"],zs={class:"content"},Rs={class:"frame bg w-full border-radius-12 p-10"},qs={class:"frameImg"},js={class:"frameOpt"},Hs=["aria-label","onKeydown"],Ws=["aria-label","onKeydown"],Ks=["aria-label","onKeydown"],Ys={class:"setting w-300 h-full"},Qs={class:"editor h-full"},Xs={class:"bg border-radius-12 p-10 h-145px"},Js={class:"flex justify-space-between items-center"},Zs={class:"carterTitle"},er={class:"upload-card w-full h-80px flex items-center justify-center m-t-10"},tr={class:"upload-inner w-full h-full"},ar={key:0,class:"preview-card w-full h-full flex items-center justify-center border-radius-12"},nr=["aria-label","onClick","onKeydown"],sr={key:1,class:"upload-trigger"},rr={key:0,class:"text-12 text-[var(--color-error)] text-center"},lr={class:"p-10 prompt-area"},or={class:"carterTitle"},ir={class:"footer m-t-10 w-full flex gap-20 items-center"},ur={class:"imgList h-full"},cr={class:"w-300"},dr={__name:"FirstFrame",props:{currentImg:{type:Object,default:()=>({id:0,firstFrameImg:""})},shotId:{type:[String,Number],default:null},historyImgList:{type:Array,default:()=>[]},visible:{type:Boolean,default:!1},taskId:{type:[String,Number],default:null},mvCoverImage:{type:String,default:""},shotType:{type:[String,Number],default:null},isFlowV2:{type:Boolean,default:!1}},emits:["update:currentImg","update:historyImgList","closeFirstFrame"],setup(e,{emit:r}){const n=e,i=Wa(),g=r,{t:u}=Ft(),{request:w,transform:y}=ha();Ee([()=>n.visible,()=>n.shotId],()=>{var t;return(t=w.value)==null?void 0:t.cancel()});const E=b({url:n.currentImg.coverImage,remoteUrl:n.currentImg.coverImage,file:null,isViolation:!1,violationMessage:""}),p=b(null),S=b(!1),L=os({},{onValueChange:t=>{E.value={url:t.localUrl||"",remoteUrl:t.remoteUrl||"",file:t.file||null,isViolation:t.isViolation===!0,violationMessage:t.isViolation?t.violationMessage||u("mv.imageViolationTip"):""}}}),K=t=>{S.value=t},O=b(n.currentImg.shotImgDesc||""),W=b(!1),U=b(!1),D=b(!1),x=b(""),h=b(null),$=new Map,R=[0,3,4],Se=z(()=>Wt.normalizePoint(n.isFlowV2?Wt.mvSeedanceGachaImagePoint:Wt.gachaImagePoint)),m=z({get:()=>n.historyImgList||[],set:t=>{g("update:historyImgList",t)}}),X=t=>(t==null?void 0:t.status)===de.Success,C=t=>(t==null?void 0:t.status)===de.Pending||(t==null?void 0:t.status)===de.Generating,G={preview:"mv.firstFrameGeneratingPreviewTip",download:"mv.firstFrameGeneratingDownloadTip",delete:"mv.firstFrameGeneratingDeleteTip",select:"mv.firstFrameGeneratingSelectTip"},Z=t=>G[t]||"mv.firstFrameOnlySuccessTip",J=t=>m.value.some(s=>
2s.id!==t&&X(s)),Me=(t,s=0)=>{if(!t.length)return{};const I=Math.min(Math.max(s,0),t.length-1),B=t[I];return X(B)?B:t.find(X)||B},st=t=>{t!=null&&t.id&&(re.value=t,g("update:currentImg",t))},qe=t=>((t==null?void 0:t.coverImage)==n.mvCoverImage&&R.includes(Number(n.shotType))&&(t.coverImage=""),Sa(t)),Ie=async t=>{const s=t==null?void 0:t.id,I=(s?[t,...m.value.filter(B=>B.id!==s)]:m.value).map(qe);if(!n.taskId||!n.shotId)return m.value=I,I;try{const ae=(await cs(n.isFlowV2,{taskId:n.taskId,shotId:n.shotId})).map(qe),H=s&&ae.some(j=>j.id===s),A=s&&!H?[qe(t),...ae]:ae;return m.value=A,A}catch(B){return console.error("å·æ°é¦å¸§åå²å表失败",B),m.value=I,I}},re=b(n.currentImg);Ee(()=>re.value,()=>{E.value.url=re.value.coverImage,E.value.remoteUrl=re.value.coverImage,E.value.file=null,E.value.isViolation=!1,E.value.violationMessage="",O.value=re.value.shotImgDesc||"",x.value=""}),Ee(()=>n.visible,t=>{t&&(re.value=n.currentImg)}),Ee(()=>n.currentImg.id,()=>{re.value=n.currentImg,O.value=n.currentImg.shotImgDesc||"",x.value=""});const Ce=z(()=>{const t=[],s=re.value.firstFrameImg;return s&&t.push(s),m.value.forEach(I=>{const B=I.firstFrameImg;B&&B!==s&&t.push(B)}),t}),Ue=t=>m.value.find(s=>s.id===t)||null,Le=()=>{var s;const t=(s=re.value)==null?void 0:s.id;return t&&Ue(t)||re.value},ge=z(()=>is(Le())),je=(t="select")=>{const s=Le();return X(s)&&(s!=null&&s.firstFrameImg)?(re.value=s,s):C(s)?(Te.warning(u(Z(t))),null):(Te.warning(u("mv.firstFrameOnlySuccessTip")),null)},Fe=()=>{const t=Le();return C(t)?(Te.warning(u(Z("delete"))),null):t},He=()=>{je("preview")&&(U.value=!0)},Ne=async()=>{const t=je("download");if(!(!t||D.value)){D.value=!0;try{const s=t.firstFrameImg,I=s.split("?")[0].split("/").pop()||"first-frame";if(s&&s.includes("http")){const B=await An(s),{data:ae}=B;Ua({fileName:I,blob:ae})}else Ua({fileName:I,href:s})}catch(s){console.error("ä¸è½½å¤±è´¥",s)}finally{D.value=!1}}},$e=()=>{if(!ge.value)return;const t=Fe();if(!t)return;const s=t==null?void 0:t.id;if(!s||!J(s)){Te.warning(u("mv.cannotDeleteLastFrame"));return}Ka({message:u("mv.confirmDeleteFirstFrame"),confirmText:u("mv.confirm"),cancelText:u("mv.cancel"),confirm:async I=>{const B=Ue(s)||t;if(C(B)){Te.warning(u(Z("delete"))),I();return}if(!J(s)){Te.warning(u("mv.cannotDeleteLastFrame")),I();return}const ae=m.value.findIndex(A=>A.id===s);if((await Mn(s)).data){const A=m.value.filter(we=>we.id!==s),j=Math.min(Math.max(ae,0),A.length-1);m.value=A,st(Me(A,j)),Ve(s),Te.success(u("common.deleteTip"))}else{Te.error(u("mv.deleteFailed"));return}I()}})},me=t=>{var s,I;L.clear(),typeof t=="function"?t(!1):(I=(s=p.value)==null?void 0:s.clear)==null||I.call(s,!1),S.value=!1,E.value={url:"",remoteUrl:"",file:null,isViolation:!1,violationMessage:""}},Ve=t=>{const s=$.get(t);typeof s=="function"&&s(),$.delete(t)},fe=()=>{$.forEach(t=>{typeof t=="function"&&t()}),$.clear()},Be=()=>{m.value.filter(t=>t.status===de.Generating||t.status===de.Pending).forEach(t=>{Oe(t)})},Ge=async()=>{var s,I,B;if(W.value)return;if(x.value="",!O.value){Te.warning(u("mv.enterDescription"));return}if(S.value){Te.warning(u("mv.uploading"));return}W.value=!0;const t=n.shotId;try{if(!await Kt(Se.value)||!await((I=(s=h.value)==null?void 0:s.validateModeration)==null?void 0:I.call(s)))return;if(E.value.isViolation){Te.error(E.value.violationMessage||u("mv.imageViolationTip"));return}let ae=E.value.remoteUrl||E.value.url;if(E.value.url&&!E.value.remoteUrl)try{ae=await hs({remoteUrl:E.value.remoteUrl,file:E.value.file,objectUrl:E.value.url}),E.value.remoteUrl=ae}catch(ye){if(ye instanceof bs){E.value.isViolation=!0,E.value.violationMessage=ye.message||u("mv.imageViolationTip"),Te.error(E.value.violationMessage);return}if(ye instanceof ws){Te.error(u("mv.uploadFailed"));return}Te.error(u("mv.uploadFailed"));return}const H={id:t,coverImg:ae,description:O.value,userNeedPoint:Se.value},A=await us(n.isFlowV2,H,m.value.map(ye=>ye.id));if(!((B=A.data)!=null&&B.id))throw new Error("é¦å¸§é建æ¥å£æªè¿åæææ°æ®");const j=ye=>ye&&(ye.shotImgDesc||(ye.shotImgDesc=H.description),!ye.coverImage&&H.coverImg&&(ye.coverImage=H.coverImg),ye);if(j(A.data),i.getUserInfo(),n.shotId!==t)return;const we=await Ie(A.data);if(n.shotId!==t)return;const Ke=j(we.find(ye=>ye.id===A.data.id)||A.data);st(Ke),Be(),Oe(Ke)}catch(ae){if(Dt(ae))return;console.error("éæ°çæå¤±è´¥",ae)}finally{W.value=!1}},Oe=t=>{if(!(t!=null&&t.id))return;Ve(t.id);let s=()=>{};const I=t.shotId??n.shotId,{start:B,stop:ae}=Gt({request:()=>
2sn(n.isFlowV2,{historyId:t.id,shotId:I}),onUpdate:async H=>{var A;if((A=H==null?void 0:H.data)!=null&&A.id&&H.data.status!==de.Generating&&H.data.status!==de.Pending){const j=un(H.data,Ue(H.data.id));re.value.id===j.id&&(re.value=j,g("update:currentImg",re.value)),m.value=m.value.map(we=>we.id===j.id?j:we),s()}},key:`first-frame-cover-${t.id}`,immediate:!0,stopOnDeactivated:!0});s=()=>{ae(),$.delete(t.id)},$.set(t.id,s),B()},c=async()=>{var s,I;const t=je("select");t&&await((I=(s=h.value)==null?void 0:s.validateModeration)==null?void 0:I.call(s))&&(t!=null&&t.src&&(m.value.some(ae=>ae.src===t.src)||(m.value=[t,...m.value])),g("update:currentImg",t),g("closeFirstFrame"))};return en(()=>{Be()}),tn(()=>{fe()}),ga(()=>{fe()}),(t,s)=>{const I=ct("LazyImages"),B=an,ae=ct("upload-filled"),H=pa;return k(),Q("section",{class:"firstFrame","aria-label":t.$t("mv.firstFrame")},[d("section",zs,[d("div",Rs,[d("div",qs,[re.value.status===o(de).Success?(k(),ve(I,{key:0,preview:"","preview-teleported":"",src:re.value.firstFrameImg,alt:t.$t("mv.firstFrame"),height:"100%",class:"border-radius-12"},null,8,["src","alt"])):ne("",!0),M(Rt,{status:re.value.status,"loading-status":o(de).Generating,"error-status":o(de).Failed,"loading-text":t.$t("common.generating"),"show-loading-text":"","error-icon-width":"55px"},null,8,["status","loading-status","error-status","loading-text"])]),d("div",js,[d("div",{class:"frameOptBut",role:"button",tabindex:"0","aria-label":t.$t("common.viewNow"),onClick:He,onKeydown:[pe(le(He,["prevent"]),["enter"]),pe(le(He,["prevent"]),["space"])]},[M(I,{src:"@/assets/mv/fullScreen.svg",alt:"",role:"presentation"})],40,Hs),d("div",{class:Xe(["frameOptBut",{disabled:D.value}]),role:"button",tabindex:"0","aria-label":t.$t("mv.download"),onClick:Ne,onKeydown:[pe(le(Ne,["prevent"]),["enter"]),pe(le(Ne,["prevent"]),["space"])]},[D.value?(k(),ve(B,{key:0,class:"is-loading"},{default:Ae(()=>[M(o(ts))]),_:1})):(k(),ve(I,{key:1,src:"@/assets/mv/edit-download.svg",alt:"",role:"presentation"}))],42,Ws),ge.value?(k(),Q("div",{key:0,class:"frameOptBut",role:"button",tabindex:"0","aria-label":t.$t("common.delete"),onClick:$e,onKeydown:[pe(le($e,["prevent"]),["enter"]),pe(le($e,["prevent"]),["space"])]},[M(I,{src:"@/assets/mv/edit-delete.svg",alt:"",role:"presentation"})],40,Ks)):ne("",!0),M(Ja,{"show-credits":!1,block:!1,size:"small",background:"rgba(255, 255, 255, 0.12)","background-disabled":"rgba(255, 255, 255, 0.06)",onClick:c},{default:Ae(()=>[St(Y(t.$t("common.confirm")),1)]),_:1})])]),d("div",Ys,[d("div",Qs,[d("div",Xs,[d("div",Js,[d("div",Zs,Y(t.$t("mv.referencePhoto")),1)]),d("div",er,[d("div",tr,[M(ya,{ref_key:"imageUploadRef",ref:p,type:"image",class:"w-full h-full","upload-fn":o(L).uploadFn,"transform-file":o(y),"generate-preview-url":!1,"show-status-text":!1,source:"mv-storyboard-first-frame",onProcessingChange:K},{default:Ae(({clear:A})=>[E.value.url?(k(),Q("div",ar,[M(I,{class:"border-radius-12",src:E.value.url,alt:t.$t("mv.referencePhoto"),height:"70px",width:"70px"},null,8,["src","alt"]),d("div",{class:"close-btn",role:"button",tabindex:"0","aria-label":t.$t("common.cancel"),onClick:le(j=>me(A),["stop"]),onKeydown:[pe(le(j=>me(A),["stop","prevent"]),["enter"]),pe(le(j=>me(A),["stop","prevent"]),["space"])]},[...s[5]||(s[5]=[d("i",{class:"icon-close","aria-hidden":"true"},null,-1)])],40,nr)])):(k(),Q("div",sr,[M(B,{class:"el-icon--upload"},{default:Ae(()=>[M(ae)]),_:1}),d("div",null,Y(t.$t("mv.photoAlbum")),1)]))]),_:1},8,["upload-fn","transform-file"])])]),E.value.isViolation?(k(),Q("div",rr,Y(E.value.violationMessage||t.$t("mv.imageViolationTip")),1)):ne("",!0)]),d("div",lr,[d("div",or,Y(t.$t("mv.promptLabel")),1),M(Bt,{ref_key:"descriptionInputRef",ref:h,modelValue:O.value,"onUpdate:modelValue":s[0]||(s[0]=A=>O.value=A),"error-message":x.value,"onUpdate:errorMessage":s[1]||(s[1]=A=>x.value=A),type:"textarea",class:"description-input m-t-10 h-full flex-1 rounded-[12px] border-solid border-[2px] border-[var(--app-border-transparent)] bg-[var(--app-bg-surface-dark)]","input-class":"pb-[20px]","error-class":"absolute bottom-[2px] left-[10px]",maxlength:"2000","show-word-limit":"",resize:"none",placeholder:t.$t("mv.describePicturePlaceholder"),"moderation-field":"description"},null,8,["modelValue","error-message","placeholder"])])])])]),d("footer",ir,[d("div",ur,[M(cn,{"model-value":re.value,"onUpdate:modelValue":s[2]||(s[2]=A=>re.value=A),"show-navigation-buttons":"always",images:m.value,"item-width":"90px","item-height":"90px"},null,8,["model-value","images"])]),d("div",cr,[M(Nt,{credits:Se.value,loading:W.value,disabled:W.value,onClick:Ge},{default:Ae(()=>
2[St(Y(t.$t("create.create")),1)]),_:1},8,["credits","loading","disabled"])])]),U.value?(k(),ve(H,{key:0,teleported:"","url-list":Ce.value,"initial-index":0,onClose:s[3]||(s[3]=A=>U.value=!1)},null,8,["url-list"])):ne("",!0),o(w)?(k(),ve(ba,{key:o(w).url,src:o(w).url,"confirm-file":o(w).confirm,onCancel:s[4]||(s[4]=A=>o(w).cancel())},null,8,["src","confirm-file"])):ne("",!0)],8,Bs)}}},vr=nt(dr,[["__scopeId","data-v-b33e65d1"]]),mr=["aria-label","aria-busy"],fr={class:"carterTitle shrink-0",role:"heading","aria-level":"2"},gr=["aria-label","aria-busy"],pr={class:"absolute inset-[var(--mv-edit-space)]"},yr={class:"historyFrame shrink-0"},hr=["aria-label"],Na="first-frame-data-loading",br={__name:"FirstFrameEditor",props:{currentImg:{type:Object,default:()=>({id:0,firstFrameImg:""})},historyImgList:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1}},emits:["update:currentImg","update:historyImgList","openFirstFrame"],setup(e,{emit:r}){const n=e,i=r,g=z({get:()=>n.currentImg,set:p=>{i("update:currentImg",p)}}),u=z({get:()=>n.historyImgList||[],set:p=>{i("update:historyImgList",p)}}),w=z(()=>{var p;return!!((p=g.value)!=null&&p.firstFrameImg)}),y=z(()=>n.loading&&!w.value),E=z(()=>{const p=u.value||[],S=g.value;return S!=null&&S.src&&!p.some(K=>K.src===S.src)?[S,...p]:p});return(p,S)=>{var K,O;const L=ct("LazyImages");return k(),Q("section",{class:"firstframe bg flex flex-col flex-[11_1_0%] min-h-0 gap-[var(--mv-edit-space)] p-[var(--mv-edit-space)]","aria-label":p.$t("mv.firstFrame"),"aria-busy":n.loading?"true":"false"},[d("div",fr,Y(p.$t("mv.firstFrame")),1),d("div",{class:"imgContent flex-c-c flex-1 min-h-0 overflow-hidden",role:"button",tabindex:"0","aria-label":p.$t("mv.firstFrame"),"aria-busy":y.value?"true":"false",onClick:S[0]||(S[0]=W=>p.$emit("openFirstFrame")),onKeydown:[S[1]||(S[1]=pe(le(W=>p.$emit("openFirstFrame"),["prevent"]),["enter"])),S[2]||(S[2]=pe(le(W=>p.$emit("openFirstFrame"),["prevent"]),["space"]))]},[d("div",pr,[((K=g.value)==null?void 0:K.status)===o(de).Success?(k(),ve(L,{key:0,src:g.value.firstFrameImg,alt:p.$t("mv.firstFrame"),height:"100%",width:"100%",fit:"contain"},null,8,["src","alt"])):ne("",!0)]),y.value?(k(),ve(Rt,{key:0,status:Na,"loading-status":Na,"error-status":o(de).Failed,"loading-text":p.$t("common.loading"),"show-loading-text":"","error-icon-width":"55px"},null,8,["error-status","loading-text"])):(k(),ve(Rt,{key:1,status:(O=g.value)==null?void 0:O.status,"loading-status":o(de).Generating,"error-status":o(de).Failed,"loading-text":p.$t("common.generating"),"show-loading-text":"","error-icon-width":"55px"},null,8,["status","loading-status","error-status","loading-text"]))],40,gr),d("div",yr,[d("div",{class:"optFrame",role:"button",tabindex:"0","aria-label":p.$t("mv.firstFrame"),onClick:S[3]||(S[3]=W=>p.$emit("openFirstFrame")),onKeydown:[S[4]||(S[4]=pe(le(W=>p.$emit("openFirstFrame"),["prevent"]),["enter"])),S[5]||(S[5]=pe(le(W=>p.$emit("openFirstFrame"),["prevent"]),["space"]))]},[M(L,{src:"@/assets/mv/updataImg.svg",width:"24px",alt:"",role:"presentation"})],40,hr),M(cn,{"model-value":g.value,images:E.value,loading:n.loading,"item-width":"var(--mv-edit-thumb)","item-height":"var(--mv-edit-thumb)","onUpdate:modelValue":S[6]||(S[6]=W=>g.value=W)},null,8,["model-value","images","loading"])])],8,mr)}}},wr=nt(br,[["__scopeId","data-v-5343e423"]]),Sr={class:"prompt-editor-wrapper flex flex-col flex-[10_1_0%] gap-[var(--mv-edit-gap)]"},Ir={key:0,class:"videoTypeBlock flex justify-space-between items-center p-[var(--mv-edit-space)]"},Fr={class:"carterTitle"},$r={class:"prompt-area flex flex-col flex-1 min-h-0 p-[var(--mv-edit-space)]"},kr={class:"carterTitle shrink-0"},Tr={__name:"PromptEditor",props:{description:{type:String,default:""},isRegnenerate:{type:Boolean,default:!0},videoType:{type:Number,default:0},mvType:{type:Number,default:0},errorMessage:{type:String,default:""},maxLength:{type:Number,default:$s}},emits:["update:description","update:videoType","input-change"],setup(e,{emit:r}){const n=e,i=r,{t:g}=Ft(),u=z(()=>[{value:0,label:g("mv.common")},{value:1,label:g("mv.sing")}]),w=z({get:()=>n.videoType,set:y=>i("update:videoType",y)});return(y,E)=>(k(),Q("div",Sr,[e.mvType==0?(k(),Q("div",Ir,[d("div",Fr,Y(y.$t("mv.videoType")),1),M(on,{modelValue:w.value,"onUpdate:modelValue":E[0]||(E[0]=p=>w.value=p),options:u.value,"font-size":"var(--mv-edit-tab-font)",padding:"var(--mv-edit-tab-padding)","item-style":{lineHeight:"var(--mv-edit-tab-line)"}},null,8,["modelValue","options"])])):ne("",!0),d("div",$r,[d("div",kr,Y(e.mvType==0?y.$t("mv.videoGenerationPrompt"):y.$t("mv.imageGenerationPrompt")),1),M(Bt,{"model-value":e.description,"error-message":e.errorMessage,disabled:!e.isRegnenerate,type:"textarea",class:"description-input mt-[var(--mv-edit-space)] flex-1 min-h-[104px] rounded-[12px] border-solid border-[2px] border-[rgba(255,255,255,0)] bg-[rgba(0,0,0,0.25)]","error-class":"absolute bottom-[2px] left-[10px]",maxlength:e.maxLength,"show-word-limit":"",resize:"none",placeholder:y.$t("mv.describeThisShot"),"onUpdate:modelValue":E[1]||(E[1]=p=>y.$emit("update:description",p)),onInputChange:E[2]||(E[2]=p=>y.$emit("input-change"))},null,8,["model-value","error-message","disabled","maxlength","placeholder"])])]))}},Er=nt(Tr,[["__scopeId","data-v-aca2a779"]]),_r=["disabled"],Pr=["disabled"],Cr=Object.assign({name:"ReferenceImageActionMenu"},{__name:"ReferenceImageActionMenu",props:{disabled:{type:Boolean,default:!1}},emits:["upload","select"],setup(e,{emit:r}){const n=r;return(i,g)=>{const u=Ya;return k(),Q("div",{class:"upload-action-menu",role:"menu",onClick:g[2]||(g[2]=le(()=>{},["stop"]))},[d("button",{type:"button",class:"upload-action-menu-item",role:"menuitem",disabled:e.disabled,onClick:g[0]||(g[0]=le(w=>n("upload"),["stop"]))},[M(u,{name:"song-upload",color:"currentColor",class:"w-[16px] h-[16px]"}),d("span",null,Y(i.$t("mv.upload")),1)],8,_r),d("button",{type:"button",class:"upload-action-menu-item",role:"menuitem",disabled:e.disabled,onClick:g[1]||(g[1]=le(w=>n("select"),["stop"]))},[M(u,{name:"photo-select",color:"currentColor",class:"w-[16px] h-[16px]"}),d("span",null,Y(i.$t("mv.chooseASong")),1)],8,Pr)])}}}),Ga=nt(Cr,[["__scopeId","data-v-9ce7b3f2"]]);function oa(){return typeof window<"u"&&!!window.localStorage}function dn(e){if(typeof e!="string")return!1;const r=e.trim();return r!==""&&!/^(blob:|data:)/i.test(r)}function Lr(e){if(!e||typeof e!="object")return null;const r=e;return dn(r.url)?{url:r.url.trim(),hash:typeof r.hash=="string"?r.hash:""}:null}function Ba(e,r){const n=new Set,i=new Set,g=[];for(const u of e)n.has(u.url)||u.hash&&i.has(u.hash)||(n.add(u.url),u.hash&&i.add(u.hash),g.push(u));return g.slice(0,r)}async function xr(e){try{const r=await globalThis.crypto.subtle.digest("SHA-256",await e.arrayBuffer());return Array.from(new Uint8Array(r),n=>n.toString(16).padStart(2,"0")).join("")}catch{return""}}function Ar(e){const{storageKey:r,maxItemsPerScope:n,maxScopes:i}
2=e,g=b({}),u=b([]);let w=!1;const y=()=>{if(!oa())return{buckets:{},recent:[]};try{const K=window.localStorage.getItem(r),O=K?JSON.parse(K):null;if(!O||typeof O!="object")return{buckets:{},recent:[]};const W=O,U=W.buckets,D={};if(U&&typeof U=="object")for(const[$,R]of Object.entries(U)){if(!Array.isArray(R))continue;const Se=R.map(Lr).filter(X=>X!==null),m=Ba(Se,n);m.length&&(D[$]=m)}const h=(Array.isArray(W.recent)?W.recent:[]).filter($=>typeof $=="string"&&$ in D).slice(0,i);return{buckets:D,recent:h}}catch{return{buckets:{},recent:[]}}},E=()=>{if(oa())try{window.localStorage.setItem(r,JSON.stringify({buckets:g.value,recent:u.value}))}catch{}},p=()=>{if(w||!oa())return;w=!0;const K=y();g.value=K.buckets,u.value=K.recent},S=K=>{if(K==null)return"";const O=`${K}`.trim();return O===""||O==="undefined"||O==="null"?"":O},L=K=>{const O=u.value.filter(D=>D!==K),W=[K,...O],U=W.slice(0,i);for(const D of W.slice(i))delete g.value[D];u.value=U};return{useScope:K=>(p(),{items:z(()=>{const O=S(o(K));return O?(g.value[O]||[]).map(W=>W.url):[]}),add:async(O,W)=>{const U=S(o(K));if(!U||!dn(O))return;p();const D=O.trim(),x=W instanceof File?await xr(W):"",$=(g.value[U]||[]).filter(R=>R.url!==D&&!(x&&R.hash&&R.hash===x));g.value={...g.value,[U]:Ba([{url:D,hash:x},...$],n)},L(U),E()}})}}const Mr="sondo.mvEditReferenceImageHistory.v1",Ur=50,Vr=20,Or=Ar({storageKey:Mr,maxItemsPerScope:Ur,maxScopes:Vr});function Dr(e){return Or.useScope(e)}const Nr=["aria-label"],Gr={class:"carterTitle",role:"heading","aria-level":"2"},Br={class:"galleryGrid"},zr=["aria-label","onMouseenter","onClick","onKeydown"],Rr={class:"galleryItemMedia"},qr=["aria-label","aria-expanded","onClick"],jr=["aria-label"],Hr={class:"galleryCell galleryCell--upload"},Wr=["aria-expanded","tabindex","aria-label"],Kr={class:"uploadWorkerPool hidden",hidden:"","aria-hidden":"true"},Yr=["src"],_t=220,ia=10,Ht=8,Qr=Object.assign({name:"ReferenceImageGallery"},{__name:"ReferenceImageGallery",props:{modelValue:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1},shotId:{type:[String,Number],default:""},mvId:{type:[String,Number],default:""}},emits:["update:modelValue","uploading"],setup(e,{emit:r}){const{request:n,transform:i}=ha({queue:!0}),g=e,u=r,{t:w}=Ft(),y=b(Array.isArray(g.modelValue)?[...g.modelValue]:[]);Ee(()=>g.modelValue,c=>y.value=Array.isArray(c)?[...c]:[]);function E(c){const t=String(c||"").trim();if(!t||y.value.includes(t))return!1;if(y.value.length>=Pt)return Te.warning(w("mv.referenceImageMax",{max:Pt})),!1;const s=[...y.value,t];return y.value=s,u("update:modelValue",s),!0}function p(c,t){const s=String(t||"").trim();if(!s)return!1;const I=y.value;if(c<0||c>=I.length||I.includes(s))return!1;const B=I.map((ae,H)=>H===c?s:ae);return y.value=B,u("update:modelValue",B),!0}function S(c,t){return typeof c=="number"?p(c,t):E(t)}const L=b(Array.from({length:Pt},()=>({localUrl:"",remoteUrl:"",processing:!1,mode:null,targetIndex:null,appendOrder:null,settled:!1}))),K=b([]),O=b(null),W=z(()=>L.value.some(c=>c.processing)),U=z(()=>L.value.some(c=>c.processing&&c.mode==="append"));let D=0,x=1;const h=new Map;Ee(W,c=>u("uploading",c));const{items:$,add:R}=Dr(z(()=>g.mvId));function Se(c,t){K.value[c]=t||null}function m(c){return L.value.some(t=>t.processing&&t.mode==="replace"&&t.targetIndex===c)}function X(){return L.value.findIndex(c=>!c.processing)}function C(){return L.value.filter(c=>c.processing&&c.mode==="append").length}function G(){for(;h.has(x);){const c=h.get(x);h.delete(x),x+=1,c&&(E(c.remoteUrl),R(c.remoteUrl,c.file))}}function Z(c,t=null){if(!c.settled){if(c.settled=!0,typeof c.appendOrder!="number"){t&&(E(t.remoteUrl),R(t.remoteUrl,t.file));return}h.set(c.appendOrder,t),G()}}function J(c){c.mode=null,c.targetIndex=null,c.appendOrder=null,c.settled=!1}function Me(c,t){const s=L.value[c];s&&(s.processing=t,t&&s.mode==="append"&&typeof s.appendOrder!="number"&&(s.appendOrder=++D),t||(s.mode==="append"&&Z(s),J(s)))}function st(c,t){const s=L.value[c];if(!s)return;const I=String((t==null?void 0:t.remoteUrl)||"").trim(),B=s.mode,ae=s.targetIndex;I&&(B==="replace"&&typeof ae=="number"?(p(ae,I),R(I,t==null?void 0:t.file)):B==="append"&&Z(s,{remoteUrl:I,file:t==null?void 0:t.file}))}function qe(c,t){const s=L.value[c];s&&(s.mode==="append"&&Z(s),s.processing=!1,J(s)),console.error(t)}Ee(()=>g.shotId,()=>{K.value.forEach(c=>c==null?void 0:c.clear(!1)),L.value.forEach(c=>{c.processing=!1,J(c),c.localUrl="",c.remoteUrl=""}),D=0,x=1,h.clear(),O.value=null,re(),Oe(),me.value=!1});const Ie=b(null);function re(){Ie.value=null}function Ce(){re()}function Ue(c){c.key==="Escape"&&re()}Ee(Ie,c=>{c!==null?(document.addEventListener("click",Ce),document.addEventListener("keydown",Ue)):(document.removeEventListener("click",Ce),document.removeEventListener("keydown",Ue))});function Le(c){g.disabled||Ie.value!==c&&c==="upload"&&ge()||(Oe(),Ie.value=Ie.value===c?null:c)}function ge(){return y.value.length+C()<Pt?!1:(Te.warning(w("mv.referenceImageMax",{max:Pt})),!0)}function je(){var I;const c=Ie.value;if(re(),g.disabled||c==="upload"&&ge())return;const t=X();if(t<0)return;const s=L.value[t];s&&(s.mode=typeof c=="number"?"replace":"append",s.targetIndex=typeof c=="number"?c:null,(I=K.value[t])==null||I.chooseFile())}function Fe(){const c=Ie.value;re(),!g.disabled&&(c==="upload"&&ge()||(O.value=typeof c=="number"?c:null,He.value=!0))}const He=b(!1);function Ne(c){if(g.disabled)return;const t=O.value;O.value=null,S(t,c)}function $e(c){if(g.disabled)return;const t=O.value;O.value=null,S(t,(c==null?void 0:c.roleImg)||(c==null?void 0:c.coverImage)||"")}const me=b(!1),Ve=b(0);function fe(c){y.value.length&&(Oe(),Ve.value=c,me.value=!0)}const Be=b(null);function Ge(c,t){var j,we;if(typeof window>"u"||Ie.value!==null)return;const s=(we=(j=t.currentTarget)==null?void 0:j.getBoundingClientRect)==null?void 0:we.call(j);if(!s)return;const B=s.top>=_t+ia+Ht?s.top-ia-_t:s.bottom+ia,ae=s.left+s.width/2-_t/2,H=Math.max(window.innerWidth-_t-Ht,Ht),A=Math.min(Math.max(ae,Ht),H);
2Be.value={url:c,style:{top:`${Math.round(B)}px`,left:`${Math.round(A)}px`,width:`${_t}px`,height:`${_t}px`}}}function Oe(){Be.value=null}return fa(()=>{Oe(),document.removeEventListener("click",Ce),document.removeEventListener("keydown",Ue),W.value&&u("uploading",!1)}),(c,t)=>{const s=ct("LazyImages"),I=Ya,B=qt,ae=pa;return k(),Q("section",{class:Xe(["reference-image-gallery shrink-0 relative",{"z-10":Ie.value!==null}]),"aria-label":c.$t("mv.referencePhoto")},[d("div",Gr,Y(c.$t("mv.referencePhoto")),1),d("div",Br,[(k(!0),Q(It,null,xt(y.value,(H,A)=>(k(),Q("div",{key:H,class:"galleryCell galleryItem",role:"button",tabindex:0,"aria-label":c.$t("mv.referencePhoto"),onMouseenter:j=>Ge(H,j),onMouseleave:Oe,onClick:j=>fe(A),onKeydown:[pe(le(j=>fe(A),["self","prevent"]),["enter"]),pe(le(j=>fe(A),["self","prevent"]),["space"])]},[d("div",Rr,[M(s,{src:H,lazy:!1,width:"100%",height:"100%",alt:c.$t("mv.referencePhoto")},null,8,["src","alt"])]),!e.disabled&&!m(A)?(k(),Q("button",{key:0,type:"button",class:"galleryReplace galleryReplace--action","aria-label":c.$t("create.replace"),"aria-haspopup":"menu","aria-expanded":Ie.value===A,onClick:le(j=>Le(A),["stop"])},[M(I,{name:"photo-replace",class:"w-[14px] h-[14px]",color:"#fff"})],8,qr)):m(A)?(k(),Q("div",{key:1,class:"galleryReplace",role:"status","aria-label":c.$t("common.loading"),onClick:t[0]||(t[0]=le(()=>{},["stop"]))},[M(B,{variant:"button",size:18})],8,jr)):ne("",!0),Ie.value===A?(k(),ve(Ga,{key:2,disabled:e.disabled,onUpload:je,onSelect:Fe},null,8,["disabled"])):ne("",!0)],40,zr))),128)),d("div",Hr,[d("div",{class:Xe(["optFrame",{"is-disabled":e.disabled}]),role:"button","aria-haspopup":"menu","aria-expanded":Ie.value==="upload",tabindex:e.disabled?void 0:0,"aria-label":c.$t("mv.uploadPhoto"),onClick:t[1]||(t[1]=le(H=>Le("upload"),["stop"])),onKeydown:[t[2]||(t[2]=pe(le(H=>Le("upload"),["stop","prevent"]),["enter"])),t[3]||(t[3]=pe(le(H=>Le("upload"),["stop","prevent"]),["space"]))]},[U.value?(k(),ve(B,{key:0,variant:"button",size:22})):(k(),ve(s,{key:1,src:"@/assets/mv/updataImg.svg",width:"24px",alt:"",role:"presentation","show-skeleton":!1}))],42,Wr),Ie.value==="upload"?(k(),ve(Ga,{key:0,disabled:e.disabled,onUpload:je,onSelect:Fe},null,8,["disabled"])):ne("",!0)])]),d("div",Kr,[(k(!0),Q(It,null,xt(L.value,(H,A)=>(k(),ve(ya,nn({key:A,ref_for:!0,ref:j=>Se(A,j),modelValue:H.localUrl,"onUpdate:modelValue":j=>H.localUrl=j,"remote-url":H.remoteUrl,"onUpdate:remoteUrl":j=>H.remoteUrl=j,type:"image","max-size-mb":10},{ref_for:!0},o(ln),{"transform-file":o(i),"manual-trigger":!0,"show-status-text":!1,"show-processing-mask":!1,disabled:e.disabled,source:"mv-edit-reference-image",onProcessingChange:j=>Me(A,j),onSuccess:j=>st(A,j),onError:j=>qe(A,j)}),null,16,["modelValue","onUpdate:modelValue","remote-url","onUpdate:remoteUrl","transform-file","disabled","onProcessingChange","onSuccess","onError"]))),128))]),(k(),ve(as,{to:"body"},[Be.value?(k(),Q("div",{key:0,class:"gallery-hover-preview",style:Lt(Be.value.style),role:"presentation"},[d("img",{src:Be.value.url,class:"gallery-hover-preview-img",alt:""},null,8,Yr)],4)):ne("",!0)])),me.value?(k(),ve(ae,{key:0,teleported:"","url-list":y.value,"initial-index":Ve.value,onClose:t[4]||(t[4]=H=>me.value=!1)},null,8,["url-list","initial-index"])):ne("",!0),o(n)?(k(),ve(ba,{key:o(n).url,src:o(n).url,"confirm-file":o(n).confirm,onCancel:t[5]||(t[5]=H=>o(n).cancel())},null,8,["src","confirm-file"])):ne("",!0),M(Ss,{visible:He.value,"onUpdate:visible":t[6]||(t[6]=H=>He.value=H),"hide-public":"","show-mv-images":"","show-history":"","history-urls":o($),onPick:Ne,onPickRole:$e},null,8,["visible","history-urls"])],10,Nr)}}}),Xr=nt(Qr,[["__scopeId","data-v-60b67f53"]]),Jr=["aria-label"],Zr={class:"carterTitle shrink-0",role:"heading","aria-level":"2"},el=["role","tabindex","aria-label","onKeydown"],tl={class:"absolute inset-[var(--mv-edit-space)]"},al={key:0,class:"s-loading-region"},nl={class:"historyFrame shrink-0"},sl=["tabindex","aria-label","onClick","onKeydown"],rl=["tabindex","aria-label","onClick","onKeydown"],ll=["tabindex","aria-selected","onClick","onKeydown"],ol=Object.assign({name:"ReferenceImageUploader"},{__name:"ReferenceImageUploader",props:{remoteUrl:{type:String,default:""},images:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1},shotId:{type:[String,Number],default:""}},emits:["update:remoteUrl","uploading"],setup(e,{emit:r}){const{request:n,transform:i}=ha(),g=e,u=r,w=b(g.remoteUrl||""),y=b(g.remoteUrl||""),E=b(null),p=b(""),S=b(!1),L=b(!1),K=z(()=>!!w.value&&!S.value);Ee(()=>g.remoteUrl,m=>{const X=m||"";X!==y.value&&(w.value=X,y.value=X)}),Ee(y,m=>u("update:remoteUrl",m||"")),Ee(S,m=>u("uploading",m)),Ee(()=>g.shotId,()=>{var m;(m=E.value)==null||m.clear(!1),O(),S.value=!1,w.value=y.value});const O=(m="")=>{const X=p.value;!X||X===m||(URL.revokeObjectURL(X),p.value="")},W=()=>{K.value&&(L.value=!0)},U=m=>{var X;g.disabled||!m||((X=E.value)==null||X.clear(!1),O(),S.value=!1,w.value=m,y.value=m)},D=m=>{O();const X=URL.createObjectURL(m);p.value=X,w.value=X,y.value=""},x=m=>{S.value=m},h=m=>{O(m.localUrl),w.value=m.localUrl||"",y.value=m.remoteUrl||""},$=m=>{m.remoteUrl&&(w.value=m.remoteUrl,y.value=m.remoteUrl)},R=m=>
2{O(),w.value="",y.value="",S.value=!1,console.error(m)},Se=()=>{O()};return fa(()=>{O(),S.value&&u("uploading",!1)}),(m,X)=>{const C=ct("LazyImages"),G=qt,Z=pa;return k(),Q("section",{class:"reference-image flex flex-col flex-[11_1_0%] min-h-0 gap-[var(--mv-edit-space)] p-[var(--mv-edit-space)]","aria-label":m.$t("mv.referencePhoto")},[d("div",Zr,Y(m.$t("mv.referencePhoto")),1),d("div",{class:Xe(["imgContent flex-c-c flex-1 min-h-0 overflow-hidden",{"is-previewable":K.value}]),role:K.value?"button":void 0,tabindex:K.value?0:void 0,"aria-label":m.$t("mv.referencePhoto"),onClick:W,onKeydown:[pe(le(W,["prevent"]),["enter"]),pe(le(W,["prevent"]),["space"])]},[d("div",tl,[w.value?(k(),ve(C,{key:w.value,src:w.value,alt:m.$t("mv.referencePhoto"),height:"100%",width:"100%",fit:"contain"},null,8,["src","alt"])):ne("",!0)]),S.value?(k(),Q("div",al,[M(G,{variant:"block"})])):ne("",!0)],42,el),d("div",nl,[M(ya,nn({ref_key:"imageUploadRef",ref:E,modelValue:w.value,"onUpdate:modelValue":X[0]||(X[0]=J=>w.value=J),"remote-url":y.value,"onUpdate:remoteUrl":X[1]||(X[1]=J=>y.value=J),type:"image","max-size-mb":10},o(ln),{"transform-file":o(i),class:"upload-sfile-wrap","manual-trigger":!0,"show-status-text":!1,disabled:e.disabled,source:"mv-edit-reference-image",onRawChange:D,onProcessingChange:x,onChange:h,onSuccess:$,onError:R,onValidateError:Se}),{default:Ae(({chooseFile:J})=>[d("div",{class:Xe(["optFrame",{"is-disabled":e.disabled}]),role:"button",tabindex:e.disabled?void 0:0,"aria-label":m.$t("mv.uploadPhoto"),onClick:le(()=>e.disabled||J(),["stop"]),onKeydown:[pe(le(()=>e.disabled||J(),["stop","prevent"]),["enter"]),pe(le(()=>e.disabled||J(),["stop","prevent"]),["space"])]},[M(C,{src:"@/assets/mv/updataImg.svg",width:"24px",alt:"",role:"presentation","show-skeleton":!1})],42,sl)]),preview:Ae(({chooseFile:J})=>[d("div",{class:Xe(["optFrame",{"is-disabled":e.disabled}]),role:"button",tabindex:e.disabled?void 0:0,"aria-label":m.$t("mv.uploadPhoto"),onClick:le(()=>e.disabled||J(),["stop"]),onKeydown:[pe(le(()=>e.disabled||J(),["stop","prevent"]),["enter"]),pe(le(()=>e.disabled||J(),["stop","prevent"]),["space"])]},[M(C,{src:"@/assets/mv/updataImg.svg",width:"24px",alt:"",role:"presentation","show-skeleton":!1})],42,rl)]),_:1},16,["modelValue","remote-url","transform-file","disabled"]),M(wa,{"show-navigation-buttons":"","navigation-button-type":"none",class:"referenceList"},{default:Ae(()=>[(k(!0),Q(It,null,xt(e.images,J=>(k(),Q("div",{key:J,class:Xe(["referenceItem",{activeFrame:J===w.value,"is-disabled":e.disabled}]),role:"option",tabindex:e.disabled?void 0:0,"aria-selected":J===w.value,onClick:Me=>U(J),onKeydown:[pe(le(Me=>U(J),["prevent"]),["enter"]),pe(le(Me=>U(J),["prevent"]),["space"])]},[M(C,{src:J,width:"100%",height:"100%",alt:m.$t("mv.referencePhoto")},null,8,["src","alt"])],42,ll))),128))]),_:1})]),L.value?(k(),ve(Z,{key:0,teleported:"","url-list":[w.value],"initial-index":0,onClose:X[2]||(X[2]=J=>L.value=!1)},null,8,["url-list"])):ne("",!0),o(n)?(k(),ve(ba,{key:o(n).url,src:o(n).url,"confirm-file":o(n).confirm,onCancel:X[3]||(X[3]=J=>o(n).cancel())},null,8,["src","confirm-file"])):ne("",!0)],8,Jr)}}}),il=nt(ol,[["__scopeId","data-v-c949a743"]]),ul=["aria-label"],cl={class:"bg p-10"},dl={class:"carterTitle",role:"heading","aria-level":"2"},vl={class:"settings-cover m-t-10 p-10 bg-black/20 br-12 h-220 flex items-center justify-center"},ml={key:1,class:"settings-cover__placeholder flex-c-c flex-d-column"},fl={class:"bg p-10 prompt-area h-200px m-t-20"},gl={class:"flex justify-space-between items-center"},pl={class:"carterTitle",role:"heading","aria-level":"2"},yl={class:"br-12 overflow-hidden m-t-20"},hl={class:"f-w-700 f-s-18 c-[#c685ff] font-[Carter\\ One] p-10 bg-[rgba(148,173,255,0.2)]",role:"heading","aria-level":"2"},bl={class:"w-full p-10 bg-[rgba(148,173,255,0.1)] flex flex-d-column gap-10 items-center"},wl={key:0,class:"option-row option-row--alt w-full"},Sl={class:"option-row-label"},Il=["aria-label"],Fl=["aria-checked"],$l=["aria-checked"],kl={class:"w-full flex justify-space-between items-center"},Tl={class:"option-switch-pill"},El={class:"option-switch-state"},_l={class:"w-full flex justify-space-between items-center"},Pl={class:"option-switch-pill"},Cl={class:"option-switch-state"},Ll={class:"w-full flex justify-space-between items-center gap-8 br-12"},xl={class:"option-switch-pill"},Al={class:"option-switch-state"},Ml={class:"w-full flex justify-space-between items-center gap-8 br-12"},Ul={class:"flex items-center gap-10"},Vl={class:"option-switch-pill"},Ol={class:"option-switch-state"},Dl={key:1,class:"w-full flex justify-space-between items-center gap-8 br-12"},Nl={class:"option-switch-pill"},Gl={class:"option-switch-state"},za=0,Bl=ns({__name:"SettingsPanel",props:Ma({againMergePicPoint:{default:0},promptErrorMessage:{default:""},titleErrorMessage:{default:""},nameErrorMessage:{default:""},coverRefreshing:{type:Boolean,default:!1},capcutLocked:{type:Boolean,default:!0},quality:{default:"480"},showQualitySelector:{type:Boolean,default:!1}},{mvDetail:{required:!0},mvDetailModifiers:{},description:{required:!0},descriptionModifiers:{}}),emits:Ma(["refreshCover","setQuality"],["update:mvDetail","update:description"]),setup(e,{emit:r}){const n=e,i=Aa(e,"mvDetail"),g=Aa(e,"description"),u=r,w=rn(),{t:y}=Ft(),E=z(()=>{var $;return!!(($=i.value)!=null&&$.firstFrameImg)}),p=z(()=>{var $;return E.value?"ready":n.coverRefreshing?"generating":(($=i.value)==null?void 0:$.firstFrameImg)===void 0?"loading":"empty"}),S=z(()=>p.value==="empty"?y("VideoEditor.timeline.noCoverImage"):p.value==="loading"?y("common.loading"):y("common.generating")),L=z(()=>p.value==="loading"||p.value==="generating"),K=z(()=>
2n.coverRefreshing),O=z(()=>p.value==="loading"),W=$=>Number($)!==za?!0:Ts(),U=()=>W(i.value.isWatermark),D=()=>W(i.value.isLyric),x=$=>Number($)===za?y("mv.ON"):y("mv.OFF"),h=()=>{u("refreshCover")};return($,R)=>{const Se=Un,m=ct("Loading"),X=an,C=ss,G=rs;return k(),Q("section",{class:"settings hide-scrollbar","aria-label":$.$t("mv.options")},[d("section",cl,[d("div",dl,Y($.$t("mv.cover")),1),d("div",vl,[E.value?(k(),ve(Se,{key:0,src:i.value.firstFrameImg,"preview-src-list":i.value.firstFrameImg?[i.value.firstFrameImg]:[],class:"br-12",height:"100%",width:"auto",alt:i.value.title||$.$t("mv.cover")},null,8,["src","preview-src-list","alt"])):(k(),Q("div",ml,[L.value?(k(),ve(X,{key:0,class:"is-loading",size:"18",color:"#fff"},{default:Ae(()=>[M(m)]),_:1})):ne("",!0),d("span",{class:Xe(["settings-cover__placeholderText c-fff",{"m-t-8":L.value}])},Y(S.value),3)]))])]),d("section",fl,[d("div",gl,[d("div",pl,Y($.$t("mv.coverDescription")),1),M(Nt,{size:"smaller",loading:K.value,disabled:O.value,block:!1,credits:e.againMergePicPoint,onClick:h},{default:Ae(()=>[St(Y($.$t("create.create")),1)]),_:1},8,["loading","disabled","credits"])]),M(Bt,{modelValue:g.value,"onUpdate:modelValue":R[0]||(R[0]=Z=>g.value=Z),"error-message":e.promptErrorMessage,type:"textarea",class:"description-input m-t-10 flex-1 rounded-[12px] border-solid border-[2px] border-[rgba(255,255,255,0)] bg-[rgba(0,0,0,0.25)]","input-class":"pb-[20px]","error-class":"absolute bottom-[2px] left-[10px]",maxlength:"2000","show-word-limit":"",resize:"none","aria-label":$.$t("mv.enterCoverDescription"),placeholder:$.$t("mv.enterCoverDescription")},null,8,["modelValue","error-message","aria-label","placeholder"])]),d("section",yl,[d("div",hl,Y($.$t("mv.options")),1),d("div",bl,[e.showQualitySelector?(k(),Q("div",wl,[d("span",Sl,Y($.$t("mv.resolution")),1),d("div",{class:"seg-group",role:"radiogroup","aria-label":$.$t("mv.resolution")},[d("button",{type:"button",class:Xe(["seg-btn",{"seg-btn--active":e.quality==="480"}]),role:"radio","aria-checked":e.quality==="480",onClick:R[1]||(R[1]=Z=>u("setQuality","480"))},Y($.$t("mv.standard")),11,Fl),M(C,{content:$.$t("mv.hdUpgradeTip"),placement:"top"},{default:Ae(()=>[d("button",{type:"button",class:Xe(["seg-btn",{"seg-btn--active":e.quality==="720"}]),role:"radio","aria-checked":e.quality==="720",onClick:R[2]||(R[2]=Z=>u("setQuality","720"))},Y($.$t("mv.quality")),11,$l)]),_:1},8,["content"])],8,Il)])):ne("",!0),d("div",kl,[d("span",null,Y($.$t("mv.mvTitle")),1),d("div",Tl,[d("span",El,Y(x(i.value.isTitle)),1),M(G,{modelValue:i.value.isTitle,"onUpdate:modelValue":R[3]||(R[3]=Z=>i.value.isTitle=Z),"active-value":0,"inactive-value":1},null,8,["modelValue"])])]),M(Bt,{modelValue:i.value.title,"onUpdate:modelValue":R[4]||(R[4]=Z=>i.value.title=Z),"error-message":e.titleErrorMessage,"show-word-limit":"",placeholder:$.$t("mv.enterSongTitle"),"aria-label":$.$t("mv.enterSongTitle"),maxlength:"30",class:"w-full info-input"},null,8,["modelValue","error-message","placeholder","aria-label"]),d("div",_l,[d("span",null,Y($.$t("mv.authorName")),1),d("div",Pl,[d("span",Cl,Y(x(i.value.isName)),1),M(G,{modelValue:i.value.isName,"onUpdate:modelValue":R[5]||(R[5]=Z=>i.value.isName=Z),"active-value":0,"inactive-value":1},null,8,["modelValue"])])]),M(Bt,{modelValue:i.value.artist,"onUpdate:modelValue":R[6]||(R[6]=Z=>i.value.artist=Z),"error-message":e.nameErrorMessage,"show-word-limit":"",placeholder:$.$t("mv.enterSongName"),"aria-label":$.$t("mv.enterSongName"),maxlength:"30",class:"w-full info-input"},null,8,["modelValue","error-message","placeholder","aria-label"]),d("div",Ll,[d("div",null,Y($.$t("mv.watermark")),1),d("div",xl,[d("span",Al,Y(x(i.value.isWatermark)),1),M(G,{modelValue:i.value.isWatermark,"onUpdate:modelValue":R[7]||(R[7]=Z=>i.value.isWatermark=Z),"active-value":0,"inactive-value":1,"before-change":U},null,8,["modelValue"])])]),d("div",Ml,[d("div",Ul,Y($.$t("create.lyrics")),1),d("div",Vl,[d("span",Ol,Y(x(i.value.isLyric)),1),M(G,{modelValue:i.value.isLyric,"onUpdate:modelValue":R[8]||(R[8]=Z=>i.value.isLyric=Z),"active-value":0,"inactive-value":1,"before-change":D},null,8,["modelValue"])])]),o(w)?(k(),Q("div",Dl,[d("div",null,Y($.$t("mv.effects")),1),d("div",Nl,[d("span",Gl,Y(i.value.capcutEnabled===!0?$.$t("mv.ON"):$.$t("mv.OFF")),1),M(G,{modelValue:i.value.capcutEnabled,"onUpdate:modelValue":R[9]||(R[9]=Z=>i.value.capcutEnabled=Z),disabled:n.capcutLocked},null,8,["modelValue","disabled"])])])):ne("",!0)])])],8,ul)}}}),zl=nt(Bl,[["__scopeId","data-v-4f860b9f"]]),Rl=["aria-label"],ql={key:0,class:"sr-only",role:"status","aria-live":"polite"},jl={class:"storyHeader"},Hl={class:"carterTitle",role:"heading","aria-level":"2"},Wl={class:"flex items-center gap-12"},Kl=["aria-label","onKeydown"],Yl=["aria-label","onClick","onKeydown"],Ql={class:"clip-img-box flex-c-c flex-1 min-h-0"},Xl={class:"shot-status f-s-13 flex-c-c"},Jl={key:0,class:"loading flex-c-c flex-d-column"},Zl={class:"f-s-13 m-t-4 c-fff"},eo={key:1,class:"error c-fff"},to={key:2,class:"absolute inset-0 z-10 flex flex-c-c flex-d-column gap-4 bg-[rgba(0,0,0,0.88)] c-white text-center pointer-events-none","aria-hidden":"true"},ao={class:"f-s-12 f-w-500"},no={class:"clip-time shrink-0"},so={__name:"StoryboardList",props:{shotList:{type:Array,default:()=>[]},shotIndex:{type:Number,default:0},mvType:{type:Number,default:0},videoPlayType:{type:String,default:"cycle"},flowStatusVisible:{type:Boolean,default:!1},flowStatusText:{type:String,default:""},flowStatusLoading:{type:Boolean,default:!0}},emits:["selectShot","update:videoPlayType"],setup(e,{emit:r}){const n=e,i=r;function g(){const w=n.videoPlayType==="cycle"?"order":"cycle";i("update:videoPlayType",w)}return(u,w)=>{const y=ct("LazyImages"),E=qt;return k(),Q("section",{class:"storyboardList bg flex flex-col p-[clamp(6px,1.92cqh,15px)]","aria-label":u.$t("mv.timeline")},[e.flowStatusVisible?(k(),Q("span",ql,Y(e.flowStatusText),1)):ne("",!0),d("header",jl,[d("div",Hl,Y(u.$t("mv.timeline")),1),d("div",Wl,[d("div",{class:"flip-container cursor-pointer",role:"button",tabindex:"0","aria-label":u.$t("mv.timeline"),onClick:g,onKeydown:[pe(le(g,["prevent"]),["enter"]),pe(le(g,["prevent"]),["space"])]},[d("div",{class:Xe(["flipper",{flipped:n.videoPlayType==="order"}])},[M(y,{class:"front",src:"@/assets/mv/cycleActivation.svg",width:"24px",alt:"",role:"presentation"}),M(y,{class:"back",src:"@/assets/mv/orderActivation.svg",width:"24px",alt:"",role:"presentation"})],2)],40,Kl)])]),M(wa,{class:"clips-strip flex-1 min-h-0"},{default:Ae(()=>[(k(!0),Q(It,null,xt(e.shotList,(p,S)=>(k(),Q("div",{key:S,class:Xe(["clip-card flex flex-col",{active:e.shotIndex===S}]),role:"button",tabindex:"0","aria-label":`${u.$t("mv.timeline")} ${S+1}`,onClick:L=>u.$emit("selectShot",S),onKeydown:[pe(le(L=>u.$emit("selectShot",S),["prevent"]),["enter"]),pe(le(L=>u.$emit("selectShot",S),["prevent"]),["space"])]},[d("div",Ql,[p.status==o(te).Success&&p.klingImg&&e.mvType==1?(k(),ve(y,{key:0,src:p.klingImg,alt:`${u.$t("mv.timeline")} ${S+1}`,height:"100%",width:"auto",class:"br-12"},null,8,["src","alt"])):ne("",!0),p.status==o(te).Success&&e.mvType==0&&p.firstFrameImg?(k(),ve(y,{key:1,src:p.firstFrameImg,alt:`${u.$t("mv.timeline")} ${S+1}`,height:"100%",width:"auto",class:"br-12"},null,8,["src","alt"])):ne("",!0),d("div",Xl,[p.status==o(te).Generating||p.status==o(te).Pending?(k(),Q("div",Jl,[M(E,{variant:"button",size:16}),d("span",Zl,Y(u.$t("common.generating")),1)])):ne("",!0),p.status==o(te).Failed?(k(),Q("div",eo,Y(u.$t("common.generationFailed")),1)):ne("",!0)]),e.flowStatusVisible?(k(),Q("div",to,[e.flowStatusLoading?(k(),ve(E,{key:0,variant:"block",size:22})):ne("",!0),d("span",ao,Y(e.flowStatusText),1)])):ne("",!0)]),d("div",no,Y(p.timestamp),1)],42,Yl))),128))]),_:1})],8,Rl)}}},ro=nt(so,[["__scopeId","data-v-eddf23a3"]]),lo={class:"videoPreview bg p-[clamp(6px,1.92cqh,15px)]"},oo={class:"player-wrap relative"},io={class:"player-content"},uo={class:"f-s-0 h-full"},co=["src"],vo={class:"player-loading"},mo={key:0,class:"w-full h-full flex flex-c-c flex-d-column"},fo={class:"f-s-13 m-t-4 c-fff"},go={key:1,class:"error c-fff w-full h-full flex flex-c-c"},po={__name:"VideoPreview",props:{videoUrl:String,klingImg:String,audioUrl:String,mvType:Number,storyboard:{type:Object,default:()=>({})}},setup(e,{expose:r}){const n=b(null),i=b(null);return r({playerCompRef:n,audioRef:i}),(g,u)=>{const w=ct("LazyImages"),y=qt;return k(),Q("div",lo,[d("div",oo,[Vt(d("div",io,[Vt(d("div",uo,[M(w,{src:e.klingImg,height:"100%",alt:"thumb"},null,8,["src"])],512),[[Ot,e.mvType==1&&e.klingImg]]),Vt(M(Es,{ref_key:"playerCompRef",ref:n,"control-bar":{volumePanel:!1,pictureInPictureToggle:!1},muted:!0,loop:!1,src:e.videoUrl,poster:e.klingImg||e.storyboard.firstFrameImg||e.storyboard.coverImage||"","border-radius":"12px"},null,8,["src","poster"]),[[Ot,e.mvType==0]]),Vt(d("audio",{ref_key:"audioRef",ref:i,preload:"auto",style:{display:"none"},src:e.audioUrl},null,8,co),[[Ot,e.mvType==0]])],512),[[Ot,(e.klingImg||e.videoUrl)&&e.storyboard.status==o(te).Success]]),Vt(d("div",vo,[e.storyboard.status!=o(te).Failed?(k(),Q("div",mo,[M(y,{variant:"block",size:24}),d("span",fo,Y(e.storyboard.status!=null?g.$t("common.generating"):g.$t("common.loading")),1)])):ne("",!0),e.storyboard.status==o(te).Failed?(k(),Q("div",go,Y(g.$t("common.generationFailed")),1)):ne("",!0)],512),[[Ot,!((e.klingImg||e.videoUrl)&&e.storyboard.status==o(te).Success)]])])])}}},yo=nt(po,[["__scopeId","data-v-56280f15"]]);function ho(e){if(typeof e!="string")return null;const r=e.trim().match(/^(\d+):(\d{1,2})[.:](\d+)$/);if(!r)return null;const n=Number(r[1]),i=Number(r[2]),g=r[3]||"",u=Number(g)/10**g.length;return!Number.isFinite(n)||i>=60||!Number.isFinite(u)?0:n*60+i+u}const bo=new Set([13,14]),wo=new Set(["composing","final_video"]);function So(e){const r=e==null?void 0:e.data,n=r&&typeof r=="object"&&!Array.isArray(r)?r.steps:r;return Array.isArray(n)?n.filter(i=>!!(i&&typeof i=="object"&&!Array.isArray(i))):[]}function Ra(e){const r=[`${e.status??""}`.trim().toLowerCase()];
2return(Array.isArray(e.cards)?e.cards:[]).forEach(i=>{if(!i||typeof i!="object"||Array.isArray(i))return;const g=i;r.push(`${g.status??""}`.trim().toLowerCase()),(Array.isArray(g.items)?g.items:[]).forEach(w=>{!w||typeof w!="object"||Array.isArray(w)||r.push(`${w.status??""}`.trim().toLowerCase())})}),r.filter(Boolean)}function Io(e){return e.isFinalStep===!0||wo.has(`${e.type??""}`.trim().toLowerCase())}function Fo(e,r){const n=So(e),i=n[n.length-1],g=`${(i==null?void 0:i.title)??(i==null?void 0:i.displayTitle)??""}`.trim();if(r){const w=n.filter(Io),y=n.map(Ra),E=!!(n.length&&w.length&&y.every(L=>L.length>0&&L.every(K=>K===na.Success))),p=w.some(L=>Ra(L).includes(na.Failed)),S=y.some(L=>L.includes(na.Failed));return{stageTitle:g,hasReachedSynthesis:w.length>0,allFlowSucceeded:E,hasFlowFailure:S,synthesisFailed:p}}const u=n.filter(w=>bo.has(Number(w.status)));return{stageTitle:g,hasReachedSynthesis:u.length>0,allFlowSucceeded:!!(n.length&&u.length&&n.every(w=>w.isSuccess===!0)),hasFlowFailure:n.some(w=>w.isSuccess===!1),synthesisFailed:u.some(w=>w.isSuccess===!1)}}const qa=()=>{if(typeof window>"u")return;const e=window;return window.AudioContext||e.webkitAudioContext};function ja(e,r,n={}){const i=typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1),g=n.threshold??(i?.2:.15),u=n.syncInterval??(i?180:120),w=n.bufferMargin??.5,y=i?.012:.018,E=i?.012:.02,p=i?700:500,S=450,L=i?.65:.5,K=i?700:500,O=i?.25:.18,W=.08,U=i?220:180,D=.02,x=1500;let h=0,$=!1,R=!1,Se=null,m=0,X=0;const C=5e3;let G=null,Z=!1,J=!1,Me=typeof n.onSegmentEnd=="function"?n.onSegmentEnd:()=>{},st=0,qe=!1,Ie=!1,re=0,Ce=0,Ue=null,Le=null,ge=0,je=!1,Fe=!1,He=n.loopMode!==!1,Ne=!1,$e=null,me=null,Ve=0,fe=0,Be=0,Ge=!1,Oe=null,c=!1,t=null,s=null;const I=(...f)=>{try{n&&n.debug&&[...f]}catch{}},B=()=>{Le&&(clearTimeout(Le),Le=null)},ae=()=>{const f=e==null?void 0:e.value,P=r==null?void 0:r.value;if(!P)return;const N=(f==null?void 0:f.playbackRate)||1;try{Math.abs((P.playbackRate||1)-N)>.001&&(P.playbackRate=N)}catch(q){I("æ¢å¤é³é¢éç失败:",q)}},H=(f,P)=>{if(P-Be<p)return;const N=e==null?void 0:e.value,q=r==null?void 0:r.value;if(!N||!q)return;const se=N.playbackRate||1,ce=-f*y,v=se-E,T=se+E,be=Math.max(v,Math.min(T,se+ce));try{Math.abs((q.playbackRate||1)-be)>.003&&(q.playbackRate=be),Be=P,G&&clearTimeout(G),G=setTimeout(()=>{ae(),G=null},S)}catch(oe){I("é³é¢éçä¿®æ£å¤±è´¥:",oe)}},A=async()=>{if(!i||c)return!1;c=!0,I("å°è¯è§£éiOSé³é¢");const f=r==null?void 0:r.value,P=e==null?void 0:e.value;try{const N=qa();N&&(t=t||new N,t.state==="suspended"&&await t.resume());const q=async ce=>{if(!ce)return!1;try{const v=ce.muted;return ce.muted=!0,ce.playbackRate=1,await ce.play().catch(()=>{}),await new Promise(T=>setTimeout(T,100)),ce.pause(),ce.muted=v,!0}catch{return!1}},se=await q(f)||await q(P);return se&&(R=!0,I("iOSé³é¢è§£éæå")),se}catch(N){return I("iOSé³é¢è§£é失败:",N),!1}},j=async(f=300)=>{try{const P=qa();if(!P||(t=t||new P,t.state!=="suspended"))return;await Promise.race([t.resume(),new Promise(N=>setTimeout(N,f))])}catch(P){I("AudioContextåå§å失败:",P)}},we=()=>{if(s||typeof window>"u")return;const f=()=>{window.removeEventListener("pointerdown",P,!0),window.removeEventListener("keydown",P,!0),window.removeEventListener("touchend",P,!0),s=null};function P(){f(),(async()=>{if(await j(),Fe)return;const N=e==null?void 0:e.value,q=r==null?void 0:r.value;N&&q&&$&&!N.paused&&!N.ended&&q.paused&&(I("ç¨æ·æå¿å°è¾¾ï¼è¡¥åé³é¢æ¢å¤"),Qe())})()}window.addEventListener("pointerdown",P,!0),window.addEventListener("keydown",P,!0),window.addEventListener("touchend",P,!0),s=f},Ke=(f,P=3e3)=>{const N=r==null?void 0:r.value;if(!N)return Promise.resolve(!1);const q=()=>{if(!N.buffered||N.buffered.length===0)return!1;for(let se=0;se<N.buffered.length;se++)if(N.buffered.start(se)<=f&&N.buffered.end(se)>=f+.5)return!0;return!1};return q()?Promise.resolve(!0):new Promise(se=>{let ce=!1;const v=oe=>{ce||(ce=!0,N.removeEventListener("progress",T),N.removeEventListener("canplaythrough",be),se(oe))},T=()=>{q()&&v(!0)},be=()=>v(!0);N.addEventListener("progress",T),N.addEventListener("canplaythrough",be,{once:!0}),setTimeout(()=>v(!1),P)})};let ye=!1;const ke=async f=>{if(!f||ye)return!1;if(Oe)return Oe;Oe=(async()=>{try{return await j(),ae(),f.volume=1,await Promise.race([f.play().then(()=>"ok"),new Promise(N=>setTimeout(()=>N("timeout"),2e3))])==="timeout"&&f.paused?(I("é³é¢ play() è¶
æ¶ä¸ä»å¤äºæåï¼å¤å®ä¸ºå¤±è´¥"),!1):(i&&!ge&&(ge=Date.now()),!0)}catch(P){return I("é³é¢ææ¾å¤±è´¥:",P),ye=!0,setTimeout(()=>{ye=!1},100),we(),!1}})();try{return await Oe}finally{Oe=null}},ze=()=>{Ue&&(clearTimeout(Ue),Ue=null)},dt=5,Qe=(f=0)=>{if(f>=dt){I("é³é¢æ¢å¤éè¯å·²è¾¾ä¸éï¼çå¾
ç¨æ·æå¿"),we();return}
2ze(),Ue=setTimeout(async()=>{if(Fe)return;const P=e==null?void 0:e.value,N=r==null?void 0:r.value;if(!(!P||!N))if(!P.paused&&!P.ended&&!J&&N.paused&&$&&P.readyState>=3){I("é³é¢æ¢å¤å®æ¶å¨è§¦åï¼éæ°å¯¹é½å¹¶ææ¾é³é¢ï¼ç¬¬ %s 次",f+1),We(m+(P.currentTime||0),{force:!0});const q=await ke(N);if(Fe||!$)return;if(!q){Qe(f+1);return}Ye()}else $&&!P.paused&&!P.ended&&N.paused&&Qe(f+1)},300)},Ye=()=>{Je();const f=P=>{var he,ut;if(Fe)return;const N=Date.now();if(N-st<u){h=requestAnimationFrame(f);return}st=N;const q=e==null?void 0:e.value,se=r==null?void 0:r.value;if(!q||!se||!$){h=requestAnimationFrame(f);return}!q.paused&&!q.ended&&se.paused&&!J&&q.readyState>=3&&(I("åæ¥å¾ªç¯æ£æµå°é³é¢æå¤æåï¼å°è¯æ¢å¤"),We(m+(q.currentTime||0),{force:!0}),ke(se));const ce=q.currentTime||0,v=m+ce;if(Ge&&v+.1<X&&(Ge=!1),v+D>=X){if(He){Ge||(Ge=!0,We(m,{force:!0})),h=requestAnimationFrame(f);return}q.pause(),se.pause(),Je(),$=!1,Z=!1,qe||(qe=!0,Me());return}const T=((he=q.buffered)==null?void 0:he.length)>0?q.buffered.end(q.buffered.length-1):0,be=((ut=se.buffered)==null?void 0:ut.length)>0?se.buffered.end(se.buffered.length-1):0,oe=Math.min(w,(X-m)*.3);if(ce+oe>T||v+oe>be){h=requestAnimationFrame(f);return}const De=(se.currentTime||0)-v,ue=i&&ge&&N-ge<x;if(Math.abs(De)>g)try{Math.abs(De)>L?We(v):ue||H(De,N)}catch(tt){I("忥é误:",tt)}else!G&&!ue&&ae();h=requestAnimationFrame(f)};h=requestAnimationFrame(f)},Je=()=>{h&&(cancelAnimationFrame(h),h=0),G&&(clearTimeout(G),G=null),ae()},We=(f,P={})=>{const N=Math.max(0,Number(f)||0),q=r==null?void 0:r.value;if(q&&R&&isFinite(q.duration))try{const se=Math.max(0,q.duration-.05),ce=Math.min(N,se),v=Date.now(),T=Math.abs((q.currentTime||0)-ce),be=v-Ve<K&&Math.abs(fe-ce)<W;if(!P.force&&(T<O||be||q.seeking))return;q.currentTime=ce,Ve=v,fe=ce}catch{}else Se=N},it=()=>{R=!0,I("é³é¢å
æ°æ®å è½½å®æ"),Se!==null&&(We(Se,{force:!0}),Se=null)},rt=async()=>{const f=e==null?void 0:e.value,P=r==null?void 0:r.value;if(!f||!P)return;if(Ie&&Date.now()-Ce<C){B();return}Ie=!0,Ce=Date.now();const N=++re,q=()=>Fe||re!==N;try{if(q()||(B(),J=!1,ze(),Z=!0,$=!0,i&&(await A(),q()))||q()||J||f.paused||f.ended)return;const se=m+(f.currentTime||0);if(We(se,{force:!0}),q()||J||f.paused||f.ended)return;if(i&&!je){if(I("iOSçå¾
é³é¢ç¼å²å°±ç»ª..."),await Ke(se,2e3),je=!0,q()||J||f.paused||f.ended)return;We(m+(f.currentTime||0),{force:!0})}const ce=await ke(P);if(q())return;if(!ce)Qe();else{if(J||f.paused||f.ended){P.pause();return}Ye()}}finally{const se=re===N;se&&(Ie=!1);const ce=e==null?void 0:e.value,v=r==null?void 0:r.value;se&&!Fe&&ce&&v&&!ce.paused&&!ce.ended&&!J&&$&&v.paused&&ce.readyState>=3&&Qe()}},vt=()=>{B(),Le=setTimeout(()=>{if(Le=null,Fe)return;const f=e==null?void 0:e.value;if(!f||f.paused||f.ended||f.readyState>=3)return;J=!0,Z=!1,Je(),ze();const P=r==null?void 0:r.value;if(P)try{P.pause()}catch{}Qe()},U)},Ze=()=>{const f=e==null?void 0:e.value;if(f&&f.ended)return;Z=!1,$=!1,B(),ze(),Je();const P=r==null?void 0:r.value;P&&P.pause()},et=()=>{const f=e==null?void 0:e.value;if(!f||!f.ended||!Z)return;Z=!1,$=!1,B(),ze(),Je();const P=r==null?void 0:r.value;P&&P.pause(),qe||(qe=!0,Me())},mt=()=>{const f=e==null?void 0:e.value;f&&We(m+(f.currentTime||0),{force:!0})},ft=()=>{$e&&($e.removeEventListener("playing",rt),$e.removeEventListener("pause",Ze),$e.removeEventListener("ended",et),$e.removeEventListener("seeked",mt),$e.removeEventListener("waiting",vt)),me&&me.removeEventListener("loadedmetadata",it),$e=null,me=null,Ne=!1},$t=()=>{const f=e==null?void 0:e.value,P=r==null?void 0:r.value;if(!(!f||!P)){if(Ne){if($e===f&&me===P)return;ft()}f.addEventListener("playing",rt),f.addEventListener("pause",Ze),f.addEventListener("ended",et),f.addEventListener("seeked",mt),f.addEventListener("waiting",vt),P.addEventListener("loadedmetadata",it),$e=f,me=P,Ne=!0,i&&(f.setAttribute("playsinline","true"),f.setAttribute("webkit-playsinline","true"),f.playsInline=!0)}};return{start:async(f=0,P=1)=>{Fe=!1,B(),ze(),Je(),m=Math.max(0,Number(f)||0),X=m+Math.max(1,Number(P)||1),qe=!1,J=!1,ge=0,je=!1,Ge=!1,st=0,Ve=0,Be=0,i&&await j();const N=r==null?void 0:r.value;return N&&(N.readyState>=1&&(R=!0),N.preload="auto",We(m,{force:!0}),i&&(N.readyState<2&&N.load(),We(m,{force:!0}))),$t(),setTimeout(()=>{if(Fe)return;const q=e==null?void 0:e.value,se=r==null?void 0:r.value;if(q&&se&&!q.paused&&!q.ended&&q.readyState>=3&&!J&&se.paused){$=!0,Z=!0;const ce=m+(q.currentTime||0);We(ce,{force:!0}),ke(se).then(v=>{Fe||!$||(v?Ye():Qe())})}},50),!0},pause:()=>{Ze()},resume:async()=>{const f=e==null?void 0:e.value,P=r==null?void 0:r.value;return!f||!P||!Z?!1:(await ke(P),$=!0,Ye(),!0)},stop:()=>{Fe=!0,Je(),ze(),B(),s==null||s(),J=!1,ge=0,Ge=!1;const f=r==null?void 0:r.value;f&&(f.pause(),f.currentTime=m),$=!1,Z=!1},seekToVideoTime:f=>We(m+f,{force:!0}),attachListeners:$t,detachListeners:()=>{Fe=!0,Je(),ze(),B(),s==null||s(),ft()},setOnSegmentEnd(f){Me=f},setLoopMode(f){He=!!f}}}function $o(e){return e.isFlow&&e.hasRetriedInEditor&&!e.hasShownAllSuccess&&e.regeneShotlistLength===0&&e.shotListLength>0&&e.allShotsSuccess}function ko(e){return(e.previousStatus===te.Generating||e.previousStatus===te.Pending)&&e.nextStatus===te.Success}function ua(e,r){return(r?e==null?void 0:e.scene:e==null?void 0:e.description)||""}function ca(e){return(e==null?void 0:e.shotType)==1?1:0}function vn(e,r){return(e==null?void 0:e.id)===void 0||e.id===null?!1:(e.status===te.Pending||e.status===te.Generating)&&r.some(i=>i==e.id)}const mn=-1;function To(e){if(typeof e=="string"){const n=e.toLowerCase();if(n.includes("success"))return zt.Success;if(n.includes("generat"))return zt.Generating;if(n.includes("fail"))return mn}const r=Number(e);return Number.isFinite(r)?r:null}function da(e){return`${(e==null?void 0:e.firstFrameImg)||""}`.trim()}function Ha(e){if(!e)return null;if(Object.prototype.hasOwnProperty.call(e,"againCoverImgStatus")){const r=e.againCoverImgStatus;return r==null?da(e)?zt.Success:mn:To(r)}return null}const fn=e=>e===zt.Generating,va=e=>e===zt.Success,Eo=e=>e!==null&&!fn(e)&&!va(e);function _o(e,r,n={}){const i=n.videoPlayType??b("cycle"),g=n.flowCompletionEnabled??b(!0),u=Qa(),w=Wa(),{t:y}=Ft(),E=b(""),p=b(null),S=b(null),L=b(null),K=b(null);let O=null,W=null;const U=b({}),D=b(""),x=b({description:"",prompt:"",title:"",name:""}),h=b([]),$=new Map,R=new Map,Se=b(-1),m=b(null),X=b(!0),C=b({}
2),G=b([]),Z=b(!1),J=b(!1),Me=b(null),st=z(()=>!!Me.value),qe=b(!1),Ie=b(!1),re=b(!1),Ce=b(!1),Ue=b(""),Le=b("polling"),ge=b(null);let je=0,Fe=!1,He=!1,Ne=null,$e=!1;const me=b(!1),Ve=Wt,fe=b(0),Be=b(""),Ge=b(!1),Oe=b(!1),c=b(null),t=b({});let s=!1,I=null,B=0;const ae=z(()=>!!h.value.length&&h.value.every(a=>a.status==te.Success)),H=b(""),A=b(0),j=b(!1),we=b(!1),Ke=b(!0),ye=rn(),ke=b(null),ze=()=>{const a=e.value;return a??null},dt=()=>Yt(C.value),Qe=a=>{x.value[a]&&(x.value[a]="")},Ye=a=>Ve.normalizePoint(a),Je=a=>{const l=Number(a);return l===0||l===1?l:null},We=a=>{for(const l of a){const F=Je(l.mvType);if(F!==null)return F}return null},it=()=>{const a=h.value.filter(l=>l.status===te.Pending||l.status===te.Generating);return a.length?a.some(l=>!!`${l.klingImg||""}`.trim()||!!`${l.videoUrl||""}`.trim()):h.value.some(l=>!!`${l.videoUrl||""}`.trim())},rt=()=>{var a;return!!(u.flow&&(yt(C.value)||He||(a=C.value)!=null&&a.taskPhase||it()))},vt=a=>rt()?!0:a===0||a===null&&fe.value===0,Ze=a=>{if(rt()){fe.value=0;return}fe.value=a},et=a=>{if(!u.flow||fe.value!==1||!h.value.length)return!1;let l=!1;const F=h.value.every(_=>_.id==a?(l=!0,!0):_.status==te.Success);return l&&F},mt=(a=!1)=>{!u.flow||!Z.value&&!a||qe.value||Me.value||(Me.value=Xa().open({text:y("mv.flowImageRegeneratedNextStepTip"),background:"rgba(0, 0, 0, 0.72)"}))},ft=()=>{var a;(a=Me.value)==null||a.close(),Me.value=null},$t=a=>{if(!u.flow||!h.value.length)return!1;const l=vt(a),F=!l&&(a===1||a===null&&fe.value===1),_=h.value.every(ie=>ie.status==te.Success),V=h.value.every(ie=>ie.status===te.Pending||ie.status===te.Generating),ee=h.value.some(ie=>ie.status===te.Pending||ie.status===te.Generating);return l&&ee&&(Ie.value=!0),!yt(C.value)&&!Fe&&F&&_?(re.value=!1,mt(!0),!0):re.value?!(F&&_)&&!(l&&V)?(ee||(re.value=!1),!1):(re.value=!1,mt(),!1):!1},kt=a=>{var V;!Me.value||!h.value.length||!vt(a)||!(yt(C.value)||(V=C.value)!=null&&V.taskPhase||a===0||Ie.value||h.value.some(ee=>!!`${ee.videoUrl||""}`.trim()))||!h.value.every(ee=>ee.status!==te.Pending&&ee.status!==te.Generating)||(ft(),qe.value=!0)},ht=()=>!!(u.flow&&g.value&&fe.value===0&&h.value.length&&h.value.every(a=>a.status===te.Success&&!!`${a.videoUrl||""}`.trim())),At=()=>!!(u.flow&&fe.value===0&&(rt()||We(h.value)===0)&&!Ce.value&&h.value.length&&h.value.every(a=>a.status===te.Success)&&h.value.some(a=>!`${a.videoUrl||""}`.trim())),pt=async(a=!1)=>{var F;if(yt(C.value)||He)return!0;if(Ne)return Ne;if(Fe&&!a)return!1;const l=ze();return l===null?!1:(Fe=!0,Ne=Wn({id:l,continueModel:1,userNeedPoint:Ye((F=C.value)==null?void 0:F.continueFullMvNeedPoint)}).then(()=>(He=!0,!0)).catch(_=>(Dt(_)||console.error(_),!1)).finally(()=>{Ne=null}),Ne)},Mt=()=>{var a;!ht()||Ce.value||(Ce.value=!0,Le.value="polling",Ue.value=y("mv.synthesisGenerating"),(a=m.value)==null||a.call(m),ge.value=Pn,ta.checkIsPolling()||ta.start())},f=(a,l)=>!$e&&a===je&&`${ze()??""}`==`${l}`&&Ce.value,P=async()=>{var wt,_a;if(!Ce.value)return;const a=ze();if(a===null)return;const l=++je,F=yt(C.value),_=F?await On(a,{silentError:!0}):await Dn(a,{silentError:!0});if(!f(l,a))return;const V=Fo(_,F);if(!F){if(V.hasReachedSynthesis)He=!0;else if(await pt(),!f(l,a))return}const ee=await La(a,{silentError:!0});if(!f(l,a))return;const Pe=ee!=null&&ee.data&&typeof ee.data=="object"?ee.data:{},ie=Number(Pe.status),gt=`${Pe.resultUrl||""}`.trim(),xe=ie===xa.Success&&!!gt;if(ie===xa.SynthesisFailed||V.synthesisFailed&&!xe){Le.value="failed",Ue.value=y("mv.synthesisFailed"),(wt=ge.value)==null||wt.call(ge);return}if(V.allFlowSucceeded&&xe){const Ln=C.value.capcutEnabled;C.value={...C.value,...Pe,capcutEnabled:Ln},Ce.value=!1,Ue.value="",(_a=ge.value)==null||_a.call(ge),u.setIsFlow(!1),u.setMessagePosition("edit");return}Le.value="polling",Ue.value=V.hasReachedSynthesis&&!V.hasFlowFailure&&V.stageTitle||y("mv.synthesisGenerating")},N=a=>{var l;return Ve.calcGachaVideoGeneratePoint(a,(l=C.value)==null?void 0:l.quality)},q=()=>Ye(Ve.gachaImagePoint),se=z(()=>{var F,_;if(u.flow){const V=Va(U.value);if(V!==null)return V}const a=Number(((F=U.value)==null?void 0:F.duration)??0);if(ms(C.value)){const V=fe.value?Ye(Ve.mvSeedanceGachaImagePoint):Ve.calcMvSeedanceGachaVideoGeneratePoint(a,(_=C.value)==null?void 0:_.quality);return Number.isNaN(V)?0:Math.floor(V)}const l=fe.value?q():N(qn(U.value));return Number.isNaN(l)?0:Math.floor(l)}),ce=z(()=>u.flow&&Va(U.value)===0),v=z(()=>Ye(Ve.coverRegeneratePoint)),T=z(()=>
2Ye(Ve.mvMergePoint)),be=b("480"),oe=a=>{be.value=a==="720"?"720":"480"},De=z(()=>{var a;return be.value==="720"&&!ra((a=C.value)==null?void 0:a.quality)}),ue=z(()=>{var a,l;return Number((a=C.value)==null?void 0:a.genMode)===2&&!ra((l=C.value)==null?void 0:l.quality)}),he=z(()=>De.value?Cs(C.value):T.value),ut=async()=>{var V;const a=ze();if(a===null)return;const l=await La(a);C.value=l.data||{},be.value=ra(C.value.quality)?"720":"480",Ke.value=Is(C.value.capcutEnabled),C.value.capcutEnabled=C.value.capcutEnabled===!0,H.value=l.data.coverPrompt;const F=await Pa(a),_=Ha(F.data);if(fn(_))C.value.firstFrameImg="",we.value=!0,Ea();else if(va(_)){const ee=da(F.data);ee&&(C.value.firstFrameImg=ee)}Ze((V=l.data)!=null&&V.taskPhase?0:1)},tt=a=>a==null?"":`${a}`,lt=a=>{const l=tt(a);return l?R.get(l):void 0},bt=(a,l)=>{const F=tt(a);if(!F)return;const _={...R.get(F)??{},...l};if(Object.keys(_).forEach(V=>{_[V]===void 0&&delete _[V]}),Object.keys(_).length){R.set(F,_);return}R.delete(F)},_e=a=>{const l=tt(a);l&&R.delete(l)},Qt=a=>{var F;const l=(F=lt(a==null?void 0:a.id))==null?void 0:F.description;return l===void 0?ua(a,fe.value):l},gn=a=>{var F;const l=(F=lt(a==null?void 0:a.id))==null?void 0:F.videoType;return l===void 0?ca(a):l},Xt=b(""),Jt=b(0),Ia=a=>{if(!u.flow||a!==1||fe.value!==0)return;h.value.forEach(F=>bt(F.id,{description:void 0}));const l=h.value.find(F=>F.id==U.value.id);l&&(D.value=ua(l,0),Xt.value=D.value,A.value=ca(l),Jt.value=A.value)},pn=a=>{var ee;const l=(ee=U.value)==null?void 0:ee.id,F=tt(l);if(!F||tt(a)===F)return;const _=h.value.find(Pe=>Pe.id==l)??U.value,V={};D.value!==Xt.value&&(V.description=D.value===ua(_,fe.value)?void 0:D.value),A.value!==Jt.value&&(V.videoType=A.value===ca(_)?void 0:A.value),Object.keys(V).length&&bt(l,V)},yn=a=>{var l;return(l=lt(a))==null?void 0:l.firstFrameId},hn=(a,l)=>{bt(a,{firstFrameId:l})},Ut=(a,l=null)=>{l!==null&&typeof l=="number"&&(Se.value=l),pn(a==null?void 0:a.id),U.value=a,A.value=gn(a),D.value=Qt(a),Xt.value=D.value,Jt.value=A.value,E.value=(a==null?void 0:a.status)==te.Success&&(a==null?void 0:a.videoUrl)||"",Be.value=(a==null?void 0:a.status)==te.Success&&(a==null?void 0:a.klingImg)||"";const F=++B;if(fe.value!=0||(a==null?void 0:a.status)!=te.Success||!p.value||!S.value){s&&(I&&(clearTimeout(I),I=null),s=!1);return}Ct(async()=>{if(F===B)try{const V=ho(a.timestamp)??jn(a.timestamp||"0"),ee=(ie=2e3)=>new Promise(gt=>{if(p.value&&S.value)return gt(!0);const xe=50;let Re=0;const wt=Hn(()=>{p.value&&S.value?(clearInterval(wt),gt(!0)):(Re+=xe)>=ie&&(clearInterval(wt),gt(!1))},xe)}),Pe=p.value&&S.value?!0:await ee();if(F!==B)return;Pe?Ta(V,F):(ot(),s&&(I&&(clearTimeout(I),I=null),s=!1))}catch(_){console.error("playback error",_),s&&(I&&(clearTimeout(I),I=null),s=!1)}})},bn=a=>{if(a!=null)return $.get(`${a}`)},wn=a=>{$.clear(),a.forEach(l=>{l.id===void 0||l.id===null||typeof l.status=="number"&&$.set(`${l.id}`,l.status)})},Zt=async()=>{var a;try{const l=ze();if(l===null)return;const _=ds(u.flow,C.value)?await Ca(l,{calculateRetryPoints:!0}):await Ca(l);h.value=_.data||[];const V=bn(U.value.id);wn(h.value);const ee=We(h.value);if(u.flow&&ee!==null){const xe=fe.value;Ze(ee),Ia(xe)}G.value=[],h.value.forEach(xe=>{(xe.status==te.Generating||xe.status==te.Pending)&&xe.id!==void 0&&G.value.push(xe.id)});const Pe=U.value.id,ie=h.value.find(xe=>xe.id==Pe);if(ie&&(ko({previousStatus:V,nextStatus:ie.status})?(_e(ie.id),Ut(ie)):ie.status===te.Generating||ie.status===te.Pending?(U.value={...U.value,status:ie.status,videoUrl:ie.videoUrl,klingImg:ie.klingImg},E.value="",Be.value=""):U.value=ie,ie.status==te.Failed&&w.getUserInfo()),$o({isFlow:u.flow,hasRetriedInEditor:Z.value,hasShownAllSuccess:J.value,regeneShotlistLength:G.value.length,shotListLength:h.value.length,allShotsSuccess:h.value.every(xe=>xe.status==te.Success)})&&(u.flow&&fe.value==1||(J.value=!0,Te.success(y("mv.allShotsGeneratedSuccessfully")))),$t(ee))if(await pt()){const xe=fe.value;Ze(0),Ia(xe),aa()}else ft();kt(ee),Mt(),!G.value.length&&!re.value&&!Me.value&&!At()&&((a=m.value)==null||a.call(m))}catch(l){if(l&&typeof l=="object"&&"code"in l&&l.code==="ECONNABORTED")throw l;console.error("getShotList error",l)}},Sn=async(a={})=>{var Pe,ie,gt,xe;if(Ce.value)return;const l=Array.isArray(a.referenceImgsOverride)?a.referenceImgsOverride.map(Re=>`${Re??""}
2`.trim()).filter(Boolean):null,F=a.coverImgOverride!==void 0||l!==null,_=U.value.id;if(_===void 0)return;if(vn(U.value,G.value)){Te.warning("generating");return}if(Qe("description"),!await Kt(se.value))return;const V=await sa([{text:`${D.value||""}`.trim(),field:"description"}]);if(!V.passed){x.value.description=V.fieldMessageMap.description||V.firstViolationMessage;return}const ee=et(_);G.value=G.value.filter(Re=>Re!=_),G.value.push(_);try{ot();const Re={id:_,description:D.value,coverImg:F?l?l[0]||void 0:a.coverImgOverride||void 0:(Pe=t.value)==null?void 0:Pe.firstFrameImg,...l!=null&&l.length?{referenceUrls:l}:{},lipSync:!!A.value,...dt()||F?{}:{imgHistoryId:t.value.id},userNeedPoint:se.value,isFlow:0,...dt()&&`${((ie=U.value)==null?void 0:ie.shortDesc)??""}`.trim()?{shortDesc:`${((gt=U.value)==null?void 0:gt.shortDesc)??""}`}:{}};u.flow?(Re.isUpdt=0,Re.regenImage=0,Re.isFlow=1,Re.mvType=fe.value,Re.genMode=C.value.genMode,yt(C.value)?await zn(Re):await Rn(Re)):await vs(dt(),Re),fe.value==0?Tt(Et.retryFragmentVideo):Tt(Et.retryFragmentImage),ot(),w.getUserInfo(),Z.value=!0,re.value=ee,K.value={videoUrl:E.value,storyboard:U.value},E.value="",U.value.status=te.Generating,(xe=m.value)==null||xe.call(m),aa(!0)}catch(Re){Dt(Re)||console.error(Re),G.value=G.value.filter(wt=>wt!=_)}},In=async()=>{Ka({message:y("mv.taskStartedNoRefund"),confirmText:y("mv.confirm"),cancelText:y("mv.cancel"),confirm:async a=>{var V,ee,Pe;a==null||a();const l=U.value.id;if(l===void 0)return;G.value=G.value.filter(ie=>ie!=l);const F=await Bn({shotId:l,genMode:2});Tt(Et.cancelFragmentGeneration),U.value.status=F.data,E.value=F.data==te.Success&&((V=K.value)==null?void 0:V.videoUrl)||"";const _=h.value.findIndex(ie=>ie.id===l);if(_!==-1){const ie=h.value[_];ie&&(ie.status=F.data)}if(fe.value==0&&U.value.status==te.Success)await Ct(),Ut(U.value);else{ot();try{(ee=S.value)==null||ee.pause()}catch{}}(Pe=m.value)==null||Pe.call(m)}})},Fn=async()=>{var l;const a=ze();if(a!==null)try{if(!Ce.value&&!yt(C.value)&&!await pt(!0))return;Ce.value=!1,je+=1,(l=ge.value)==null||l.call(ge),r.push(`/mv-information-flow/${a}`)}catch(F){if(Dt(F))return;console.error(F)}},$n=()=>{var _,V;if(!h.value.length||!u.flow)return 0;const a=(V=(_=r.currentRoute.value)==null?void 0:_.query)==null?void 0:V.shotId,l=Array.isArray(a)?a[0]:a;if(l!=null&&`${l}`!=""){const ee=h.value.findIndex(Pe=>`${Pe.id}`==`${l}`);if(ee>=0)return ee}const F=Number(u.shotIndex);return Number.isInteger(F)&&F>=0&&F<h.value.length?F:0},Fa=a=>{var F,_;if(a=a===-1?0:a,a===Se.value)return;I&&(clearTimeout(I),I=null),s=!1,ot();try{(F=S.value)==null||F.pause()}catch{}try{(_=p.value)==null||_.pause()}catch{}const l=h.value[a]||{};Ut(l,a)},ot=()=>{if(c.value&&p.value){try{p.value.removeEventListener("playing",c.value)}catch{}c.value=null}if(L.value){try{L.value.stop()}catch{}try{L.value.detachListeners()}catch{}}Ge.value=!1,Oe.value=!1},$a=()=>{var _,V,ee;if(Ge.value||s)return;if(Oe.value=!1,i.value!=="order"||h.value.length===0){Ut(U.value,Se.value);return}const a=h.value.length;let l=-1;for(let Pe=1;Pe<=a;Pe++){const ie=(Se.value+Pe)%a;if(((_=h.value[ie])==null?void 0:_.status)===te.Success){l=ie;break}}if(l===-1){ot();return}s=!0,I&&clearTimeout(I),I=setTimeout(()=>{s=!1,I=null},5e3),ot();try{(V=S.value)==null||V.pause()}catch{}try{(ee=p.value)==null||ee.pause()}catch{}const F=h.value[l];if(!F){ot();return}Ut(F,l)},ka=()=>{p.value&&(p.value.loop=i.value!=="order")};Ee(i,()=>{var a;ka(),(a=L.value)==null||a.setLoopMode(i.value!=="order")});const Ta=async(a=0,l=B)=>{var F;try{if(((F=U.value)==null?void 0:F.status)!=te.Success)return;if(ot(),Ge.value=!1,L.value){try{L.value.detachListeners()}catch{}L.value=null}if(!p.value||!S.value){console.warn("Cannot initialize mediaSync: video or audio ref not ready");return}const _=p.value;ka(),L.value=ja(p,S,{onSegmentEnd:$a,loopMode:i.value!=="order"});try{O&&O(),W&&W(),p.value&&(O=Oa(p.value,{group:"storyboard"})),S.value&&(W=Oa(S.value,{group:"storyboard"}))}catch{}const V=L.value;if(await V.start(a,Number(U.value.duration??0)),l!==B||V!==L.value||_!==p.value){V.stop(),V.detachListeners();return}try{await _.play()}catch{return}if(l!==B||V!==L.value)return;Oe.value=!0}catch(_){console.error("startPlaybackLoop error",_)}finally{I&&(clearTimeout(I),I=null),s=!1}},kn=async()=>
2{if(we.value)return;if(!H.value){Te.warning(y("mv.pleaseEnterCoverDescription"));return}if(Qe("prompt"),!await Kt(Ye(Ve.coverRegeneratePoint)))return;const a=C.value.firstFrameImg;we.value=!0,C.value.firstFrameImg="";let l=!0;try{const F=await sa([{text:`${H.value||""}`.trim(),field:"prompt"}]);if(!F.passed){x.value.prompt=F.fieldMessageMap.prompt||F.firstViolationMessage;return}await Nn({taskId:e.value,image_prompt:H.value}),Tt(Et.flowEditImg,{createMode:"premium"}),j.value=!0,w.getUserInfo(),l=!1,Ea()}catch(F){if(Dt(F))return;console.error("refreshCover error",F)}finally{l&&(C.value.firstFrameImg=a,we.value=!1)}},Tn=async()=>{var l,F;const a=ze();if(a!==null)try{const _=await Pa(a),V=Ha(_.data);if(va(V)){Tt(Et.coverRetry);const ee=da(_.data);C.value.firstFrameImg=ee,ee||(j.value=!1),we.value=!1,Vn.emit("update-mv-item-firstFrameImg",{id:a,firstFrameImg:ee}),(l=ke.value)==null||l.call(ke)}else Eo(V)&&(j.value=!1,we.value=!1,(F=ke.value)==null||F.call(ke))}catch(_){if(_&&typeof _=="object"&&"code"in _&&_.code==="ECONNABORTED")throw _;console.error("getFirstFrameImg err",_)}},ea=Gt({key:`storyboard-first-frame-${e.value??"unknown"}`,request:Tn}),jt=Gt({key:`storyboard-shot-list-${e.value??"unknown"}`,request:Zt,immediate:!1}),ta=Gt({key:`storyboard-flow-completion-${e.value??"unknown"}`,request:P}),En=()=>{ea.stop(),ke.value=null},Ea=()=>{ke.value=En,ea.checkIsPolling()||ea.start()},_n=()=>{jt.stop(),m.value=null},Pn=()=>{ta.stop(),ge.value=null},aa=(a=!1)=>{m.value=_n,jt.checkIsPolling()||jt.start(),a&&jt.trigger()},Cn=async()=>{if(Tt(Et.flowEditVideo,{createMode:"premium"}),h.value.length===0){Te.warning(y("mv.pleaseEnsureAllShotsGenerated"));return}if(!await Kt(he.value))return;if((j.value||we.value)&&!C.value.firstFrameImg){Te.warning(y("mv.pleaseWaitForCoverRegenerated"));return}Qe("title"),Qe("name");const a=await sa([{text:`${C.value.title||""}`.trim(),field:"title"},{text:`${C.value.artist||""}`.trim(),field:"name"}]);if(!a.passed){x.value.title=a.fieldMessageMap.title||"",x.value.name=a.fieldMessageMap.name||"",!x.value.title&&!x.value.name&&(x.value.title=a.firstViolationMessage);return}if(!h.value.every(_=>_.status==te.Success)){Te.warning(y("mv.pleaseEnsureAllShotsGenerated"));return}const F={mvId:e.value,genMode:C.value.genMode,quality:be.value,userNeedPoint:he.value,title:C.value.title,name:C.value.artist,isTitle:C.value.isTitle,isName:C.value.isName,isLyric:C.value.isLyric,isWatermark:C.value.isWatermark,...Fs({current:C.value.capcutEnabled,locked:Ke.value,featureEnabled:ye}),firstFrameImg:j.value?C.value.firstFrameImg:null,isupdt:1};await Gn(F),await _s(e.value,"basic"),w.getUserInfo(),u.setMessagePosition("edit"),await Ps(r,e.value,"/profile",{regenerating:!0})};return ma(async()=>{var a;try{if(await ut(),await Zt(),h.value.length){Fa($n()),await Ct();const l=document.querySelector(".clips-strip"),F=l==null?void 0:l.querySelector(".clip-card.active");if(l&&F){const _=l.getBoundingClientRect(),V=F.getBoundingClientRect(),ee=V.left-_.left-_.width/2+V.width/2;l.scrollLeft+=ee}}if((G.value.length||At())&&aa(),await Ct(),!L.value&&p.value&&S.value&&((a=U.value)==null?void 0:a.status)==te.Success){L.value=ja(p,S,{onSegmentEnd:$a,loopMode:i.value!=="order"});try{L.value.attachListeners()}catch{}}}finally{X.value=!1}}),ga(()=>{var a,l,F;$e=!0,je+=1,ft(),(a=m.value)==null||a.call(m),(l=ge.value)==null||l.call(ge),(F=ke.value)==null||F.call(ke),I&&(clearTimeout(I),I=null),ot();try{O==null||O()}catch{}try{W==null||W()}catch{}}),{videoUrl:E,videoRef:p,audioRef:S,storyboard:U,description:D,moderationErrors:x,shotList:h,shotIndex:Se,storyboardInitialLoading:X,mvType:fe,klingImg:Be,mvDetail:C,isNextStep:ae,shotCredits:se,isFreeShotRetry:ce,againMergePicPoint:v,againMergePoint:T,quality:be,showQualitySelector:ue,isQualityUpgrade:De,mergeCredits:he,setQuality:oe,isCoverRefreshing:we,isCapcutEffectLocked:Ke,firstFrameImgClear:ke,regeneShotlist:G,hasRetriedInEditor:Z,isFlowImageToVideoLoading:st,isFlowCompletionActive:Ce,flowCompletionStatusText:Ue,flowCompletionStatus:Le,videoType:A,coverDescription:H,currentImg:t,isCancelStorv:me,getShotFirstFrameDraftId:yn,setShotFirstFrameDraftId:hn,clearModerationError:Qe,onRecreate:Sn,onCancelRecreate:In,onNextStep:Fn,onSelectShot:Fa,startPlaybackLoop:Ta,stopPlaybackLoop:ot,getShotList:Zt,refreshFlowCompletion:P,getMvDetail:ut,onGenerate:Cn,onRefreshCover:kn}}function Po(e){return e.schemaOpen&&e.informationFlowV2}const Co=["aria-label"],Lo={class:"header"},xo={class:"title"},Ao={class:"fragment-heading"},Mo={key:0,class:"extra w-400"},Uo={class:"content [container-type:size]"},Vo={class:"video"},Oo={class:"setting w-400"},Do={class:"editor overflow-hidden"},No={class:"editor-actions flex items-center gap-10 mt-[var(--mv-edit-space)] shrink-0"},Go={class:"w-full"},Bo=3e3,zo=50,Ro=Object.assign({name:"MvStoryboardEdit"},{__name:"[id]",setup(e){const r=Kn(),n=ls(()=>xn(()=>
2import("./ByQ2B-w5.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85]),import.meta.url)),i=b([]),g=b(!1),u=b("cycle"),w=b(!1),y=b(null),{t:E}=Ft(),p=Yn(),S=z(()=>`video-editor-${p.fullPath}`),L=Qn(),K=Qa(),O=b(p.params.id),{videoUrl:W,videoRef:U,audioRef:D,storyboard:x,description:h,moderationErrors:$,shotList:R,shotIndex:Se,storyboardInitialLoading:m,mvType:X,klingImg:C,mvDetail:G,isNextStep:Z,shotCredits:J,isFreeShotRetry:Me,regeneShotlist:st,isFlowCompletionActive:qe,flowCompletionStatusText:Ie,flowCompletionStatus:re,againMergePicPoint:Ce,quality:Ue,showQualitySelector:Le,mergeCredits:ge,setQuality:je,isCoverRefreshing:Fe,isCapcutEffectLocked:He,videoType:Ne,coverDescription:$e,currentImg:me,isCancelStorv:Ve,getShotFirstFrameDraftId:fe,setShotFirstFrameDraftId:Be,clearModerationError:Ge,onRecreate:Oe,onNextStep:c,onSelectShot:t,onCancelRecreate:s,onGenerate:I,onRefreshCover:B}=_o(O,L,{videoPlayType:u,flowCompletionEnabled:z(()=>!r.isMobile)}),ae=z(()=>{var v;return Number((v=G.value)==null?void 0:v.mvTaskSchemaOpen)===2}),H=z(()=>Po({schemaOpen:ae.value,informationFlowV2:yt(G.value)})),A=z(()=>ks(G.value)),j=z(()=>ys(G.value)),we=z(()=>j.value[0]||""),Ke=b("");Ee([()=>{var v;return(v=x.value)==null?void 0:v.id},we],([v],T)=>{if(v!==(T==null?void 0:T[0])){Ke.value=we.value;return}Ke.value||(Ke.value=we.value)},{immediate:!0});const ye=b([]),ke=b(!1),ze=z(()=>it.value||!h.value||qe.value||ke.value),dt=z(()=>vn(x.value,st.value)),Qe=z(()=>{var v;return g.value||!((v=x.value)!=null&&v.id)&&m.value}),Ye=b("edit"),Je=z(()=>[{value:"edit",label:E("mv.editTab")},{value:"setting",label:E("mv.settingTab")}]),We=z(()=>Je.value.map(v=>v.value)),it=b(!1),rt=b(!1),vt=b(!1),Ze=new Map;let et=0;const mt=b(!1),ft=()=>{mt.value&&(u.value="order",mt.value=!1),w.value=!1},$t=()=>{u.value=="order"&&(u.value="cycle",mt.value=!0),w.value=!0},kt=v=>{const T=Ze.get(v);typeof T=="function"&&T(),Ze.delete(v)},ht=()=>{Ze.forEach(v=>{typeof v=="function"&&v()}),Ze.clear()},At=()=>{i.value.filter(v=>v.status===de.Generating||v.status===de.Pending).forEach(v=>{P(v)})},pt={environment_shot:0,lip_sync_shot:1,interaction_shot:2,dynamic_zoom_shot:3,Character_Close_Shots:4},Mt=b(void 0),f=v=>{var T;me.value=v||{},Mt.value=(T=me.value)==null?void 0:T.id};Ee(()=>{var v;return(v=me.value)==null?void 0:v.id},v=>{var T;v!=null&&v!==Mt.value&&Be((T=x.value)==null?void 0:T.id,v)}),Ee(()=>x.value,async(v,T,be)=>{var De;if(v!=null&&v.id&&v.id===(T==null?void 0:T.id))return;const oe=++et;if(ht(),be(()=>{ht()}),i.value=[],ye.value=[],me.value={},!(v!=null&&v.id)){g.value=!1;return}if(!(oe!==et||v.id!==((De=x.value)==null?void 0:De.id))){g.value=!0;try{if(H.value){let _e=[];try{_e=await fs({taskId:G.value.id,shotId:v.id})}catch{_e=[]}if(oe!==et)return;ye.value=_e.slice(0,Pt);return}const ue=Yt(G.value),{list:he,lastUsedReferenceUrls:ut}=await gs(ue,{taskId:G.value.id,shotId:v.id});if(oe!==et)return;he.forEach(_e=>{_e.coverImage==G.value.coverImage&&(v.shotType==pt.environment_shot||v.shotType==pt.dynamic_zoom_shot||v.shotType==pt.Character_Close_Shots)&&(_e.coverImage=""),Sa(_e)}),i.value=he;const tt=fe(v.id),lt=tt===void 0?void 0:he.find(_e=>_e.id==tt);if(lt)f(lt);else if(he.length==1&&he[0].firstFrameImg){f(he[0]),me.value.status=de.Success;return}else if(ue)f(ps(he,la,ut));else{const _e=he[he.length-1];f(he.filter(Qt=>Qt.isDefault)[0]||(la(_e)?_e:[...he].reverse().find(la))||_e||{})}he.filter(_e=>_e.status===de.Generating||_e.status===de.Pending).forEach(_e=>{P(_e,oe)})}catch{if(oe!==et)return;i.value=[]}finally{oe===et&&(g.value=!1)}}},{immediate:!0}),Ee(h,()=>{Ge("description")}),Ee($e,()=>{Ge("prompt")}),Ee(()=>{var v;return(v=G.value)==null?void 0:v.title},()=>{Ge("title")}),Ee(()=>{var v;return(v=G.value)==null?void 0:v.artist},()=>{Ge("name")});const P=(v,T=et)=>{var ue;kt(v.id);const be=v.shotId??((ue=x.value)==null?void 0:ue.id),{start:oe,stop:De}=Gt({request:()=>sn(Yt(G.value),{historyId:v.id,shotId:be}),onUpdate:async he=>{var ut,tt;if(T!==et){kt(v.id);return}if((ut=he==null?void 0:he.data)!=null&&ut.id&&he.data.status!=de.Generating&&he.data.status!=de.Pending){const lt=i.value.findIndex(_e=>_e.id===v.id),bt=un(he.data,lt!==-1?i.value[lt]:null);lt!==-1&&(i.value[lt]=bt),((tt=me.value)==null?void 0:tt.id)===v.id&&(me.value=bt),kt(v.id)}},key:`storyboard-cover-${v.id}`,immediate:!0,stopOnDeactivated:!0});Ze.set(v.id,De),oe()},N=async()=>{vt.value=!0;try{await I()}finally{vt.value=!1}};async function q(){var T,be;if((((T=me.value)==null?void 0:T.status)!==de.Success||!((be=me.value)!=null&&be.firstFrameImg))&&x.value.mvType==1&&!K.flow&&!ae.value){Te.warning(E("mv.pleaseSelectCorrectFirstFrame"));return}if(it.value||ke.value)return;const v=Xa().open({lock:!0,text:E("create.loading"),background:"rgba(0, 0, 0, 0.82)",variant:"block",size:56});try{it.value=!0,await Oe(H.value?{referenceImgsOverride:ye.value}:ae.value?{coverImgOverride:Ke.value}:void 0)}catch(oe){console.error("recreate error",oe)}finally{it.value=!1,v.close()}}const se=async()=>
2{if(!rt.value)try{rt.value=!0,await s()}catch(v){console.error("recreate error",v)}finally{rt.value=!1}};async function ce(){var be,oe,De;const v=Date.now()+Bo;let T=null;for(;!T&&Date.now()<v;){await Ct();const ue=(be=y.value)==null?void 0:be.playerCompRef;if(T=((oe=ue==null?void 0:ue.getVideoEl)==null?void 0:oe.call(ue))||null,T)break;await new Promise(he=>setTimeout(he,zo))}U.value=T,D.value=((De=y.value)==null?void 0:De.audioRef)||null}return ma(()=>{ce()}),en(()=>{At()}),tn(()=>{ht()}),ga(()=>{ht()}),Ee(()=>y.value,v=>{!U.value&&v&&ce()}),(v,T)=>{const be=Xn;return o(r).isMobile?(k(),ve(be,{key:0},{default:Ae(()=>[M(o(n))]),_:1})):(k(),Q("section",{key:o(S),class:"legacy-page-content"},[d("section",{class:"mvEdit","aria-label":v.$t("mv.fragmentContent")},[d("header",Lo,[d("div",xo,[d("h1",Ao,Y(v.$t("mv.fragmentContent")),1),o(K).flow?ne("",!0):(k(),ve(Nt,{key:0,credits:o(ge),loading:o(vt),block:!1,size:"small",onClick:N},{default:Ae(()=>[St(Y(v.$t("mv.mergeVideo")),1)]),_:1},8,["credits","loading"]))]),o(K).flow?ne("",!0):(k(),Q("div",Mo,[M(on,{modelValue:o(Ye),"onUpdate:modelValue":T[0]||(T[0]=oe=>at(Ye)?Ye.value=oe:null),options:o(Je)},null,8,["modelValue","options"])]))]),d("section",Uo,[d("div",Vo,[M(yo,{ref_key:"videoPreviewRef",ref:y,"video-url":o(W),"kling-img":o(C),"audio-url":o(G).audioUrl,"mv-type":o(X),storyboard:o(x)||{}},null,8,["video-url","kling-img","audio-url","mv-type","storyboard"]),M(ro,{"video-play-type":o(u),"onUpdate:videoPlayType":T[1]||(T[1]=oe=>at(u)?u.value=oe:null),"shot-list":o(R),"shot-index":o(Se),"mv-type":o(X),"flow-status-visible":o(qe),"flow-status-text":o(Ie),"flow-status-loading":o(re)==="polling",onSelectShot:o(t)},null,8,["video-play-type","shot-list","shot-index","mv-type","flow-status-visible","flow-status-text","flow-status-loading","onSelectShot"])]),d("div",Oo,[M(Zn,{"active-key":o(Ye),"key-order":o(We),fill:""},{"panel-edit":Ae(()=>{var oe,De;return[d("div",Do,[!o(m)&&o(X)==0&&!o(ae)?(k(),ve(wr,{key:0,"current-img":o(me),"onUpdate:currentImg":T[2]||(T[2]=ue=>at(me)?me.value=ue:null),"history-img-list":o(i),"onUpdate:historyImgList":T[3]||(T[3]=ue=>at(i)?i.value=ue:null),loading:o(Qe),onOpenFirstFrame:$t},null,8,["current-img","history-img-list","loading"])):ne("",!0),o(H)?(k(),ve(Xr,{key:1,modelValue:o(ye),"onUpdate:modelValue":T[4]||(T[4]=ue=>at(ye)?ye.value=ue:null),"shot-id":((oe=o(x))==null?void 0:oe.id)??"","mv-id":o(O),onUploading:T[5]||(T[5]=ue=>ke.value=ue)},null,8,["modelValue","shot-id","mv-id"])):o(ae)?(k(),ve(il,{key:2,"remote-url":o(Ke),"onUpdate:remoteUrl":T[6]||(T[6]=ue=>at(Ke)?Ke.value=ue:null),images:o(j),"shot-id":((De=o(x))==null?void 0:De.id)??"",onUploading:T[7]||(T[7]=ue=>ke.value=ue)},null,8,["remote-url","images","shot-id"])):ne("",!0),M(Er,{description:o(h),"onUpdate:description":T[8]||(T[8]=ue=>at(h)?h.value=ue:null),"video-type":o(Ne),"onUpdate:videoType":T[9]||(T[9]=ue=>at(Ne)?Ne.value=ue:null),"mv-type":o(X),"max-length":o(A),"error-message":o($).description,"is-regnenerate":!o(dt)},null,8,["description","video-type","mv-type","max-length","error-message","is-regnenerate"])]),d("div",No,[d("div",Go,[o(dt)?ne("",!0):(k(),ve(Nt,{key:0,credits:o(J),"show-credits":!o(Me),loading:o(it),disabled:o(ze),onClick:q},{default:Ae(()=>[St(Y(v.$t("common.regenerate")),1)]),_:1},8,["credits","show-credits","loading","disabled"])),o(dt)?(k(),ve(Ja,{key:1,style:{"margin-left":"0px"},"show-credits":!1,background:"var(--app-dialog-btn-cancel-bg)","background-disabled":"rgba(255, 255, 255, 0.06)",loading:o(rt),disabled:o(rt)||o(Ve),onClick:se},{default:Ae(()=>[St(Y(v.$t("common.cancel")),1)]),_:1},8,["loading","disabled"])):ne("",!0)]),o(Z)&&o(K).flow?(k(),ve(Nt,{key:0,style:{"margin-left":"0px"},"show-credits":!1,onClick:o(c)},{default:Ae(()=>[St(Y(v.$t("mv.NextStep")),1)]),_:1},8,["onClick"])):ne("",!0)])]}),"panel-setting":Ae(()=>[M(zl,{"mv-detail":o(G),"onUpdate:mvDetail":T[10]||(T[10]=oe=>at(G)?G.value=oe:null),description:o($e),"onUpdate:description":T[11]||(T[11]=oe=>at($e)?$e.value=oe:null),"again-merge-pic-point":o(Ce),"prompt-error-message":o($).prompt,"title-error-message":o($).title,"name-error-message":o($).name,"cover-refreshing":
2o(Fe),"capcut-locked":o(He),quality:o(Ue),"show-quality-selector":o(Le),onSetQuality:o(je),onRefreshCover:o(B)},null,8,["mv-detail","description","again-merge-pic-point","prompt-error-message","title-error-message","name-error-message","cover-refreshing","capcut-locked","quality","show-quality-selector","onSetQuality","onRefreshCover"])]),_:1},8,["active-key","key-order"])])]),M(Jn,{"model-value":o(w),"onUpdate:modelValue":T[14]||(T[14]=oe=>at(w)?w.value=oe:null),title:v.$t("mv.firstFrame"),variant:"glass",width:"1200px",top:"10vh",onClose:ft},{default:Ae(()=>{var oe,De;return[M(vr,{"current-img":o(me),"onUpdate:currentImg":T[12]||(T[12]=ue=>at(me)?me.value=ue:null),"history-img-list":o(i),"onUpdate:historyImgList":T[13]||(T[13]=ue=>at(i)?i.value=ue:null),visible:o(w),"shot-id":(oe=o(x))==null?void 0:oe.id,"task-id":o(G).id,"mv-cover-image":o(G).coverImage,"shot-type":(De=o(x))==null?void 0:De.shotType,"is-flow-v2":o(Yt)(o(G)),onCloseFirstFrame:ft},null,8,["current-img","history-img-list","visible","shot-id","task-id","mv-cover-image","shot-type","is-flow-v2"])]}),_:1},8,["model-value","title"])],8,Co)]))}}}),qo=nt(Ro,[["__scopeId","data-v-bbbd8ba3"]]),fi=Object.freeze(Object.defineProperty({__proto__:null,default:qo},Symbol.toStringTag,{value:"Module"}));export{fi as _,ho as p};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.