1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="da96a9f3-6ddb-5224-a68b-69265d53a61d")}catch(e){}}(); 3import{d as ei}from"./chunk-DDX27UMN.js";import{a as S,b as D,c as Jt}from"./chunk-L6XWN64N.js";import"./chunk-LGU7AQEH.js";import{c as Ge,d as Le,e as Bt,f as Ht,g as Ue,h as We,i as jt,j as Fe,k as Xt,l as $e,m as Be,n as He,o as je,p as Kt,q as qt,r as Zt,s as Qt,u as Yt}from"./chunk-42CE2B4K.js";import{a as J}from"./chunk-GGKS4JRM.js";import{a as Lt,b as Ut,c as Wt,d as Ft}from"./chunk-CNFKEEFA.js";import{a as $t}from"./chunk-CJLBI7WM.js";import{a as Gt}from"./chunk-TOPKRSHX.js";import{a as zt}from"./chunk-GH6AYR3B.js";import"./chunk-GDKCSVOR.js";import"./chunk-S4OZDCYQ.js";import{a as Ae,b as Nt}from"./chunk-USU4W6DP.js";import"./chunk-A5Y33E5O.js";import"./chunk-PO3EBANM.js";import{c as Te}from"./chunk-25OUOILF.js";import"./chunk-U554F3JP.js";import{a as Rt,b as Dt}from"./chunk-ZNPKQ2J6.js";import"./chunk-EKYIQW3I.js";import"./chunk-2Y6NUYJB.js";import"./chunk-66OGKBOW.js";import"./chunk-SVLQLMJ7.js";import"./chunk-U4HYV4PM.js";import"./chunk-NA24U4XU.js";import{a as Ot}from"./chunk-ZSFXLLKG.js";import{a as Mt}from"./chunk-72752F5E.js";import"./chunk-OVY6EDTI.js";import{a as Y,b as Vt}from"./chunk-R4IPFSQD.js";import"./chunk-YNXW3XB4.js";import"./chunk-QTIP6K62.js";import{b as xe}from"./chunk-BFGMM5EH.js";import"./chunk-ZAGZXP75.js";import"./chunk-2URU2LUN.js";import"./chunk-HPMUTVYB.js";import"./chunk-WTAZXU3H.js";import"./chunk-ALS6TH3Q.js";import"./chunk-U44DPNPU.js";import"./chunk-IZIKZSIY.js";import"./chunk-OUNC6SXQ.js";import"./chunk-QO4VJPX3.js";import"./chunk-B26FOHT5.js";import{a as kt,b as It}from"./chunk-6ZE2GEBR.js";import"./chunk-6NTJ7A5V.js";import"./chunk-KM7D4QU6.js";import{b as Et}from"./chunk-75KC7XY3.js";import"./chunk-OYY43EBR.js";import"./chunk-XKC6U7KO.js";import"./chunk-ICJ4OYTG.js";import{a as Pt}from"./chunk-OD4XUPKL.js";import"./chunk-GV6YIY7T.js";import"./chunk-3Q4ENG64.js";import"./chunk-MZNQZHSR.js";import"./chunk-FAI4VIAI.js";import"./chunk-TZG57MXV.js";import"./chunk-6UKZOYTK.js";import"./chunk-GRLQ2JNI.js";import"./chunk-7OEBSWIG.js";import"./chunk-ICVHPWOZ.js";import"./chunk-I5TYGA5O.js";import"./chunk-FM4BRFJL.js";import"./chunk-6EK472QO.js";import"./chunk-74XSALDF.js";import"./chunk-TN63NN3M.js";import{Ed as yt,Fd as mi,Id as xt,Jd as gi,Md as Tt,Nd as hi,Od as be,Pd as ye,Qd as At,da as wt,ee as N,fe as ie,ha as pi,ia as bt,l as pt,la as _i,m as ci}from"./chunk-3DSPHW6V.js";import{O as W,P as oe,S as we,T as Ct,X as se,Y as Ne,a as vt,b as li}from"./chunk-63QE6F3C.js";import{n as ae,r as De}from"./chunk-J3ZCYF7X.js";import"./chunk-N6HKC5YM.js";import"./chunk-EHPICUXU.js";import{D as gt,Db as Se,Eb as Ce,M as ht,O as ut,Tb as ft,Wb as St,rc as le,t as _t,xb as ze,y as mt,zb as di}from"./chunk-NZAURXIC.js";import{D as z,k as lt,l as U,r as dt,y as V}from"./chunk-PDBQSBW2.js";import{$c as ve,Bb as $,Da as g,E as Je,F as et,Gb as ce,Gc as L,I as Pe,Ib as s,Ic as he,Ja as P,Jb as ot,Jc as ue,La as nt,Lc as v,Md as ne,Nc as o,P as tt,Tc as j,Ua as ge,Uc as X,Ud as f,Va as h,Vc as K,Wa as u,Wb as I,Wd as F,Yc as Me,Zc as A,Zd as E,_c as R,a as Ye,eb as at,ec as y,f as me,fb as k,fc as B,fd as fe,gd as M,hc as c,ic as re,id as ct,jc as H,ma as te,oc as st,od as Ve,pd as Oe,ra as it,sa as rt,tc as d,uc as p,ud as Re,vc as C,wc as Z,xc as Q,zc as T}from"./chunk-RX45F3VG.js";import"./chunk-XTLLHG7S.js";import"./chunk-3YV6UUBL.js";import"./chunk-JLENAXOB.js";import"./chunk-2QIXGXOC.js";import"./chunk-SNF2N7IK.js";import"./chunk-NM7LVQTP.js";import"./chunk-IK6B3JC3.js";import{a as b,b as x,m as G}from"./chunk-C6VPWJCA.js";E();z();De();li();E();z();ie();oe();E();z();function ui(n,_){if(n&1){let e=T();d(0,"app-voice-clone-select",3),v("selectionChanged",function(t){h(e);let r=o();return u(r.onSelectionChanged(t));})("voiceSelect",function(t){h(e);let r=o();return u(r.onVoiceSelect(t));})("voicePlay",function(t){h(e);let r=o();return u(r.onVoicePlay(t));})("voiceFavoriteToggle",function(t){h(e);let r=o();return u(r.onVoiceFavoriteToggle(t));}),p();}if(n&2){let e=o();c("layout","grid")("showHeader",!1)("showFooter",!1)("autoPlayOnSelect",!0)("preSelectedVoiceId",e.preSelectedVoiceId());}}
3function vi(n,_){if(n&1&&(d(0,"div",4)(1,"div",5),C(2,"app-lottie-progress-loader",6),p()()),n&2){let e=o();s(2),c("title",e.generatingTitle)("progress",e.generation.progress());}}var Xe=(()=>{class n{constructor(){this.wizardState=g(D),this.eventsService=g(N),this.photo2VideoService=g(J),this.notificationsService=g(W),this.cdr=g(ne),this.pendingPreviewAudio=null,this.preSelectedVoiceId=f(()=>this.wizardState.select("selectedVoice")()?.id??null),this.voiceSubView=this.wizardState.select("voiceSubView"),this.generatingTitle="Generating preview",this.generation=new Lt();let e=!1;F(()=>{let i=this.voiceSubView()==="generating";i!==e&&(e=i,i?this.generation.start(xe(this.wizardState.select("scriptText")())):this.generation.reset());},{allowSignalWrites:!0});}generateVoicePreview(){return G(this,null,function*(){let e=this.wizardState.select("selectedVoice")(),i=this.wizardState.select("scriptText")();if(!e?.externalID||!i){this.wizardState.setVoiceSubView("list");return;}try{let t=yield this.photo2VideoService.generateVoicePreview(e.externalID,i,"portraitToVideo"),r={id:this.createVariationId(),voiceId:e.externalID,voiceName:e.name,voiceAvatarUrl:e.avatarUrl||"",voiceSource:this.wizardState.mapVoiceSource(e),audioUrl:t.url,createdAt:Date.now(),locale:t.locale,segmentationUrl:t.segmentation?.url,durationSec:t.duration};this.wizardState.addVoiceVariation(r),this.wizardState.setSelectedVariationId(r.id),this.logPreviewReady(t.url),yield this.generation.complete(),this.wizardState.setVoiceSubView("list"),this.wizardState.setCurrentStep(S.CREATE_VOICEOVER);}catch(t){let r=t instanceof Error?t.message:"Failed to generate voice preview";this.notificationsService.error(r),this.wizardState.setVoiceSubView("list");}finally{this.cdr.markForCheck();}});}ngOnDestroy(){this.generation.reset(),this.releasePendingPreviewAudio();}onSelectionChanged(e){this.wizardState.setSelectedVoice(e);}onVoiceSelect(e){this.logVoiceClick(e.voice,"select");}onVoicePlay(e){this.logVoiceClick(e.voice,"preview");}onVoiceFavoriteToggle(e){this.logVoiceClick(e.voice,e.isFavorite?"star":"unstar");}logVoiceClick(e,i){this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoVoiceClick,{voiceName:e.name,voiceSource:this.wizardState.mapVoiceSource(e),button:i});}createVariationId(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`variation-${Date.now()}-${Math.random().toString(36).slice(2,10)}`;}logPreviewReady(e){this.releasePendingPreviewAudio();let i=this.wizardState.buildCombinedAttrs(),t=new Audio(e);this.pendingPreviewAudio=t;let r=()=>{this.pendingPreviewAudio===t&&(this.pendingPreviewAudio=null),t.src="",t.removeAttribute("src"),t.load();},a=l=>{this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoPreviewReady,x(b({},i),{duration:l})),r();};t.addEventListener("loadedmetadata",()=>{a(isFinite(t.duration)?t.duration:0);},{once:!0}),t.addEventListener("error",()=>a(0),{once:!0});}releasePendingPreviewAudio(){this.pendingPreviewAudio&&(this.pendingPreviewAudio.src="",this.pendingPreviewAudio.removeAttribute("src"),this.pendingPreviewAudio.load(),this.pendingPreviewAudio=null);}static{this.ɵfac=function(i){return new(i||n)();};}static{this.ɵcmp=P({type:n,selectors:[["app-select-voice-step"]],standalone:!0,features:[M],decls:3,vars:2,consts:[[1,"select-voice-step"],[3,"layout","showHeader","showFooter","autoPlayOnSelect","preSelectedVoiceId","selectionChanged","voiceSelect","voicePlay","voiceFavoriteToggle",4,"ngIf"],["class","voice-step-card",4,"ngIf"],[3,"selectionChanged","voiceSelect","voicePlay","voiceFavoriteToggle","layout","showHeader","showFooter","autoPlayOnSelect","preSelectedVoiceId"],[1,"voice-step-card"],[1,"voice-step-card__body"],[3,"title","progress"]],template:function(i,t){i&1&&(d(0,"div",0),y(1,ui,1,5,"app-voice-clone-select",1)(2,vi,3,2,"div",2),p()),i&2&&(s(),c("ngIf",t.voiceSubView()==="list"),s(),c("ngIf",t.voiceSubView()==="generating"));},dependencies:[V,U,zt,Gt],styles:["[_nghost-%COMP%]{display:block;height:100%;min-height:0}.select-voice-step[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;width:100%;min-height:0}.voice-step-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:24px;flex:1;min-height:0;padding:32px;background:#fff;border-radius:10px;box-shadow:none;overflow:hidden}.voice-step-card__header[_ngcontent-%COMP%]{display:flex;align-items:center;height:40px;flex-shrink:0}.voice-step-card__title[_ngcontent-%COMP%]{font-family:Inter,sans-serif;font-size:18px;font-weight:700;line-height:1.4;color:#253658;margin:0}.voice-step-card__body[_ngcontent-%COMP%]{display:flex;flex:1;min-height:0;width:100%;align-items:center;justify-content:center}.voice-step-card__body[_ngcontent-%COMP%] app-lottie-progress-loader[_ngcontent-%COMP%]{width:100%;max-width:420px}"],changeDetection:0});}}return n;})();E();z();ie();oe();At();E();var ti=(()=>{class n{constructor(){this.wizardState=g(D),this.photo2VideoService=g(J),this.eventsService=g(N),this.notificationsService=g(W),this.dialogHelperService=g(ye),this.cdr=g(ne),this.variations=this.wizardState.select("voiceVariations"),this.selectedVariationId=this.wizardState.select("selectedVariationId"),this.selectedVoice=this.wizardState.select("selectedVoice"),this.isGeneratingNew=I(!1),this.headerTitle="Create Voiceover",this.generateNewLabel="Generate new",this.generatingTitle="Generating preview",this.errorMessage="Failed to generate voice variation",this.hasVariations=f(()=>this.variations().length>0),this.scriptWordCount=f(()=>xe(this.wizardState.select("scriptText")())),this.variationLabel=e=>"Variation "+(e+1)+"";}onVariationToggle(e){this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoVoiceVariationClick,{voiceName:e.variation.voiceName,voiceSource:e.variation.voiceS
3ource,button:e.action==="play"?"preview":"pause",variationIndex:e.index+1});}onVariationSelect(e){this.wizardState.setSelectedVariationId(e.variation.id),this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoVoiceVariationClick,{voiceName:e.variation.voiceName,voiceSource:e.variation.voiceSource,button:"select",variationIndex:e.index+1});}openGenerateDialog(){let e=this.selectedVoice();this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoVoiceVariationGenerateStart,{voiceName:e?.name??"",voiceSource:this.wizardState.mapVoiceSource(e)});let i=new Wt(),t=null;i.onSubmit=a=>{a&&(t?.close(),this.generateNewVariation(a));},i.onClose=()=>t?.close();let r=new be();r.panelClass="new-confirmation-dialog",t=this.dialogHelperService.open(i,Ft,r);}generateNewVariation(e){return G(this,null,function*(){let i=this.selectedVoice(),t=this.wizardState.select("scriptText")();if(!i?.externalID||!t){this.notificationsService.error(this.errorMessage);return;}this.isGeneratingNew.set(!0),this.cdr.markForCheck();try{let r=yield this.photo2VideoService.generateVoicePreview(i.externalID,t,"portraitToVideo"),a={id:this.createVariationId(),voiceId:i.externalID,voiceName:i.name,voiceAvatarUrl:i.avatarUrl||"",voiceSource:this.wizardState.mapVoiceSource(i),audioUrl:r.url,createdAt:Date.now(),locale:r.locale,segmentationUrl:r.segmentation?.url,durationSec:r.duration,reason:e};this.wizardState.addVoiceVariation(a),this.wizardState.setSelectedVariationId(a.id),this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoVoiceVariationGenerate,{voiceName:a.voiceName,voiceSource:a.voiceSource,prompt:e});}catch(r){let a=r instanceof Error?r.message:this.errorMessage;this.notificationsService.error(a);}finally{this.isGeneratingNew.set(!1),this.cdr.markForCheck();}});}createVariationId(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`variation-${Date.now()}-${Math.random().toString(36).slice(2,10)}`;}static{this.ɵfac=function(i){return new(i||n)();};}static{this.ɵcmp=P({type:n,selectors:[["app-create-voiceover-step"]],standalone:!0,features:[M],decls:1,vars:9,consts:[[3,"variationToggle","variationSelect","generateRequested","variations","selectedVariationId","voiceForSubtitle","isGenerating","headerTitle","generateNewLabel","generatingTitle","generationWordCount","variationLabel"]],template:function(i,t){i&1&&(d(0,"app-voice-variation-player",0),v("variationToggle",function(a){return t.onVariationToggle(a);})("variationSelect",function(a){return t.onVariationSelect(a);})("generateRequested",function(){return t.openGenerateDialog();}),p()),i&2&&c("variations",t.variations())("selectedVariationId",t.selectedVariationId())("voiceForSubtitle",t.selectedVoice())("isGenerating",t.isGeneratingNew())("headerTitle",t.headerTitle)("generateNewLabel",t.generateNewLabel)("generatingTitle",t.generatingTitle)("generationWordCount",t.scriptWordCount())("variationLabel",t.variationLabel);},dependencies:[V,Ut],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0});}}return n;})();E();z();di();it();rt();le();hi();oe();ie();function pe(n){let{markers:_,baseImageUrl:e,audioDuration:i}=n,t=[..._].sort((w,O)=>w.startTime-O.startTime),r=[],a=0,l=null,m=e;for(let w of t)w.startTime>a&&r.push({variationId:l,imageUrl:m,startTime:a,endTime:w.startTime}),a=Math.max(a,w.startTime),l=w.variationId,m=w.imageUrl;return i>a&&r.push({variationId:l,imageUrl:m,startTime:a,endTime:i}),r;}function ii(n,_){for(let e of n)if(_>=e.startTime&&_<e.endTime)return e.imageUrl;return n.length?n[n.length-1].imageUrl:null;}var Ke=50;function Ee(n,_){let e=Math.floor(_*1e3);return n.map(i=>({startTime:Math.max(0,Math.floor(i.startTime*1e3)),endTime:Math.min(Math.floor(i.endTime*1e3),e)})).filter(i=>i.endTime>i.startTime).sort((i,t)=>i.startTime-t.startTime);}function fi(n){return n.reduce((_,e)=>_+(e.endTime-e.startTime),0)/1e3;}function Si(n,_){let e=[],i=0;for(let t of _){let r=t.startTime/1e3,a=t.endTime/1e3;for(let l of n){let m=Math.max(l.startTime,r),w=Math.min(l.endTime,a);w<=m||e.push({variationId:l.variationId,imageUrl:l.imageUrl,startTime:i+(m-r),endTime:i+(w-r)});}i+=a-r;}return Ci(e);}function Ci(n){return n.reduce((_,e)=>{let i=_[_.length-1];return i&&i.variationId===e.variationId?(i.endTime=e.endTime,_):(_.push(b({},e)),_);},[]);}function ke(n){let{segments:_,audioDuration:e,voiceTrimRanges:i}=n,t=i?.length?Si(_,i):_,r=i?.length?fi(i):e,a=t.map(l=>x(b({},l.variationId?{variationId:l.variationId}:{}),{startSec:l.startTime,endSec:l.endTime}));return a.length&&(a[0].startSec=0,a[a.length-1].endSec=r),a;}E();z();le();E();z();var wi=["anchor"];function bi(n,_){n&1&&C(0,"span",6);}function yi(n,_){n&1&&C(0,"span",6);}function xi(n,_){if(n&1){let e=T();d(0,"div",7),v("click",function(t){h(e);let r=o();return u(r.onOverlayClick(t));}),d(1,"lib-thumbnail",8),v("clicked",function(){h(e);
3let t=o();return u(t.onOverlaySelect());})("closeClick",function(){h(e);let t=o();return u(t.onCloseClick());}),p()();}if(n&2){let e=_.ngIf,i=o();re("top",e.top,"px")("left",e.left,"px"),H("marker-chip__overlay--selectable",i.selectable),s(),c("input1",i.marker.imageUrl)("close",i.removable);}}var ri=(()=>{class n{constructor(){this.activeMarkerId=null,this.removable=!0,this.selectable=!0,this.showBars=!0,this.chipClick=new k(),this.removeMarker=new k(),this.overlaySelect=new k(),this.markerAriaLabel="Camera angle marker",this.overlayPosition=I(null),this.scrollListenerCleanup=null;}static{this.OVERLAY_WIDTH=90;}static{this.OVERLAY_HEIGHT=120;}static{this.ROW_TOP_OFFSET=6;}static{this.HEADER_CLEARANCE=68;}static{this.VIEWPORT_MARGIN=12;}get isOpen(){return this.activeMarkerId===this.marker.id;}ngOnChanges(e){e.activeMarkerId&&(this.isOpen?this.openOverlay():this.closeOverlay());}ngOnDestroy(){this.detachScrollListener();}onChipClick(e){e.stopPropagation(),this.chipClick.emit(this.marker.id);}onOverlayClick(e){e.stopPropagation();}onCloseClick(){this.removeMarker.emit(this.marker.id);}onOverlaySelect(){this.selectable&&this.overlaySelect.emit(this.marker.id);}openOverlay(){requestAnimationFrame(()=>{this.isOpen&&(this.overlayPosition.set(this.computePosition()),this.attachScrollListener());});}closeOverlay(){this.overlayPosition.set(null),this.detachScrollListener();}computePosition(){let e=this.anchorRef.nativeElement.getBoundingClientRect(),i=n.OVERLAY_WIDTH,t=n.OVERLAY_HEIGHT,r=n.VIEWPORT_MARGIN,a=e.top-n.ROW_TOP_OFFSET;a=Math.max(n.HEADER_CLEARANCE,a),a=Math.min(a,window.innerHeight-t-r);let l=e.left,m=window.innerWidth-i-r;return l=Math.min(Math.max(r,l),m),{top:a,left:l};}attachScrollListener(){if(this.scrollListenerCleanup)return;let e=()=>this.chipClick.emit(this.marker.id);window.addEventListener("scroll",e,{capture:!0,passive:!0}),this.scrollListenerCleanup=()=>window.removeEventListener("scroll",e,{capture:!0});}detachScrollListener(){this.scrollListenerCleanup?.(),this.scrollListenerCleanup=null;}static{this.ɵfac=function(i){return new(i||n)();};}static{this.ɵcmp=P({type:n,selectors:[["app-camera-angle-marker-chip"]],viewQuery:function(i,t){if(i&1&&j(wi,7),i&2){let r;X(r=K())&&(t.anchorRef=r.first);}},inputs:{marker:"marker",activeMarkerId:"activeMarkerId",removable:"removable",selectable:"selectable",showBars:"showBars"},outputs:{chipClick:"chipClick",removeMarker:"removeMarker",overlaySelect:"overlaySelect"},standalone:!0,features:[ge,M],decls:7,vars:7,consts:[["anchor",""],[1,"marker-chip"],["class","marker-chip__bar",4,"ngIf"],["type","button",1,"marker-chip__avatar-btn",3,"click"],["alt","",1,"marker-chip__avatar",3,"src"],["class","marker-chip__overlay",3,"marker-chip__overlay--selectable","top","left","click",4,"ngIf"],[1,"marker-chip__bar"],[1,"marker-chip__overlay",3,"click"],["type","rectangle","size","small","width","90px","height","120px","objectFit","cover",3,"clicked","closeClick","input1","close"]],template:function(i,t){if(i&1){let r=T();d(0,"div",1),y(1,bi,1,0,"span",2),d(2,"button",3,0),v("click",function(l){return h(r),u(t.onChipClick(l));}),C(4,"img",4),p(),y(5,yi,1,0,"span",2)(6,xi,2,8,"div",5),p();}i&2&&(H("marker-chip--open",t.isOpen),s(),c("ngIf",t.showBars),s(),B("aria-label",t.markerAriaLabel),s(2),c("src",t.marker.thumbnailUrl||t.marker.imageUrl,$),s(),c("ngIf",t.showBars),s(),c("ngIf",t.isOpen&&t.overlayPosition()));},dependencies:[V,U,ft],styles:[".marker-chip[_ngcontent-%COMP%]{position:relative;display:inline-flex;align-items:center;gap:4px;vertical-align:middle}.marker-chip__bar[_ngcontent-%COMP%]{width:2px;height:22px;border-radius:2px;background-color:#4481fd;opacity:.45}.marker-chip__avatar-btn[_ngcontent-%COMP%]{display:inline-flex;padding:0;border:none;background:transparent;cursor:pointer;border-radius:8px;overflow:hidden;box-shadow:0 0 0 1px #4481fd59}.marker-chip__avatar-btn[_ngcontent-%COMP%]:hover .marker-chip__avatar[_ngcontent-%COMP%]{width:34px}.marker-chip__avatar[_ngcontent-%COMP%]{display:block;width:28px;height:28px;object-fit:cover;border-radius:8px;transition:width .15s ease}.marker-chip--open[_ngcontent-%COMP%] .marker-chip__avatar-btn[_ngcontent-%COMP%]{box-shadow:0 0 0 2px #4481fd}.marker-chip--open[_ngcontent-%COMP%] .marker-chip__bar[_ngcontent-%COMP%]{opacity:.8}.marker-chip__overlay[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_marker-overlay-in .18s cubic-bezier(.16,1,.3,1);transform-origin:top left;position:fixed;z-index:1100}.marker-chip__overlay--selectable[_ngcontent-%COMP%]{cursor:pointer}@keyframes _ngcontent-%COMP%_marker-overlay-in{0%{opacity:0;transform:translateY(6px) scale(.92)}to{opacity:1;transform:translateY(0) scale(1)}}"],changeDetection:0});}}return n;})();E();z();ut();le();Ne();oe();ie();E();z();ut();function Ti(n,_){if(n&1){let e=T();d(0,"button",15),v("click",function(){h(e);
3let t=o(4);return u(t.startEditName());}),C(1,"img",16),p();}if(n&2){let e=o(4);B("aria-label","Rename portrait"),s(),c("src",e.editIconUrl,$);}}function Ai(n,_){if(n&1&&(Z(0),d(1,"span",13),A(2),p(),y(3,Ti,2,2,"button",14),Q()),n&2){let e=o().ngIf,i=o(2);s(2),R(e.title),s(),c("ngIf",i.isOwnPortrait());}}function Ei(n,_){if(n&1){let e=T();d(0,"input",17,3),v("ngModelChange",function(t){h(e);let r=o(3);return u(r.editedName.set(t));})("keydown.enter",function(){h(e);let t=o(3);return u(t.commitName());})("keydown.escape",function(){h(e);let t=o(3);return u(t.cancelEditName());})("blur",function(){h(e);let t=o(3);return u(t.commitName());}),p();}if(n&2){let e=o(3);c("ngModel",e.editedName());}}function ki(n,_){if(n&1&&(Z(0),y(1,Ai,4,2,"ng-container",12)(2,Ei,2,1,"ng-template",null,2,Re),Q()),n&2){let e=Me(3),i=o(2);s(),c("ngIf",!i.isEditingName())("ngIfElse",e);}}function Ii(n,_){if(n&1){let e=T();Z(0),d(1,"aside",6)(2,"header",7)(3,"h2",8),L(4,4),p(),d(5,"lib-button-icon",9),v("clicked",function(){h(e);let t=o();return u(t.onClose());}),p()(),d(6,"portrait-variants-panel",10),v("variantSelected",function(t){h(e);let r=o();return u(r.onAddVariant(t));})("uploadStarted",function(){h(e);let t=o();return u(t.onUploadStarted());})("uploadFinished",function(t){h(e);let r=o();return u(r.onUploadFinished(t));}),d(7,"div",11,1),y(9,ki,4,2,"ng-container",5),p()()(),Q();}if(n&2){let e=o(),i=Me(2);s(),H("is-closing",e.isClosing()),s(3),he(e.drawerTitle),ue(4),s(),c("iconContent",e.closeIconUrl),s(),c("subject",e.subject())("canManage",e.isOwnPortrait())("showDelete",!1)("readyCardTemplate",i),s(3),c("ngIf",e.selectedPortrait());}}function Pi(n,_){if(n&1){let e=T();d(0,"div",18)(1,"div",19),C(2,"img",20),d(3,"button",21),v("click",function(){let t=h(e).$implicit,r=o();return u(r.onAddVariant(t));}),p()(),d(4,"span",22),A(5),p()();}if(n&2){let e=_.$implicit,i=o();c("draggable",!0)("dropData",e)("imageData",e.thumbnailUrl||e.imageUrl),s(2),c("src",e.thumbnailUrl||e.imageUrl,$)("alt",e.title),s(),H("fade",i.recentlyAddedVariationId()===e.variationId),B("aria-label","Add camera angle at playhead"),s(2),R(e.title);}}var qe=(()=>{class n{constructor(){this.wizardState=g(D),this.requestsService=g(se),this.notifier=g(W),this.eventsService=g(N),this.variantsService=g(Ae),this.open=!1,this.closing=new k(),this.closed=new k(),this.addVariant=new k(),this.drawerTitle="Avatar Variants",this.renameErrorMessage="Failed to rename portrait. Please try again.",this.closeIconUrl="/img/icon-library/basic-ui/close-regular.svg",this.editIconUrl="/img/icon-library/actions/edit-stroke-small.svg",this.isClosing=I(!1),this.isEditingName=I(!1),this.editedName=I(""),this.recentlyAddedVariationId=I(null),this.selectedPortrait=this.wizardState.select("selectedPortrait"),this.isOwnPortrait=f(()=>this.selectedPortrait()?.source==="media library"),this.subject=f(()=>{let e=this.selectedPortrait();return e?{id:e.id,title:e.title,imageUrl:e.imageUrl,thumbnailUrl:e.thumbnailUrl}:null;}),this.addedFlashTimer=null;}static{this.CLOSE_ANIMATION_MS=240;}static{this.ADDED_FLASH_MS=1500;}ngOnChanges(e){let i=e.open;i&&i.currentValue&&!i.previousValue&&(this.isClosing.set(!1),this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoAnglesAddOpen,x(b({},this.wizardState.buildAnglesAttrs()),{numVariations:this.selectedPortrait()?.variantsCount??0})));}ngOnDestroy(){this.addedFlashTimer&&clearTimeout(this.addedFlashTimer);}onEscape(e){if(!e.defaultPrevented){if(this.isEditingName()){this.cancelEditName();return;}this.open&&this.onClose();}}onClose(){this.isClosing()||(this.isClosing.set(!0),this.closing.emit(),setTimeout(()=>{this.isEditingName.set(!1),this.isClosing.set(!1),this.closed.emit();},n.CLOSE_ANIMATION_MS));}startEditName(){let e=this.selectedPortrait();!e||!this.isOwnPortrait()||(this.editedName.set(e.title),this.isEditingName.set(!0));}cancelEditName(){this.isEditingName.set(!1);}commitName(){return G(this,null,function*(){if(!this.isEditingName())return;let e=this.selectedPortrait();if(this.isEditingName.set(!1),!e)return;let i=this.editedName().trim();if(!i||i===e.title)return;let t=e.title;this.wizardState.setSelectedPortrait(x(b({},e),{title:i}));try{yield this.requestsService.updateAsset({assetId:e.id,title:i});}catch(r){this.wizardState.setSelectedPortrait(x(b({},e),{title:t})),this.notifier.error(r?.responseJSON?.msg||this.renameErrorMessage);}});}onAddVariant(e){this.addVariant.emit(e),this.flashAdded(e.variationId);}onUploadStarted(){this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoAnglesAddNewStart,x(b({},this.wizardState.buildAnglesAttrs()),{numVariations:this.variantsService.variants().length}));}onUploadFinished(e){this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoAnglesAddNewFinish,x(b({},this.wizardState.buildAnglesAttrs()),{variationSource:"upload",variationName:e.title,numVariations:this.variantsService.variants().length}));}flashAdded(e){this.recentlyAddedVariationId.set(e),this.addedFlashTimer&&clearTimeout(this.addedFlashTimer),this.addedFlashTimer=setTimeout(()=>{this.recentlyAddedVariationId.set(null),this.addedFlashTimer=null;},n.ADDED_FLASH_MS);}static{this.ɵfac=function(i){return new(i||n)();};}static{this.ɵcmp=P({type:n,selectors:[["app-avatar-variants-drawer"]],hostBindings:function(i,t){i&1&&v("keydown.escape",function(a){return t.onEscape(a);},!1,ce);},inputs:{open:"open"},outputs:{closing:"closing",closed:"closed",addVariant:"addVariant"},standalone:!0,features:[ge,M],decls:3,vars:1,consts:()=>{let e;return e=""+"\uFFFD0\uFFFD"+"",[["readyCard",""],["panelSubjectTitle",""],["editNameTpl",""],["nameInput",""],e,[4,"ngIf"],[1,"variants-drawer"],[1,"variants-drawer__header"],[1,"variants-drawer__title"],["size","md","variant","tertiary",3,"clicked","iconContent"],[3,"variantSelected","uploadStarted","uploadFinished","subject","canManage","showDelete","readyCardTemplate"],["panelSubjectTitle","",1,"variants-drawer__name-line"],[4,"ngIf","ngIfElse"],[1,"variants-drawer__name"],["type","button","class","variants-drawer__pencil",3,"click",4,"ngIf"],["type","button",1,"variants-drawer__pencil",3,"click"],["alt","",3,"src"],["type","text","autofocus","",1,"variants-drawer__name-input",3,"ngModelChange","keydown.enter","keydown.escape","blur","ngModel"],["dragWrapper","",1,"variants-drawer__card",3,"draggable","dropD
3ata","imageData"],[1,"variants-drawer__card-image"],[3,"src","alt"],["type","button",1,"variants-drawer__card-add",3,"click"],[1,"variants-drawer__card-label"]];},template:function(i,t){i&1&&y(0,Ii,10,9,"ng-container",5)(1,Pi,6,9,"ng-template",null,0,Re),i&2&&c("ngIf",t.open||t.isClosing());},dependencies:[V,U,ht,_t,mt,gt,Ce,Te,Nt],styles:['.variants-drawer[_ngcontent-%COMP%]{position:fixed;top:calc(57px + var(--sudo-bar-height, 0px));right:0;bottom:0;width:min(384px,100vw);background:#fff;-webkit-backdrop-filter:blur(65px);backdrop-filter:blur(65px);border-radius:24px 0 0 24px;box-shadow:0 8px 40px #0003;z-index:1101;display:flex;flex-direction:column;overflow:hidden;animation:_ngcontent-%COMP%_slideIn .24s cubic-bezier(.16,1,.3,1)}.variants-drawer.is-closing[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_slideOut .24s cubic-bezier(.7,0,.84,0) forwards}.variants-drawer__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 24px;flex-shrink:0;border-bottom:1px solid #e1e7f0}.variants-drawer__title[_ngcontent-%COMP%]{margin:0;font-size:18px;font-weight:600;line-height:1.4;color:#253658}.variants-drawer__name-line[_ngcontent-%COMP%]{display:flex;align-items:center;gap:2px;flex:1;min-width:0}.variants-drawer__name[_ngcontent-%COMP%]{font-size:14px;font-weight:500;line-height:1.4;letter-spacing:-.14px;color:#253658;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.variants-drawer__pencil[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:2px;border:none;background:transparent;cursor:pointer;line-height:0;flex-shrink:0}.variants-drawer__pencil[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:16px;height:16px}.variants-drawer__pencil[_ngcontent-%COMP%]:hover{opacity:.7}.variants-drawer__name-input[_ngcontent-%COMP%]{width:100%;font-size:14px;font-weight:500;color:#253658;border:1px solid #4481fd;border-radius:6px;padding:3px 8px;outline:none}.variants-drawer__card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px;min-width:0}.variants-drawer__card-image[_ngcontent-%COMP%]{position:relative;width:100%;aspect-ratio:9/16;border-radius:16px;overflow:hidden;background:#ebf2ff;border:1px solid #e5e7eb}.variants-drawer__card-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;display:block}.variants-drawer__card-add[_ngcontent-%COMP%]{position:absolute;top:7px;right:7px;width:22px;height:22px;border-radius:40px;border:none;padding:0;cursor:pointer;background:transparent url(/img/plus-with-background-white-grey.svg) center/cover;transition:opacity .3s ease-in-out}.variants-drawer__card-add[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:0;background:url(/img/selected-asset.svg) center/cover;opacity:0;transition:opacity .3s ease-in-out}.variants-drawer__card-add[_ngcontent-%COMP%]:hover:not(.fade){opacity:.6}.variants-drawer__card-add.fade[_ngcontent-%COMP%]:before{opacity:1}.variants-drawer__card-label[_ngcontent-%COMP%]{font-size:12px;font-weight:500;line-height:1.4;letter-spacing:-.12px;color:#253658;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_slideIn{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes _ngcontent-%COMP%_slideOut{0%{transform:translate(0)}to{transform:translate(100%)}}'],changeDetection:0});}}return n;})();E();E();var ni=(()=>{class n{constructor(e){this.element=e,this.dropEnter=new k(),this.dropLeave=new k(),this.variantDropped=new k(),this.markerDropped=new k(),this.options={},this.onOver=()=>{this.dropEnter.emit();},this.onOut=()=>{this.dropLeave.emit();},this.onDrop=(i,t)=>{let r=jQuery(t.draggable).data("dragData");r&&("kind"in r&&r.kind==="marker-move"?this.markerDropped.emit(r.markerId):this.variantDropped.emit(r));};}ngOnInit(){this.options.tolerance="pointer",this.options.over=this.onOver,this.options.out=this.onOut,this.options.drop=this.onDrop,jQuery(this.element.nativeElement).droppable(this.options);}ngOnDestroy(){let e=jQuery(this.element.nativeElement);e.data("ui-droppable")&&e.droppable("destroy");}static{this.ɵfac=function(i){return new(i||n)(ot(at));};}static{this.ɵdir=nt({type:n,selectors:[["","appWordsDropZone",""]],outputs:{dropEnter:"dropEnter",dropLeave:"dropLeave",variantDropped:"variantDropped",markerDropped:"markerDropped"},standalone:!0});}}return n;})();E();z();var Mi=["audioElement"],Vi=["wordsContainer"],Oi=["transcriptContent"],Ri=["timestampsContainer"],Di=n=>({kind:"marker-move",markerId:n});function zi(n,_){if(n&1){let e=T();d(0,"app-credits-button",40),v("buyCredits",function(){h(e);
3let t=o();return u(t.onBuyCredits());}),p();}if(n&2){let e=o();c("remainingCredits",e.credits.remainingCredits)("totalCredits",e.credits.totalCredits)("loading",e.credits.isCheckingLimits)("tooltipText",e.credits.tooltipText)("showBuyButton",!e.credits.isAIMax&&e.showBuyButton);}}function Ni(n,_){if(n&1&&C(0,"app-skeleton-loader",41),n&2){let e=o();c("wordCount",50)("direction",e.isRTL()?"rtl":"ltr");}}function Gi(n,_){if(n&1&&(d(0,"div",42)(1,"p"),A(2),p()()),n&2){let e=o();s(2),R(e.emptyStateText);}}function Li(n,_){if(n&1&&(d(0,"div",43)(1,"p"),A(2),p()()),n&2){let e=o();s(2),R(e.errorStateText);}}function Ui(n,_){if(n&1&&(d(0,"span",48),A(1),p()),n&2){let e=_.$implicit,i=o(2);re("top",e.top,"px"),s(),ve(" ",i.formatTimestamp(e.time)," ");}}function Wi(n,_){if(n&1){let e=T();d(0,"app-word-chip",52),v("wordClicked",function(t){h(e);let r=o(4);return u(r.onWordClick(t));})("arrowKeyPressed",function(t){h(e);let r=o().$implicit,a=o(3);return u(a.onArrowKeyPressed(r.word,t));}),p();}if(n&2){let e=o().$implicit,i=o(3);c("word",e.word)("currentPlaybackWordIndex",i.currentPlaybackWordIndex());}}function Fi(n,_){if(n&1){let e=T();d(0,"app-gap-bracket",53),v("gapClicked",function(t){h(e);let r=o(4);return u(r.onGapClick(t));}),p();}if(n&2){let e=o().$implicit,i=o(3);c("gap",e.gap)("selectedGapId",i.selectedGapId());}}function $i(n,_){if(n&1&&(Z(0),y(1,Wi,1,2,"app-word-chip",50)(2,Fi,1,2,"app-gap-bracket",51),Q()),n&2){let e=_.$implicit;s(),c("ngIf",e.type==="word"),s(),c("ngIf",e.type==="gap");}}function Bi(n,_){if(n&1&&y(0,$i,3,2,"ng-container",49),n&2){let e=o(2);c("ngForOf",e.wordsWithGaps())("ngForTrackBy",e.trackByGridItem);}}function Hi(n,_){if(n&1){let e=T();d(0,"app-word-chip",52),v("wordClicked",function(t){h(e);let r=o(4);return u(r.onWordClick(t));})("arrowKeyPressed",function(t){h(e);let r=o().$implicit,a=o(3);return u(a.onArrowKeyPressed(r.word,t));}),p();}if(n&2){let e=o().$implicit,i=o(3);c("word",e.word)("currentPlaybackWordIndex",i.currentPlaybackWordIndex());}}function ji(n,_){if(n&1){let e=T();d(0,"app-gap-bracket",53),v("gapClicked",function(t){h(e);let r=o(4);return u(r.onGapClick(t));}),p();}if(n&2){let e=o().$implicit,i=o(3);c("gap",e.gap)("selectedGapId",i.selectedGapId());}}function Xi(n,_){if(n&1&&(Z(0),y(1,Hi,1,2,"app-word-chip",50)(2,ji,1,2,"app-gap-bracket",51),Q()),n&2){let e=_.$implicit;s(),c("ngIf",e.type==="word"),s(),c("ngIf",e.type==="gap");}}function Ki(n,_){if(n&1&&y(0,Xi,3,2,"ng-container",49),n&2){let e=o(2);c("ngForOf",e.wordsWithIntroOutroGaps())("ngForTrackBy",e.trackByGridItem);}}function qi(n,_){if(n&1){let e=T();d(0,"app-camera-angle-marker-chip",57),v("chipClick",function(t){h(e);let r=o(4);return u(r.onMarkerChipClick(t));}),p();}if(n&2){let e=o().$implicit,i=o(3);c("marker",e.marker)("removable",!1)("selectable",!1)("showBars",!1)("activeMarkerId",i.activeMarkerId());}}function Zi(n,_){if(n&1){let e=T();d(0,"app-camera-angle-marker-chip",58),v("chipClick",function(t){h(e);let r=o(4);return u(r.onMarkerChipClick(t));})("removeMarker",function(t){h(e);let r=o(4);return u(r.onMarkerRemove(t));})("overlaySelect",function(t){h(e);let r=o(4);return u(r.onMarkerOverlaySelect(t));}),p();}if(n&2){let e=o().$implicit,i=o(3);c("dropData",ct(4,Di,e.marker.id))("imageData",e.marker.thumbnailUrl||e.marker.imageUrl)("marker",e.marker)("activeMarkerId",i.activeMarkerId());}}function Qi(n,_){if(n&1){let e=T();d(0,"app-word-chip",52),v("wordClicked",function(t){h(e);let r=o(4);return u(r.onWordClick(t));})("arrowKeyPressed",function(t){h(e);let r=o().$implicit,a=o(3);return u(a.onArrowKeyPressed(r.word,t));}),p();}if(n&2){let e=o().$implicit,i=o(3);c("word",e.word)("currentPlaybackWordIndex",i.currentPlaybackWordIndex());}}function Yi(n,_){if(n&1&&(Z(0),y(1,qi,1,5,"app-camera-angle-marker-chip",55)(2,Zi,1,6,"app-camera-angle-marker-chip",56)(3,Qi,1,2,"app-word-chip",50),Q()),n&2){let e=_.$implicit;s(),c("ngIf",e.type==="base"),s(),c("ngIf",e.type==="marker"),s(),c("ngIf",e.type==="word");}}function Ji(n,_){if(n&1&&(C(0,"span",54),y(1,Yi,4,3,"ng-container",49),C(2,"span",54)),n&2){let e=o(2);s(),c("ngForOf",e.wordsWithMarkers())("ngForTrackBy",e.trackByGridItem);}}function er(n,_){if(n&1){let e=T();d(0,"div",44)(1,"div",45,2),y(3,Ui,2,3,"span",46),p(),d(4,"div",47,3),v("dropEnter",function(){h(e);
3let t=o();return u(t.onDropEnter());})("dropLeave",function(){h(e);let t=o();return u(t.onDropLeave());})("variantDropped",function(t){h(e);let r=o();return u(r.onVariantDropped(t));})("markerDropped",function(t){h(e);let r=o();return u(r.onMarkerDropped(t));})("click",function(t){h(e);let r=o();return u(r.onWordsContainerClick(t));}),y(6,Bi,1,2)(7,Ki,1,2)(8,Ji,3,2),p()();}if(n&2){let e,i=o();B("dir",i.isRTL()?"rtl":"ltr"),s(3),c("ngForOf",i.rowTimestamps()),s(),H("preview-mode-disabled",i.editorMode()==="preview")("gap-review-mode",i.editorMode()==="gap-review"),B("dir",i.isRTL()?"rtl":"ltr"),s(2),st(6,(e=i.editorMode())==="gap-review"?6:e==="preview"?7:8);}}function tr(n,_){if(n&1&&C(0,"div",59),n&2){let e=_.ngIf;re("left",e.left,"px")("top",e.top,"px")("height",e.height,"px");}}var ai=(()=>{class n{static{this.INTRO_WORD_INDEX=-1;}static{this.OUTRO_WORD_INDEX=-2;}static{this.FIRST_WORD_INDEX=0;}static{this.RTL_SAMPLE_SIZE=10;}static{this.RESIZE_DEBOUNCE_MS=100;}static{this.ROW_GROUP_TOLERANCE_PX=8;}static{this.SUPPORT_WIDGET_OWNER="camera-angles";}constructor(){this.supportWidget=g(Tt),this.wizardState=g(D),this.editorState=g(Fe),this.videoService=g(We),this.timelineService=g(Le),this.gapDetectionService=g(Ue),this.historyService=g($e),this.segmentationService=g(Ge),this.outputGenerator=g(Be),this.timestampService=g(He),this.scrollService=g(je),this.notifier=g(W),this.eventsService=g(N),this.credits=null,this.showBuyButton=!0,this.generateClick=new k(),this.back=new k(),this.buyCredits=new k(),this.headerTitle="Talking AI Video",this.generateLabel="Generate Video",this.currentPortraitLabel="Current Portrait",this.emptyStateText="No transcript available for this voiceover.",this.errorStateText="Failed to load the voiceover transcript.",this.fullScreenIconUrl="/img/icons/icons-full-screen-enter-black.svg",this.exitFullscreenIconUrl="/img/icons/icons-full-screen-exit-black.svg",this.undoIconUrl="/img/icon-library/symbols/Undo.svg",this.redoIconUrl="/img/icon-library/symbols/redo-small.svg",this.breadCrumbs=[new Y("projects-icon","Home","/boards",!1),new Y("",this.headerTitle,"",!1),new Y("","Camera Angles","",!0)],this.playIconUrl="/img/icon-library/video-music/play-filled-small.svg",this.pauseIconUrl="/img/icon-library/video-music/pause-filled-small.svg",this.volumeOnIconUrl="/img/icon-library/music/AI voices.svg",this.infoIconUrl="/img/icon-library/symbols/info-2-small.svg",this.isFullscreen=!1,this.isMuted=I(!1),this.isDrawerOpen=I(!1),this.isDrawerClosing=I(!1),this.isDrawerPushed=f(()=>this.isDrawerOpen()&&!this.isDrawerClosing()),this.activeMarkerId=I(null),this.dropIndicator=I(null),this.wordRects=[],this.dropCandidateIndex=-1,this.lastDragPointer=null,this.dragMoveHandler=null,this.dragScrollHandler=null,this.destroy$=new me(),this.resizeSubscription=null,this.scrollListenerCleanup=null,this.scrollListenerAttached=!1,this.activeAnimationFrames=[],this.audioInitialized=!1,this.selectedPortrait=this.wizardState.select("selectedPortrait"),this.markers=this.wizardState.select("cameraAngleMarkers"),this.variations=this.wizardState.select("voiceVariations"),this.selectedVariationId=this.wizardState.select("selectedVariationId"),this.selectedVariation=f(()=>{let e=this.selectedVariationId();return this.variations().find(i=>i.id===e)??null;}),this.audioUrl=f(()=>this.selectedVariation()?.audioUrl??""),this.segmentationUrl=f(()=>this.selectedVariation()?.segmentationUrl??""),this.hasSegmentation=f(()=>this.segmentationUrl().length>0),this.words=this.editorState.words,this.currentPlaybackWordIndex=this.editorState.currentPlaybackWordIndex,this.selectedGapId=this.gapDetectionService.selectedGapId,this.loadingState=this.segmentationService.loadingState,this.error=this.segmentationService.error,this.rowTimestamps=this.timestampService.rowTimestamps,this.isLoading=f(()=>this.loadingState()==="loading"),this.hasError=f(()=>this.loadingState()==="error"),this.hasWords=f(()=>this.words().length>0),this.isGapReviewMode=this.editorState.isGapReviewMode,this.isPreviewMode=this.editorState.isPreviewMode,this.isPlaying=this.videoService.isPlaying,this.formattedCurrentTime=this.videoService.formattedCurrentTime,this.formattedDuration=this.videoService.formattedDuration,this.currentTime=this.videoService.currentTime,this.duration=this.videoService.duration,this.canUndo$=ze(this.historyService.canUndo),this.canRedo$=ze(this.historyService.canRedo),this.isRTL=f(()=>{let e=this.words();if(!e||e.length===0)return!1;let i=e.slice(0,n.RTL_SAMPLE_SIZE).map(t=>t.word);
3return Yt(i,n.RTL_SAMPLE_SIZE);}),this.sortedMarkers=f(()=>[...this.markers()].sort((e,i)=>e.startTime-i.startTime)),this.cameraAngleSegments=f(()=>pe({markers:this.sortedMarkers(),baseImageUrl:this.selectedPortrait()?.imageUrl??"",audioDuration:this.videoService.duration()||Number.MAX_SAFE_INTEGER})),this.seekProgressPercent=f(()=>{let e=this.videoService.duration();return e?`${Math.min(100,this.videoService.currentTime()/e*100)}%`:"0%";}),this.currentImageUrl=f(()=>{let e=this.selectedPortrait()?.imageUrl??"";return ii(this.cameraAngleSegments(),this.videoService.currentTime())??e;}),this.editorMode=f(()=>this.isGapReviewMode()?"gap-review":this.isPreviewMode()?"preview":"normal"),this.baseMarker=f(()=>{let e=this.selectedPortrait();return e?{id:"base-portrait",variationId:"",imageUrl:e.imageUrl,thumbnailUrl:e.thumbnailUrl??e.imageUrl,startWordIndex:-1,startTime:0}:null;}),this.wordsWithMarkers=f(()=>{let e=this.words(),i=this.markers(),t=[],r=this.baseMarker();r&&e.length>0&&t.push({type:"base",marker:r});let a=new Map(),l=[];for(let m of i)if(m.startWordIndex<e.length){let w=a.get(m.startWordIndex)??[];w.push(m),a.set(m.startWordIndex,w);}else l.push(m);for(let m of e){let w=a.get(m.index);w&&w.forEach(O=>t.push({type:"marker",marker:O})),t.push({type:"word",word:m});}return l.forEach(m=>t.push({type:"marker",marker:m})),t;}),this.wordsWithGaps=f(()=>{let e=this.words();if(!this.isGapReviewMode())return e.map(m=>({type:"word",word:m}));if(this.gapDetectionService.gapsWithStates().length===0)return e.map(m=>({type:"word",word:m}));let t=this.gapDetectionService.getIntroGap(),r=this.gapDetectionService.getOutroGap(),a=this.gapDetectionService.getGapMapByBeforeWordIndex(),l=[];t&&e.length>0&&l.push({type:"gap",gap:t});for(let m of e)l.push({type:"word",word:m}),m.index>=0&&a.has(m.index)&&l.push({type:"gap",gap:a.get(m.index)});return r&&e.length>0&&l.push({type:"gap",gap:r}),l;}),this.wordsWithIntroOutroGaps=f(()=>{let e=this.words();if(!this.isPreviewMode()||e.length===0)return e.map(l=>({type:"word",word:l}));let i=this.gapDetectionService.gapsWithStates(),t=i.length>0?i[0]:void 0,r=i.length>1?i[i.length-1]:void 0,a=[];return t&&a.push({type:"gap",gap:t}),e.forEach(l=>a.push({type:"word",word:l})),r&&r.id!==t?.id&&a.push({type:"gap",gap:r}),a;}),this.handleFullscreenChange=()=>{this.isFullscreen=!!document.fullscreenElement;},F(()=>{this.wizardState.setSelectedVariationDuration(this.videoService.duration());},{allowSignalWrites:!0}),F(()=>{let e=this.videoService.currentTime();this.videoService.isPlaying()?this.editorState.updateCurrentPlaybackWord(e):this.editorState.clearCurrentPlaybackWord();},{allowSignalWrites:!0}),F(()=>{let e=this.words(),i=this.loadingState();if(e.length>0&&i==="success"){let t=requestAnimationFrame(()=>{this.calculateRowTimestamps(),this.activeAnimationFrames=this.activeAnimationFrames.filter(r=>r!==t);});this.activeAnimationFrames.push(t);}else this.timestampService.clear();},{allowSignalWrites:!0}),F(()=>{let e=this.words();e.length>0&&this.loadingState()==="success"&&this.gapDetectionService.updateWords(e);},{allowSignalWrites:!0}),F(()=>{let e=this.currentPlaybackWordIndex();this.videoService.isPlaying()&&e!==null&&!this.scrollService.isAutoScrollPaused()&&this.transcriptContentRef?.nativeElement&&this.wordsContainerRef?.nativeElement&&this.scrollService.scheduleScrollToWord(e,this.transcriptContentRef.nativeElement,this.wordsContainerRef.nativeElement,this.words());}),F(()=>{if(this.hasWords()&&!this.scrollListenerAttached){let i=requestAnimationFrame(()=>{this.transcriptContentRef?.nativeElement&&!this.scrollListenerAttached&&(this.scrollListenerCleanup=this.scrollService.initializeScrollListener(this.transcriptContentRef.nativeElement),this.scrollListenerAttached=!0),this.activeAnimationFrames=this.activeAnimationFrames.filter(t=>t!==i);});this.activeAnimationFrames.push(i);}});}ngOnInit(){this.supportWidget.suppress(n.SUPPORT_WIDGET_OWNER),this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoAnglesScreen,x(b({},this.wizardState.buildAnglesAttrs()),{hasAccess:!0})),this.editorState.analyticsContext={source:"portrait2video",storyId:this.wizardState.select("storyId")()??"",takeId:""},document.addEventListener("fullscreenchange",this.handleFullscreenChange),this.loadSegmentation();}ngAfterViewInit(){this.initializeAudioPlayer(),typeof window<"u"&&(this.resizeSubscription=Je(window,"resize",{passive:!0}).pipe(tt(n.RESIZE_DEBOUNCE_MS),te(this.destroy$)).subscribe(()=>this.calculateRowTimestamps())),this.wordsContainerRef?.nativeElement&&this.timestampService.setupRowDetection(this.wordsContainerRef.nativeElement,()=>this.calculateRowTimestamps());}ngOnDestroy(){this.supportWidget.release(n.SUPPORT_WIDGET_OWNER),document.removeEventListener("fullscreenchange",this.handleFullscreenChange),this.scrollListenerCleanup?.(),this.scrollListenerCleanup=null,this.scrollService.cancelAllScheduledScrolls(),this.timestampService.cleanup(),this.timelineService.cleanup(),this.videoService.destroy(),this.resizeSubscription?.unsubscribe(),this.activeAnimationFrames.forEac
3h(e=>cancelAnimationFrame(e)),this.activeAnimationFrames=[],this.clearDropState(),this.destroy$.next(),this.destroy$.complete();}initializeAudioPlayer(){if(this.audioInitialized)return;let e=this.audioUrl(),i=this.audioElementRef?.nativeElement;!e||!i||(this.audioInitialized=!0,this.videoService.initializePlayer(i,e));}loadSegmentation(){let e=this.segmentationUrl();e&&this.segmentationService.loadSegmentation(e).subscribe({next:()=>{let i=this.segmentationService.words(),t=this.segmentationService.fillerWords();!i||i.length===0||(this.editorState.initializeWords(i),this.gapDetectionService.initializeWords(i,t),this.historyService.setInitialState(this.captureCombinedSnapshot()));},error:()=>{}});}calculateRowTimestamps(){if(!this.wordsContainerRef?.nativeElement||!this.timestampsContainerRef?.nativeElement)return;let e=this.words();if(!e||e.length===0){this.timestampService.clear();return;}this.timestampService.calculateRowTimestamps(e,this.wordsContainerRef.nativeElement,this.timestampsContainerRef.nativeElement,this.isRTL());}formatTimestamp(e){let i=Math.floor(e/60),t=Math.floor(e%60);return`${i.toString().padStart(2,"0")}:${t.toString().padStart(2,"0")} s`;}onGenerate(){this.persistTrimKeptRanges(),this.generateClick.emit();}persistTrimKeptRanges(){let e=this.outputGenerator.generateOutput(),i=this.videoService.duration();if(!e||this.isFullAudioRange(e,i)){this.wizardState.setTrimKeptRanges(null);return;}this.wizardState.setTrimKeptRanges(e.map(t=>({startTime:t.startTime,endTime:t.endTime})));}isFullAudioRange(e,i){if(e.length!==1)return!1;let[t]=e,r=.05;return t.startTime<=r&&(i<=0||t.endTime>=i-r);}onBack(){this.back.emit();}onBreadCrumbClick(e){e.label===this.headerTitle&&this.back.emit();}onBuyCredits(){this.buyCredits.emit();}onTogglePlay(){this.videoService.togglePlayPause();}onSeek(e){let i=Number(e.target.value);this.videoService.seek(i);}onToggleMute(){let e=!this.isMuted();this.isMuted.set(e);let i=this.audioElementRef?.nativeElement;i&&(i.muted=e);}toggleFullscreen(){let e=document.documentElement;this.isFullscreen?document.exitFullscreen():(e.requestFullscreen||e.webkitRequestFullscreen)?.call(e);}onAddVariant(){if(this.isDrawerOpen()){this.variantsDrawerRef?.onClose();return;}this.isDrawerClosing.set(!1),this.isDrawerOpen.set(!0);}onDrawerClosing(){this.isDrawerClosing.set(!0);}onDrawerClosed(){this.isDrawerOpen.set(!1),this.isDrawerClosing.set(!1);}onToolbarAction(e){}onMarkerChipClick(e){this.activeMarkerId.update(i=>i===e?null:e);}onMarkerOverlaySelect(e){let i=this.segmentationService.words();if(!i.length)return;let t=this.sortedMarkers(),r=i.length-1,a=0,l=i.length;if(e==="base-portrait")l=t.length?Math.min(t[0].startWordIndex,i.length):i.length;else{let w=t.findIndex(O=>O.id===e);if(w===-1)return;a=Math.min(t[w].startWordIndex,r),l=w+1<t.length?Math.min(t[w+1].startWordIndex,i.length):i.length;}let m=Math.max(a,Math.min(l-1,r));this.editorState.clearSelection(),this.editorState.selectWord(i[a]),this.editorState.selectWord(i[m]),this.activeMarkerId.set(null);}onMarkerRemove(e){this.pushCurrentState(),this.wizardState.removeCameraAngleMarker(e),this.activeMarkerId()===e&&this.activeMarkerId.set(null);}onDrawerAddVariant(e){let i=this.playheadWordIndex();i!==null&&this.addMarkerAt(e,i);}onDropEnter(){this.cacheWordRects(),this.attachDragListeners();}onDropLeave(){this.clearDropState();}onVariantDropped(e){let i=this.dropCandidateIndex;this.clearDropState(),!(i<0)&&this.addMarkerAt(e,i);}onMarkerDropped(e){let i=this.dropCandidateIndex;if(this.clearDropState(),i<0)return;let t=this.markers().find(m=>m.id===e);if(!t||t.startWordIndex===i)return;let r=this.words();if(r.length===0)return;let a=r[i]??r[r.length-1],l=x(b({},t),{startWordIndex:i,startTime:a.start});this.canPlaceMarker(l)&&(this.pushCurrentState(),this.wizardState.addCameraAngleMarker(l));}addMarkerAt(e,i){let t=this.words();if(t.length===0)return;let r=t[i]??t[t.length-1],a={id:crypto.randomUUID(),variationId:e.variationId,imageUrl:e.imageUrl,thumbnailUrl:e.thumbnailUrl,startWordIndex:i,startTime:r.start};this.canPlaceMarker(a)&&(this.pushCurrentState(),this.wizardState.addCameraAngleMarker(a),this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoAnglesAddFinish,x(b({},this.wizardState.buildAnglesAttrs()),{variationSource:this.wizardState.mapVariationSource(),variationName:e.title})));}canPlaceMarker(e){let i=this.videoService.duration();if(!i)return!0;let t=[...this.markers().filter(m=>m.id!==e.id&&m.startWordIndex!==e.startWordIndex),e],a=this.outputGenerator.generateOutput()?.map(m=>({startTime:m.startTime,endTime:m.endTime}))??[];return ke({segments:pe({markers:t,baseImageUrl:this.selectedPortrait()?.imageUrl??"",audioDuration:i}),audioDuration:i,voiceTrimRanges:a.length?Ee(a,i):null}).length>Ke?(this.notifier.warn("You can use up to "+Ke+" camera angles in one video."),!1):!0;}playheadWordIndex(){let e=this.words();if(e.length===0)return null;let i=this.videoService.currentTime();return(e.find(r=>r.start>=i)??e[e.length-1]).index;}attachDragListeners(){this.dragMoveHandler||(this.dragMoveHandler=e=>{this.lastDragPointer={x:e.clientX,y:e.clientY},this.updateIndicator(e.clientX,e.clientY);},document.addEventListener("mousemove",this.dragMoveHandler,{passive:!0})),this.dragScrollHandler||(this.dragScrollHandler=()=>{this.cacheWordRects(),this.lastDragPointer&&this.updateIndicator(this.lastDragPointer.x,this.lastDragPointer.y);},window.addEventListener("scroll",this.dragScrollHandler,{capture:!0,passive:!0}),window.addEventListener("resize",this.dragScrollHandler,{passive:!0}));}clearDropState(){this.dropIndicator.set(null),this.dropCandidateIndex=-1,this.lastDragPointer=null,this.wordRects=[],this.dragMoveHandler&&(document.removeEventListener("mousemove",this.dragMoveHandler),this.dragMoveHandler=null),this.dragScrollHandler&&(window.removeEventListener("scroll",this.dragScrollHandler,{capture:!0}),window.removeEventListener("resize",this.dragScrollHandler),this.dragScrollHandler=null);}cacheWordRects(){let e=this.wordsContainerRef?.nativeElement;if(!e){this.wordRects=[];return;}let i=Array.from(e.querySelectorAll(".word-chip")),t=[];for(let r of i){let a=Number(r.getAttribute("data-index"));if(!Number.isFinite(a)||a<0)continue;let l=r.getBoundingClientRect();t.push({index:a,left:l.left,right:l.right,top:l.top,bottom:l.bottom});}this.wordRects=t;}updateIndicator(e,i){if(this.wordRects.length===0){this.dropIndicator.set(null),this.dropCandidateIndex=-1;return;}let t=this.groupWordRows(),r=this.pickWordRow(t,i);if(!r||r.chips.length===0)return;let a=this.isRTL(),l=1/0,m=0,w=0;for(let Ie of r.chips){let Ze=a?Ie.right:Ie.left,Qe=Math.abs(e-Ze);Qe<l&&(l=Qe,m=Ze,w=Ie.index);}let O=r.chips[r.chips.length-1],q=a?O.left:O.right,_e=Math.abs(e-q);_e<l&&(l=_e,m=q,w=O.index+1),this.dropCandidateIndex=w,this.dropIndicator.set({left:m,top:r.top,height:r.bottom-r.top});}groupWordRows(){let e=[...this.wordRects].sort((r,a)=>r.top-a.top),i=[],t=n.ROW_GROUP_TOLERANCE_PX;for(let r of e){let a=i[i.length-1];a&&Math.abs(r.top-a.refTop)<=t?(a.chips.push(r),a.top=Math.min(a.top,r.top),a.bottom=Math.max(a.bottom,r.bottom)):i.push({refTop:r.top,top:r.top,bottom:r.bottom,chips:[r]});}
3return i.forEach(r=>r.chips.sort((a,l)=>a.index-l.index)),i;}pickWordRow(e,i){if(e.length===0)return null;for(let a of e)if(i>=a.top&&i<=a.bottom)return a;let t=e[0],r=1/0;for(let a of e){let l=(a.top+a.bottom)/2,m=Math.abs(i-l);m<r&&(r=m,t=a);}return t;}onDocumentClick(){this.activeMarkerId()!==null&&this.activeMarkerId.set(null);}onEscape(){this.activeMarkerId()!==null&&this.activeMarkerId.set(null);}undo(){this.videoService.stop();let e=this.historyService.undo(this.captureCombinedSnapshot());e&&this.restoreState(e);}redo(){this.videoService.stop();let e=this.historyService.redo(this.captureCombinedSnapshot());e&&this.restoreState(e);}restoreState(e){this.editorState.restoreState(e),this.timelineService.restoreHandles(e.startHandle,e.endHandle),e.markers&&this.wizardState.setCameraAngleMarkers(e.markers);}captureCombinedSnapshot(){let e=this.editorState.captureState(this.timelineService.startHandle(),this.timelineService.endHandle());return x(b({},e),{markers:this.markers().map(i=>b({},i))});}onGapClick(e){this.isPreviewMode()&&!this.isGapReviewMode()||this.gapDetectionService.selectGap(e.id);}onWordsContainerClick(e){if(this.isGapReviewMode()){if(e.target.closest("app-gap-bracket"))return;e.stopPropagation(),this.notifier.warn("In this mode you can only select Gaps and Ums.");}}onArrowKeyPressed(e,i){if(this.isPreviewMode()||e.index===n.INTRO_WORD_INDEX||e.index===n.OUTRO_WORD_INDEX)return;let t=this.words();if(t.length===n.FIRST_WORD_INDEX)return;let r=e.index,a;i==="right"?(a=r+1,a>=t.length&&(a=n.FIRST_WORD_INDEX)):(a=r-1,a<n.FIRST_WORD_INDEX&&(a=t.length-1));let l=requestAnimationFrame(()=>{document.querySelector(`[data-index="${a}"].word-chip`)?.focus(),this.activeAnimationFrames=this.activeAnimationFrames.filter(w=>w!==l);});this.activeAnimationFrames.push(l);}onWordClick(e){if(e.index===n.INTRO_WORD_INDEX||e.index===n.OUTRO_WORD_INDEX||this.isPreviewMode())return;if(this.isGapReviewMode()){this.notifier.warn("In this mode you can only select Gaps and Ums.");return;}let i=this.editorState.selectionStart(),t=this.editorState.selectionEnd();if(!i){this.pushCurrentState(),this.editorState.selectWord(e),this.videoService.playWordPreview(e.start,!1);return;}if(i&&!t&&e.index===i.index){this.pushCurrentState(),this.editorState.selectWord(e),this.videoService.playWordPreview(e.start,!0,e.end);return;}if(i&&!t&&e.index>i.index){this.pushCurrentState(),this.editorState.selectWord(e),this.videoService.playWordPreview(e.start,!0,e.end);return;}if(i&&t&&i.index===t.index&&e.index===i.index){this.pushCurrentState(),this.editorState.clearSelection(),this.editorState.selectWord(e),this.videoService.playWordPreview(e.start,!1);return;}if(i&&t&&e.index===t.index){this.pushCurrentState(),this.editorState.clearSelection(),this.editorState.selectWord(e),this.videoService.playWordPreview(e.start,!1);return;}i&&t&&this.pushCurrentState(),this.editorState.selectWord(e),this.videoService.playWordPreview(e.start,!1);}pushCurrentState(){this.historyService.pushState(this.captureCombinedSnapshot());}trackByGridItem(e,i){return i.type==="word"?`w${i.word.index}`:i.type==="gap"?`g${i.gap.id}`:i.type==="base"?"base-portrait":`m${i.marker.id}`;}static{this.ɵfac=function(i){return new(i||n)();};}static{this.ɵcmp=P({type:n,selectors:[["app-camera-angles-step"]],viewQuery:function(i,t){if(i&1&&(j(Mi,5),j(Vi,5),j(Oi,5),j(Ri,5),j(qe,5)),i&2){let r;X(r=K())&&(t.audioElementRef=r.first),X(r=K())&&(t.wordsContainerRef=r.first),X(r=K())&&(t.transcriptContentRef=r.first),X(r=K())&&(t.timestampsContainerRef=r.first),X(r=K())&&(t.variantsDrawerRef=r.first);}},hostBindings:function(i,t){i&1&&v("click",function(){return t.onDocumentClick();},!1,ce)("keydown.escape",function(){return t.onEscape();},!1,ce);},inputs:{credits:"credits",showBuyButton:"showBuyButton"},outputs:{generateClick:"generateClick",back:"back",buyCredits:"buyCredits"},standalone:!0,features:[fe([Ae,Fe,We,Le,Ue,jt,$e,Ge,Be,Ht,je,He,Bt,Xt]),M],decls:47,vars:38,consts:()=>{let e;e="Undo";let i;i="Redo";let t;return t=""+"\uFFFD0\uFFFD"+"",[["transcriptContent",""],["audioElement",""],["t
3imestampsContainer",""],["wordsContainer",""],e,i,t,[1,"camera-angles"],[1,"camera-angles__header"],[1,"camera-angles__header-left"],[3,"breadCrumbClick","breadCrumbs"],[1,"camera-angles__header-center"],["size","sm","variant","tertiary",3,"clicked","disabled","leftIconContent"],[1,"camera-angles__header-actions"],["size","md","variant","secondary",3,"clicked","iconContent"],[1,"camera-angles__header-divider"],[3,"remainingCredits","totalCredits","loading","tooltipText","showBuyButton","buyCredits",4,"ngIf"],["size","md","variant","primary",3,"clicked"],[1,"camera-angles__body"],[1,"camera-angles__left"],[1,"camera-angles__portrait"],["alt","",1,"camera-angles__portrait-img",3,"src"],[1,"camera-angles__caption"],["alt","",1,"camera-angles__caption-icon",3,"src"],[1,"camera-angles__playbar"],["type","button",1,"camera-angles__play-btn",3,"click"],["alt","",3,"src"],[1,"camera-angles__time"],["type","range","min","0","step","0.01","aria-label","Seek",1,"camera-angles__seek",3,"input","max","value"],["type","button",1,"camera-angles__mute-btn",3,"click"],[1,"camera-angles__right"],[1,"camera-angles__transcript"],[3,"wordCount","direction",4,"ngIf"],["class","camera-angles__state",4,"ngIf"],["class","camera-angles__state","role","alert",4,"ngIf"],["class","camera-angles__transcript-wrapper",4,"ngIf"],[3,"addVariant","actionTriggered","showAddVariant","showTutorial","showAllActions"],["playsinline","",1,"camera-angles__audio"],[3,"addVariant","closing","closed","open"],["class","camera-angles__drop-indicator",3,"left","top","height",4,"ngIf"],[3,"buyCredits","remainingCredits","totalCredits","loading","tooltipText","showBuyButton"],[3,"wordCount","direction"],[1,"camera-angles__state"],["role","alert",1,"camera-angles__state"],[1,"camera-angles__transcript-wrapper"],[1,"camera-angles__timestamps"],["class","camera-angles__timestamp",3,"top",4,"ngFor","ngForOf"],["appWordsDropZone","",1,"camera-angles__words",3,"dropEnter","dropLeave","variantDropped","markerDropped","click"],[1,"camera-angles__timestamp"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"word","currentPlaybackWordIndex","wordClicked","arrowKeyPressed",4,"ngIf"],[3,"gap","selectedGapId","gapClicked",4,"ngIf"],[3,"wordClicked","arrowKeyPressed","word","currentPlaybackWordIndex"],[3,"gapClicked","gap","selectedGapId"],[1,"camera-angles__edge-bar"],[3,"marker","removable","selectable","showBars","activeMarkerId","chipClick",4,"ngIf"],["dragWrapper","","cancelSelector",".marker-chip__overlay",3,"dropData","imageData","marker","activeMarkerId","chipClick","removeMarker","overlaySelect",4,"ngIf"],[3,"chipClick","marker","removable","selectable","showBars","activeMarkerId"],["dragWrapper","","cancelSelector",".marker-chip__overlay",3,"chipClick","removeMarker","overlaySelect","dropData","imageData","marker","activeMarkerId"],[1,"camera-angles__drop-indicator"]];},template:function(i,t){if(i&1){let r=T();d(0,"div",7)(1,"header",8)(2,"div",9)(3,"bread-crumbs",10),v("breadCrumbClick",function(l){return h(r),u(t.onBreadCrumbClick(l));}),p()(),d(4,"div",11)(5,"lib-button",12),Ve(6,"async"),v("clicked",function(){return h(r),u(t.undo());}),L(7,4),p(),d(8,"lib-button",12),Ve(9,"async"),v("clicked",function(){return h(r),u(t.redo());}),L(10,5),p()(),d(11,"div",13)(12,"lib-button-icon",14),v("clicked",function(){return h(r),u(t.toggleFullscreen());}),p(),C(13,"div",15),y(14,zi,1,5,"app-credits-button",16),d(15,"lib-button",17),v("clicked",function(){return h(r),u(t.onGenerate());}),A(16),p()()(),d(17,"div",18)(18,"aside",19)(19,"div",20),C(20,"img",21),p(),d(21,"div",22),C(22,"img",23),d(23,"span"),L(24,6),p()(),d(25,"div",24)(26,"button",25),v("click",function(){return h(r),u(t.onTogglePlay());}),C(27,"img",26),p(),d(28,"span",27),A(29),p(),d(30,"input",28),v("input",function(l){return h(r),u(t.onSeek(l));}),p(),d(31,"span",27),A(32),p(),d(33,"button",29),v("click",function(){return h(r),u(t.onToggleMute());}),C(34,"img",26),p()()(),d(35,"section",30)(36,"div",31,0),y(38,Ni,1,2,"app-skeleton-loader",32)(39,Gi,3,1,"div",33)(40,Li,3,1,"div",34)(41,er,9,8,"div",35),p(),d(42,"app-action-bar",36),v("addVariant",function(){return h(r),u(t.onAddVariant());})("actionTriggered",function(l){return h(r),u(t.onToolbarAction(l));}),p()()(),C(43,"video",37,1),d(45,"app-avatar-variants-drawer",38),v("addVariant",function(l){return h(r),u(t.onDrawerAddVariant(l));})("closing",function(){return h(r),u(t.onDrawerClosing());})("closed",function(){return h(r),u(t.onDrawerClosed());}),p(),y(46,tr,1,6,"div",39),p();}i&2&&(H("camera-angles--drawer-open",t.isDrawerPushed()),s(3),c("breadCrumbs",t.breadCrumbs),s(2),c("disabled",!Oe(6,34,t.canUndo$))("leftIconContent",t.undoIconUrl),s(3),c("disabled",!Oe(9,36,t.canRedo$))("leftIconContent",t.redoIconUrl),s(4),c("iconContent",t.isFullscreen?t.exitFullscreenIconUrl:t.fullScreenIconUrl),s(2),c("ngIf",t.credits),s(2),R(t.generateLabel),s(4),c("src",t.currentImageUrl(),$),s(2),c("src",t.infoIconUrl,$),s(2),he(t.currentPortraitLabel),ue(24),s(2),B("aria-label",t.isPlaying()?"Pause":"Play"),s(),c("src",t.isPlaying()?t.pauseIconUrl:t.playIconUrl,$),s(2),R(t.formattedCurrentTime()),s(),re("--progress",t.seekProgressPercent()),c("max",t.duration())("value",t.currentTime()),s(2),R(t.formattedDuration()),s(),H("is-muted",t.isMuted()),B("aria-label",t.isMuted()?"Unmute":"Mute"),s(),c("src",t.volumeOnIconUrl,$),s(4),c("ngIf",t.isLoading()),s(),c("ngIf",!t.isLoading()&&!t.hasSegmentation()),s(),c("ngIf",!t.isLoading()&&t.hasSegmentation()&&t.hasError()),s(),c("ngIf",!t.isLoading()&&!t.hasError()&&t.hasWords()),s(),c("showAddVariant",!0)("showTutorial",!1)("showAllActions",!0),s(3),c("open",t.isDrawerOpen()),s(),c("ngIf",t.dropIndicator()));},dependencies:[V,lt,U,dt,Ce,Se,Vt,Mt,qt,Zt,Kt,Qt,ri,qe,ni,Te],styles:["[_nghost-%COMP%]{display:block}
3.camera-angles[_ngcontent-%COMP%]{position:fixed;inset:var(--sudo-bar-height, 0px) 0 0 0;z-index:1000;display:flex;flex-direction:column;background-color:#fff;overflow:hidden}.camera-angles__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;height:56px;padding:0 16px;gap:16px;background-color:#fff;border-bottom:1px solid #e1e7f0;flex-shrink:0}.camera-angles__header-left[_ngcontent-%COMP%]{display:flex;align-items:center;min-width:0;flex:1}.camera-angles__header-center[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;flex-shrink:0}.camera-angles__header-actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex:1}.camera-angles__header-divider[_ngcontent-%COMP%]{width:1px;height:24px;background-color:#e1e7f0;flex-shrink:0}.camera-angles__body[_ngcontent-%COMP%]{flex:1;display:flex;align-items:stretch;min-height:0;overflow:hidden;transition:margin-right .24s cubic-bezier(.7,0,.84,0)}.camera-angles--drawer-open[_ngcontent-%COMP%] .camera-angles__body[_ngcontent-%COMP%]{margin-right:min(384px,100vw);transition-timing-function:cubic-bezier(.16,1,.3,1)}.camera-angles__left[_ngcontent-%COMP%]{flex:0 0 42%;max-width:560px;display:flex;flex-direction:column;align-items:center;gap:16px;padding:24px;background-color:#f6f8fc;overflow-y:auto;min-width:0}.camera-angles__portrait[_ngcontent-%COMP%]{width:100%;max-width:320px;aspect-ratio:9/16;border-radius:20px;overflow:hidden;background-color:#0d1526;flex-shrink:0}.camera-angles__portrait-img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;display:block}.camera-angles__caption[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;font-family:Inter,sans-serif;font-size:14px;font-weight:500;color:#64748b}.camera-angles__caption-icon[_ngcontent-%COMP%]{width:16px;height:16px;display:block}.camera-angles__playbar[_ngcontent-%COMP%]{width:100%;max-width:344px;display:flex;align-items:center;gap:4px}.camera-angles__play-btn[_ngcontent-%COMP%], .camera-angles__mute-btn[_ngcontent-%COMP%]{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:none;border-radius:999px;background:transparent;cursor:pointer}.camera-angles__play-btn[_ngcontent-%COMP%]:hover, .camera-angles__mute-btn[_ngcontent-%COMP%]:hover{background:#2536580f}.camera-angles__play-btn[_ngcontent-%COMP%] img[_ngcontent-%COMP%], .camera-angles__mute-btn[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:20px;height:20px;display:block}.camera-angles__mute-btn.is-muted[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{opacity:.4}.camera-angles__time[_ngcontent-%COMP%]{flex-shrink:0;font-family:Inter,sans-serif;font-size:14px;font-weight:500;line-height:1.4;letter-spacing:-.14px;color:#253658;min-width:40px;text-align:center}.camera-angles__seek[_ngcontent-%COMP%]{flex:1;min-width:0;appearance:none;-webkit-appearance:none;height:6px;margin:0 4px;border:.5px solid #e1e7f0;border-radius:100px;background:linear-gradient(90deg,#28b3f7,#506aff) 0 0/var(--progress, 0%) 100% no-repeat,#ebf2ff;box-shadow:inset 0 0 4px #0000001a;cursor:pointer}.camera-angles__seek[_ngcontent-%COMP%]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:24px;height:14px;border:.5px solid #e1e7f0;border-radius:4px;background:#fff;box-shadow:1px 0 5px #00144a33}.camera-angles__seek[_ngcontent-%COMP%]::-moz-range-thumb{width:24px;height:14px;border:.5px solid #e1e7f0;border-radius:4px;background:#fff;box-shadow:1px 0 5px #00144a33}.camera-angles__right[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;flex-direction:column;border-left:1px solid #e1e7f0;overflow:hidden}.camera-angles__transcript[_ngcontent-%COMP%]{flex:1;min-height:0;display:flex;flex-direction:column;align-items:flex-start;padding:24px;overflow-y:auto;overflow-x:hidden;scrollbar-gutter:stable;scroll-behavior:smooth}.camera-angles__state[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:center;align-items:flex-start;padding:32px}.camera-angles__state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-family:Inter,sans-serif;font-size:16px;color:#64748b}.camera-angles__transcript-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row;gap:16px;width:100%;align-items:stretch}.camera-angles__timestamps[_ngcontent-%COMP%]{position:relative;flex-shrink:0;align-self:stretch;width:56px;padding:10px 0;overflow:visible}.camera-angles__timestamp[_ngcontent-%COMP%]{position:absolute;display:flex;width:auto;background-color:#eef2f8;border-radius:6px;color:#64748b;font-family:Inter,sans-serif;font-size:12px;font-weight:500;white-space:nowrap;padding:2px 6px;direction:ltr;text-align:left;transform:translateY(-50%)}.camera-angles__transcript-wrapper[dir=ltr][_ngcontent-%COMP%] .camera-angles__timestamp[_ngcontent-%COMP%]{right:0;left:auto}.camera-angles__transcript-wrapper[dir=rtl][_ngcontent-%COMP%] .camera-angles__timestamp[_ngcontent-%COMP%]{left:0;right:auto}.camera-angles__words[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:8px;line-height:2.2;flex:1;min-width:0;overflow-wrap:break-word}.camera-angles__words.gap-review-mode[_ngcontent-%COMP%] app-word-chip[_ngcontent-%COMP%]{pointer-events:none}.camera-angles__words.gap-review-mode[_ngcontent-%COMP%] app-gap-bracket[_ngcontent-%COMP%]{pointer-events:auto}
3.camera-angles__words.preview-mode-disabled[_ngcontent-%COMP%] app-word-chip .word-chip{cursor:default}.camera-angles__edge-bar[_ngcontent-%COMP%]{flex-shrink:0;width:1.5px;height:36px;border-radius:999px;background-color:#4481fd}.camera-angles__audio[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.camera-angles__drop-indicator[_ngcontent-%COMP%]{position:fixed;width:3px;border-radius:2px;background-color:#4481fd;box-shadow:0 0 0 1px #4481fd40;z-index:1500;pointer-events:none;transform:translate(-50%)}@media (max-width: 900px){.camera-angles__body[_ngcontent-%COMP%]{flex-direction:column}.camera-angles__left[_ngcontent-%COMP%]{flex:0 0 auto;max-width:none;width:100%}.camera-angles__right[_ngcontent-%COMP%]{border-left:none;border-top:1px solid #e1e7f0;flex:1}}"]});}}return n;})();E();z();De();le();mi();gi();pi();_i();ie();E();var oi=(()=>{class n{constructor(){this.demoVideo=ei,this.premiumPlanService=g(xt),this.router=g(ae),this.eventsService=g(N),this.wizardState=g(D);}ngOnInit(){this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoAnglesScreen,x(b({},this.wizardState.buildAnglesAttrs()),{hasAccess:!1}));}onUnlockClick(){let e=this.router.url;this.premiumPlanService.openPricingDialog(wt.AI_MAX,e,e,bt.portrait2Video);}static{this.ɵfac=function(i){return new(i||n)();};}static{this.ɵcmp=P({type:n,selectors:[["app-camera-angles-gate"]],standalone:!0,features:[M],decls:19,vars:2,consts:()=>{let e;e="Camera Angles";let i;i="Make your talking video feel more dynamic";let t;t="Switch between close-up, medium, and wide shots while your voiceover plays. Stop staring at one static frame.";let r;r="BIGVU maps your shots to your transcript \u2014 so you pick close-up, medium, or wide right on the words. The presenter moves, the scene changes, your video comes alive.";let a;a="Edit every angle before you generate.";let l;return l="Unlock Feature with AIMax",[e,i,t,r,a,l,[1,"camera-angles-gate"],[1,"camera-angles-gate__demo"],["borderRadius","16.245px",1,"camera-angles-gate__demo-media",3,"streamUrl","thumbnailUrl"],[1,"camera-angles-gate__content"],[1,"camera-angles-gate__titles"],[1,"camera-angles-gate__title"],[1,"camera-angles-gate__subtitle"],[1,"camera-angles-gate__body"],["variant","primary","size","md",1,"camera-angles-gate__cta",3,"clicked"]];},template:function(i,t){i&1&&(d(0,"div",6)(1,"div",7),C(2,"hls-video-player",8),p(),d(3,"div",9)(4,"div",10)(5,"h1",11),L(6,0),p(),d(7,"p",12),L(8,1),p()(),d(9,"div",13)(10,"p"),L(11,2),p(),d(12,"p"),L(13,3),p(),d(14,"p"),L(15,4),p()(),d(16,"lib-button",14),v("clicked",function(){return t.onUnlockCl
3ick();}),d(17,"span"),L(18,5),p()()()()),i&2&&(s(2),c("streamUrl",t.demoVideo.streamUrl)("thumbnailUrl",t.demoVideo.thumbnailUrl));},dependencies:[V,Se,yt],styles:["[_nghost-%COMP%]{display:block;height:100%;min-height:0}.camera-angles-gate[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:32px;height:100%;padding:32px 64px;background:#fff;border-radius:10px;box-sizing:border-box;overflow:hidden}.camera-angles-gate__demo[_ngcontent-%COMP%]{flex:0 0 526px;max-width:100%;aspect-ratio:676/380.78;border:.677px solid #ebf2ff;border-radius:16.245px;background:linear-gradient(-34.82deg,#f8f5ff 15.23%,#eff5ff 65.31%);overflow:hidden}.camera-angles-gate__demo-media[_ngcontent-%COMP%]{display:block;width:100%;height:100%}.camera-angles-gate__content[_ngcontent-%COMP%]{display:flex;flex:1 1 0;min-width:0;flex-direction:column;justify-content:center;gap:24px}.camera-angles-gate__titles[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.camera-angles-gate__title[_ngcontent-%COMP%]{margin:0;font-family:Inter,sans-serif;font-size:32px;font-weight:700;line-height:1.2;letter-spacing:-1.28px;background:linear-gradient(-42.07deg,#253658 31.32%,#576e9c 99.83%);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.camera-angles-gate__subtitle[_ngcontent-%COMP%]{margin:0;font-size:18px;font-weight:500;line-height:1.4;color:#4b5563}.camera-angles-gate__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;font-size:14px;font-weight:400;line-height:1.4;letter-spacing:-.14px;color:#4b5563}.camera-angles-gate__body[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.camera-angles-gate__cta[_ngcontent-%COMP%]{align-self:flex-start}"],changeDetection:0});}}return n;})();E();z();De();it();rt();le();ci();Ct();Ne();oe();ie();E();z();function ir(n,_){if(n&1&&(d(0,"div",4)(1,"div",5)(2,"div",6),C(3,"lib-logo",7),p(),C(4,"lottie-loader",8),p(),d(5,"div",9)(6,"h2",10),A(7),p(),d(8,"p",11),A(9),p()(),d(10,"div",12),C(11,"app-progress-fake-bar",13),p()()),n&2){let e=o();s(4),c("lottieWidth",180)("lottieHeight",180),s(3),R(e.generatingTitle),s(2),R(e.generatingSubtitle),s(2),c("showBackground",!1)("row",!0)("show",!0)("isRealProgress",!0)("realProgress",e.progress());}}function rr(n,_){if(n&1&&(d(0,"div",14)(1,"div",15)(2,"div",16),C(3,"lib-logo",17),p(),d(4,"div",18)(5,"div",19)(6,"span",20),A(7),p(),d(8,"span",21),A(9),p()(),d(10,"p",22),A(11),p()()()()),n&2){let e=o();s(7),R(e.successTitle),s(2),R(e.successTimeLabel),s(2),R(e.successBody);}}var nr=2,ar=-1,or=15*60*1e3,sr=1500,si=(()=>{class n{constructor(){this.wizardState=g(D),this.photo2VideoService=g(J),this.taskProgressService=g(Pt),this.websocketService=g(we),this.requestsService=g(se),this.notificationsService=g(W),this.router=g(ae),this.cdr=g(ne),this.eventsService=g(N),this.generatingTitle="Generating your video",this.generatingSubtitle="After doing all the hard work, you deserve a coffee break!",this.successTitle="Congratulations \uD83D\uDC4D",this.successBody="Your video is ready",this.successTimeLabel="just now",this.progress=f(()=>this.wizardState.select("generationProgress")()),this.status=f(()=>this.wizardState.select("generationStatus")()),this.isReady=f(()=>this.status()==="ready"),this.portraitImageUrl=f(()=>this.wizardState.select("selectedPortrait")()?.imageUrl??""),this.unsubscribe$=new me(),this.subscriptions=new Ye();}ngOnInit(){let e=this.wizardState.select("generationStatus")(),i=this.wizardState.select("generatingVideoId")();if(this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoFinishScreen,this.wizardState.buildFinishAttrs()),e==="generating"&&i){this.websocketService.connect(),this.subscribeToProgress(i);return;}e!=="ready"&&this.startGeneration();}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete(),this.subscriptions.unsubscribe();}startGeneration(){return G(this,null,function*(){let e=this.wizardState.select("selectedPortrait")(),i=this.wizardState.select("selectedVariationId")(),r=this.wizardState.select("voiceVariations")().find(O=>O.id===i),a=r?.audioUrl??null,l=this.wizardState.select("storyId")(),m=r?.segmentationUrl,w=r?.durationSec??0;if(!e?.imageUrl||!a||!l){this.notificationsService.error("Missing data \u2014 please go back and re-select."),this.wizardState.setCurrentStep(S.SELECT_VOICE);return;}this.wizardState.setGenerationStatus("generating"),this.wizardState.setGenerationProgress(0);try{let q=(yield this.photo2VideoService.generateVideo(b({storyId:l,audioUrl:a,portraitAssetId:e.id,portraitUrl:e.imageUrl,segmentationUrl:m},this.buildCameraAngles(e.imageUrl,w))))?.storyVideo?.id;if(!q)throw new Error("Missing video id from generateVideo response");this.wizardState.setGeneratingVideoId(q),yield new Promise(_e=>setTimeout(_e,1e3)),this.websocketService.connect(),this.subscribeToProgress(q);}catch(O){let q=O instanceof Error?O.message:"Video generation failed";this.handleFailure(q);}});}buildCameraAngles(e,i){let t=this.wizardState.select("cameraAngleMarkers")(),r=this.wizardState.select("trimKeptRanges")();if(!i)return{};let a=r?.length?Ee(r,i):null;if(!t.length)return a?.length?{voiceTrimRanges:a}:{};let l=ke({segments:pe({markers:t,baseImageUrl:e,audioDuration:i}),audioDuration:i,voiceTrimRanges:a});return b({portraitRanges:l},a?.length?{voiceTrimRanges:a}:{});}subscribeToProgress(e){let i=this.wizardState.select("storyId")();this.taskProgressService.getProgressForEntity(e).pipe(te(this.unsubscribe$)).subscribe(t=>
3{if(t!=null&&this.status()==="generating"){let r=Math.min(Math.max(t,0),100);this.wizardState.setGenerationProgress(r),this.cdr.detectChanges();}}),this.taskProgressService.taskFailed$.pipe(Pe(t=>t.entityId===e||t.entityIds?.includes(e)||t.entityId===i||t.entityIds?.includes(i??"")),te(this.unsubscribe$)).subscribe(()=>this.handleFailure("Video generation task failed")),this.websocketService.updatedStoryId$.pipe(Pe(t=>!!t&&t.storyId===i),te(this.unsubscribe$)).subscribe(t=>G(this,null,function*(){if(t?.actions?.includes("portraitToVideo"))try{let a=(yield this.requestsService.getStoryById(i))?.videos?.find(l=>l.id===e);if(!a)return;a.status===nr?this.handleReady(a):a.status===ar&&this.handleFailure("Video generation failed");}catch(r){console.error("generate-video-step: failed to fetch story",r);}})),et(or).pipe(te(this.unsubscribe$)).subscribe(()=>{this.status()==="generating"&&this.handleFailure("Video generation timed out");});}handleReady(e){if(this.status()!=="generating")return;let i=e?.streams?.[0]?.url||e?.hlsPlaylistUrl||null;this.wizardState.setGeneratedVideoUrl(i),this.wizardState.setGenerationProgress(100),this.wizardState.setGenerationStatus("ready"),this.cdr.detectChanges();let t=this.wizardState.select("storyId")();setTimeout(()=>{let r=t?["/script-story",t,"takes"]:["/boards"];this.router.navigate(r).then(a=>{a&&this.wizardState.reset();});},sr);}handleFailure(e){this.status()!=="failed"&&(this.wizardState.setGenerationStatus("failed"),this.notificationsService.error("Video generation failed. Please try again."),setTimeout(()=>{this.wizardState.setCurrentStep(S.SELECT_VOICE);},600));}static{this.ɵfac=function(i){return new(i||n)();};}static{this.ɵcmp=P({type:n,selectors:[["app-generate-video-step"]],standalone:!0,features:[M],decls:4,vars:2,consts:[[1,"generate-step"],[1,"generate-step__body"],["class","loader",4,"ngIf"],["class","success-card",4,"ngIf"],[1,"loader"],[1,"loader__graphic"],[1,"loader__logo"],["type","logo","color","blue"],["path","/assets/waiting_coffee.json",1,"loader__coffee",3,"lottieWidth","lottieHeight"],[1,"loader__text"],[1,"loader__title"],[1,"loader__subtitle"],[1,"loader__progress"],[3,"showBackground","row","show","isRealProgress","realProgress"],[1,"success-card"],[1,"success-card__inner"],[1,"success-card__logo"],["type","icon","color","blue"],[1,"success-card__text"],[1,"success-card__row"],[1,"success-card__title"],[1,"success-card__time"],[1,"success-card__body"]],template:function(i,t){i&1&&(d(0,"section",0)(1,"div",1),y(2,ir,12,9,"div",2)(3,rr,12,3,"div",3),p()()),i&2&&(s(2),c("ngIf",!t.isReady()),s(),c("ngIf",t.isReady()));},dependencies:[V,U,Et,St,pt],styles:["[_nghost-%COMP%]{display:block;height:100%;min-height:0}.generate-step[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;height:100%;min-height:0;padding:32px;background:#fff;border-radius:10px;overflow:hidden;box-sizing:border-box}.generate-step__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;flex:1;min-height:0}.loader[_ngcontent-%COMP%]{position:relative;width:393px;height:387px;max-width:100%}.loader__graphic[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:289px;display:flex;align-items:center;justify-content:center}.loader__logo[_ngcontent-%COMP%]{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:295px;height:183px;flex-shrink:0;opacity:.12;pointer-events:none;mask-image:linear-gradient(to bottom,black 0%,black 30%,transparent 100%);-webkit-mask-image:linear-gradient(to bottom,black 0%,black 30%,transparent 100%)}.loader__logo[_ngcontent-%COMP%] lib-logo, .loader__logo[_ngcontent-%COMP%] svg{width:100%;height:100%}.loader__coffee[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center;max-height:100%}.loader__text[_ngcontent-%COMP%]{position:absolute;top:265px;left:50%;transform:translate(-50%);width:361px;max-width:100%;display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}.loader__title[_ngcontent-%COMP%]{margin:0;font-size:32px;font-weight:600;line-height:1.2;letter-spacing:-1.28px;color:#253658}.loader__subtitle[_ngcontent-%COMP%]{margin:0;max-width:233px;font-size:14px;font-weight:400;line-height:1.4;letter-spacing:-.14px;color:#4b5563}.loader__progress[_ngcontent-%COMP%]{position:absolute;top:371px;left:50%;transform:translate(-50%);width:268px}.loader__progress[_ngcontent-%COMP%] .progress-fake-bar-wrapper{width:100%!important}.success-card[_ngcontent-%COMP%]{width:400px;max-width:100%;padding:12px;background-color:#ebf2ff;border-radius:12px;box-sizing:border-box}.success-card__inner[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:8px;padding:12px;background-color:#fff;border-radius:10px;box-shadow:0 0 40px #0000001a}.success-card__logo[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:8px;background-color:#102133;display:flex;align-items:center;justify-content:center;flex-shrink:0;overflow:hidden}.success-card__logo[_ngcontent-%COMP%] lib-logo, .success-card__logo[_ngcontent-%COMP%] svg{width:24px;height:24px}.success-card__text[_ngcontent-%COMP%]{flex:1 1 0;min-width:0;display:flex;flex-direction:column;justify-content:center}.success-card__row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px}.success-card__title[_ngcontent-%COMP%]{font-size:14px;font-weight:600;line-height:1.4;letter-spacing:-.14px;color:#253658}.success-card__time[_ngcontent-%COMP%]{font-size:12px;font-weight:400;line-height:1.4;letter-spacing:-.12px;color:#6b7280}.success-card__body[_ngcontent-%COMP%]{margin:0;font-size:12px;font-weight:400;line-height:1.4;letter-spacing:-.12px;color:#6b7280}"],changeDetection:0});}}return n;})();At();oe();ie();
3Ne();Ct();E();z();function cr(n,_){if(n&1){let e=T();d(0,"app-portrait-selection",5),v("portraitSelected",function(t){h(e);let r=o();return u(r.onPortraitSelectionChanged(t));}),p();}if(n&2){let e=o();c("initialSelectedPortrait",e.selectedPortrait());}}function lr(n,_){n&1&&C(0,"app-select-voice-step");}function dr(n,_){n&1&&C(0,"app-create-voiceover-step");}function pr(n,_){n&1&&C(0,"app-camera-angles-gate");}function _r(n,_){n&1&&C(0,"app-generate-video-step");}function mr(n,_){if(n&1){let e=T();d(0,"app-camera-angles-step",6),v("generateClick",function(){h(e);let t=o();return u(t.onCameraAnglesGenerate());})("back",function(){h(e);let t=o();return u(t.onCameraAnglesBack());})("buyCredits",function(){h(e);let t=o();return u(t.onBuyCredits());}),p();}if(n&2){let e=o();c("credits",e.credits());}}var yo=(()=>{class n{constructor(){this.wizardStateService=g(D),this.navigationHelperService=g(Ot),this.router=g(ae),this.dialogHelperService=g(ye),this.notificationsService=g(W),this.eventsService=g(N),this.photo2VideoService=g(J),this.requestsService=g(se),this.websocketService=g(we),this.TalkingPhotoStep=S,this.breadCrumbs=[],this.currentStep=S.SELECT_PORTRAIT,this.isRatingAnswered=!1,this.ratingText="Rate your experience",this.creditsSubscription=null,this.credits=I(null),this.selectedPortrait=f(()=>this.wizardStateService.select("selectedPortrait")()),this.cameraAnglesEnabled=f(()=>this.credits()?.hasCameraAngles??null),this.buttonContinue="Continue",this.buttonGoToProjects="Go to projects",this.buttonGenerateVideo="Generate Video",this.headerCtaLabel=f(()=>{switch(this.wizardStateService.select("currentStep")()){case S.GENERATE:return this.buttonGoToProjects;case S.CAMERA_ANGLES:return this.buttonGenerateVideo;default:return this.buttonContinue;}}),this.isHeaderCtaDisabled=f(()=>this.wizardStateService.select("currentStep")()===S.GENERATE?!1:!this.isCurrentStageComplete()),this.pendingReturnTo=null,this.steps=[{id:S.SELECT_PORTRAIT,title:"Select portrait",description:"Who's on screen?",iconSrcDefault:"/img/icon-library/messaging/quote.svg",iconSrcActive:"/img/icon-library/messaging/quote.svg",isActive:!0,isDisabled:!1},{id:S.EDIT_SCRIPT,title:"Edit script",description:"Write what you want to say",iconSrcDefault:"/img/icon-library/scripts/script.svg",iconSrcActive:"/img/icon-library/scripts/script.svg",isActive:!1,isDisabled:!0},{id:S.SELECT_VOICE,title:"Select Voice",description:"The sound of your narration",iconSrcDefault:"/img/icon-library/music/microphone.svg",iconSrcActive:"/img/icon-library/music/microphone.svg",isActive:!1,isDisabled:!0},{id:S.CREATE_VOICEOVER,title:"Create Voiceover",description:"Preview & create variations",iconSrcDefault:"/img/icon-library/music/microphone.svg",iconSrcActive:"/img/icon-library/music/microphone.svg",isActive:!1,isDisabled:!0},{id:S.CAMERA_ANGLES,title:"Camera Angles",description:"Switch shots as voice plays",iconSrcDefault:"/img/icon-library/video/video.svg",iconSrcActive:"/img/icon-library/video/video.svg",rightIconSrc:"/img/profile/ai-max-diamond.svg",isActive:!1,isDisabled:!0}],this.isCurrentStageComplete=f(()=>{switch(this.wizardStateService.select("currentStep")()){case S.SELECT_PORTRAIT:return this.selectedPortrait()!==null;case S.SELECT_VOICE:return this.wizardStateService.select("voiceSubView")()==="generating"?!1:this.wizardStateService.select("selectedVoice")()!==null;case S.CREATE_VOICEOVER:return this.wizardStateService.select("selectedVariationId")()!==null;case S.CAMERA_ANGLES:{let i=this.wizardStateService.select("selectedVariationId")();return i===null?!1:!!this.wizardStateService.select("voiceVariations")().find(r=>r.id===i)?.audioUrl;}default:return!1;}}),F(()=>{let e=this.wizardStateService.select("currentStep")();e!==this.currentStep&&(this.currentStep=e),this.selectedPortrait(),this.wizardStateService.select("scriptText")(),this.wizardStateService.select("selectedVoice")(),this.wizardStateService.select("voiceSubView")(),this.wizardStateService.select("selectedVariationId")(),this.updateStepStates();});}ngOnInit(){this.navigationHelperService.hideNavigationMenu=!0;let e=this.readNavState(),i=e?.returnTo==="voice";i||this.wizardStateService.reset(),this.applyNavigationState(e),this.initializeBreadCrumbs(),this.resolveInitialStep(),this.updateStepStates(),this.creditsSubscription=this.photo2VideoService.creditsState.subscribe(t=>this.credits.set(t)),this.photo2VideoService.checkUserPlanAndLimits(),i||this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoStart,e?.source?{source:e.source}:{});}
3ngOnDestroy(){this.creditsSubscription?.unsubscribe();}onBuyCredits(){this.photo2VideoService.onBuyCredits();}readNavState(){return this.router.getCurrentNavigation()?.extras?.state??(typeof history<"u"?history.state:null);}applyNavigationState(e){e&&(e.storyId&&this.wizardStateService.setStoryId(e.storyId),typeof e.script=="string"&&this.wizardStateService.setScriptText(e.script),e.portrait&&this.wizardStateService.setSelectedPortrait(e.portrait),this.pendingReturnTo=e.returnTo??null,this.hydrateScriptFromStory());}hydrateScriptFromStory(){return G(this,null,function*(){let e=this.wizardStateService.select("storyId")();if(!(!e||this.wizardStateService.hasValidScript()))try{let i=yield this.requestsService.getStoryById(e);i?.script&&!this.wizardStateService.hasValidScript()&&this.wizardStateService.setScriptText(i.script);}catch(i){console.error("Talking photo wizard: could not load the story script",i);}});}resolveInitialStep(){if(this.pendingReturnTo==="voice"){this.wizardStateService.setCurrentStep(S.SELECT_VOICE);return;}this.wizardStateService.setCurrentStep(S.SELECT_PORTRAIT);}initializeBreadCrumbs(){let e=this.wizardStateService.select("storyId")(),i=[new Y("projects-icon","Home","/boards",!1)];e&&i.push(new Y("","Script",`/script-story/${e}/script`,!1)),i.push(new Y("","Talking AI Video","/portrait2video",!0)),this.breadCrumbs=i;}updateStepStates(){let e=this.selectedPortrait()!==null,i=this.wizardStateService.hasValidScript(),t=this.wizardStateService.hasSelectedVoice(),r=this.wizardStateService.select("selectedVariationId")()!==null,a=this.currentStep===S.GENERATE,l=a?S.CREATE_VOICEOVER:this.currentStep;this.steps=this.steps.map(m=>x(b({},m),{isActive:m.id===l,isDisabled:a?!0:m.id===S.SELECT_PORTRAIT?!1:m.id===S.EDIT_SCRIPT?!e:m.id===S.SELECT_VOICE?!(e&&i):m.id===S.CREATE_VOICEOVER?!(e&&i&&t):m.id===S.CAMERA_ANGLES?!r:!0}));}onStepClick(e){if(e.id===S.EDIT_SCRIPT){let i=this.wizardStateService.select("selectedPortrait")();i&&this.navigateToScriptStory(i);return;}this.wizardStateService.setCurrentStep(e.id);}onHeaderCtaClick(){if(this.wizardStateService.select("currentStep")()===S.GENERATE){this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoFinish,x(b({},this.wizardStateService.buildFinishAttrs()),{option:"projects",notifyEnabled:!1})),this.router.navigate(["/boards"]);return;}this.onNextClick();}onNextClick(){if(!this.isCurrentStageComplete())return;let e=this.wizardStateService.select("currentStep")();if(e===S.SELECT_PORTRAIT){let i=this.wizardStateService.select("selectedPortrait")();i&&this.advanceFromPortraitSelection(i);return;}if(e===S.SELECT_VOICE){this.advanceFromVoiceSelection();return;}if(e===S.CREATE_VOICEOVER){this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoNext,x(b({},this.wizardStateService.buildCombinedAttrs()),{stage:"voiceover"})),this.wizardStateService.setCurrentStep(S.CAMERA_ANGLES);return;}e===S.CAMERA_ANGLES&&this.advanceFromCameraAngles();}advanceFromVoiceSelection(){return G(this,null,function*(){let e=this.wizardStateService.select("scriptText")();(yield this.photo2VideoService.ensureCreditsForScript(e))&&(this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoNext,x(b({},this.wizardStateService.buildCombinedAttrs()),{stage:"voice"})),this.wizardStateService.setVoiceSubView("generating"),this.selectVoiceStepRef?.generateVoicePreview());});}advanceFromCameraAngles(){return G(this,null,function*(){this.websocketService.connect();let e=this.wizardStateService.select("scriptText")();(yield this.photo2VideoService.ensureCreditsForScript(e))&&(this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoNext,x(b({},this.wizardStateService.buildCombinedAttrs()),{stage:"angles"})),this.wizardStateService.setCurrentStep(S.GENERATE));});}onCameraAnglesGenerate(){this.advanceFromCameraAngles();}onCameraAnglesBack(){this.wizardStateService.setCurrentStep(S.CREATE_VOICEOVER);}onPortraitSelectionChanged(e){this.wizardStateService.setSelectedPortrait(e);}advanceFromPortraitSelection(e){this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoNext,x(b({},this.wizardStateService.buildPortraitAttrs()),{stage:"portrait"})),this.navigateToScriptStory(e);}onRatingClick(e){let i=e?"like":"dislike",t=new kt();t.title=i==="like"?"Great! Tell us what you liked about this experience.":"Not quite right? Help us understand how we
3can improve.",t.inputPlaceholder="Type your feedback here",t.inputVariant="text-area",t.confirmButtonText="Send",t.cancelButtonText="Cancel",t.showClearButton=!1,t.showValidationErrors=!1,t.onSubmit=a=>{this.isRatingAnswered=!0,this.notificationsService.success("Thank you for your feedback!"),this.dialogHelperService.close();},t.onClose=()=>{this.dialogHelperService.close();};let r=new be();r.panelClass="confirmation-with-input-dialog",this.dialogHelperService.open(t,It,r);}navigateToScriptStory(e){let i=this.wizardStateService.select("storyId")(),t=this.wizardStateService.select("scriptText")(),r=i?["/script-story",i,"script"]:["/script-story","script"];this.router.navigate(r,{state:{portrait:e,storyId:i??void 0,script:t||void 0}});}static{this.ɵfac=function(i){return new(i||n)();};}static{this.ɵcmp=P({type:n,selectors:[["app-talking-photo-wizard"]],viewQuery:function(i,t){if(i&1&&j(Xe,5),i&2){let r;X(r=K())&&(t.selectVoiceStepRef=r.first);}},standalone:!0,features:[fe([D,Rt,Dt]),M],decls:9,vars:14,consts:[[3,"stepClick","buyCredits","ratingClick","steps","breadCrumbs","credits","ratingText","ratingAnswered"],["wizardHeaderCta","","size","md",3,"onClick","variant","disabled"],[3,"initialSelectedPortrait","portraitSelected",4,"ngIf"],[4,"ngIf"],[3,"credits","generateClick","back","buyCredits",4,"ngIf"],[3,"portraitSelected","initialSelectedPortrait"],[3,"generateClick","back","buyCredits","credits"]],template:function(i,t){i&1&&(d(0,"app-wizard-shell",0),v("stepClick",function(a){return t.onStepClick(a);})("buyCredits",function(){return t.onBuyCredits();})("ratingClick",function(a){return t.onRatingClick(a);}),d(1,"ui-button",1),v("onClick",function(){return t.onHeaderCtaClick();}),A(2),p(),y(3,cr,1,1,"app-portrait-selection",2)(4,lr,1,0,"app-select-voice-step",3)(5,dr,1,0,"app-create-voiceover-step",3)(6,pr,1,0,"app-camera-angles-gate",3)(7,_r,1,0,"app-generate-video-step",3),p(),y(8,mr,1,1,"app-camera-angles-step",4)),i&2&&(c("steps",t.steps)("breadCrumbs",t.breadCrumbs)("credits",t.credits())("ratingText",t.ratingText)("ratingAnswered",t.isRatingAnswered),s(),c("variant","primary-royal")("disabled",t.isHeaderCtaDisabled()),s(),ve(" ",t.headerCtaLabel()," "),s(),c("ngIf",t.currentStep===t.TalkingPhotoStep.SELECT_PORTRAIT),s(),c("ngIf",t.currentStep===t.TalkingPhotoStep.SELECT_VOICE),s(),c("ngIf",t.currentStep===t.TalkingPhotoStep.CREATE_VOICEOVER),s(),c("ngIf",t.currentStep===t.TalkingPhotoStep.CAMERA_ANGLES&&t.cameraAnglesEnabled()===!1),s(),c("ngIf",t.currentStep===t.TalkingPhotoStep.GENERATE),s(),c("ngIf",t.currentStep===t.TalkingPhotoStep.CAMERA_ANGLES&&t.cameraAnglesEnabled()===!0));},dependencies:[V,U,$t,vt,Jt,Xe,ti,ai,oi,si],styles:["[_nghost-%COMP%]{display:block}"]});}}return n;})();export{yo as TalkingPhotoWizardComponent};/**i18n:e059b5419240afef74436eb5a1887102ff8937e043a8d48b1423a03649476971*/ 4//# debugId=da96a9f3-6ddb-5224-a68b-69265d53a61d
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.