1import{_ as X,a as J}from"./FiZF3q-Y.js";import{_ as Q}from"./Dt3zQnvQ.js";import{_ as Z}from"./-2bwaYIy.js";import{_ as tt}from"./D_WnfevE.js";import{d as z,a as et,E as at,c as st,X as ot,H as nt,o as l,i,m as s,R as B,k as t,t as r,q as p,F as j,L as R,p as $,w as b,r as U,v as lt,S as G,l as it,aX as rt,s as L,x as N,Y as dt,aY as O,z as c,A as K,_ as W,G as ut,g as ct,y as w,j as A}from"./DxGGWIbl.js";import"./BJW03ctj.js";import"./CK2ExGwn.js";import"./DN80BDhH.js";const pt={key:1,class:"editor-shell"},vt={class:"video-pane"},bt={class:"video-frame"},ft=["src"],mt={key:1,class:"no-video"},gt={class:"video-meta"},kt={class:"segments-pane"},yt={key:0,class:"segment-list"},_t=["onClick"],wt={class:"segment-head"},xt=["onClick"],ht=["onClick"],St=["onUpdate:modelValue","onKeydown"],Ct={class:"segment-actions"},jt=["onClick"],$t=["disabled","onClick"],Tt={key:1,class:"no-segments"},It={class:"settings-pane"},Vt={class:"export-section"},Rt={class:"export-types"},Ut=["onClick"],At={class:"control-label"},Et=["value"],Mt=["disabled"],Lt=["href"],Nt={class:"regenerate-modal",role:"dialog","aria-modal":"true","aria-labelledby":"regenerate-title"},Bt={class:"modal-actions"},Ft=["disabled"],Pt={key:1,class:"toast",role:"status"},qt=z({__name:"SubtitleEditor",props:{projectId:{}},setup(E){const f=E,o=et(),{auth:F}=at(),{requireAuth:m}=st(),g=c(null),x=c(""),d=c(null),v=c(!0),k=c(!0),T=c(!1),y=c("video"),h=c("mp4"),S=c(!1),C=c(""),P=K(()=>y.value==="video"?["mp4"]:y.value==="audio"?["mp3"]:["srt","vtt"]);ot(y,()=>{h.value=P.value[0]}),nt(()=>{const n=async()=>{try{await Promise.all([o.fetchProject(f.projectId,!1),o.fetchSegments(f.projectId)])}catch{}};F.isAuthenticated()?n():m(n)});function q(n){const e=Math.max(0,n||0),I=Math.floor(e/3600),a=Math.floor(e%3600/60),V=Math.floor(e%60),u=`${String(a).padStart(2,"0")}:${String(V).padStart(2,"0")}`;return I?`${String(I).padStart(2,"0")}:${u}`:u}function Y(n){x.value=n.id,g.value&&(g.value.currentTime=n.start,g.value.play().catch(()=>{}))}async function M(n){try{await o.saveSegment(f.projectId,n),_("Subtitle saved")}catch(e){_(e instanceof Error?e.message:"Unable to save subtitle")}}async function D(){if(!(!d.value||!v.value&&!k.value)){T.value=!0;try{await o.regenerate(f.projectId,d.value.id,v.value,k.value),d.value=null,_("Segment regenerated")}catch(n){_(n instanceof Error?n.message:"Unable to regenerate segment")}finally{T.value=!1}}}async function H(){S.value=!0;try{const n=await o.export(f.projectId,y.value,h.value);n.url&&window.open(n.url,"_blank","noopener"),_(n.url?"Export ready":"Export started. It will appear here when ready.")}catch(n){_(n instanceof Error?n.message:"Unable to create export")}finally{S.value=!1}}function _(n){C.value=n,window.setTimeout(()=>{C.value===n&&(C.value="")},2600)}return(n,e)=>{const I=tt;return l(),i(j,null,[s(o).loading&&(!s(o).project||!s(o).segments.length)?(l(),B(I,{key:0,title:"Opening subtitle editor",message:"Loading video, speakers, and translated segmentsâ¦",icon:"fas fa-closed-captioning"})):s(o).project?(l(),i("div",pt,[t("section",vt,[t("div",bt,[s(o).project.outputUrl||s(o).project.sourceUrl?(l(),i("video",{key:0,ref_key:"video",ref:g,src:s(o).project.outputUrl||s(o).project.sourceUrl,controls:"",preload:"metadata"},null,8,ft)):(l(),i("div",mt,[...e[8]||(e[8]=[t("i",{class:"fas fa-play"},null,-1),t("span",null,"Video preview",-1)])]))]),t("div",gt,[t("div",null,[t("strong",null,r(s(o).project.filename),1),t("span",null,r(s(o).project.sourceLanguage||"Original")+" â "+r(s(o).project.targetLanguage||"Translated"),1)]),e[9]||(e[9]=t("span",{class:"complete-pill"},[t("i",{class:"fas fa-check"}),p(" Ready")],-1))]),e[10]||(e[10]=t("div",{class:"editor-tip"},[t("i",{class:"fas fa-lightbulb"}),t("span",null,"Click any subtitle to jump to that moment in the video.")],-1))]),t("section",kt,[t("header",null,[t("div",null,[e[11]||(e[11]=t("h2",null,"Subtitles",-1)),t("span",null,r(s(o).segments.length)+" segments",1)]),t("button",{type:"button",title:"Reload subtitles",onClick:e[0]||(e[0]=a=>s(o).fetchSegments(E.projectId))},[...e[12]||(e[12]=[t("i",{class:"fas fa-rotate"},null,-1)])])]),s(o).segments.length?(l(),i("div",yt,[(l(!0),i(j,null,R(s(o).segments,(a,V)=>(l(),i("article",{key:a.id,class:$({active:s(x)===a.id}),onClick:u=>x.value=a.id},[t("div",wt,[t("button",{type:"button",class:"time",onClick:b(u=>Y(a),["stop"])},[e[13]||(e[13]=t("i",{class:"fas fa-play"},null,-1)),p(" "+r(q(a.start))+" â "+r(q(a.end)),1)],8,xt),t("span",null,r(a.speaker||`Speaker ${V%2+1}`),1),t("button",{type:"button",class:"more",title:"Regenerate segment",onClick:b(u=>d.value=a,["stop"])},[...e[14]||(e[14]=[t("i",{class:"fas fa-rotate"},null,-1)])],8,ht)]),t("label",null,[e[15]||(e[15]=t("span",null,"Original",-1)),t("p",null,r(a.sourceText||"No source text available"),1)]),t("label",null,[e[16]||(e[16]=t("span",null,"Translation",-1)),U(t("textarea",{"onUpdate:modelValue":u=>a.translatedText=u,rows:"3",onClick:e[1]||(e[1]=b(()=>{},["stop"])),onKeydown:[G(b(u=>M(a),["meta"]),["enter"]),G(b(u=>M(a),["ctrl"]),["enter"])]},null,40,St),[[lt,a.translatedText]])]),t("div",Ct,[t("button",{type:"button",onClick:b(u=>d.value=a,["stop"])},[...e[17]||(e[17]=[t("i",{class:"fas fa-wand-magic-sparkles"},null,-1),p(" Regenerate",-1)])],8,jt),t("button",{type:"button",class:"save",disabled:s(o).savingId===a.id,onClick:b(u=>M(a),["stop"])},[t("i",{class:$(s(o).savingId===a.id?"fas fa-spinner fa-spin":"fas fa-check")},null,2),p(" "+r(s(o).savingId===a.id?"Savingâ¦":"Save"),1)],8,$t)])],10,_t))),128))])):(l(),i("div",Tt,[...e[18]||(e[18]=[t("i",{class:"fas fa-closed-captioning"},null,-1),t("strong",null,"No subtitle segments yet",-1),t("p",null,"Reload in a moment if processing has just finished.",-1)])]))]),t("aside",It,[e[23]||(e[23]=it('<section data-v-1522bcb1><div class="side-heading" data-v-1522bcb1><i class="fas fa-user-group" data-v-1522bcb1></i><div data-v-1522bcb1><h3 data-v-1522bcb1>Speakers</h3><p data-v-1522bcb1>Voice assignment</p></div></div><div class="speaker" data-v-1522bcb1><span data-v-1522bcb1>S1</span><div data-v-1522bcb1><strong data-v-1522bcb1>Speaker 1</strong><small data-v-1522bcb1>Original voice</small></div><i class="fas fa-chevron-down" data-v-1522bcb1></i></div><div class="speaker" data-v-1522bcb1><span data-v-1522bcb1>S2</span><div data-v-1522bcb1><strong data-v-1522bcb1>Speaker 2</strong><small data-v-1522bcb1>Natural female</small></div><i class="fas fa-chevron-down" data-v-1522bcb1></i></div></section><section data-v-1522bcb1><div class="side-heading" data-v-1522bcb1><i class="fas fa-closed-captioning" data-v-1522bcb1></i><div data-v-1522bcb1><h3 data-v-1522bcb1>Subtitle style</h3><p data-v-1522bcb1>Preview settings</p></div></div><label class="control-label" data-v-1522bcb1><span data-v-1522bcb1>Font</span><select data-v-1522bcb1><option data-v-1522bcb1>Inter</option><option data-v-1522bcb1>Arial</option><option data-v-1522bcb1>Georgia</option></select></label><div class="two-controls" data-v-1522bcb1><label class="control-label" data-v-1522bcb1><span data-v-1522bcb1>Size</span><select data-v-1522bcb1><option data-v-1522bcb1>
1Medium</option><option data-v-1522bcb1>Small</option><option data-v-1522bcb1>Large</option></select></label><label class="control-label" data-v-1522bcb1><span data-v-1522bcb1>Position</span><select data-v-1522bcb1><option data-v-1522bcb1>Bottom</option><option data-v-1522bcb1>Top</option></select></label></div><div class="subtitle-sample" data-v-1522bcb1>Your translated subtitle</div></section>',2)),t("section",Vt,[e[22]||(e[22]=t("div",{class:"side-heading"},[t("i",{class:"fas fa-arrow-up-from-bracket"}),t("div",null,[t("h3",null,"Export"),t("p",null,"Choose a deliverable")])],-1)),t("div",Rt,[(l(),i(j,null,R([{value:"video",icon:"fas fa-film",label:"Video"},{value:"audio",icon:"fas fa-wave-square",label:"Audio"},{value:"subtitle",icon:"fas fa-closed-captioning",label:"Subtitles"}],a=>t("button",{key:a.value,type:"button",class:$({active:s(y)===a.value}),onClick:V=>y.value=a.value},[t("i",{class:$(a.icon)},null,2),p(r(a.label),1)],10,Ut)),64))]),t("label",At,[e[19]||(e[19]=t("span",null,"Format",-1)),U(t("select",{"onUpdate:modelValue":e[2]||(e[2]=a=>L(h)?h.value=a:null)},[(l(!0),i(j,null,R(s(P),a=>(l(),i("option",{key:a,value:a},r(a.toUpperCase()),9,Et))),128))],512),[[rt,s(h)]])]),t("button",{class:"export-button",type:"button",disabled:s(S),onClick:H},[t("i",{class:$(s(S)?"fas fa-spinner fa-spin":"fas fa-download")},null,2),p(" "+r(s(S)?"Preparingâ¦":"Generate export"),1)],8,Mt),(l(!0),i(j,null,R(s(o).project.exports?.filter(a=>a.url),a=>(l(),i("a",{key:a.id,class:"ready-export",href:a.url,target:"_blank",rel:"noopener"},[t("span",null,[e[20]||(e[20]=t("i",{class:"fas fa-file-arrow-down"},null,-1)),p(" "+r(a.format.toUpperCase())+" ready",1)]),e[21]||(e[21]=t("i",{class:"fas fa-arrow-up-right-from-square"},null,-1))],8,Lt))),128))])])])):N("",!0),(l(),B(dt,{to:"body"},[s(d)?(l(),i("div",{key:0,class:"modal-backdrop",onClick:e[7]||(e[7]=b(a=>d.value=null,["self"]))},[t("div",Nt,[t("button",{class:"close",type:"button","aria-label":"Close",onClick:e[3]||(e[3]=a=>d.value=null)},[...e[24]||(e[24]=[t("i",{class:"fas fa-xmark"},null,-1)])]),e[27]||(e[27]=t("span",{class:"modal-icon"},[t("i",{class:"fas fa-wand-magic-sparkles"})],-1)),e[28]||(e[28]=t("h2",{id:"regenerate-title"},"Regenerate segment",-1)),e[29]||(e[29]=t("p",null,"Choose what should be refreshed for this subtitle.",-1)),t("label",null,[U(t("input",{"onUpdate:modelValue":e[4]||(e[4]=a=>L(v)?v.value=a:null),type:"checkbox"},null,512),[[O,s(v)]]),e[25]||(e[25]=t("span",null,[t("strong",null,"Translation"),t("small",null,"Create a new translation for this phrase.")],-1))]),t("label",null,[U(t("input",{"onUpdate:modelValue":e[5]||(e[5]=a=>L(k)?k.value=a:null),type:"checkbox"},null,512),[[O,s(k)]]),e[26]||(e[26]=t("span",null,[t("strong",null,"Voice"),t("small",null,"Generate a new dubbed audio segment.")],-1))]),t("div",Bt,[t("button",{type:"button",onClick:e[6]||(e[6]=a=>d.value=null)},"Cancel"),t("button",{type:"button",disabled:s(T)||!s(v)&&!s(k),onClick:D},r(s(T)?"Regeneratingâ¦":"Regenerate"),9,Ft)])])])):N("",!0),s(C)?(l(),i("div",Pt,[e[30]||(e[30]=t("i",{class:"fas fa-check-circle"},null,-1)),p(" "+r(s(C)),1)])):N("",!0)]))],64)}}}),Gt=W(qt,[["__scopeId","data-v-1522bcb1"]]),Ot=z({__name:"edit",setup(E){const f=ut(),o=K(()=>String(f.params.id));return ct({title:"Review Translation | AI Video Translator",meta:[{name:"robots",content:"noindex, follow"}]}),(F,m)=>{const g=J,x=Q,d=Z,v=X;return l(),B(v,{class:"video-editor-page"},{sidebar:w(()=>[A(g,{"active-key":"video-translator","sign-in-return":`/workspace/videos/${s(o)}/edit`},null,8,["sign-in-return"])]),title:w(()=>[...m[0]||(m[0]=[t("div",{class:"header-text"},[t("h1",{class:"header-name"},"Review translation"),t("p",{class:"header-desc"},"Fine-tune subtitles, voices, and export settings.")],-1)])]),actions:w(()=>[A(x,{class:"workspace-header-btn",to:`/workspace/videos/${s(o)}`},{default:w(()=>[...m[1]||(m[1]=[t("i",{class:"fas fa-arrow-left"},null,-1),p(" Project status",-1)])]),_:1},8,["to"])]),default:w(()=>[A(d,{"max-width":"92rem"},{default:w(()=>[A(Gt,{"project-id":s(o)},null,8,["project-id"])]),_:1})]),_:1})}}}),Qt=W(Ot,[["__scopeId","data-v-0afe2d14"]]);export{Qt as default};
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.