1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/src-D0IV0f1J.js","assets/vendor-7FYv43lO.js","assets/vendor-radix-7wwiYcv7.js","assets/rolldown-runtime-BgUFPplA.js","assets/vendor-legcy4jI.css"])))=>i.map(i=>d[i]); 2import{s as ae}from"./rolldown-runtime-BgUFPplA.js";import{$x as Rd,Ds as Ld,Lw as It,Ml as Dd,Mw as Md,Os as Ud,Qx as po,Ub as Pd,Yw as Od,Zw as la,_x as Bd,eS as mo,ex as mi,ix as Fd,jw as ye,lo as jd,nw as Nt,pS as Nd,pd as fi,pw as p,rw as Re,yx as Vd}from"./vendor-7FYv43lO.js";import{$ as Gd,Gt as Kd,Jt as Wd,Kt as Hd,Xt as qd,Yt as $d,Z as Yd,dn as zd,et as Qd,ln as Jd,nt as Xd,qt as Zd,tt as el}from"./vendor-radix-7wwiYcv7.js";import{A as hr,An as pr,Ar as Do,Cn as Mo,Ct as tl,En as ca,Fr as Be,Ft as et,Gr as ua,Gt as ol,Hr as gi,Ht as rl,Jt as al,Mr as sl,Nt as il,Pr as Ai,Qi as Xo,Tt as nl,Wt as dl,Yt as to,_i as os,_r as yi,an as ll,da as Tt,di as cl,gt as ul,ii as hl,kt as pl,ln as nt,m as ml,mt as bi,on as fl,pa as I,pt as _i,qt as gl,r as Xt,s as Al,tn as Ii,wa as yl,wn as Cr,wt as bl,xn as de,yt as _l}from"./util-CwJhy4uq.js";import{$n as Il,$t as Tl,Ai as Ce,B as rs,Bi as vl,Ci as Sl,Gt as wl,H as as,I as El,Ki as Ti,L as Uo,N as ss,Ni as Cl,O as vi,Oo as xl,Qa as kl,Qi as Si,Rn as wi,Si as Ei,Tt as Ci,V as Rl,Vt as Ll,W as qo,Xt as Dl,ao as qr,ar as $r,bo as Ml,cr as mr,ct as Ul,di as xi,dr as Pl,dt as is,fi as ki,go as Ri,i as uo,io as xr,ir as Ol,j as Bl,ko as ha,li as Li,ln as Fl,mi as jl,nn as Nl,on as Vl,oo as Gl,or as kr,pr as Kl,q as pa,qn as ns,rn as Wl,rr as Hl,st as ql,u as Di,un as Mi,yo as $l,z as Ui}from"./movingZoomHelpers-D5GAXqCT.js";import{C as fo,F as go,O as Ao,P as yo,R as fr,U as vt,W as Yl,c as ce,f as zl,i as Ql,m as Jl,p as Xl,t as Po,z as ma}from"./amplitude-BImStEgY.js";import{t as Ie}from"./SafeLocalStorage-D5FbXAxu.js";import{At as Pi,Bt as Zl,Q as Rr,Rt as ec,S as tc,Z as Zo,c as oc,en as rc,it as ac,l as gr,m as er,u as We,w as sc}from"./utils-C32JQUwF.js";import{$S as ic,$T as Yr,$c as Oi,$f as Bi,$h as Fi,$m as ji,AS as nc,Ag as dc,Ai as Ar,Au as Pt,Av as lc,B as cc,BS as uc,Bc as hc,Bt as yt,Bw as pc,CD as mc,CT as Ni,C_ as Vi,Cu as He,Cv as fc,DO as Gi,Da as gc,Dg as yr,EC as Ac,E_ as yc,Ef as he,Ev as bc,FS as _c,Fc as Ic,Fw as dt,Fx as mt,GC as Tc,GD as vc,GS as Sc,Gf as fa,Gl as wc,HE as ds,Hc as Ec,Hd as bo,Hm as Cc,IS as xc,Is as kc,Iw as Rc,Ix as Se,J as Lc,JS as ga,Jh as Ki,Jx as $o,K as Dc,KS as Mc,Ku as Uc,Kw as Wi,Lc as Pc,Lf as ho,Ls as Hi,MD as ne,Mb as Oc,Mc as Bc,Mw as Fc,NE as jc,Nu as Nc,OD as br,OT as Vc,O_ as Pe,Oa as Gc,Ou as Vt,Pu as Ot,Pw as Kc,Px as qi,Q as Wc,QD as Hc,QS as $i,QT as qc,Qf as $c,Qh as Aa,Ql as Yc,Qm as ya,RC as ie,Rd as _r,Ri as zc,Rm as Yi,Rp as zi,Ru as ba,SS as Qc,ST as Qi,Sa as Jc,Ss as Xc,Su as _o,TE as Zc,Uf as Ji,Uu as eu,Uw as _a,Ux as tu,Vc as ou,Vd as Xi,Vf as ru,Vt as au,Vu as Ze,W as su,WC as iu,WD as nu,W_ as Io,Wc as du,Wf as lu,Wm as Ia,Wu as cu,Wv as uu,X as hu,XD as zr,XT as pu,Xc as Ta,Xf as mu,Xm as Gt,Xp as va,Y as fu,YS as Qr,Yc as Zi,Yh as en,Ym as gu,Z as Au,Zc as yu,Zf as bu,Zm as tn,_h as _u,_s as Iu,aE as on,ad as Tu,ap as vu,bS as ls,b_ as Oe,bv as cs,cS as Su,cT as lt,cl as rn,cs as To,dS as wu,dy as Eu,eC as Cu,eg as an,eh as St,ep as xu,et as Sa,f as ku,fE as sn,fv as Ru,gS as vo,gv as Lu,hS as Du,hg as Mu,hv as Uu,ig as Pu,il as Ou,jS as Ir,j_ as Bu,jh as Fu,jm as nn,ju as So,jv as Kt,kD as ju,kS as us,km as wo,kn as Oo,ku as Nu,mO as Vu,mx as Gu,my as Ku,nC as Wu,nh as wa,nl as Ea,nv as Hu,o as qu,oC as $u,og as Eo,pS as Te,pi as Yu,pv as dn,pw as zu,q as Qu,qS as ln,qc as Ju,qn as cn,qp as hs,qw as bt,qx as Dt,rf as un,rl as Xu,rt as ps,rw as hn,s as Zu,sC as e1,sg as pn,ss as t1,tg as o1,tl as tr,u as r1,vh as m,vv as a1,wD as ke,wO as s1,w_ as i1,wc as Tr,wg as Bo,xC as n1,xp as K,xu as Bt,xw as wt,y_ as Lt,yt as d1,yu as l1,yv as c1,zS as u1,zc as h1,zi as p1}from"./LoadingFullScreen-bAuLA9h3.js";try{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="19299a01-8982-4ae9-ac20-22e6e4340bb6",e._sentryDebugIdIdentifier="sentry-dbid-19299a01-8982-4ae9-ac20-22e6e4340bb6")}catch{}{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=Object.assign({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:kapwing-app-key":!0})}const m1="1001",f1="1000",g1="58px",A1="Tooltip-module_TooltipContent_cDsTX",y1="Tooltip-module_slideDownAndFade_ncwkE",b1="Tooltip-module_slideLeftAndFade_sBAYd",_1="Tooltip-module_slideUpAndFade_BLgLA",I1="Tooltip-module_slideRightAndFade_lCUnQ",T1="Tooltip-module_TooltipArrow_gVdsC",v1="Tooltip-module_StudioToolTip_eqInC";var Fo={workspacePopoverZIndex:"18",popoverZIndex:"14",paywallZIndex:m1,paywallBgZIndex:f1,collapsedMediaSidebarWidth:g1,TooltipContent:A1,slideDownAndFade:y1,slideLeftAndFade:b1,slideUpAndFade:_1,slideRightAndFade:I1,TooltipArrow:T1,StudioToolTip:v1},S1=ae(ye()),v=ae(zd()),ms=ae(mo()),C=ae(Jd()),w1=1e3*60*60*24,E1=e=>{const t=(0,S1.c)(51),{children:o,delayDuration:r,message:s,wrapWithDiv:a,open:n,setOpen:i,style:l,side:d,align:c,noArrow:u,disabled:h,container:A,className:g,arrowClassName:y,tapToOpenOnTouchDevices:b}=e,_=r===void 0?500:r,S=d===void 0?"top":d,T=c===void 0?"center":c,w=b===void 0?!1:b,x=(0,v.useId)(),k=ml(),[M,j]=(0,v.useState)(!1),O
2=i||j,B=n!==void 0?n:M;let $;t[0]!==k||t[1]!==O?($=me=>{k||O(me)},t[0]=k,t[1]=O,t[2]=$):$=t[2];const Z=$;let Y,Q;t[3]!==x||t[4]!==O?(Q=me=>{const ge=me.target,be=document.querySelector(`[data-tooltip-root="${x}"]`);be&&(be.contains(ge)||(O(!1),document.removeEventListener("pointerdown",Q)))},t[3]=x,t[4]=O,t[5]=Q):Q=t[5];let L;t[6]!==Q?(L=[()=>document.addEventListener("pointerdown",Q),()=>document.removeEventListener("pointerdown",Q)],t[6]=Q,t[7]=L):L=t[7],Y=L;const[f,U]=Y;let P,F;t[8]!==g?(F=g?(0,ms.default)(Fo.TooltipContent,g):Fo.TooltipContent,t[8]=g,t[9]=F):F=t[9],P=F;const H=P;let N,W;t[10]!==y?(W=y?(0,ms.default)(Fo.TooltipArrow,y):Fo.TooltipArrow,t[10]=y,t[11]=W):W=t[11],N=W;const se=N;let G;t[12]!==o||t[13]!==a?(G=()=>a?(0,C.jsx)("div",{children:o}):o,t[12]=o,t[13]=a,t[14]=G):G=t[14];const z=G;if(h){let me;return t[15]!==z?(me=z(),t[15]=z,t[16]=me):me=t[16],me}const re=h?w1:_;let J;t[17]!==k||t[18]!==B||t[19]!==O||t[20]!==f||t[21]!==w||t[22]!==U?(J=me=>{k&&w&&me.pointerType==="touch"&&(O(C1),B?U():f())},t[17]=k,t[18]=B,t[19]=O,t[20]=f,t[21]=w,t[22]=U,t[23]=J):J=t[23];let q;t[24]!==z?(q=z(),t[24]=z,t[25]=q):q=t[25];let te;t[26]!==x||t[27]!==J||t[28]!==q?(te=(0,C.jsx)(qd,{"data-tooltip-root":x,asChild:!0,onPointerDown:J,children:q}),t[26]=x,t[27]=J,t[28]=q,t[29]=te):te=t[29];let X;t[30]!==s?(X=typeof s!="string"?s:s.split(` 3`).map(x1),t[30]=s,t[31]=X):X=t[31];let oe;t[32]!==se||t[33]!==u?(oe=!u&&(0,C.jsx)(Kd,{className:se}),t[32]=se,t[33]=u,t[34]=oe):oe=t[34];let pe;t[35]!==T||t[36]!==H||t[37]!==S||t[38]!==l||t[39]!==X||t[40]!==oe?(pe=(0,C.jsxs)(Hd,{className:H,sideOffset:5,style:l,side:S,align:T,children:[X,oe]}),t[35]=T,t[36]=H,t[37]=S,t[38]=l,t[39]=X,t[40]=oe,t[41]=pe):pe=t[41];let fe;t[42]!==A||t[43]!==pe?(fe=(0,C.jsx)(Zd,{container:A,children:pe}),t[42]=A,t[43]=pe,t[44]=fe):fe=t[44];let ue;return t[45]!==Z||t[46]!==B||t[47]!==re||t[48]!==te||t[49]!==fe?(ue=(0,C.jsx)(Wd,{children:(0,C.jsxs)($d,{delayDuration:re,onOpenChange:Z,open:B,children:[te,fe]})}),t[45]=Z,t[46]=B,t[47]=re,t[48]=te,t[49]=fe,t[50]=ue):ue=t[50],ue},Y7=v.memo(E1);function C1(e){return!e}function x1(e,t){return(0,C.jsx)("div",{children:e},t)}var mn=ae(ye()),fn=ae(Ud()),gn=ae(It());const z7=()=>{const e=(0,mn.c)(6),[t,o]=(0,v.useState)(null),[r,s]=(0,v.useState)(null);let a,n;e[0]!==t?(a=()=>{if(!t)return;const l=new fn.ResizeSensor(t,(0,gn.throttle)(d=>{const{width:c,height:u}=d;s({width:c,height:u})},120));return()=>l.detach()},n=[t],e[0]=t,e[1]=a,e[2]=n):(a=e[1],n=e[2]),(0,v.useEffect)(a,n);let i;return e[3]!==t||e[4]!==r?(i={containerDimensions:r,containerRef:o,container:t},e[3]=t,e[4]=r,e[5]=i):i=e[5],i},Q7=()=>{const e=(0,mn.c)(6),[t,o]=(0,v.useState)(null),[r,s]=(0,v.useState)(null);let a,n;e[0]!==t?(a=()=>{if(!t)return;const l=new fn.ResizeSensor(t,(0,gn.throttle)(()=>{s(t.getBoundingClientRect())},120));return()=>l.detach()},n=[t],e[0]=t,e[1]=a,e[2]=n):(a=e[1],n=e[2]),(0,v.useEffect)(a,n);let i;return e[3]!==t||e[4]!==r?(i={containerRect:r,setContainer:o,container:t},e[3]=t,e[4]=r,e[5]=i):i=e[5],i};var k1=e=>v.createElement("svg",{width:20,height:20,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("path",{d:"M5 9C7.20914 9 9 7.20914 9 5C9 2.79086 7.20914 1 5 1C2.79086 1 1 2.79086 1 5",stroke:"white"})),or=k1;const R1="1001",L1="1000",D1="58px",M1="common-module_home_-g5DV",U1="common-module_homeHowBackgroundWhite_lk0ar",P1="common-module_largeButton_Ow-Nu",O1="common-module_sectionContent_729kX",B1="common-module_sectionHeader_DGzNz",F1="common-module_spacer_qUHDO",j1="common-module_chevron_0zn3K",N1="common-module_splashText_cJRkE",V1="common-module_splashSubtext_Ff92p",G1="common-module_aboutSection_sVwjD",K1="common-module_mobile_YhPeR",W1="common-module_desktop_VhQ3J",H1="common-module_screenReaderOnlyLabel_8D71S",q1="common-module_disabled_IGHpz",$1="common-module_disabledWithPointerEvents_YgGKs",Y1="common-module_noScrollBar_vU4jz",z1="common-module_textOverflowEllipsis_a37Xy",Q1="common-module_disableTextHighlight_iUfji",J1="common-module_genericButtonBlue_oIz2h",X1="common-module_rmButtonUserAgentStyles_t1AuF",Z1="common-module_button_
3LAGoF",e2="common-module_buttonDisabled_34u7q",t2="common-module_buttonSelected_8KcUS",o2="common-module_buttonOk_Ej8NU",r2="common-module_buttonStacked_MzyG5",a2="common-module_doneButton_ExwF0",s2="common-module_controlSectionContainer_EKL5g",i2="common-module_section_MuPhT",n2="common-module_input_w2CGu",d2="common-module_cyanDoneButton_sTD5k",l2="common-module_cyanDoneButton__disabled_0GAF-",c2="common-module_cyanDoneButtonContainer_17DCB",u2="common-module_genericButton_m0lJB",h2="common-module_genericButtonSelected_d9XTy",p2="common-module_groupControlContainer_iVxdO",m2="common-module_controlSectionRows_2mfXH",f2="common-module_controlSectionRowsTimeline_avuf0",g2="common-module_controlSectionRowsTwoPerRow_gK-Ir",A2="common-module_controlSectionRowsFullWidth_LwfAt",y2="common-module_controlSectionRowsIconAndControl_sfzkz",b2="common-module_controlSectionTitle_yQcK-",_2="common-module_controlSectionTitleNoPadding_WuJp0",I2="common-module_strongControlSectionTitle_b-MF5",T2="common-module_controlSectionDescription_OV0H9",v2="common-module_smallControlButton_xMfva",S2="common-module_smallControlButtonDisabled_f-2UG",w2="common-module_smallControlButtonSelected_LW0Jv",E2="common-module_smallControlButtonLabel_wJ2Pt",C2="common-module_controlSectionRow_ioCki",x2="common-module_controlButtonIcon_Y9-M3",k2="common-module_controlButtonOnlyIcon_5PpkF",R2="common-module_controlButtonOnlyIconRoundedSmallTheme_-ZIud",L2="common-module_bigOverlayButton_0jtc7",D2="common-module_glimmer_S5Hva",M2="common-module_pulse_Qwb8D",U2="common-module_bigOverlayButtonSelected_3crax",P2="common-module_bigOverlayButtonDisabled_X7gAL",O2="common-module_bigOverlayButtonIcon_yiP8e",B2="common-module_incrementDecrementControl_vzUjt",F2="common-module_incrementDecrementControlLightTheme_ZTAiY",j2="
3common-module_incrementDecrementControlSmallTheme_IXXK3",N2="common-module_incrementDecrementControlExtraSmallTheme_NI7z0",V2="common-module_incrementDecrementButton_-Kdf7",G2="common-module_incrementDecrementButtonLightTheme_8uPZj",K2="common-module_incrementDecrementButtonSmallTheme_9CdBf",W2="common-module_incrementDecrementControlValue_-UE-a",H2="common-module_incrementDecrementControlValueSmallTheme_hNJ9b",q2="common-module_incrementControl_sW4Cx",$2="common-module_decrementControl_zSg-I",Y2="common-module_disabledIncrementDecrementButton_-WWtP",z2="common-module_tooltip_lKQsJ",Q2="common-module_selectDropDownContainer_nG7Sa",J2="common-module_selectDropDownDisplay_gn6ij",X2="common-module_selectDropDownDisabled_Sn9sA",Z2="common-module_selectDropDownLabel_fnSTP",e0="common-module_selectDropDownLabelContainer_MCkqE",t0="common-module_selectDropDownFlag_YUPZR",o0="common-module_proSparkle_wZpm-",r0="common-module_selectDropDownLink_aE19Y",a0="common-module_selectDropDownList_H9NXa",s0="common-module_selectDropDownListScrollContainer_X5hMP",i0="common-module_selectDropDownItem_roOdV",n0="common-module_selectDropDownItemDisabled_DX5lK",d0="common-module_selectDropDownItemLeft_H-0NV",l0="common-module_selectDropDownItemBottomStatic_ju0i0",c0="common-module_voiceCloneIcon_9EhMi",u0="common-module_bottomDivider_ooYCR",h0="common-module_selectDropDownItemSelected_ipQAY",p0="common-module_selectDropDownShowing_B10sC",m0="common-module_dropDownButtonIcon_OT298",f0="common-module_selectOptionIcon_zH0h3",g0="common-module_dropDownAddIcon_Cvqwe",A0="common-module_selectDropDownItemPreview_QTAV7",y0="common-module_selectDropDownItemPlayIcon_sUaW1",b0="common-module_transparentSelectInput_nLDPP",_0="common-module_selectOptionContainer_5ULEp",I0="common-module_dropDownHeader_Z2xsA",T0="common-module_noMargin_z-qx1",v0="common-module_halfWidth_aIEpa",S0="common-module_fullWidth_Wbf91",w0="common-module_selectDropDownIcon_4vVgD",E0="common-module_controlButtonsContainer_f7exr",C0="common-module_loadingIcon_Op3HO",x0="common-module_spin_6LUja",k0="common-module_iconAndLabelRow_Evfnw",R0="common-module_dropdownDirectInput_ZwfcF";var V={workspacePopoverZIndex:"18",popoverZIndex:"14",paywallZIndex:R1,paywallBgZIndex:L1,collapsedMediaSidebarWidth:D1,home:M1,homeHowBackgroundWhite:U1,largeButton:P1,sectionContent:O1,sectionHeader:B1,spacer:F1,chevron:j1,splashText:N1,splashSubtext:V1,aboutSection:G1,mobile:K1,desktop:W1,screenReaderOnlyLabel:H1,disabled:q1,disabledWithPointerEvents:$1,noScrollBar:Y1,textOverflowEllipsis:z1,disableTextHighlight:Q1,genericButtonBlue:J1,rmButtonUserAgentStyles:X1,button:Z1,buttonDisabled:e2,buttonSelected:t2,buttonOk:o2,buttonStacked:r2,doneButton:a2,controlSectionContainer:s2,section:i2,input:n2,cyanDoneButton:d2,cyanDoneButton__disabled:l2,cyanDoneButtonContainer:c2,genericButton:u2,genericButtonSelected:h2,groupControlContainer:p2,controlSectionRows:m2,controlSectionRowsTimeline:f2,controlSectionRowsTwoPerRow:g2,controlSectionRowsFullWidth:A2,controlSectionRowsIconAndControl:y2,controlSectionTitle:b2,controlSectionTitleNoPadding:_2,strongControlSectionTitle:I2,controlSectionDescription:T2,smallControlButton:v2,smallControlButtonDisabled:S2,smallControlButtonSelected:w2,smallControlButtonLabel:E2,controlSectionRow:C2,controlButtonIcon:x2,controlButtonOnlyIcon:k2,controlButtonOnlyIconRoundedSmallTheme:R2,bigOverlayButton:L2,glimmer:D2,pulse:M2,bigOverlayButtonSelected:U2,bigOverlayButtonDisabled:P2,bigOverlayButtonIcon:O2,incrementDecrementControl:B2,incrementDecrementControlLightTheme:F2,incrementDecrementControlSmallTheme:j2,incrementDecrementControlExtraSmallTheme:N2,incrementDecrementButton:V2,incrementDecrementButtonLightTheme:G2,incrementDecrementButtonSmallTheme:K2,incrementDecrementControlValue:W2,incrementDecrementControlValueSmallTheme:H2,incrementControl:q2,decrementControl:$2,disabledIncrementDecrementButton:Y2,tooltip:z2,selectDropDownContainer:Q2,selectDropDownDisplay:J2,selectDropDownDisabled:X2,selectDropDownLabel:Z2,selectDropDownLabelContainer:e0,selectDropDownFlag:t0,proSparkle:o0,selectDropDownLink:r0,selectDropDownList:a0,selectDropDownListScrollContainer:s0,selectDropDownItem:i0,selectDropDownItemDisabled:n0,selectDropDownItemLeft:d0,selectDropDownItemBottomStatic:l0,voiceCloneIcon:c0,bottomDivider:u0,selectDropDownItemSelected:h0,selectDropDownShowing:p0,dropDownButtonIcon:m0,selectOptionIcon:f0,dropDownAddIcon:g0,selectDropDownItemPreview:A0,selectDropDownItemPlayIcon:y0,transparentSelectInput:b0,selectOptionContainer:_0,dropDown
3Header:I0,noMargin:T0,halfWidth:v0,fullWidth:S0,selectDropDownIcon:w0,controlButtonsContainer:E0,loadingIcon:C0,spin:x0,iconAndLabelRow:k0,dropdownDirectInput:R0},L0=ae(ye());const rr=v.memo(e=>{const t=(0,L0.c)(8),{style:o,children:r,className:s}=e;let a;t[0]!==o?(a=o===void 0?{}:o,t[0]=o,t[1]=a):a=t[1];const n=a;let i;t[2]!==s?(i=[V.smallControlButtonLabel],s&&i.push(s),t[2]=s,t[3]=i):i=t[3];const l=i.join(" ");let d;return t[4]!==r||t[5]!==n||t[6]!==l?(d=(0,C.jsx)("div",{className:l,style:n,"data-testid":"small-control-button-label",children:r}),t[4]=r,t[5]=n,t[6]=l,t[7]=d):d=t[7],d});const D0="1001",M0="1000",U0="58px",P0="BigOverlayButton-module_sparkleContainer_EcqCY";var O0={workspacePopoverZIndex:"18",popoverZIndex:"14",paywallZIndex:D0,paywallBgZIndex:M0,collapsedMediaSidebarWidth:U0,sparkleContainer:P0},B0=ae(ye()),F0=ae(mo());const J7=v.forwardRef((e,t)=>{const o=(0,B0.c)(42),{icon:r,title:s,label:a,children:n,handleClick:i,disabled:l,selected:d,hasSparkle:c,showGlimmer:u,iconStyles:h,buttonStyles:A,buttonCSSClassStyles:g,showLoadingIcon:y}=e,b=l===void 0?!1:l;let _;o[0]!==h?(_=h===void 0?{}:h,o[0]=h,o[1]=_):_=o[1];const S=_;let T;o[2]!==A?(T=A===void 0?{}:A,o[2]=A,o[3]=T):T=o[3];const w=T,x=g===void 0?"":g,k=y===void 0?!1:y;let M;o[4]!==s?(M=`big-overlay-button-${s}`,M=M.replace(/ +/g,"-"),o[4]=s,o[5]=M):M=o[5];let j,O;o[6]!==S?(O={...S,height:17},o[6]=S,o[7]=O):O=o[7],j=O;const B=j;let $;o[8]!==x||o[9]!==b||o[10]!==d||o[11]!==u?($=(0,F0.default)({[x]:x,[V.bigOverlayButton]:!0,[V.bigOverlayButtonDisabled]:b,[V.bigOverlayButtonSelected]:d,[V.glimmer]:u}),o[8]=x,o[9]=b,o[10]=d,o[11]=u,o[12]=$):$=o[12];let Z;o[13]!==i?(Z=P=>{i(P),P.stopPropagation()},o[13]=i,o[14]=Z):Z=o[14];const Y=M;let Q;e:{if(k){const P=`${M}-loading-icon`;let F;o[15]!==B||o[16]!==P?(F=(0,C.jsx)(or,{style:B,className:V.loadingIcon,"data-testid":P}),o[15]=B,o[16]=P,o[17]=F):F=o[17],Q=F;break e}if(typeof r=="string"){let P;o[18]!==r||o[19]!==S||o[20]!==s?(P=(0,C.jsx)("img",{src:r,alt:s,style:S,className:V.bigOverlayButtonIcon,"data-testid":"big-overlay-button__image-icon"}),o[18]=r,o[19]=S,o[20]=s,o[21]=P):P=o[21],Q=P;break e}if(typeof r=="function"){const P=r;let F;o[22]!==P?(F=(0,C.jsx)(P,{}),o[22]=P,o[23]=F):F=o[23];let H;o[24]!==S||o[25]!==F?(H=(0,C.jsx)("div",{style:S,className:V.bigOverlayButtonIcon,children:F}),o[24]=S,o[25]=F,o[26]=H):H=o[26],Q=H;break e}Q=null}let L;o[27]!==a?(L=a&&(0,C.jsx)(rr,{children:a}),o[27]=a,o[28]=L):L=o[28];let f;o[29]!==c?(f=c&&(0,C.jsx)("div",{className:O0.sparkleContainer,children:(0,C.jsx)(Sa,{})}),o[29]=c,o[30]=f):f=o[30];let U;return o[31]!==w||o[32]!==n||o[33]!==M||o[34]!==t||o[35]!==d||o[36]!==$||o[37]!==Z||o[38]!==Q||o[39]!==L||o[40]!==f?(U=(0,C.jsxs)("div",{className:$,onPointerDown:j0,onClick:Z,style:w,"data-testid":Y,"data-selected":d,ref:t,children:[Q,L,n,f]}),o[31]=w,o[32]=n,o[33]=M,o[34]=t,o[35]=d,o[36]=$,o[37]=Z,o[38]=Q,o[39]=L,o[40]=f,o[41]=U):U=o[41],U});function j0(e){e.stopPropagation()}const N0="1001",V0="1000",G0="58px",K0="SmallControlSelectDropDown-module_tooltip_bn3hF";var W0={workspacePopoverZIndex:"18",popoverZIndex:"14",paywallZIndex:N0,paywallBgZIndex:V0,collapsedMediaSidebarWidth:G0,tooltip:K0},H0=ae(ye());function q0(){const e=new Audio;return e.preload="none",e}const $0=()=>{const e=(0,H0.c)(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=q0(),e[0]=t):t=e[0];const o=(0,v.useRef)(t);let r,s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=function(){const n=o.current;return function(){n.pause()}},s=[],e[1]=r,e[2]=s):(r=e[1],s=e[2]),(0,v.useEffect)(r,s),o},Y0=v.memo(({item:e,value:t,setMouseUp:o,handleConfirm:r,setClickingPreview:s,previewCurrentlyPlaying:a,setPreviewCurrentlyPlaying:n,alignItemsLeft:i,itemsFontSize:l,disabled:d})=>{const[c,u]=(0,v.useState)(!1),h=$0();return h.current.onended=function(){u(!1)},(0,v.useEffect)(function(){c&&a!==e.audioPreview&&(u(!1),h.current.pause())},[c,e.audioPreview,h,a]),(0,C.jsxs)("button",{type:"button",className:`${i?V.selectDropDownItemLeft:V.selectDropDownItem} ${e.value===t?V.selectDropDownItemSelected:""} ${d?V.selectDropDownItemDisabled:""}`,onMouseDown:()=>o(!1),onMouseUp:A=>{A.button===0&&(o(!0),r(e.value))},disabled:d,children:[e.iconUrl&&(typeof e.iconUrl=="string"?(0,C.jsx)("img",{className:V.selectDropDownIcon,style:e.iconStyle,src:e.iconUrl,alt:`${e.value} icon item`}):(0,C.jsx)(e.iconUrl,{})),(0,C.jsxs)("div",{className:V.selectDropDownLabelContainer,children:[e.flagUrl&&(0,C.jsx)("img",{className:V.selectDropDownFlag,src:e.flagUrl,alt:"flag icon"}),(0,C.jsx)("span",{className:V.selectDropDownLabel,style:{fontSize:l},children:e.label}),e.isPremium&&(0,C.jsx)(Sa,{}),e?.isVoiceClone&&(0,C.jsx)("div",{className:V.voiceCloneIcon,children:(0,C.jsx)(fi,{})})]}),e.audioPreview&&(0,C.jsx)("div",{className:V.selectDropDownItemPreview,onMouseDown:A=>{A.stopPropagation(),s(!0),e.audioPreview&&(c?(u(!1),h.current.pause()):(h.current.src=e.audioPreview,u(!0),n(e.audioPreview),h.current.play(),ce("Text to Speech Audio Preview",{Voice:e.label,Source:"Media Sidebar"})))},onMouseUp:A=>{A.stopPropagation(),s(!1)},children:(0,C.jsx)("img",{className:V.selectDropDownItemPlayIcon,src:c?"https://cdn-useast1.kapwing.com/static/RBD-PauseButtonGray.webp":"https://cdn-useast1.kapwing.com/static/QXm-playButtonGray.webp",alt:"Play Preview"})})]})}),X7=v.memo(({value:e,listItems:t,onChange:o,allowArrowKeys:r=!1,dataTestId:s="",allowDirectInput:a=!1,className:n,halfWidth:i,displayMinHeight:l,dropdownMaxHeight:d,dropdownListClassName:c,alignItemsLeft:u,itemsFontSize:h,displayFontSize:A,disabled:g,disabledReason:y})=>{const b=(0,v.useRef)(null),_=(0,v.useRef)(null),[S,T]=(0,v.useState)(!1),[w,x]=(0,v.useState)(!1),[k,M]=(0,v.useState)(!1),[j,O]=(0,v.useState)(""),B=(0,v.useRef)(()=>{}),[$,Z]=(0,v.useState)(null),[Y,Q]=(0,v.useState)(!1),L=t.find(q=>q.value===e),f=!!L&&!!L.iconUrl,U=L?L.selectedLabel??L.label:e,P=$===null?e:$;let F=S?`${V.selectDropDownDisplay} ${V.selectDropDownShowing}`:V.selectDropDownDisplay;g&&(F+=` ${V.selectDropDownDisabled}`),(0,v.useEffect)(()=>{S||(b.current?.blur(),_.current?.blur())},[S]),(0,v.useEffect)(()=>()=>B.current(),[B]);const H=(0,v.useCallback)(()=>
3{if(!r||!L)return;const q=t[t.indexOf(L)-1];q&&o(q.value)},[r,t,o,L]),N=(0,v.useCallback)(()=>{if(!r||!L)return;const q=t[t.indexOf(L)+1];q&&o(q.value)},[r,t,o,L]),W=(0,v.useCallback)(()=>{T(!1),x(!1)},[]),se=q=>{o(q),W()},G=(0,v.useCallback)(()=>{$&&(o($),Z(null))},[$,Z,o]);B.current=G;const z=(0,v.useCallback)(q=>{const te=q.target;Z(te.value),q.preventDefault(),q.stopPropagation()},[Z]),re=(0,v.useCallback)(q=>{({Tab:N,ArrowUp:H,ArrowDown:N,Escape:W}[q.key]||(()=>{}))(),a||(q.preventDefault(),q.stopPropagation())},[H,N,W,a]),J=(0,v.useCallback)(q=>{q.key==="Enter"&&G()},[G]);return(0,C.jsxs)("div",{"data-testid":s||"small-control-select-dropdown",className:`${V.selectDropDownContainer} ${i&&V.halfWidth} ${n}`,onKeyDown:re,onMouseEnter:()=>g&&y&&Q(!0),onMouseLeave:()=>Q(!1),children:[g&&y&&Y&&(0,C.jsx)("div",{className:W0.tooltip,children:y}),(0,C.jsxs)("div",{role:"button",ref:b,className:F,style:{minHeight:l},"data-testid":`${s}__button`,tabIndex:0,onBlur:()=>{w&&!k&&W()},onMouseUp:()=>{g||(S&&w&&!k?W():(T(!0),x(!0)))},children:[f&&(typeof L.iconUrl=="string"?(0,C.jsx)("img",{className:V.selectDropDownIcon,style:{width:"30px",...L.iconStyle},src:L.iconUrl,alt:`${L.value} icon confirm`,"data-testid":`${s}__icon`}):L.iconUrl&&(0,C.jsx)(L.iconUrl,{})),a?(0,C.jsx)("input",{type:"text",value:P,className:V.dropdownDirectInput,onBlur:G,onChange:z,onKeyPress:J,"data-testid":`${s}__input`}):(0,C.jsxs)("div",{className:V.selectDropDownLabelContainer,children:[L?.flagUrl&&(0,C.jsx)("img",{className:V.selectDropDownFlag,src:L?.flagUrl,alt:"flag icon"}),(0,C.jsx)("span",{className:V.selectDropDownLabel,style:{fontSize:A},"data-testid":`${s}__label`,children:U}),L?.isVoiceClone&&(0,C.jsx)("div",{className:V.voiceCloneIcon,children:(0,C.jsx)(fi,{})})]}),(0,C.jsx)(Dd,{className:V.dropDownButtonIcon,id:"dropdown-button"})]}),(0,C.jsx)("div",{ref:_,className:`${V.selectDropDownList} ${c||""}`,style:{display:S?"block":"none",top:l&&"46px"},tabIndex:-1,onBlur:()=>{w&&!k&&W()},onMouseDownCapture:()=>x(!1),onMouseUpCapture:()=>x(!0),children:(0,C.jsx)("div",{className:V.selectDropDownListScrollContainer,style:{maxHeight:d},children:t.map((q,te)=>(0,C.jsx)(Y0,{item:q,value:e,setMouseUp:x,handleConfirm:se,previewCurrentlyPlaying:j,setPreviewCurrentlyPlaying:O,setClickingPreview:M,al
3ignItemsLeft:u,itemsFontSize:h,disabled:q.disabled},`${q.label}-${te}`))})})]})});var z0=ae(ye()),Q0={color:"#6E7077"};const Z7=v.memo(e=>{const t=(0,z0.c)(17),{icon:o,label:r,onIconClick:s}=e;if(!o)return null;const a=`${r.toUpperCase().replace(/ /g,"-").replace(/[:#]/g,"")}-icon`;if(o==="loadingIcon"){let g;return t[0]===Symbol.for("react.memo_cache_sentinel")?(g=(0,C.jsxs)("div",{className:V.iconAndLabelRow,"data-testid":"icon-and-label",children:[(0,C.jsx)("div",{style:{width:"30px",display:"flex",justifyContent:"center"},children:(0,C.jsx)(or,{className:V.loadingIcon})}),(0,C.jsx)(rr,{style:Q0,children:"Volume"})]}),t[0]=g):g=t[0],g}let n;t[1]!==o?(n=function(){if(!o)return null;if(o?.render)return o.render();switch(typeof o){case"string":return(0,C.jsx)("img",{src:o,className:V.bigOverlayButtonIcon,alt:"","data-testid":"icon-and-label-row__image-icon"});case"function":{const y=o;return(0,C.jsx)("div",{className:V.bigOverlayButtonIcon,"data-testid":"icon-and-label-row__component-icon",children:(0,C.jsx)(y,{})})}default:return o}},t[1]=o,t[2]=n):n=t[2];const i=n,l=s?"pointer":"inherit";let d;t[3]!==l?(d={width:"30px",display:"flex",justifyContent:"center",cursor:l},t[3]=l,t[4]=d):d=t[4];let c;t[5]!==i?(c=i(),t[5]=i,t[6]=c):c=t[6];let u;t[7]!==a||t[8]!==s||t[9]!==d||t[10]!==c?(u=(0,C.jsx)("div",{style:d,onClick:s,"data-testid":a,children:c}),t[7]=a,t[8]=s,t[9]=d,t[10]=c,t[11]=u):u=t[11];let h;t[12]!==r?(h=(0,C.jsx)(rr,{children:r}),t[12]=r,t[13]=h):h=t[13];let A;return t[14]!==u||t[15]!==h?(A=(0,C.jsxs)("div",{className:V.iconAndLabelRow,"data-testid":"icon-and-label",children:[u,h]}),t[14]=u,t[15]=h,t[16]=A):A=t[16],A});var J0=ae(ye()),X0=v.memo(e=>{const t=(0,J0.c)(4),{children:o,style:r,noPadding:s,strongTitle:a}=e;let n=s?V.controlSectionTitleNoPadding:V.controlSectionTitle;a&&(n=n+` ${V.strongControlSectionTitle}`);let i;return t[0]!==o||t[1]!==r||t[2]!==n?(i=(0,C.jsx)("div",{className:n,style:r,children:o}),t[0]=o,t[1]=r,t[2]=n,t[3]=i):i=t[3],i}),Z0=X0;const eh="1001",th="1000",oh="58px",rh="MenuMessage-module_menuMessage_JuUvJ";var ah={workspacePopoverZIndex:"18",popoverZIndex:"14",paywallZIndex:eh,paywallBgZIndex:th,collapsedMediaSidebarWidth:oh,menuMessage:rh},sh=ae(ye());const e8=v.memo(e=>{const t=(0,sh.c)(3),{text:o}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,C.jsx)(Z0,{}),t[0]=r):r=t[0];let s;return t[1]!==o?(s=(0,C.jsxs)(C.Fragment,{children:[r,(0,C.jsx)("div",{className:ah.menuMessage,children:o})]}),t[1]=o,t[2]=s):s=t[2],s});var ih="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAAAeCAYAAABZs0CNAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAB4SURBVHgB7dyxDcAgAANBiLL/ysAOfEFxJ3mEbz3XMYAb6xvANSFBQEgQEBIEhAQBIUFASBAQEgSEBAEhQUBIEBASBIQEASFBQEgQEBIEhAQBIUFASBAQEgSEBAEhQUBIEBASBIQEASFBQEgQEBIE/jMn+u+bg6dt4RYGOdVsFE0AAAAASUVORK5CYII=",nh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMoAAADKCAYAAADkZd+oAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKYSURBVHgB7d1BasMwFABRpeRe7U0aerJepReLmkD3HUjkgP0eaG2MPQJt9MdgiTnnZW7ren/mYIm3AfxLKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQHAe8KA559i78+0lL4MVPsa2Trf1/oKf9jT2b57mEbYDeMx0RoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBAIBQKhQCAUCIQCgVAgEAoEQoFAKBDcL+l2peoar7qT1/d8vnkP5WuwwsdtfY5tfd/Wz+DZbD6r3KcEzG1dTSZYxxkFAqFAIBQIhAKBUCAQyj
3pHmG14GEJZwFjM/REKBEKBQCgQCAUCoUAgFAiEAoFQIBAKBEKBQCgQCAUCoUAgFAiEAoFQIBAKBEKBQCgQCAUCoUAgFAiEAoFQIBAKBEKBQCgQCAUCoUAgFAiEAoFQIBAKBEKBQCgQCAUCoUAgFAiEAoFQIBAKBEKBQCgQCAUCoUAgFAiEAoFQIBAKBEKBQCgQCAUCoUAgFAiEAoFQIBAKBEKBQCgQCAUCoUAgFAiEAoFQIBAKBEKBQCgQCAUCoUAgFAiEAoFQIBAKBEKBQCgQCAUCoUBwHqwy/9Zen3cov+TEC2aS5UVtAAAAAElFTkSuQmCC",dh=ae(ye());const t8=v.forwardRef((e,t)=>{const o=(0,dh.c)(43),{containerStyle:r,dataTestId:s,decrement:a,disableDecrement:n,disableIncrement:i,extraSmallTheme:l,increment:d,incrementDecrementValueStyles:c,lightTheme:u,smallTheme:h,symbol:A,value:g}=e,y=n===void 0?!1:n,b=i===void 0?!1:i,_=l===void 0?!1:l,S=u===void 0?!1:u,T=(0,v.useRef)(null),w=(0,v.useRef)(0),x=(0,v.useRef)(y),k=(0,v.useRef)(b),M=(0,v.useRef)(a),j=(0,v.useRef)(d);let O=V.incrementDecrementControl,B=V.incrementDecrementControlValue,$=V.incrementDecrementButton,Z=V.controlButtonOnlyIcon;h||_?(O=_?V.incrementDecrementControlExtraSmallTheme:V.incrementDecrementControlSmallTheme,B=V.incrementDecrementControlValueSmallTheme,$=V.incrementDecrementButtonSmallTheme,Z=V.controlButtonOnlyIconRoundedSmallTheme):S&&(O=V.incrementDecrementControlLightTheme,$=V.incrementDecrementButtonLightTheme);let Y,Q;o[0]===Symbol.for("react.memo_cache_sentinel")?(Q=ge=>{Y();const be=()=>ge?k.current?(Y(),!1):(j.current(),!0):x.current?(Y(),!1):(M.current(),!0);be()&&(T.current=window.setInterval(()=>{w.current=w.current+1,w.current>=4&&be()},150))},Y=()=>{T.current&&clearInterval(T.current),T.current=null,w.current=0},o[0]=Y,o[1]=Q):(Y=o[0],Q=o[1]);let L,f;o[2]===Symbol.for("react.memo_cache_sentinel")?(L=function(){return Y},f=[],o[2]=L,o[3]=f):(L=o[2],f=o[3]),(0,v.useEffect)(L,f);let U,P;o[4]!==y?(U=function(){x.current=y},P=[y],o[4]=y,o[5]=U,o[6]=P):(U=o[5],P=o[6]),(0,v.useEffect)(U,P);let F,H;o[7]!==b?(H=function(){k.current=b},F=[b],o[7]=b,o[8]=F,o[9]=H):(F=o[8],H=o[9]),(0,v.useEffect)(H,F);let N,W;o[10]!==d?(N=function(){j.current=d},W=[d],o[10]=d,o[11]=N,o[12]=W):(N=o[11],W=o[12]),(0,v.useEffect)(N,W);let se,G;o[13]!==a?(se=function(){M.current=a},G=[a],o[13]=a,o[14]=se,o[15]=G):(se=o[14],G=o[15]),(0,v.useEffect)(se,G);const z=y?V.disabledIncrementDecrementButton:$;let re;o[16]===Symbol.for("react.memo_cache_sentinel")?(re=()=>Q(!1),o[16]=re):re=o[16];let J;o[17]!==Z?(J=(0,C.jsx)("img",{src:ih,alt:"Decrement",className:Z}),o[17]=Z,o[18]=J):J=o[18];let q;o[19]!==z||o[20]!==J?(q=(0,C.jsx)("div",{className:V.decrementControl,children:(0,C.jsx)("div",{className:z,onMouseDown:re,onMouseLeave:Y,onMouseUp:Y,"data-testid":"decrement-control",children:J})}),o[19]=z,o[20]=J,o[21]=q):q=o[21];let te;o[22]!==g?(te=(0,C.jsx)("span",{children:g}),o[22]=g,o[23]=te):te=o[23];let X;o[24]!==B||o[25]!==c||o[26]!==A||o[27]!==te?(X=(0,C.jsxs)("div",{className:B,style:c,"data-testid":"increment-decrement-value",children:[te,A]}),o[24]=B,o[25]=c,o[26]=A,o[27]=te,o[28]=X):X=o[28];const oe=b?V.disabledIncrementDecrementButton:$;let pe;o[29]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>Q(!0),o[29]=pe):pe=o[29];let fe;o[30]!==Z?(fe=(0,C.jsx)("img",{src:nh,alt:"Increment",className:Z}),o[30]=Z,o[31]=fe):fe=o[31];let ue;o[32]!==oe||o[33]!==fe?(ue=(0,C.jsx)("div",{className:V.incrementControl,children:(0,C.jsx)("div",{className:oe,onMouseDown:pe,onMouseLeave:Y,onMouseUp:Y,"data-testid":"increment-control",children:fe})}),o[32]=oe,o[33]=fe,o[34]=ue):ue=o[34];let me;return o[35]!==r||o[36]!==O||o[37]!==s||o[38]!==t||o[39]!==q||o[40]!==X||o[41]!==ue?(me=(0,C.jsxs)("div",{className:O,style:r,"data-testid":s,ref:t,children:[q,X,ue]}),o[35]=r,o[36]=O,o[37]=s,o[38]=t,o[39]=q,o[40]=X,o[41]=ue,o[42]=me):me=o[42],me});var lh=ae(ye());const o8=v.memo(e=>{const t=(0,lh.c)(3),{children:o,style:r}=e;let s;return t[0]!==o||t[1]!==r?(s=(0,C.jsx)("div",{className:V.controlSectionRow,style:r,children:o}),t[0]=o,t[1]=r,t[2]=s):s=t[2],s});var ch=ae(ye()),fs=ae(mo()),gs={right:0,marginRight:4,top:2.2,height:14};const r8=v.forwardRef((e,t)=>{const o=(0,ch.c)(50),{icon:r,title:s,label:a,selected:n,disabled:i,children:l,handleClick:d,labelFont:c,style:u,iconStyle:h,labelClassName:A,labelFontStyle:g,className:y,selectedClassName:b,type:_,dataTestId:S,dataTestIdString:T,hasSparkle:w,isLoading:x,onMouseEnter:k,onMouseLeave:M,iconClassName:j}=e,O=s===void 0?"":s,B=a===void 0?"":a,$=n===void 0?!1:n,Z=i===void 0?!1:i,Y=y===void 0?"":y,Q=b===void 0?"":b,L=_===void 0?"":_,f=S===void 0?"":S,U=T===void 0?"":T,P=w===void 0?!1:w,F=x===void 0?!1:x;let H,N;o[0]!==c?(N=c?{fontFamily:c}:{},o[0]=c,o[1]=N):N=o[1];let W=N;if(g){let ue;o[2]!==g||o[3]!==W?(ue={...W,...g},o[2]=g,o[3]=W,o[4]=ue):ue=o[4],W=ue}H=W;const se=H;let G;f?G=f:U?G=`${U.replace(/ /g,"-").replace(/[:#]/g,"")}
3-small-control-button`:B&&typeof B=="string"?G=`${B.replace(/ /g,"-").replace(/[:#]/g,"")}-small-control-button`:L?G=`${L}-small-control-button`:G="small-control-button";let z=`${V.smallControlButton}`;Z?z=`${V.smallControlButton} ${V.smallControlButtonDisabled}`:$&&(z=`${V.smallControlButton} ${V.smallControlButtonSelected}`,Q&&(z=z+` ${Q}`)),Y&&(z=z+` ${Y}`);const re=G,J=!!$,q=z;let te;o[5]!==Z||o[6]!==d?(te=ue=>{Z||d?.(ue)},o[5]=Z,o[6]=d,o[7]=te):te=o[7];let X;e:{if(typeof r=="string"){const ue=B?V.controlButtonIcon:V.controlButtonOnlyIcon;let me;o[8]!==j||o[9]!==ue?(me=(0,fs.default)(ue,j),o[8]=j,o[9]=ue,o[10]=me):me=o[10];let ge;o[11]!==r||o[12]!==h||o[13]!==me||o[14]!==O?(ge=(0,C.jsx)("img",{src:r,alt:O,className:me,style:h,"data-testid":"small-control-button__image-icon"}),o[11]=r,o[12]=h,o[13]=me,o[14]=O,o[15]=ge):ge=o[15];let be;o[16]!==F?(be=F&&(0,C.jsx)(or,{className:V.loadingIcon,style:gs}),o[16]=F,o[17]=be):be=o[17];let tt;o[18]!==ge||o[19]!==be?(tt=(0,C.jsxs)(C.Fragment,{children:[ge,be]}),o[18]=ge,o[19]=be,o[20]=tt):tt=o[20],X=tt;break e}if(typeof r=="function"){const ue=r,me=B?V.controlButtonIcon:V.controlButtonOnlyIcon;let ge;o[21]!==j||o[22]!==me?(ge=(0,fs.default)(me,j),o[21]=j,o[22]=me,o[23]=ge):ge=o[23];let be;o[24]!==ue?(be=(0,C.jsx)(ue,{}),o[24]=ue,o[25]=be):be=o[25];let tt;o[26]!==h||o[27]!==ge||o[28]!==be?(tt=(0,C.jsx)("div",{className:ge,style:h,"data-testid":"small-control-button__icon",children:be}),o[26]=h,o[27]=ge,o[28]=be,o[29]=tt):tt=o[29],X=tt;break e}if(typeof r=="object"){X=r;break e}X=null}let oe;o[30]!==se||o[31]!==F||o[32]!==B||o[33]!==A?(oe=B&&(0,C.jsx)(rr,{style:se,className:A,children:F?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(or,{className:V.loadingIcon,style:gs}),B]}):B}),o[30]=se,o[31]=F,o[32]=B,o[33]=A,o[34]=oe):oe=o[34];let pe;o[35]!==P?(pe=P&&(0,C.jsx)(Sa,{}),o[35]=P,o[36]=pe):pe=o[36];let fe;return o[37]!==l||o[38]!==z||o[39]!==G||o[40]!==t||o[41]!==k||o[42]!==M||o[43]!==u||o[44]!==J||o[45]!==te||o[46]!==X||o[47]!==oe||o[48]!==pe?(fe=(0,C.jsxs)("div",{ref:t,"data-testid":re,"data-testid-selected":J,className:q,onMouseEnter:k,onMouseLeave:M,onClick:te,style:u,children:[l,X,oe,pe]}),o[37]=l,o[38]=z,o[39]=G,o[40]=t,o[41]=k,o[42]=M,o[43]=u,o[44]=J,o[45]=te,o[46]=X,o[47]=oe,o[48]=pe,o[49]=fe):fe=o[49],fe}),uh="Sample text",Jr=(e,t,o=!1,r=!1)=>{const{state:s}=I(),a=Mi(s,e.id).fontSizingTemp,n=r?a??e:e;if(n&&n.baseWidth!==t){if(r){on(e.id,{fontSizingTemp:{fontSize:n.fontSize,baseWidth:t}});return}bt({[e.id]:{baseWidth:t}},"text.ts",o)}},a8=(e,t="")=>{const{state:o}=I();if(!Fl(o,e.id)||e.type!=="text")return;const{textTemp:r=""}=Mi(o,e.id);if(r===""&&t===""){Ot({layerIds:[e.id],undoable:!0,source:"studioExitTextLayer"});return}on(e.id,{isEditing:!1})},hh=e=>{const{dispatch:t}=I();t(Sl(e))},s8=(e,t,o=!1)=>{const{width:r,x:s,y:a}=t||pu(e),{containerWidth:n,containerHeight:i}=gc(e),l=o?r:n;eu(e,{x:s,y:a,width:l,height:i,rotation:e.position?.rotation},!0),Jr(e,l,!0)};function i8(e,t,o,r=!0){const s=Jc(e,t,o);if(!s)return e.fontSize;const a=Gc(t,e.baseWidth);return(s!==e.fontSize||a!==1||e.baseWidth==null)&&(r?Pe.execInUndoBatch(()=>{bt({[e.id]:{fontSize:s}},"recomputeFontSize",!0),Jr(e,t,!0)}):(bt({[e.id]:{fontSize:s}},"recomputeFontSize",!1),Jr(e,t,!1))),s}const n8=e=>{if(!e.checkIfSeenByUser)return;const{state:t,dispatch:o}=I(),r=t.textPresets.usedPresetIds;!r||r[e.presetId]||o(du(e.presetId))},ph=async e=>{await ne.presets.text.insert.mutate({preset:e})},mh=async e=>(await ne.presets.text.get.query({teamId:e})).presets,fh=async e=>{await ne.presets.text.update.mutate({preset:e})},gh=async e=>{await ne.presets.text.updateMany.mutate({presets:e})},Ah=async(e,t)=>{await ne.presets.text.delete.mutate({teamId:e,presetId:t})};var An=ae(ye()),yh=ae(Pd()),Yo=ae(It()),Ca=ae(po());var As=0,bh=e=>{if(e.every(o=>o.title))return e;let t=1;for(const o of e)o.title||(o.title=`Brand Style ${t}`,t++);return gh(e),e};const _h=async e=>{const{dispatch:t}=I(),o=Date.now();if(o-As<1e3*10)return;As=o;let r=await mh(e);r&&(r=bh(r),t(yu({brandkitPresets:r})))},Ih=e=>{const t=[];return e.forEach(({style:{hasCustomFont:o,asset_id:r}})=>{o&&r&&t.push(r)}),t},Th=(e,t)=>{const{style:{hasCustomFont:o,asset_id:r}}=e;return o&&r&&t[r]?.url?{...e,style:{...e.style,url:t[r]?.url}}:e};var vh=async()=>{const{dispatch:e,state:t}=I(),{presets:o}=t.textPresets,r=Ih(o);if(!r.every(s=>{const a=t.assets.byId[s];return a?.url&&!Tt(a.url)}))try{const s=await pn(r,Aa.textPresets);e(Te(s));const a=s.reduce((n,i)=>(n[i._id]=i,n),{});e(Oi({presets:o.map(n=>Th(n,a))}))}catch(s){console.error("refreshSubtitlePresetFontAssetUrls err",s)}};const d8=async(e,t)=>{const{dispatch:o,state:r}=I();try{const s={...e,teamId:Ai(r),timestampCreated:Date.now()};s.presetId==="LAST_USED"&&(s.presetId=`preset-${(0,Ca.default)()}`,s.title="Brand Style"),o(Ec({preset:s,index:t})),await ph(s),o(ke({description:"Your text style is now accessible to everyone on your team!",type:"success"})),yr("add","textPreset")}catch(s){Se({description:"Failed to save text style.",error:s})}},l8=async e=>{try{await fh(e)}catch(t){Se({description:"Failed to update text style.",error:t})}},c8=async e=>{const{dispatch:t,state:o}=I(),r=Be(o);if(r)try{t(Ju({presetId:e})),await Ah(r,e),yr("remove","textPreset")}catch(s){Se({description:"Failed to remove text style.",error:s})}},yn=()=>{const{state:e,dispatch:t}=I(),{showCanvas:o}=e.studio;
3o||(Tu({ratioWidth:16,ratioHeight:9,undoable:!0}),t(dn({undoable:!0})))},Sh=e=>{const t=e.italic?"italic":"normal",o=document.createElement("canvas").getContext("2d");if(!o)return 0;const r=e.fontWeight||"normal",s=Oc(e);o.font=`${t} normal ${r} ${e.fontSize}px ${s}`;let a=e.text;return e.textTransform==="uppercase"?a=e.text.toLocaleUpperCase():e.textTransform==="lowercase"&&(a=e.text.toLocaleLowerCase()),o.measureText(a).width},u8=2;var ys={};const h8=(e,t,o)=>{const r=`${e.presetId}_${t}_${o}`,s=ys[r];if(s)return s;const{width:a,height:n}=bn(e).position,i=Oe(a),l=Oe(n),d={width:t*i/100,height:o*l/100};return ys[r]=d,d},Xe=e=>["white","#ffffff","#fff","rgb(255,255,255)"].includes(e?.toLowerCase().replaceAll(" ","")),Ge=e=>["black","#000000","#000","rgb(0,0,0)"].includes(e?.toLowerCase().replaceAll(" ","")),Mt=e=>["transparent","rgba(0,0,0,0)",vi].includes(e?.toLowerCase().replaceAll(" ","")),wh=e=>(0,yh.default)(e).lightness()>50?"#000000":"#FFFFFF",Xr=e=>!!(Xe(e.style.color)&&Mt(e.style.backgroundColor)&&(!e.style.textShadow||e.style.textShadow==="none"||Mt(e.style.textShadow)||Xe(e.style.textShadow))&&(!e.style.textEffe
3ct||Xe(e.style.textEffectColor??"")||Mt(e.style.textEffectColor??""))),Eh=e=>!!(Ge(e.style.color)&&Mt(e.style.backgroundColor)&&(!e.style.textShadow||e.style.textShadow==="none"||Mt(e.style.textShadow)||Ge(e.style.textShadow))&&(!e.style.textEffect||Ge(e.style.textEffectColor??"")||Mt(e.style.textEffectColor??""))),Ch=e=>{const{state:t}=I();let o;const r=t.studio.background.toLowerCase()||"";return Xe(r)&&Xr(e)&&e.presetId!=="BASIC"&&(o={color:"#000000",width:20}),Ge(r)&&Eh(e)&&e.presetId!=="BASIC"&&(o={color:"#ffffff",width:20}),o},bn=(e,t={})=>{const{state:o}=I(),r=uo(),s=Hi(o.studio,sn(o.studio)),{canvasDimensions:a}=o.studioSizing,{canvasWidth:n,canvasHeight:i}=a||{},l=n||320,d=i||320*9/16,c=n/i,u=i?Math.floor(i*(.1*c)):16,h=o.isMobile?u:33,A=o.studio?.background.toLowerCase()||"",g=Ch(e);g&&(t.textOutline=g),e.presetId==="BASIC"&&(t.color=wh(A));const y={id:Nt(12),presetId:e.presetId,backgroundColor:e.style.backgroundColor,fontFamily:e.style.fontFamily,hasCustomFont:e.style.hasCustomFont,asset_id:e.style.asset_id,fontType:e.style.fontType,fontWeight:e.style.fontWeight,textAlign:e.style.textAlign,textTransform:e.style.textTransform,textOutline:e.style.textOutline,textShadow:e.style.textShadow==="none"?"transparent":e.style.textShadow,color:e.style.color,textBlur:e.style.textBlur,textEffect:e.style.textEffe
3ct==="dropShadow"?void 0:e.style.textEffect,textDropShadowColor:e.style.textEffectColor,textPadding:e.style.textPadding,wrapOrFill:e.style.wrapOrFill,textShadowBlur:e.style.textShadowBlur,textShadowDist:e.style.textShadowDist,textShadowRot:e.style.textShadowRot,borderRadius:e.style.borderRadius,underline:e.style.underline,italic:e.style.italic,globalAlpha:e.style.globalAlpha,lineHeight:e.style.lineHeight,type:de.Text,fontSize:h,baseWidth:l,text:uh,startTime:r,endTime:s>0?r+2:r,...t};if(e.style.hasCustomFont){const{fontType:S,fontFamily:T,asset_id:w}=e.style;y.hasCustomFont=!0,y.asset_id=w,y.fontType=S,y.fontFamily=T}const b=Sh(y)+20,_=y.fontSize*y.lineHeight;if(y.baseWidth=b,!t.position){const S=Lt(100*b/l),T=Lt(100*_/d),{x:w,y:x,rotation:k}=i1(S,T);y.position={x:w,y:x,width:S,height:T,rotation:k}}return y},xh=async({preset:e,overrides:t={},replaceInfo:o,droppedTrackInfo:r})=>{yn();const{dispatch:s}=I(),a=bn(e,t);So({newLayer:a,options:{undoable:!0,knownTimelineRow:a.timelineRow!==void 0,droppedTrackInfo:r},replaceInfo:o}),s(Ta({preset:e})),hh(a),ce("Added Text Preset",{presetId:e.presetId,isDefaultPreset:Ea(e),"Is Brandkit Preset":!!e.teamId,"Is Recently Used Preset":e.presetId===tr,dndTimeline:t.timelineRow!==void 0,dndCanvas:t.position!==void 0})},xa=e=>{const{state:t}=I(),{backgroundColor:o,fontFamily:r,hasCustomFont:s,asset_id:a,fontType:n,fontWeight:i,textAlign:l,textTransform:d,textShadow:c,textOutline:u,color:h,textBlur:A,textEffect:g,textDropShadowColor:y,textPadding:b,wrapOrFill:_,textShadowBlur:S,textShadowDist:T,textShadowRot:w,borderRadius:x,underline:k,italic:M,globalAlpha:j,lineHeight:O}=e,B=wi(e,t);return{presetId:e.presetId||`preset-${(0,Ca.default)()}`,style:{backgroundColor:o,fontFamily:r,hasCustomFont:s,url:B?.url,asset_id:a,fontType:n,fontWeight:i,textAlign:l,textTransform:d,textShadow:c,textOutline:u,color:h,textBlur:A,textEffect:g!=="textBlur"&&y?"dropShadow":g,textEffectColor:y,textPadding:b,wrapOrFill:_,textShadowBlur:S,textShadowDist:T,textShadowRot:w,borderRadius:x,underline:k,italic:M,globalAlpha:j,lineHeight:O}}},kh=e=>{const{backgroundColor:t,color:o,fontFamily:r,hasCustomFont:s,asset_id:a,fontType:n,fontWeight:i,textAlign:l,textTransform:d,textShadow:c,textOutline:u,textBlur:h,textEffect:A,textEffectColor:g,textPadding:y,wrapOrFill:b,textShadowBlur:_,textShadowDist:S,textShadowRot:T,borderRadius:w,underline:x,italic:k,globalAlpha:M,lineHeight:j}=e.style;return(0,Yo.cloneDeep)({backgroundColor:t,color:o,fontFamily:r,hasCustomFont:s,asset_id:a,fontType:n,fontWeight:i,textAlign:l,textTransform:d,textShadow:c,textOutline:u,textBlur:h,textEffect:A==="dropShadow"?void 0:A,textDropShadowColor:A==="dropShadow"?g:void 0,textPadding:y,wrapOrFill:b,textShadowBlur:_,textShadowDist:S,textShadowRot:T,borderRadius:w,underline:x,italic:k,globalAlpha:M,lineHeight:j})},p8=e=>{const{state:t,dispatch:o}=I(),r=Kt(t);r.length===0||!r.every(Ii)||(Pe.execInUndoBatch(()=>{e.teamId&&o(Zi(e.presetId));const s={};r.forEach(a=>{const n=kh(e);s[a.id]={...n,presetId:e.presetId,draftJSTextTree:void 0,textBlocks:void 0}}),bt(s,"setSelectedTextLayersToPreset",!0),o(Oo.setTextColor({ids:r.map(a=>a.id),value:e.style.color})),o(Oo.setTextBold({ids:r.map(a=>a.id),value:e.style.fontWeight==="bold"})),o(Oo.setTextItalics({ids:r.map(a=>a.id),value:e.style.italic??!1})),o(Oo.setTextUnderline({ids:r.map(a=>a.id),value:e.style.underline??!1}))}),ce("Clicked Text Preset",{presetId:e.presetId,"Is Default Preset":Ea(e),"Is Brandkit Preset":!!e.teamId,"Is Recently Used Preset":e.presetId===tr}))};var Rh=e=>["none","transparent"].includes(e);function Zr(e,t){let o=!0;return Object.keys(e.style).forEach(r=>{const s=r,a=e.style[s],n=t.style[s],i=JSON.stringify(a),l=JSON.stringify(n);s!=="url"&&(!a&&!n||(s==="textShadow"||s==="textOutline")&&(Xr(e)&&Xe(t.style.color)&&(Ge(t.style.textShadow)||Ge(t.style.textOutline?.color??""))||Xr(t)&&Xe(e.style.color)&&(Ge(e.style.textShadow)||Ge(e.style.textOutline?.color??"")))||["textShadow","color"].includes(s)&&[e.presetId,t.presetId].includes("BASIC")&&(Xe(e.style.color)&&Ge(t.style.color)||Xe(t.style.color)&&Ge(e.style.color)||Xe(e.style.textShadow)&&Ge(t.style.textShadow)||Xe(t.style.textShadow)&&Ge(e.style.textShadow))||[i,l].every(Rh)||i!==l&&(o=!1))}),o}function _n(e){const{state:t,dispatch:o}=I(),{_id:r}=t.studio,s=t.textPresets.presets,a={};
3s.forEach(d=>{a[d.presetId]=d});const n=new Set,i=[];e.forEach(d=>{const c=xa(d);let u=a[c.presetId];u&&Zr(u,c)||(u=[...i,...s].find(A=>Zr(A,c)));let h=u?.presetId;h||(h=`preset-${(0,Ca.default)()}`,c.presetId=h,c.videoId=r,c.title="Text Style"),h&&!n.has(h)&&(n.add(h),i.push(c)),d.presetId!==h&&bt({[d.id]:{presetId:h}},"saveTextPresets")});const l=s.filter(d=>!n.has(d.presetId));i.reverse(),o(Oi({presets:[...i,...l]}))}function m8(){const{state:e}=I(),{allLayers:t}=e.studio,o=Object.values(t.byId).filter(r=>r&&r.type===de.Text&&!r.fromTextDefaults);o.length!==0&&_n(o)}function f8(){const{state:e}=I(),t=lc(e);!t||t.type!==de.Text||_n([t])}function Lh(){const e=(0,An.c)(22),t=Ki(),o=We(Be),{brandkitPresets:r,presets:s,lastUsedPreset:a,lastUsedBrandkitPresetId:n}=We(Mh),[i,l]=(0,v.useState)(!1);let d,c;e[0]!==o?(d=()=>{o&&_h(o)},c=[o],e[0]=o,e[1]=d,e[2]=c):(d=e[1],c=e[2]),(0,v.useEffect)(d,c);let u;e[3]!==t.current?(u=()=>{(async function(){await vh(),t.current&&l(!0)})()},e[3]=t.current,e[4]=u):u=e[4];let h;if(e[5]!==t?(h=[t],e[5]=t,e[6]=h):h=e[6],(0,v.useEffect)(u,h),!i){let S;return e[7]===Symbol.for("react.memo_cache_sentinel")?(S={presets:[],brandkitPresets:[]},e[7]=S):S=e[7],S}let A;e[8]!==r?(A=new Set(r.map(Dh)),e[8]=r,e[9]=A):A=e[9];const g=A;let y,b;if(e[10]!==g||e[11]!==a||e[12]!==s){let S;e[15]!==g?(S=w=>w&&w.presetId&&!g.has(w.presetId),e[15]=g,e[16]=S):S=e[16];const T=s.filter(S);y=a,b=Xu(T),e[10]=g,e[11]=a,e[12]=s,e[13]=y,e[14]=b}else y=e[13],b=e[14];let _;return e[17]!==r||e[18]!==n||e[19]!==y||e[20]!==b?(_={lastUsedPreset:y,presets:b,brandkitPresets:r,lastUsedBrandkitPresetId:n},e[17]=r,e[18]=n,e[19]=y,e[20]=b,e[21]=_):_=e[21],_}function Dh(e){return e.presetId}function Mh(e){return e.textPresets}const g8=()=>{const{state:e,dispatch:t}=I(),o=Kt(e);if(o.length!==1)return;const r=o[0];if(!r||!Ii(r))return;const s=xa(r);s.presetId=tr,s.title="Custom";const{lastUsedPreset:a}=e.textPresets;(!a||!Zr(s,a))&&(bt({[r.id]:{presetId:tr}},"updateLastUsedTextPreset"),t(Ta({preset:s})))},A8=(e,t)=>{if(e===t)return!1;const o=Object.keys({backgroundColor:!0,color:!0,fontFamily:!0,fontType:!0,fontWeight:!0,globalAlpha:!0,italic:!0,lineHeight:!0,wrapOrFill:!0,textAlign:!0,textTransform:!0,textBlur:!0,textEffect:!0,textDropShadowColor:!0,textPadding:!0,borderRadius:!0,textOutline:!0,textShadow:!0,textShadowBlur:!0,textShadowDist:!0,textShadowRot:!0,textShadowOpacity:!0,underline:!0,hasCustomFont:!0,asset_id:!0});return!(0,Yo.isEqual)((0,Yo.pick)(e,o),(0,Yo.pick)(t,o))},Uh=({lastUsedPreset:e,brandkitPresets:t,lastUsedBrandkitPresetId:o})=>{const{dispatch:r}=I();if(t.length>0){if(o){const s=t.find(a=>a.presetId===o);if(s)return s;r(Zi(void 0))}if(t[0])return t[0]}return e||Ou},y8=()=>{const e=(0,An.c)(4),{lastUsedPreset:t,brandkitPresets:o,lastUsedBrandkitPresetId:r}=Lh();let s;return e[0]!==o||e[1]!==r||e[2]!==t?(s=Uh({lastUsedPreset:t,brandkitPresets:o,lastUsedBrandkitPresetId:r}),e[0]=o,e[1]=r,e[2]=t,e[3]=s):s=e[3],s},b8=()=>{const{dispatch:e}=I();e(Ta({preset:void 0}))},ea=Pe.withUndoBatch((e,t)=>{const{dispatch:o}=I(),r=t.type;if(r==="none")return;const s=He(e);if(!s)return;const a=Nt(12),n=Fh([s]);if(!n)return;const i=Math.min(t.transitionDuration||Ll[t.id]?.duration||.5,n),l={animationName:t.id,id:a,layerId:s.id,isCrossTransition:!1,transitionDuration:i,movingZoomOptions:t.movingZoomOptions};o(Io.applyAnimation({animation:l,layerId:e,type:r}))}),bs=Pe.withUndoBatch((e,t)=>{const{dispatch:o}=I(),r=He(e);if(!r)return;const s=r.animation?.[t]?.[0];s&&o(Io.deleteAnimation({animationId:s}))});function In(e){return Re(ie,(t=[])=>{const o={};for(const r of t){const s=r.animation?.[e];if(s)for(const a of s)o[a]=r}return o})}const Ph=In("intro"),Oh=In("outro"),oo=Pe.withUndoBatch(e=>{const{dispatch:t}=I();t(Io.deleteAnimation({animationId:e}))}),_8=()=>{I().dispatch(Gl(null))},_s=Pe.withUndoBatch((e,t,o)=>{const{state:r}=I(),s=He(e);if(!s){console.error("Could not find layer to add cross transition to");return}const a=pa(s),n=t==="intro"?a.introTransition:a.outroTransition;if(n?.transitionId===o.id)return;let i,l;if(n){let d;s.id===n.introLayerId?d=He(n.outroLayerId):d=He(n.introLayerId),d&&([i,l]=t==="intro"?[s,d]:[d,s])}if(!i||!l){const d=ie(r).filter(Ul),c=r.studio.duration,{nextLayer:u,prevLayer:h}=jh(s,d,c);[i,l]=t==="intro"?[s,h]:[u,s]}!i&&!l||(i=i||ss,l=l||ss,I().dispatch(Io.applyTransition({leftLayerId:l.id,rightLayerId:i.id,transition:o})))});var Bh=e=>Math.round(e*10)/10;const Fh=e=>{const t=Bh(e.reduce((o,r)=>{if(!r||El(r))return o;const{start:s,end:a}=et(r),n=a-s;return Math.min(o,n)},8)/2);return t<.1?null:t},I8=Pe.withUndoBatch((e,t)=>{const{dispatch:o}=I();o(Ri(e,{transitionDuration:t}))}),T8=Pe.withUndoBatch((e,t)=>{const{dispatch:o}=I();o(Io.changeTransitionDuration({animationId:e,duration:t}))}),v8=Pe.withUndoBatch((e,t,o)=>{const{dispatch:r}=I(),s=e.animation?.[t];if(!s)return;const a=s[0];a&&r(Ri(a,{animationName:o}))}),S8=e=>{const{dispatch:t,state:o}=I(),r=o.studio.duration,s=[];if(e.forEach(n=>{const i=He(n);if(!i)return;const l=Ui(i),{start:d,end:c}=et(i,r);l.forEach(u=>{if(u.id!==nt.None){if(u.type==="intro"||u.type==="constant")s.push(d);else if(u.type==="outro"){const h=Ci(u,o.studio.animations);s.push(c-h)}}})}),s.length===0)return;s.sort((n,i)=>n-i);const a=s[0];Xc({time:a}),t(rn())},w8=(e,t)=>{const{dispatch:o,state:r}=I(),s=r.studio.duration,a=He(e);if(!a)return;let n;const{start:i,end:l}=et(a,s);if(t==="intro"||t==="constant")n=i;else{const d=qo(a,t);n=l-(d?Ci(d,r.studio.animations):.5)}Iu(n),o(rn())},jh=(e,t,o)=>{if(!e||e.type==="virtual")return{};let{start:r,end:s}=et(e,o);const{introTransition:a,outroTransition:n}=pa(e),i=a?.introLayerId,l=n?.outroLayerId;let d,c;const u=Yu(t,e);for(const h of u){if(h.id===e.id)continue;let{start:A,end:g}=et(h,o);r=parseFloat(r.toFixed(2)),s=parseFloat(s.toFixed(2)),A=parseFloat(A.toFixed(2)),g=parseFloat(g.toFixed(2));const y=ql.includes(h.type);if((y&&A===s||l===h.id||Math.abs(A-s)<=.5)&&(c=h,d)||(y&&g===r||i===h.id||Math.abs(g-r)<=.5)&&(d=h,c))break}return{prevLayer:d,nextLayer:c}};function Is(e,t,o){if(!t||!o)return!0;const r=e.studio.duration,{start:s,end:a}=et(t,r),{start:n,end:i}=et(o,r);return t.timelineRow==null||t.timelineRow!==o.timelineRow||s>=i||n>=a}const E8=Pe.withUndoBatch(e=>{const{state:t}=I(),o=e?[e]:ie(t);for(const s of o){const{animation:a}=s;if(a){if(a.intro)for(const n of a.intro){const i=as(n,t.studio.animations);if(!i||!i.isCrossTransition||Uo(i.outroLayerId))continue;const l=Oh(t)[n];Is(t,l,s)&&oo(n)}
3if(a.outro)for(const n of a.outro){const i=as(n,t.studio.animations);if(!i||!i.isCrossTransition||Uo(i.introLayerId))continue;const l=Ph(t)[n];Is(t,s,l)&&oo(n)}}}const{animations:r}=t.studio;for(const s of Object.values(r?.byId??[])){if(!s.isCrossTransition)continue;const{introLayerId:a,outroLayerId:n}=s;let i=!1;Uo(a)||He(a)?.animation?.intro?.includes(s.id)||(i=!0),Uo(n)||He(n)?.animation?.outro?.includes(s.id)||(i=!0),i&&oo(s.id)}}),Ts=e=>!!e&&e.id!==nt.None,Nh=e=>!!e.isCrossTransition,Vh=e=>!Nh(e),C8=(e,t)=>{const o=Ts(e),r=Ts(t);return o&&r?"both":o?"intro":r?"outro":null},x8=e=>{switch(e){case"both":return["intro","outro"];case"intro":return["intro"];case"outro":return["outro"];default:return[]}},Lr=["intro","outro"],k8=Pe.withUndoBatch((e,t,o)=>{const{state:r,dispatch:s}=I(),a=r.studio.animations;let n=r.studio.duration;if(r.studio.duration||(n=10,s(Ru({duration:n,userSetDuration:!0,userSelectedDuration:n,undoable:!0})),Nu(),s(dn())),t.id===nt.None)return e.forEach(d=>{Lr.forEach(c=>{const u=qo(d,c,a);u&&u.transitionId&&u.animationStateMapId?oo(u.animationStateMapId):bs(d.id,c)})}),{isNewTransition:!1};const i=Vh(t);let l=!0;for(const d of e)for(const c of Lr){const u=qo(d,c,a);u&&(l=!1),u&&u.transitionId&&u.animationStateMapId?oo(u.animationStateMapId):bs(d.id,c)}for(const d of e){if(i){Lr.forEach(c=>{if(o!=="both"&&o!==c)return;const u=qo(d,c,a),h={...t};u&&(h.transitionDuration=u.transitionDuration),h.type=c,ea(d.id,h)});continue}["intro","both"].includes(o)&&_s(d.id,"intro",t),["outro","both"].includes(o)&&_s(d.id,"outro",t)}return{isNewTransition:l}}),vs="derived/pdf-pages/assets/{asset_id}/page-{page_number}.{ext}",Gh=vs.slice(0,vs.indexOf("{")),Kh=e=>!!e?.blob_name?.startsWith(Gh);var Ss=new WeakMap;const Tn=(e,t)=>{let o=Ss.get(e);o||(o=new Map,Ss.set(e,o));const r=o.get(t);if(r)return r;const s=new Set;if(wt(e[t]))for(const a of Object.values(e))a&&String(a.original_asset_id)===t&&s.add(a._id);return o.set(t,s),s};async function Wh(e){const{state:t,dispatch:o}=I(),r=t.studio._id,{conversion_type:s,pastedUrl:a,resource:n,type:i,layer:l}=e,d="asset_id"in e?e.asset_id:void 0,c="preview_asset_id"in e?e.preview_asset_id:void 0,u={asset_id:d,preview_asset_id:c,resource:n,type:i,conversion_type:s,video_id:r};try{console.info(`Kicking off conversion of type ${i??s} for asset ${d||l?.asset_id} and url ${a}`);const{conversion_id:h,asset:A}=await ne.conversion.create.mutate({asset_id:d,preview_asset_id:c,resource:n,type:i,conversion_type:s,layer:l,video_id:r,fragment:s==="optimize-mp4"&&Tc(),hls:s==="optimize-mp4"&&iu().allowed,previewABTestGroup:Yl(),pastedUrl:a});return A&&o(Te([A])),h}catch(h){console.error(h);const{debugMsg:A}=qi(h);throw ce("Conversion Fails",{...u,failureMessage:A}),h}}async function R8(e){if(!e)throw new Error("No conversion id present");const t=await ne.conversion.get.query({id:e});return t.status===Xl.failed&&ce("Conversion Fails",{asset_id:t.asset_id,conversion_id:e,failureMessage:"conversion status === failed"}),t}let R=function(e){return e.AddAudio="add-audio",e.AddImage="add-image",e.AddSoundEffects="add-sound-effects",e.Adjust="adjust",e.AnimatedText="animatedText",e.AddBorder="add-border",e.AiVoiceCloning="aiVoiceCloning",e.Blur="blur",e.BlurVideoBackground="blurVideoBackground",e.BRollGenerator="bRollGenerator",e.Censor="censor",e.Collage="collage",e.ColorChanging="color-changing",e.CompressVideo="compressVideo",e.Convert="convert",e.Crop="crop",e.CustomEmoji="custom-emoji",e.Draw="draw",e.Dubbing="dubbing",e.Editor="editor",e.Extract="extract",e.Filter="filter",e.FreezeFrame="freeze-frame",e.GifMaker="gifMaker",e.Glitch="glitch",e.KenBurns="ken-burns",e.Keyframing="keyframing",e.Link="link",e.MemeMaker="memeMaker",e.MusicVideo="musicVideo",e.PersonasCreationFlow="personasCreationFlow",e.PersonasStockLibrary="personasStockLibrary",e.RemoveBackgroundNoiseWithElevenLabs="removeBackgroundNoiseWithElevenLabs",e.RemoveImageBackground="remove-image-background",e.RemoveVideoBackground="remove-video-background",e.SpeakerFocus="speakerFocus",e.Chromakey="chromakey",e.Podcast="podcast",e.ProgressBar="progressBar",e.RecordScreen="record-screen",e.Resize="resize",e.SafeZone="safe-zone",e.Speed="speed",e.SlowMotion="slowMotion",e.Subtitles="subtitles",e.Teleprompter="teleprompter",e.Text="text",e.Timeline="timeline",e.TextToSpeech="text-to-speech",e.Transitions="transitions",e.Translate="translate",e.TranslateSubtitles="translate-subtitles",e.TranslateImage="translate-image",e.TranslateAudio="translate-audio",e.TrimVideo="trim-video",e.TvStatic="tv-static",e.VideoStabilizer="video-stabilizer",e.YoutubeThumbn
3ail="youtubeThumbnail",e.Rotate="rotate",e.AiScriptGenerator="aiScriptGenerator",e.AiVideoGenerator="aiVideoGenerator",e.AiImageGenerator="aiImageGenerator",e.AiDocumentToVideo="aiDocumentToVideo",e.AiArticleToVideo="aiArticleToVideo",e.AiScriptToVideoGenerator="aiScriptToVideoGenerator",e.Transcribe="transcribe",e.TrimWithTranscript="trimWithTranscript",e.VttFile="vttFile",e.SilenceRemover="silence-remover",e.SrtFile="srtFile",e.TrimAudio="trim-audio",e.Reverse="reverse",e.Pinning="pinning",e.Slideshow="slideshow",e.SrtEditor="srtEditor",e.Vhs="vhs",e.Volume="volume",e.Waveform="waveform",e.EnhanceImage="enhanceImage",e.EnhanceVoice="enhanceVoice",e.Generic="Generic",e.SplitVocals="splitVocals",e.SmartCut="smartCut",e.EyeContact="eyeContact",e.SplitVideo="splitVideo",e.SpeakerLabels="speakerLabels",e.KaiSoundEffects="kai-sound-effects",e.KaiFontGenerator="kai-font-generator",e.KaiCharacters="kai-characters",e}({});var Hh=class{showWhen;tooltipAnchorId;priority;header;subtext;large;isTerminal;isSearchable;constructor(e){this.init=e,this.showWhen=e.showWhen||(()=>!0),this.tooltipAnchorId=e.tooltipAnchorId,this.priority=e.priority===void 0?-1:e.priority,this.header=e.header,this.subtext=e.subtext,this.large=e.large||!1,this.isTerminal=e.isTerminal||!1,this.isSearchable=e.isSearchable||!1}},D=class{rules;mobileWarningToast;constructor({rules:e,mobileWarningToast:t}){this.rules=e.map(o=>new Hh(o)),this.mobileWarningToast=t}};const L8=(e,t,o)=>{const r=e.toLowerCase(),s=o.replace(/-/g," ").toLowerCase(),{header:a,subtext:n}=t;return!!(s.includes(r)||a?.toLowerCase().includes(r)||n?.toLowerCase().includes(r))};var ws=e=>e.reduce((t,o)=>t&&(t.priority||-1)>(o.priority||-1)?t:o,void 0);const D8=e=>{const t=ws(e.filter(o=>o.isSearchable));return t||ws(e)},vn=e=>Object.values(R).includes(e);var ro=e=>ie(e).some(t=>t.type==="video"),zo=e=>!ro(e),Zt=e=>ie(e).some(t=>t.type==="video"||t.type==="image"),qh=e=>!Zt(e),Ye=e=>Kt(e)[0]?.type==="video",Ne=e=>ie(e).some(t=>t.type==="image"),Sn=e=>!Ne(e),Je=e=>Kt(e)[0]?.type==="image",je=e=>ie(e).length>0,wn=e=>e.selectedTabs["visuals-sidebar"]===_u.images&&e.selectedTabs["media-sidebar"]===pr.VISUALS,$h=e=>je(e)&&wn(e),ot=(e,t)=>({tooltipAnchorId:m.Upload,subtext:t,header:e,priority:0,showWhen:o=>ie(o).length===0,isSearchable:!0}),Le=(e,t,o=0)=>({tooltipAnchorId:m.Upload,header:e,showWhen:qh,subtext:t,priority:o,isSearchable:!0}),Qe=(e,t)=>({tooltipAnchorId:m.Upload,header:e,showWhen:zo,subtext:t,priority:0,isSearchable:!0}),Yh=e=>ie(e).every(t=>!t.duration),jo=(e,t)=>({tooltipAnchorId:m.Upload,header:e,showWhen:Yh,subtext:t,priority:0,isSearchable:!0}),zh=(e,t)=>({tooltipAnchorId:m.CanvasBackground,header:e,showWhen:o=>ie(o).some(r=>r.duration)&&Kt(o).every(r=>!r.duration),subtext:t,priority:1}),No=(e,t)=>({tooltipAnchorId:m.Upload,header:e,showWhen:Sn,subtext:t,priority:0,isSearchable:!0}),Ct=(e,t,o=r=>!0)=>[{showWhen:o,header:e,subtext:`Select outside of the canvas to de-select your content, then ${t}.`,tooltipAnchorId:m.CanvasBackground,priority:1},{showWhen:o,header:e,subtext:`First, open the project settings menu to ${t}.`,tooltipAnchorId:m.ProjectSidebarTab,priority:2},{showWhen:r=>o(r)&&Kt(r).length>0,header:e,subtext:`Exit this menu, then follow the hints to ${t}.`,tooltipAnchorId:m.CloseMobileMediaSidebarButton,priority:100}],le=e=>ie(e).some(t=>t.type==="video"&&t.hasAudio||t.type==="audio"),Qh=e=>!le(e),eo=e=>ie(e).some(t=>t.type==="video"&&t.hasAudio),Jh=(e,t)=>({tooltipAnchorId:m.Upload,header:e,showWhen:o=>!eo(o),subtext:t,priority:0,isSearchable:!0}),De=(e,t)=>({tooltipAnchorId:m.Upload,header:e,showWhen:Qh,subtext:t,priority:0,isSearchable:!0}),Dr=(e,t)=>[{tooltipAnchorId:m.ImageTransitionsControlsTab,header:e,subtext:t,priority:1},{tooltipAnchorId:m.VideoTransitionsControlsTab,header:e,subtext:t,priority:1},{tooltipAnchorId:m.RightSidebarTransitionsOptions,header:e,subtext:t,priority:2}],qe=(e,t,o=1)=>({tooltipAnchorId:m.CanvasBackground,header:e,showWhen:r=>ie(r).some(s=>s.type==="video"||s.type==="image")&&!Ye(r)&&!Je(r),subtext:t,priority:o}),st=(e,t)=>
3({tooltipAnchorId:m.CanvasBackground,header:e,showWhen:o=>ro(o)&&!Ye(o),subtext:t,priority:1}),$t=(e,t)=>({tooltipAnchorId:m.CanvasBackground,header:e,showWhen:o=>!Je(o)&&Ne(o),subtext:t,priority:1}),Qo=(e,t)=>[...rt(e,t,o=>le(o)&&!Ye(o)),{showWhen:o=>ie(o).some(r=>r.type==="video"&&r.hasAudio),tooltipAnchorId:m.CanvasBackground,header:e,subtext:t,priority:3}],Es=e=>[De(`Create a ${e} File`,`First upload your video, then use the controls to create and download a ${e} file for your video.`),{tooltipAnchorId:m.MagicSubtitlesSidebarTab,header:`Create a ${e} File`,subtext:`Auto-generate subtitles for your video, then you'll be able to download the complete ${e} file.`},{tooltipAnchorId:m.StartMagicSubtitlesButton,header:`Create a ${e} File`,subtext:`Auto-generate subtitles for your video, then you'll be able to download the complete ${e} file.`,showWhen:t=>ie(t).every(o=>!o.hasAudio&&o.type!=="audio"),priority:1},{tooltipAnchorId:m.SubtitleEmptyCTA,header:"Choose a Video",subtext:`Upload a video or audio file to use the ${e} file maker tool.`,priority:2},{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:`Create a ${e} File`,subtext:`Exit this menu, then follow the hints to create the ${e} file.`,priority:2},{tooltipAnchorId:m.StartMagicSubtitlesButton,header:`Create a ${e} File`,subtext:`Auto-generate subtitles for your project, then you'll be able to download the complete ${e} file.`,priority:3,isTerminal:!0}],xt=(e,t,o)=>[{tooltipAnchorId:m.HeaderAiButton,header:"Make more AI content",subtext:"Click the lightbulb icon to reopen the Kapwing AI modal at any time.",priority:0},{tooltipAnchorId:o,header:e,subtext:t,priority:2}],rt=(e,t,o=r=>!0)=>[{tooltipAnchorId:m.Timeline,header:e,subtext:t,priority:1,showWhen:o},{tooltipAnchorId:m.CloseMobileSidebarSlider,header:e,subtext:"Slide down to close this menu and access the timeline.",priority:2,showWhen:o}],Cs=e=>new D({mobileWarningToast:e+" is not available on mobile. Please try again on a desktop device.",rules:[De(e,'Upload your audio, then use "Smart Cut" in the sidebar controls to remove silences'),...Qo(e,"Click to select the layer you want to remove silences from"),{tooltipAnchorId:m.VideoAiToolsControlsTab,header:"Apply Smart Cut",subtext:"Use Smart Cut to automatically remove silences from your video.",priority:2},{tooltipAnchorId:m.AudioAiToolsControlsTab,header:"Apply Smart Cut",subtext:"Use Smart Cut to automatically remove silences from your audio.",priority:2},{tooltipAnchorId:m.SmartCutButton,header:"Apply Smart Cut",subtext:"Use Smart Cut to automatically remove silences from your audio.",priority:3},{tooltipAnchorId:m.SmartCutButton,header:"Apply Smart Cut",showWhen:Ye,subtext:"Use Smart Cut to automatically remove silences from your video.",priority:4}]}),xs=[{tooltipAnchorId:m.AddSample,header:"Add Subtitles",subtext:"Try a sample video, then add and customize subtitles afterwards.",isSearchable:!0,priority:1},{tooltipAnchorId:m.MagicSubtitlesSidebarTab,header:"Subtitle Your Video",subtext:"First auto-generate subtitles for your video, then you'll be able to edit them in your project."},{tooltipAnchorId:m.StartMagicSubtitlesButton,header:"Subtitle Your Video",subtext:"First auto-generate subtitles for your video, then you'll be able to edit them in your project.",showWhen:e=>ie(e).every(t=>!t.hasAudio&&t.type!=="audio"),priority:1},{tooltipAnchorId:m.SubtitleEmptyCTA,header:"Choose a Video",subtext:"Upload a video or audio file to add subtitles to your project.",priority:2},{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Add Subtitles",subtext:"Exit this menu, then follow the hints to add subtitles.",priority:2},{tooltipAnchorId:m.MagicSubtitlesSidebarTab,header:"Create Subtitles",subtext:"Auto-generate subtitles for your audio, then you'll be able to edit the project.",showWhen:e=>ie(e).some(t=>t.type==="audio")},{tooltipAnchorId:m.StartMagicSubtitlesButton,header:"Subtitle Your Video",subtext:"First auto-generate subtitles for your video, then you'll be able to edit them in your project.",showWhen:e=>ie(e).some(t=>t.type==="video"&&t.hasAudio),priority:3},{tooltipAnchorId:m.StartMagicSubtitlesButton,header:"Create Subtitles",subtext:"Auto-generate subtitles for your audio, then you'll be able to edit the project.",showWhen:e=>ie(e).some(t=>t.type==="audio"),priority:3},{tooltipAnchorId:m.MagicSubtitleGenerateButton,header:"Subtitle Your Video",subtext:"First auto-generate subtitles for your video, then you'll be able to edit them in your project.",showWhen:e=>ie(e).some(t=>t.type==="video"&&t.hasAudio),priority:4,isTerminal:!0},{tooltipAnchorId:m.MagicSubtitleGenerateButton,header:"Create Subtitles",subtext:"Auto-generate subtitles for your audio, then you'll be able to edit the project.",showWhen:e=>ie(e).some(t=>t.type==="audio"),priority:4,isTerminal:!0}];
3const M8={[R.Subtitles]:new D({rules:xs}),[R.AddBorder]:new D({rules:[Le("Add Border","First upload your content, then use the 'Expand Padding' section in the right-hand sidebar to add a border."),...Ct("Add Border","add a border to your project."),{tooltipAnchorId:m.ProjectPaddingControlsTab,header:"Add Border",subtext:"Use these controls to add a border to your project.",priority:3},{tooltipAnchorId:m.AddPaddingControls,header:"Add Border",subtext:"These options will let you add a border to your content by increasing padding of the top, bottom, left, or right of your project. You can also remove extra padding if you wish.",priority:4}]}),[R.Adjust]:new D({rules:[Le("Adjust","First, upload your file, then adjust video quality and settings in the sidebar."),{showWhen:Zt,tooltipAnchorId:m.CanvasBackground,header:"Adjust",subtext:"Select the layer you want to adjust"},{tooltipAnchorId:m.ImageAdjustControlsTab,header:"Adjust Image",subtext:"Adjust image quality and settings here.",priority:2},{tooltipAnchorId:m.VideoAdjustControlsTab,header:"Adjust Video",subtext:"Adjust video quality and settings here.",priority:2},{showWhen:Je,tooltipAnchorId:m.AdjustFilterControl,header:"Adjust Image",subtext:"Adjust image quality and settings here.",priority:3},{showWhen:Ye,tooltipAnchorId:m.AdjustFilterControl,header:"Adjust Video",subtext:"Adjust video quality and settings here.",priority:3}]}),[R.Blur]:new D({rules:[qe("Blur","First upload an image or video, then use the controls in the sidebar to adjust blur levels."),qe("Blur","Select the layer you want to blur."),{tooltipAnchorId:m.ImageAdjustControlsTab,header:"Blur",subtext:"Use the controls to add blur to your image",priority:2},{tooltipAnchorId:m.VideoAdjustControlsTab,header:"Blur",subtext:"Use the controls to add blur to your video",priority:2},{showWhen:Je,tooltipAnchorId:m.AdjustFilterControlBlur,header:"Blur",subtext:"Use the controls to add blur to your image.",priority:3},{showWhen:Ye,tooltipAnchorId:m.AdjustFilterControlBlur,header:"Blur",subtext:"Use the controls to add blur to your video.",priority:3}]}),[R.BlurVideoBackground]:new D({mobileWarningToast:"Blur Video Background is not available on mobile. Please try again on a desktop device.",rules:[Le("Blur Video Background","First upload a video to blur."),qe("Blur Background","Select the layer you want to blur."),{showWhen:Je,tooltipAnchorId:m.ImageAdjustControlsTab,header:"Blur Image",subtext:"Use the controls to add a blur effect to your image.",priority:2},{showWhen:Je,tooltipAnchorId:m.AdjustFilterControl,header:"Blur Image",subtext:"Use the controls to add a blur effect to your image.",priority:3},{tooltipAnchorId:m.VideoEffectControlsTab,header:"Blur Video Background",subtext:"Use the controls to blur the background of your video.",priority:2},{tooltipAnchorId:m.VideoBlurBackgroundEffect,header:"Blur Video Background",subtext:"Use the controls to blur the background of your video.",priority:3}]}),[R.Chromakey]:new D({rules:[Qe("Chroma Key","Upload a video, then use the controls in the sidebar to apply a chroma key effect / edit the green screen."),st("Chroma Key","Select the video you want to apply the chroma key to."),{tooltipAnchorId:m.VideoEffectControlsTab,header:"Chroma Key Effect",subtext:"Click the EFFECTS tab to apply a chroma key / green screen effect",priority:2},{tooltipAnchorId:m.ChromakeyEffect,header:"Chroma Key Effect",subtext:"Use the controls to apply a chroma key / green screen effect to your video.",priority:3}]}),[R.ColorChanging]:new D({rules:[No("Make Color Changing GIF","Upload a GIF, then click the EFFECTS tab and select 'Hue Rotate' to add a rainbow effect."),$t("Select your GIF","Select your GIF to apply a color changing effect"),{tooltipAnchorId:m.ConstantAnimationControlsTab,header:"Color Change",subtext:"Click on ANIMATIONS to add a Hue Rotate effect to your gif",priority:2},{tooltipAnchorId:m.AnimationSelectionControl,header:"Color Change",subtext:"Select 'Hue Rotate' to add a rainbow effect to your GIF. You can also adjust the speed of the color change."}]}),[R.Crop]:new D({rules:[Le("Crop","First, upload your file. Then, in the sidebar, use the controls to crop your content to the desired size."),qe("Crop","First, select the layer you'd like to crop"),{showWhen:Je,tooltipAnchorId:m.ImageEditControlsTab,header:"Crop",subtext:"Click the EDIT tab to crop your image to a desired size"},{showWhen:Ye,tooltipAnchorId:m.VideoEditControlsTab,header:"Crop",subtext:"Click the EDIT tab to crop your video to a desired size"},{showWhen:Je,tooltipAnchorId:m.CropButton,header:"Crop",subtext:"Click the CROP button to crop your image to a desired size",priority:3},{showWhen:Ye,tooltipAnchorId:m.CropButton,header:"Crop",subtext:"Click the CROP button to crop your video to a desired size",priority:3}]}),[R.EnhanceImage]:new D({rules:[No("Enhance Image","Upload an image, then use the Enhance Image button in the sidebar to enhance your image."),$t("Enhance Image","Select the image you want to enhance."),{tooltipAnchorId:m.ImageAiToolsControl
3sTab,header:"Enhance Image",subtext:"Click the AI TOOLS tab to enhance your image.",priority:2},{tooltipAnchorId:m.EnhanceImageButton,header:"Enhance Image",subtext:"Click this button to enhance your image.",priority:3}]}),[R.EnhanceVoice]:new D({rules:[De("Enhance Voice","First, upload a video or audio track, then use the Enhance Voice button in the sidebar to create studio quality sound."),{showWhen:le,tooltipAnchorId:m.Timeline,header:"Enhance Voice",subtext:"Select the layer with the audio you want to enhance.",priority:0},...rt("Enhance Voice","Select the layer with the audio you want to enhance.",le),{showWhen:e=>ie(e).some(t=>t.type==="video"&&t.hasAudio),tooltipAnchorId:m.CanvasBackground,header:"Enhance Voice",subtext:"Select the layer with the audio you want to enhance.",priority:3},{tooltipAnchorId:m.AudioAiToolsControlsTab,header:"Enhance Voice",subtext:"Click the AI TOOLS tab to enhance the voice track in your content.",priority:3},{tooltipAnchorId:m.VideoAudioControlsTab,header:"Enhance Voice",subtext:"Click the AUDIO tab to enhance the voice track in your content.",priority:4},{tooltipAnchorId:m.EnhanceVoiceButton,header:"Enhance Voice",subtext:"Click to enhance the voice track in your content.",priority:5}]}),[R.Filter]:new D({rules:[Le("Apply Filter","First, upload your file, then select the file and click the FILTER tab in the sidebar."),qe("Apply Filter","Select the layer you want to filter."),{tooltipAnchorId:m.ConnectedPresetFilterControlTab,header:"Add Filter",subtext:"Click this tab to add a filter to your image.",priority:2},{tooltipAnchorId:m.VideoFiltersControlsTab,header:"Add Filter",subtext:"Click the ADJUST tab to filter and adjust your video.",priority:2},{showWhen:Ye,tooltipAnchorId:m.PresetFilterControls,header:"Add Filter",subtext:"Use the controls to add a filter to your video.",priority:3},{showWhen:Je,tooltipAnchorId:m.PresetFilterControls,header:"Filter and Adjust",subtext:"Use the controls to add a filter to your image.",priority:3}]}),[R.FreezeFrame]:new D({rules:[Qe("Freeze Frame","Upload your video first, then use the sidebar to create a Freeze Frame"),st("Freeze Frame","Select the video you want to create a Freeze Frame from."),{tooltipAnchorId:m.VideoTimingControlsTab,showWhen:Ye,header:"Freeze Frame",subtext:"Use the TIM
3ING tab to generate a Freeze Frame of your video"},{tooltipAnchorId:m.FreezeFrameButton,header:"Freeze Frame",subtext:"Use this button to generate a Freeze Frame of your video",priority:4}]}),[R.KenBurns]:new D({rules:[Qe("Add Ken Burns Effect","Upload a video, open the right sidebar, and select 'Moving Zoom' under 'Animation'."),st("Add Ken Burns Effect","Select the video you want to add a Ken Burns effect to."),{tooltipAnchorId:m.ConstantAnimationControlsTab,header:"Add Ken Burns Effect",subtext:"Click the ANIMATIONS tab to add a Ken Burns effect to your video.",priority:2},{tooltipAnchorId:m.MovingZoomButton,header:"Add Ken Burns Effect",subtext:"Click here to add a Ken Burns effect to your video.",priority:3}]}),[R.Keyframing]:new D({rules:[Le("Add Keyframes to Video","First upload your video, then add a keyframe with the âââ button next to keyframable properties within the right sidebar."),qe("Add Keyframes","Select the layer you want to add keyframes to."),{tooltipAnchorId:m.VideoPositionControlsTab,header:"Add Keyframes to Video",subtext:"Click the diamond icon next to a property in the right sidebar to add a keyframe."},{tooltipAnchorId:m.KeyframingDiamond,header:"Add Keyframes to Video",subtext:"Click the diamond icon next to a property in the right sidebar to add a keyframe.",priority:3}]}),[R.RemoveBackgroundNoiseWithElevenLabs]:new D({rules:[De("Remove Noise","First, upload a video, then use the Clean Audio button in the sidebar to remove background noise."),...Qo("Remove Noise","Select the layer with audio to remove background noise from."),{tooltipAnchorId:m.VideoAudioControlsTab,header:"Remove Noise",subtext:"Click the AUDIO tab to remove background noise.",priority:3},{tooltipAnchorId:m.AudioAiToolsControlsTab,header:"Remove Noise",subtext:"Click the AI TOOLS tab to remove background noise.",priority:3},{tooltipAnchorId:m.RemoveNoiseButton,header:"Remove Noise",subtext:"Click to remove background noise.",priority:4}]}
3),[R.RemoveImageBackground]:new D({rules:[No("Remove Background","Upload an image, then use the ERASE button in the sidebar to remove the background."),$t("Remove Background","Click to select the image that you want to remove the background from."),{tooltipAnchorId:m.ImageAiToolsControlsTab,header:"Remove Background",subtext:"Click the AI TOOLS tab to remove the background from your image.",priority:3},{tooltipAnchorId:m.RemoveBackgroundButton,header:"Remove Background",subtext:"Click to remove the background from your image.",priority:4},{tooltipAnchorId:m.VideoEffectControlsTab,header:"Erase Video Background",subtext:"Click the EFFECTS tab to remove the background from your video.",priority:2},{tooltipAnchorId:m.VideoRemoveBackgroundEffect,header:"Erase Video Background",subtext:"Click to remove the background from your video.",priority:3}]}),[R.RemoveVideoBackground]:new D({rules:[Qe("Erase Video Background","Upload a video, then click the EFFECTS tab in the sidebar to remove the background."),st("Erase Video Background","âClick to select the layer that you want to remove the background from."),{tooltipAnchorId:m.ImageAiToolsControlsTab,header:"Remove Backgroun
3d",subtext:"Click the AI TOOLS tab to remove the background from your image.",priority:2},{tooltipAnchorId:m.RemoveBackgroundButton,header:"Remove Background",subtext:"Click to remove the background from your image.",priority:3},{tooltipAnchorId:m.VideoEffectControlsTab,header:"Erase Video Background",subtext:"Click the EFFECTS tab to remove the background from your video.",priority:2},{tooltipAnchorId:m.VideoRemoveBackgroundEffect,header:"Erase Video Background",subtext:"Click to remove the background from your video.",priority:4}]}),[R.Reverse]:new D({rules:[Qe("Reverse","Upload your content, then use the controls in the right-hand sidebar to reverse your video or gif."),st("Reverse Video","Select the video you want to reverse."),{tooltipAnchorId:m.VideoAdjustControlsTab,header:"Reverse Video",subtext:"Use the controls to reverse your video.",priority:2},{tooltipAnchorId:m.ReverseToggle,header:"Reverse Video",subtext:"Use this toggle to reverse your video.",priority:3}]}),[R.Rotate]:new D({rules:[Le("Rotate","First, upload a file, then use the sidebar controls to rotate your image or video."),qe("Rotate","Select the layer you want to rotate."),{tooltipAnchorId:m.ImagePositionControlsTab,header:"Rotate Image",subtext:"Use the controls to rotate, mirror, or flip your image.",priority:2},{tooltipAnchorId:m.VideoPositionControlsTab,header:"Rotate Video",subtext:"Use the controls to rotate, flip, or mirror your video.",priority:2},{tooltipAnchorId:m.MirrorControl,showWhen:Ye,header:"Rotate Video",subtext:"Use the controls to rotate, flip, or mirror your video.",priority:3},{tooltipAnchorId:m.MirrorControl,showWhen:Je,header:"Rotate Image",subtext:"Use the controls to rotate, mirror, or flip your image.",priority:3}]}),[R.SlowMotion]:new D({rules:[Qe("Slow Motion","First, upload the video you want to slow down. The
3n use the sidebar controls to change its speed."),st("Slow Motion","Select the video you want to slow"),{tooltipAnchorId:m.VideoEditControlsTab,header:"Slow Motion",subtext:"Use the speed control to slow down your video.",priority:2},{tooltipAnchorId:m.SpeedControl,header:"Slow Motion",subtext:"Use the speed control to slow down your video.",priority:3}]}),[R.Speed]:new D({rules:[jo("Change Video Speed","First, upload a file, then use the sidebar controls to change its speed."),zh("Change Speed","Select the layer you want to change the speed of."),{tooltipAnchorId:m.AudioEditControlsTab,header:"Change Audio Speed",subtext:"Use the speed control to change the speed of your audio."},{tooltipAnchorId:m.VideoEditControlsTab,header:"Change Video Speed",subtext:"Use the speed control to change the speed of your video.",priority:2},{tooltipAnchorId:m.SpeedControl,header:"Change Speed",subtext:"Use the speed control to change the speed of your video.",priority:3}]}),[R.SilenceRemover]:Cs("Remove Silences"),[R.SmartCut]:Cs("Smart Cut"),[R.Volume]:new D({rules:[De("Adjust Volume","Upload your audio, then use the volume controls in the sidebar to adjust the volume."),...Qo("Adjust Volume","Select the layer for which you want to adjust the volume."),{tooltipAnchorId:m.VideoAudioControlsTab,header:"Adjust Volume",subtext:"Use this slider to adjust the volume of your video.",priority:3},{tooltipAnchorId:m.AudioEditControlsTab,header:"Adjust Volume",subtext:"Use this slider to adjust the volume of your audio.",priority:4},{tooltipAnchorId:m.VolumeControl,header:"Adjust Volume",subtext:"Use this slider to adjust the volume of your audio.",priority:5}]}),[R.VideoStabilizer]:new D({rules:[Qe("Stabilize Video","Upload a video to stabilize."),st("Stabilize Video","Select the video you want to stabilize."),{tooltipAnchorId:m.VideoAiToolsControlsTab,header:"Stabilize Video",subtext:"Select 'Stabilize' in the video controls.",priority:2},{tooltipAnchorId:m.VideoStabilizeButton,header:"Stabilize Video",subtext:"Select 'Stabilize' in the video controls.",priority:3}]}),[R.Resize]:new D({rules:[Le("Resize","First, upload your file. Then, in the sidebar, use the controls to adjust the size of your content."),...Ct("Resize","change the dimensions of your project.",je),{showWhen:je,tooltipAnchorId:m.ProjectControlTab,header:"Resize",subtext:"Use the 'Resize Project' button to change the dimensions of your project.",priority:3},{showWhen:je,tooltipAnchorId:m.ProjectResizeControl,header:"Resize",subtext:"Use the 'Resize Project' button to change the dimensions of your project.",priority:4}]}),[R.Convert]:new D({rules:[{tooltipAnchorId:m.Upload,priority:0,header:"Convert",subtext:"First upload the content that you want to convert. Then you will be able to export in different formats.",isSearchable:!0},{priority:2,showWhen:e=>ie(e).length>0&&ie(e).every(t=>!t.duration),header:"Convert To Video",tooltipAnchorId:m.CanvasBackground,subtext:"Start by selecting the image you want to convert to a video."},{priority:3,showWhen:e=>ie(e).length>0&&ie(e).every(t=>!t.duration),tooltipAnchorId:m.ImageTimingControlsTab,header:"Convert To Video",subtext:"Use the timing tab to add duration to your image, then you can export it as a video."},{priority:4,showWhen:e=>ie(e).length>0&&ie(e).every(t=>!t.duration),tooltipAnchorId:m.DurationControls,header:"Convert To Video",subtext:"Use the duration controls to add duration to your image, then you can export it as a video."},{showWhen:e=>ie(e).some(t=>t.duration),priority:0,tooltipAnchorId:m.ExportButton,header:"Convert",subtext:"Click Export, then choose the format you want to convert your video to."},{showWhen:e=>ie(e).length>0&&ie(e).every(t=>t.hasAudio),priority:1,tooltipAnchorId:m.ExportButton,header:"Convert",subtext:"Click Export, then choose the format you want to convert your audio to."}]}),[R.TvStatic]:new D({rules:[Le("Add TV Static","Upload a video to add TV Static to."),qe("Add TV Static","Select the video you want to add TV Static to."),...Dr("Add TV Static","Select the 'Transitions' tab and search for the TV Static transition.")]}),[R.Glitch]:new D({rules:[Le("Add Glitch Effect","Upload a video to add a Glitch transition to."),qe("Add Glitch Effect","Select the video you want to add a Glitch effect to."),...rt("Add Glitch Effect","Split your video into two parts at the point where you want to add the glitch effect.",e=>Object.values(ie(e).reduce((t,o)=>(o.timelineRow&&(t[o.timelineRow]=(t[o.timelineRow]||0)+1),t),{})).some(t=>t>1)),...Dr("Add Glitch Effect","In the 'Transitions' tab, select âGlitch Displaceâ or âGlitch Memoriesâ.")]}),[R.Transitions]:new D({rules:[{tooltipAnchorId:m.Upload,header:"Add Transitions",subtext:"First upload two videos, then select the first one and use the transitions tab to add a transition between them.",isSearchable:!0,showWhen:e=>ie(e).filter(t=>t.type==="image"||t.type==="video").length<2}
3,{tooltipAnchorId:m.CanvasBackground,header:"Add Transitions",showWhen:e=>ie(e).filter(t=>t.type==="image"||t.type==="video").length>=2,subtext:"Click to select the layer you want to add a transition to."},...Dr("Add Transitions","Select the transition you want to add.")]}),[R.ProgressBar]:new D({rules:[jo("Progress Bar","Upload a video, then use the `Visuals` tab to add a progress bar."),{showWhen:e=>e.studio.duration>0,tooltipAnchorId:m.VisualsSidebarTab,header:"Progress Bar",subtext:"Click the Visuals sidebar tab, then navigate to the Elements tab.",priority:1},{showWhen:e=>e.studio.duration>0,tooltipAnchorId:m.ElementsSearchTab,header:"Progress Bar",subtext:"Click the Elements tab, then click one of the progress bar styles",priority:2},{showWhen:e=>e.studio.duration>0,tooltipAnchorId:m.ProgressBarOptions,priority:3,header:"Progress Bar",subtext:"Click on a progress bar to add it to your project."}]}),[R.Waveform]:new D({rules:[De("Add a Waveform / Audiogram","First, upload a file with audio, then click on 'Visuals' in the sidebar to add a waveform."),{showWhen:le,tooltipAnchorId:m.VisualsSidebarTab,header:"Add Waveform",subtext:"Open the Visuals tab, then select the Elements tab.",priority:1},{showWhen:le,tooltipAnchorId:m.ElementsSearchTab,header:"Add Waveform",subtext:"Open the Elements tab, then choose one of the waveform patterns.",priority:2},{showWhen:le,tooltipAnchorId:m.WaveformOptions,header:"Add Waveform",subtext:"Select a waveform style to add it to your project.",priority:3}]}),[R.Censor]:new D({rules:[Le("Censor","Upload your content, then use a shape from the `Elements` tab to cover parts of your content."),{showWhen:Zt,tooltipAnchorId:m.VisualsSidebarTab,header:"Censor",subtext:"Open the Visuals tab, then select the Elements tab.",priority:1},{showWhen:Zt,tooltipAnchorId:m.ElementsSearchTab,header:"Censor",subtext:"Open the Elements tab, then choose a shape to censor your content.",priority:2},{showWhen:Zt,tooltipAnchorId:m.ElementsTabShapesOptions,header:"Censor",subtext:"Click on a shape to add it to your project.",priority:3}]}),[R.CustomEmoji]:new D({rules:[{header:"Custom Emoji",subtext:"Add an emoji to your project, then use the canvas to customize your emoji.",tooltipAnchorId:m.VisualsSidebarTab,isSearchable:!0},{header:"Custom Emoji",subtext:"Add an emoji to your project, then use the canvas to customize your emoji.",tooltipAnchorId:m.ElementsSearchTab,isSearchable:!0,priority:0},{showWhen:Sn,header:"Custom Emoji",subtext:"Add an emoji to your project, then use the canvas to customize your emoji.",tooltipAnchorId:m.ElementsTabEmojiOptions,isSearchable:!0,priority:1},{tooltipAnchorId:m.CanvasBackground,header:"Custom Emoji",subtext:"Click outside of the canvas to de-select your content.",priority:5,showWhen:e=>Ne(e)&&!(e.studio.width&&e.studio.height&&e.studio.width/e.studio.width===1)},{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Custom Emoji",subtext:"Exit this menu, then follow the hints to resize your emoji to the recommended dimensions (128px by 128px or 180px by 180px).",priority:6,showWhen:e=>Ne(e)&&!(e.studio.width&&e.studio.height&&e.studio.width/e.studio.width===1)},{tooltipAnchorId:m.ProjectSidebarTab,header:"Custom Emoji",subtext:"Use the project settings to resize your emoji to the recommended dimensions (128px by 128px or 180px by 180px)",priority:7,showWhen:e=>Ne(e)&&!(e.studio.width&&e.studio.height&&e.studio.width/e.studio.width===1)},{tooltipAnchorId:m.ProjectControlTab,header:"Resize",subtext:"Use the 'Resize Project' button to change the dimensions of your emoji to the recommended dimensions (128px by 128px or 180px by 180px).",priority:8,showWhen:e=>Ne(e)&&!(e.studio.width&&e.studio.height&&e.studio.width/e.studio.width===1)},{tooltipAnchorId:m.ProjectResizeControl,header:"Resize",subtext:"Use the 'Resize Project' button to change the dimensions of your emoji to the recommended dimensions (128px by 128px or 180px by 180px).",priority:9,showWhen:e=>Ne(e)&&!(e.studio.width&&e.studio.height&&e.studio.width/e.studio.width===1)},$t("Custom Emoji","Click to select you emoji to remove the background from it."),{tooltipAnchorId:m.ImageAiToolsControl
3sTab,header:"Custom Emoji",subtext:"Click the AI TOOLS tab to remove the background from your emoji.",priority:3},{tooltipAnchorId:m.RemoveBackgroundButton,header:"Custom Emoji",subtext:"Click to remove the background from your emoji.",priority:4}]}),[R.Draw]:new D({rules:[{tooltipAnchorId:m.VisualsSidebarTab,header:"Draw",subtext:"Open the Visuals tab to create a custom drawing, then select the Elements tab.",isSearchable:!0},{tooltipAnchorId:m.AllSearchTab,header:"Draw",subtext:"Open the Elements tab, then select Draw.",priority:1},{tooltipAnchorId:m.DrawButton,header:"Draw",subtext:"Click Draw to create a custom drawing for your project.",priority:2,isTerminal:!0}]}),[R.TranslateAudio]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Translate Audio",subtext:"Exit this menu, then follow the hints to translate audio.",priority:3},De("Translate Audio","Upload media and click 'Dub video' in the Translate tab."),{showWhen:le,tooltipAnchorId:m.TranslateSidebarTab,header:"Translate Audio",subtext:"Click here to generate translated audio and dub your video.",priority:1},{showWhen:le,tooltipAnchorId:m.DubVideoButton,header:"Translate Audio",subtext:"Click here to generate translated audio and dub your video.",priority:2,isTerminal:!0}]}),[R.Translate]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Translate Content",subtext:"Exit this menu, then follow the hints to start translating your project.",priority:3},{tooltipAnchorId:m.TranslateEmptyCTA,header:"Choose a Video",subtext:"Upload a video or audio file to start translating it into 40+ languages.",priority:2},{tooltipAnchorId:m.AddSample,header:"Translate Video",subtext:"Try a sample video, then you can generate translated subtitles afterwards.",isSearchable:!0,priority:1},{tooltipAnchorId:m.TranslateSidebarTab,header:"Translate your project",subtext:"Click here to start translating your project into one of 40+ languages.",priority:0},{tooltipAnchorId:m.TranslateTabStart,header:"Translate your project",subtext:"Start translating by either dubbing your project into another language, or creating translated subtitles.",priority:0},{tooltipAnchorId:m.MagicSubtitlesSmartToolsDropdown,header:"Translate Subtitles",subtext:"Click here to translate the subtitles for your project.",priority:2,isTerminal:!0},{tooltipAnchorId:m.SubtitleLanguageOptions,header:"Translate Subtitles",subtext:"Click here to select the language you would like to translate subtitles into.",priority:2},{tooltipAnchorId:m.DubbingLanguageOptions,header:"Dub your content",subtext:"Click here to select the language(s) you would like to dub your content into.",priority:2}]}),[R.TranslateSubtitles]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Translate Subtitles",subtext:"Exit this menu, then follow the hints to start translating your subtitles.",priority:3},{tooltipAnchorId:m.TranslateEmptyCTA,header:"Choose a Video",subtext:"Upload a video or audio file to start translating it into 40+ languages.",priority:2},{tooltipAnchorId:m.AddSample,header:"Translate Subtitles",subtext:"Try a sample video, then you can generate translated subtitles afterwards.",isSearchable:!0,priority:1},{tooltipAnchorId:m.MagicSubtitlesSidebarTab,header:"Translate Subtitles",subtext:"Click here to start translating your project into one of 40+ languages.",priority:0},{tooltipAnchorId:m.StartMagicSubtitlesButton,header:"Translate your project",subtext:"Click here to start translating your project into one of 40+ languages.",priority:1},{tooltipAnchorId:m.TranslateSubtitlesButton,header:"Translate Subtitles",subtext:"Click here to start translating your project into one of 40+ languages.",priority:1},{tooltipAnchorId:m.MagicSubtitlesSmartToolsDropdown,header:"Translate Subtitles",subtext:"Click here to translate the subtitles for your project.",priority:2,isTerminal:!0},{tooltipAnchorId:m.SubtitleLanguageOptions,header:"Translate Subtitles",subtext:"Click here to select the language you would like to translate subtitles into.",priority:2}]}),[R.Dubbing]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Dubbing",subtext:"Exit this menu, then follow the hints to dub your project.",priority:3},{tooltipAnchorId:m.TranslateEmptyCTA,header:"Choose a Video",subtext:"Upload a video or audio file to dub your project.",priority:1},De("Dubbing","Upload media and click 'Dub video' in the Translate tab."),{showWhen:le,tooltipAnchorId:m.TranslateSidebarTab,header:"Dubbing",subtext:"Click 'Dub video' in the Translate tab.",priority:0},{showWhen:le,tooltipAnchorId:m.DubVideoButton,header:"Dubbing",subtext:"Click 'Dub video' in the Translate tab.",priority:1},{showWhen:le,tooltipAnchorId:m.MagicSubtitlesSmartToolsDropdown,header:"Dubbing",subtext:"Click here to dub your video.",priority:1},{showWhen:le,tooltipAnchorId:m.DubbingLanguageOptions,header:"Dubbing",subtext:"Click here to select the language(s) you would like to dub your content into.",isTerminal:!0,priority:2}]}),[R.Transcribe]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Translate Subtitles",subtext:"Exit this menu, then follow the hints to add subtitles.",priority:10},De("Create a Transcription","First upload your video, then use the controls to create and download a transcription."),{showWhen:le,tooltipAnchorId:m.TranscriptSidebarTab,header:"Create a Transcription",subtext:"Click here to create a transcription for your video or audio.",priority:4},{showWhen:le,tooltipAnchorId:m.TrimWithTranscriptEntrypointButton,header:"Create a Transcription",subtext:"Click here to create a transcription for your video or audio.",priority:5},{tooltipAnchorId:m.TranscriptionTabDownloadTranscriptButton,header:"Create a Transcription",subtext:"Click here to download the transcription for your video or audio.",priority:6},{tooltipAnchorId:m.MagicSubtitlesSidebarTab,header:"Create a Transcription",subtext:"Auto-generate subtitles for your audio, then you'll be able to download the transcript.",showWhen:le},{tooltipAnchorId:m.StartMagicSubtitlesButton,header:"Subtitle Your Video",subtext:"First auto-generate subtitles for your video, then you'll be able to download the transcript.",showWhen:le,priority:1,isTerminal:!0}]}),[R.TrimWithTranscript]:new D({mobileWarningToast:"This feature is not available on mobile, come back on desktop to use it.",rules:[De("Edit Video by Editing Text","Get started by uploading the video or audio file that you'd like to edit."),{tooltipAnchorId:m.TranscriptSidebarTab,header:"Edit Video by Editing Text",subtext:"First transcribe your video, then you'll be able to split, trim, and edit using the words spoken in your video.",showWhen:le},{tooltipAnchorId:m.TrimWithTranscriptEntrypointButton,header:"Edit Video by Editing Text",subtext:"First transcribe your video, then you'll be able to split, trim, and edit using the words spoken in your video.",showWhen:le,priority:1},{tooltipAnchorId:m.TrimWithTranscriptApplyButton,header:"Edit Video by Editing Text",subtext:"First transcribe your video, then you'll be able to split, trim, and edit using the words spoken in your video.",showWhen:le,priority:1,isTerminal:!0},{tooltipAnchorId:m.TrimWithTranscriptContainer,header:"Edit Video by Editing Text",subtext:"Edits made to text here will be reflected in the video timeline",showWhen:le,priority:1,isTerminal:!0}]}),[R.AddImage]:new D({rules:[ot("Add Image","Upload video, images, or audio files and start editing them within the Kapwing editor."),{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Add Image",subtext:"Exit this menu, then follow the hints to add an image.",priority:3},{showWhen:je,tooltipAnchorId:m.VisualsSidebarTab,header:"Add Image",subtext:"Add additional images from the Visuals tab.",priority:1},{showWhen:je,tooltipAnchorId:m.ImagesSearchTab,header:"Add Image",subtext:"Add additional images from the Visuals tab.",priority:2},{showWhen:$h,tooltipAnchorId:m.SearchTabContents,header:"Add Image",subtext:"Add additional images from the Images tab.",priority:3}]}),[R.MusicVideo]:new D({rules:[ot("Create a Music Video","Upload a video here, or use the controls to the left to get started."),{tooltipAnchorId:m.AudioSidebarTab,showWhen:je,header:"Add Music",subtext:"Upload your own music, or browse from 1000+ songs and s
3ound effects to add to your video."},{tooltipAnchorId:m.AudioTabContent,showWhen:je,header:"Add Music",subtext:"Upload your own music, or browse from 1000+ songs and sound effects to add to your video.",priority:1}]}),[R.AddAudio]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Add Audio",subtext:"Exit this menu, then follow the hints to add audio."},{tooltipAnchorId:m.AudioSidebarTab,header:"Add Audio",subtext:"Add audio to your project from the left sidebar.",priority:0,isSearchable:!0},{tooltipAnchorId:m.AudioTabMusicOptions,header:"Add Audio",subtext:"Add audio to your project from the left sidebar.",priority:1}]}),[R.AddSoundEffects]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Add Sound Effects",subtext:"Exit this menu, then follow the hints to add sound effects."},{tooltipAnchorId:m.AudioSidebarTab,header:"Add Sound Effects",subtext:"Add sound effects to your project from the left sidebar.",priority:0,isSearchable:!0},{tooltipAnchorId:m.AudioTabSoundEffectsOptions,header:"Add Sound Effects",subtext:"Add sound effects to your project from the left sidebar.",priority:1}]}),[R.AnimatedText]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Animated Text",subtext:"Exit this menu, then follow the hints to add animated text to your project.",priority:2},{tooltipAnchorId:m.TextSidebarTab,header:"Animated Text",subtext:"Open the Text tab to add animated text to your project.",priority:0}]}),[R.AiVoiceCloning]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Voice Cloning",subtext:"Exit this menu, then follow the hints to add voice cloning to your project.",priority:3},{tooltipAnchorId:m.TextToSpeechSidebarTab,header:"Voice Cloning",subtext:"Click âAdd voice cloneâ to record or upload a voice sample to clone.",priority:0,isSearchable:!0},{tooltipAnchorId:m.TTSVoiceSelector,header:"Voice Cloning",subtext:"Click âAdd voice cloneâ to record or upload a voice sample to clone.",priority:1},{tooltipAnchorId:m.TTSCreateVoiceClone,header:"Voice Cloning",subtext:"Click âAdd voice cloneâ to record or upload a voice sample to clone.",priority:2}]}),[R.PersonasCreationFlow]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Create a Persona",subtext:"Exit this menu, then follow the hints to create a persona.",priority:3},{tooltipAnchorId:m.TextToSpeechSidebarTab,header:"Create a Persona",subtext:"Click here to create a your persona. You will be guided through selecting a video and creating a voice for it.",isSearchable:!0},{tooltipAnchorId:m.PersonaSelector,header:"Create a Persona",subtext:"Click here to create a your persona. You will be guided through selecting a video and creating a voice for it."}]}),[R.PersonasStockLibrary]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Use a Stock Persona",subtext:"Exit this menu, then follow the hints to use a stock persona.",priority:3},{tooltipAnchorId:m.TextToSpeechSidebarTab,header:"Use a Stock Persona",subtext:"Click here to select a persona from our stock library.",priority:0,isSearchable:!0},{tooltipAnchorId:m.StockPersonasTab,header:"Use a Stock Persona",subtext:"Click here to select a persona from our stock library.",priority:1}]}),[R.TextToSpeech]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Add Text to Speech",subtext:"Close this menu, then follow the hints to add text to speech.",priority:3},{tooltipAnchorId:m.TextToSpeechSidebarTab,header:"Add Text to Speech",subtext:"Add your text here, then use the buttons below to generate an audio layer.",priority:0,isSearchable:!0},{tooltipAnchorId:m.SelectedTextToSpeechBlock,header:"Add Text to Speech",subtext:"Add your text here, then use the buttons below to generate an audio layer.",priority:1}]}),[R.TranslateImage]:new D({rules:[No("Translate Image","First, upload your image here. You can translate the text afterward."),$t("Translate Image","Click Translate Text to translate the text from your image."),{tooltipAnchorId:m.ImageAiToolsControlsTab,header:"Translate Image",subtext:"Click Translate Text to translate the text from your image.",priority:2},{tooltipAnchorId:m.TranslateImageControl,header:"Translate Image",subtext:"Click Translate Text to translate the text from your image.",priority:3}]}),[R.BRollGenerator]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"B-Roll Generator",subtext:"Exit this menu, then follow the hints to add b-roll.",priority:3},De("B-Roll Generator","First upload the video or audio that you'd like to add b-roll for. Then, use Smart B-Roll to create clips for your video."),{showWhen:le,tooltipAnchorId:m.VisualsSidebarTab,header:"B-Roll Generator",subtext:"Select Smart B-Roll to start generating b-roll clips for your video.",priority:2},{showWhen:le,tooltipAnchorId:m.ImagesSearchTab,header:"B-Roll Generator",subtext:"Select Smart B-Roll to start generating b-roll clips for your video.",priority:3},{showWhen:le,tooltipAnchorId:m.StartSmartBRollButton,header:"B-Roll Generator",subtext:"Select Smart B-Roll to start generating b-roll clips for your video.",priority:4}]}),[R.Collage]:new D({rules:[Le("Make a Collage","Upload your files here, then rearrange them into the perfect collage."),{tooltipAnchorId:m.CanvasBackgroun
3d,header:"Make a Collage",subtext:"You can rearrange the content you upload by clicking and dragging them here. The blue transformation handles will help you resize and rotate to make your collage."}]}),[R.CompressVideo]:new D({rules:[ot("Compress","Upload your content, then adjust the Compression Level in the export settings."),{tooltipAnchorId:m.ExportButton,showWhen:je,header:"Compress",subtext:"Open the Export Settings to adjust the compression Level."}]}),[R.Editor]:new D({rules:[ot("Get Started","To get started, upload a file here, or use the controls to the left to get started."),qe("Get Started","Click a video or image to edit it."),{tooltipAnchorId:m.ImageEditControlsTab,header:"Get Started",priority:3,subtext:"Explore image controls.",isTerminal:!0},{tooltipAnchorId:m.VideoEditControlsTab,header:"Get Started",priority:3,subtext:"Explore video controls.",isTerminal:!0}]}),[R.Extract]:new D({rules:[De("Extract Audio","Upload a video or paste a youtube link. Then, in the timeline, right-click the video layer and select Detach Audio."),...rt("Extract Audio","Right-click the video layer and select Detach Audio to extract the audio.",e=>ie(e).some(t=>t.hasAudio&&t.type==="video")),{showWhen:e=>ie(e).some(t=>t.hasAudio&&t.type==="video"),tooltipAnchorId:m.SelectedVideoTrack,header:"Extract Audio",subtext:"Right-click the video layer and select Detach Audio to extract the audio.",priority:3}]}),[R.GifMaker]:new D({rules:[Le("Make a GIF","Upload a video or image here, then choose Export as a GIF when you're ready."),...Ct("Convert to GIF","add duration to your image, then you can export it as a GIF.",e=>!e.studio.duration),{showWhen:e=>!e.studio.duration,tooltipAnchorId:m.ProjectTimingControlsTab,header:"Convert to GIF",subtext:"You need to convert your image to a video in order to export it as an animated GIF. Choose a duration here.",priority:4},{showWhen:e=>!e.studio.duration,tooltipAnchorId:m.ProjectDurationControls,header:"Convert to GIF",subtext:"You need to convert your image to a video in order to export it as an animated GIF. Choose a duration here.",priority:5},{showWhen:e=>!!e.studio.duration,priority:1,tooltipAnchorId:m.ExportButton,header:"Make a GIF",subtext:"When you're ready, click Export and then choose GIF."}]}),[R.TrimVideo]:new D({rules:[jo("Trim","Upload your content, then use the timeline that appears to trim your video."),...rt("Trim Video","Use the handlers at each end of the track to trim the video. Drag the track to change when it starts.",e=>e.studio.duration>0),{tooltipAnchorId:m.SelectedVideoTrack,header:"Trim Video",subtext:"Use the handlers at each end of the track to trim the video. Drag the track to change when it starts.",priority:3},{tooltipAnchorId:m.SelectedAudioTrack,header:"Trim",subtext:"Use the handlers at each end of the track to trim the audio. Drag the track to change when it starts.",priority:3}]}),[R.TrimAudio]:new D({rules:[jo("Trim Audio","Upload your content, then use the timeline that appears to trim your audio."),...rt("Trim Audio","Use the handlers at each end of the track to trim the audio. Drag the track to change when it starts.",e=>e.studio.duration>0),{tooltipAnchorId:m.SelectedVideoTrack,header:"Trim",subtext:"Use the handlers at each end of the track to trim your video. Drag the track to change when it starts.",priority:2},{tooltipAnchorId:m.SelectedAudioTrack,header:"Trim Audio",subtext:"Use the handlers at each end of the track to trim the audio. Drag the track to change when it starts.",priority:2}]}),[R.Link]:new D({rules:[ot("Make a Link","Upload a video or image here, then export your project to get your shareable link."),{tooltipAnchorId:m.ExportButton,showWhen:je,header:"Make a Link",subtext:"After you export your project, you'll be able to share it with a link.",priority:1}]}),[R.YoutubeThumbnail]:new D({rules:[Le("Create a YouTube Thumbnail","Paste the link to your YouTube Video below, then click Export to create a single frame of the video."),{showWhen:e=>zo(e)&&Ne(e),header:"Make a Thumbnail",subtext:"Select your image to crop it.",tooltipAnchorId:m.CanvasBackgroun
3d,priority:1},{showWhen:e=>zo(e)&&Ne(e),header:"Make a Thumbnail",subtext:"Click the CROP button to crop your image to a YouTube Thumbnail size.",tooltipAnchorId:m.ImageEditControlsTab,priority:2},{showWhen:e=>zo(e)&&Ne(e),header:"Make a Thumbnail",subtext:"Click the CROP button to crop your image to a YouTube Thumbnail size.",tooltipAnchorId:m.CropButton,priority:3},{showWhen:e=>ro(e),header:"YouTube Thumbnail",subtext:"Click Export, then select PNG to create an image thumbnail of your video.",tooltipAnchorId:m.ExportButton,priority:1}]}),[R.RecordScreen]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Record Screen",subtext:"Exit this menu, then follow the hints to record your screen, camera, or audio.",priority:2},{tooltipAnchorId:m.RecordSidebarTab,header:"Record Screen",subtext:"Use the record tab in the sidebar to record your screen, camera, or audio.",priority:1,isTerminal:!0}]}),[R.MemeMaker]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Meme Maker",subtext:"Exit this menu, then follow the hints to create a meme.",priority:3},{tooltipAnchorId:m.TemplatesSidebarTab,header:"Meme Maker",subtext:"Select a meme template from the Templates tab.",priority:1},{tooltipAnchorId:m.FirstTemplateOption,header:"Meme Maker",subtext:"Select a meme template from the Templates tab.",priority:2}]}),[R.Vhs]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Add a VHS Effect",subtext:"Exit this menu, then follow the hints to add a VHS effect.",priority:4},{tooltipAnchorId:m.VisualsSidebarTab,header:"Add a VHS Effect",subtext:"Open the 'Visuals' tab and search for VHS effects to add to your content",priority:1},{tooltipAnchorId:m.ImagesSearchTab,header:"Add a VHS Effect",subtext:"Open the 'Images' tab and search for VHS effects to add to your content",priority:2},{showWhen:wn,tooltipAnchorId:m.SearchTabContents,header:"Add a VHS Effect",subtext:"Search for a VHS effect and click it to add to your content",priority:3}]}),[R.SrtEditor]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Edit an SRT",subtext:"Exit this menu, then follow the hints to add subtitles to your video."},De("Edit an SRT","First, upload the video you'd like to add subtitles to. You can upload an SRT file in the next step."),{showWhen:le,tooltipAnchorId:m.MagicSubtitlesSidebarTab,header:"Upload SRT File",subtext:"Upload an SRT file to edit your subtitles directly from the SRT file editor that will appear.",priority:1},{showWhen:le,tooltipAnchorId:m.StartUploadSubtitleButton,header:"Upload SRT File",subtext:"Upload an SRT file to edit your subtitles directly from the SRT file editor that will appear.",priority:2}]}),[R.Slideshow]:new D({rules:[Le("Make a Slideshow","Upload images and videos to get started."),{showWhen:e=>!e.studio.duration,tooltipAnchorId:m.CanvasBackground,header:"Make a Slideshow",subtext:"Click outside of the canvas to deselect your image, then add duration to your project to create a slideshow.",priority:1},{showWhen:e=>!e.studio.duration,tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Make a Slideshow",subtext:"Close this menu, then follow the hints to add a duration to your project.",priority:4},{showWhen:e=>!e.studio.duration,tooltipAnchorId:m.ProjectTimingControlsTab,header:"Make a Slideshow",subtext:"Use the timing controls to add duration to your project to create a slideshow.",priority:2},{showWhen:e=>!e.studio.duration,tooltipAnchorId:m.ProjectDurationControls,header:"Make a Slideshow",subtext:"Use the timing controls to add duration to your project to create a slideshow.",priority:3}]}),[R.SrtFile]:new D({rules:Es("SRT")}),[R.VttFile]:new D({rules:Es("VTT")}),[R.SpeakerFocus]:new D({rules:[Jh("Center Active Speakers","Upload a video with at least one speaker, then choose Speaker Focus in the Right Sidebar."),...Ct("Center Active Speakers","to use Speaker Focus to center the active speaker in each scene.",e=>eo(e)),{showWhen:eo,tooltipAnchorId:m.ProjectControlTab,header:"Center Active Speakers",subtext:"Use Speaker Focus to center the active speaker in each scene.",priority:3},{showWhen:eo,tooltipAnchorId:m.SpeakerFocusControl,header:"Center Active Speakers",subtext:"Use Speaker Focus to center the active speaker in each scene.",priority:4}]}),[R.Podcast]:new D({rules:[De("Edit Audio for Podcasts","Upload your audio and get started!"),{showWhen:eo,tooltipAnchorId:m.CanvasBackgroun
3d,header:"Edit Audio for Podcasts",subtext:"Click to select the layer with audio you want to edit.",priority:3},...rt("Edit Audio for Podcasts","Select your audio layer in the time line to edit it.",le),{showWhen:le,tooltipAnchorId:m.AudioEditControlsTab,header:"Edit Audio for Podcasts",subtext:"You can edit your podcast audio with the controls here.",priority:4},{showWhen:le,tooltipAnchorId:m.VideoAudioControlsTab,header:"Edit Audio for Podcasts",subtext:"You can edit your podcast audio with the controls here.",priority:4}]}),[R.SafeZone]:new D({rules:[ot("Show Safe Zones","Upload your content, then under the 'Canvas' tab, use the 'Safe Zones' section to resize your canvas."),...Ct("Show Safe Zones","to show safe zones.",je),{tooltipAnchorId:m.ProjectSafeZoneControlsTab,header:"Show Safe Zones",subtext:"Select a platform to preview your content with a layout overlay",priority:2},{tooltipAnchorId:m.SafeZoneControlTabContent,header:"Show Safe Zones",subtext:"Select a platform to preview your content with a layout overlay",priority:3}]}),[R.Teleprompter]:new D({rules:[{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Teleprompter",subtext:"Exit this menu, then follow the hints to use the teleprompter.",priority:3},{tooltipAnchorId:m.RecordSidebarTab,header:"Teleprompter",subtext:"Select a recording option, then click âOpen Teleprompter.â",priority:1},{tooltipAnchorId:m.RecordOptions,header:"Teleprompter",subtext:"Select a recording option, then click âOpen Teleprompter.â",priority:2}]}),[R.Text]:new D({rules:[ot("Add Text","Upload your content, then add text to your project."),{tooltipAnchorId:m.CloseMobileMediaSidebarButton,header:"Add Text",subtext:"Exit this menu, then follow the hints to add text.",priority:3},{tooltipAnchorId:m.TextSidebarTab,header:"Add Text",subtext:"Click the TEXT button to add text to your project.",priority:1},{tooltipAnchorId:m.AddTextButton,header:"Add Text",subtext:"Click the TEXT button to add text to your project.",priority:2,isTerminal:!0}]}),[R.Timeline]:new D({rules:[ot("Edit With Timeline","Upload video, images, or audio files and start editing them within the Kapwing editor."),...Ct("Convert Image to Video","to add duration to your image.",e=>Ne(e)&&!e.studio.duration),{showWhen:e=>!e.studio.duration&&Ne(e),tooltipAnchorId:m.ProjectTimingControlsTab,header:"Convert Image to Video",subtext:"If you want to make a video from this image, use the duration selector to change the duration of your image video.",priority:3},{showWhen:e=>!e.studio.duration&&Ne(e),tooltipAnchorId:m.ProjectDurationControls,header:"Convert Image to Video",subtext:"If you want to make a video from this image, use the duration selector to change the duration of your image video.",priority:4},...rt("Edit Your Video","Use timeline to trim, merge, and edit your videos. Drag and drop files into Kapwing to start.",ro),...rt("Edit Your Audio","Use timeline to trim, merge, and edit your audio files. Drag and drop files into Kapwing to start.",e=>le(e)&&!ro(e)),{showWhen:je,tooltipAnchorId:m.SelectedVideoTrack,header:"Edit Your Video",subtext:"Use timeline to trim, merge, and edit your videos. Drag and drop files into Kapwing to start.",priority:3}]}),[R.AiScriptToVideoGenerator]:new D({rules:xt("Create an AI video from a custom script","Paste or type your script, and Kapwing AI will create a video based on its contents.",m.AiPasteExistingScriptInput)}),[R.AiArticleToVideo]:new D({rules:xt("Article to Video","Paste the link to an article, and Kapwing AI will create a video based on its contents.",m.AiPasteArticleUrlInput)}),[R.AiDocumentToVideo]:new D({rules:xt("Document to Video","Paste or type your document, and Kapwing AI will create a video based on its contents.",m.AiGenerateScriptInput)}),[R.AiVideoGenerator]:new D({rules:xt("Create a video with AI","Type an idea for a video, and Kapwing AI will take care of the rest.",m.AiGenerateScriptInput)}),[R.AiScriptGenerator]:new D({rules:xt("Create an AI Script","Type an idea for a script, and Kapwing AI will take care of the rest.",m.AiGenerateScriptInput)}),[R.AiImageGenerator]:new D({rules:xt("Create AI Images","Type a prompt, and Kapwing will generate four images for your project.",m.AiGenerateImageInput)}),[R.KaiSoundEffects]:new D({rules:[{tooltipAnchorId:m.KaiChatInput,header:"Create a sound effect",subtext:"Remember to include âsound effectâ in your prompt"}]}
3),[R.KaiFontGenerator]:new D({rules:[{tooltipAnchorId:m.KaiChatInput,header:"Generate a Font",subtext:"To create accurate text art, include your custom words in quotation marks"}]}),[R.KaiCharacters]:new D({rules:[{tooltipAnchorId:m.KaiChatInputCharacterButton,header:"Use a Character",subtext:"To generate with a character, click the @ button to choose a stock character or create your own",isTerminal:!0}]}),[R.Pinning]:new D({rules:[Qe("Pin Object with Keyframes","Upload a video to get started."),{tooltipAnchorId:m.CanvasBackground,header:"Pin Object with Keyframes",subtext:"Click to select the layer you want to pin to an object in your video.",priority:1},{tooltipAnchorId:m.ImagePositionControlsTab,header:"Pin Object with Keyframes",subtext:"Click the âââ button to mark the starting position of the object you want to track.",priority:2},{tooltipAnchorId:m.VideoPositionControlsTab,header:"Pin Object with Keyframes",subtext:"Click the âââ button to mark the starting position of the object you want to track.",priority:2},{tooltipAnchorId:m.LayerPositionKeyframeButton,header:"Pin Object with Keyframes",subtext:"Click the âââ button to mark the starting position of the object you want to track.",priority:3}]}),[R.Generic]:new D({rules:[ot("Upload Content","To get started, upload a file here, or use the controls to the left to get started."),qe("Make edits","Click a video or image to edit it.",2),{tooltipAnchorId:m.ExportButton,showWhen:je,header:"Export",subtext:"When you're ready, click Export to download your project.",priority:1}]}),[R.SplitVocals]:new D({rules:[De("Split Vocals","Upload a video or audio file to get started."),...Qo("Split Vocals","Select the audio layer to split."),{tooltipAnchorId:m.AudioEditControlsTab,header:"Split Vocals",subtext:"Click the âSplit Vocalsâ button to split the vocals.",priority:3},{tooltipAnchorId:m.VideoAudioControlsTab,header:"Split Vocals",subtext:"Click the âSplit Vocalsâ button to split the vocals.",priority:3},{tooltipAnchorId:m.SplitVocalsButton,header:"Split Vocals",subtext:"Click the âSplit Vocalsâ button to split the vocals.",priority:4}]}),[R.EyeContact]:new D({rules:[Qe("Eye Contact","Upload a video, then use the Eye Contact button in the sidebar to correct the eye movement"),st("Eye Contact","Select the layer with eye movement to correct"),{tooltipAnchorId:m.VideoAiToolsControlsTab,header:"Eye Contact",subtext:"Click the AI Tools tab to correct the eye movement in your video.",priority:2},{tooltipAnchorId:m.EyeContactButton,header:"Eye Contact",subtext:"Retouch your video so that your subject is always making eye contact with the camera",priority:3}]}),[R.SplitVideo]:new D({rules:[Qe("Split Video","Upload your content, then use the timeline that appears to split your video"),{tooltipAnchorId:m.Timeline,header:"Split Video",subtext:'Drag the seeker to the part of the video where you want to split and use the Split button or "S" key to cut the footage at that time.',priority:1}]}),[R.SpeakerLabels]:new D({rules:[...xs.map(e=>({...e,isSearchable:!1,isTerminal:!1})),{tooltipAnchorId:m.MagicSubtitlesSpeakerLabel,header:"Edit Speaker Labels",subtext:"Customize speaker names and add speakers to the canvas.",priority:7,isTerminal:!0},{tooltipAnchorId:m.MagicSubtitleToolbarOverflowButton,header:"Show Speaker Labels",subtext:"Customize speaker names and add speakers to the canvas.",priority:5},{tooltipAnchorId:m.MagicSubtitlesSpeakerLabelsButton,header:"Show Speaker Labels",subtext:"Customize speaker names and add speakers to the canvas.",priority:6}]})};function En(){let e="";const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<8;o+=1)e+=t.charAt(Math.floor(Math.random()*62));return e}function Cn(){const{location:e}=ha(),{pathname:t}=e;return t.match(/studio\/editor/)||t.includes("upload")||t.includes("replace")||t.includes("mediaLibrary")||t.includes("search")||t.includes("emoji")||t.includes("remove-background")||t.includes("subtitles")}var xn=e=>{const t=en(Xo.UNLIMITED_EXPORT_DURATION_LIMIT);"duration"in e&&e.duration&&e.duration>240&&!t&&!yc(e.id)&&ce("Paywalled Upload",{"Upload Type":e.type,Duration:e.duration})},Xh=(e,t,o)=>{const{dispatch:r}=I(),s={position:null,...e};
3return xn(s),s.position=qc(s),Vt(s),e.isMediaLibraryUpload||(o&&r(kl(o,"handleUploadRequiringConversion")),Pt(s)),e.uploadLocation==="resize"&&(s.lockAspectRatio=!0),t&&Cn()&&["pastedLink","local"].includes(e.source||"")&&e.origin!=="oneoff-landing-page"&&Ln(e,!1),s};const Wt=()=>({id:Nt(12)}),ka=async(e,t,o)=>{const{state:r}=I(),{currentUser:{user:{_id:s}},assets:{localAssetInfo:a}}=r;let n;const{name:i,size:l,type:d,recordType:c}=e;c&&(n=`Recorded ${c} ${ie(r).reduce((_,S)=>S.recordType?_+1:_,0)+1}`);const u=go(t);let h=a[u]?.local_url;h||(h=URL.createObjectURL(e),wu({[u]:{local_url:h}}));const A=await ga(h,e,dt.HIGH),g=A?A.type:t.type;if(!g)throw new _a("Could not identify media type",{extra:{properties:t,mediaInfo:A,...pc(e)}});const y={videoDelay:0};o?.addAtSeeker&&(y.videoDelay=uo());const b={...Wt(),name:n||i,size:l,mime:d,...c&&{recordType:c},source:"local",objectFit:"cover",...t,...A,type:g,...o?.addAtSeeker&&y,uploaderId:s};return Object.assign(b,_o(b)),A?.type==="video"&&(b.startTime=t.startTime??0,b.endTime=t.endTime??A.duration),b},U8=async(e,t,o,r,s,a)=>{let n;if(r.url)n=await Qr(r.url,{name:r.url,type:r.mime},dt.HIGH);else if(r.hasUploadedAssetDuplicate&&e.url)n=await Qr(e.url,{name:e.name,type:e.content_type},dt.HIGH);else throw Error("No url to extract");const i=n.type;if(!i)throw new _a("Could not identify media type",{extra:{mediaInfo:n,asset:e,extractInfo:r}});let l={};r.height&&r.width&&(l={height:r.height,width:r.width});const d=(t?.duplicate||r.hasUploadedAssetDuplicate)&&e.status===er.uploaded?"upload":"pastedLink",c=e.status===er.uploaded,u={...Wt(),name:e.name||En(),asset_id:e._id,conversion_id:e.conversion_id||r.conversion_id,mime:r.mime,requireConversion:r.requireConversion,conversion_type:r.conversion_type,source:d,objectFit:"cover",isMediaLibraryUpload:s,...n,...l,type:i,uploadPending:!c};return Object.assign(u,_o(u)),go(u),a&&(u.videoAssetId=a._id),t&&(u.cmlFileId=t._id),o&&(u.teamAssetId=o._id),s||lt(u.type,"paste link"),r.thumbnailUrl&&(u.thumbnailUrl=r.thumbnailUrl),u},Zh=async(e,t,o)=>{const r=await Ir(e);if(!r)return;const s=r.type===de.Image?["original"]:["preview","original"],[a,n]=us(r,s);if(!n)return;const i=Rn(t),l=nc({idbAsset:r,includeHasAudio:!0,fileSelectionOrder:s}),d={};if(t.content_type==="image/webp"){let T="unknown";try{T=await ic(n)}catch{console.error("Failed to determine webp file type")}d.webpType=T}const c={...i,...l,...d},{id:u}=Wt(),{state:h,dispatch:A}=I(),{localAssetInfo:g}=h.assets,y=g[e]||{},b={};if(r.type===de.Video&&t.preview&&t.preview.url&&(!t.preview.width||!t.preview.height||!t.preview.duration))if(c?.duration&&c?.width&&c?.height){const T={...t.preview,width:c.width,height:c.height,duration:c.duration};t.preview._id&&Bo(t.preview._id,{dimensions:{width:c.width,height:c.height},duration:c.duration}),A(Te([{...t,preview:T}]))}else{const T=await $i({asset:t},"video/mp4",dt.HIGH);if(T.success){const{width:w,height:x,duration:k}=T.properties,M={...t.preview,width:w,height:x,duration:k,startTime:0,endTime:k};t.preview._id&&Bo(t.preview._id,{dimensions:{width:w,height:x},duration:k}),A(Te([{...t,preview:M}]))}}if(r.type===de.Image&&t.preview?.url&&(!t.preview.width||!t.preview.height))if(c?.width&&c?.height){const T={...t.preview,width:c.width,height:c.height};t.preview._id&&Bo(t.preview._id,{dimensions:{width:c.width,height:c.height}}),A(Te([{...t,preview:T}]))}else{const T=await ln(t.preview.url,"image/png");if(T.success){const{width:w,height:x}=T.properties,k={...t.preview,width:w,height:x};t.preview._id&&Bo(t.preview._id,{dimensions:{width:w,height:x}}),A(Te([{...t,preview:k}]))}}if(t.track_preview&&!y.trackPreviewLocalUrl){const[T,w]=us(r,["track"]);w&&(b.trackPreviewLocalUrl=URL.createObjectURL(w))}if(r.type===de.Video&&r.thumbnailSheet&&!y.thumbnailSheetLocalInfo){const{file:T,thumbnail_height:w,thumbnail_width:x,fps:k,width:M,height:j}=r.thumbnailSheet;b.thumbnailSheetLocalInfo={local_url:URL.createObjectURL(T),thumbnailHeight:w,thumbnailWidth:x,fps:k,sheetWidth:M,sheetHeight:j}}!y.local_url&&a==="original"&&(b.local_url=URL.createObjectURL(n)),!y.preview_local_url&&a==="preview"&&(b.preview_local_url=URL.createObjectURL(n)),Object.keys(b).length>0&&A(vo({[e]:b}));let _;t.preview?.hasAudio!=null?_=t.preview.hasAudio:t.hasAudio!=null?_=t.hasAudio:"hasAudio"in c?_=c.hasAudio:_=void 0;const S={id:u,asset_id:r.asset_id,type:r.type,...c,source:"upload",size:n.size,name:n.name,originalName:n.name,mime:n.type,addedFromMediaLibrary:!0,...o,duration:o?.duration??c.duration,hasAudio:_};return Object.assign(S,_o(S)),S},kn=async(e,t,o,r)=>{if(!e.url){console.error("MISING ASSET url getNewLayerFromRemoteAsset",e);return}if(e.preview&&e.preview.url){const d={...e.preview,mediaLibraryID:t},c=e.content_type?.startsWith("image"),u=e.content_type?.startsWith("video");let h={};if(c&&d.url&&(!d.width||!d.height)){const A=await ln(d.url,"image/png");A.success&&(h.height=A.properties.height,h.width=A.properties.width)}if(u&&d.url&&(!d.width||!d.height||!d.duration)){const A=await $i({asset:e},"video/mp4",dt.HIGH);if(A.success){const{width:g,height:y,duration:b}=A.properties;h={...d,width:g,height:y,duration:b,startTime:0,endTime:b}}}Object.keys(h).length>0&&I().dispatch(Te([{...e,preview:h}]))}const s=await Ir(go({asset_id:e._id,uploadId:o.uploadId}
3));let a;if(s&&s.type==="video"){const d=s.optimizedPreviewFile_v2??s.file_v2;d&&(a={duration:d.duration,hasAudio:d.hasAudio,width:o.width||d.width,height:o.height||d.height,type:s.type})}if(s&&s.type==="image"){const d=s.file_v2;d&&(a={width:o.width||d.width,height:o.height||d.height,type:s.type})}if(!a){const d={name:o.name,type:o.mime??void 0},c=Rn(e);a=r||c,a||(o.type?a=await ga(e.url,d,dt.HIGH):a=await Qr(e.url,d,dt.HIGH))}const n=o.type||a?.type;if(!n)throw new _a("Could not identify media type",{extra:{properties:o,mediaInfo:a,givenMediaInfo:r,asset:e,idbAsset:s}});if(e.content_type==="image/webp"&&a?.type==="image"&&!a.webpType&&e.url){let d="unknown";try{d=await Cu(e.url)}catch{console.error("Failed to determine webp file type")}o.webpType=d}let i;e.preview?.hasAudio!=null?i=e.preview.hasAudio:e.hasAudio!=null?i=e.hasAudio:a&&"hasAudio"in a?i=a.hasAudio:o.hasAudio!=null?i=o.hasAudio:n==="video"||n==="audio"?i=!0:i=void 0;const l={...Wt(),name:En(),source:"upload",objectFit:"cover",...o,...a,type:n,asset_id:e._id,hasAudio:i};return Object.assign(l,_o(l)),l},Rn=e=>{const t=e,o=zu(t);if(o){if(o===de.Image&&t.dimensions?.width&&t.dimensions?.height)return{width:t.dimensions.width,height:t.dimensions.height,type:o};if(o===de.Audio&&t.duration)return{duration:t.duration,hasAudio:!0,type:o};if(o===de.Video&&t.duration&&t.dimensions?.width&&t.dimensions?.height&&"hasAudio"in t)return{width:t.dimensions.width,height:t.dimensions.height,duration:t.duration,hasAudio:t.hasAudio,type:o}}};var Ln=(e,t)=>{const{dispatch:o,state:r}=I(),{pathname:s}=ha().location;r.uploadOverlay.open&&o(au.close()),vn(r.toolTip)&&r.toolTip===R.Subtitles&&(Hl("/studio/editor/subtitles"),o(wa({tabId:pr.SUBTITLES,tabContainerId:ca}))),!s.includes("/upgrade")&&(t&&Cn()||e.origin==="oneoff-landing-page"?e.origin!=="oneoff-landing-page"&&!s.includes("/studio/editor")?kr():(s.includes("/overlay/library")||s.includes("/overlay/search")||s.includes("/overlay/projects")||s.includes("/overlay/emojis")||s.includes("/drag-upload"))&&kr():(e.uploadLocation==="resize"||e.uploadLocation==="convert")&&kr())};const Dn=(e,t)=>{const{selectLayerInCreator:o=!1,replaceInfo:r,newTimeline:s=!1,knownTimelineRow:a=!1,multiRowUploadForRecording:n=!1,singleFileUpload:i=!1,skipStudioAddLayer:l=!1,useCustomVideoDelay:d=void 0,droppedTrackInfo:c}=t||{},{state:u}=I();if(u?.currentUser?.token||(e.wasUploadedAnonymously=!0),!e.originalName&&e.name&&(e.originalName=e.name),e.requireConversion)return Xh(e,o,r?.layerToReplace);const h=yo(e),A=h?u.assets.localAssetInfo[h]?.local_url:void 0;(["pastedLink","local"].includes(e.source??"")||!A||!e.metadataGathered||t3(e))&&xn(e);const g=n||i;return d===void 0&&!r&&!e.isMediaLibraryUpload&&g&&Vt(e),d!==void 0&&(e.type===de.Image?e.startTime=d:e.videoDelay=d),r?ba({newLayer:e,replacedLayer:r.layerToReplace,addLayerOptions:{knownTimelineRow:a,newTimeline:s,undoable:!0},mediaSource:r.mediaSource,entryPoint:r.entryPoint}):!e.isMediaLibraryUpload&&!l&&Pt(e,{knownTimelineRow:a,newTimeline:s,undoable:!0,droppedTrackInfo:c}),Ln(e,o),e},P8=e=>{const{dispatch:t,state:o}=I(),r={};if(kc.forEach(s=>{s in e&&(r[s]=e[s])}),t(Ml(e,r)),r.asset_id){const s=[];Object.values(o.studio.allLayers.byId).forEach(a=>{e.uploadId&&a.uploadId===e.uploadId&&s.push(a.id)}),t(Du({assetId:r.asset_id,layerIds:s}))}return e};function e3(e,t=I().state){const o=yo(e);return o?t.assets.localAssetInfo[o]?.preview_local_url?!0:e.asset_id?!!t.assets.byId[e.asset_id]?.preview?.url:!1:!1}function O8(e,t=I().state){const o=He(e,t);if(!o)return!1;const r=e3(o,t);return o.requireConversion&&!r}function B8(e){if(!e)return null;const{progress:t=0,conversionProgress:{conversion:o=101,gather_assets:r=101,uploading_converted:s=101}={}}=e;let a=null;if(t<100)a=`Uploading ... ${t}%`;else if(r<100)a="Getting Assets ... ";else if(o<100)a=`Converting ... ${o}%`;else if(s<100)a="Uploading ... ";else if(e.uploadManager&&Wu(e.uploadManager.layer))return"Converting ... ";return a}function F8(e){if(!e)return null;const{progress:t=0,conversionProgress:{conversion:o=101,gather_assets:r=101,uploading_converted:s=101}={}}=e;let a=null;return t<100?a=t:r<100?a=r:o<100?a=o:s<100&&(a=s),a}function j8(){const{state:e}=I(),{background:t}=e.studio;return t==="rgba(-255,-255,-255,0)"}var Mr=e=>{const t=e.toString(16);return t.length===1?`0${t}`:t};const N8=(e,t,o)=>`#${Mr(e)}${Mr(t)}${Mr(o)}`.toUpperCase();var t3=e=>{const t=He(e.id);return t?.position?Object.keys(t.position).some(o=>{const r=o,s=t.position?.[r];return typeof s=="string"&&s.includes("NaN")}):!0},o3=e=>{const t=e.split(".");return t.pop(),t.push("mkv"),"audio_"+t.join(".")};async function r3(e){try{const{Conversion:t,Input:o,Output:r,BlobSource:s,MkvOutputFormat:a,BufferTarget:n,ALL_FORMATS:i}=await Md(async()=>{const{Conversion:u,Input:h,Output:A,BlobSource:g,MkvOutputFormat:y,BufferTarget:b,ALL_FORMATS:_}=await import("./src-D0IV0f1J.js");return{Conversion:u,Input:h,Output:A,BlobSource:g,MkvOutputFormat:y,BufferTarget:b,ALL_FORMATS:_}},__vite__mapDeps([0,1,2,3,4])),l=new o({formats:i,source:new s(e)}),d=new r({format:new a,target:new n});if((await l.getAudioTracks())[0]==null)return console.warn("No audio tracks foun
3d"),null;await(await t.init({input:l,output:d,video:{discard:!0},audio:(u,h)=>{if(h>1)return{discard:!0}}})).execute();const c=d.target.buffer;return c==null?(console.error("Buffer not found..."),null):new File([c],o3(e.name),{type:"audio/matroska"})}catch(t){return console.error("Unknown error!",t),null}}const ks=e=>new Uint8Array(e).reduce((t,o)=>t+o.toString(16).padStart(2,"0"),"");async function Yt(e){return await window.crypto.subtle.digest("SHA-256",e)}var a3=1024*1024*1024;async function s3(e){if(!window?.crypto?.subtle?.digest)return null;try{const t=[],o=.5*a3;if(e.size<o*3)for(let n=0;n<e.size;n+=o){const i=e.slice(n,n+o);t.push(await Yt(await i.arrayBuffer()))}else{const n=await e.slice(0,o).arrayBuffer(),i=await e.slice(e.size-o).arrayBuffer();t.push(await Yt(n)),t.push(await Yt(i));const l=o,d=e.size-o,c=d-l,u=1e7,h=Math.floor(o/u),A=Math.floor(c/h);for(let g=l;g<d;g+=A){const y=await e.slice(g,Math.min(d,g+u)).arrayBuffer();t.push(await Yt(y))}}const r=t.reduce((n,i)=>n+i.byteLength,0),s=new Uint8Array(new ArrayBuffer(r));let a=0;for(const n of t)s.set(new Uint8Array(n),a),a+=n.byteLength;return await Yt(s)}catch(t){console.error("Unknown hash error",t)}return console.error("Unable to get hash from file",e),null}var i3=ae(It()),n3=ae(Rd()),Co=ae(po());function Mn(e,t){return t.allowPdfs===!0&&u1(e)==="application/pdf"}async function V8(e,t){if(!e.length)return{conversionAndUploadPromise:Promise.resolve(),uploadIds:[]};const{dispatch:o,state:r}=I();if(!r.currentUser?.user?._id)return o(Ei()),t.eventHandlers?.handleError?.(),{conversionAndUploadPromise:Promise.resolve(),uploadIds:[]};const{uploadOptions:{multiRowUploadForRecording:s}}=t;let a=Array.from(e).sort((c,u)=>c.lastModified-u.lastModified);s&&(a=a.sort((c,u)=>c.recordType==="screen"?-1:1));const n=new Fd(8);a.length>1&&ce("Multi Upload",{"Number of files":a.length,"Total file size (MB)":a.reduce((c,u)=>c+u.size/1e6,0)});const i=await Promise.all(a.map((c,u)=>n.runExclusive(()=>l3(c,t,u)))),l=i.filter(({layer:c,fileOnly:u})=>c||u).map(c=>c.bundle.uploadId),d=i.filter(({layer:c})=>c);return l.length?d.length?(t.uploadOptions.skipAddTimelineLayer||o(Li(!0)),!s&&!t.uploadOptions.skipAddTimelineLayer&&A3(d),{conversionAndUploadPromise:c3(d),processedFilesAndLayers:d,uploadIds:l}):{conversionAndUploadPromise:Promise.resolve(),uploadIds:l}:{conversionAndUploadPromise:Promise.resolve(),uploadIds:[]}}async function Rs(e){if(!crypto?.subtle?.digest)return{};let t=2*Rr;Wl()?t=.5*Rr:Dl()&&(t=1*Rr);let o,r;if(e.size<t){const i=await y3(e).arrayBuffer(),l=await crypto.subtle.digest("SHA-256",i);o=ks(l),r=Ds(l)}else if(e.size>2*1073741824){const i=await s3(e);i&&(o=ks(i),r=Ds(i))}if(!o||!r)return{hashStr:o};const{state:s}=I(),a=s.CMLFiles.byId,n=s.assets.byId;for(const i of s.CMLFiles.myMediaIds){const l=a[i];if(l&&(l.hash&&Buffer.compare(r,new Uint8Array(l.hash.data))===0||l.hashStr&&l.hashStr===o)&&!n[l.asset_id]?.pdf_conversion_failed)return{hashStr:o,duplicate:{cml:l}}}return{hashStr:o}}async function d3({bundle:e,layer:t,file:o,duplicate:r}){const{dispatch:s,state:a}=I(),n=a.studio._id,i=vt(a,St.ENABLE_TEAM_ASSETS),l=r.cml.asset_id,d={...t,asset_id:l,cmlFileId:r.cml._id,source:"upload",uploadConfirmed:Date.now()};if(Yi(r.cml).catch(h=>{console.error("Failed to update CML File modified date",h)}),!e.uploadOptions.skipLinkCMLFileToProject&&(s(ya(r.cml,n)),d.videoAssetId=Object.values(a.videoAssets.byId).find(h=>h.asset_id===l&&(!n||h.video_id===n))?._id,i&&!d.videoAssetId&&n))try{const h=await wo(n,l);h&&(d.videoAssetId=h._id,s(Gt(h)),s(bo([h])))}catch(h){console.error("Failed to create video asset for duplicate upload",h)}e.uploadOptions.skipUploadStatusUpdates||s(yt.addUploadStatus({id:e.uploadId,fileName:o.name})),s(yt.updateUploadStatus({id:e.uploadId,updates:{assetId:l,progress:100,stage:Ce.done}}));const c=a.assets.byId[l]??await Eo(l,"dedupReuse");s(Te([c])),xo(e,d,o);const u=I().state.mediaCache.uploadIdToMediaCacheId[e.uploadId];u&&s(fr({assetId:l,mediaCacheId:u})),Un(e,d,{retries:0},c,{isDuplicateUpload:!0}),wt(c)&&!e.uploadOptions.isMediaLibraryUpload&&!e.uploadOptions.skipAddTimelineLayer&&On(c)}async function l3(e,t,o){const{dispatch:r}=I();let s,a=e,n,i;const l=Ra(t,o),{uploadOptions:{dragUpload:d,isMediaLibraryUpload:c,uploadLocation:u,doDuplicateHandling:h,convertToAudio:A,isThumbnail:g,analyticsUploadSource:y,usedProFeatures:b},validationOptions:_,uploadId:S}=l,T=e.name.split(".").pop()||"";["jfif","jif","jfi"].includes(T)&&e.type==="image/jpeg"&&(e=new File([e],e.name.replace(/\.jfif|\.jif|\.jfi/g,".jpeg"),{type:e.type,lastModified:e.lastModified}),a=e),g||(ce("Upload Started",{"File Type":e.type,"Size (MB)":e.size/1e6,"Upload Location":y,"Upload Id":S}),!c&&!l.uploadOptions.skipAddTimelineLayer&<(e.type?.split("/")?.[0]??"unknown",y));const w=fo(),x=uc({file:e,options:_,planTier:w});if(x){if(x.severity==="error")return x.action?x.action():r(ke({description:x.message,type:"error"})),ce("Upload Rejected",{Origin:u,Message:x.message,FileType:e.type,"File Size (MB)":e.size/1e6}),t.eventHandlers?.handleError?.(),at(l),{};r(ke({description:x.message,type:"warning"}))}const k=Mn(e,_);if(_.fontUpload||k){const M={...Wt(),uploadId:S,type:de.Image,source:"upload",name:e.name};if(k){M.isMediaLibraryUpload=!0;try{const j=await Rs(e);n=j.hashStr,i=j.duplicate}catch(j){console.error("PDF de-dupe detection failed; uploading normally",j)}if(i?.cml)try{await d3({bundle:l,layer:M,file:e,duplicate:i})}catch(j){Se({description:"Upload Failed",error:j}),at(l)}else l.hashStr=n,xo(l,M,e)}i||La(l,e,M)}else try{if(s=await ka(e,{uploadId:S,uploadLocation:d?"dragUpload":u,isMediaLibraryUpload:c,usedProFeatures:b},{addAtSeeker:t.uploadOptions.addAtSeeker}),l.timelineRowForAllLayers&&(s.timelineRow=l.timelineRowForAllLayers),A&&!(s.type===de.Image||s.hasAudio))return s=void 0,r(ke({description:"Please upload a file with Audio",type:"warning"})),at(l),{file:a,layer:s,bundle:l,hashStr:n,duplicate:i};if(a=await Da(l,e,s),h){const M=await Rs(e);n=M.hashStr,i=M.duplicate}if(await e1(a,s)){s.requireConversion=!0;const M=yo(s),{state:j,dispatch:O}=I(),{localAssetInfo:B}=j.assets,$=M?B[M]?.local_url:void 0;M&&$&&(URL.revokeObjectURL($),O(vo({[M]:{local_url:void 0}})))}}catch(M){const{debugMsg:j}=qi(M);Se({description:"Upload Failed",error:M}),ce("Upload Fails",{FailStage:"Process File and Create Layer",Origin:u,Message:j,FileType:e.type,"File Size (MB)":e.size/1e6,"Upload Id":S}),at(l)}return{file:a,layer:s,bundle:l,hashStr:n,duplicate:i,fileOnly:_.fontUpload||k}}function Ra(e,t){const o=(0,Co.default)();let{analyticsUploadSource:r}=e.uploadOptions;const s=t!==void 0?e.uploadOptions.analyticsUploadSources?.[t]:null;s&&(r=s);const a=e.uploadOptions.addLayersToSameTimelineRow?sr():null;return{eventHandlers:{...e.eventHandlers},initialLocalProjectId:I().state.studioLocal.localProjectId,uploadOptions:{...e.uploadOptions,analyticsUploadSource:r},validationOptions:{...e.validationOptions},uploadId:o,timelineRowForAllLayers:a}}async function c3(e){const{dispatch:t,state:o}=I(),{mediaCache:{assetIdToMediaCacheId:r},studio:{_id:s},studioLocal:{localProjectId:a},uploadStatuses:n,assets:i}=o,l=vt(o,St.ENABLE_TEAM_ASSETS),d=[];await Promise.all(e.map(async({file:u,layer:h,bundle:A,hashStr:g,duplicate:y})=>{if(!h)return;const{omitFromIDB:b,fontUpload:_,originalAssetId:S}=A.uploadOptions,T=_||Mn(u,A.validationOptions);let w;!b&&h.uploadId&&!T&&(w=(0,Co.default)(),t(ma({mediaCacheId:w,uploadId:h.uploadId}
3)),t(vo({[w]:{local_url:URL.createObjectURL(u)}})));const x=y?.asset!=null&&y.asset.blob_name==null;if(y&&!x&&!rc.forceNewAssets){const k=y.cml?.asset_id||y.asset?._id||"";if(y.cml){const O=Yi(y.cml).catch(B=>{console.error("Failed to update CML File modified date",B)});d.push(O),t(ya(y.cml,s)),h.cmlFileId=y.cml._id}if(h.videoAssetId=Object.values(I().state.videoAssets.byId).find(O=>O.asset_id===k&&(!s||O.video_id===s))?._id,l&&(h.teamAssetId=Object.values(I().state.teamAssets.byId).find(O=>O?.asset_id===k)?._id,!h.videoAssetId&&s))try{const O=await wo(s,k);O&&(h.videoAssetId=O._id,t(Gt(O)),t(bo([O])))}catch(O){console.error("Failed to create video asset for duplicate upload",O)}const M=r[k];if(!(M&&await Ir(M))&&w){const O=ls({mediaCacheId:w,type:h.type,file:u,extraErrorOptions:{extra:{layer:h}}}).catch(B=>{console.error(B)});d.push(O),t(fr({mediaCacheId:w,assetId:k}))}t(yt.updateUploadStatus({id:A.uploadId,updates:{stage:Ce.done}})),h.asset_id=k,Pn(h,n,A,{retries:0},{projectIdChanged:a!==A.initialLocalProjectId,isDuplicateUpload:!0}),xo(A,h,u);const j=i.byId[k];j&&A.eventHandlers.handleDedupedAsset?.(h,j)}else{A.hashStr=g;try{if(h.requireConversion)h.conversion_type=Sc(void 0,u.type),f3(A,u,h);else{if(w&&!S)try{const k=await ls({mediaCacheId:w,type:h.type,file:u,extraErrorOptions:{extra:{layer:h}}});h.isMediaLibraryUpload&&t(vl(w)),k||ce("Upload Failed IDB Add",{fileType:u.type,fileSize:u.size}),h.isMediaLibraryUpload||To({mediaCacheId:w,source:A.uploadOptions.analyticsUploadSource,uploadId:h.uploadId??void 0})}catch(k){console.error(k)}Ma(A,u,h)}}catch(k){Se({description:"Upload failed",error:k}),at(A)}}}));const c=e[0];c&&e.length>1&&c.bundle.uploadOptions.multiRowUploadForRecording&&Pe.execInUndoBatch(()=>{const u=Tr();Ar(e.filter(h=>h.layer).map(h=>h.layer?.id||""),u,!0),p1(u,!0,!0)}),t(Li(!1)),(await Promise.allSettled(d)).forEach(u=>{u.status==="rejected"&&console.error(u.reason)})}function ze(e,t){if(e.uploadOptions.skipUploadStatusUpdates)return;const{dispatch:o}=I();o(yt.updateUploadStatus({id:e.uploadId,updates:t}))}async function G8(e,t){const{dispatch:o}=I(),r=(0,Co.default)(),{mediaLibraryID:s}=e;if(e.type==="video"&&!e.file_v2)throw Error("Do not have the original file. Cannot reupload.");const a=e.type==="audio"?e.file:e.file_v2.file,n=Ra(t);n.uploadOptions.isThumbnail||ce("Upload Started",{"File Type":a.type,"Size (MB)":a.size/1e6,"Upload Location":t.uploadOptions.analyticsUploadSource,"Is Reupload":!0}),o(ma({mediaCacheId:s,uploadId:r}));try{const i=await ka(a,{uploadId:r});Ma(n,await Da(n,a,i),i)}catch(i){Se({description:"Upload failed",error:i}),at(n)}}async function K8(e,t,o){let r=t;const s={};t.uploadId||(s.uploadId=(0,Co.default)());const{dispatch:a,state:n}=I(),{localAssetInfo:i}=n.assets,l=go(t);if(!(l&&i[l]?.local_url)){const c=URL.createObjectURL(e);a(vo({[l]:{local_url:c}}))}(0,i3.isEmpty)(s)||(bt({[t.id]:s},"studioReuploadLayer"),r={...t,...s});const d={...Ra(o),uploadId:r.uploadId};d.uploadOptions.isThumbnail||ce("Upload Started",{"File Type":e.type,"Size (MB)":e.size/1e6,"Upload Location":o.uploadOptions.analyticsUploadSource,"Is Reupload":!0}),Ma(d,await Da(d,e,t),r)}function ar(e){const{state:{uploadStatuses:t={}},dispatch:o}=I(),r=t[e];if(!r)return;const{uploadManager:s}=r;s?.cancel(),o(yt.deleteUploadStatus({id:e}))}var La=(e,t,o)=>{const{dispatch:r,state:s}=I(),a=Be(s),{uploadId:n,uploadOptions:{fontUpload:i,uploadSourceComponent:l,createTeamAsset:d,suppressFileSizeWarnings:c}}=e,u=en(Xo.UNLIMITED_EXPORT_DURATION_LIMIT);u&&"duration"in o&&o.duration&&o.duration>7200&&!c&&r(ke({description:"Your file is longer than 2 hours. You must trim your file to export.",type:"warning"})),!u&&"duration"in o&&o.duration!==1/0&&o.duration&&o.duration>240&&!c&&ke({description:"Your file is longer than 4 minutes. Trim or upgrade to export videos longer than 4 minutes.",type:"warning"});const h={};let A;const g=new AbortController;window.addEventListener("beforeunload",b=>yl?null:b.returnValue=!0,{signal:g.signal}),e.uploadOptions.extractAudio&&(A=r3(t).then(b=>{if(b==null){console.warn("Cannot perform audio extraction");return}return new Promise(_=>
3{new hs({analyticsUploadSource:"Extract audio",file:b,folder:"audio-segments",layer:o,onFinish:[h3(e,h,t),async()=>_()],onCancel:()=>at(e),onRetry:Ls(e),origin:o.uploadLocation,uploadSourceComponent:l}).upload()})}));const y=()=>{const b=new hs({analyticsUploadSource:e.uploadOptions.analyticsUploadSource,file:t,layer:o,onError:Et(e),onProgress:u3(e),onFinish:[p3(e,h),m3(e,h),async()=>{g.abort()}],onCancel:()=>at(e),onRetry:Ls(e),origin:o.uploadLocation,uploadSourceComponent:l,useNameDirectly:e.uploadOptions.useNameDirectly});b.upload(),e.uploadOptions.skipUploadStatusUpdates||r(yt.addUploadStatus({id:n,fileName:t.name})),ze(e,{fontUpload:i,uploadManager:b,omitFromIDB:e.uploadOptions.omitFromIDB,teamId:d&&a||void 0})};A?A.then(y):y()},u3=e=>(t,o,r)=>{if(!r.uploadId)return;const s=Math.round(t*100);let a=`Uploading ... ${s.toString()}%`;s===100&&o.type==="image/gif"?a="Processing your GIF ...":s===100&&o.type==="video/3gpp"&&(a="Converting file to mp4 ..."),ze(e,{progressText:a,progress:s,stage:Ce.inProgress})},Ls=e=>(t,o)=>{t.uploadId&&ze(e,{retryInfo:o})},h3=(e,t,o)=>async(r,s,a,n)=>{const{uploadOptions:{fontUpload:i,isThumbnail:l,createTeamAsset:d,createWorkspaceAsset:c,usedProFeatures:u,originalAssetId:h,dimensions:A,preserveAssetId:g},hashStr:y}=e;ze(e,{stage:Ce.audioUploadFinish});const{state:b}=I(),{studio:{_id:_}}=b,S=Be(b),T=gi(b),w=Ao()?.settings?.defaultPrivacy===Pi.private,[x,k]=hn(s),M={bucket:x||"kapwing-useast1",size:o.size,mime:o.type,name:o.name,sha256Str:y,usedProFeature:u?.[0]};g&&(M.id=g),k&&(M.tmp_audio_blob_name=k);const j=l||e.uploadOptions.skipCMLCreation||!!h,O=!w&&l;if(!S)throw new Error("No selected team found");const B={fontUpload:i,skipSigning:O,skipCML:j,teamId:S};_&&(B.video_id=_),c&&(B.workspaceId=T||void 0),d&&(B.origin=yi.brandkit),h&&(B.originalAssetId=h),A&&(M.dimensions=A);const{asset:$,cmlFile:Z,teamAsset:Y,videoAsset:Q}=await Fi(M,B);ze(e,{assetId:$._id}),t.asset=$,Y&&(t.teamAsset=Y);const L={...n,asset_id:$._id};return e.eventHandlers.handleAudioUpload?.(L,$),_r($,Z,Y,Q,e.uploadId,e.uploadOptions.skipLinkCMLFileToProject),{asset:M,params:B}},p3=(e,t)=>async(o,r,s,a)=>{const{uploadId:n,uploadOptions:{fontUpload:i,isThumbnail:l,createTeamAsset:d,createWorkspaceAsset:c,usedProFeatures:u,originalAssetId:h,dimensions:A,preserveAssetId:g,skipLinkCMLFileToProject:y},hashStr:b}=e,_=t.asset,{state:S}=I(),{studio:{_id:T}}=S,w=Be(S),x=gi(S),k=Ao()?.settings?.defaultPrivacy===Pi.private,M=F=>{ze(e,{stage:F})};if(o.status!==200){Et(e)({error:new Error(o.statusText),file:s,layer:a,errorType:"onGCSUploadFinish"});return}M(Ce.onGCSUploadFinish);const[j,O]=hn(r),B={bucket:j||"kapwing-useast1",size:s.size,mime:s.type,name:s.name,sha256Str:b,usedProFeature:u?.[0]};
3_&&(B.id=_._id),g&&(B.id=g),O&&(B.blob_name=O),i&&(a.mime=`font/${B.name?.split(".").pop()??""}`);const $=l||e.uploadOptions.skipCMLCreation||!!h,Z=!k&&l;if(!w)throw new Error("No selected team found");const Y={fontUpload:i,skipSigning:Z,skipCML:$,teamId:w};T&&(Y.video_id=T),c&&(Y.workspaceId=x||void 0),d&&(Y.origin=yi.brandkit),h&&(Y.originalAssetId=h),A&&(B.dimensions=A),M(Ce.createAsset);const{asset:Q,cmlFile:L,teamAsset:f,videoAsset:U}=await Fi(B,Y);ze(e,{assetId:Q._id});const P={...Q};a.conversion_type&&(P.conversion_type=a.conversion_type),i||_r(P,L,f,U,n,y),t.asset=Q,L&&(t.cmlFile=L),f&&(t.teamAsset=f),U&&(t.videoAsset=U)},m3=(e,t)=>async(o,r,s,a,n)=>{const{uploadId:i,uploadOptions:{isThumbnail:l,fontUpload:d,originalAssetId:c}}=e,{asset:u,cmlFile:h,teamAsset:A,videoAsset:g}=t;if(!u)return;const{dispatch:y}=I();e.uploadOptions.addToStoreAfterUpload&&y(Te([u]));const b=T=>{ze(e,{stage:T})},_={...a,asset_id:u._id,source:"upload",uploadConfirmed:Date.now()};if(b(Ce.assetCreated),a.requireConversion){b(Ce.runConversion);const T=await Wh({asset_id:u._id,resource:u.blob_name||"",type:"blob",conversion_type:a.conversion_type,layer:_});_.conversion_id=T,_.videoConvertedState="begun",b(Ce.addPendingConversion),await Qc(T,a.id,a.name,i,h?._id,A?._id,g?._id)}if(u.name&&(_.name=u.name),g&&(_.videoAssetId=g._id),h&&(_.cmlFileId=h._id),A&&(_.teamAssetId=A._id),u.ffprobeData){_.ffprobeData=u.ffprobeData;const{duration:T}=u.ffprobeData,w=Number(T);typeof w=="number"&&!isNaN(w)&&(_.duration=w)}u.hasAudio&&!_.hasAudio&&(_.hasAudio=!0);const S=yo(a);if(S&&y(Ti(S)),!d&&!l&&(b(Ce.updateCompletedUploadInIDB),S&&_.asset_id&&t1({mediaCacheId:S,assetId:_.asset_id}),!a.requireConversion&&S&&await _c(S,{url:r,asset_id:_.asset_id}),S&&hr(a))){const T=await Ir(S);if(T&&"waveformData_v6"in T&&T.waveformData_v6){const{waveformData_v6:w}=T;Mu(u._id,w)}T?.type===de.Video&&!T.file_v2?.hasAudio&&u.hasAudio&&await xc(S,!0)}c&&b(Ce.updateCompletedUploadInIDB),wt(u)&&!e.uploadOptions.isMediaLibraryUpload&&!e.uploadOptions.skipAddTimelineLayer&&On(u),b(Ce.handleFinish),Un(e,_,n,u),b(Ce.done)},at=e=>{const{uploadId:t,eventHandlers:{handleCancel:o}}=e,{dispatch:r,state:s}=I(),a=s.mediaCache.uploadIdToMediaCacheId[t];a&&r(Ti(a)),o&&o(t)},Et=e=>({file:t,layer:o,errorType:r,captureException:s,error:a})=>{Od({category:"Upload Flow Error",message:`ErrorType: ${r} layer: ${JSON.stringify(o)} file: ${JSON.stringify(t)}`}),s&&la(a);const{eventHandlers:{handleError:n},initialLocalProjectId:i}=e;I().state.studioLocal.localProjectId===i&&(ze(e,{stage:Ce.errored}),n?.(),Se({description:"An error occurred while uploading. Please try again later.",error:a}),at(e))},Da=async(e,t,o)=>{const{dispatch:r,state:s}=I();e.uploadOptions.skipUploadStatusUpdates||r(yt.addUploadStatus({id:e.uploadId,fileName:t.name}));const n=await $u(t,i=>ze(e,{progressText:i}),Et(e));if(t!==n){const i=go(o),l=s.assets.localAssetInfo[i]?.local_url;l&&URL.revokeObjectURL(l);const d=URL.createObjectURL(n);r(vo({[i]:{local_url:d}}))}return(n.type.includes("video")||n.type.includes("audio"))&&(o.duration=await Ac(n)),n},Ma=(e,t,o)=>{try{xo(e,o,t),La(e,t,o)}catch(r){console.error("error during upload ",r),Et(e)({error:r,file:t,layer:o,errorType:"checkFileAndUpload"})}},Un=(e,t,o,r,{isDuplicateUpload:s=!1}={})=>{const{state:{studioLocal:{localProjectId:a},uploadStatuses:n}}=I();try{const{eventHandlers:{handleFinish:i},initialLocalProjectId:l,uploadOptions:{skipVerifyProjectOpenBeforeHandleFinish:d=!1}}=e,c=a!==l;Pn(t,n,e,o,{projectIdChanged:c,isDuplicateUpload:s}),i&&!(!d&&c)&&i(t,r)}catch(i){console.error("error during upload ",i),Et(e)({error:i,file:void 0,layer:t,errorType:"handleFinish"})}},xo=(e,t,o)=>{ze(e,{preemptivelyAvailableAt:performance.now()});try{const{eventHandlers:{handlePreemptiveFinish:r},initialLocalProjectId:s,uploadOptions:{multiRowUploadForRecording:a,recordScreenAndCameraUpload:n,addLayersToSameTimelineRow:i}}=e,l=I().state.studioLocal.localProjectId!==s;r&&!l&&r(t,{multiRowUploadForRecording:a,selectLayerInCreator:!0,recordScreenAndCameraUpload:n,knownTimelineRow:i})}catch(r){console.error("error during upload ",r),Et(e)({error:r,file:o,layer:t,errorType:"handleFinish"})}},f3=(e,t,o)=>{try{xo(e,o,t),La(e,t,o)}catch(r){console.error("error during upload ",r),Et(e)({error:r,file:t,layer:o,errorType:"checkFileAndUpload"})}};function Pn(e,t,o,r,s){if(!o.uploadOptions.isThumbnail)try{const a=yo(e),n={"Layer Type":e.type,mime:e.mime,"Size (MB)":(e.size??0)
3/1e6,"Layer Duration":"duration"in e&&e.duration||0,"Conversion Required":e.requireConversion||!1,"Project ID Changed During Upload":s.projectIdChanged,mediaCacheId:a,"Upload Retries":r.retries,"Upload Location":o.uploadOptions.analyticsUploadSource,"Duplicate Upload":s.isDuplicateUpload,"Asset ID":e.asset_id},i=t?.[o.uploadId];if(i){const l=performance.now();n["Overall Upload Duration"]=(l-i.beganAt)/1e3,i.preemptivelyAvailableAt&&(n["Time to on Canvas"]=(i.preemptivelyAvailableAt-i.beganAt)/1e3,n["Upload Duration after on Canvas"]=(l-i.preemptivelyAvailableAt)/1e3)}"ffprobeData"in e&&e.ffprobeData&&(e.ffprobeData.codec_name&&(n.Codec=e.ffprobeData.codec_name),e.ffprobeData.codec_long_name&&(n["Codec (Long)"]=e.ffprobeData.codec_long_name)),n["Upload Id"]=e.uploadId,ce("Upload Finished",n)}catch(a){console.error(a),la(a)}}var g3=e=>{const{dispatch:t}=I(),o=Tr(),r=e.filter(({layer:s})=>s).map(({layer:s})=>s.id);t(Hu("")),Ar(r,o,!0)},A3=e=>{const t=e[0];if(!t)return;const{state:o,dispatch:r}=I(),s=sr(),a=Bu(o),n=3;let i=a===void 0?0:uo();const l=e.filter(({layer:y})=>y).some(({layer:y})=>y.duration),d=e.every(({layer:y,bundle:b})=>!y||b.uploadOptions.isThumbnail?!1:y.type==="image"),c=o.studio.origin==="make/slideshow"&&d;if(!o.studio.duration&&d){const y=e.filter(({layer:b,bundle:_})=>b&&_.uploadOptions.analyticsUploadSource!=="Media sidebar button - This Project").map(({layer:b,file:_})=>`${b.id} ${_.lastModified}`);if(r(jl([...o.studioLocal.staticUploadIds,...y])),e.filter(({layer:b})=>b).length>1){const b=Tr();Ar(e.filter(({layer:_})=>_).map(({layer:_})=>_.id),b,!1)}}if(!o.studio.duration&&!l&&!c)return;const u=[s];e.forEach(({layer:y,bundle:b})=>{if(y&&!b.uploadOptions.isThumbnail&&!b.uploadOptions.isMediaLibraryUpload&&!b.uploadOptions.createTeamAsset){if(y.requireConversion){const _=sr(u);y.timelineRow=_,u.push(_);return}e.length>1&&(y.timelineRow=s),["video","audio"].find(_=>_===y.type)?(y.videoDelay=i,i+=y.duration||0):(y.startTime=i,y.endTime=i+n,i=y.endTime)}}),!o.studio.duration&&l&&cu(ie(o),i,!0);const h=o.studio.selectedTimelineRows,A=e.length===1,g=l1({...t.layer},uo(),Math.min(...h,0));A&&g&&h.length>0&&(t.layer.timelineRow=Math.min(...h)),c&&g3(e)},sr=(e=[])=>{const{state:t}=I(),o=ie(t);if(!t.studio.duration&&o.length)return o.length;const r=[...o.map(s=>s.timelineRow||0),...e];for(let s=0;s<r.length+1;s+=1)if(!r.includes(s))return s;return 0},y3=e=>new File([e],"tempFile",{type:e.type}),Ds=e=>{const t=Buffer.alloc(e.byteLength),o=new Uint8Array(e);for(let r=0;r<t.length;r+=1)t[r]=o[r];return t},Ms=3,Ur=new Set,b3=async e=>{const{state:t,dispatch:o}=I(),r=t.studio._id;if(!vt(t,St.ENABLE_TEAM_ASSETS)||!r)return;const s=new Set(t.studio.videoAssetIds??[]);if(Object.values(t.videoAssets.byId).some(n=>n.asset_id===e&&s.has(n._id)))return;const a=await wo(r,e);a&&(o(Gt(a)),o(bo([a])))},_3=4e3,I3=120,T3=async(e,t)=>{for(let o=0;o<I3;o+=1){if(t?.())return null;try{const r=await ne.conversion.get.query({id:e});if(r?.status===$o.SUCCESS||r?.status===$o.FAILED||r?.status===$o.DISPATCH_FAILED)return r}catch(r){console.warn("PDF conversion poll failed; retrying",r)}if(t?.())return null;await Kc(_3)}return null},Us="Adding PDF pagesâ¦",v3=async e=>{if(!e.conversion_id)return e;const{dispatch:t,state:o}=I(),r=o.studioLocal.localProjectId;t(ke({type:"info",description:Us,duration:Cl.INFINITE}));try{if((await T3(e.conversion_id,()=>I().state.studioLocal.localProjectId!==r))?.status!==$o.SUCCESS||I().state.studioLocal.localProjectId!==r)return null;const s=await Eo(e._id,"pdfPagesReady");return t(Te([s])),s}finally{const s=Object.entries(I().state.toasts).find(([,a])=>a.open&&a.description===Us);s&&t(mc(s[0]))}},S3=e=>{const{state:t}=I(),o=Tn(t.assets.byId,e);return o.size===0?!1:ie(t).some(r=>r.asset_id&&o.has(r.asset_id))},On=async e=>{try{if(!e.conversion_id&&!e.derived?.pages?.length||S3(e._id))return;await ko({pdfAsset:e})}catch(t){console.error("Failed to auto-add PDF pages to the canvas",t)}};const ko=async({pdfAsset:e,droppedTrackInfo:t})=>{let o=e;if(o.pdf_conversion_failed){I().dispatch(ke({description:"This PDF couldn't be converted, so its pages can't be added.",type:"warning"}));return}if(Ur.has(o._id))return;Ur.add(o._id);const{dispatch:r}=I();Ze(o._id,!0);try{const s=await v3(o);if(!s)return;o=s;const{assets:a}=await ne.asset.createPdfPageImageAssets.mutate({pdfAssetId:o._id});if(a.length===0){r(ke({description:"This PDF's pages aren't ready yet. Try again in a moment.",type:"warning"}));return}r(Te(a));const n=t?.dndGhostTrackDropPosition,i=n?.timelineRow??sr();let l=n?.timelineTime??(uo()||0);const d=[];for(const c of a){if(!c)continue;const u=await Ht(c,{addedFromMediaLibrary:!0,asset_id:c._id,name:c.name||c.blob_name,mime:c.content_type,...c.dimensions,startTime:l,endTime:l+Ms,timelineRow:i});u&&(d.push(u),l+=Ms)}Pe.execInUndoBatch(()=>{(0,n3.batch)(()=>{for(const c of d)So({newLayer:c,options:{undoable:!0,knownTimelineRow:!0}})})});try{await b3(o._id)}catch(c){console.error("Failed to add PDF to This Project media",c)}}catch(s){Se({description:"Failed to add the PDF's pages",error:s})}finally{Ze(o._id,!1),Ur.delete(o._id)}},W8=async({cmlFile:e,asset:t,properties:o={},propertiesAfterTypeDetermined:r=()=>({}),replaceInfo:s,droppedTrackInfo:a})=>{if(wt(t))return await ko({pdfAsset:t,droppedTrackInfo:a}),null;const{state:n,dispatch:i}=I(),{isAdding:l}=n.studioLocal;let d=t;if(l[d._id]||Ze(d._id,!0),(!t.url||Tt(t.url)||t.preview_asset_id&&!t.preview)&&(d=await Eo(t._id,"addFromMediaLib"),i(Te([d]))),!d.url)return Ze(d._id,!1),console.error(`Could not create layer for cml file ${e._id}: asset has no url`),null;const c=vt(n,St.ENABLE_TEAM_ASSETS),u=n.studio._id;let h=Object.values(n.videoAssets.byId).find(g=>g.asset_id===d._id)?._id;if(c&&!h&&u){const g=await wo(u,d._id);g&&(h=g._id,i(Gt(g)),i(bo([g])))}const{dimensions:A}=d;try{const g={addedFromMediaLibrary:!0,asset_id:d._id,cmlFileId:e._id,videoAssetId:h,name:d.name||d.blob_name,mime:d.content_type,usedProFeatures:t.usedProFeature?[t.usedProFeature]:[],...A,...o},y=await Ht(d,g);if(!y)return null;const b=r(y);if(!b)return null;const _={...y,...b};return!(_.startTime||_.endTime)&&!s&&Vt(_),So({newLayer:_,options:{undoable:!0,knownTimelineRow:g.timelineRow!==void 0,droppedTrackInfo:a},replaceInfo:s}),_.asset_id&&hr(_)&&To({assetId:_.asset_id,source:"Media Library"}),_}catch(g){return Se({description:"Failed to add layer",error:g}),Ze(d._id,!1),null}},H8=async({teamAsset:e,asset:t,properties:o={},propertiesAfterTypeDetermined:r=()=>({}),replaceInfo:s,droppedTrackInfo:a})=>{if(wt(t))return await ko({pdfAsset:t,droppedTrackInfo:a}),null;const{state:n,dispatch:i}=I(),l=n.studio._id;let d=Object.values(n.videoAssets.byId).find(c=>c.asset_id===t._id);
3return!d&&l&&(d=await wo(l,t._id),d&&(i(Gt(d)),i(bo([d])))),d?w3({videoAsset:d,asset:t,properties:{...o,teamAssetId:o.teamAssetId??e._id},propertiesAfterTypeDetermined:r,replaceInfo:s,droppedTrackInfo:a}):(console.error(`Could not create video asset for team asset ${e._id}`),null)},q8=async({asset:e,cmlFile:t,entryPoint:o,mediaSource:r,properties:s={}})=>{if(wt(e))return await ko({pdfAsset:e}),null;const{dispatch:a,state:n}=I(),{isAdding:i}=n.studioLocal;let l=e;if(i[l._id]||Ze(l._id,!0),(!e.url||Tt(e.url)||e.preview==null)&&(l=await Eo(e._id,"addFromMediaLib"),a(Te([l]))),!l.url)return Ze(l._id,!1),console.error(`Could not create layer for cml file ${t._id}: asset has no url`),null;const{state:{studio:{selectedItem:d}}}=I(),c=He(d?.id||"");if(!c)return null;const u=Object.values(n.videoAssets.byId).find(h=>h.asset_id===l._id)?._id;try{const h=await Ht(l,{addedFromMediaLibrary:!0,asset_id:e._id,cmlFileId:t._id,videoAssetId:u,usedProFeatures:e.usedProFeature?[e.usedProFeature]:[],...s});return ba({newLayer:h,replacedLayer:c,addLayerOptions:{knownTimelineRow:!0,undoable:!0},entryPoint:o,mediaSource:r}),h.asset_id&&hr(h)&&To({assetId:h.asset_id,source:"Media Library"}),h}catch(h){return Se({description:"Failed to replace layer",error:h}),null}},w3=async({videoAsset:e,asset:t,properties:o={},propertiesAfterTypeDetermined:r=()=>({}),replaceInfo:s,droppedTrackInfo:a})=>{if(wt(t))return await ko({pdfAsset:t,droppedTrackInfo:a}),null;const{state:n,dispatch:i}=I(),{isAdding:l}=n.studioLocal;let d=t;if(l[d._id]||Ze(d._id,!0),(!t.url||Tt(t.url)||t.preview_asset_id&&!t.preview)&&(d=await Eo(t._id,"addFromMediaLib"),i(Te([d]))),!d.url)return Ze(d._id,!1),console.error(`Could not create layer for video asset ${e._id}: asset has no url`),null;const{dimensions:c}=d;try{const u={addedFromMediaLibrary:!0,asset_id:d._id,videoAssetId:e._id,name:d.name||d.blob_name,mime:d.content_type,usedProFeatures:t.usedProFeature?[t.usedProFeature]:[],...c,...o},h=await Ht(d,u);if(!h)return null;const A=r(h);if(!A)return null;const g={...h,...A};return!(g.startTime||g.endTime)&&!s&&Vt(g),So({newLayer:g,options:{undoable:!0,knownTimelineRow:u.timelineRow!==void 0,droppedTrackInfo:a},replaceInfo:s}),g.asset_id&&hr(g)&&To({assetId:g.asset_id,source:"Media Library"}),g}catch(u){return Se({description:"Failed to add layer",error:u}),Ze(d._id,!1),null}},Ht=async(e,t={})=>{const{state:o,dispatch:r}=I(),{mediaCache:{assetIdToMediaCacheId:s}}=o,a=s[e._id];if(a){const l=await Zh(a,e,t);if(l)return l}const n=a||(0,Co.default)(),i=await kn(e,n,t);return r(fr({assetId:e._id,mediaCacheId:n})),i};var E3="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAQEBAQEBAQEBAQGBgUGBggHBwcHCAwJCQkJCQwTDA4MDA4MExEUEA8QFBEeFxUVFx4iHRsdIiolJSo0MjRERFwBBAQEBAQEBAQEBAYGBQYGCAcHBwcIDAkJCQkJDBMMDgwMDgwTERQQDxAUER4XFRUXHiIdGx0iKiUlKjQyNEREXP/CABEIAHgAeAMBIgACEQEDEQH/xAAdAAEAAgMBAQEBAAAAAAAAAAAABwgFBgkEAgMB/9oACAEBAAAAAKhgAAAAAsfcKp1bfCAHTiic8WQjGp8VfwW1sDAuq5rCIAky2uy8xx1+ppdvy1BsJOHHvSbAzDR0dt/tzMv/AEB6Tch9J6W0I0kdt/tznmys/ULlH4L4cwg7b/b8oEl/YeXF0qn1qAAAbz4Mj4chtuegSQdN/bXRarf463PWtuhO0Fa5CwVWhfCrGUxuZZyI54iy6fOMAAAAB//EABQBAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIQAAAAAAAAAAAAAAD/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oACAEDEAAAAAAAAAAAAAAA/8QALhAAAgIDAAEBBgUEAwAAAAAABQYDBAECBwgAEBITFBggFRY1N1QRIjBQQEFT/9oACAEBAAEMAP8ASeMaRo1P+pS9VxKNcfHbmrhmazoMyKvOXio+gfiWVyaA9UJCyYa5IPLjrVG5/j8dFeBF5ThhJR4isl+otm7wecQJ24PnTPLpgofAqOwaInCNf+L9jpaDL8g27I4+Iy4RxJcSDMoyVx4r0VI+JKVATS0s4zrnONsZxn7EPxaZbZkbadc1Y1/6UuT/APiW9Onig1xn7n5IzUlC/Sp1n+MK9Z8eO95qfIZLaZp/Sp1n+MK9fSp1n+MK9FxdsCYKBrvu4uJ3cujpedI6J2S3TRfK9eOT0xjOHnH3e6c+5jXTTzYWXoILv2NzNdTeW3GcdBDLb+r7oH/S+C9c3aLjgirjMQhhht9I6gscxE6ED02+9i95jNG97bcYpCoqPLPIRW6Ra0DT19xJz10v9x+gezxrTMtfSaF6eH3qHl64e5leRasn2hP0YR7en7kOkd+srl2ztFEJ5RzcQKiD1EsRJV7olwcn6IOIKeflKoArgqCEE/7s56X+4/QPZ4wqEStzrdjv6aw2ejNm7u7sbPnOfhfYE/RhHt8g1E1z7p2j4K03xUD+XSfKG+MZDXoCpC60eRPTIcwU9o4aNSIdRp0Yv6YjOKJl47I7roGOPe/Q5S44cQioaA3KUvkEx1kDkkoAZnSKf7Qn6MI9pkUKOUJhZkfBdp2/FzlEtrSzpQuwaKSIpotHNFZDw04vX54k513hsbI6Gt30n+R/L2/5eIjewEI+T7vC0PcYcdb0nG/8Ra5o9uFTe+trNy7VnSWmoy1VC6FsVzdLmjmR3YIqIfaeYSjsxsKWY6I3ORKzzB9cam19cWbdynzJSvieyKK43A9oZHzhvSJmtlvBkyfYZGOvy39RelKfN8pxrpoYZKXIqF2KnGuGJF6dp0p7ZELaoebrVqkv0Nrc/wBnf2AstbpaSvXpxwQdaKGQPjmdb8Y2ZFidqi8ji2irppvL5M6T0FhdppUI/RD8hCRkFBz4Yp3LddGTj+WARxBzaLUeSL+TfFjr5+ETcLQEfk6cfcyV3FEdo08sfXeDrAzUsVvSStS5jfnPaQq7W97XxcGXpTjmW1qyZo/Z1XvbOgFwIdZgCWqpDrDqXcQ7uXI6XSI/tLYJw3yi6YqreWOqsayuHFH5YeVBIPdug87H4EB7te0M6F3Fx6UOpDD1YZDEK8mOpigeAul+lYzlvZ8sm7f+N2vx6r5Z9SrwQwyQA7O4/rLqHcDDsHI60iJbozgogDx3pjEvZm/0H//EAD4QAAIBAwIDAwkCDQUAAAAAAAECAwAEEQUSEyIxIUFRBhAUICNhcXSyFlAHFSQwMjM0NUBCU2K0cnOS0tP/2gAIAQEADT8A+5NEhN1JvTKGduWJKc/tOnkR5PUkp2qaHdFiC5A6nkc4NR4L291C8Mq7hkZRwCMj85q6tqs7sNrC2A9gpPht5x/qq+vGlHAcorxKcRrJGSVYAdxoYDXdniG4wB1KHkcmiDiy1OIJPGxTLGLfggjpvSm5ltbsme2+CuOdRS9Ly09vDgnaMlemfA0Dgg+q8JmkFrc5nk3JyKK+dpsNALu62zJ7jXztcIQ8A6u/C4YGNm
3yvna+drTrye0m2NlRLA5Rtp7xkUOttfZnSp5I4UktgZ4XkkbaKtYPYy2n5O0kxOEQ7PFj6thpVtLGkwJjYnYvNtINf7c//AKVqFsZZI4QRGpDlezcSan3C0soBmadh9KjvY1kYjuHmlm/5oUFOCY7WZw8c+P6UmB5vtJqv+U/m0MfjCYlSV4y9kC+47ucUQdSvPoiHq+hQfQPOdbi0SEg7hBbpIIyyBj8WpY9jtcWkU803vkkkBZjVwqahZIrluBLG3MB/ZV1ZxTEnxdQa+0mq/wCU/m1pzeSSuApW0jGIxu70xz1eXbejAjaRbR8kII8dgGfV9Cg+gee/vo9TtbrG5I71GEjI1JGM20ADxyOB3PTskYRO1LOyU9rMat4UiXAx2IMVP5Qa28ayvsBEM8jmr28jhLuhCbCcsVcZXO0VqcSaPaouBiAriY48NnL63oUH0Dzy44kFwgkRseINdWgS7kKNTYMjjmlkI6b3Pa3mtfKPW0aAvs3pNNJGcNXdHqYCRB/FJ/0K0SAQI0T743nl55W/hUYqZkACEjuBYjNXEscMVrKNrO0vYuD0INaIWF/EjoZItoyTtzkitMB9LupGWOOMgZIy3U0CV46gLGSPAsRmjfbZ7S7jBDKY2PwIqS/ne24GwLwS2RgUZuALbhni8XONm3ruz3VEhklfCtsUd5Ck1DerYvcZGBOybwmPhVvbPcyqpA2xJ1bt9W00K0uBbW7lA8zZ53qXysiS3nn7LufTiWKyOD2lTUuqzpeJLngmzz7XfUtzK076YQUfUd5yJTHQ0Czl02SAlIppeu5mHV9m01ZeU91pj38362SER4QSOfe1HWZDYRRGTdKJnxGIk/nD19gI7wQRkfvksQ+3vLiOtRvza6nbXbNiQHIKOjdMVon4QHvHtIeeSOzSLZv2jt2CoPJ26hefB2CWTGEz6p0WznMlxE8ziQjBGY5FrS7lJ7OKVMW0Wx94QRoV5a8o3c3l/HA/pKB+qQszkKtarkz2epxPMiserRlHQqxODnuIyKUu0VpfxGWOEuckxlSjCrWfjxPZQyxPv+LyPSRGOK+ubffdxDoMHIUkeLA005nN9v8Aa7/+uOzb0x2Ui4M01rJvf3tslUVqty097DEmbWXe+8oY3LdlT6bLa6XoWkHJmuH6yu+ZD9w//8QAFBEBAAAAAAAAAAAAAAAAAAAAYP/aAAgBAgEBPwAB/8QAFBEBAAAAAAAAAAAAAAAAAAAAYP/aAAgBAwEBPwAB/9k=",C3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAMAAAD6TlWYAAAB8lBMVEUFoIH////9/v7x+fjl9fLY8OvN7OW65NyX18pyybhOu6YqrpMHoYLz+vm55Nt8zb0/tp4LooT2+/qt4NVXv6oNo4Wl3dJGuKLQ7edfwq4JoYPj9PF0yrnd8u5WvqrC5+A1spn8/f2D0MAIoYLL6+QrrpT1+/poxbKT1si45NsSpYfV7+ogqo7b8e0fqo7a8eweqY3Z8OwdqY2p3tR+zr4TpYgwsJZTvah5zLuh29De8u7+/v5PvKYjq5BnxbK95t3o9vMYp4rq9/QOo4Xn9vNdwa2S1cju+PaV1skXp4rA59/6/fyZ2Muw4ddsx7X7/f08tZ2u4NaAzr8kq5Cr39WQ1MfO7OYQpIYhqo/p9vSy4di/5t74/PsRpIc2spnE6OEmrJH3/PvK6uQ4s5sKooMxsJdRvae149mb2cxvyLaO1MZ4y7uBz7+J0sOI0cOG0cJ2y7rJ6uPv+fdHuaIprZNawKv5/Pw7tJyE0MFIuaMPpIbt+PbD6OA6tJzc8e11yrlMu6UsrpTw+fdbwKwVpokWpokur5V3y7rS7uiz4thEuKF9zb17zbzs9/Wg28/y+vhmxLGb2c2H0cKK0sSW18qi29Bhw69Bt59gwq5uyLbr9/VDt6DP7edJuqPf8++249pLuqR/zr4nrZKe2s5pxrMzsZgQPDzOAAADa0lEQVR4Ae3cg7ptNxuA0XzHtm3btm1bP2vbtu32Pvugnll756zUHeMS3ukZJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOD3QvwqunTt1r1Hz169+/TtJ2Cd/gMGDhosYJ0hQ4cNF7BO/xEjBaw0avQYAeuMHTdYwDrjJwhYaeIkAetMnjJVwDrTpgtYZ8ZMASvN6idgndlzBKwzd56AdeYvELDOwkUC1lm8RMA6PYYLWGepgJWW/TMCppvWb/m8FStXrV4TnVi7TsAOrd+wsUt0ZNNmATsxb9mW6MBQATu1tfe2aG27gJ2bs2NytLJzs4AFJo2PVnYJWGL3nmhhb18BS0zdFy3sF7DMgYORd0jAMsPWRtZhAQsdiazJRwUsdCyyjgtYaOuJyOl6UsBCp05HzmgBS22PnDMCFjsbGefOC1hqxdrI2C5gscORcUzAYhciY5uA5S5GxiUBi82se5ERcPnlaNonYLme0XRFwHKrommLgOWuRsZJAYtdmxxN1wUsNz+abghY7l/RtEHAcv+Opv8IWO6/0fQ/Acv9P5qOCFhuYDTdImC5W6PpNgHL7Yqm2wUsN8JrTJ07ommYgOXujKa7BCy2JDLuFrDYPdF0bz8Bq77k5iYBi62pmq0v4H2Rcb+AxXpFxgMClnrwoWi6d6uApcZFxsNJwEKDu0XGFAFL3R45jwhYaF7/yHg0CVjocORMEbDQY5HVV8Ayj3eJnCtJwCJPPBlZTwlY5On5kTW+n4AlnrkYeQdSAQGffTTyTg8XsECfrlFxAgr4XJdo4fl+AnZq/QvR0otJwE5sfWlG+xvHCDjn5S3R2itLBOzQi6++Fh1ZmVoRsF/f10dsi469kb4n4KQ3f/TW2++cmXtvdKr7VgF/8G7ctIfuThUEvPe9VEPA91MNAVelGgI+lioIuPaDVEHAgxtSBQE//ChVEPDj9amCgO9sTe0TcNuNVEHAEc+k9gn48SepfQJ+Ojq1T8CFH1xL7RJw7Wefp7YJeOKLL1ObBJxxtvf61B4BT3/19Tf9UtsEfCcVEFBAAQUUUEABBRRQQAEFFFBAAQUUUEABBRRQwAoCFhJQQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEABAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL4FwSegPJGNcQIAAAAASUVORK5CYII=",x3=ae(Ld()),k3=["boob","boobs","breast","breasts","butt","butts","seggs","kill","guns","foreplay","prostitution","mary jane","doobie","joint","spliff","shoot","drug","304","blood","nude","big bobs"],R3=new Set(["vodka","kicking","demon","Guido"]),Bn=x3.default.filter(e=>!R3.has(e));Bn.push(...k3);const Ps=new Set(Bn);var L3=ae(It());const D3=e=>e.video.small,$8=2,Y8=e=>{if(!e)return!1;if(Ps.has(e))return!0;const t=e.split(" ");for(const o of t)if(Ps.has(o))return!0;return!1},z8=(e,t,o)=>{if(t==="PEXELS"){const s=e;return{name:s.name||o,smallUrl:s.images.small,largeUrl:s.images.large,downloadUrl:s.images.download,type:"PEXELS",attribution:{providerUrl:"//pexels.com",altText:"Pexels Logo",logoSrc:C3,attributionUrl:s.attribution.url,attributionName:s.attribution.name},dimensions:s.dimensions,images:s.images,isPremiumAsset:!1,searchResult:e}}if(t==="PIXABAY"){const s=e;return{name:o,smallUrl:s.images.small,largeUrl:s.images.large,downloadUrl:s.images.download,type:"PIXABAY",attribution:{providerUrl:"//pixabay.com",altText:"Pixabay Logo",logoSrc:E3,attributionUrl:s.attribution.url,attributionName:s.attribution.name},dimensions:s.dimensions,images:s.images,isPremiumAsset:!1,searchResult:e}}
3const r=e;return{name:r.name||o,smallUrl:r.url,largeUrl:r.url,downloadUrl:r.url,type:"BING",dimensions:r.dimensions,isPremiumAsset:!0,searchResult:e}},Q8=async({query:e,pageNumber:t,royaltyFree:o,source:r})=>{const s=vt(I().state,St.BING_IMAGES_PUPPETEER);return ne.assetSearch.image.query({query:e,pageNumber:t,royaltyFree:o,source:r,bingPuppeteerEnabled:s})},J8=async({query:e,source:t,pageNumber:o})=>{const r={query:e,pageNumber:o,source:t};return ne.assetSearch.video.query({query:r.query,pageNumber:r.pageNumber,source:r.source})};function Fn(e){return"video"in e}function M3(e){return!Fn(e)}var Pr=class{index=0;constructor(e){this.items=e}pop(){if(this.index<this.items.length)return(0,L3.cloneDeep)(this.items[this.index++])}};function X8({pexels:e,pixabay:t,bing:o,isFreeUser:r}){const s=[],a=[],n=e.length+t.length+o.length,i=new Pr(e),l=new Pr(t),d=new Pr(o);if(r){const u=Math.min(2,e.length+t.length);for(;a.length<u;){const h=i.pop();if(h)a.push(h);else{const A=l.pop();A&&a.push(A)}}}function c(u){const h=u.pop(),A=u.pop();h&&s.push(h),A&&s.push(A)}for(;a.length+s.length<n;)c(i),c(l),c(d);return[...a,...s.map(u=>({...u,isPremiumAsset:!0}))]}const xe={QUERY:"SIDEBAR_SEARCH_QUERY",RESULTS:{VIDEO:"SIDEBAR_VIDEO_RESULTS_V2",IMAGE:"SIDEBAR_IMAGE_RESULTS",GIF:"SIDEBAR_GIF_RESULTS",EMOJI:"SIDEBAR_EMOJI_RESULTS",QUERY:{VIDEO:"SIDEBAR_VIDEO_QUERY",IMAGE:"SIDEBAR_IMAGE_QUERY",GIF:"SIDEBAR_GIF_QUERY",EMOJI:"SIDEBAR_EMOJI_QUERY"}}};function Z8({images:e,videos:t,nColumns:o}){const r=Array.from({length:o},()=>0),s=Array.from({length:o},()=>[]);function a(i){const l=M3(i)?(i.dimensions?.height??1)/(i.dimensions?.width??1):i.dimensions.height/i.dimensions.width;let d=0;for(let c=1;c<r.length;c++){const u=r[d],h=r[c];if(h===void 0||u===void 0)throw new Error("columnHeight is undefined");h<u&&(d=c)}r[d]+=l,s[d]?.push(i)}const n=Math.max(e.length,t.length);for(let i=0;i<n;i++){const l=e[i],d=t[i];l&&a(l),d&&a(d)}return s}function e6(e,t){return e.filter(o=>!Fn(o)||!t.has(D3(o)))}function t6(e){return e.addedLayerFrom?.query?e.addedLayerFrom.query:""}var U3=ae(po()),Os={memeMaker:"meme"};const o6=()=>Ie.remove(xe.QUERY),r6=()=>{const e=Ie.get(xe.RESULTS.IMAGE,{disabled:null});return e?Ie.get(xe.RESULTS.QUERY.IMAGE,{disabled:null})!==Ie.get(xe.QUERY,{disabled:null})?[]:e:[]},P3=()=>{const e=I().state.toolTip;return Object.keys(Os).includes(e)&&vn(e)?Os[e]||"":Ie.get(xe.QUERY,{disabled:""})||""},a6=()=>{const e=P3();if(!e)return!1;const t=Ie.get(xe.RESULTS.QUERY.IMAGE,{disabled:""}),o=Ie.get(xe.RESULTS.QUERY.VIDEO,{disabled:""}),r=Ie.get(xe.RESULTS.QUERY.GIF,{disabled:""}),s=Ie.get(xe.RESULTS.QUERY.EMOJI,{disabled:""});return e===t&&e===o&&e===r&&e===s},s6=()=>({images:Ie.get(xe.RESULTS.IMAGE,{disabled:[]})||[],videos:Ie.get(xe.RESULTS.VIDEO,{disabled:[]})||[],gifs:Ie.get(xe.RESULTS.GIF,{disabled:[]})||[],emojis:Ie.get(xe.RESULTS.EMOJI,{disabled:[]})||[]}),i6=()=>{const e=Ie.get(xe.RESULTS.VIDEO,{disabled:null});return e?Ie.get(xe.RESULTS.QUERY.VIDEO,{disabled:null})!==Ie.get(xe.QUERY,{disabled:null})?[]:e:[]};var ao=new Map;function O3(e,t){const{layerProperties:o={}}=t,{state:r}=I(),s=Be(r),a={video_id:r.studio._id};o.name?a.fileName=o.name:"emojiDescription"in o&&o.emojiDescription&&(a.fileName=o.emojiDescription),s&&(a.teamId=s),t.skipCML&&(a.skipCML=!0);const n=o.usedProFeatures?.[0];n&&(a.usedProFeature=n);const i={};return t.thumbnailUrl&&(i.thumbnailUrl=t.thumbnailUrl),an(e,a,i)}function B3(e){const t=Be(I().state);return o1(e.map(({url:o,options:r})=>{const{layerProperties:s={}}=r;let a=s.name;!a&&"emojiDescription"in s&&s.emojiDescription&&(a=s.emojiDescription);const n={fileName:a,skipCML:r.skipCML,usedProFeature:s.usedProFeatures?.[0],url:o,video_id:void 0,conversion_id:void 0},i={};return r.thumbnailUrl&&(i.thumbnailUrl=r.thumbnailUrl),{linkInfo:n,extract_info:i}}),t??void 0)}var ta=async(e,t,o,r)=>{const{id:s}=Wt(),{asset:a,cmlFile:n,teamAsset:i,videoAsset:l}=e,d=a.status!==er.uploaded,c={id:s,asset_id:a._id,source:d?"pastedLink":"upload",duration:a.duration,isMediaLibraryUpload:o.isMediaLibraryUpload,...o.layerProperties};if(d&&(c.uploadId=(0,U3.default)(),c.uploadPending=!0),l&&(c.videoAssetId=l._id),n&&(c.cmlFileId=n._id),i&&(c.teamAssetId=i._id),r&&r.cancelled)return;const u=await Ht(a,c);if(!u)throw console.error("Failed to create layer from asset",a),Error(`Could not create layer from asset ${a._id}`);Object.assign(u,_o(u)),_r(a,n,i,l,u.uploadId??void 0);let h=!1;if(!o.skipGetMediaInfo&&(u.type===de.Audio||u.type===de.Video))try{const y=o.mediaInfo||await Rc({actionDescription:"getMediaInfo",timeoutMs:1e4,promise:ga(t,{name:t},dt.HIGH)});y&&"hasAudio"in y&&(h=y.hasAudio)}catch(y){console.error(y)}const A={selectLayerInCreator:!0,singleFileUpload:!0,knownTimelineRow:o.layerProperties?.timelineRow!==void 0,skipStudioAddLayer:o.skipStudioAddLayer,useCustomVideoDelay:o.useCustomVideoDelay,droppedTrackInfo:o.droppedTrackInfo},g={...u};if(o.propertiesAfterTypeDetermined){const y=o.propertiesAfterTypeDetermined(g);if(!y)return null;
3Object.assign(g,y)}if(!o.isMediaLibraryUpload&&h&&To({assetId:a._id,source:o?.layerProperties?.addedLayerFrom?.source||o?.layerProperties?.assetSource||"Url Add"}),o.replaceInfo){const y=I().state.studio.allLayers.byId[o.replaceInfo.idOfLayerToReplace];y&&(A.replaceInfo={layerToReplace:y,mediaSource:o.replaceInfo.mediaSource,entryPoint:o.replaceInfo.entryPoint})}return o.isMediaLibraryUpload||lt(u.type,o.layerProperties?.addedLayerFrom?.source||o.pluginId||void 0),Dn(g,A),g},Ua=()=>{const{state:e,dispatch:t}=I();return zr(e.currentUser)?!0:(t(Ei()),!1)};const n6=async({urlAndOptions:e,cancellationSource:t})=>{if(!Ua())return[];const o=[],r=[],s={};for(const n of e){const{url:i,options:l}=n;if(i)if(!ao.has(i))r.push(n),s[i]=l;else{const d=ao.get(i);if(!d)throw new Error("Pending request not found");const c=await ta(await d,i,l,t);o.push(c)}}const a=(await B3(r)).createdLinks;return await Promise.all(a.map(async n=>{const i=n.asset.input_url;if(!i)return null;const l=s[i];return l?await ta(n,i,l,t):null}))},Ro=async({url:e,options:t={},cancellationSource:o})=>{if(!Ua()||!e)return null;ao.has(e)||ao.set(e,O3(e,t));const r=ao.get(e);if(!r)throw new Error("Pending request not found");return await ta(await r,e,t,o)},Pa=async(e,t)=>{if(!Ua())return null;const{state:o,dispatch:r}=I();o.assets.byId[e._id]||r(Te([e]));const{layerProperties:s,replaceInfo:a,skipCML:n,skipStudioAddLayer:i,useCustomVideoDelay:l}=t,d=await Ht(e,{...s,asset_id:e._id});if(!d){console.error("Failed to create layer from asset",e);return}if(l!==void 0?d.type===de.Image?(d.startTime=l,d.endTime=l+2):d.videoDelay=l:Vt(d),t.propertiesAfterTypeDetermined){const c=t.propertiesAfterTypeDetermined(d);if(!c)return null;
3Object.assign(d,c)}if(a){const c=o.studio.allLayers.byId[a.idOfLayerToReplace];d&&c&&ba({newLayer:d,replacedLayer:c,addLayerOptions:{undoable:!0},entryPoint:a.entryPoint,mediaSource:a.mediaSource})}else i||Pt(d,{undoable:!0});try{const c=o.studio._id,u=Be(o);if(!u)return d;ne.asset.addAssetForUserVideo.mutate({assetId:e._id,teamId:u,videoId:c,fileName:e.name,skipCML:n}).then(h=>{if(!h.cmlFile)return;const{thisProjectCMLFiles:A}=o.studio,g=vt(o,St.ENABLE_TEAM_ASSETS),{cmlFile:y,teamAsset:b,videoAsset:_}=h,S=_&&!!o.videoAssets.byId[_._id];g&&_&&g&&!S&&r(Gt(_));const T={cmlFileId:y._id,teamAssetId:b?._id,videoAssetId:_?._id};r($l({[d.id]:T},"addLayerFromExternalAsset",!1)),r(Ia([y])),r(Cc([y._id])),!A?.[y._id]&&c&&r(ya(y,c)),y.duplicate&&r(gu({id:y._id,modified:new Date(y.modified)}))})}catch(c){console.error("Error adding asset to user video",c)}return d},F3="M75 0 L0 200 L150 200 Z",d6=(e,t)=>{const{state:o}=I(),{background:r}=o.studio,s=Vi(),a=typeof window<"u"&&window.innerWidth<768;let n="#ffffff";["#fff","#ffffff","white","rgba(-255,-255,-255,0)"].includes(r.toLowerCase())&&(n="#000000");let i={id:Nt(12),type:de.Shape,shapeType:e,background:n,stroke:vi,position:s,lineCap:["line","arrow"].includes(e)?"round":"butt",globalAlpha:1};lt("shape","element tab");const l=e==="svg"?"0.1%":"0.3%";if(i.lineWidth=["line","arrow"].includes(e)?"0.6%":l,["line","arrow"].includes(e)&&(i={...i,position:s,lineRightAngle:"horizontal",linePointStartCorner:"topLeft",stroke:"#000000"}),e==="arrow"&&(i={...i,lineArrow:"open"}),e==="triangle"&&(i.position.svg_width=150,i.position.svg_height=200,i.svgData=F3,i.shapeType="svg"),e==="svg"&&t){const d=(t.attributes.viewBox||"").split(" ");i.svgChildren=t.children,i.position.svg_width=parseInt(d[2],10),i.position.svg_height=parseInt(d[3],10),i.stroke=n==="#000000"?"#ffffff":"#000000"}if(["rectangle","ellipse","triangle"].includes(e)&&(i.position=Yr(i.position)),e==="svg"&&i.position){const d=Yr(i.position),{svg_width:c,svg_height:u}=i.position;c&&u&&(d.width=`${c/u*parseInt(i.position.width)}%`),i.position=d}Pt(i,{undoable:!0}),ce("Add layer from shape sidebar",{id:t?.id??e}),a&&Il()};var j3=e=>{let t=e?.blob_name?.split("/")?.pop()?.split("-");return t?.length&&["drink","places"].includes(t[0]||"")&&(t=t.slice(1)),`Emoji ${t?.join(" ")?.split(".")[0]}`};async function N3({emoji:e,isMediaLibraryUpload:t,cancellationSource:o}){const r=j3(e),s=`https://cdn-useast1.kapwing.com/${e.blob_name}`,a={emojiDescription:r,isMediaLibraryUpload:t,library:"emoji",lockAspectRatio:!0,mime:"image/png",position:Yr(Vi())},n=e.emoji_asset;n?Pa(n,{layerProperties:a}):await Ro({url:s,options:{layerProperties:a,mediaInfo:{height:120,type:de.Image,width:120}},cancellationSource:o}),ce("Added Emoji Element",{emoji:r})}const l6=e=>async t=>{const o=(await Wi())[e.assetId],r={name:e.name,canvasBlurValid:e.canvasBlurValid};o?.url&&!Tt(o.url)?Pa(o,{layerProperties:r}):await Ro({url:e.fullQualityUrl,options:{layerProperties:r,mediaInfo:e.mediaInfo},cancellationSource:t})},c6=async(e,t)=>{const o=e.emoji_asset?._id;if(o){const r=(await Wi())[o];r&&r.url&&!Tt(r.url)&&(e.emoji_asset=r)}await N3({emoji:e,isMediaLibraryUpload:!1,cancellationSource:t})},u6=async(e,t)=>{Ro({url:e.images.original.url,options:{layerProperties:{name:e.title,canvasBlurValid:!1,addedLayerFrom:{source:"Elements",query:t}},mediaInfo:{height:e.images.original.height,type:de.Image,width:e.images.original.width}}}),ce("Add layer from element search")},V3=async e=>{await ne.presets.textTemplates.insert.mutate({template:e})},G3=async e=>(await ne.presets.textTemplates.get.query({teamId:e})).templates,K3=async e=>{await ne.presets.textTemplates.update.mutate({template:e})},W3=async(e,t)=>{await ne.presets.textTemplates.delete.mutate({teamId:e,templateId:t})};var H3=ae(ye()),Bs=0;const q3=async e=>{const{dispatch:t}=I(),o=Date.now();if(o-Bs<1e3*10)return;Bs=o;const r=await G3(e);r&&t(Pc({brandkitTemplates:r}))};var $3=1e3*60*60*4;const Y3=e=>{const t=[],{state:o}=I();return e.forEach(({layers:r})=>{r.forEach(s=>{if(s.asset_id){const a=wi(s,o);(!a?.url||Tt(a.url,$3))&&t.push(s.asset_id)}})}),t};var z3=async()=>{const{dispatch:e,state:t}=I(),{templates:o}=t.textTemplates,r=Y3(o);if(r.length)try{e(Te(await pn(r,Aa.textTemplates)))}catch(s){console.error("refreshSubtitlePresetFontAssetUrls err",s)}};const h6=async(e,t)=>{const{dispatch:o,state:r}=I();try{const s={...e,teamId:Ai(r),timestampCreated:Date.now()};o(Bc({template:s,index:t})),await V3(s),o(ke({description:"Your text style is now accessible to everyone on your team!",type:"success"})),yr("add","textTemplate")}catch(s){Se({description:"Failed to save text style.",error:s})}},p6=async e=>{try{await K3(e)}catch(t){Se({description:"Failed to update text style.",error:t})}},m6=async e=>{const{dispatch:t,state:o}=I(),r=Be(o);if(r)try{t(Ic({templateId:e})),await W3(r,e),yr("remove","textTemplate")}catch(s){Se({description:"Failed to remove text style.",error:s})}},jn=(e,t={})=>{const{state:o}=I(),{ratio:r}=o.studio,{duration:s}=o.studio,a=r!==(e.ratio?.join(":")||"16:9");return e.layers.map(n=>{const i=Nt(12),{type:l}=n;let{position:d}=n;if(a&&d){const u=+r.split(":")[0],h=+r.split(":")[1],A={width:u/Math.min(u,h),height:h/Math.min(u,h)},g=e.ratio||[16,9],y=g[0]/g[1],b=Uc({xPct:Oe(d.x),yPct:Oe(d.y),widthPct:Oe(d.width),heightPct:Oe(d.height)},{width:y,height:1},A,{left:!1,top:!1});d={...d,x:Lt(b.xPct),y:Lt(b.yPct),width:Lt(b.widthPct),height:Lt(b.heightPct)}}const c={...n,position:d,id:i,type:l,fromTextDefaults:e.templateId};if(s&&(Vt(c),t.startTime)){const u=(c.endTime||0)-(c.startTime||0)||t.duration||0;c.duration=u,c.startTime=t.startTime,c.endTime=t.startTime+u}return c})};var Fs={};const f6=(e,t,o)=>{const r=`${e.templateId}_${t}_${o}`,s=Fs[r];if(s)return s;const a=jn(e);let n=100,i=0,l=100,d=0;a.forEach(({position:A})=>
3{if(!A)return;const{x:g,y,width:b,height:_}=A,S=Oe(g),T=Oe(y),w=Oe(b),x=Oe(_);S<n&&(n=S),T<l&&(l=T),S+w>i&&(i=S+w),T+x>d&&(d=T+x)});const c=i-n,u=d-l,h={width:t*c/100,height:o*u/100};return Fs[r]=h,h},Q3=async({template:e,overrides:t={},undoable:o=!0,droppedTrackInfo:r})=>{yn();const{state:s,dispatch:a}=I(),{ratio:n}=s.studio,{duration:i}=s.studio,l=n!==(e.ratio?.join(":")||"16:9"),d=jn(e,t);if(Pe.beginBatch(),d.length===1){const h=d[0],A=e.layers[0];if(Pt(h,{undoable:o,droppedTrackInfo:r}),l&&Nc(h.id,o),A.animation&&i){const g=rs(A.animation.animationName);g.transitionDuration=A.animation.transitionDuration,ea(h.id,g)}}else{const h=Tr(),A=Al();for(let y=0;y<d.length;y+=1){const b=d[y];ol(b)&&b.url?(await Ro({url:b.url,options:{layerProperties:b,skipCML:!0}}),a(qr(null))):Pt(b,{undoable:o,isReplacing:!0,droppedTrackInfo:r});const _=e.layers[y];if(_.animation&&i){const S=rs(_.animation.animationName);S.transitionDuration=_.animation.transitionDuration,ea(b.id,S)}}Ar(d.map(y=>y.id),h,o),a(xr(h,!1,o));const g={x:50,y:50};if(t.position){const{x:y,y:b,width:_,height:S}=t.position,T=Oe(y),w=Oe(b),x=Oe(_),k=Oe(S);g.x=T+x/2,g.y=w+k/2}zc(h,o,g),a(xr(h,!0,o)),A&&(a(xr(h,!1,o)),a(qr(null)))}Pe.endBatch();const c=!!h1.find(h=>h.templateId===e.templateId),u=!!e.teamId;ce("Added Text Template",{templateId:e.templateId,isDefaulTemplate:c,isBrandkitTemplate:u,dndTimeline:t.timelineRow!==void 0,dndCanvas:t.position!==void 0})};function g6(){const e=(0,H3.c)(18),t=Ki(),o=We(Be),{brandkitTemplates:r,templates:s}=We(X3),[a,n]=(0,v.useState)(!1);let i,l;e[0]!==o?(i=()=>{o&&q3(o)},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),(0,v.useEffect)(i,l);let d;e[3]!==t.current?(d=()=>{(async function(){await z3(),t.current&&n(!0)})()},e[3]=t.current,e[4]=d):d=e[4];let c;if(e[5]!==t?(c=[t],e[5]=t,e[6]=c):c=e[6],(0,v.useEffect)(d,c),!a){let y;return e[7]===Symbol.for("react.memo_cache_sentinel")?(y={templates:[],brandkitTemplates:[]},e[7]=y):y=e[7],y}let u;e[8]!==r?(u=new Set(r.map(J3)),e[8]=r,e[9]=u):u=e[9];const h=u;let A;if(e[10]!==h||e[11]!==s){let y;e[13]!==h?(y=b=>b&&b.templateId&&!h.has(b.templateId),e[13]=h,e[14]=y):y=e[14],A=ou(s.filter(y)),e[10]=h,e[11]=s,e[12]=A}else A=e[12];let g;return e[15]!==r||e[16]!==A?(g={templates:A,brandkitTemplates:r},e[15]=r,e[16]=A,e[17]=g):g=e[17],g}function J3(e){return e.templateId}function X3(e){return e.textTemplates}var Z3=ae(It());function Nn(e){return ua(I().state,e)}function A6(e){return!!ua(I().state,e)}async function y6(e){const{state:t}=I(),{currentUser:o}=t,{token:r,user:s}=o||{},{_id:a}=s||{},n=Nn(e),i={token:r,userId:a,teamId:"",type:n?.type??Zo.personal,folderId:e};n?.teamId&&n.teamId!=="personal"&&(i.teamId=n.teamId);try{return await ne.workspace.getUser.query({workspaceId:e})}catch(l){return console.error(l),l}}function b6(e){const{dispatch:t}=I();t(Vu(e))}function _6(e){const t="";if(!e)return t;const o=Nn(e);return o==null?t:o.name||t}function I6(){const{dispatch:e}=I();e(ke({description:"Your folder has been successfully deleted.",type:"success"}))}function T6(){const{state:e}=I(),{foldersById:t}=e.workspaces,{allTeams:o}=e.teams,r=o[0]?._id||null;return zi(Object.values(t),r)[0]?._id||""}function v6(e){const{foldersById:t}=I().state.workspaces;return zi(Object.values(t),e)[0]?._id||""}async function S6({folderType:e,teamId:t,parentFolderId:o=null}){const{dispatch:r,state:s}=I(),{currentUser:a}=s,n=Be(s),i=t||n;if(!i)throw new Error("No selected team");const{workspace:l}=await ne.workspace.create.mutate({name:Jl,type:e,teamId:i,parentFolderId:o});return r(s1.addFolder(l)),ce("Create Folder",{Email:vc(a),"Folder ID":l._id,"Team ID":i,"Folder Type":(0,Z3.capitalize)(Zo[e]),"Parent Folder ID":o}),l}async function ep(e){return(await ne.workspace.type.query({folderId:e})).folderType}function tp(e){const t=JSON.stringify(e).length;return Number((t/1024/1024).toFixed(2))}function op(e,t,o,r){if(t.formatType!==ec.VIDEO||t.videoType!==Zl.MP4)return;const s=(e.width??0)/(e.height??1);if(Dc(e,"videoBuild")){const a=Object.values(e.allLayers.byId)[0],{videoType:n}=t;a&&Lc(a,s,e.ratio,{exportQuality:t.exportQuality,exportResolution:t.exportResolution}
3)&&(o["Client Side Processable"]={...o["Client Side Processable"],"No Changes":!0,"Processed on client":r}),a&&Qu(a,s)&&(o["Client Side Processable"]={...o["Client Side Processable"],"Trim only":!0,"Processed on client":r}),a&&fu(a,s,n)&&(o["Client Side Processable"]={...o["Client Side Processable"],"Short Duration Cropped or Resized Video":!0})}hu(e)&&(o["Client Side Processable"]={...o["Client Side Processable"],"Static Image Video":!0}),Wc(e,t)&&(o["Client Side Processable"]={...o["Client Side Processable"],"No Changes Video + Audio":!0}),Au(e)&&(o["Client Side Processable"]={...o["Client Side Processable"],"Trimmed Video + Audio":!0})}var rp={usedGapInsert:["Used Drag Into Split/Small Gap"],usedRippleDelete:["Used Ripple Delete"],usedRippleMode:["Used Ripple Mode"],usedSpeedAdjustMode:["Used Speed Adjust Mode"],usedPasteModifications:["Used Paste Modifications"],usedCanvasBlur:["Used Canvas Blur"],usedSafezone:["Used Safezone"],usedTimeline:["Used Timeline V2"],usedCrop:["Used Crop"],usedImageErase:["Used Image Erase"],usedExactInput:["Used Exact Input"],waveformCreationFailure:["Waveform Creation Failure"],renameLayer:["User Renamed Layer"],usedUploadSRT:["Used Upload SRT"],usedGenerateTTSVideo:["Used Generate TTS Video"],usedGenerateTTSVideoPastPrompt:["Used Past Prompt to Generate TTS Video"],usedGenerateVideo:["Used Generate Video"],usedGenerateVideoPastPrompt:["Used Past Prompt to Generate Video"],usedGenerateImage:["Used Generate Image"],usedGenerateImagePastPrompt:["Used Past Prompt to Generate Image"],usedGenerateMeme:["Used Generate Meme"],usedGenerateMemePastPrompt:["Used Past Prompt to Generate Meme"],usedGenerateVideoFromDocument:["Used Document to Video Generator"],usedGenerateVideoFromDocumentPastPrompt:["Used Past Prompt to Generate Document to Video Generator"],usedGenerateVideoFromScript:["Used Script to Video Generator"],usedGenerateVideoFromScriptPastPrompt:["Used Past Prompt to Generate Script to Video Generator"],usedGenerateVideoFromArticle:["Used Article to Video Generator"],usedGenerateVideoFromArticlePastPrompt:["Used Past Prompt to Generate Article to Video Generator"],usedGenerateBRoll:["Used Generate B-Roll"],usedEnhanceImage:["Used Enhance Image"],usedSmartReframe:["Used Smart Reframe"],usedIndividualSubtitlePlacements:["Used Individual Subtitle Placements"],updatedAllSubtitlePlacements:["Updated All Subtitle Placements"],usedClassicTranscribe:["Used Classic Transcribe","Used Classic Autogenerate"],usedClassicTranslate:["Used Classic Translate","Used Classic Autogenerate"],usedTranslateReviewDubbing:["Used Translate Review Dubbing"],usedVoiceDubbing:["Used Voice Dubbing"],usedVolumeAdjustOnOriginalDubbedAsset:["Used Volume Adjust on Original Dubbed Asset"],usedLipSync:["Used Lip Sync"],usedDubbingWithFileUpload:["Used Dubbing File Upload"],usedTTSVoiceFilters:["Used TTS Voice Filters"]};function ap(e,t,o,r,s,a){if(a["Export Type"]=r.selectedExtension,r.exportQuality&&(a.exportQuality=r.exportQuality),r.exportResolution&&(a.exportResolution=r.exportResolution),"usedUndo"in t&&t.usedUndo&&(a["Used Undo"]=!0),t.usedEyedropper&&(a["Used Eyedropper"]=!0),zl(a,t,o),t.analytics){const{analytics:f}=t;f.activeFindHighlightsJobInfo&&(a["Find Highlights Job ID"]=f.activeFindHighlightsJobInfo.jobId,a["Find Highlights Asset Duration"]=f.activeFindHighlightsJobInfo.assetDuration),f.autoEditJobId&&(a["Auto Edit Job ID"]=f.autoEditJobId),Object.entries(rp).forEach(([U,P])=>{f[U]&&P.forEach(F=>a[F]=!0)})}t.workflowId&&(a["Find Highlights Workflow ID"]=t.workflowId),a["Exported With Individual Subtitle Placements"]=Ku(o).some(f=>!!o.studio.magicSubtitleFramesByAsset?.[f.assetId]?.byId?.[f.frame[Mo.id]]?.[Mo.position]);const n=Object.values(e.allLayers.byId);a["Has Smart Reframe Layers"]=n.some(({fromSmartReframe:f})=>f);const i=n.filter(rl),l=i.filter(al).some(f=>!!f.volume),d=n.filter(dl);a["Has Dubbed Layers"]=i.length>0,a["Has Dubbed TTS Layers"]=d.length>0,a["Has Dubbed Layer With Original Audio"]=l,a["Has Lip Sync Layers"]=n.some(gl);let c=0,u=0;const h=new Map,A=new Set;if(n.forEach(f=>{if(f.bRollId&&A.add(f.bRollId),!f.bRollLayerSource)return;f.type==="image"&&(c+=1),f.type==="video"&&(u+=1);const U=h.get(f.bRollLayerSource)||0;h.set(f.bRollLayerSource,U+1)}),a["B-Roll Image Layers"]=c,a["B-Roll Video Layers"]=u,t.analytics?.smartBrollAddAllInfo){const{brolls:f,entryPoint:U}=t.analytics.smartBrollAddAllInfo,P={};for(const X of Object.values(f))P[X.source]=(P[X.source]??0)+1;const F=Object.keys(f).length,H=Object.values(f).filter(X=>X.type==="image").length,N=Object.values(f).filter(X=>X.type==="video").length,W=[],se=[],G=[],z=[],re={};let J=0,q=0,te=0;for(const[X,oe]of Object.entries(f)){if(!A.has(X)){oe.assetId&&z.push(oe.assetId),se.push(oe.keyword);continue}oe.assetId&&G.push(oe.assetId),W.push(oe.keyword),J+=1,oe.type==="image"&&(q+=1),oe.type==="video"&&(te+=1),re[oe.source]=(re[oe.source]??0)+1}a["B-Roll Accuracy - Entry Point"]=U,F>0&&(a["B-Roll Accuracy - % broll kept"]=Math.round(J/F*100)),H>0&&(a["B-Roll Accuracy - % images kept"]=Math.round(q/c*100)),N>0&&(a["B-Roll Accuracy - % videos kept"]=Math.round(te/u*100))}"translate"in t&&!t.isTranscribed&&(a["Used Translate"]=!0),a["Number of Layers"]=Object.entries(e.allLayers.byId).length,a["Max Number of Rows Across Scenes"]=0,op(e,r,a,s),a["Number of Tracks Used"]=Object.keys({}).length,a["Strict Video Recorded Layers"]=0,a["Strict Audio Recorded Layers"]=0,a["Screen Recorded Layers"]=0,a["Video Recorded During Screen Record Layers"]=0,a["Audio Recorded During Screen Record Layers"]=0,a["Number of Subtitle Layers"]=0,a["Total Uploaded File Size (MB)"]=0,a["Has Draw Layer"]=!1,a["Has Generated Scene Layers"]=Object.values(e.allLayers.byId).some(f=>f.source==="generateScene");const g=e.magicSubtitlesOnExport;g&&(a["Number of Subtitle Layers"]=Object.values(g).reduce((f,U)=>f+U.length,0));const y=new Set,b=new Set,_=new Set,S=new Set,T=(f,U)=>{a[f]?a[f].push(U):a[f]=[U]},w={};
3o.magicSubtitlePresets.presets.forEach(f=>{w[f.presetId]=f});const x={};o.magicSubtitlePresets.brandkitPresets.forEach(f=>{x[f.presetId]=f});const k={};o.textPresets.presets.forEach(f=>{k[f.presetId]=f});const M={};o.textPresets.brandkitPresets.forEach(f=>{M[f.presetId]=f});const j={};o.textTemplates.templates.forEach(f=>{j[f.templateId]=f});const O={};o.textTemplates.brandkitTemplates.forEach(f=>{O[f.templateId]=f});const B=new Set;let $=!1,Z=!1;for(const f of Object.values(e.allLayers.byId)){f.volume&&f.volume>0&&f.volume<1&&(a["Uses Layer Volume Adjust"]=!0),to(f)&&(a["Has Persona"]=!0);const U={};if(typeof f.timelineRow=="number"){const G=`${f.timelineRow}`;U[G]=(U[G]||0)+1,a["Max Number of Rows Across Scenes"]=Math.max(f.timelineRow+1,a["Max Number of Rows Across Scenes"])}if(f.type==="video"&&f.videoDelay&&(a["Uses Video Delay"]=!0),f.type===de.Shape&&(a["Has Shape"]=!0),f.shapeType==="progressBar"&&(a["Has Progress Bar"]=!0),f.isDrawLayer&&(a["Has Draw Layer"]=!0),f.type===de.Text)if(a["Has Text"]=!0,f.wrapOrFill==="wrap"?a["Used Text Background"]="wrap":f.wrapOrFill==="fill"||f.backgroundColor?a["Used Text Background"]="fill":a["Used Text Background"]="none",f.textShadow&&f.textShadow!=="rgba(-255,-255,-255,0)"?a["Used Text Outline"]=f.textShadow:a["Used Text Outline"]="none",f.fromTextDefaults){const G=f.fromTextDefaults;if(!B.has(G)){B.add(G);const z=j[G],re=O[G],J=z||re;if(J){const q=!!re,te=hc(J),X=J.videoId!==o.studio._id;T("Reused Text Custom Template",!te&&X),T("Used Text Custom Template",!te&&!X),T("Used Text Brandkit Template",q),T("Used Text Brandkit Template From Another User",q&&!z),T("Used Text Default Template",te),te&&T("Text Default Template ID",J.templateId)}}}else{const G=xa(f),z=k[G.presetId],re=M[G.presetId],J=z||re,q=!!re,te=!!J&&Ea(J),X=J?.videoId!==o.studio._id;T("Reused Text Custom Preset",!te&&X),T("Used Text Custom Preset",!te&&!X),T("Used Text Brandkit Preset",q),T("Used Text Brandkit Preset From Another User",q&&!z),T("Used Text Default Preset",te),te&&T("Text Default Preset ID",J.presetId)}f.type==="image"&&(f.imageEffectColor&&(a["Has Image Drop Shadow"]=!0),f.mime==="image/webp"&&(a["Has Webp File"]=!0),f.isFreezeFrameLayer&&(a["Has Freeze Frame"]=!0),f.usedProFeatures?.includes("enhanced-image")&&(a["Has Enhanced Image"]=!0),f.asset_id&&Kh(o.assets.byId[f.asset_id])&&(a["Has PDF Page"]=!0)),f.pluginSource&&(a["Has Layer From Plugin"]=!0);const P=Rl(f);P&&P.id!=="none"&&(a["Has Animation"]=!0,f.type==="image"&&(a["Has Image Animation"]=!0),f.type==="text"&&(a["Has Text Animation"]=!0),f.type==="video"&&(a["Has Video Animation"]=!0));const F=Ui(f);F.find(G=>G.type==="outro")!==void 0&&(a["Has Outro Animation"]=!0),F.find(G=>G.id===nt.MovingZoom)&&(a["Has Moving Zoom"]=!0);const{introTransition:H,outroTransition:N}=pa(f);if((H&&H.id!=="none"||N&&N.id!=="none")&&(a["Has Transition"]=!0),H?.transitionId&&is(H?.transitionId)&&S.add(H?.transitionId),N?.transitionId&&is(N?.transitionId)&&S.add(N?.transitionId),f.textDropShadowColor&&f.textDropShadowColor!=="rgba(-255,-255,-255,0)"&&(a["Uses Drop Shadow"]=!0),f.type==="text"&&f.textEffect&&(a["Uses Text Effect"]=!0,f.textEffect==="textBlur"&&(a["Uses Text Blur"]=!0)),f.draftJSTextTree?.blocks.length&&!a["Uses Inline Styling"]){const{blocks:G}=f.draftJSTextTree,z=new Set(G[0]?.inlineStyleRanges.map(re=>re.style));a["Uses Inline Styling"]=G.some(re=>re.inlineStyleRanges.some(J=>!z.has(J.style)||J.offset!==0||J.length!==re.text.length))}"library"in f&&f.library==="emoji"&&(a["Has Emoji"]=!0),f.hasCustomFont&&(a["Has Custom Font"]=!0),(f.type==="video"||f.type==="image")&&"lineWidth"in f&&f.lineWidth!==0&&(a["Uses Image/Video Border"]=!0),f.isAudiogram&&(a["Has Audiogram"]=!0),f.removeBg&&(a["Uses Video Remove Backgroun
3d"]=!0),f.blurBg&&(a["Uses Video Blurred Background"]=!0),f.chromaKey&&(a["Uses Chroma Key"]=!0),f.isReversed&&(a["Uses Reverse Effect"]=!0),f.presetFilter&&f.presetFilter.name&&f.presetFilter.name!=="Original"&&(a["Uses Preset Filter"]=!0),f.recordType==="video"&&(a["Strict Video Recorded Layers"]+=1),f.recordType==="audio"&&(a["Strict Audio Recorded Layers"]+=1),f.recordType==="screen"&&(a["Screen Recorded Layers"]+=1),f.recordType==="screen-video"&&(a["Video Recorded During Screen Record Layers"]+=1),f.recordType==="screen-audio"&&(a["Audio Recorded During Screen Record Layers"]+=1),f.preemptiveDownloadError&&(a["Preemptive Download Error Detected"]=!0),f.addedFromMediaLibrary&&(a["Uses Media Library"]=!0),f.locked&&(a["Has a Locked Layer"]=!0),f.shapeType==="rectangle"&&f.borderRadius&&f.borderRadius.relative!=="0"&&(a["Has Rounded Rectangles"]=!0),f.isZoomed&&(a["Uses Zoom"]=!0),f.detachedAudioId&&(a["Detached Video"]=!0),f.audioEffect&&f.audioEffect==="fade"&&(f.type==="audio"&&(a["Used Audio Fade"]=!0),f.type==="video"&&(a["Used Audio Fade for Video Layer"]=!0)),f.volume&&f.volume>1&&(a["Set Volume > 100%"]=!0),f.audioCompressor&&(a["Uses Auto Level Volume"]=!0),typeof f.size=="number"&&(a["Total Uploaded File Size (MB)"]+=f.size/1e6),f.isTranslatedImageTextLayer&&(a["Used Translate Text in Image"]=!0),fl(f)&&(a["Has preset filters"]=!0),ll(f)&&(a["Has filters"]=!0,wl(f.filters)&&(a["Has color correct filters"]=!0));const W=sl(o);if(!$&&W){const G=(W.teamAssetIds||[]).some(z=>f.asset_id&&o.teamAssets.byId[z]?.asset_id===f.asset_id);(W?.cmlIds&&f.cmlFileId&&W.cmlIds.includes(f.cmlFileId)||G||f.color&&W.colors.includes({value:f.color,default:!1})||f.backgroundColor&&W.colors.includes({value:f.backgroundColor,default:!1})||f.fontFamily&&W.fonts.some(z=>z.fontFamily===f.fontFamily))&&(a["Used Brandkit Asset"]=!0,$=!0)}!Z&&W&&(f.asset_id&&o.assets.byId[f.asset_id]?.input_url?.includes("asset.brandfetch.io")&&(a["Used Prepopulated Brandkit Asset"]=!0,Z=!0),(f.color&&W.colors.includes({value:f.color,default:!1,isPrepopulated:!0})||f.backgroundColor&&W.colors.includes({value:f.backgroundColor,default:!1,isPrepopulated:!0})||f.fontFamily&&W.fonts.some(G=>G.fontFamily===f.fontFamily&&G.isPrepopulated))&&(a["Used Prepopulated Brandkit Asset"]=!0,Z=!0),f.alt_asset?.enhancements.includes(Do.STABILIZE)&&(a["Used Stabilize in Video"]=!0),f.alt_asset?.enhancements.includes(Do.CLEAN_AUDIO)&&(a["Used Clean Audio in Video"]=!0),f.alt_asset?.enhancements.includes(Do.ENHANCE_VOICE)&&(a["Used Enhance Voice in Video"]=!0),f.alt_asset?.enhancements.includes(Do.EYE_CONTACT)&&(a["Used Eye Contact in Video"]=!0)),f.hasAudio&&(b.add(f.asset_id),_.add(f.id));const se=Su(f);se&&y.add(se)}a["Audible Assets"]=b.size,a["Audible Layers"]=_.size,a["GLTransitions Used"]=[...S],e.ratio&&(a.Ratio=e.ratio),a["Max Video Layers in Single Scene"]=Object.values(e.allLayers.byId).filter(f=>f.type==="video").length,e.groups&&Object.values(e.groups).filter(f=>f.saved).length>0&&(a["Has a Group"]=!0),e.contextMenuUsed&&(a["Opened Context Menu"]=e.contextMenuUsed),e.duration===null&&(a["Null Duration"]=!0),e.duration===void 0&&(a["Undefined Duration"]=!0),o.projectSessionSettings.trimWithTranscriptAnalytics?.secondsRemoved&&(a["Trim With Transcript - Seconds Removed"]=Math.ceil(o.projectSessionSettings.trimWithTranscriptAnalytics.secondsRemoved));const Y=Object.entries(t.tetheredWaveforms?.byAssetId||{}).filter(([f,U])=>U?.enabled&&y.has(f)).length;if(Y&&(a["Tethered Waveform Assets"]=Y),Object.values(t.magicSubtitles||{}).some(f=>f?.enabled)){const f=Object.entries(t.magicSubtitles||{}).filter(([z,re])=>re?.enabled).map(([z])=>z),U=new Set,P=new Set,F=Eu(o),H=F.transitionId||nt.None,{subtitleAnimation:N,wordByWordAnimations:W}=F;if(W&&W.animationId!==nt.None&&W.animationName!==nt.None){const{animationId:z,animationName:re}=W,J=`${z}:${re}`;U.add(J)}H!==nt.None&&P.add(H),N&&U.add(N.animationId);const se=[...P],G=[...U];se.length&&(a["Magic Subtitle Transitions"]=se.join(" ")),G.length&&(a["Magic Subtitle Animations"]=G.join(" "));for(const z of f){const re=t.magicSubtitles?.[z];if(!re)continue;(!re.transcriptionSource||re.transcriptionSource==="transcription")&&(a["Used Magic Autogenerate"]=!0),re.translatedLanguageCode&&(a["Used Magic Translate"]=!0);const J=uu(o,z),q=!!J?.some(oe=>oe&&oe[Mo.words].some(pe=>pe[Cr.inlineStyles]&&Object.keys(pe[Cr.inlineStyles]).length>1));a["Used Magic Subtitles Inline Styling"]=a["Used Magic Subtitles Inline Styling"]||q;
3const te=!!J?.some(oe=>oe&&oe[Mo.words].some(pe=>jc(pe[Cr.text])));a["Magic Subtitles Has Emojis"]=a["Magic Subtitles Has Emojis"]||te;const X=Fu();if(X){const oe=w[X.presetId],pe=!!x[X.presetId],fe=dc(X),ue=X.videoId!==o.studio._id;T("Used Magic Subtitles Custom Preset",!fe&&!ue),T("Reused Magic Subtitles Custom Preset",!fe&&ue),T("Used Magic Subtitles Brandkit Preset",pe),T("Used Magic Subtitles Brandkit Preset From Another User",pe&&!oe),T("Used Magic Subtitles Default Preset",fe),fe&&T("Magic Subtitles Default Preset ID",X.presetId)}}}let Q=!1;if(t.keyframing){let f=0,U=0;Object.values(t.keyframing).forEach(P=>{let F=!1;Object.entries(P).forEach(([H,N])=>{const{keyframes:W}=N;if(!W.length)return;const se=`Total ${H} Keyframes`;f+=W.length,F=!0,a[se]||(a[se]=0),a[se]+=W.length}),F&&(U+=1)}),f&&(Q=!0,a["Total Keyframe Count"]=f,a["Total Keyframed Layer Count"]=U)}a["Has Keyframes"]=Q;const L=wc.getMetrics();L&&Object.assign(a,L)}async function sp({exportLocation:e,video:t,studioState:o={},processedOnClient:r=!1,exportSettings:s}){try{await ip({exportLocation:e,video:t,studioState:o,processedOnClient:r,exportSettings:s})}catch(a){console.error(a),la(a)}}async function ip({exportLocation:e,video:t,studioState:o={},exportSettings:r,processedOnClient:s=!1}){const{state:a}=I(),n={...Ql()};t._id&&(n["Video ID"]=t._id,n["Link to Video"]=`kapwing.com/videos/${t._id}`),t.createLocation==="studio-publish-dropdown"&&(n["Exported With Dropdown"]=!0),n.exportLocation=e,n["Export Extension"]=r.selectedExtension,n["Export Format"]=r.formatType,n["Approximate Video Document Size (MB)"]=tp(t);const{origin:i}=t;i&&(n["Landing Page"]=i);const{templateSource:l}=a.exploreTemplates;l&&(n["Template Source"]=l),Vl()&&(n["Used PWA"]=!0),t.duration&&(n.Duration=t.duration),ap(t,o,a,r,s,n);const{interval:d,status:c}=await va(),u=Ao(),h=fo();n["Team ID"]=u?u._id:"None",n["Current Plan"]=h.name,n["Monthly/Annual"]=d,n["Subscription Status"]=c,n["Number of Workspace Members"]=u?u?.users?.length:0,n["Is Team Member"]=Ni(t.teamId??""),n["Is Project Owner"]=Qi(t.creatorId??""),n["Brand Kit Pre-Populated"]=Vc(),n["Subtitle Edits"]=Object.values(o.transcriptionEditCounts||{}).reduce((g,y)=>g+y,0),n["Speaker Labels Added"]=!!I().state.studio.magicSubtitleSpeakers?.showSpeakerLabelsOnCanvas;const A=I().state.studio.magicSubtitleSpeakers?.speakerConfigs;n["Speaker Specific Styles Added"]=A&&Object.values(A).some(g=>g?.style&&Object.keys(g.style).length||g?.position),n["Used Magic Animate"]=a.studio.analytics.usedMagicAnimate||!1,n["Has Audio Layer"]=Object.values(a.studio.allLayers.byId).some(g=>g.type===de.Audio),ce("Create Video",n),Gi("Create Video")}async function w6({callToAction:e,template:t,originOverride:o,landingPageLocale:r}){const{state:s}=I(),{currentUser:a,exploreTemplates:{templateSource:n}}=s,i=o||s.studio.origin,l={"Call to Action":e};if(l["Landing Page"]=i,r&&(l["Landing Page Locale"]=r),!l?.["Landing Page"])switch(e){case Po.GetStarted:l["Landing Page"]="Home Page",l["Landing Page URL"]="https://www.kapwing.com/";break;case Po.NewContentWorkspace:l["Landing Page"]="Workspace",l["Landing Page URL"]="https://www.kapwing.com/folder";break;case Po.EditThisTemplate:l["Landing Page"]=t?.title||"Unknown",l["Landing Page URL"]=`https://www.kapwing.com/explore/${t?.slug}`;break;case Po.WorkspaceSearchTool:l["Landing Page"]="Workspace Search",l["Landing Page URL"]="https://www.kapwing.com/search";break;default:l["Landing Page"]="undefined",l["Landing Page URL"]="undefined";break}n&&(l["Template Source"]=n),a&&a.user&&(l["Project Owner Email"]=a.user.email);const{interval:d,status:c}=await va(),u=Ao(),h=fo();l["Team ID"]=u?u._id:"None",l["Current Plan"]=h.name,l["Monthly/Annual"]=d,l["Subscription Status"]=c,l["Quantity Legacy Members"]=0,l["Number of Workspace Members"]=u?.users?.length||0,ce("Started Editing",l),Gi("Started Editing")}async function E6(e,t){const{interval:o,status:r}=await va(),s=Ao(),a=fo();ce("Download File",{"Is Signed In":e,"Team ID":s?s._id:"None","Current Plan":a.type,"Monthly/Annual":o,"Subscription Status":r,"Quantity Legacy Members":0,"Number of Worksp
3ace Members":s?s.users.length:0,"Entry Point":t})}const C6=async e=>{const{state:t}=I(),o=e.workspaceId,r=o?ua(t,o):void 0;let s,a=r?.type;try{!r&&o&&(a=await ep(o))}catch(i){console.error("Failed to fetch folder type",i)}switch(a){case Zo.personal:s="Private";break;case Zo.team:s="Team";break}const n={"Is Team Member":Ni(e.teamId??""),"Is Project Owner":Qi(e.creatorId??"")};s&&(n["Project Location"]=s),ce("Access Final Video Page",n)},np=`poster-${Nt(5)}`,x6=async({exportLocation:e,video:t,exportSettings:o})=>(sp({exportLocation:e,exportSettings:o,video:t}),await ne.video.videoCreationExport.mutate({video:t,exportSettings:o})),k6=async({source:e,video:t,workflowId:o})=>(cc({newFolderId:t.workspaceId,videoId:void 0,source:e,stateBeforeCopy:I().state,workflowId:o}),await ne.video.videoCreationCreate.mutate({video:t}));function Vn(e){return e.map(t=>to(t)?[tl(t),bl(t)]:[t]).flat()}const dp=Re(ie,e=>Vn(e));var lp=ae(mi());const cp=e=>{if(!e.position)return-1;const t=parseFloat(e.position.x),o=parseFloat(e.position.y),r=parseFloat(e.position.width),s=parseFloat(e.position.height),a=Xt(t,0,100),n=Xt(o,0,100),i=Xt(t+r,0,100),l=Xt(o+s,0,100);return(i-a)*(l-n)/100},up=e=>{let t=null,o=0;for(const r of e)if(!r.isHidden&&Oa(r)){const s=cp(r);(s>o||s===o&&t?.name!==np)&&(t=r,o=s)}return{layer:t,percent:o}},hp=(e,t,o)=>{let r={x:"-5%",y:"-5%",width:"110%",height:"110%",rotation:0,flip:e.position?.flip};if(e.position?.rotation){r.rotation=e.position.rotation;const a=r.rotation*Math.PI/180,n=I().state.studio.width||100,i=I().state.studio.height||100,l=e.width??n,d=e.height??i,c=1.1*Math.max(Math.abs(Math.cos(a))+i/n*Math.abs(Math.sin(a)),l/d*(Math.abs(Math.sin(a))+i/n*Math.abs(Math.cos(a)))),u=Math.round(c*100),h=Math.round(c*d/l*100);r.width=`${u}%`,r.height=`${h}%`,r.x=`${(100-u)/2}%`,r.y=`${(100-h)/2}%`}const s={...e,id:`blurred-layer-${(0,lp.v4)()}`,originalLayerId:e.id,filters:{...e.filters,blurBackground:5},position:r,crop:void 0,borderRadius:{relative:"0%"},animation:void 0,isCanvasBlurLayer:!0,blurBg:!1,removeBg:!1,depth:nl};if(e.type==="video"){s.isMuted=!0;const a=e.playbackRate??1,n=e.startTime??0,i=(e.endTime??e.duration??0)-n,l=t-(e.videoDelay??0),d=o-(e.videoDelay??0),c=l/(i/a),u=d/(i/a);s.startTime=n+c*i,s.endTime=n+u*i,s.videoDelay=t}else s.startTime=t,s.endTime=o;return s};var pp=e=>{const t=[];return e.forEach(o=>{const{layer:r,percent:s}=up(o.layers);s>=99||r!==null&&t.push({layer:hp(r,o.startTime,o.endTime),startTime:o.startTime,endTime:o.endTime})}),t};const mp=e=>pp(tu(e));var fp=[];const R6=Re(e=>e,e=>{const t=Vn(e);return t.length===0?fp:mp(t.filter(Oa))}),Oa=e=>(e.type==="video"||e.type==="image")&&e.canvasBlurValid===void 0||e.canvasBlurValid,L6=()=>{const{state:e}=I();return!dp(e).every(t=>!Oa(t))};function D6(){return/^((?!chrome|android).)*safari/i.test(window&&window.navigator&&window.navigator.userAgent||"")}var js=(e,t)=>{const o=()=>{e.state==="suspended"&&e.resume(),window.removeEventListener("pointerdown",o),window.removeEventListener("keydown",o)};window.addEventListener("pointerdown",o,{signal:t}),window.addEventListener("keydown",o,{signal:t})},Gn=e=>{const t=new AudioContext,o=new AbortController;return t.state==="suspended"&&js(t,o.signal),t.addEventListener("statechange",function(){switch(this.state){case"closed":o.abort(),e();break;case"suspended":console.warn("warning: I don't think audiocontext should ever be suspended after it gets enabled??"),js(this,o.signal);break}},{signal:o.signal}),t},Vo;const M6=()=>(Vo==null&&(Vo=Gn(()=>{Vo=void 0})),Vo);var ir=new WeakMap,Ba=new WeakMap;const U6=e=>{const t=ir.get(e);t&&(ir.delete(e),Ba.delete(e),t.compressor.disconnect(),t.source.disconnect(),t.gainNode.disconnect(),t.context.close())},gp=e=>xl(ir,e,{insert(){const t=Gn(()=>{ir.delete(e),e.dispatchEvent(new Event("destroyThisElementPlease"))}),o=t.createMediaElementSource(e),r=t.createGain(),s=t.createDynamicsCompressor();return o.connect(s),s.connect(r),r.connect(t.destination),{context:t,source:o,compressor:s,gainNode:r}}}),P6=e=>{e.paused&&!e.muted&&(e.muted=!0),e.addEventListener("pause",function(){this.muted=!0}
3),e.addEventListener("play",function(){const o=Ba.get(this),r=o==null?!1:o===0;r!==this.muted&&(this.muted=r)})},O6=(e,t)=>{if(Ba.set(e,t),!e.paused){const o=t===0;e.muted!==o&&(e.muted=o)}if(e.crossOrigin==null||Tl()){const o=Xt(t,0,1);if(ns(e.volume,o,.01))return;e.volume=o}else{e.volume!==1&&(e.volume=1);const{gainNode:o}=gp(e);if(ns(o.gain.value,t,.01))return;o.gain.value=t}};function B6(e){return Math.pow(10,e/20)}var F6=class{_cancelled=!1;cancelledPromise;resolveCancelled;constructor(){this.cancelledPromise=new Promise(e=>{this.resolveCancelled=e})}cancel(){this._cancelled||(this._cancelled=!0,this.resolveCancelled?.())}reset(){this._cancelled=!1,this.cancelledPromise=new Promise(e=>{this.resolveCancelled=e})}waitForCancelled(){return this.cancelledPromise}get cancelled(){return this._cancelled}};async function j6(e){const t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip")).getReader(),o=[];let r=await t.read();for(;!r.done;)o.push(r.value),r=await t.read();return t.releaseLock(),new Blob(o)}async function N6(e){const t=e.stream().pipeThrough(new DecompressionStream("gzip")).getReader(),o=new TextDecoder;let r="";for(;;){const{done:s,value:a}=await t.read();if(s)break;r+=o.decode(a)}return r}const Ap=async({manager:e,properties:t={},propertiesAfterTypeDetermined:o=()=>({}),replaceInfo:r,droppedTrackInfo:s})=>{const a=await ka(e.file,{...t,uploadId:e.layer.uploadId}),n=o(a);return n?So({newLayer:{...a,...n},options:{undoable:!0,knownTimelineRow:t.timelineRow!==void 0,droppedTrackInfo:s},replaceInfo:r}):null},V6=async({uploadId:e,properties:t={},replaceInfo:o,droppedTrackInfo:r})=>{const{state:s}=I(),a=s.uploadStatuses?.[e]?.uploadManager;a&&await Ap({manager:a,properties:t,replaceInfo:o,droppedTrackInfo:r})};var Kn=e=>{const{state:t}=I(),o=Tn(t.assets.byId,e);return o.size===0?[]:Bt().filter(r=>r.asset_id&&o.has(r.asset_id)).map(r=>r.id)};const G6=e=>{const{dispatch:t,state:o}=I();Ot({layerIds:Bt().filter(r=>e._id===r.cmlFileId).map(r=>r.id).concat(e.asset_id?Kn(e.asset_id):[]),source:"studioRemoveCMLFile"}),t(ji(e._id,o.studio._id))},K6=async e=>{const{dispatch:t}=I();Ot({layerIds:Bt().filter(o=>e.asset_id===o.asset_id).map(o=>o.id).concat(Kn(e.asset_id)),source:"studioRemoveVideoAsset"}),await nn(e._id),t(Xi(e._id)),t(tn(e))},W6=e=>{Ot({layerIds:Bt().filter(t=>e===t.uploadId).map(t=>t.id),source:"studioRemoveUploadingCMLFile"}),ar(e)},H6=()=>{const{dispatch:e,state:t}=I(),{CMLFiles:{byId:o},studio:{_id:r,thisProjectCMLFiles:s},videoAssets:{byId:a},uploadStatuses:n={}}=t;if(vt(t,St.ENABLE_TEAM_ASSETS)){const d=new Set(Object.values(a).map(c=>c.asset_id));if(d.size===0)return;Ot({layerIds:Bt().filter(c=>c.asset_id&&d.has(c.asset_id)).map(c=>c.id),source:"studioRemoveAllThisProject"}),Object.values(a).forEach(c=>{nn(c._id).then(({success:u})=>{u&&(e(Xi(c._id)),e(tn(c)))}).catch(u=>{console.error("Failed to delete video asset",u)})}),Object.entries(n).forEach(([c,u])=>{u.stage!==Ce.done&&ar(c)});return}if(!s)return;const i=Object.values(s).map(d=>d.cmlFileId),l=new Set(i);Ot({layerIds:Bt().filter(d=>d.cmlFileId&&l.has(d.cmlFileId)).map(d=>d.id),source:"studioRemoveAllThisProject"}),Object.values(s).forEach(({cmlFileId:d})=>{const c=o[d];c&&e(ji(c._id,r))}),Object.entries(n).forEach(([d,c])=>{c.stage!==Ce.done&&ar(d)})},q6=({layerProperties:e,textPreset:t,replaceInfo:o,droppedTrackInfo:r})=>{const s={};Object.keys(e).forEach(a=>{const n=a,i=e[n];i!==void 0&&(s[n]=i)}),xh({preset:t,overrides:s,replaceInfo:o,droppedTrackInfo:r})},$6=({layerProperties:e,textTemplate:t,droppedTrackInfo:o})=>{const r={};Object.keys(e).forEach(s=>{const a=s,n=e[a];n!==void 0&&(r[a]=n)}),Q3({template:t,undoable:!0,overrides:e,droppedTrackInfo:o})},Y6=async({dndAsset:e,layerProperties:t={},idOfLayerToReplace:o,droppedTrackInfo:r})=>{const{url:s,query:a,urlSource:n,name:i,actionSource:l,mediaType:d,bRollLayerSource:c,usedProFeature:u,width:h,height:A}=e,g=d===de.Video;let y;g&&"videoDelay"in t&&(y=t.videoDelay);const b=t.startTime||t.endTime;!g&&b&&(y=t.startTime);const _={layerProperties:{addedLayerFrom:{source:l,query:a},name:i,bRollLayerSource:c,usedProFeatures:u?[u]:void 0,type:g?de.Video:de.Image,width:h,height:A,...t},replaceInfo:o?{idOfLayerToReplace:o,entryPoint:"Drag and Drop",mediaSource:"Media Library"}:void 0,useCustomVideoDelay:y,droppedTrackInfo:r};if(g){const S=e,T=S.videoRef?.current,w=T?.duration??S.duration,x=T?await Mc(T):!1;_.mediaInfo={type:de.Video,duration:w,hasAudio:x,width:h,height:A},_.layerProperties.duration=w,o||(_.layerProperties.endTime=w)}return n&&ce(g?"Add layer from video search":"Add layer from image search",{source:n}),Ro({url:s,options:_})};function Wn(e){const{background:t}=e;if(!t)return null;const o=Bl(t);if(!o)return null;const{r,g:s,b:a}=o;return{background:t,gradientStyleColor:`rgba(${r}, ${s}, ${a}, 0.2)`,glowingStyleColor:`rgba(${r}, ${s}, ${a}, 0.9)`,backgroundStyleColor:`rgba(${r}, ${s}, ${a}, 0.2)`}}function yp(e,t,o=!1){const{progressBarStyle:r}=e,s=Wn(e);if(!s)return;const{background:a,gradientStyleColor:n}=s;if(!r||r==="solid"||r==="glowing")return a;
3if(r==="gradient")return`linear-gradient(to right, ${n}, ${s.background})`;if(o)return a;const i=`${t*100}%`;return`linear-gradient(to right, ${`${a} 0% ${i}`}, ${`${s.backgroundStyleColor} ${i} 100%`})`}function z6(e,t,o=!1){const r=Wn(e);return{containerDivStyles:r&&e.progressBarStyle==="glowing"?{filter:`drop-shadow(0px 0px 12px ${r.glowingStyleColor})`}:null,progressBarStyles:{background:yp(e,t,o)}}}const Q6=(e,t)=>e<0||e>64?!1:e<8?!!(t[0]&1<<e):e<16?!!(t[1]&1<<e-8):e<24?!!(t[2]&1<<e-16):!!(t[3]&1<<e-24),J6=({blurPixels:e,image:t,createCanvas:o=(a,n)=>{const i=document.createElement("canvas");return i.width=a,i.height=n,i},width:r,height:s})=>{if(!("width"in t)||!("height"in t)||typeof t.width!="number"||typeof t.height!="number")throw Error("Unexpected SVG image");const[a,n]=[r||t.width,s||t.height],i=3*e,l=o(a+i*2,n+i*2),d=l.getContext("2d");if(!d)throw Error("Failed to create canvas ctx");const[c,u,h,A,g,y,b]=[t.width,t.height,a,n,i,a+i,n+i];return d.drawImage(t,0,0,c,1,g,0,h,g),d.drawImage(t,0,u-1,c,1,g,b,h,g),d.drawImage(t,0,0,1,u,0,g,g,A),d.drawImage(t,c-1,0,1,u,y,g,g,A),d.drawImage(t,0,0,1,1,0,0,g,g),d.drawImage(t,c-1,0,1,1,y,0,g,g),d.drawImage(t,0,u-1,1,1,0,b,g,g),d.drawImage(t,c-1,u-1,1,1,y,b,g,g),d.drawImage(t,g,g,h,A),[l,i]},X6=(e,t,o,r)=>e<=0||t<=0||o<=0||r<=0?1:Math.min(e/o,t/r);var bp=e=>{const t=e.getContext("2d");if(!t||!e.width||!e.height)return;let o;try{o=t.getImageData(0,0,e.width,e.height)}catch{return}const r=o.data;for(let s=3;s<r.length;s+=4){const a=(r[s]??0)*10;r[s]=a>255?255:a}t.putImageData(o,0,0)};const Z6=({image:e,crop:t,width:o,height:r,filter:s,alphaRestore:a,createCanvas:n})=>{if(!t.width||!t.height||!e.width||!e.height)return null;const i=n(Math.max(1,Math.round(o)),Math.max(1,Math.round(r))),l=i.getContext("2d");if(!l)return null;l.imageSmoothingEnabled=!0;const d=o/t.width,c=r/t.height;return l.filter=s,l.drawImage(e,-t.x*d,-t.y*c,e.width*d,e.height*c),l.filter="none",a&&bp(i),i};var zt=` 4precision mediump float; 5 6attribute vec2 a_position; 7attribute vec2 a_texCoord; 8varying vec2 v_texCoord; 9 10void main() { 11 gl_Position = vec4(a_position, 0.0, 1.0); 12 v_texCoord = a_texCoord; 13} 14`,_p=` 15precision mediump float; 16 17varying vec2 v_texCoord; 18uniform sampler2D u_texture; 19uniform vec2 u_direction; 20 21void main() { 22 vec4 color = texture2D(u_texture, v_texCoord) * 0.2270270270; 23 color += texture2D(u_texture, v_texCoord + u_direction * 1.3846153846) * 0.3162162162; 24 color += texture2D(u_texture, v_texCoord - u_direction * 1.3846153846) * 0.3162162162; 25 color += texture2D(u_texture, v_texCoord + u_direction * 3.2307692308) * 0.0702702703; 26 color += texture2D(u_texture, v_texCoord - u_direction * 3.2307692308) * 0.0702702703; 27 gl_FragColor = color; 28} 29`,Ip=` 30precision mediump float; 31 32varying vec2 v_texCoord; 33uniform sampler2D u_texture; 34uniform vec2 u_pixelStep; 35 36void main() { 37 vec2 stepSize = max(u_pixelStep, vec2(0.0001, 0.0001)); 38 vec2 pixelatedCoord = (floor(v_texCoord / stepSize) + 0.5) * stepSize; 39 pixelatedCoord = clamp(pixelatedCoord, stepSize * 0.5, vec2(1.0) - stepSize * 0.5); 40 gl_FragColor = texture2D(u_texture, pixelatedCoord); 41} 42`,Tp=` 43precision mediump float; 44 45varying vec2 v_texCoord; 46uniform sampler2D u_texture; 47uniform float u_threshold; 48uniform float u_invert; 49 50float getMaskValue(vec4 color) { 51 return max(max(color.r, color.g), color.b); 52} 53 54void main() { 55 float maskValue = getMaskValue(texture2D(u_texture, v_texCoord)); 56 float thresholded = step(u_threshold, maskValue); 57 58 if (u_invert > 0.5) { 59 thresholded = 1.0 - thresholded; 60 } 61 62 gl_FragColor = vec4(vec3(thresholded), 1.0); 63} 64`,Hn=1.15,Ns=8/255,vp=` 65precision mediump float; 66 67varying vec2 v_texCoord; 68uniform sampler2D u_source; 69uniform sampler2D u_blurred; 70uniform sampler2D u_mask; 71uniform sampler2D u_featheredMask; 72uniform float u_hasFeatheredMask; 73uniform float u_invertMask; 74 75float getMaskValue(vec4 color) { 76 return max(max(color.r, color.g), color.b); 77} 78 79void main() { 80 vec4 sourceColor = texture2D(u_source, v_texCoord); 81 vec4 blurredColor = texture2D(u_blurred, v_texCoord); 82 float maskValue = getMaskValue(texture2D(u_mask, v_texCoord)); 83 float featheredMaskValue = maskValue; 84 85 if (u_hasFeatheredMask > 0.5) { 86 featheredMaskValue = getMaskValue(texture2D(u_featheredMask, v_texCoord)); 87 } 88 89 if (u_invertMask > 0.5) { 90 maskValue = 1.0 - maskValue; 91 featheredMaskValue = 1.0 - featheredMaskValue; 92 } 93 94 float alpha = min(1.0, featheredMaskValue * ${Hn.toFixed(2)}); 95 96 gl_FragColor = vec4(mix(sourceColor.rgb, blurredColor.rgb, alpha), sourceColor.a); 97} 98`,Sp=` 99precision mediump float; 100 101varying vec2 v_texCoord; 102uniform sampler2D u_source; 103uniform sampler2D u_mask; 104uniform sampler2D u_featheredMask; 105uniform float u_hasFeatheredMask; 106 107float getMaskValue(vec4 color) {
108 return max(max(color.r, color.g), color.b); 109} 110 111void main() { 112 vec4 sourceColor = texture2D(u_source, v_texCoord); 113 float featheredMaskValue = getMaskValue(texture2D(u_mask, v_texCoord)); 114 115 if (u_hasFeatheredMask > 0.5) { 116 featheredMaskValue = getMaskValue(texture2D(u_featheredMask, v_texCoord)); 117 } 118 119 float alpha = min(1.0, featheredMaskValue * ${Hn.toFixed(2)}); 120 121 gl_FragColor = vec4(sourceColor.rgb, sourceColor.a * alpha); 122} 123`,Vs=640,Gs=new WeakMap;function Ks(e,t,o){const r=e.createShader(t);return r?(e.shaderSource(r,o),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(console.error(e.getShaderInfoLog(r)),e.deleteShader(r),null)):null}function Qt(e,t,o){const r=Ks(e,e.VERTEX_SHADER,t),s=Ks(e,e.FRAGMENT_SHADER,o);if(!r||!s)return null;const a=e.createProgram();return a?(e.attachShader(a,r),e.attachShader(a,s),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)?{program:a,positionLocation:e.getAttribLocation(a,"a_position"),texCoordLocation:e.getAttribLocation(a,"a_texCoord")}:(console.error(e.getProgramInfoLog(a)),e.deleteProgram(a),null)):null}function oa(e){const t=e.createTexture();return t?(e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),t):null}function Me(e,t,o,r){return t.texture||(t.texture=oa(e)),t.framebuffer||(t.framebuffer=e.createFramebuffer()),!t.texture||!t.framebuffer?!1:t.width===o&&t.height===r?!0:(e.bindTexture(e.TEXTURE_2D,t.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,o,r,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindFramebuffer(e.FRAMEBUFFER,t.framebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.texture,0),t.width=o,t.height=r,e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE)}function wp(e,t){t.positionBuffer||(t.positionBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,t.positionBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW)),t.texCoordBuffer||(t.texCoordBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,t.texCoordBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),e.STATIC_DRAW))}function qt(e,t,o){return wp(e,t),!t.positionBuffer||!t.texCoordBuffer?!1:(e.useProgram(o.program),e.bindBuffer(e.ARRAY_BUFFER,t.positionBuffer),e.enableVertexAttribArray(o.positionLocation),e.vertexAttribPointer(o.positionLocation,2,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,t.texCoordBuffer),e.enableVertexAttribArray(o.texCoordLocation),e.vertexAttribPointer(o.texCoordLocation,2,e.FLOAT,!1,0,0),!0)}function Fa(e){const t=Gs.get(e);if(t)return t;const o=Qt(e,zt,_p),r=Qt(e,zt,Ip),s=Qt(e,zt,Tp),a=Qt(e,zt,vp),n=Qt(e,zt,Sp);if(!o||!r||!s||!a||!n)return null;const i={blurProgram:o,pixelateProgram:r,thresholdProgram:s,compositeProgram:a,cutoutCompositeProgram:n,positionBuffer:null,texCoordBuffer:null,sourceTexture:oa(e),maskTexture:oa(e),pingA:{framebuffer:null,texture:null,width:0,height:0},pingB:{framebuffer:null,texture:null,width:0,height:0},maskA:{framebuffer:null,texture:null,width:0,height:0},maskB:{framebuffer:null,texture:null,width:0,height:0},featherA:{framebuffer:null,texture:null,width:0,height:0},featherB:{framebuffer:null,texture:null,width:0,height:0}};return!i.sourceTexture||!i.maskTexture?null:(Gs.set(e,i),i)}function Ft(e,t,o){return t?(e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),!0):!1}function Ue(e,t,o,r){!t||!r||(e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_2D,t),e.uniform1i(r,o))}function _t(e,t,o,r){e.bindFramebuffer(e.FRAMEBUFFER,t?.framebuffer||null),e.viewport(0,0,o,r),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)}function qn(e){return e<=0?0:Math.min(6,Math.max(1,Math.ceil(e/8)))}function Ws(e,t){return Math.max(1,e/Math.max(1,qn(e)))/t}function ja(e,t){const o=Math.max(e,t);if(o<=Vs)return{width:e,height:t,scale:1};const r=Vs/o;return{width:Math.max(1,Math.round(e*r)),height:Math.max(1,Math.round(t*r)),scale:r}}function jt({gl:e,state:t,texture:o,targetA:r,targetB:s,width:a,height:n,amount:i}){if(!qt(e,t,t.blurProgram))return o;const l=e.getUniformLocation(t.blurProgram.program,"u_texture"),d=e.getUniformLocation(t.blurProgram.program,"u_direction"),c=qn(i);if(!c||l===null||d===null)return o;let u=o;const h=Ws(i,a),A=Ws(i,n);for(let g=0;g<c;g+=1)_t(e,r,a,n),Ue(e,u,0,l),e.uniform2f(d,h,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),_t(e,s,a,n),Ue(e,r.texture,0,l),e.uniform2f(d,0,A),e.drawArrays(e.TRIANGLE_STRIP,0,4),u=s.texture;return u}function Ep({gl:e,state:t,texture:o,target:r,width:s,height:a,pixelAmount:n}){if(!qt(e,t,t.pixelateProgram))return o;const i=e.getUniformLocation(t.pixelateProgram.program,"u_texture"),l=e.getUniformLocation(t.pixelateProgram.program,"u_pixelStep");return i===null||l===null?o:(_t(e,r,s,a),Ue(e,o,0,i),e.uniform2f(l,Math.min(1,Math.max(1/s,n/s)),Math.min(1,Math.max(1/a,n/a))),e.drawArrays(e.TRIANGLE_STRIP,0,4),r.texture)}function Or({gl:e,state:t,texture:o,target:r,width:s,height:a,threshold:n,invert:i=!1}){if(!o||!qt(e,t,t.thresholdProgram))return o;const l=e.getUniformLocation(t.thresholdProgram.program,"u_texture"),d=e.getUniformLocation(t.thresholdProgram.program,"u_threshold"),c=e.getUniformLocation(t.thresholdProgram.program,"u_invert");return l===null||d===null||c===null?o:(_t(e,r,s,a),Ue(e,o,0,l),e.uniform1f(d,n),e.uniform1f(c,i?1:0),e.drawArrays(e.TRIANGLE_STRIP,0,4),r.texture)}function Na({gl:e,state:t,width:o,height:r,expandAmount:s}){return t.maskTexture?s===0?t.maskTexture:s<0?Or({gl:e,state:t,texture:jt({gl:e,state:t,texture:Or({gl:e,state:t,texture:t.maskTexture,target:t.featherA,width:o,height:r,threshold:.5,invert:!0}),targetA:t.maskA,targetB:t.maskB,width:o,height:r,amount:Math.max(1,Math.abs(s))}),target:t.featherB,width:o,height:r,threshold:Ns,invert:!0}):Or({gl:e,state:t,texture:jt({gl:e,state:t,texture:t.maskTexture,targetA:t.maskA,targetB:t.maskB,width:o,height:r,amount:Math.max(1,Math.abs(s))}),target:t.featherA,width:o,height:r,threshold:Ns,invert:!1}):null}function ef({gl:e,source:t,mask:o,blurAmount:r,expandAmount:s,featherAmount:a,invertMask:n}){const i=Fa(e);if(!i)return!1;const l=e.canvas.width,d=e.canvas.height;if(!l||!d)return!1;const c=ja(l,d),u=Math.max(1,r*c.scale),h=s*c.scale,A=Math.max(0,(a??0)*c.scale);if(!Me(e,i.pingA,c.width,c.height)||!Me(e,i.pingB,c.width,c.height)||!Me(e,i.maskA,c.width,c.height)||!Me(e,i.maskB,c.width,c.height)||!Me(e,i.featherA,c.width,c.height)||!Me(e,i.featherB,c.width,c.height)||(e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),!Ft(e,i.sourceTexture,t)||!Ft(e,i.maskTexture,o)))return!1;const g=jt({gl:e,state:i,texture:i.sourceTexture,targetA:i.pingA,targetB:i.pingB,width:c.width,height:c.height,amount:u}),y=Na({gl:e,state:i,width:c.width,height:c.height,expandAmount:h}),b=A>0?jt({gl:e,state:i,texture:y,targetA:i.maskA,targetB:i.maskB,width:c.width,height:c.height,amount:A}):y;if(!qt(e,i,i.compositeProgram))return!1;_t(e,null,l,d);const _=e.getUniformLocation(i.compositeProgram.program,"u_source"),S=e.getUniformLocation(i.compositeProgram.program,"u_blurred"),T=e.getUniformLocation(i.compositeProgram.program,"u_mask"),w=e.getUniformLocation(i.compositeProgram.program,"u_featheredMask"),x=e.getUniformLocation(i.compositeProgram.program,"u_hasFeatheredMask"),k=e.getUniformLocation(i.compositeProgram.program,"u_invertMask");return _===null||S===null||T===null||w===null||x===null||k===null?!1:(Ue(e,i.sourceTexture,0,_),Ue(e,g,1,S),Ue(e,y,2,T),Ue(e,b,4,w),e.uniform1f(x,A>0?1:0),e.uniform1f(k,n?1:0),e.drawArrays(e.TRIANGLE_STRIP,0,4),!0)}function tf({gl:e,source:t,mask:o,expandAmount:r,featherAmount:s}){const a=Fa(e);if(!a)return!1;const n=e.canvas.width,i=e.canvas.height;if(!n||!i)return!1;const l=ja(n,i),d=(r??0)*l.scale,c=Math.max(0,(s??0)*l.scale);if(!Me(e,a.featherA,l.width,l.height)||!Me(e,a.featherB,l.width,l.height)||!Me(e,a.maskA,l.width,l.height)||!Me(e,a.maskB,l.width,l.height)||(e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),!Ft(e,a.sourceTexture,t)||!Ft(e,a.maskTexture,o)))return!1;const u=Na({gl:e,state:a,width:l.width,height:l.height,expandAmount:d}),h=c>0?jt({gl:e,state:a,texture:u,targetA:a.maskA,targetB:a.maskB,width:l.width,height:l.height,amount:c}):u;if(!qt(e,a,a.cutoutCompositeProgram))return!1;_t(e,null,n,i);const A=e.getUniformLocation(a.cutoutCompositeProgram.program,"u_source"),g=e.getUniformLocation(a.cutoutCompositeProgram.program,"u_mask"),y=e.getUniformLocation(a.cutoutCompositeProgram.program,"u_featheredMask"),b=e.getUniformLocation(a.cutoutCompositeProgram.program,"u_hasFeatheredMask");return A===null||g===null||y===null||b===null?!1:(Ue(e,a.sourceTexture,0,A),Ue(e,u,1,g),Ue(e,h,3,y),e.uniform1f(b,c>0?1:0),e.drawArrays(e.TRIANGLE_STRIP,0,4),!0)}function of({gl:e,source:t,mask:o,expandAmount:r,featherAmount:s,pixelateAmou
123nt:a=18,invertMask:n}){const i=Fa(e);if(!i)return!1;const l=e.canvas.width,d=e.canvas.height;if(!l||!d)return!1;const c=ja(l,d),u=(r??0)*c.scale,h=Math.max(0,(s??0)*c.scale),A=Math.max(1,Math.round(a*c.scale));if(!Me(e,i.pingA,c.width,c.height)||!Me(e,i.maskA,c.width,c.height)||!Me(e,i.maskB,c.width,c.height)||!Me(e,i.featherA,c.width,c.height)||!Me(e,i.featherB,c.width,c.height)||(e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),!Ft(e,i.sourceTexture,t)||!Ft(e,i.maskTexture,o)))return!1;const g=Ep({gl:e,state:i,texture:i.sourceTexture,target:i.pingA,width:c.width,height:c.height,pixelAmount:A}),y=Na({gl:e,state:i,width:c.width,height:c.height,expandAmount:u}),b=h>0?jt({gl:e,state:i,texture:y,targetA:i.maskA,targetB:i.maskB,width:c.width,height:c.height,amount:h}):y;if(!qt(e,i,i.compositeProgram))return!1;_t(e,null,l,d);const _=e.getUniformLocation(i.compositeProgram.program,"u_source"),S=e.getUniformLocation(i.compositeProgram.program,"u_blurred"),T=e.getUniformLocation(i.compositeProgram.program,"u_mask"),w=e.getUniformLocation(i.compositeProgram.program,"u_featheredMask"),x=e.getUniformLocation(i.compositeProgram.program,"u_hasFeatheredMask"),k=e.getUniformLocation(i.compositeProgram.program,"u_invertMask");return _===null||S===null||T===null||w===null||x===null||k===null?!1:(Ue(e,i.sourceTexture,0,_),Ue(e,g,1,S),Ue(e,y,2,T),Ue(e,b,4,w),e.uniform1f(x,h>0?1:0),e.uniform1f(k,n?1:0),e.drawArrays(e.TRIANGLE_STRIP,0,4),!0)}const Cp=(e,t)=>{const{state:o}=I(),{draggedTracksOverrides:r}=o.studioLocal,s=pl(e),a=!!r?.overrides[e.id];let n=1;e.playbackRate&&(n=e.playbackRate);let i=t;return i-=e.videoDelay||0,i>s&&!a&&(i%=s),i*=n,i+=e.startTime||0,e.isReversed&&(i=e.duration-i),i},rf=async(e,t,o,r)=>{let s=Cp(e,o);if(s>=t.duration&&(_l(e)?s%=t.duration:s=t.duration-.01),e.isReversed){const a=e.duration-s;r&&(r.currentTime=a)}await n1(t,s)},af=()=>!Nl();var xp=.0028,kp=1,Rp=.34,Lp=1,Dp=.0033,Mp=1,Up=.34,Pp=1,Hs=.01,qs=.1,Op=.005,Bp=1,Fp=2,jp=.8,Np=255,Vp=.005,Gp=1,Kp=2,Wp=.8,Hp=255,qp=10,Jt=50,$p=2,Go=50,Br=10,Va=e=>e==="studio"?{WAVE_STYLE_BAR_WIDTH:Dp,MIN_WAVE_STYLE_BAR_WIDTH:Mp,WAVE_STYLE_BAR_HEIGHT:Up,WAVE_STYLE_OFFSET:Pp,BAR_STYLE_BAR_WIDTH:Vp,MIN_BAR_STYLE_BAR_WIDTH:Gp,BAR_STYLE_SPACING:Kp,BAR_STYLE_BAR_HEIGHT:Wp,NORMALIZED_FREQUENCY_RANGE:Hp,CIRCLE_STYLE_BAR_WIDTH:Hs,CIRCLE_STYLE_BAR_HEIGHT:qs}:{WAVE_STYLE_BAR_WIDTH:xp,MIN_WAVE_STYLE_BAR_WIDTH:kp,WAVE_STYLE_BAR_HEIGHT:Rp,WAVE_STYLE_OFFSET:Lp,BAR_STYLE_BAR_WIDTH:Op,MIN_BAR_STYLE_BAR_WIDTH:Bp,BAR_STYLE_SPACING:Fp,BAR_STYLE_BAR_HEIGHT:jp,NORMALIZED_FREQUENCY_RANGE:Np,CIRCLE_STYLE_BAR_WIDTH:Hs,CIRCLE_STYLE_BAR_HEIGHT:qs};const Yp=({ctx:e,frequencyData:t,layerWidth:o,layerHeight:r,layer:s,source:a})=>{const{WAVE_STYLE_BAR_WIDTH:n,MIN_WAVE_STYLE_BAR_WIDTH:i,WAVE_STYLE_BAR_HEIGHT:l,WAVE_STYLE_OFFSET:d,NORMALIZED_FREQUENCY_RANGE:c}=Va(a),u=o;for(let h=0;h<u;h+=1){const A=t[h];if(!A)continue;const g=Math.floor(o*n)||i,y=h*g;if(y>o)return;const b=r-r/2,_=A/c*r*l;s&&"globalAlpha"in s&&s.globalAlpha!==1?(e.fillRect(y,b,g,-_),e.fillRect(y,b,g,_)):(e.f
123illRect(y,b+d,g,-_),e.fillRect(y,b-d,g,_))}},zp=({ctx:e,frequencyData:t,layerWidth:o,layerHeight:r,source:s})=>{const{CIRCLE_STYLE_BAR_WIDTH:a,CIRCLE_STYLE_BAR_HEIGHT:n,NORMALIZED_FREQUENCY_RANGE:i}=Va(s),l=o/2;for(let d=0;d<l;d+=1){const c=t[d];if(!c)continue;const u=o/2,h=r/2,A=Math.floor(o*a)||3,g=d*A,y=Math.floor(o/A);if(g>o)return;const b=c/i*r*n,_=d/y*2*Math.PI,S=Math.min(o,r)*.2;e.save(),e.translate(u,h),e.rotate(_),e.fillRect(-A/2,-S,A,-b),e.restore()}},$s=({ctx:e,frequencyData:t,layerWidth:o,layerHeight:r,source:s})=>{const{BAR_STYLE_BAR_WIDTH:a,MIN_BAR_STYLE_BAR_WIDTH:n,BAR_STYLE_SPACING:i,BAR_STYLE_BAR_HEIGHT:l,NORMALIZED_FREQUENCY_RANGE:d}=Va(s),c=o;for(let u=0;u<c;u+=1){const h=t[u];if(!h)continue;const A=Math.floor(o*a)||n,g=u*(A*i);if(g>o)return;const y=r,b=-(h/d*r)*l;e.fillRect(g,y,A,b)}},Qp=({ctx:e,frequencyData:t,layerWidth:o,layerHeight:r})=>{const s=Array(Jt).fill(0);for(let u=0;u<t.length;u+=1){const h=u%Jt,A=t[u];s[h]!==void 0&&(s[h]+=A||0)}const a=Math.min(...s),n=Math.max(...s)-a,i=s.map(u=>Math.floor(qp*(u-a)/n)),l=r,d=o/Jt,c=d/2;for(let u=0;u<Jt;u+=1){const h=i[u]||0,A=u*(o/Jt);for(let g=0;g<h;g+=1){const y=l-g*c;e.fillRect(A,y-g*2,d-$p,-c)}}};var Jp=({ctx:e,x:t,y:o,width:r,height:s,isEven:a})=>{e.lineWidth=1.5,e.beginPath();const n=a?s:-s;e.moveTo(t,o),e.lineTo(t,o+n),e.arc(t+r/2,o+n,r/2,Math.PI,0,a),e.lineTo(t+r,o),e.stroke()};const Xp=({ctx:e,frequencyData:t,layerWidth:o,layerHeight:r})=>{const s=Go,a=Array(s).fill(0);for(let h=0;h<t.length;h+=1){const A=h%s,g=t[h];a[A]!==void 0&&(a[A]+=g||0)}const n=Math.min(...a),i=Math.max(...a)-n,l=20,d=r/5,c=a.map(h=>l+Math.floor(d*(h-n)/i)),u=o/Go;for(let h=0;h<Go;h++){const A=c[h]||0,g=h*(o/Go);let y=r/2+A;y<0&&(y=0),Jp({ctx:e,x:g,y:r/2,width:u,height:A,isEven:(h+1)%2===0})}},Zp=({ctx:e,frequencyData:t,layerWidth:o,layerHeight:r})=>{const s=Br,a=Array(s).fill(0);for(let u=0;u<t.length;u+=1){const h=u%s,A=t[u];a[h]!==void 0&&(a[h]+=A||0)}const n=Math.min(...a),i=Math.max(...a)-n,l=10,d=r/20,c=a.map(u=>l+Math.floor(d*(u-n)/i));for(let u=0;u<Br;u++){const h=c[u]||0,A=(u+.5)*(o/Br),g=r/2;e.beginPath(),e.arc(A,g,h,0,2*Math.PI),e.fill()}},sf=e=>{switch(e){case"wave":return Yp;case"bar":return $s;case"circle":return zp;case"blocks":return Qp;case"snake":return Xp;case"ball":return Zp;default:return $s}},nf=[204.35838132923993,203.00945332832035,199.65900469732605,194.98271845278515,189.56132214289326,183.33473438912372,172.52400430499736,167.07532066537684,187.47065016402843,198.68807545388097,203.48982568521964,204.1176240653317,202.15691732602392,200.06529787993665,199.29780568337057,198.68467837138908,197.26189269581153,195.4906761781706,193.5894680197673,190.99841409170546,187.04933995236826,182.25360885686126,177.63250777500204,173.28407960282425,167.70417685616633,158.76226893469703,144.56500607291406,141.00209952410114,145.56804845329737,145.98247959194708,151.30333957601397,158.65594331047583,163.28351501985006,165.0274425332393,164.56009034724005,162.69563468431807,160.3371300218423,158.2700085578228,157.39999468815182,158.03471062124936,159.09200990304208,159.69089115160511,159.86921679067325,159.6075664376986,158.52087286589776,156.6650151944958,155.10307758735354,154.76731334199766,154.53817469416,152.83946762235234,149.7773929680549,146.91810966789785,145.2304213494264,144.0396936303876,142.34788989257112,140.02924475411893,137.86488379627102,136.94443024999612,137.23038873543342,137.02795358522172,135.09262390148805,131.78995127630665,127.15201700601123,118.07364045259453,92.95048846026552,111.58227970522246,129.45278563115795,138.2921805525958,143.1711053210688,145.54670069071844,146.10057562215798,145.83463815520878,146.36977981790818,148.0554387843523,149.43629769169783,149.03798836610676,145.92771765577686,140.3413699534398,134.16252749146054,130.7483709722678,129.62976562861337,128.55726783363963,128.17372090103626,128.68453448110859,129.61467268224547,131.37936708272957,133.615185772025,134.24522747949015,132.49724810152492,130.3479207101576,132.49438546853943,136.93991181373855,139.66216072746448,140.10834545254787,138.1270546398033,132.51069038452,120.695
12358867721602,89.01754914367318,110.34211587855022,120.83417434236462,122.36200772241834,119.71362583248677,117.22074187792266,119.75264768893518,126.5367395343374,132.2061093130478,133.96693353280494,130.6684966876412,123.6815217863759,126.52157795061277,134.62983091628038,139.3180272591702,140.28667668531253,137.62219818584865,131.98348466528336,124.07663570706792,114.2267694499014,103.44772202882844,92.9584608439638,83.35329993623219,82.46689771012865,75.82770036464417,66.06349703115293,98.03414526793118,111.33889876855572,118.98648423031145,122.54177224513953,122.47951959397489,118.64583070128839,113.87371352182163,119.12974241422387,127.33420020821598,131.46335674969552,131.3822456107658,127.3830481228133,119.37978564347974,107.60067684669835,111.66825278667098,124.05076277537741,131.22772394028615,134.48448788702927,134.7861839517469,131.92539177767685,127.40494750758486,124.68811639326971,123.8965060008981,120.9054998438967,114.88101986961341,109.76176859442026,112.1629841277428,119.27887876494424,124.82951411454222,128.02837046990257,129.85943432178908,131.89986646363,134.2959664200011,135.78516337340758,135.22114124260463,131.84250434163295,126.45507975231583,121.93106290183131,122.11921102289395,126.02335733427888,130.41644177850932,134.06653952639124,136.5638564699891,138.01616957258577,138.23945775755297,136.29941618189454,131.33912440717808,125.33728980410184,126.77827246986509,131.88614297305546,134.5995306065226,136.2399757750571,139.04068907529907,142.9197060262825,145.9078344918701,147.13650225775328,146.41335613205808,143.84972114295687,139.64912794324272,134.3253574737259,129.02642302040337,124.93796462149683,121.5393264193191,117.322732247941,114.73057166609908,118.8452229107018,125.32158129160658,130.25817923584472,133.19297336645127,134.27063636776148,133.61613697497285,131.3563797543291,127.81845352593217,124.49172753170508,123.7513624080227,124.38224504365684,121.98895450367736,114.08596503252865,105.82629767516569,110.88300039306839,119.90552132506646,127.202147201513,131.9667614478077,133.76958758760802,132.70781458819803,129.56830485026168,125.94077414424684,122.38418137561702,117.21442780157889,104.9489244287997,92.05361102549689,112.54203234883539,121.46683920506331,124.38005590514472,123.53852557520595,121.56477951652924,121.33882435595636,122.2275429466472,121.4062971945044,117.93754225866843,112.6971528635918,104.27515467306111,88.6528521160044,96.42663339577929,107.60183673130071,106.82225946173723,88.40507400283728,104.04178637381129,117.95828545895965,122.46746248313711,124.28669381415281,126.67005328527794,129.27522451899023,129.7650229950298,126.52643324838441,118.86804102107371,109.40834958178631,110.93113718338012,114.07121904322369,108.35331346001797,88.96705472009042,100.66853781444378,109.97573475103614,108.08517276324821,95.58895557030422,89.06300976096674,100.91403830932555,104.06730366572654,102.81085812399192,102.27248417282829,109.75997332490616,122.65446694505044,131.27973072984534,134.659499974981,132.34540824765594,122.983550056949,117.08732924209211,129.23091278150616,136.1537186103394,138.83472161916444,139.99022039298902,140.92873074735414,141.4350478891782,140.302255484849,137.183074064597,134.8362750409565,136.08173198415673,137.3102051022957,135.29421222826153,129.14481974035795,120.98443896939034,122.10389522255312,129.55517351459943,133.1448836556803,130.95005729684308,120.2247398448641,88.75300107301513,115.15603565056695,125.57494349672899,129.060984495252,130.1292469749284,130.3401027591469,129.43479875948742,127.3812776144528,128.0007642924076,131.7025425637015,133.04022544791667,130.59201431746015,123.86052071405743,111.95477123616325,105.70885785702148,118.51401850384497,127.74406905646723,132.76569119540864,134.50333751053557,133.95982949270305,133.34831260302562,135.23414699652548,138.76267935057723,141.77778219016764,143.28657189711944,142.627691535347,139.3644825559961,133.4722084696932,125.10044387363267,112.46111177234778,92.09275680431377,116.55997780602732,126.09832147776532,124.7534823951912,110.71875423547183,96.50112043365947,112.4485124681327,113.26506731234124,108.58103656834763,101.99803482567827,97.14913597763675,113.57660886046824,125.21760786245515,131.97504303651732,137.11982745823596,142.19699775863148,146.74299115161836,149.8110840053253,151.14779573703814,151.33695915010136,151.12865162025216,150.500088718598,148.7887948486843,145.75817203220814,142.99623735437788,143.01809980998883,145.25921794002127,146.94978222310706,145.90004561737913,140.90565004641883,132.09016956580749,120.14784234370435,115.32010047236865,127.36594813894344,133.55111744902817,133.779199329228,130.05306182494044,125.02575693885959,122.87310149941793,123.0047656386207,121.46331452528521,117.8741314694841,117.78964041278229,122.5987050435432,125.50729776735199,124.54332009302718,120.16906619959042,114.14090655164526,115.6280158581019,124.03749904425878,128.12242075902333,125.8990361446127,117.54157651579577,109.15688815418844,117.72541720595963,127.23209372584536,131.4583482182636,131.00135069548762,127.335942799752,121.62186226856994,114.22543748940511,114.85572068019748,122.37860097066992,126.59694202163297,127.4986334752324,125.67563125327746,122.00225729495378,119.92276357023357,122.23990555829354,126.51250740094001,129.903949786847,131.71070023688006,131.97553484395505,129.78930892615406,123.78174072681384,116.3424370534271,118.26378107046335,123.7633490117246,125.59327470473724,122.7324601126848,114.68183007149709,101.26825438324576,86.63384744011921,83.21618025600223,92.5882747839233,101.81575376052287,107.16764512838256,109.37281048707132,112.3974640636089,119.9366852918811,127.35884663106289,132.47940283462185,135.70218555776887,137.10112609991162,136.34754082287984,133.0083175599282,126.02857776304094,112.29113303317646,97.16001644870359,111.40431919504549,114.2106564702352,106.30950393288109,94.81430769903297,96.47370642704341,84.92532458224564,60.545487148081754,79.88039774315853,68.67596712239431,89.11906170616737,91.34917675692962,73.856623411296,90.26844758457986,104.1086223795779,111.58070017271665,116.49222512452609,118.90377264729761,118.22411457287104,114.23802667459175,107.40620915533147,100.60987015302861,97.57527844151682,97.34158232256256,98.10290657702991,98.66362467593973,101.7433519346422,106.2073561951195,108.69895880734114,110.8035723792059,112.15569136889091,109.49690243299439,103.93036448482624,100.92628029593007,97.86096217096936,95.66608809626983,101.03380856504565,108.34648051731253,116.07978807883318,123.8283548391442,130.54394791018052,135.56296750803784,138.76204157391325,
123140.13435297163534,139.4593490534493,136.21123380350022,129.43441998628626,117.31101607955178,103.73912043267357,112.44864947671577,118.98964903641227,121.21591071320593,121.98924397601607,122.15980962476785,121.38400859362196,119.26549450974018,116.8959893414305,115.88483515515084,114.78338677210779,112.33315907937443,107.62137119796489,98.73602747048403,87.73038295136323,91.13378536825944,101.16947207803058,106.2253997649699,104.13784134633754,100.52905925732327,105.68729473617451,108.82944337043381,105.65177463603948,99.53348804272758,99.12635127717267,101.89825121460251,104.22530938942084,106.5199998892505,109.53476613473762,113.18969053622115,115.68672529991734,115.68799615105743,113.54259565985197,111.07854773053354,109.34605744693557,106.82092535033571,101.93352157530809,95.15483646585035,85.77495510365729,71.47980071875158,56.42559082770286,37.29837819664849,61.63020725776271,60.59370173495803,29.06580455390409,48.298454080119065,55.25910173785193,49.07081918616964,27.913389433570206,46.06408623486975,65.30229863737705,69.00799421180668,62.951246181167086,78.39628391473362,92.91338861566796,101.18515479771182,107.06300736303153,112.21793848064252,116.14938312247597,118.20778576944683,118.84594635653883,119.06929816454088,119.14718314409345,118.36809783419976,116.29053669089575,113.1890980334156,109.04454487149671,102.72609076505472,92.41500440345374,76.33094400443694,52.15810967929434,60.53209431838238,74.51909568179593,71.77931834367912,39.82659016836722,60.1169244820835,62.52548851218519,62.11074567808925,63.45832055316442,46.8261122989831,57.52269917794884,70.21957081125319,80.99419298885374,93.73663259384219,102.81429704783874,108.98970049077947,114.1615558836602,118.65326487722758,121.47156722067137,121.70532057926238,119.0050512192624,113.91296124678925,108.02487100201645,102.45933706749719,99.47598191566438,103.07457144991398,107.83179905939933,109.71431398958043,111.18776497305835,115.9312322534841,122.2031968088484,127.06021086188508,129.01757233521474,127.38100954224436,121.95378438456284,113.88747930721628,108.24673019657541,108.8848456885361,110.8492682187245,110.54528629513362,106.91146973958499,100.23720183593618,93.09935251508304,88.52204668469803,83.40893002956824,75.3313841827785,73.00260059182122,74.77627146153478,76.25559930918028,84.45871817093106,89.97952576061537,91.3626377391236,91.7720533305402,92.52791684811231,92.58468973705524,90.10201677066587,83.06805232336963,69.79640996980096,59.46018368728643,64.53504442365393,64.72506424680589,48.59176666190088,42.997013594499144,58.400853744202436,49.148725852729285,19.301829008746356,45.525192245861724,34.586577726746604,32.89897205356545,37.35431487600631,39.36070499932478,47.28944881987594,55.80702434942269,58.31379853055729,53.27520107576588,51.77221796539581,59.30468018244898,64.77574569278,63.45891452054705,57.60286625521149,64.7802979806566,76.39692667582972,85.4774034636836,91.17797207425647,93.54958517538748,93.58937200947447,93.20455317792343,93.90957285858832,95.18829374855927,95.20282588854431,94.1588385341336,93.16395918149897,91.64607366999336,88.37909124667785,83.1975774402594,76.5085768647885,68.0130768674399,55.14813057328617,44.67960299230243,66.19961637978649,73.74863121315964,73.14806942281302,70.76269255868576,73.75017282602815,80.37283457139709,87.42884063345399,91.6920197763112,92.84484827437588,93.15688891664955,95.12943817890444,98.85873726821387,102.5135604044542,104.24947206735496,103.74848206676312,101.97082217522741,99.89393393504812,97.42699236602259,93.52313150722814,87.44822165948382,79.08988655073196,68.55796791028351,57.70810591072713,50.239173324672905,44.00139587945284,39.17083257776271,37.56426246163583,31.857100767319398,20.165041089762884,30.798890823664454,32.02446587793886,19.32695305555075,27.48639441172864,10.930601425652121,12.518216720193713,2.623565728612991,22.124740941086785,21.123585398658616,24.3753003574641,30.536378710455626,30.35213053286443,22.59887852402723,11.9977441597185,25.025017367983914,26.00439871228424,18.850166521576575,9.604053766122993,13.011991569025879,7.01229322727204,11.365433863731198,8.7599170980214,15.208450149837269,15.512142053824034,13.521601913144004,15.627891152571781,18.21907486102378,14.10397536331784,6.6846268698
12303753,14.97313805067607,17.469824613321073,9.143059568749683,9.72404561637773,10.913143242930877,11.254267483348588,12.760208164488825,11.77213667443736,11.140989359072801,11.10708686047775,13.140019528204556,14.488009330945031,14.833626779648931,6.488046088213211,16.2637832245964,18.805897212928652,19.046297637613492,19.094705802544446,13.896945197556589,5.927629107022312,4.88997960497853,13.662719862992427,12.802014202571163,15.88131005611988,20.900868342879562,14.231926082696635,3.084827018001512,11.369536829619058,15.940886671074017,11.84259622372541,9.559611031609194,14.878394008099942,16.009889164087866,11.666183139837901,0,12.514914259860406,15.279401813005864,17.800918809356883,21.1931645496907,17.429196777389954,7.843912801881345,5.419655023241892,13.47154206569122,15.202617570591675,10.050371931296217,13.540489467787344,15.464754579117251,11.21828400842651,2.3313856619575697,0,0,7.332534216620066,10.865586005260077,0,2.224326565846797,7.864873951393415,4.891568249139188,6.328567349711326,9.358049038355206,15.130964014834193,15.451401393072944,11.804496346795498,7.581079491398729,11.531322431346336,0,8.785004433259628,9.392121069315627,11.304817166597942,17.287662196476834,16.980347110242366,10.820287423168313,0,2.1537316621570883,12.37549089851758,11.882712849582024,0,0,8.332193257260796,14.52776345255954,15.534839890870575,5.716670958406418,0,9.193888869630946,12.165761627915707,14.438050716725746,10.029858466961555,2.5528491032018263,1.1157600999344226,9.023402532060699,11.84909143756013,10.996168833136753,1.1101978370485968,1.6905400167320037,9.165985999739283,11.476104803759513,6.424915969262808,8.078837643373163,15.305529378163936,11.383243139804426,.2952564977218819,6.767946143193262,12.780993948718079,14.38604755985657,14.007328091697389,3.734705766356697,9.029154344080528,13.815128884049631,18.164041081188802,19.24454885612999,17.615774330925618,11.30736552162138,15.281484694967853,19.860681293473736,14.219040359734858,10.568559653800875,13.531719935107636,6.619084727827993,18.10185293789845,20.20005490406164,12.977800532040959,13.630593272325221,15.613474662488834,1.4071067722403952,5.104100308028737,4.453092250334667,7.950531831873705,12.546181719144284,16.912889584119306,13.611063804511913,0,5.14340750155569,4.168112019595056,7.907150889977693,8.979147446431407,9.426140225224962,13.243225390442396,11.469977914072203,6.748875731042129,12.419333543855343,17.67077925645081,18.880096475694156,17.976945230424562,13.259975924641125,9.110054638830176,13.897020932221713,10.897095324514966,7.8151207360060235,9.849822772927759,11.325162474719361,12.016694841102133,11.961220785443153,17.26423194554651,21.170934171205246,19.36679035480077,10.251257554114659,12.697790518293173,12.226322012316976,8.797966914057117,7.304920597468326,6.035264457772584,9.213676766218406,6.700444658116453,0,9.469079930845345,12.587156119390347,10.245214753239326,0,3.9196260047336264,14.939554766587442,20.32950591396716,17.43295039442306,12.232478269551809,7.075514116679573,11.653567301617436,14.522086687604194,4.999105820822678,8.972467820299194,14.752996098031064,12.58737256922795,8.269772553863397,6.845181399549767,9.453814130341753,6.702038616580293,0,5.248058865577265,9.060301063117464,4.959265667263332,1.6907237601620995,12.1849239447419,10.75358814568625,5.579890828342152,10.25437631919848,8.727296893037195,8.674164699122215,8.654266132067589,17.559192518562003,18.013714536426534,3.19846928252853,15.138023018241498,13.120210256537089,13.25959664576775,14.705757047417212,13.646956860434232,11.4493918726612,14.42216931817045,15.61832623520531,9.588827906656373,13.530472972857197,12.078871233581653,12.325619997935547,16.171122133369753,12.287442774753139,9.18184999018405,15.581479804162036,18.89011269904545,12.610509248201758,4.349945852315997,10.24488560466813,7.227081000118217,5.75185749552973,10.778581893610276,13.024889141559335,1.6624037980402562,0,5.918273781830605,11.381155590038007,13.981295548325248,13.94288510294386,10.133007988991162,2.121248558055799,0,1.9723575884446862,0,3.6330911978320097,0,10.113576400672237,10.40896817062201,0,10.454790827761203,10.174902839382536,0,3.5765172429638006,0,1.6182090693881206,0,1.7447440566893428,10.14584872592788,14.082806239138574,14.13045625770746,11.519994887021749,6.000767441228888,0,1.342626361452378,12.895630837651595,10.65092334647549,5.653708141569734,7.225975812423864,10.279236321645836,4.420118550235051,12.63436625022545,18.90372918109156,15.609480264737144,9.227081575590395,12.28784948291024,16.150819092173037,12.313925939027017,12.108909431418597,13.543631056849733,9.508949273227547,15.512028540224131,14.328925846207822,11.606027192071757,13.781481597455045,14.782072988727856,13.30651238407281,13.1388298848693
12365,15.116653621679085,2.9554299337869274,17.91580710523786,17.470496727492755,8.753478916254254,8.814297997449522,8.777238025275853,10.263800483364781,5.636264759368252,10.794078851559046,12.174723218930296,1.4999538295923966,4.8007532181192625,9.094005719383269,5.504161448330176,0,6.91445360252918,9.53931383986776,6.812469238027456,8.104675064882583,12.402321867359854,14.575215846710353,8.894139055166587,5.41943166165391,14.702972067789473,11.856970622795508,7.31333026934427,12.322306413619625,17.448578513027048,20.310376499547864,14.862257403880673,3.6298947871426073,0,10.22551953701423,12.663942733922736,9.61832375637568,0,6.745343890336374,9.1393486211929,5.781388148243254,6.969392453063516,8.48361378533504,12.179137558366316,12.915935053266153,10.579301518169789,19.476760426918048,21.219739452820882,17.2642243065431,11.862556627260657,11.853653103061724,11.114382480645585,9.604425225673191,7.6263471783133365,10.939435292913382,13.995774524794472,9.214802148624713,13.269349891158216,17.961464275474153,18.8761951030306,17.698161852858053,12.50827264365707,6.932947620998374,11.58021263899969,13.310898121668322,9.484703064785522,9.030022395410246,7.984609496401385,4.285134891752637,5.175920875087389,0,13.47134581762161,16.757700789043493,12.272879876417079,7.605413336393965,4.436834888590431,5.3134281624631585,1.586948407695722,15.628696329790479,13.638049432844555,12.98106684584527
1237,20.19082567242849,18.075206606619627,6.555147116491932,13.552012665837841,10.672208165568314,14.32546649410791,19.931514729626965,15.377797494051292,11.375769236373975,17.588585804754313,19.15950620196171,18.01841039563144,13.588143662169683,9.003820447085538,4.03228667394176,14.040446206569532,14.325258350511012,12.642339255005362,6.742497661212694,.7632554290740886,11.504334170814484,15.332947927875477,8.03418629947505,6.311434613265711,11.402639779964485,9.08442868708418,1.601545623919535,1.3179729309311625,11.175473098509213,12.027947817686973,9.206758553558133,1.3016492801836677,2.486550006182436,9.873629602046508,14.267461740251058,11.989494723427752,9.41420926886248,0,6.207702433978429,15.662305858152648,14.565948407450774,8.191337129018594,0,0,11.59078022260681,12.47321848095627,2.679199564616129,0,10.77357845916403,16.891122441267942,17.1738294458997,11.228060112174784,9.666473753231518,9.186067689083913,0,11.708749974182963,7.648578892756032,11.719897248816912,15.319507064767029,14.968844289851205,9.178167370766324,6.354883478391251,5.0317240483073755,7.875625082238901,2.016429963438845,0,10.81387157350129,7.390275955986494,0,0,2.473783795561967,11.283288373376966,15.494440278723957,13.529264929400577,9.9355770563046,15.074756774232712,13.328369502150904,5.5117560855136665,8.147300916502846,17.538402466378802,21.23247911794689,17.79172658927885,15.18189805300655,12.281546300058944,0,11.647743078165266,16.218227783549956,15.059530854897316,9.791646218821802,12.002311842637019,16.021067746218772,11.394436422577598,2.8364568713671985,14.060141217183588,20.80123791581557,15.77343773482499,12.726059083415214,13.584190131875445,4.713261533825819,6.033935500495772,14.02584255505931,19.162913910339118,19.09196180796629,18.83135815701536,16.263660209745257,6.366220890786104,14.713260017851788,14.321220889923108,13.119121396181448,11.41273340341992,11.490232130794169,12.058640417183204,12.939169262726953,11.333490287597444,10.857884175240345,9.538347399436034,8.87164508142129,17.33526561528871,14.797043625492982,6.303864751177793,14.008458579047376,18.281616804764848,15.714776244389387,13.536078416015936,15.43565038521385,15.085553833964894,8.816838562473114,11.57889252690025,7.243366337808657,13.049992675819164,9.562100439480858,18.8423624821782,26.026230764925945,25.063588495745275,12.088440383270365,22.598703824524417,30.335175370360073,30.507203823934503,24.31575743172064,21.091347153092375,22.192008263984746,2.6921532477189625,12.555925389688039,10.955792349554407,27.496596933783845,19.32309532965342,32.02016781504115,30.79363057915056,20.153705208595028,31.84733432313043,37.55422676155908,39.161318089373836,43.99725905548563,50.239521349711644,57.709945157232774,68.56102072874769,79.09277757582453,87.45022449812227,93.52414032558913,97.42708629345228,99.89326580207333,101.96969528883949,103.74738305478293,104.24929170393897,102.51409565496083,98.85891221948177,95.12889229516455,93.15575142612721,92.84481690448938,91.69353557099636,87.43065766212484,80.37511065919674,73.75278758416235,70.76481546499228,73.1488809356018,73.748251522107,66.19754420726265,44.67055040009078,55.14127984460118,68.00897312875901,76.50577378971266,83.19565707317221,88.37928427891767,91.64707205600125,93.1645549214913,94.15892605231977,95.2024261748412,95.18759292865255,93.90926869773944,93.20519129451228,93.58993179108286,93.54980638035424,91.17789631782823,85.47711109836708,76.39650364258733,64.77967081028163,57.60148341599023,63.457047409979346,64.77373700220063,59.30619115439834,51.77610792645369,53.27738581379225,58.31513815008083,55.809899784465536,47.29546194987288,39.36798475813622,37.358230987929666,32.900513693669474,34.58876357417883,45.52733381871206,19.30418051352355,49.14605651861594,58.39674489502643,42.985076505824125,48.58277552730088,64.72489073088832,64.53855632176429,59.46461446008204,69.79866094213094,83.06895000871368,90.10241292436534,92.58477826421021,92.52767576810614,91.77141536117016,91.36164373019474,89.97832484647684,84.45765489771985,76.25612211802503,74.77793832270372,73.00464769163953,75.33322759939438,83.409989
12367778759,88.52257846445491,93.09950831286169,100.23713376604933,106.91129234333648,110.54503255674483,110.84895308710479,108.88450078687669,108.24640086701157,113.88723795443882,121.95382120919903,127.38124075994413,129.01779133987984,127.06035587666086,122.20320925325537,115.93106559880616,111.18750587058453,109.71416357836468,107.8317384576405,103.07442993273,99.47570439915134,102.45913685400123,108.02480011537054,113.91292131176246,119.00504719734893,121.70543114560706,121.4717871530839,118.65353350928577,114.16181719598866,108.98992131815601,102.8145364807752,93.73710616384784,80.99522436021847,70.22074977909531,57.522235111051,46.820031202418996,63.45379796911414,62.10573859306925,62.522478315454485,60.116833586304146,39.831630797412195,71.7806367413494,74.5199217836516,60.53234686501897,52.15602168536246,76.32972481770639,92.41450363484631,102.72603832002034,109.04463777755306,113.18911196254741,116.29040798264832,118.3678616281676,119.14690593059633,119.06909211625258,118.84607224151263,118.20797609910174,116.14962898219424,112.21827699609415,107.06342747939058,101.18559829646743,92.9137702620287,78.39634865319103,62.949900114705216,69.0062502703019,65.30050053459482,46.064088050295645,27.925213019067385,49.07620602908922,55.26130242039997,48.297181557952335,29.0547768428826,60.59226990706777,61.63229498033179,37.31050251614931,56.42876438016364,71.47969431040048,85.77420915075048,95.15419246153931,101.93312177445505,106.82075655302869,109.34608956875489,111.07870777085459,113.54273215819515,115.68801133344986,115.68660528363839,113.18945966755618,109.53447768330773,106.51968978192635,104.22493771561832,101.89789204190814,99.12657145417897,99.53419272300803,105.65227830143226,108.8297392582113,105.68749484539899,100.52925035881725,104.13800355421641,106.2254843732615,101.16934758006757,91.13304937350996,87.72891307583734,98.7349633067024,107.62097112736863,112.3335144467274,114.78372232892166,115.8850378488818,116.89611504765251,119.26561324794429,121.3841409612775,122.15993185509966,121.98932645564041,121.21593174035927,118.98958046309708,112.44840636612393,103.73853807373665,117.31064469551029,129.43421370886102,136.2111032227428,139.4593666500088,140.13445296046177,138.76213759970432,135.5630320707424,130.54393168059855,123.82818837992177,116.07941747991194,108.34647026968001,101.03456677959765,95.66676904546009,97.86113189561249,100.92602617581143,103.92989096852207,109.49660407900826,112.15584663912672,110.80382908028835,108.69898621387294,106.20701462462121,101.74262759240635,98.66422744858968,98.10394110643142,97.34235283999772,97.57566565538899,100.60994855041994,107.40617250158246,114.23798647603215,118.22408238485863,118.90373163887496,116.49216867904974,111.58068216565138,104.10879697628687,90.26906232119254,73.85763572461435,91.3491361317248,89.11836156706346,68.6726434655926,79.87799282974109,60.54385059908123,84.92760936178982,96.4752001963592,94.81545038646067,106.30970359538547,114.2104747499376,111.40391612227951,97.
12315934129972361,112.29095612707094,126.02848842354501,133.0082159148334,136.34745581511382,137.10109773309034,135.70217756931117,132.47935526768777,127.35878828072931,119.93677584068564,112.39768481660613,109.37303827394014,107.16791080188607,101.81608101208793,92.58847469956677,83.21567458536418,86.63294719282503,101.26812860539339,114.68214557056169,122.7327563809439,125.59348797481894,123.76350402125736,118.26389009957268,116.34245948001073,123.78168323041649,129.78921427083176,131.9754194958146,131.71057816330685,129.90384904754552,126.51249016784601,122.2400326926942,119.92296598384048,122.00238053081277,125.67563725822029,127.49855890937131,126.59682802396568,122.37848723288941,114.85566139586028,114.22547302310696,121.62189039066338,127.33590647591397,131.00124646643715,131.4581964185114,127.23195927702446,117.72549862641351,109.15718761707542,117.5417232792651,125.89906325638462,128.1223527402383,124.03727447364358,115.62748592770117,114.1414572415632,120.16950335825283,124.54351889399076,125.50728589986323,122.59848279111162,117.78921780035344,117.87374702603012,121.46344538503499,123.00503642802835,122.8734071286911,125.0260325714215,130.05322831072004,133.77926904706976,133.55111737490492,127.36586241105557,115.31977487505993,120.14742685497546,132.08991772494053,140.90571592124957,145.90019036520025,146.94986939321637,145.25922677868306,143.01802540646966,142.99611495827006,145.75805912714097,148.7887275816813,150.50010621591636,151.12869154826384,151.3369874794862,151.14782222367967,149.81112513081436,146.74304447140364,142.19704817050356,137.1198908229571,131.9752019882868,125.21794163113624,113.57714712439454,97.1496708876078,101.99777402644207,108.58044026376153,113.26447168913776,112.44799022370425,96.50035067728408,110.7184240927532,124.75329634069374,126.09814773550508,116.55980886066847,92.09290392856308,112.46133923706601,125.10058260240726,133.47227546085253,139.36449484155528,142.62766498926533,143.28651934923624,141.7777189620662,138.76263185246356,135.23412709801426,133.3482677848772,133.95975448544326,134.50352636166627,132.7659707744914,127.74442217998808,118.51443047524482,105.70920689819519,111.95472089630582,123.86037400016116,130.59188784746723,133.04014714791705,131.70252224342494,128.0008127705433,127.38138224297306,129.434918343866,130.34020737337966,130.12929658046303,129.06093066996556,125.57473288368382,115.15550893518736,88.75111693106655,120.22453810765779,130.95014630155598,133.14503685689422,129.55533244102588,122.1039896651948,120.98431843230455,129.14457830522727,135.29395885539418,137.31014313066748,136.0819237857414,134.83640740952785,137.1831284757891,140.30229214517712,141.43509044999527,140.92874954055137,139.99017540878293,138.83460020229015,136.15353009056514,129.23071391558705,117.08769051494484,122.98399945459973,132.34571375732787,134.6597375927039,131.27989475331978,122.65446358116598,109.75949319385768,102.27131663760005,102.80963036664456,104.0666210406399,100.91412970054837,89.06336437380658,95.58870434298841,108.08474410886177,109.975290454292,100.66889665503349,88.96843946142424,108.35377053933227,114.07147267518978,110.93133801377837,109.40847694746347,118.86806993241346,126.52642833562173,129.76501730620384,129.27523809375847,126.67010440280367,124.2867969604617,122.46761377773747,117.95846370606961,104.04194815548871,88.40480038565197,106.82193564925728,107.60151358936267,96.42637893625684,88.65279147756746,104.27502925063335,112.6969219771717,117.9373093683718,121.406189082809,122.22759791766974,121.33894117599992,121.56481739405223,123.53842605672006,124.37982270531079,121.4664769197343,112.5421258034038,92.05572428849077,104.95013039989355,117.2150495419483,122.38464342834497,125.94120162594115,129.56872072251423,132.70817382527588,133.76983838542708,131.96684976064296,127.20200356221375,119.90507895581473,110.88228885993007,105.82567256372081,114.08568971832912,121.98872160371074,124.38192964308752,123.75101574287024,124.49157990671355,127.81856423476499,131.35653746685884,133.61619154056436,134.27054425788754,133.19274055872873,130.25785139226338,125.32131062603564,118.84529769293798,114.73094669137538,117.32300402124814,121.53943096505532,124.9379924905757,129.02643889799754,134.3253630920495,139.64910289859577,143.8496663010949,146.41329976809035,147.13649400326642,145.90790583900943,142.91983020235745,139.0408100268394,136.24004215578535,134.59953604193316,131.88611703248006,126.77824631740835,125.3372918872163,131.3391518029233,136.2994523875791,138.23949026777544,138.01618690253528,136.56384741173846,134.06648656763667,130.41631523162945,126.02312916597072,122.11888737668045,121.93072850705732,126.4549135403018,131.84271947263983,135.2216409007247,135.78574715423088,134.29650210685182,131.90021668190013,129.8594835186377,128.02810329865105,124.82896562622523,119.27804181115263,112.1618210875847,109.7606065138958,114.88031169305953,120.90516479632258,123.89634815814485,124.68805393056857,127.40506420407145,131.92568913122147,134.78655438887444,134.4848762084327,131.22808687816396,124.05101542935647,111.6680648967376,107.59959271972605,119.37875651717499,127.38222796356523,131.3818360741695,131.46362921294215,127.33447882627286,119.12981556963278,113.87365385967676,118.6459118084248,122.47968242291527,122.54191464816928,118.98660493600012,111.3390799924638,98.03459026282384,66.0661580661814,75.82987579913082,82.46862653900081,83.35442562124413,92.95836763726317,103.44710699349196,114.2263158659949,124.07664699923747,131.9837736115233,137.62243813449857,140.2867189328989,139.3177998211297,134.62922878192632,126.52050160692933,123.68212005871749,130.6692723829163,133.96735606383828,132.20629593622854,12
1236.5367302709491,119.75248527642005,117.22061060775094,119.7137227059548,122.3623542790754,120.83475813308127,110.34310180873224,89.01927960713165,120.69558179387168,132.5104431738287,138.12673652205208,140.1080316236496,139.66190688366913,136.93978178629223,132.49447508534894,130.34818088211662,132.497424113394,134.24522201135863,133.6150381540072,131.37917928582317,129.61449782803453,128.68427532159342,128.17334706648543,128.5570699958125,129.62991707093713,130.74845529998203,134.16233629157972,140.3412106741102,145.92797999640203,149.0383053133878,149.4364893947315,148.0554258060447,146.3695241642237,145.83421067683977,146.10029858906174,145.5471045139762,143.17158774370387,138.29280912280117,129.4537010593994,111.58363981456151,92.9500761571869,118.07215437644277,127.15033919507839,131.78855357780378,135.09324290014425,137.02860179241654,137.23047459407942,136.94397279949845,137.86427558389795,140.02962568671,142.3485383990313,144.04004642976972,145.23040828356415,146.91784789675518,149.77722092433748,152.83961538279263,154.53838820199408,154.767354252018,155.10287774079123,156.66466873822475,158.52065843724156,159.60779223082642,159.8694960176258,159.69121555858095,159.09241653554025,158.03511913820253,157.40026253234646,158.2700924193581,160.33717038158198,162.69577420981906,164.56028366121572,165.02755215312504,163.283454921089,158.65569137848354,151.30289226152428,145.98183448662513,145.5672642570963,141.00160436370405,144.56602842693394,158.76317699692117,167.70472832739583,173.28440040276342,177.63272863056815,182.25384109168323,187.0496190825908,190.998692836551,193.5896629106951,195.4906998402826,197.26171132802398,198.68440631822128,199.29787388223784,200.06585544947043,202.15749478072573,204.1179813944494,203.48988916928616,198.687723927
12355173,187.46942834049108,167.07117359067868,172.52204017273783,183.33627056640074,189.56207222209986,194.98293881072215,199.6589895567035],df=[204.35838132923993,203.00945332832035,199.65900469732605,194.98271845278515,189.56132214289326,183.33473438912372,172.52400430499736,167.07532066537684,187.47065016402843,198.68807545388097,203.48982568521964,204.1176240653317,202.15691732602392,200.06529787993665,199.29780568337057,198.68467837138908,197.26189269581153,195.4906761781706,193.5894680197673,190.99841409170546,187.04933995236826,182.25360885686126,177.63250777500204,173.28407960282425,167.70417685616633,158.76226893469703,144.56500607291406,141.00209952410114,145.56804845329737,145.98247959194708,151.30333957601397,158.65594331047583,163.28351501985006,165.0274425332393,164.56009034724005,162.69563468431807,160.3371300218423,158.2700085578228,157.39999468815182,158.03471062124936,159.09200990304208,159.69089115160511,159.86921679067325,159.6075664376986,158.52087286589776,156.6650151944958,155.10307758735354,154.76731334199766,154.53817469416,152.83946762235234,149.7773929680549,146.91810966789785,145.2304213494264,144.0396936303876,142.34788989257112,140.02924475411893,137.86488379627102,136.94443024999612,137.23038873543342,137.02795358522172,135.09262390148805,131.78995127630665,127.15201700601123,118.07364045259453,92.95048846026552,111.58227970522246,129.45278563115795,138.2921805525958,143.1711053210688,145.54670069071844,146.10057562215798,145.83463815520878,146.36977981790818,148.0554387843523,149.43629769169783,149.03798836610676,145.92771765577686,140.3413699534398,134.16252749146054,130.7483709722678,129.62976562861337,128.55726783363963,128.17372090103626,128.68453448110859,129.61467268224547,131.37936708272957,133.615185772025,134.24522747949015,132.49724810152492,130.3479207101576,132.49438546853943,136.93991181373855,139.66216072746448,140.10834545254787,138.1270546398033,132.51069038452,120.69558867721602,89.01754914367318,110.34211587855022,120.83417434236462,122.36200772241834,119.71362583248677,117.22074187792266,119.75264768893518,126.5367395343374,132.2061093130478,133.96693353280494,130.6684966876412,123.6815217863759,126.52157795061277,134.62983091628038,139.3180272591702,140.28667668531253,137.62219818584865,131.98348466528336,124.07663570706792,114.2267694499014,103.44772202882844,92.9584608439638,83.35329993623219,82.46689771012865,75.82770036464417,66.06349703115293,98.03414526793118,111.33889876855572,118.98648423031145,122.54177224513953,122.47951959397489,118.64583070128839,113.87371352182163,119.12974241422387,127.33420020821598,131.46335674969552,131.3822456107658,127.3830481228133,119.37978564347974,107.60067684669835,111.66825278667098,124.05076277537741,131.22772394028615,134.48448788702927,134.7861839517469,131.92539177767685,127.40494750758486,124.68811639326971,123.8965060008981,120.9054998438967,114.88101986961341,109.76176859442026,112.1629841277428,119.27887876494424,124.82951411454222,128.02837046990257,129.85943432178908,131.89986646363,134.2959664200011,135.78516337340758,135.22114124260463,131.84250434163295,126.45507975231583,121.93106290183131,122.11921102289395,126.02335733427888,130.41644177850932,134.06653952639124,136.5638564699891,138.01616957258577,138.23945775755297,136.29941618189454,131.33912440717808,125.33728980410184,126.77827246986509,131.88614297305546,134.5995306065226,136.2399757750571,139.04068907529907,142.9197060262825,145.9078344918701,147.13650225775328,146.41335613205808,143.84972114295687,139.64912794324272,134.3253574737259,129.02642302040337,124.93796462149683,121.5393264193191,117.322732247941,114.73057166609908,118.8452229107018,125.32158129160658,130.25817923584472,133.19297336645127,134.27063636776148,133.61613697497285,131.3563797543291,127.81845352593217,124.49172753170508,123.7513624080227,124.38224504365684,121.98895450367736,114.08596503252865,105.82629767516569,110.88300039306839,119.90552132506646,127.202147201513,131.9667614478077,133.76958758760802,132.70781458819803,129.56830485026168,125.94077414424684,122.38418137561702,117.21442780157889,104.9489244287997,92.05361102549689,112.54203234883539,121.46683920506331,124.38005590514472,123.53852557520595,121.56477951652924,121.33882435595636,122.2275429466472,121.4062971945044,117.93754225866843,112.6971528635918,104.27515467306111,88.6528521160044,96.42663339577929,107.60183673130071,106.82225946173723,88.40507400283728,104.04178637381129,117.95828545895965,122.46746248313711,124.28669381415281,126.67005328527794,129.27522451899023,129.7650229950298,126.52643324838441,118.86804102107371,109.40834958178631,110.93113718338012,114.07121904322369,108.35331346001797,88.96705472009042,100.66853781444378,109.97573475103614,108.08517276324821,95.58895557030422,89.06300976096674,100.91403830932555,104.06730366572654,102.81085812399192,102.27248417282829,109.75997332490616,122.65446694505044,131.27973072984534,134.659499974981,132.34540824765594,122.983550056949,117.08732924209211,129.23091278150616,136.1537186103394,138.83472161916444,139.99022039298902,140.92873074735414,141.4350478891782,140.302255484849,137.183074064597,134.8362750409565,136.08173198415673,137.3102051022957,135.29421222826153,129.14481974035795,120.98443896939034,122.10389522255312,129.55517351459943,133.1448836556803,130.95005729684308,120.2247398448641,88.75300107301513,115.15603565056695,125.57494349672899,129.060984495252,130.1292469749284,130.3401027591469,129.43479875948742,127.3812776144528,128.0007642924076,131.7025425637015,133.04022544791667,130.59201431746015,123.86052071405743,111.95477123616325,105.70885785702148,118.51401850384497,127.74406905646723,132.76569119540864,134.50333751053557,133.95982949270305,133.34831260302562,135.23414699652548,138.76267935057723,141.77778219016764,143.28657189711944,142.627691535347,139.3644825559961,133.4722084696932,125.10044387363267,112.46111177234778,92.09275680431377,116.55997780602732,126.09832147776532,124.7534823951912,110.71875423547183,96.50112043365947,112.4485124681327,113.26506731234124,108.58103656834763,101.99803482567827,97.14913597763675,113.57660886046824,125.21760786245515,131.97504303651732,137.11982745823596,142.19699775863148,146.74299115161836,149.8110840053253,151.14779573703814,151.33695915010136,151.12865162025216,150.500088718598,148.7887948486843,145.75817203220814,142.99623735437788,143.01809980998883,145.25921794002127,146.94978222310706,145.90004561737913,140.90565004641883,132.09016956580749,120.14784234370435,115.32010047236865,127.36594813894344,133.55111744902817,133.779199329228,130.05306182494044,125.02575693885959,122.87310149941793,123.0047656386207,121.46331452528521,117.8741314694841,117.78964041278229,122.5987050435432,125.50729776735199,124.54332009302718,120.16906619959042,114.14090655164526,115.6280158581019,124.03749904425878,128.12242075902333,125.8990361446127,117.54157651579577,109.15688815418844,117.72541720595963,127.23209372584536,131.4583482182636,131.00135069548762,127.335942799752,121.62186226856994,114.22543748940511,114.85572068019748,122.37860097066992,126.59694202163297,127.4986334752324,125.67563125327746,122.00225729495378,119.92276357023357,122.23990555829354,126.51250740094001,129.903949786847,131.71070023688006,131.97553484395505,129.78930892615406,123.78174072681384,116.3424370534271,118.26378107046335,123.7633490117246,125.59327470473724,122.7324601126848,114.68183007149709,101.26825438324576,86.63384744011921,83.21618025600223,92.5882747839233,101.81575376052287,107.16764512838256,109.37281048707132,112.3974640636089,119.9366852918811,127.35884663106289,132.47940283462185,135.70218555776887,137.10112609991162,136.34754082287984,133.0083175599282,126.02857776304094,112.29113303317646,97.16001644870359,111.40431919504549,114.2106564702352,106.30950393288109,94.81430769903297,96.47370642704341,84.92532458224564,60.545487148081754,79.88039774315853,68.67596712239431,89.11906170616737,91.34917675692962,73.856623411296,90.26844758457986,104.1086223795779,111.58070017271665,116.49222512452609,118.90377264729761,118.22411457287104,114.23802667459175,107.40620915533147,100.60987015302861,97.57527844151682,97.34158232256256,98.10290657702991,98.66362467593973,101.7433519346422,106.2073561951195,108.69895880734114,110.8035723792059,112.15569136889091,109.49690243299439,103.93036448482624,100.92628029593007,97.86096217096936,95.66608809626983,101.03380856504565,108.34648051731253,116.07978807883318,123.8283548391442,130.54394791018052,135.56296750803784,138.76204157391325,
123140.13435297163534,139.4593490534493,136.21123380350022,129.43441998628626,117.31101607955178,103.73912043267357,112.44864947671577,118.98964903641227,121.21591071320593,121.98924397601607,122.15980962476785,121.38400859362196,119.26549450974018,116.8959893414305,115.88483515515084,114.78338677210779,112.33315907937443,107.62137119796489,98.73602747048403,87.73038295136323,91.13378536825944,101.16947207803058,106.2253997649699,104.13784134633754,100.52905925732327,105.68729473617451,108.82944337043381,105.65177463603948,99.53348804272758,99.12635127717267,101.89825121460251,104.22530938942084,106.5199998892505,109.53476613473762,113.18969053622115,115.68672529991734,115.68799615105743,113.54259565985197,111.07854773053354,109.34605744693557,106.82092535033571,101.93352157530809,95.15483646585035,85.77495510365729,71.47980071875158,56.42559082770286,37.29837819664849,61.63020725776271,60.59370173495803,29.06580455390409,48.298454080119065,55.25910173785193,49.07081918616964,27.913389433570206,46.06408623486975,65.30229863737705,69.00799421180668,62.951246181167086,78.39628391473362,92.91338861566796,101.18515479771182,107.06300736303153,112.21793848064252,116.14938312247597,118.20778576944683,118.84594635653883,119.06929816454088,119.14718314409345,118.36809783419976,116.29053669089575,113.1890980334156,109.04454487149671,102.72609076505472,92.41500440345374,76.33094400443694,52.15810967929434,60.53209431838238,74.51909568179593,71.77931834367912,39.82659016836722,60.1169244820835,62.52548851218519,62.11074567808925,63.45832055316442,46.8261122989831,57.52269917794884,70.21957081125319,80.99419298885374,93.73663259384219,102.81429704783874,108.98970049077947,114.1615558836602,118.65326487722758,121.47156722067137,121.70532057926238,119.0050512192624,113.91296124678925,108.02487100201645,102.45933706749719,99.47598191566438,103.07457144991398,107.83179905939933,109.71431398958043,111.18776497305835,115.9312322534841,122.2031968088484,127.06021086188508,129.01757233521474,127.38100954224436,121.95378438456284,113.88747930721628,108.24673019657541,108.8848456885361,110.8492682187245,110.54528629513362,106.91146973958499,100.23720183593618,93.09935251508304,88.52204668469803,83.40893002956824,75.3313841827785,73.00260059182122,74.77627146153478,76.25559930918028,84.45871817093106,89.97952576061537,91.3626377391236,91.7720533305402,92.52791684811231,92.58468973705524,90.10201677066587,83.06805232336963,69.79640996980096,59.46018368728643,64.53504442365393,64.72506424680589,48.59176666190088,42.997013594499144,58.400853744202436,49.148725852729285,19.301829008746356,45.525192245861724,34.586577726746604,32.89897205356545,37.35431487600631,39.36070499932478,47.28944881987594,55.80702434942269,58.31379853055729,53.27520107576588,51.77221796539581,59.30468018244898,64.77574569278,63.45891452054705,57.60286625521149,64.7802979806566,76.39692667582972,85.4774034636836,91.17797207425647,93.54958517538748,93.58937200947447,93.20455317792343,93.90957285858832,95.18829374855927,95.20282588854431,94.1588385341336,93.16395918149897,91.64607366999336,88.37909124667785,83.1975774402594,76.5085768647885,68.0130768674399,55.14813057328617,44.67960299230243,66.19961637978649,73.74863121315964,73.14806942281302,70.76269255868576,73.75017282602815,80.37283457139709,87.42884063345399,91.6920197763112,92.84484827437588,93.15688891664955,95.12943817890444,98.85873726821387,102.5135604044542,104.24947206735496,103.74848206676312,101.97082217522741,99.89393393504812,97.42699236602259,93.52313150722814,87.44822165948382,79.08988655073196,68.55796791028351,57.70810591072713,50.239173324672905,44.00139587945284,39.17083257776271,37.56426246163583,31.857100767319398,20.165041089762884,30.798890823664454,32.02446587793886,19.32695305555075,27.48639441172864,10.930601425652121,12.518216720193713,2.623565728612991,22.124740941086785,21.123585398658616,24.3753003574641,30.536378710455626,30.35213053286443,22.59887852402723,11.9977441597185,25.025017367983914,26.00439871228424,18.850166521576575,9.604053766122993,13.011991569025879,7.01229322727204,11.365433863731198,8.7599170980214,15.208450149837269,15.512142053824034,13.521601913144004,15.627891152571781,18.21907486102378,14.10397536331784,6.6846268698
12303753,14.97313805067607,17.469824613321073,9.143059568749683,9.72404561637773,10.913143242930877,11.254267483348588,12.760208164488825,11.77213667443736,11.140989359072801,11.10708686047775,13.140019528204556,14.488009330945031,14.833626779648931,6.488046088213211,16.2637832245964,18.805897212928652,19.046297637613492,19.094705802544446,13.896945197556589,5.927629107022312,4.88997960497853,13.662719862992427,12.802014202571163,15.88131005611988,20.900868342879562,14.231926082696635,3.084827018001512,11.369536829619058,15.940886671074017,11.84259622372541,9.559611031609194,14.878394008099942,16.009889164087866,11.666183139837901,0,12.514914259860406,15.279401813005864,17.800918809356883,21.1931645496907,17.429196777389954,7.843912801881345,5.419655023241892,13.47154206569122,15.202617570591675,10.050371931296217,13.540489467787344,15.464754579117251,11.21828400842651,2.3313856619575697,0,0,7.332534216620066,10.865586005260077,0,2.224326565846797,7.864873951393415,4.891568249139188,6.328567349711326,9.358049038355206,15.130964014834193,15.451401393072944,11.804496346795498,7.581079491398729,11.531322431346336,0,8.785004433259628,9.392121069315627,11.304817166597942,17.287662196476834,16.980347110242366,10.820287423168313,0,2.1537316621570883,12.37549089851758,11.882712849582024,0,0,8.332193257260796,14.52776345255954,15.534839890870575,5.716670958406418,0,9.193888869630946,12.165761627915707,14.438050716725746,10.029858466961555,2.5528491032018263,1.1157600999344226,9.023402532060699,11.84909143756013,10.996168833136753,1.1101978370485968,1.6905400167320037,9.165985999739283,11.476104803759513,6.424915969262808,8.078837643373163,15.305529378163936,11.383243139804426,.2952564977218819,6.767946143193262,12.780993948718079,14.38604755985657,14.007328091697389,3.734705766356697,9.029154344080528,13.815128884049631,18.164041081188802,19.24454885612999,17.615774330925618,11.30736552162138,15.281484694967853,19.860681293473736,14.219040359734858,10.568559653800875,13.531719935107636,6.619084727827993,18.10185293789845,20.20005490406164,12.977800532040959,13.630593272325221,15.613474662488834,1.4071067722403952,5.104100308028737,4.453092250334667,7.950531831873705,12.546181719144284,16.912889584119306,13.611063804511913,0,5.14340750155569,4.168112019595056,7.907150889977693,8.979147446431407,9.426140225224962,13.243225390442396,11.469977914072203,6.748875731042129,12.419333543855343,17.67077925645081,18.880096475694156,17.976945230424562,13.259975924641125,9.110054638830176,13.897020932221713,10.897095324514966,7.8151207360060235,9.849822772927759,11.325162474719361,12.016694841102133,11.961220785443153,17.26423194554651,21.170934171205246,19.36679035480077,10.251257554114659,12.697790518293173,12.226322012316976,8.797966914057117,7.304920597468326,6.035264457772584,9.213676766218406,6.700444658116453,0,9.469079930845345,12.587156119390347,10.245214753239326,0,3.9196260047336264,14.939554766587442,20.32950591396716,17.43295039442306,12.232478269551809,7.075514116679573,11.653567301617436,14.522086687604194,4.999105820822678,8.972467820299194,14.752996098031064,12.58737256922795,8.269772553863397,6.845181399549767,9.453814130341753,6.702038616580293,0,5.248058865577265,9.060301063117464,4.959265667263332,1.6907237601620995,12.1849239447419,10.75358814568625,5.579890828342152,10.25437631919848,8.727296893037195,8.674164699122215,8.654266132067589,17.559192518562003,18.013714536426534,3.19846928252853,15.138023018241498,13.120210256537089,13.25959664576775,14.705757047417212,13.646956860434232,11.4493918726612,14.42216931817045,15.61832623520531,9.588827906656373,13.530472972857197,12.078871233581653,12.325619997935547,16.171122133369753,12.287442774753139,9.18184999018405,15.581479804162036,18.89011269904545,12.610509248201758,4.349945852315997,10.24488560466813,7.227081000118217,5.75185749552973,10.778581893610276,13.024889141559335,1.6624037980402562,0,5.918273781830605,11.381155590038007,13.981295548325248,13.94288510294386,10.133007988991162,2.121248558055799,0,1.9723575884446862,0,3.6330911978320097,0,10.113576400672237,10.40896817062201,0,10.454790827761203,10.174902839382536,0,3.5765172429638006,0,1.6182090693881206,0,1.7447440566893428,10.14584872592788,14.082806239138574,14.13045625770746,11.519994887021749,6.000767441228888,0,1.342626361452378,12.895630837651595,10.65092334647549,5.653708141569734,7.225975812423864,10.279236321645836,4.420118550235051,12.63436625022545,18.90372918109156,15.609480264737144,9.227081575590395,12.28784948291024,16.150819092173037,12.313925939027017,12.108909431418597,13.543631056849733,9.508949273227547,15.512028540224131,14.328925846207822,11.606027192071757,13.781481597455045,14.782072988727856,13.30651238407281,13.1388298848693
12365,15.116653621679085,2.9554299337869274,17.91580710523786,17.470496727492755,8.753478916254254,8.814297997449522,8.777238025275853,10.263800483364781,5.636264759368252,10.794078851559046,12.174723218930296,1.4999538295923966,4.8007532181192625,9.094005719383269,5.504161448330176,0,6.91445360252918,9.53931383986776,6.812469238027456,8.104675064882583,12.402321867359854,14.575215846710353,8.894139055166587,5.41943166165391,14.702972067789473,11.856970622795508,7.31333026934427,12.322306413619625,17.448578513027048,20.310376499547864,14.862257403880673,3.6298947871426073,0,10.22551953701423,12.663942733922736,9.61832375637568,0,6.745343890336374,9.1393486211929,5.781388148243254,6.969392453063516,8.48361378533504,12.179137558366316,12.915935053266153,10.579301518169789,19.476760426918048,21.219739452820882,17.2642243065431,11.862556627260657,11.853653103061724,11.114382480645585,9.604425225673191,7.6263471783133365,10.939435292913382,13.995774524794472,9.214802148624713,13.269349891158216,17.961464275474153,18.8761951030306,17.698161852858053,12.50827264365707,6.932947620998374,11.58021263899969,13.310898121668322,9.484703064785522,9.030022395410246,7.984609496401385,4.285134891752637,5.175920875087389,0,13.47134581762161,16.757700789043493,12.272879876417079,7.605413336393965,4.436834888590431,5.3134281624631585,1.586948407695722,15.628696329790479,13.638049432844555,12.98106684584527
1237,20.19082567242849,18.075206606619627,6.555147116491932,13.552012665837841,10.672208165568314,14.32546649410791,19.931514729626965,15.377797494051292,11.375769236373975,17.588585804754313,19.15950620196171,18.01841039563144,13.588143662169683,9.003820447085538,4.03228667394176,14.040446206569532,14.325258350511012,12.642339255005362,6.742497661212694,.7632554290740886,11.504334170814484,15.332947927875477,8.03418629947505,6.311434613265711,11.402639779964485,9.08442868708418,1.601545623919535,1.3179729309311625,11.175473098509213,12.027947817686973,9.206758553558133,1.3016492801836677,2.486550006182436,9.873629602046508,14.267461740251058,11.989494723427752,9.41420926886248,0,6.207702433978429,15.662305858152648,14.565948407450774,8.191337129018594,0,0,11.59078022260681,12.47321848095627,2.679199564616129,0,10.77357845916403,16.891122441267942,17.1738294458997,11.228060112174784,9.666473753231518,9.186067689083913,0,11.708749974182963,7.648578892756032,11.719897248816912,15.319507064767029,14.968844289851205,9.178167370766324,6.354883478391251,5.0317240483073755,7.875625082238901,2.016429963438845,0,10.81387157350129,7.390275955986494,0,0,2.473783795561967,11.283288373376966,15.494440278723957,13.529264929400577,9.9355770563046,15.074756774232712,13.328369502150904,5.5117560855136665,8.147300916502846,17.538402466378802,21.23247911794689,17.79172658927885,15.18189805300655,12.281546300058944,0,11.647743078165266,16.218227783549956,15.059530854897316,9.791646218821802,12.002311842637019,16.021067746218772,11.394436422577598,2.8364568713671985,14.060141217183588,20.80123791581557,15.77343773482499,12.726059083415214,13.584190131875445,4.713261533825819,6.033935500495772,14.02584255505931,19.162913910339118,19.09196180796629,18.83135815701536,16.263660209745257,6.366220890786104,14.713260017851788,14.321220889923108,13.119121396181448,11.41273340341992,11.490232130794169,12.058640417183204,12.939169262726953,11.333490287597444,10.857884175240345,9.538347399436034,8.87164508142129,17.33526561528871,14.797043625492982,6.303864751177793,14.008458579047376,18.281616804764848,15.714776244389387,13.536078416015936,15.43565038521385,15.085553833964894,8.816838562473114,11.57889252690025,7.243366337808657,13.049992675819164,9.562100439480858,18.8423624821782,26.026230764925945,25.063588495745275,12.088440383270365,22.598703824524417,30.335175370360073,30.507203823934503,24.31575743172064,21.091347153092375,22.192008263984746,2.6921532477189625,12.555925389688039,10.955792349554407,27.496596933783845,19.32309532965342,32.02016781504115,30.79363057915056,20.153705208595028,31.84733432313043,37.55422676155908,39.161318089373836,43.99725905548563,50.239521349711644,57.709945157232774,68.56102072874769,79.09277757582453,87.45022449812227,93.52414032558913,97.42708629345228,99.89326580207333,101.96969528883949,103.74738305478293,104.24929170393897,102.51409565496083,98.85891221948177,95.12889229516455,93.15575142612721,92.84481690448938,91.69353557099636,87.43065766212484,80.37511065919674,73.75278758416235,70.76481546499228,73.1488809356018,73.748251522107,66.19754420726265,44.67055040009078,55.14127984460118,68.00897312875901,76.50577378971266,83.19565707317221,88.37928427891767,91.64707205600125,93.1645549214913,94.15892605231977,95.2024261748412,95.18759292865255,93.90926869773944,93.20519129451228,93.58993179108286,93.54980638035424,91.17789631782823,85.47711109836708,76.39650364258733,64.77967081028163,57.60148341599023,63.457047409979346,64.77373700220063,59.30619115439834,51.77610792645369,53.27738581379225,58.31513815008083,55.809899784465536,47.29546194987288,39.36798475813622,37.358230987929666,32.900513693669474,34.58876357417883,45.52733381871206,19.30418051352355,49.14605651861594,58.39674489502643,42.985076505824125,48.58277552730088,64.72489073088832,64.53855632176429,59.46461446008204,69.79866094213094,83.06895000871368,90.10241292436534,92.58477826421021,92.52767576810614,91.77141536117016,91.36164373019474,89.97832484647684,84.45765489771985,76.25612211802503,74.77793832270372,73.00464769163953,75.33322759939438,83.409989
12367778759,88.52257846445491,93.09950831286169,100.23713376604933,106.91129234333648,110.54503255674483,110.84895308710479,108.88450078687669,108.24640086701157,113.88723795443882,121.95382120919903,127.38124075994413,129.01779133987984,127.06035587666086,122.20320925325537,115.93106559880616,111.18750587058453,109.71416357836468,107.8317384576405,103.07442993273,99.47570439915134,102.45913685400123,108.02480011537054,113.91292131176246,119.00504719734893,121.70543114560706,121.4717871530839,118.65353350928577,114.16181719598866,108.98992131815601,102.8145364807752,93.73710616384784,80.99522436021847,70.22074977909531,57.522235111051,46.820031202418996,63.45379796911414,62.10573859306925,62.522478315454485,60.116833586304146,39.831630797412195,71.7806367413494,74.5199217836516,60.53234686501897,52.15602168536246,76.32972481770639,92.41450363484631,102.72603832002034,109.04463777755306,113.18911196254741,116.29040798264832,118.3678616281676,119.14690593059633,119.06909211625258,118.84607224151263,118.20797609910174,116.14962898219424,112.21827699609415,107.06342747939058,101.18559829646743,92.9137702620287,78.39634865319103,62.949900114705216,69.0062502703019,65.30050053459482,46.064088050295645,27.925213019067385,49.07620602908922,55.26130242039997,48.297181557952335,29.0547768428826,60.59226990706777,61.63229498033179,37.31050251614931,56.42876438016364,71.47969431040048,85.77420915075048,95.15419246153931,101.93312177445505,106.82075655302869,109.34608956875489,111.07870777085459,113.54273215819515,115.68801133344986,115.68660528363839,113.18945966755618,109.53447768330773,106.51968978192635,104.22493771561832,101.89789204190814,99.12657145417897,99.53419272300803,105.65227830143226,108.8297392582113,105.68749484539899,100.52925035881725,104.13800355421641,106.2254843732615,101.16934758006757,91.13304937350996,87.72891307583734,98.7349633067024,107.62097112736863,112.3335144467274,114.78372232892166,115.8850378488818,116.89611504765251,119.26561324794429,121.3841409612775,122.15993185509966,121.98932645564041,121.21593174035927,118.98958046309708,112.44840636612393,103.73853807373665,117.31064469551029,129.43421370886102,136.2111032227428,139.4593666500088,140.13445296046177,138.76213759970432,135.5630320707424,130.54393168059855,123.82818837992177,116.07941747991194,108.34647026968001,101.03456677959765,95.66676904546009,97.86113189561249,100.92602617581143,103.92989096852207,109.49660407900826,112.15584663912672,110.80382908028835,108.69898621387294,106.20701462462121,101.74262759240635,98.66422744858968,98.10394110643142,97.34235283999772,97.57566565538899,100.60994855041994,107.40617250158246,114.23798647603215,118.22408238485863,118.90373163887496,116.49216867904974,111.58068216565138,104.10879697628687,90.26906232119254,73.85763572461435,91.3491361317248,89.11836156706346,68.6726434655926,79.87799282974109,60.54385059908123,84.92760936178982,96.4752001963592,94.81545038646067,106.30970359538547,114.2104747499376,111.40391612227951,97.
12315934129972361,112.29095612707094,126.02848842354501,133.0082159148334,136.34745581511382,137.10109773309034,135.70217756931117,132.47935526768777,127.35878828072931,119.93677584068564,112.39768481660613,109.37303827394014,107.16791080188607,101.81608101208793,92.58847469956677,83.21567458536418,86.63294719282503,101.26812860539339,114.68214557056169,122.7327563809439,125.59348797481894,123.76350402125736,118.26389009957268,116.34245948001073,123.78168323041649,129.78921427083176,131.9754194958146,131.71057816330685,129.90384904754552,126.51249016784601,122.2400326926942,119.92296598384048,122.00238053081277,125.67563725822029,127.49855890937131,126.59682802396568,122.37848723288941,114.85566139586028,114.22547302310696,121.62189039066338,127.33590647591397,131.00124646643715,131.4581964185114,127.23195927702446,117.72549862641351,109.15718761707542,117.5417232792651,125.89906325638462,128.1223527402383,124.03727447364358,115.62748592770117,114.1414572415632,120.16950335825283,124.54351889399076,125.50728589986323,122.59848279111162,117.78921780035344,117.87374702603012,121.46344538503499,123.00503642802835,122.8734071286911,125.0260325714215,130.05322831072004,133.77926904706976,133.55111737490492,127.36586241105557,115.31977487505993,120.14742685497546,132.08991772494053,140.90571592124957,145.90019036520025,146.94986939321637,145.25922677868306,143.01802540646966,142.99611495827006,145.75805912714097,148.7887275816813,150.50010621591636,151.12869154826384,151.3369874794862,151.14782222367967,149.81112513081436,146.74304447140364,142.19704817050356,137.1198908229571,131.9752019882868,125.21794163113624,113.57714712439454,97.1496708876078,101.99777402644207,108.58044026376153,113.26447168913776,112.44799022370425,96.50035067728408,110.7184240927532,124.75329634069374,126.09814773550508,116.55980886066847,92.09290392856308,112.46133923706601,125.10058260240726,133.47227546085253,139.36449484155528,142.62766498926533,143.28651934923624,141.7777189620662,138.76263185246356,135.23412709801426,133.3482677848772,133.95975448544326,134.50352636166627,132.7659707744914,127.74442217998808,118.51443047524482,105.70920689819519,111.95472089630582,123.86037400016116,130.59188784746723,133.04014714791705,131.70252224342494,128.0008127705433,127.38138224297306,129.434918343866,130.34020737337966,130.12929658046303,129.06093066996556,125.57473288368382,115.15550893518736,88.75111693106655,120.22453810765779,130.95014630155598,133.14503685689422,129.55533244102588,122.1039896651948,120.98431843230455,129.14457830522727,135.29395885539418,137.31014313066748,136.0819237857414,134.83640740952785,137.1831284757891,140.30229214517712,141.43509044999527,140.92874954055137,139.99017540878293,138.83460020229015,136.15353009056514,129.23071391558705,117.08769051494484,122.98399945459973,132.34571375732787,134.6597375927039,131.27989475331978,122.65446358116598,109.75949319385768,102.27131663760005,102.80963036664456,104.0666210406399,100.91412970054837,89.06336437380658,95.58870434298841,108.08474410886177,109.975290454292,100.66889665503349,88.96843946142424,108.35377053933227,114.07147267518978,110.93133801377837,109.40847694746347,118.86806993241346,126.52642833562173,129.76501730620384,129.27523809375847,126.67010440280367,124.2867969604617,122.46761377773747,117.95846370606961,104.04194815548871,88.40480038565197,106.82193564925728,107.60151358936267,96.42637893625684,88.65279147756746,104.27502925063335,112.6969219771717,117.9373093683718,121.406189082809,122.22759791766974,121.33894117599992,121.56481739405223,123.53842605672006,124.37982270531079,121.4664769197343,112.5421258034038,92.05572428849077,104.95013039989355,117.2150495419483,122.38464342834497,125.94120162594115,129.56872072251423,132.70817382527588,133.76983838542708,131.96684976064296,127.20200356221375,119.90507895581473,110.88228885993007,105.82567256372081,114.08568971832912,121.98872160371074,124.38192964308752,123.75101574287024,124.49157990671355,127.81856423476499,131.35653746685884,133.61619154056436,134.27054425788754,133.19274055872873,130.25785139226338,125.32131062603564,118.84529769293798,114.73094669137538,117.32300402124814,121.53943096505532,124.9379924905757,129.02643889799754,134.3253630920495,139.64910289859577,143.8496663010949,146.41329976809035,147.13649400326642,145.90790583900943,142.91983020235745,139.0408100268394,136.24004215578535,134.59953604193316,131.88611703248006,126.77824631740835,125.3372918872163,131.3391518029233,136.2994523875791,138.23949026777544,138.01618690253528,136.56384741173846,134.06648656763667,130.41631523162945,126.02312916597072,122.11888737668045,121.93072850705732,126.4549135403018,131.84271947263983,135.2216409007247,135.78574715423088,134.29650210685182,131.90021668190013,129.8594835186377,128.02810329865105,124.82896562622523,119.27804181115263,112.1618210875847,109.7606065138958,114.88031169305953,120.90516479632258,123.89634815814485,124.68805393056857,127.40506420407145,131.92568913122147,134.78655438887444,134.4848762084327,131.22808687816396,124.05101542935647,111.6680648967376,107.59959271972605,119.37875651717499,127.38222796356523,131.3818360741695,131.46362921294215,127.33447882627286,119.12981556963278,113.87365385967676,118.6459118084248,122.47968242291527,122.54191464816928,118.98660493600012,111.3390799924638,98.03459026282384,66.0661580661814,75.82987579913082,82.46862653900081,83.35442562124413,92.95836763726317,103.44710699349196,114.2263158659949,124.07664699923747,131.9837736115233,137.62243813449857,140.2867189328989,139.3177998211297,134.62922878192632,126.52050160692933,123.68212005871749,130.6692723829163,133.96735606383828,132.20629593622854,12
1236.5367302709491,119.75248527642005,117.22061060775094,119.7137227059548,122.3623542790754,120.83475813308127,110.34310180873224,89.01927960713165,120.69558179387168,132.5104431738287,138.12673652205208,140.1080316236496,139.66190688366913,136.93978178629223,132.49447508534894,130.34818088211662,132.497424113394,134.24522201135863,133.6150381540072,131.37917928582317,129.61449782803453,128.68427532159342,128.17334706648543,128.5570699958125,129.62991707093713,130.74845529998203,134.16233629157972,140.3412106741102,145.92797999640203,149.0383053133878,149.4364893947315,148.0554258060447,146.3695241642237,145.83421067683977,146.10029858906174,145.5471045139762,143.17158774370387,138.29280912280117,129.4537010593994,111.58363981456151,92.9500761571869,118.07215437644277,127.15033919507839,131.78855357780378,135.09324290014425,137.02860179241654,137.23047459407942,136.94397279949845,137.86427558389795,140.02962568671,142.3485383990313,144.04004642976972,145.23040828356415,146.91784789675518,149.77722092433748,152.83961538279263,154.53838820199408,154.767354252018,155.10287774079123,156.66466873822475,158.52065843724156,159.60779223082642,159.8694960176258,159.69121555858095,159.09241653554025,158.03511913820253,157.40026253234646,158.2700924193581,160.33717038158198,162.69577420981906,164.56028366121572,165.02755215312504,163.283454921089,158.65569137848354,151.30289226152428,145.98183448662513,145.5672642570963,141.00160436370405,144.56602842693394,158.76317699692117,167.70472832739583,173.28440040276342,177.63272863056815,182.25384109168323,187.0496190825908,190.998692836551,193.5896629106951,195.4906998402826,197.26171132802398,198.68440631822128,199.29787388223784,200.06585544947043,202.15749478072573,204.1179813944494,203.48988916928616,198.687723927
12355173,187.46942834049108,167.07117359067868,172.52204017273783,183.33627056640074,189.56207222209986,194.98293881072215,199.6589895567035],e4=async e=>{try{const t=await ne.splitVocals.getById.query({splitVocalsJobId:e});if(t.splitVocalsJob)return t.splitVocalsJob}catch(t){console.error(t)}return null},t4=async e=>{try{const t=await ne.splitVocals.getByAssetId.query({assetId:e});if(t.splitVocalsJob)return t.splitVocalsJob}catch(t){console.error(t)}return null},o4=async({asset_id:e,teamId:t,videoId:o,isForVoiceClone:r=!1})=>{try{const s=await ne.splitVocals.create.mutate({assetId:e,teamId:t,videoId:o,skipChargingCredits:r});if(s.split_vocals_job_id)return s.split_vocals_job_id}catch(s){console.error(s),mt({description:"Extracting background audio failed to start. Please try again.",sentryMessage:"Split Vocals: failed to start split_vocals job",extra:{asset_id:e,videoId:o}})}return null},lf=async({asset_id:e,videoId:t,teamId:o,cancellationSource:r,showSuccessToast:s=!0})=>{const a=await t4(e);if(a?.status==="success")return a;const n=await o4({asset_id:e,videoId:t,teamId:o,isForVoiceClone:!0});if(!n)return mt({description:"Error starting split vocals. Please try again.",sentryMessage:"Split Vocals: timed out",extra:{asset_id:e}}),r.cancel(),null;let i=0;for(;!r.cancelled;){if(i>1e3)return mt({description:"Split vocals timed out. Please try again.",sentryMessage:"Split Vocals: timed out",extra:{asset_id:e}}),r.cancel(),null;const l=await e4(n);if(l)switch(l.status){case"success":return s&&I().dispatch(ke({description:"Split Vocals complete.",type:"success"})),l;case"error":return mt({description:"There was an error processing your video. Please try again."}),null;case"queued":if(i>20)return mt({description:"Extracting background audio failed to start."}),null}i+=1,await new Promise(d=>setTimeout(d,3e3))}return null};async function cf(e){return ne.splitVocals.delete.mutate({splitVocalsJobId:e})}const r4="1001",a4="1000",s4="58px",i4="StudioPopover-module_home_qyqoN",n4="StudioPopover-module_homeHowBackgroundWhite_boVCe",d4="StudioPopover-module_largeButton_AeNtO",l4="StudioPopover-module_sectionContent_OgupO",c4="StudioPopover-module_sectionHeader_aEDR-",u4="StudioPopover-module_spacer_hP5h4",h4="StudioPopover-module_chevron_RNhcq",p4="StudioPopover-module_splashText_5CFq9",m4="StudioPopover-module_splashSubtext_0oT3n",f4="StudioPopover-module_aboutSection_GX8cX",g4="StudioPopover-module_mobile_CBQsC",A4="StudioPopover-module_desktop_rrGhe",y4="StudioPopover-module_screenReaderOnlyLabel_glMha",b4="StudioPopover-module_disabled_o6w-U",_4="StudioPopover-module_disabledWithPointerEvents_Mt5mB",I4="StudioPopover-module_noScrollBar_8FBE8",T4="StudioPopover-module_textOverflowEllipsis_kD9d9",v4="StudioPopover-module_disableTextHighlight_a4rzm",S4="StudioPopover-module_genericButtonBlue_QE-PH",w4="StudioPopover-module_rmButtonUserAgentStyles_Ek1K7",E4="StudioPopover-module_content_WV3ja",C4="StudioPopover-module_fadeIn_eUfAr",x4="StudioPopover-module_small_ewzQS",k4="StudioPopover-module_header_6fPMG",R4="StudioPopover-module_description_FVzNg",L4="StudioPopover-module_iconWrapper_WnLVa",D4="StudioPopover-module_trigger_Fx-Ss",M4="StudioPopover-module_flexGrow_j6CHR",U4="StudioPopover-module_rainbowBorder_RVMSq",P4="StudioPopover-module_gradient_PfqUH",O4="StudioPopover-module_arrow_f-y-1",B4="StudioPopover-module_actions_WgnpJ",F4="StudioPopover-module_hidden_nyrp9",j4="StudioPopover-module_defer_0fAVG",N4="StudioPopover-module_confirm_dakDf",V4="StudioPopover-module_popoverContent_sUuKj";var Ve={workspacePopoverZIndex:"18",popoverZIndex:"14",paywallZIndex:r4,paywallBgZIndex:a4,collapsedMediaSidebarWidth:s4,home:i4,homeHowBackgroundWhite:n4,largeButton:d4,sectionContent:l4,sectionHeader:c4,spacer:u4,chevron:h4,splashText:p4,splashSubtext:m4,aboutSection:f4,mobile:g4,desktop:A4,screenReaderOnlyLabel:y4,disabled:b4,disabledWithPointerEvents:_4,noScrollBar:I4,textOverflowEllipsis:T4,disableTextHighlight:v4,genericButtonBlue:S4,rmButtonUserAgentStyles:w4,content:E4,fadeIn:C4,small:x4,header:k4,description:R4,iconWrapper:L4,trigger:D4,flexGrow:M4,rainbowBorder:U4,gradient:P4,arrow:O4,actions:B4,hidden:F4,defer:j4,confirm:N4,popoverContent:V4},vr=ae(ye()),$n=ae(mo()),G4={borderRadius:5,borderWidth:2},K4=v.memo(e=>{const t=(0,vr.c)(34),{children:o,content:r,header:s,onClose:a,open:n,side:i,align:l,alignOffset:d,sideOffset:c,withRainbowBorder:u,rainbowBorderOptions:h,size:A,onMount:g,onUnmount:y,onPopoverCloseAndFocus:b,triggerStyle:_,container:S,triggerRef:T,containerStyle:w,contentStyle:x,withArrow:k}=e,M=i===void 0?"right":i,j=l===void 0?"center":l,O=d===void 0?0:d,B=c===void 0?0:c,$=u===void 0?!0:u,Z=h===void 0?G4:h,Y=A===void 0?"large":A,Q=k===void 0?!0:k;let L;e:{if(n===void 0){L=void 0;break e}let G;t[0]!==a?(G=z=>{z&&a?.()},t[0]=a,t[1]=G):G=t[1],L=G}const f=L;let U,P;if(t[2]!==g||t[3]!==y||t[4]!==n?(U=function(){return n&&g?.(),()=>{y?.()}},P=[g,y,n],t[2]=g,t[3]=y,t[4]=n,t[5]=U,t[6]=P):(U=t[5],P=t[6]),(0,v.useEffect)(U,P),!n)return o;const F=n&&$;let H;t[7]!==o||t[8]!==Z||t[9]!==F||t[10]!==_?(H=(0,C.jsx)(W4,{withRainbowBorder:F,rainbowBorderOptions:Z,triggerStyle:_,children:o}),t[7]=o,t[8]=Z,t[9]=F,t[10]=_,t[11]=H):H=t[11];let N;t[12]!==H||t[13]!==T?(N=(0,C.jsx)(Xd,{asChild:!0,ref:T,children:H}),t[12]=H,t[13]=T,t[14]=N):N=t[14];let W;t[15]!==j||t[16]!==O||t[17]!==S||t[18]!==w||t[19]!==r||t[20]!==x||t[21]!==s||t[22]!==a||t[23]!==b||t[24]!==M||t[25]!==B||t[26]!==Y||t[27]!==Q?(W=!!r&&(0,C.jsx)(Qd,{container:S??Yc(),children:(0,C.jsxs)(Gd,{side:M,align:j,className:(0,$n.default)(Ve.content,{[Ve.small]:Y==="small"}),collisionPadding:16,alignOffset:O,sideOffset:B,hideWhenDetached:!0,style:w,onCloseAutoFocus:b,children:[s&&(0,C.jsx)("div",{className:Ve.header,children:s}),(0,C.jsx)("div",{className:Ve.description,style:x,children:r}),!!a&&(0,C.jsx)("button",{className:Ve.iconWrapper,onClick:G=>{G.stopPropagation(),a?.()},"data-testid":"studio-popover-close",children:(0,C.jsx)(Nd,{size:Y==="small"?18:24})}),Q&&(0,C.jsx)(Yd,{className:Ve.arrow,width:12,height:12})]})}),t[15]=j,t[16]=O,t[17]=S,t[18]=w,t[19]=r,t[20]=x,t[21]=s,t[22]=a,t[23]=b,t[24]=M,t[25]=B,t[26]=Y,t[27]=Q,t[28]=W):W=t[28];let se;return t[29]!==f||t[30]!==n||t[31]!==N||t[32]!==W?(se=(0,C.jsxs)(el,{open:n,onOpenChange:f,children:[N,W]}),t[29]=f,t[30]=n,t[31]=N,t[32]=W,t[33]=se):se=t[33],se});const W4=v.memo(v.forwardRef((e,t)=>
123{const o=(0,vr.c)(13),{rainbowBorderOptions:r,withRainbowBorder:s,triggerStyle:a,children:n}=e;let i;o[0]!==r?(i=r??{},o[0]=r,o[1]=i):i=o[1];const{borderRadius:l,borderWidth:d}=i;let c;o[2]!==n?(c=(0,C.jsx)(C.Fragment,{children:n}),o[2]=n,o[3]=c):c=o[3];let u;o[4]!==l||o[5]!==d||o[6]!==s?(u=s&&(0,C.jsx)("div",{className:Ve.rainbowBorder,style:{borderRadius:`${l}px`,margin:`-${d}px`,borderWidth:`${d}px`}}),o[4]=l,o[5]=d,o[6]=s,o[7]=u):u=o[7];let h;return o[8]!==t||o[9]!==c||o[10]!==u||o[11]!==a?(h=(0,C.jsxs)("div",{className:Ve.trigger,style:a,ref:t,children:[c,u]}),o[8]=t,o[9]=c,o[10]=u,o[11]=a,o[12]=h):h=o[12],h})),H4=v.memo(e=>{const t=(0,vr.c)(19),{description:o,media:r,additionalNote:s,buttons:a,customButtons:n}=e;let i;t[0]!==o?(i=(0,C.jsx)(C.Fragment,{children:o}),t[0]=o,t[1]=i):i=t[1];let l;t[2]!==s?(l=s&&(0,C.jsx)("div",{style:{marginTop:"12px"},children:(0,C.jsx)("i",{children:s})}),t[2]=s,t[3]=l):l=t[3];let d;t[4]!==i||t[5]!==l?(d=(0,C.jsxs)("div",{children:[i,l]}),t[4]=i,t[5]=l,t[6]=d):d=t[6];let c;t[7]!==r?(c=r?.type==="video"&&(0,C.jsx)("video",{autoPlay:!0,loop:!0,playsInline:!0,muted:!0,controls:!0,children:(0,C.jsx)("source",{src:r.src,type:"video/mp4"})}),t[7]=r,t[8]=c):c=t[8];let u;t[9]!==r?(u=r?.type==="image"&&(0,C.jsx)("img",{src:r.src,alt:r.src}),t[9]=r,t[10]=u):u=t[10];let h;t[11]!==a?(h=a&&(0,C.jsx)(Yn,{...a}),t[11]=a,t[12]=h):h=t[12];const A=!!n&&n;let g;return t[13]!==d||t[14]!==c||t[15]!==u||t[16]!==h||t[17]!==A?(g=(0,C.jsxs)("div",{className:Ve.popoverContent,children:[d,c,u,h,A]}),t[13]=d,t[14]=c,t[15]=u,t[16]=h,t[17]=A,t[18]=g):g=t[18],g}),Yn=v.memo(e=>{const t=(0,vr.c)(12),{confirmText:o,declineText:r,onConfirm:s,onDecline:a,confirmDisabled:n}=e;let i;t[0]!==r||t[1]!==a?(i=(0,C.jsx)("button",{className:Ve.defer,onClick:a,children:r}),t[0]=r,t[1]=a,t[2]=i):i=t[2];let l;t[3]!==n?(l=(0,$n.default)(Ve.confirm,{[Ve.disabled]:n}),t[3]=n,t[4]=l):l=t[4];let d;t[5]!==o||t[6]!==s||t[7]!==l?(d=(0,C.jsx)("button",{className:l,onClick:s,children:o}),t[5]=o,t[6]=s,t[7]=l,t[8]=d):d=t[8];let c;return t[9]!==i||t[10]!==d?(c=(0,C.jsxs)("div",{className:Ve.actions,children:[i,d]}),t[9]=i,t[10]=d,t[11]=c):c=t[11],c});var q4=K4;const $4="1001",Y4="1000",z4="58px",Q4="StudioTour-module_home_FZ4aE",J4="StudioTour-module_homeHowBackgroundWhite_wWJvf",X4="StudioTour-module_largeButton_62Xbh",Z4="StudioTour-module_sectionContent_a2NJj",em="StudioTour-module_sectionHeader_6pNnN",tm="StudioTour-module_spacer_qmRlg",om="StudioTour-module_chevron_Clnn2",rm="StudioTour-module_splashText_yHWy5",am="StudioTour-module_splashSubtext_Xy6Gz",sm="StudioTour-module_aboutSection_4Kp-E",im="StudioTour-module_mobile_SE8VP",nm="StudioTour-module_desktop_wImqZ",dm="StudioTour-module_screenReaderOnlyLabel_t69QZ",lm="StudioTour-module_disabled_hcrR-",cm="StudioTour-module_disabledWithPointerEvents_m6E8B",um="StudioTour-module_noScrollBar_-p7Ne",hm="StudioTour-module_textOverflowEllipsis_BcPE7",pm="StudioTour-module_disableTextHighlight_Ai3TP",mm="StudioTour-module_genericButtonBlue_BJ0I3",fm="StudioTour-module_rmButtonUserAgentStyles_lZSEY",gm="StudioTour-module_popoverContent_-Nlqs",Am="StudioTour-module_actions_cco5Y",ym="StudioTour-module_studioTourButtons_ZxcCm",bm="StudioTour-module_hidden_cA9-q",_m="StudioTour-module_back_87EV-",Im="StudioTour-module_defer_eaLL3",Tm="StudioTour-module_confirm_anPhw",vm="StudioTour-module_next_6U-w2",Sm="StudioTour-module_dots_UwWbh",wm="StudioTour-module_dot_wFi8v",Em="StudioTour-module_selected_o06X3";var it={workspacePopoverZIndex:"18",popoverZIndex:"14",paywallZIndex:$4,paywallBgZIndex:Y4,collapsedMediaSidebarWidth:z4,home:Q4,homeHowBackgroundWhite:J4,largeButton:X4,sectionContent:Z4,sectionHeader:em,spacer:tm,chevron:om,splashText:rm,splashSubtext:am,aboutSection:sm,mobile:im,desktop:nm,screenReaderOnlyLabel:dm,disabled:lm,disabledWithPointerEvents:cm,noScrollBar:um,textOverflowEllipsis:hm,disableTextHighlight:pm,genericButtonBlue:mm,rmButtonUserAgentStyles:fm,popoverContent:gm,actions:Am,studioTourButtons:ym,hidden:bm,back:_m,defer:Im,confirm:Tm,next:vm,dots:Sm,dot:wm,selected:Em},Cm=ae(ye());function zn(e){const t=(0,Cm.c)(13);let o;t[0]!==e?(o=y=>{const{studioTour:b}=y,_=b.isOpen,S=b.currentStep,T=ds[b.tour][S],w=T?.step;return{isOpen:e?_&&(Array.isArray(e)?e:[e]).includes(w):_,currentStepIndex:S,currentStep:w,userBeganTour:bc(y),tour:y.studioTour.tour,source:y.studioTour.source,currentStepData:T}},t[0]=e,t[1]=o):o=t[1];const{isOpen:r,currentStep:s,tour:a,source:n,userBeganTour:i,currentStepIndex:l,currentStepData:d}=We(o,oc),c=ds[a],u=l===0,h=l===c.length-1;let A,g;
123return t[2]!==s||t[3]!==d||t[4]!==l||t[5]!==u||t[6]!==h||t[7]!==r||t[8]!==n||t[9]!==c||t[10]!==a||t[11]!==i?(g={isOpen:r,isFirstStep:u,isLastStep:h,steps:c,currentStep:s,currentStepIndex:l,userBeganTour:i,tour:a,source:n,currentStepData:d},t[2]=s,t[3]=d,t[4]=l,t[5]=u,t[6]=h,t[7]=r,t[8]=n,t[9]=c,t[10]=a,t[11]=i,t[12]=g):g=t[12],A=g,A}var xm=ae(ye()),km=ae(mo());const Rm=e=>{const t=(0,xm.c)(45),{onNext:o,onBack:r,onConfirm:s,onDecline:a,onFinish:n,nextText:i,backText:l,confirmText:d,finishText:c,declineText:u,disableBack:h}=e,{steps:A,currentStep:g}=zn(),y=A[0]?.step===g,b=A[A.length-1]?.step===g;let _;if(t[0]!==g||t[1]!==A){let N;t[3]!==g?(N=W=>W.step===g,t[3]=g,t[4]=N):N=t[4],_=A.findIndex(N),t[0]=g,t[1]=A,t[2]=_}else _=t[2];const S=_;let T;t[5]!==g?(T=()=>{g&&fc(g)},t[5]=g,t[6]=T):T=t[6];const w=T;let x;t[7]!==w||t[8]!==s?(x=async()=>{await s?.(),w()},t[7]=w,t[8]=s,t[9]=x):x=t[9];const k=x;let M;t[10]!==a?(M=async()=>{await a?.(),Uu()},t[10]=a,t[11]=M):M=t[11];const j=M;let O;t[12]!==c||t[13]!==w||t[14]!==b||t[15]!==i||t[16]!==n||t[17]!==o?(O=()=>(0,C.jsx)("button",{className:it.next,onClick:async N=>{N.preventDefault(),N.stopPropagation(),await o?.(),b&&await n?.(),w()},"data-testid":"studio-tour-next-button",children:b?c??"Done":i??"Next"}),t[12]=c,t[13]=w,t[14]=b,t[15]=i,t[16]=n,t[17]=o,t[18]=O):O=t[18];const B=O;let $;t[19]!==l||t[20]!==h||t[21]!==y||t[22]!==r?($=()=>(0,C.jsx)("button",{className:(0,km.default)(it.back,{[it.hidden]:y,[it.disabled]:h}),onClick:async N=>{N.preventDefault(),N.stopPropagation(),await r?.(),a1()},"data-testid":"studio-tour-back-button",children:l??"Back"}),t[19]=l,t[20]=h,t[21]=y,t[22]=r,t[23]=$):$=t[23];const Z=$;let Y;t[24]!==S||t[25]!==A?(Y=()=>(0,C.jsx)("div",{className:it.dots,"data-testid":"studio-tour-dots",children:A.map((N,W)=>(0,C.jsx)("div",{className:`${it.dot} ${S===W&&it.selected}`,onClick:se=>{se.preventDefault(),se.stopPropagation(),c1(W)}},W))}),t[24]=S,t[25]=A,t[26]=Y):Y=t[26];const Q=Y;let L;t[27]!==d||t[28]!==g||t[29]!==u||t[30]!==k||t[31]!==j?(L=()=>g&&!cs(g)?null:(0,C.jsx)(Yn,{confirmText:d??"Start Tour",declineText:u??"Maybe Later",onConfirm:k,onDecline:j}),t[27]=d,t[28]=g,t[29]=u,t[30]=k,t[31]=j,t[32]=L):L=t[32];const f=L;if(g&&cs(g)){let N;return t[33]!==f?(N=f(),t[33]=f,t[34]=N):N=t[34],N}let U;t[35]!==Z?(U=Z(),t[35]=Z,t[36]=U):U=t[36];let P;t[37]!==Q?(P=Q(),t[37]=Q,t[38]=P):P=t[38];let F;t[39]!==B?(F=B(),t[39]=B,t[40]=F):F=t[40];let H;return t[41]!==P||t[42]!==F||t[43]!==U?(H=(0,C.jsxs)("div",{className:it.studioTourButtons,children:[U,P,F]}),t[41]=P,t[42]=F,t[43]=U,t[44]=H):H=t[44],H};var Lm=v.memo(Rm),Qn=ae(ye()),Dm=e=>{const t=(0,Qn.c)(32);let o,r,s,a,n,i,l;t[0]!==e?({step:l,onCloseOverride:n,children:s,additionalOpenCondition:r,conditionalDataFlag:a,additionalButtonBehavior:o,...i}=e,t[0]=e,t[1]=o,t[2]=r,t[3]=s,t[4]=a,t[5]=n,t[6]=i,t[7]=l):(o=t[1],r=t[2],s=t[3],a=t[4],n=t[5],i=t[6],l=t[7]);const{isOpen:d,currentStepData:c}=zn(l);let u;e:{if(!c||!a){u=null;break e}if(!("conditionalDataOverride"in c)){u=null;break e}if(!c.conditionalDataOverride){u=null;break e}if(!c.conditionalDataOverride[a]){u=null;break e}const w=c.conditionalDataOverride[a];let x;t[8]!==r||t[9]!==w?(x=Pm({...w,additionalOpenCondition:r}),t[8]=r,t[9]=w,t[10]=x):x=t[10],u=x}const h=u;let A;e:{if(!c){A=null;break e}if(a&&!h){A=null;break e}if(h){let B;t[11]!==h||t[12]!==i?(B={...h,...i},t[11]=h,t[12]=i,t[13]=B):B=t[13],A=B;break e}let w;t[14]!==o||t[15]!==c?(w=Um({...c,additionalButtonBehavior:o}),t[14]=o,t[15]=c,t[16]=w):w=t[16];const x=n??Lu,k=r!==void 0?r&&d:d;let M;t[17]!==w||t[18]!==x||t[19]!==k?(M={...w,onClose:x,open:k},t[17]=w,t[18]=x,t[19]=k,t[20]=M):M=t[20];const j=M;let O;t[21]!==i||t[22]!==j?(O={...j,...i},t[21]=i,t[22]=j,t[23]=O):O=t[23],A=O}const g=A,y=(0,v.useRef)(!1),b=(0,v.useRef)(null);let _;t[24]!==g?(_=function(){const x=Om,k=b.current;if(!g||!k||!("scrollIntoView"in k)||y.current)return x;function M(){y.current||(k?.scrollIntoView({block:"center",behavior:"smooth"}),j=setTimeout(M,750))}let j=setTimeout(M,200);const O=new IntersectionObserver(B=>
123{B[0]?.isIntersecting===!0&&(y.current=!0,clearTimeout(j))},{threshold:[1]});return O.observe(k),()=>{O.disconnect(),clearTimeout(j)}},t[24]=g,t[25]=_):_=t[25];let S;if(t[26]!==a||t[27]!==g?(S=[a,g],t[26]=a,t[27]=g,t[28]=S):S=t[28],(0,v.useLayoutEffect)(_,S),!g||!g.open)return s;let T;return t[29]!==s||t[30]!==g?(T=(0,C.jsx)(q4,{...g,triggerRef:b,children:s}),t[29]=s,t[30]=g,t[31]=T):T=t[31],T},Mm=v.memo(e=>{const t=(0,Qn.c)(14),{description:o,media:r,additionalNote:s,buttons:a,additionalButtonBehavior:n}=e;let i;t[0]!==a?(i=a??{},t[0]=a,t[1]=i):i=t[1];let l,d;t[2]!==i?({enabled:d,...l}=i,t[2]=i,t[3]=l,t[4]=d):(l=t[3],d=t[4]);let c;t[5]!==n||t[6]!==l||t[7]!==d?(c=d?(0,C.jsx)(Lm,{...l,...n}):null,t[5]=n,t[6]=l,t[7]=d,t[8]=c):c=t[8];const u=c;let h;return t[9]!==s||t[10]!==u||t[11]!==o||t[12]!==r?(h=(0,C.jsx)(H4,{description:o,media:r,additionalNote:s,customButtons:u}),t[9]=s,t[10]=u,t[11]=o,t[12]=r,t[13]=h):h=t[13],h}),Um=({title:e,...t})=>({header:e,content:t.description||t.media||t.additionalNote?(0,C.jsx)(Mm,{...t}):void 0,...t}),Pm=({description:e,additionalOpenCondition:t})=>({content:e,open:t!==void 0?t:!0}),uf=v.memo(Dm);function Om(){}const Bm=e=>{const t=e?.trim().toLowerCase();return t?.startsWith("image")?"Image":t?.startsWith("video")?"Video":t?.startsWith("audio")?"Audio":"Unknown"},hf=e=>{const t={"Entry Point":e.entryPoint,Destination:e.destination,"Recreate Target":e.target};if(e.target==="Asset"){ce("Recreate Clicked",{...t,"Asset Type":Bm(e.assetType)});return}ce("Recreate Clicked",{...t,"Chat Source":e.chatSource})},Jn=e=>`/kai/recreate/${encodeURIComponent(e)}`,pf=e=>`${ac}${Jn(e)}`,Fm=1e3,mf=1e4,ff=5,gf=3;var Ga=`- Sometimes, users may upload images or videos that are omitted from this chat due to processing limits. YOU are unable to see these images, but you can still reference them in your responses / use them in tool calls. 124When you see a message like: User attached 2 video/image(s) exceeding the size limit; it is not viewable but can still be used as input to tool calls.)" 125NEVER ask the user to re-upload the media. If you see omitted content messages in the chat history, assume you have access to it. 126If a user references media, but there's no media uploaded in the chat, ask them to add it to the chat.`,Ka=`If a user submits a link to an image or video, we will download it and make it available to you as an uploaded asset. You can then use that asset as input to your tool calls. You should inform the user that their link has been downloaded. Ignore links and context around downloading links when considering tool calls; only consider what the user wants to do with those assets. 127 If a request is outside your capabilities, say you cannot perform that exact request and steer toward a supported content creation or editing alternative.`,jm=`You are Kapwing, a friendly AI assistant for creating and editing images, video, and audio. Users may upload media (images, videos, audio) and PDF documents in the chat; you can use those assets as inputs for the available function tools defined outside this prompt. Attached PDFs can provide text context for video generation. 128 129Core behavior: 130- You may perform any content creation or editing task that is directly supported by your available tools. Do not imply capabilities the tools cannot achieve (e.g. complex timeline edits, keyframed effects, adding elements you cannot generate). 131- If there seems to be missing context from a user's request (e.g. no uploaded media but the user is referencing something), ask the user to provide it. 132- Never mention tool names, tools, "functions", or internal mechanics in user-facing replies. 133- For tasks unrelated to content creation or editing, politely redirect the conversation back to assistance around content creation or editing tasks. 134- When suggesting the user to use video editing software, always refer to "Kapwing" specifically, not any other editor. 135- If none of the tool calls can fulfill the user's request, politely inform them that you cannot perform that request and suggest a supported content creation or editing alternative. Never call a tool in this case. 136- When generating new media (image, video, audio) first respond with a brief interpretation + plan, then (internally) invoke the appropriate tool(s). 137- If the request maps to a transcript-based short form edit (keywords like tiktok, reels, shorts, highlight, clip, versions, cuts, etc. with at least one uploaded video), respond with ONLY one short acknowledgement sentence (<= 15 words) then invoke the transcript edit toolâno extra explanation. 138- For translation requests on uploaded speech/audio/video, use subtitle generation directly. Do not use get_transcript tool for translation ever. 139- Respond in the same language as the user. 140- Use complete sentences. 141- Never invent tools. Use only those provided. 142- When calling tools, you must always include a friendly response / acknowledgement to the users' request in 2-3 sentences. This is your initial response that will be shown before the tool call is complete. 143- Don't call tool calls unncessarily. Only call a tool if it is required to fulfill the user's request. If the user's request can be fulfilled with a text response, then respond directly without calling any tools. 144- If it's unclear what type of content you should output, you must ask the user to clarify which type of output they would like to help you understand which tool you should call. To help clarify, you should suggest some creative ideas or options for the types of content you can create based on the user's prompt. 145- When calling a tool, explain what are you doing and why based on your understanding of the user's request. 146- When suggesting ideas, be sure to consider ALL of the different tool calls that are available to you for different ways the user's request could be fulfilled. Mention all of these different options (and more) to the user. 147- Never tell the user their request is vague or unclear. 148- You should proactively suggest ideas to help the user, based on the tool call capabilities you have, as well as ask them for more details about what they would like, so that you can better choose the right tool call. 149- Never attempt to make multiple tool calls in a single response. Only make one tool call per response. 150- Be creative in your responses. Suggest interesting ideas and options for the user to consider. Come up with ways to improve or enhance their requests. 151- You can use markdown formatting for lists, bullet points, sections, or numbered steps to clearly communicate your ideas. Long responses (>5 sentences) should use markdown formatting. 152- Be friendly, engaging, lighthearted, warm, and positive.`+Ga+Ka,Nm=` 153You are a helpful assistant that can help a user with different c
153ontent creation and editing tasks. You will receive a system prompt that will define your capabilities and limitations. You should only use the capabilities that are allowed by your system prompt. 154 155If the user asks you to do something that is outside of your system prompt, you should politely inform them that you are unable to assist with that request and redirect them to use the default Kapwing AI assistant. 156 157If the user asks you to do something that is related to content creation or editing, you should use the capabilities that are allowed by your system prompt to help them. 158 159If the user asks you to do something that is not related to content creation or editing, you should politely inform them that you are unable to assist with that request. 160 161You should never execute a function that isn't explicitly defined in your system prompt. 162 163Never mention tool calls or functions in your response. 164 165Always be friendly and helpful. Always use a friendly and helpful tone. Always use complete sentences. 166 167You can use markdown formatting for lists, bullet points, sections, or numbered steps to clearly communicate your ideas. Long responses (>5 sentences) should use markdown formatting. 168 169`+Ga+Ka,Vm=`You are Kapwing, a friendly AI assistant for creating and editing images, video, and audio. Users may upload media (images, videos, audio) and PDF documents in the chat; you can use those assets as inputs for the available function tools defined outside this prompt. Attached PDFs can provide text context for video generation. 170 171Core behavior: 172- You may perform any content creation or editing task that is directly supported by your available tools. Do not imply capabilities the tools cannot achieve (e.g. complex timeline edits, keyframed effects, adding elements you cannot generate). 173- If there seems to be missing context from a user's request (e.g. no uploaded media but the user is referencing something), ask the user to provide it. 174- Never mention tool names, tools, "functions", or internal mechanics in user-facing replies. 175- For tasks unrelated to content creation or editing, politely redirect the conversation back to assistance around content creation or editing tasks. 176- When suggesting the user to use video editing software, always refer to "Kapwing" specifically, not any other editor. 177- If none of the tool calls can fulfill the user's request, politely inform them that you cannot perform that request and suggest a supported content creation or editing alternative. Never call a tool in this case. 178- If a user mentions having media they wish to edit, but does not provide any media, ask them to upload the media before proceeding. Do not generate a plan or call any tools until the media is uploaded. 179- For translation requests on uploaded speech/audio/video, use subtitle generation directly. Do not use the get_transcript tool for translation ever. 180- Respond in the same language as the user. 181- Use complete sentences. 182- Never invent tools. Use only those provided. 183- Don't call tool calls unncessarily. Only call a tool if it is required to fulfill the user's request. If the user's request can be fulfilled with a text response, then respond directly without calling any tools. 184- If it's unclear what type of content you should output, you must ask the user to clarify which type of output they would like to help you understand which tool you should call. To help clarify, you may suggest creative ideas or options, but those suggestions must not change the deliverable the user explicitly asked for in the current request. 185- When suggesting ideas, consider different tool calls only as optional follow-up suggestions or clarification options. Do not change, broaden, or replace the user's requested deliverable for the current request. 186- Never tell the user their request is vague or unclear. 187- You should proactively suggest ideas to help the user, based on the tool call capabilities you have, as well as ask them for more details when needed, but you must preserve the deliverable the user explicitly requested for the current request. 188- When multiple tool calls are required to fulfill the user's request (e.g., multi-scene videos), you may include multiple tool calls; otherwise prefer the minimal number of tool calls. 189- Be creative in your responses. Suggest interesting ideas and options for the user to consider, but treat them as optional follow-ups rather than changes to the current request. Do not improve or enhance the request by changing the requested output type. 190- You can use markdown formatting for lists, bullet points, sections, or numbered steps to clearly communicate your ideas. Long responses (>5 sentences) should use markdown formatting. 191- Be friendly, engaging, lighthearted, warm, and positive.`+Ga+Ka,Wa=` 192If the user asks for speaker focus, active speaker centering, subject-centered reframing, or mobile reframing on uploaded video, use the smart resize/reframing capability when the request is about cropping/reframing the visible video for formats like 9:16. 193Only direct the user to Kapwing's full editor when they are asking for a more advanced speaker focus effect beyond reframing/cropping. 194`,Ha=` 195Customer Support Boundaries: 196You are not a customer service representative and must never act as one. 197If a user asks for customer service help (including account, billing, subscription, refund, or platform issue support), or if they are angry/frustrated and seeking support, direct them to the "Help and Resources" tab in Kai and tell them to use "Contact us" or "Report a problem." 198If a user asks for edits requiring advanced timeline features (e.g. keyframe-level animation, or other edits or workflows not currently supported by tool calls), you should recommend they use Kapwing's full editor, a powerful online video and image editor designed for those tasks. When recommending the editor, point them to the "Help Center" button in the bottom left of the screen, within the "Help and Resources" menu. 199You should not give specific instructions on how to use the editor, but should instead point them to the aformentioned "Help Center" to find relevant tutorials and guides for using the editor to achieve their goals. 200Never say or imply that any generation, edit, or retry is free, complimentary, "without charge," or will not consume credits. Every tool call always consumes credits. 201Never promise refunds, reimbursements, credit returns, waived charges, or account-specific billing outcomes. 202Never send links or URLs to the user. Always direct users using in-product navigation text only. 203`,qa=` 204Model Preferences: 205Users may specify model preferences in their message, formatted as: 206(Model preference: image=<model_id>, video=<model_id>, music=<model_id>) 207If a model preference is provided and the requested tool supports model selection, you should honor the user's preference. If not provided, use the default model. 208Do not mention model preferences in your responses, but ensure they are applied when generating content. 209`,$a=` 210Character references: 211Characters are reusable visual references for a specific person or object. A character is represented by one or more pre-generated reference images plus an @tag. When a character is referenced in a video or image prompt with its exact @tag, those reference images can be passed to the generation model so the visual identity stays more consistent across different tool calls. 212`;const Af=jm+qa+$a+Wa+Ha,yf=Nm+qa+$a+Wa+Ha,bf=Vm+qa+$a+Wa+Ha;var Ys=new Set(["pending","pending_creation"]),ct=class{constructor(e){this.job=e}get isRerunnable(){return!0}get sourceAssetIds(){return[]}get referencedAssetIds(){const e=new Set(this.sourceAssetIds);return"assetId"in this.job&&this.job.assetId&&e.add(String(this.job.assetId)),"assetIds"in this.job&&this.job.assetIds?.forEach(t=>e.add(String(t))),"outputVideoAssetIds"in this.job&&this.job.outputVideoAssetIds?.forEach(t=>e.add(String(t))),"outputImageAssetIds"in this.job&&this.job.outputImageAssetIds?.forEach(t=>e.add(String(t))),"output"in this.job&&this.job.output?.assetId&&e.add(String(this.job.output.assetId)),Array.from(e)}getSourceAssetId(e){return this.sourceAssetIds[e]??null}get projectResults(){return[]}get generatedName(){if("generatedName"in this.job&&this.job.generatedName)return this.job.generatedName}get outputType(){return"asset"}get jobShouldBeMarkedAsTimedOut(){const e=new Date(this.job.created);return new Date().getTime()-e.getTime()>1e3*60*60&&Ys.has(this.job.status)}get jobIsMarkedAsTimedOut(){return!!this.job.jobHasTimedOut}get isError(){return this.jobIsMarkedAsTimedOut?!0:this.job.status==="error"}get errorMessageText(){return this.isError?this.jobIsMarkedAsTimedOut?"This generation has timed out. Please try again in a new chat.":this.job.error?.isUserFacingMessage&&this.job.error.message?this.job.error.message:"errorMessage"in this.job&&this.job.errorMessage?`An error occurred while generating: ${this.job.errorMessage}. Please try again later.`:"This generation has failed, please try a different generation, or try again later.":null}get isLoading(){return Ys.has(this.job.status)&&!this.jobIsMarkedAsTimedOut}get loadingMessage(){if("currentStageDescription"in this.job&&this.job.currentStageDescription)return this.job.currentStageDescription;let e="This generation is in progress.";return"progressText"in this.job&&this.job.progressText&&(e+=` ${this.job.progressText}`),e}get isComplete(){return this.job.status==="complete"}get isSettled(){return this.isComplete||this.isError}get modelId(){return"modelId"in this.job?this.job.modelId:null}get isLongPollJob(){return!1}get longPollWaitingLabel(){return null}getPostToolCallConclusionMessage(e){return this.job?.postCompletionResponse?this.job.postCompletionResponse:e??null}getCharacterUseMetadata(){return Bi(this.job)||cn(this.job)?{containsCharacters:this.job.characterUseMetadata?this.job.characterUseMetadata.chatCreatedCharacters>0||this.job.characterUseMetadata.userCreatedCharacters>0||(this.job.characterUseMetadata.stockCharacters??0)>0:this.job.usesCharacters??!1,characterUseMetadata:this.job.characterUseMetadata}:{}}},Gm=class extends ct{get sourceAssetIds(){if(this.job.type==="text-to-speech"){const t=this.job.output?.assetId;return t?[String(t)]:[]}const e=this.job.assetId;return e?[String(e)]:[]}get outputType(){return"audio"}},Km=e=>e.editType===ho.ScriptToVideo,zs=e=>e.editType===ho.AgentPlan,Fr=e=>e.editType===ho.AgentProject,Ya=class Jo extends ct{static getReferencedAssetIdsForProjects(t){const o=new Set;return t?.forEach(r=>{r.layers?.forEach(s=>
212{il(s).forEach(a=>o.add(a)),!to(s)&&!("asset_id"in s&&s.asset_id)&&"videoAssetId"in s&&typeof s.videoAssetId=="string"&&o.add(s.videoAssetId)})}),Array.from(o)}get scriptToVideoJob(){return Km(this.job)?this.job:null}get isScriptToVideoJob(){return!!this.scriptToVideoJob}get isAgentPlanJob(){return zs(this.job)}get isScriptToVideoConfirmation(){return this.isScriptToVideoJob&&this.job.status==="pending_confirmation"}get outputType(){return Fr(this.job)&&this.job.autonomousOutputType?this.job.autonomousOutputType:"project"}get sourceAssetIds(){return Fr(this.job)&&this.job.autonomousOutputType&&this.job.assetIds?.length?this.job.assetIds.map(String):this.projectResults.flatMap(t=>t.layers.flatMap(o=>to(o)?o.video_asset_id?[String(o.video_asset_id)]:[]:"asset_id"in o&&o.asset_id?[String(o.asset_id)]:"videoAssetId"in o&&o.videoAssetId?[String(o.videoAssetId)]:[]))}get referencedAssetIds(){const t=new Set([...super.referencedAssetIds,...Jo.getReferencedAssetIdsForProjects(this.job.results)]);return fa(this.job)&&(Jo.getReferencedAssetIdsForProjects(this.job.agentRun.projectDraftCheckpoint).forEach(o=>t.add(o)),Jo.getReferencedAssetIdsForProjects(this.job.agentRun.projectDraftSnapshots).forEach(o=>t.add(o))),Array.from(t)}getSourceAssetId(t){if(Fr(this.job)&&this.job.autonomousOutputType&&this.job.assetIds?.length){const r=this.job.assetIds[t];return r?String(r):null}const o=this.projectResults.flatMap(r=>r.layers)[t];return o?to(o)?o.video_asset_id?String(o.video_asset_id):null:"asset_id"in o&&o.asset_id?String(o.asset_id):"videoAssetId"in o&&o.videoAssetId?String(o.videoAssetId):null:null}get isLongPollJob(){return this.job.editType===ho.MaskVideo}get loadingMessage(){return this.job.currentStageDescription||"This generation is in progress."}get projectResults(){return this.job.results||[]}get jobSucceededWithoutLayers(){const t=this.job.results||[],o=t.length>0,r=t.some(s=>s.layers&&s.layers.length>0);return o&&!r&&this.job.status==="complete"}get isError(){return this.jobSucceededWithoutLayers?!0:super.isError}get isSettled(){const t=zs(this.job)&&!this.job.isMockJobWhileStreaming;return super.isSettled||this.isScriptToVideoConfirmation||t}get errorMessageText(){if(this.jobSucceededWithoutLayers){let t="The project was successfully generated but no layers were found. Please try again later.";return this.job.editType===ho.TranscriptEdit&&(t+=" â make sure the videos have spoken words."),t}return super.errorMessageText}},Wm=class extends Ya{get isRerunnable(){return!1}get isLongPollJob(){return!0}get longPollWaitingLabel(){return"media editing"}getPostToolCallConclusionMessage(e){return this.job.llmResponse?.userFacingResponse?this.job.llmResponse.userFacingResponse:super.getPostToolCallConclusionMessage(e)}},Hm=class extends ct{get outputType(){return"transcript"}get loadingMessage(){return this.job.currentStageDescription||"This transcription is in progress."}},qm=class extends ct{get sourceAssetIds(){return(this.job.outputImageAssetIds??[]).map(String)}get outputType(){return"image"}},$m=class extends Ya{get isRerunnable(){return!1}get isLongPollJob(){return!0}get longPollWaitingLabel(){return"media editing"}getPostToolCallConclusionMessage(e){return this.job.llmResponse?.userFacingResponse?this.job.llmResponse.userFacingResponse:super.getPostToolCallConclusionMessage(e)}},Ym=class extends ct{get sourceAssetIds(){return(this.job.assetIds??[]).map(String)}get loadingMessage(){return"Extracting media from this link"}get errorMessageText(){return this.isError?`The link failed to extract: ${this.job.url||"the provided link"}. Please try a different link or upload the file directly.`:null}},zm=class extends ct{get sourceAssetIds(){return(this.job.outputVideoAssetIds??[]).map(String)}get outputType(){return"scene"}get isLongPollJob(){return!0}get longPollWaitingLabel(){return"video generation"}},Qs=new Set([Dt.QUEUED,Dt.STARTED,Dt.RUNNING]),Qm=class extends ct{get sourceAssetIds(){return(this.job.outputVideoAssetIds??[]).map(String)}get jobShouldBeMarkedAsTimedOut(){const e=new Date(this.job.created);return new Date().getTime()-e.getTime()>1e3*60*60&&Qs.has(this.job.status)}get isLoading(){return Qs.has(this.job.status)&&!this.jobIsMarkedAsTimedOut}get isComplete(){return this.job.status===Dt.SUCCESS}get isSettled(){return this.isComplete||this.isError}get isError(){return this.jobIsMarkedAsTimedOut?!0:this.job.status===Dt.ERROR}get outputType(){return"upscaled video"}get errorMessageText(){return this.job.status===Dt.ERROR?"An error occurred while upscaling this video. Please try again later.":super.errorMessageText}get isLongPollJob(){return!0}get longPollWaitingLabel(){return"video upscaling"}},Jm=class Xn{constructor(t){this.job=t,this.interpreter=Xn.getInterpreterForJob(t)}static getInterpreterForJob(t){return cn(t)?new qm(t):Bi(t)?new zm(t):vu(t)?new Qm(t):lu(t)?new Gm(t):xu(t)?new Hm(t):$c(t)?new Wm(t):mu(t)?new $m(t):bu(t)||ru(t)?new Ya(t):t.type==="
212kai-pasted-link"?new Ym(t):new ct(t)}get generatedName(){return this.interpreter.generatedName}get jobIsMarkedAsTimedOut(){return this.interpreter.jobIsMarkedAsTimedOut}get isError(){return this.interpreter.isError}get errorMessageText(){return this.interpreter.errorMessageText}get isLoading(){return this.interpreter.isLoading}get loadingMessage(){return this.interpreter.loadingMessage}get isComplete(){return this.interpreter.isComplete}get isSettled(){return this.interpreter.isSettled}get outputType(){return this.interpreter.outputType}get modelId(){return this.interpreter.modelId}get isLongPollJob(){return this.interpreter.isLongPollJob}get longPollWaitingLabel(){return this.interpreter.longPollWaitingLabel}},_f=300*1e3,If=1800*1e3;const kt=e=>e.responseUpToDate&&!e.activeAgentResponseInfo&&!e.activeAgentResponseJobId,ra="kai:message-submission",Xm="kai:chat-loaded",Tf="kai-user-message";var Zm={sequence:0},e9={chatId:"",sequence:0},aa=new Set,sa=Zm,ia=e9;function Zn(e){return aa.add(e),function(){aa.delete(e)}}function ed(){aa.forEach(e=>{e()})}function Js(){return sa}function Xs(){return ia}function vf(){return(0,v.useSyncExternalStore)(Zn,Js,Js)}function Sf(){return(0,v.useSyncExternalStore)(Zn,Xs,Xs)}function t9(e){return new CustomEvent(ra,{detail:{chatId:e}})}function o9(e){return new CustomEvent(Xm,{detail:{chatId:e}})}function wf(e){sa={chatId:e,sequence:sa.sequence+1},ed(),window.dispatchEvent(t9(e))}function r9(e){ia={chatId:e,sequence:ia.sequence+1},ed(),window.dispatchEvent(o9(e))}function Ef(e){return window.addEventListener(ra,e),function(){window.removeEventListener(ra,e)}}function a9({jobId:e,lastEventId:t,onSharedEvent:o,onComplete:r,onError:s}){let a=!1,n=t;const i=d=>{a||(a=!0,d())},l=ne.kai.streamAgentResponse.subscribe({jobId:e,lastEventId:t},{onData(d){if(!("data"in d))return;"id"in d&&typeof d.id=="string"&&(n=d.id);const c=d.data;q5(c)&&o(c),c.type==="chat_response:complete"&&i(()=>{l.unsubscribe(),r()})},onError(d){i(()=>{l.unsubscribe(),s(d)})},onComplete(){i(()=>{l.unsubscribe(),r()})}});return{unsubscribe:()=>{i(()=>{l.unsubscribe()})},getLastEventId:()=>n}}var s9=6e4,i9=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`plugin-request-${Date.now()}-${Math.random().toString(16).slice(2)}`;const za=({targetWindow:e,message:t,value:o,timeoutMs:r=s9})=>{const s=o.requestId??i9();return typeof window>"u"?(e.postMessage({message:t,value:{...o,requestId:s}},"*"),Promise.resolve({success:!0,url:o.url})):new Promise((a,n)=>{const i=()=>{window.removeEventListener("message",l),window.clearTimeout(d)},l=c=>{if(c.source!==e)return;const u=c.data;!u||typeof u!="object"||"requestId"in u&&u.requestId!==s||"success"in u&&(i(),a({snapshotId:typeof u.snapshotId=="string"?u.snapshotId:void 0,success:!!u.success,url:u.url}))},d=window.setTimeout(()=>{i(),n(new Error(`Timed out waiting for plugin response to "${t}".`))},r);window.addEventListener("message",l),e.postMessage({message:t,value:{...o,requestId:s}},"*")})},Qa=({targetWindow:e,url:t,pluginInfo:o,kaiPlacement:r,kaiSource:s,sourceAssetId:a,message:n})=>za({targetWindow:e,message:n,value:{url:t,pluginInfo:o,kaiPlacement:r,kaiSource:s,sourceAssetId:a}});function n9({targetWindow:e,audioUrl:t,pluginInfo:o,kaiPlacement:r,kaiSource:s,sourceAssetId:a}){return Qa({targetWindow:e,url:t,pluginInfo:o,kaiPlacement:r,kaiSource:s,sourceAssetId:a,message:"audio-add-from-url"})}var so=null;function Cf(e){return so=e,()=>{so===e&&(so=null)}}function Sr(){if(!so)throw new Error("Kai Studio action executor is not available.");return so}function d9(e){switch(e.mode){case"side":return async(t,o)=>(ce("Add layer from Plugin",{Plugin:"kai",Source:"side kai"}),lt("audio","kai","side kai"),await Sr().addAudio(t,"kai",o?.kaiPlacement,o?.sourceAssetId),{success:!0,url:t});case"full":case"legacy-side":return(t,o)=>{const r=e.getStudioWindow();return r?n9({targetWindow:r,audioUrl:t,pluginInfo:{id:"kai"},kaiPlacement:o?.kaiPlacement,kaiSource:e.mode==="full"?"full kai":"side kai",sourceAssetId:o?.sourceAssetId}):Promise.reject(new Error("Kai Studio window is not available."))}}}function l9({targetWindow:e,imageUrl:t,pluginInfo:o,kaiPlacement:r,kaiSource:s,sourceAssetId:a}){return Qa({targetWindow:e,url:t,pluginInfo:o,kaiPlacement:r,kaiSource:s,sourceAssetId:a,message:"image-add-from-url"})}function td(e,t){const{state:o}=I(),r=o.studio.allLayers?.byId;if(!r)return;const s=o.studio.duration??0;let a=0,n=!1;return Object.values(r).forEach(i=>
212{if(i.type!==t||i.pluginSource!==e)return;const{end:l}=et(i,s);a=Math.max(a,l),n=!0}),n?a:void 0}function od(){const e=I().state.studio.allLayers?.byId;if(!e)return 0;let t=-1;return Object.values(e).forEach(o=>{o.timelineRow==null||o.timelineRow<0||(t=Math.max(t,o.timelineRow))}),Math.max(0,t+1)}async function c9({asset:e,layerType:t,pluginId:o,kaiPlacement:r}){const s=r?.startTimeSec,a=r?.endTimeSec,n=s??td(o,t),i=od(),l={pluginSource:o};return t===de.Audio&&(l.type=de.Audio),Pa(e,{layerProperties:l,useCustomVideoDelay:t===de.Image?void 0:n,propertiesAfterTypeDetermined:d=>{const c={timelineRow:i};if(t===de.Image){if(typeof n!="number")return c;const{start:A,end:g}=et(d,I().state.studio.duration??0),y=Math.max(0,g-A);return c.startTime=n,c.endTime=typeof s=="number"&&typeof a=="number"?Math.max(a,s):n+y,c}if(typeof s!="number"||typeof a!="number")return c;const u=Math.max(0,a-s);if(u===0)return c;c.startTime=0;const h="duration"in d&&typeof d.duration=="number"&&d.duration>0?d.duration:void 0;return c.endTime=h!==void 0?Math.min(u,h):u,c}})}var u9=ae(mi());async function h9({dispatch:e,imageUrl:t,pluginId:o,kaiPlacement:r,kaiSource:s,sourceAssetId:a}){ce("Add layer from Plugin",{Plugin:o,Source:s}),lt("image",o,s);const{state:n}=I(),i=a?n.assets.byId[a]:void 0;if(i){await c9({asset:i,layerType:de.Image,pluginId:o,kaiPlacement:r})||mt({description:"Failed to add this image",sentryMessage:"Failed to add existing image from plugin"});return}const l=Be(n)??void 0,{asset:d,cmlFile:c,teamAsset:u,videoAsset:h}=await an(t,{video_id:n.studio._id,...a?{sourceAssetId:a,teamId:l}:{}});_r(d,c,u,h);const A=(0,u9.v4)();e(fr({assetId:d._id,mediaCacheId:A}));const g=d.status===er.uploaded,y=await kn(d,A,{mime:"image/jpeg",source:g?"upload":"pastedLink",pluginSource:o,asset_id:d._id,cmlFileId:c?._id,videoAssetId:h?._id,uploadPending:!g});if(!y){mt({description:"Failed to add this image",sentryMessage:"Failed to add image from plugin"});return}const{start:b,end:_}=et(y,I().state.studio.duration??0),S=Math.max(0,_-b),T=r?.startTimeSec,w=r?.endTimeSec,x=T??td(o,de.Image);typeof x=="number"&&(y.startTime=x,typeof T=="number"&&typeof w=="number"?y.endTime=Math.max(w,T):y.endTime=x+S),y.timelineRow=od();try{Dn(y,{selectLayerInCreator:!0,knownTimelineRow:!0,useCustomVideoDelay:x})}catch(k){console.error(k)}}function p9(e){switch(e.mode){case"side":return async(t,o)=>(await h9({dispatch:e.dispatch,imageUrl:t,pluginId:"kai",kaiPlacement:o?.kaiPlacement,kaiSource:"side kai",sourceAssetId:o?.sourceAssetId}),{success:!0,url:t});case"full":case"legacy-side":return(t,o)=>{const r=e.getStudioWindow();return r?l9({targetWindow:r,imageUrl:t,pluginInfo:{id:"kai"},kaiPlacement:o?.kaiPlacement,kaiSource:e.mode==="full"?"full kai":"side kai",sourceAssetId:o?.sourceAssetId}):Promise.reject(new Error("Kai Studio window is not available."))}}}function m9({targetWindow:e,kaiProject:t,pluginInfo:o,kaiSource:r,magicSubtitlePreset:s,assets:a}){return za({targetWindow:e,message:"project-add-to-open-project",value:{kaiProject:t,pluginInfo:o,kaiSource:r,magicSubtitlePreset:s,assets:a}})}function f9({targetWindow:e,kaiProject:t,pluginInfo:o,kaiSource:r,assets:s,kaiAgentProjectToolCallId:a,restoreSnapshotToolCallId:n,sourceVideoId:i}){return za({targetWindow:e,message:"project-update-open-project",value:{kaiProject:t,pluginInfo:o,kaiSource:r,assets:s,kaiAgentProjectToolCallId:a,restoreSnapshotToolCallId:n,sourceVideoId:i}})}function g9(e){switch(e.mode){case"side":return async(t,o,r)=>(ce("Add layer from Plugin",{Plugin:"kai",Source:"side kai"}),lt("project","kai","side kai"),await Sr().addProject(t,"kai",o,r),{success:!0});case"full":case"legacy-side":return(t,o,r)=>{const s=e.getStudioWindow();return s?m9({targetWindow:s,kaiProject:t,pluginInfo:{id:"kai"},kaiSource:e.mode==="full"?"full kai":"side kai",magicSubtitlePreset:o,assets:r}):Promise.reject(new Error("Kai Studio window is not available."))}}}function A9({targetWindow:e,videoUrl:t,pluginInfo:o,kaiPlacement:r,kaiSource:s,sourceAssetId:a}){return Qa({targetWindow:e,url:t,pluginInfo:o,kaiPlacement:r,kaiSource:s,sourceAssetId:a,message:"video-add-from-url"})}function y9(e){switch(e.mode){case"side":return async(t,o)=>(ce("Add layer from Plugin",{Plugin:"kai",Source:"side kai"}),lt("video","kai","side kai"),await Sr().addVideo(t,"kai",o?.kaiPlacement,o?.sourceAssetId),{success:!0,url:t});case"full":case"legacy-side":return(t,o)=>{const r=e.getStudioWindow();return r?A9({targetWindow:r,videoUrl:t,pluginInfo:{id:"kai"},kaiPlacement:o?.kaiPlacement,kaiSource:e.mode==="full"?"full kai":"side kai",sourceAssetId:o?.sourceAssetId}):Promise.reject(new Error("Kai Studio window is not available."))}}}function b9(e){return e.mode!=="legacy-side"?Ol:()=>{e.getStudioWindow()?.postMessage({type:"kapwing-request-action",payload:{action:"openBilling"}},e.getStudioOrigin()??"*")}}function _9(e){switch(e.mode){case"side":return()=>(d1(),!0);case"full":case"legacy-side":return()=>{const t=e.getStudioWindow();return t?(t.postMessage({type:"kapwing-request-action",payload:{action:"openExportPanel"}},e.getStudioOrigin()??"*"),!0):!1}}}function I9(e){return e.mode==="side"?t=>{ps({...t,extraAmplitudeEventProperties:{...t.extraAmplitudeEventProperties,"Kai Surface":"side kai"}})}:e.mode==="full"?ps:t=>{e.getStudioWindow()?.postMessage({type:"kapwing-request-action",payload:{action:"openPaywall",paywallAction:t.action}},e.getStudioOrigin()??"*")}}var T9=ae(It());function v9(e){return e.mode!=="side"?async t=>{e.getStudioWindow()?.postMessage({type:"kapwing-request-action",payload:{action:"restoreSnapshot",snapshotId:t}},e.getStudioOrigin()??"*")}:async t=>{const o=I().state.studio._id;if(o)try{const r=await ku({video_id:o,snapshot_id:t,migrateToVersion:tc});e.dispatch(ju({video:(0,T9.cloneDeep)(r.content),source:"versionHistory",preserveId:!0,preserveStudioTime:!0,origin:!1,undoable:!0,sync:!0,isFirstVideoLoad:!0})),e.dispatch(ke({description:"Your project was successfully reverted!",type:"success"}))}catch(r){console.error("Failed to restore Side Kai snapshot",r),e.dispatch(ke({description:"Failed to restore this version.",type:"error"}))}}}function S9(e){return{...e,layersPendingUpload:{},deletedLayerDict:{}}}function w9(e,t){const o=Hi(e.studio,sn(e.studio)),{currentUser:{user:r=void 0},currentUser:s}=e||{},a=E9(o),n=zr(s)?r?._id:void 0,i=zr(s)?r?.email:void 0,l={...S9(e.studio),...su(e),duration:o,creatorId:n,creatorEmail:i,watermark:a,sessionSettings:void 0,..."Cypress"in window&&{isCypress:!0}};return t&&(l.name=e.studio.name||"Untitled Project"),l}const E9=e=>{const t=fo();return!(t.hasPermission(Xo.EXPORT_ALL_WITHOUT_WATERMARK)||e<=30&&t.hasPermission(Xo.EXPORT_30_SEC_WITHOUT_WATERMARK))};function C9(e){switch(e.mode){case"side":return async(t,o,r)=>{const s=await Sr().updateProject(t,o,{kaiAgentProjectToolCallId:r?.kaiAgentProjectToolCallId,sourceVideoId:r?.sourceVideoId});let a;if(s&&r?.restoreSnapshotToolCallId)try{const n=await r1(w9(I().state,!1));
212"_id"in n&&(a=String(n._id))}catch(n){console.error("Failed to create Side Kai restore snapshot",n)}return{success:s,snapshotId:a}};case"full":case"legacy-side":return(t,o,r)=>{const s=e.getStudioWindow();return s?f9({targetWindow:s,kaiProject:t,pluginInfo:{id:"kai"},kaiSource:e.mode==="full"?"full kai":"side kai",assets:o,kaiAgentProjectToolCallId:r?.kaiAgentProjectToolCallId,restoreSnapshotToolCallId:r?.restoreSnapshotToolCallId,sourceVideoId:r?.sourceVideoId}):Promise.reject(new Error("Kai Studio window is not available."))}}}var rd=ae(ye()),ad=(0,v.createContext)(null);function x9(){return{chatLoaded:new Set,messageSubmitted:new Set,responseFinished:new Set}}function k9(e){let t=e,o=null;return{getOrigin:()=>o,get:()=>t,setOrigin:r=>{o=r},set:r=>{t=r}}}var R9=e=>({addImageToOpenProject:p9(e),addVideoToOpenProject:y9(e),addAudioToOpenProject:d9(e),addProjectToOpenProject:g9(e),updateOpenProject:C9(e),openExportPanel:_9(e),openBilling:b9(e),openPaywall:I9(e),restoreSnapshot:v9(e)});function xf({children:e,mode:t}){const o=gr(),[r]=(0,v.useState)(()=>k9(t==="legacy-side"&&typeof window<"u"?window.parent:null)),[s]=(0,v.useState)(x9),a=(0,v.useCallback)(A=>{r.set(A)},[r]),n=(0,v.useCallback)(()=>r.get(),[r]),i=(0,v.useCallback)(A=>{r.setOrigin(A)},[r]),l=(0,v.useCallback)(()=>r.getOrigin(),[r]),d=(0,v.useMemo)(()=>t==="side"?{mode:t,dispatch:o}:{mode:t,getStudioOrigin:l,getStudioWindow:n},[o,l,n,t]),c=(0,v.useMemo)(()=>R9(d),[d]),u=(0,v.useCallback)((A,g)=>{s[A].forEach(y=>y(g))},[s]),h=(0,v.useMemo)(()=>({actions:c,emit:u,listeners:s,mode:t,setStudioOrigin:i,setStudioWindow:a}),[c,u,s,t,i,a]);return(0,C.jsx)(ad.Provider,{value:h,children:e})}function wr(){const e=(0,v.useContext)(ad);if(!e)throw new Error("Kai host hooks must be used within KaiHostProvider.");return e}function kf(){return wr().actions}function Rf(){const e=(0,rd.c)(4),{mode:t,setStudioOrigin:o,setStudioWindow:r}=wr();let s;return e[0]!==t||e[1]!==o||e[2]!==r?(s={mode:t,setStudioOrigin:o,setStudioWindow:r},e[0]=t,e[1]=o,e[2]=r,e[3]=s):s=e[3],s}function L9(){return wr().emit}function D9(e,t){const o=(0,rd.c)(5),{listeners:r}=wr(),s=Di(t);let a,n;o[0]!==e||o[1]!==r||o[2]!==s?(a=()=>{const i=r[e];return i.add(s),()=>{i.delete(s)}},n=[e,r,s],o[0]=e,o[1]=r,o[2]=s,o[3]=a,o[4]=n):(a=o[3],n=o[4]),(0,v.useEffect)(a,n)}function Lf(){return D9("chatLoaded",M9),null}function M9(e){const{chatId:t}=e;window.parent.postMessage({type:"kapwing-side-kai-chat-loaded",chatId:t},window.location.origin)}function U9(e,t){if(e?.chatId===t.chatId&&!(!e.isLoading||t.isLoading))return t.chatId}var P9=ae(It());const Ke={modelId:K.KLING_MOTION_CONTROL,imageMode:"motion_control",subjectInput:{kind:"image"},motionReferenceInput:{kind:"video",source:"uploaded",maxDurationSeconds:10}};var Zs=["none","start_frame","start_and_end_frame","image_and_audio"];const Df={[K.MINIMAX_H3]:Zs,[K.MINIMAX_H3_TRIAL]:Zs,[K.SEEDANCE_2_5]:["none","start_frame","reference"],[K.SEEDANCE_2_0]:["none","start_frame","reference"],[K.SEEDANCE_PRO]:["none","start_frame"],[K.HAPPY_HORSE_T2V]:["none"],[K.KAI_VIDEO_1]:["none","start_frame"],[K.KLING_OMNI_O1]:["none","start_frame","reference"],[K.OMNI_HUMAN]:["image_and_audio"],[Ke.modelId]:[Ke.imageMode],[K.SORA_2]:["none","start_frame"],[K.VEO_3]:["none","start_frame","start_and_end_frame","reference"],[K.PRODIA_WAN_2_2]:["none","start_frame"],[K.GROK_IMAGINE_VIDEO]:["none","start_frame"]};const Mf=Math.max(7,9,3,30);var ht=["16:9","9:16","1:1","4:3","3:4","21:9"],O9={[K.MINIMAX_H3]:[...ht],[K.MINIMAX_H3_TRIAL]:[...ht],[K.SEEDANCE_2_5]:[...ht],[K.SEEDANCE_2_0]:[...ht],[K.SEEDANCE_PRO]:[...ht],[K.HAPPY_HORSE_T2V]:["16:9","9:16","1:1","4:3","3:4"],[K.KLING_OMNI_O1]:["16:9","9:16","1:1"],[K.SORA_2]:["16:9","9:16"],[K.VEO_3]:["16:9","9:16"],[Ke.modelId]:[...ht],[K.PRODIA_WAN_2_2]:["16:9"],[K.GROK_IMAGINE_VIDEO]:["16:9","9:16","1:1","4:3","3:4","2:3"],[K.OMNI_HUMAN]:[...ht]},B9=e=>{const t=(0,P9.cloneDeep)(O9);return e==="from-image"&&(t[K.PRODIA_WAN_2_2]=["16:9","9:16"]),t};const sd=(e,t)=>B9(t)[e],ft=["1:1","9:16","16:9","4:5","5:4","3:4","4:3","2:3","21:9"],Uf=p.enum(ft);var F9="16:9";const ei=e=>ft.includes(e)?e:F9,Pf=e=>{if(e&&e!==null&&typeof e=="object"&&!Array.isArray(e)&&Object.prototype.hasOwnProperty.call(e,"key")){const{key:t}=e;return ei(t)}return ei(e)},Of=[{key:"1:1",className:"oneOne"},{key:"9:16",className:"nineSixteen"},{key:"16:9",className:"sixteenNine"},{key:"4:5",className:"fourFive"},{key:"5:4",className:"fiveFour"},{key:"3:4",className:"threeFour"},{key:"4:3",className:"fourThree"},{key:"2:3",className:"twoThree"},{key:"21:9",className:"twentyOneNine"}],Bf={"1:1":1/1,"9:16":9/16,"16:9":16/9,"4:5":4/5,"5:4":5/4,"3:4":3/4,"4:3":4/3,"2:3":2/3,"21:9":21/9},Ff=0;var j9=240,N9=30,V9=12,G9=12,K9=30,W9=30;const id=({isPaid:e})=>e?V9:G9,nd=({isPaid:e})=>e?j9:N9,H9=({isPaid:e})=>e?K9:W9,ti=({isPaid:e})=>e?`${Math.floor(nd({isPaid:e})/60)} minutes`:`${id({isPaid:e})} seconds`,ee={GENERATE_SINGLE_SCENE_VIDEO:"Generate Single-Scene Video",GENERATE_VIDEO_FROM_IMAGE:"Generate Video from Image",GENERATE_MUSIC:"Generate Music",G
212ENERATE_SOUND_EFFECT:"Generate Sound Effect",RESIZE_IMAGE_KAI:"Resize Image",EDIT_IMAGE:"Edit Image",GENERATE_SINGLE_IMAGE:"Generate Single Image",GENERATE_MULTIPLE_IMAGES:"Generate Multiple Images",EDIT_VIDEO_VIA_TRANSCRIPT:"Edit Video via Transcript",EDIT_VIDEO_VIA_MULTIMODAL:"Edit Video via Multimodal Understanding",MASK_VIDEO:"Mask Video",GET_TRANSCRIPTION:"Get Transcription",SUBTITLE_PROJECT:"Subtitle Project",GENERATE_MULTI_SCENE_VIDEO:"Generate Multi-Scene Video",RESIZE_PROJECT_RATIO:"Resize Project Ratio",SMART_RESIZE_PROJECT:"Smart Resize Project",REMOVE_SUBTITLES:"Remove Subtitles",MERGE_MEDIA:"Merge Media",PASTED_LINK_DOWNLOAD:"Pasted Link Download",REMOVE_IMAGE_BACKGROUND:"Remove Image Background",TTS:"Text to Speech",UPSCALE_VIDEO:"Upscale Video"},E={CREATE_IMAGE:"kai_create_image",CREATE_VIDEO:"kai_create_video",CREATE_VIDEO_FROM_IMAGE:"kai_create_video_from_image",CREATE_MUSIC:"kai_generate_music",CREATE_SOUND_EFFECT:"kai_generate_sound_effect",CREATE_TTS:"kai_text_to_speech",EXTRACT_PASTED_LINK:"kai_extract_pasted_link",INCLUDE_UPLOADS:"kai_include_uploads",EDIT_IMAGE:"kai_edit_image",RESIZE_IMAGE:"kai_resize_image",REMOVE_IMAGE_BACKGROUND:"kai_remove_image_background",UPSCALE_VIDEO:"kai_upscale_video",MASK_VIDEO:"kai_mask_video",EDIT_MEDIA:"kai_edit_media",EDIT_VIDEO_VIA_TRANSCRIPT:"kai_edit_video_via_transcript",EDIT_VIDEO_VIA_MULTIMODAL:"kai_edit_video_via_multimodal",GET_TRANSCRIPTION:"kai_get_transcription",SUBTITLE_PROJECT:"kai_subtitle_project",REMOVE_SUBTITLES:"kai_remove_subtitles",RESIZE_PROJECT_RATIO:"kai_resize_project_ratio",SMART_RESIZE_PROJECT:"kai_smart_resize_project",ADD_TEXT:"kai_add_text",SET_FILTERS:"kai_set_filters",SET_VISUAL_STYLE:"kai_set_visual_style",SET_AUDIO_FADE:"kai_set_audio_fade",SET_VIDEO_BACKGROUND_EFFECT:"kai_set_video_background_effect",SET_IMAGE_DROP_SHADOW:"kai_set_image_drop_shadow",DETACH_AUDIO:"kai_detach_audio",DELETE_LAYER:"kai_delete_layer",SET_VOLUME:"kai_set_volume",SET_PLAYBACK_RATE:"kai_set_playback_rate",SET_TRANSITION:"kai_set_transition",SET_POSITION_PRESET:"kai_set_position_preset",SET_PRESET_FILTER:"kai_set_preset_filter",SET_LAYER_DEPTH_ORDER:"kai_set_layer_depth_order",MOVE_LAYER:"kai_move_layer",ADD_LAYER:"kai_add_layer",DUPLICATE_LAYER:"kai_duplicate_layer",REPLACE_LAYER:"kai_replace_layer",ADD_SUBTITLES:"kai_add_subtitles",CLEAR_SUBTITLES:"kai_clear_subtitles",GET_FILE_CONTEXT:"kai_get_file_context",GET_TRANSCRIPT_CONTEXT:"kai_get_transcript_context",MAKE_TRANSCRIPT_CLIP_PLAN:"kai_make_transcript_clip_plan",GET_MULTIMODAL_CONTEXT:"kai_get_multimodal_context",LOAD_SKILLS:"kai_load_skills",PICK_CHARACTERS:"kai_pick_characters",PICK_AND_CREATE_CHARACTERS:"kai_pick_and_create_characters",SET_OUTPUT_MODE:"kai_set_output_mode",SEARCH_STUDIO_ASSETS:"kai_search_studio_assets"},q9={ADD_PROJECT_TITLE:"kai_add_project_title",REMOVE_PROJECT_TITLE:"kai_remove_project_title"},jf=new Set(Object.values(q9)),Nf="kai_agent_plan",dd="kai_agent_project",$9=[E.UPSCALE_VIDEO,E.MASK_VIDEO,E.EDIT_MEDIA,E.EDIT_VIDEO_VIA_TRANSCRIPT,E.EDIT_VIDEO_VIA_MULTIMODAL,E.GET_TRANSCRIPTION,E.SUBTITLE_PROJECT,E.SMART_RESIZE_PROJECT],Y9=[E.EDIT_IMAGE,E.RESIZE_IMAGE,E.REMOVE_IMAGE_BACKGROUND,E.UPSCALE_VIDEO,E.MASK_VIDEO,E.GET_TRANSCRIPTION],z9=[E.PICK_CHARACTERS,E.PICK_AND_CREATE_CHARACTERS,E.SET_OUTPUT_MODE,E.SEARCH_STUDIO_ASSETS,E.GET_FILE_CONTEXT,E.GET_TRANSCRIPT_CONTEXT,E.MAKE_TRANSCRIPT_CLIP_PLAN,E.GET_MULTIMODAL_CONTEXT,E.LOAD_SKILLS],Vf=[E.SET_FILTERS,E.SET_VISUAL_STYLE,E.SET_AUDIO_FADE,E.SET_VIDEO_BACKGROUND_EFFECT,E.SET_IMAGE_DROP_SHADOW,E.DETACH_AUDIO,E.DELETE_LAYER,E.SET_VOLUME,E.SET_PLAYBACK_RATE,E.SET_TRANSITION,E.SET_POSITION_PRESET,E.SET_PRESET_FILTER,E.SET_LAYER_DEPTH_ORDER,E.MOVE_LAYER,E.ADD_LAYER,E.DUPLICATE_LAYER,E.REPLACE_LAYER,E.ADD_SUBTITLES,E.CLEAR_SUBTITLES],Gf=new Set($9),Kf=new Set(Y9),Wf=new Set(z9),Q9=p.object({fromStepId:p.string().min(1).describe("The planStepId of an earlier step in this same plan whose primary output should feed this input.")});var Ko=()=>Q9,jr=e=>({inputBindings:p.object(e).strict().optional().describe("Wires outputs from earlier steps in THIS plan into this step. Reference the earlier step's planStepId via fromStepId. Use this only for steps in the current plan; for assets from prior completed conversation turns, use sourceToolCallIndexId/sourceProjectLayerIndexId instead. Do not use inputBindings on any plan that calls kai_set_output_mode.")}),Nr={planStepId:p.string().min(1).optional().describe("Stable identifier for this step within the current plan. Add one only when a later step in this same plan needs to reference this step's output via inputBindings.")},J9=["intro","verse","pre chorus","chorus","interlude","bridge","outro","post chorus","transition","break","hook","build up","inst","solo"],X9=e=>{const t=e.toLowerCase();return J9.some(o=>{const r=`[${o}]`,s=`[${o.replaceAll(" ","-")}]`;return t.includes(r)||t.includes(s)})},Z9=e=>{const t=e.trim();if(!t)return"";const o=t.slice(0,3500);return X9(o)?o:`[Intro] 213${o} 214[Outro]`},io=[K.SEEDREAM_4_5,K.SEEDREAM_5,K.GOOGLE_NANO_BANANA,K.GPT_IMAGE,K.GPT_IMAGE_LOW,K.GROK_IMAGINE_IMAGE],Vr=[K.SEEDREAM_4_5,K.SEEDREAM_5,K.GOOGLE_NANO_BANANA,K.GPT_IMAGE,K.GPT_IMAGE_LOW,K.GROK_IMAGINE_IMAGE],Gr=[K.MINIMAX_H3,K.MINIMAX_H3_TRIAL,K.SEEDANCE_2_5,K.SEEDANCE_2_0,K.SEEDANCE_PRO,K.HAPPY_HORSE_T2V,K.KLING_OMNI_O1,K.VEO_3,K.GROK_IMAGINE_VIDEO],Wo=[K.MINIMAX_H3,K.MINIMAX_H3_TRIAL,K.SEEDANCE_2_5,K.SEEDANCE_2_0,K.SEEDANCE_PRO,K.KLING_OMNI_O1,Ke.modelId,K.VEO_3,K.GROK_IMAGINE_VIDEO],oi=[K.MINIMAX_MUSIC,K.MINIMAX_MUSIC_3_0,K.ELEVENLABS_MUSIC,K.GOOGLE_LYRIA_3_5];const e5=[K.SEEDANCE_2_5,K.SEEDANCE_2_0,K.SEEDANCE_PRO,K.VEO_3];function Ja(e){const t=e[0];if(!t)throw new Error("List must contain at least one element");return t}function t5(e){return e.slice(1)}function Ut(e){if(e.length===0)return"";if(e.length===1){const t=e[0];if(!t)throw new Error("missing item");return t}return e.length===2?`${e[0]} or ${e[1]}`:`${e.slice(0,-1).join(", ")}, or ${e[e.length-1]}`}function ld(e){return`Default to ${Ja(e)}. ${Ut(t5(e))} should only be used if the user specifically requests it.`}var cd=`Video generation models can generate their own synced audio by default (${Ut
214([...e5])}). Do not add separate music/sound-effect tool calls unless the user explicitly requests additional/different audio, or explicitly asks for no model-generated audio.`,nr="For stylistic continuity across multiple clips, include persistent anchor details in every prompt: visual style (for example photorealistic, cinematic, anime), environment and time of day, lighting, lens/framing, and color mood. Repeat these anchors consistently across scenes unless the user asks for a deliberate style change. If characters have already been selected for this plan, reference them using the exact provided @tag notation in every relevant prompt and restate the important visual traits needed to preserve their appearance.",dr=`Audio direction: every generated video prompt must end with a note containing both of these keys in exactly this YAML form: 215overall_soundscape: ... 216non_diegetic_music: ... 217 218- **overall_soundscape**: Summarize the ambient sound, physical action sounds, and non-verbal human sounds expected across the entire video. Name the concrete physical sources and audible events rather than vague phrases such as "ambient sounds", "environmental audio", "matching sounds", or "natural sound effects". Infer appropriate sounds from the visible setting and action. If this audio should be silent, explicitly direct silence for this key rather than omitting it. 219- **non_diegetic_music**: Describe background music that the characters cannot hear and only the audience can hear. If narration or commentary is included, specify it with the exact quoted script, language, voice characteristics, delivery, and timing. For music, name the instruments, pacing, mood, and relative prominence rather than merely requesting "background" or "cinematic" music. If there should be no music, narration, or commentary, explicitly direct silence for this key rather than omitting it. 220 221Spoken dialogue from an on-screen character should remain in the normal scene stage directions, not in either YAML key. Identify each visible speaker, include their exact quoted dialogue, and specify the language, delivery, timing, and visible speaking behavior. Do not describe how to design or generate the audio. Before returning the prompt, verify that both YAML keys are present and that each says either exactly what should be heard or that silence is expected.`,no=e=>`If a user requests a person in the generated ${e} and doesn't specify the age, default to an adult.`,ve="Give a friendly response that will be shared with the user after the tool call is complete. Give clear, specific next actions the user could take, phrased as a natural continuation. Include unique ideas or suggestions. The suggestions must be something you can directly perform with your available tools. Do not list options that you cannot perform. Use a friendly tone and respond in 2-3 complete sentences.",pt="IMPORTANT: This tool cannot be called at the same time as other tools (NEVER include it alongside any other tool calls in the same response).";var ri=6,Kr=(e,t)=>
221`Per-model supported aspect ratios: ${e.map(o=>`${o}: ${sd(o,t).join(", ")}`).join("; ")}.`,lr=e=>t=>{const{model:o,size:r}=t.value;if(!o||!r)return;const s=sd(o,e);s.some(a=>a===r)||t.issues.push({code:"custom",path:["size"],message:`${o} does not support size ${r}. Supported sizes: ${s.join(", ")}.`,input:t.value})},cr=e=>{const{model:t,resolution:o}=e.value;o==="4k"&&t!==K.SEEDANCE_2_0&&e.issues.push({code:"custom",path:["resolution"],message:"4k video generation requires Seedance 2.0.",input:e.value})},na={aspectRatio:p.enum(ft).optional().catch(void 0).describe("The aspect ratio of the generated image in W:H format. When left blank, the aspect ratio of the first reference image will be used."),model:p.enum(io).catch(Ja(io)).optional().describe(`The model to use for the generation. Leave blank to use the automatically selected default. ${ld(io)}`),postToolCallResponse:p.string().describe(ve),referenceImages:p.enum(["latest","original","none"]).catch("none").default("none").describe("The version of the input images to use as references. 'original' uses the original images uploaded by the user, 'latest' uses the latest version of each image after all edits have been applied, 'none' means no reference images will be used and generation will be based on the prompt alone. If the user uploads new images, they will automatically be included as reference images. Latest is often a good option. If the user asks to redo a generation, then it is better to use original to avoid picking up unwanted edits. If the user indicates that they do not want any additional references, you should use 'none'.")},{postToolCallResponse:Hf,...ud}=na,o5=[K.KAI_IMAGE_1,...io],{model:qf,...r5}=ud,a5={...r5,model:p.enum(o5).catch(K.KAI_IMAGE_1).optional().describe(`Optional model override. Leave blank or use ${K.KAI_IMAGE_1} to use automatic image model selection. ${Ut([...io])} should only be used if the user specifically requests one of them or has a matching model preference.`)},$e={startTimeSec:p.number().min(0).optional().catch(void 0).describe("Optional: The start time of this asset on the final video timeline, in seconds from the beginning of the full video."),endTimeSec:p.number().min(0).optional().catch(void 0).describe("Optional: The end time of this asset on the final video timeline, in seconds from the beginning of the full video. For media with known duration (for example uploaded video/audio with duration metadata), do not set this past startTimeSec + media duration."),assetOffset:p.number().min(0).optional().catch(void 0).describe("Optional: The amount of time in seconds to offset into the source asset when placing it on the timeline. For example, if you want to use a clip from 10s to 20s of an uploaded video, you could set startTimeSec to 0, endTimeSec to 10, and assetOffset to 10. This is only relevant with audio or video elements layers. When looking at project results, this maps directly to the 'startTime' property on a layer.")},gt={loadingText:p.string().describe("Required short user-facing thinking text for this planner step. Keep it action-based, non-technical, and roughly 6 words or fewer. For example: 'Formatting for Reels'.")};const s5=/^user_index_\d+$/,i5=/^tool_index_\d+$/,n5=/^layer_index_\d+$/;var Ae={sourceToolCallIndexId:p.string().regex(i5).optional().catch(void 0).describe(`Optional: An ID attached to previous tool calls in the chat that this tool call should use as a source for input assets. 222 Use this parameter when the input to this tool call should come from the output of a previous tool call in this conversation. 223 Use the exact toolCallIndexId shown in a previous tool result, for example sourceToolCallIndexId="tool_index_2" when the result says (toolCallIndexId=tool_index_2). 224 Do not use this to reference sourceToolCallIndexIds that don't explicitly appear in a conversation history. 225 Do NOT use this to reference another step in the current plan â for that, use inputBindings."`),sourceProjectLayerIndexId:p.string().regex(n5).optional().catch(void 0).describe(`Optional: An ID attached to the specific layer that should be used from the referenced tool call's output. 226 Set this when the tool should operate on one specific layer or asset. For single-asset outputs use 'layer_index_1'. 227 Omit this when the tool should operate on the full referenced project output, including every result card/clip in a multi-result project. 228 Do not use this to reference layerIndexIds that don't explicitly appear in a conversation history. 229 An example layer is: 230 Audio layer, layerIndexId=layer_index_2, assetId="def456", timeline=0.0s-12.5s, sourceDuration=12.5s, assetOffset=0.000, volume=0.80, name="Backgroun
230d Music" 231 In this example, sourceProjectLayerIndexId would be "layer_index_2" to reference the audio layer's asset "def456" as an input to another tool call.`)},ur={uploadIndexId:p.string().regex(s5).optional().catch(void 0).describe(`Optional: An ID attached to user uploads in the chat that this tool call should place on the timeline. 232 Use the exact uploadIndexId shown in a user message, for example uploadIndexId="user_index_2" when the upload says (uploadIndexId=user_index_2). 233 Do not use this to reference uploadIndexIds that don't explicitly appear in a conversation history. 234 Defaults to user_index_1. 235 Only used when sourcing from user uploads (not from a previous tool call).`)},we={sourceStudioAssetId:p.string().min(1).optional().catch(void 0).describe("Optional: exact assetId of an existing asset in the open Side Kai Studio project to use as this tool's input media. Use this for a single selected/current/searched Studio asset instead of sourceToolCallIndex."),sourceStudioAssetIds:p.array(p.string().min(1)).min(1).max(50).optional().catch(void 0).describe("Optional: exact assetIds of existing assets in the open Side Kai Studio project to use as this tool's input media. Use this for selected/current/searched Studio assets instead of sourceToolCallIndex.")},hd=p.object({gender:p.enum(bi).optional().catch(void 0).describe("The gender that the user wants the voice to be in. If not mentioned default to male."),age:p.enum(_i).optional().catch(void 0).describe("The age that the user wants the voice to be in."),accent:p.string().optional().catch(void 0).describe("The accent that the user voice should have. There is no guarantee it will be matched, and accent intensity cannot be adjusted."),languageCode:p.enum(ul).catch("English (US)").describe("The language that the user input is in, or the language that the user wants the voice to be in. Take into account the requested accent if applicable."),text:p.string().describe("This is the text that the user wants to turn into speech."),postToolCallResponse:p.string().describe(ve)});function ai(e){return[`Select the reusable characters needed for this plan ${e?", and create new chat characters only when no suitable reusable character already exists":""}.`,"You will be given all available reusable characters for this conversation in this tool description.","Call this at the start of the planning loop only when the user's request is likely to require a stable character or reference object that should keep the same identity across multiple generation tool calls.","Only return characters that should actually be used later in this same plan.","Return existing reusable characters in existingCharacters using the exact provided @tag."].concat(e?["Return new reusable characters in newCharacters only when no suitable available character exists.","Do not update, modify, or redefine an existing character in this tool.","If the user wants a modified version of an existing character, create a new uniquely named variant instead.","Characters created by this tool become available immediately for the rest of this plan and for later chat turns."]:["Do not create, define, update, modify, or redefine characters in this tool.","If no suitable available character exists, return no characters."]).join(` 236`)}function si(){return p.array(p.object({tag:p.string().describe("Exact @tag of an available character to use as-is in this plan. Each tag must exactly match one listed in the tool description.")})).catch([]).default([])}function d5(){return p.array(p.object({name:p.string().describe("Unique display name for a new reusable character. It must not duplicate or conflict with any available character name or tag."),description:p.string().describe("Visual-only appearance description for the new character or object. Include the traits needed for c
236onsistent image/video generation. Do not include personality, backstory, or non-visual instructions."),gender:p.enum(bi).catch("NEUTRAL").describe("The gender of the character"),age:p.enum(_i).optional().catch(void 0).describe("The age of the character")})).catch([]).default([])}function ii(e){return e?p.object({existingCharacters:si(),newCharacters:d5()}):p.object({existingCharacters:si()})}var l5=e=>{const t=id(e),o=nd(e),r=ti(e),s=H9(e),a=ti({isPaid:!0});return{description:`Generate a multi-scene video. This function lets the user create a narrated or scripted video from any input. This function creates a scripted video with multiple scenes and a background music track. Use this tool when: 237- The user requests to create or generate a video that requires more than a single short clip to represent. 238- The user inputs a script or a description of a something that can be represented as a video. 239- The user's request is better represented with a video with multiple scenes, a storyline, or a specific script to be narrated. 240- The user inputs a long script, narration, or story. 241- Always use this tool if the user requests a video longer than ${t} seconds. 242${e.isPaid?`- This tool can only make videos up to ${r} long. If the user requests a duration longer than ${r}, inform them that you can only make videos up to ${r} long, and give them other options to continue.`:`- This tool can only make videos up to ${r} long because the user is on the free plan. If they request a longer video, inform them of this limit and suggest they upgrade their plan to create longer videos (up to ${a}). Don't suggest that they use the full Kapwing editor, suggest that they upgrade their plan.`} 243- This tool should be called if the user prompts to make a video 'ABOUT' something. 244- This tool cannot use reference images or videos as input.`,parameters:p.object({duration:p.number().min(t).max(o).catch(s).default(s).describe(`Include the user's requested duration in seconds if and only if the user has explicitly mentioned, asked for, or requested a duration. Otherwise, choose the default of ${s}.`),postToolCallResponse:p.string().describe(ve)})}},pd=e=>({[ee.GENERATE_SINGLE_SCENE_VIDEO]:{description:`Use this tool when the user wants to generate a single video clip from a text prompt. This tool generates clips between 3 and 30 seconds. Seedance 2.0 supports up to 15 seconds and Seedance 2.5 supports up to 30 seconds; requests above other providers' limits are normalized to those providers' supported durations. 245- Call this tool if the user's prompt for a video is highly visual. 246- Call this tool if the user prompts to make a video 'OF' something. 247- Always call this tool if the user explicitly requests a video with duration of 30 seconds or less. 248- If the user attached a PDF document, the document text can be used as source context for the generated video prompt. 249- ${cd} 250- This tool cannot generate videos longer than 30 seconds. 251- For longer videos or videos with a narration or script, use the multi-scene video generation tool.`,parameters:p.object({duration:p.number().min(3).max(30).catch(ri).describe(`The duration of the video in seconds. This tool CANNOT generate videos less than 3 seconds or greater than 30 seconds. Default is ${ri} seconds.`),prompt:p.string().describe(`Describe the video with: subject + action, environment + atmosphere, and camera behavior. Be specific about visible details and motion (who, what they look like, what they do, where they are, and how the camera moves). Use concise, concrete language. ${nr} ${dr} ${no("video")}`),resolution:p.enum(["480p","720p","1080p","4k"]).catch("1080p").describe("The requested resolution. Seedance 2.5 supports 480p/720p. Seedance 2.0 supports 480p/720p/1080p/4k, except image-reference generation normalizes 1080p to 720p. 4k requires explicitly selecting Seedance 2.0. Default is 1080p."),size:p.enum(ft).catch("9:16").describe(`The aspect ratio of the generated source video. Default to 9:16 for unspecified or short-form video. For unsupported final output ratios, generate the closest supported source ratio, then resize the assembled project. ${Kr(Gr,"from-prompt")}`),modelGeneratedAudio:p.enum(["enabled","none"]).default("enabled").cat
251ch("enabled").describe("Whether the video model should generate its own synced audio. Use 'enabled' by default. Use 'none' only when the user explicitly asks for a silent video or says they do not want model-generated audio."),model:p.enum(Gr).optional().catch(void 0).describe(`Optional model override. If omitted, use the current plan's default video model. ${Ut([...Gr])} should only be used if the user specifically requests one of them.`),postToolCallResponse:p.string().describe(ve)}).check(lr("from-prompt")).check(cr)},[ee.GENERATE_VIDEO_FROM_IMAGE]:{description:`Image to video generation tool. Use this tool when the user explicitly wants to generate new video footage from image input, such as animating a still image, using an image as a first frame, restaging a scene, creating new footage from reference photos, or transferring motion from a user-provided reference video onto an image subject. Do NOT use this tool when the user wants to preserve, place, sequence, combine, or make a slideshow/video from supplied images or videos as-is; use the appropriate media assembly tool instead. \`image_mode\` controls how the inputs drive generation. Use \`"reference"\` for identity/appearance preservation. Use \`"start_frame"\` to animate from a start image. Use \`"start_and_end_frame"\` when the user explicitly wants both a start and end frame, and ensure they attach two images in that same message. Use \`"${Ke.imageMode}"\` with Kling Motion Control when one image defines the subject and the most recent user-uploaded video, which must be ${Ke.motionReferenceInput.maxDurationSeconds} seconds or shorter, defines its motion. Kling Motion Control ignores the requested output duration and follows the reference video duration, so changing duration does not trim an overlong reference. In reference mode, up to 4 subject images from the most recent user message will be used (if provided). Route other attached video or audio references through the general video-generation tool instead. It cannot merge or concatenate multiple images or videos. Prompt guidance: describe the actual scene/location/action in plain language. Do NOT refer to images by order (e.g. "first image", "second image"). Instead, describe the subject and setting explicitly (e.g. "a man in a blue jacket walking through Grand Central Terminal").`,parameters:p.object({duration:p.number().min(3).max(30).catch(6).describe("The requested duration in seconds, between 3 and 30. Seedance 2.0 supports up to 15 seconds and Seedance 2.5 supports up to 30 seconds, with requests below their provider minimum normalized to 4 seconds. Other models normalize to their supported durations; Veo reference output is always 8 seconds."),prompt:p.string().describe(`Describe how to animate the input image using: subject + action, environment + atmosphere, and camera behavior. Be explicit about character appearance, setting details, and intended motion. ${nr} ${dr}`),resolution:p.enum(["480p","720p","1080p","4k"]).catch("1080p").describe("The requested resolution. Seedance 2.5 supports 480p/720p. Seedance 2.0 supports 480p/720p/1080p/4k, except image-reference generation normalizes 1080p to 720p. 4k requires explicitly selecting Seedance 2.0. Default is 1080p."),size:p.enum(ft).optional().default("9:16").catch("9:16").describe(`The aspect ratio of the generated source video. Default to 9:16 for unspecified or short-form video. For unsupported final output ratios, generate the closest supported source ratio, then resize the assembled project. ${Kr(Wo,"from-image")}`),modelGeneratedAudio:p.enum(["enabled","none"]).default("enabled").catch("enabled").describe("Whether the video model should generate its own synced audio. Use 'enabled' by default. Use 'none' only when the user explicitly asks for a silent video or says they do not want model-generated audio."),model:p.enum(Wo).optional().catch(void 0).describe(`Optional model override. If omitted, use the current plan's default video model. ${Ut([...Wo])} should only be used if the user specifically requests one of them. ${Kr(Wo,"from-image")}`),image_version:p.enum(["latest","original"]).catch("latest").describe("The version of the image to use for video generation. 'original' uses the original image uploaded by the user, 'latest' uses the latest version of the image in the conversation. Default: latest"),image_mode:p.enum(["reference","start_frame","start_and_end_frame",Ke.imageMode]).catch("reference").describe(`How to use the inputs. 'reference' uses the most recent attached images as references to preserve identity/appearance (default). 'start_frame' uses the first attached image as the first frame to animate from. 'start_and_end_frame' uses two attached images in order: first as start frame, second as end frame. '${Ke.imageMode}' uses one ${Ke.subjectInput.kind} for subject appearance and the most recent user-${Ke.motionReferenceInput.source} ${Ke.motionReferenceInput.kind} for motion; that reference video must be ${Ke.motionReferenceInput.maxDurationSeconds} seconds or shorter, and the duration parameter does not trim it.`),postToolCallResponse:p.string().describe(ve)}).check(lr("from-image")).check(cr)},[ee.GENERATE_MUSIC]:{description:"Music Generation tool. Use this tool to generate music or a song based on a prompt. Lyrics are optional and should only be provided when the user explicitly provides lyrics or explicitly asks for specific words. Do not invent lyrics for generic requests like 'make a song about X'; leave lyrics blank and put the topic, style, vocal language, and mood in the prompt so the music model can write the lyrics itself. If the user wants an instrumental track, make the prompt explicitly say instrumental or no vocals and leave the lyrics blank.",parameters:p.object({model:p.enum(oi).optional().catch(void 0).describe(`Optional model override. If omitted, use the current plan's default music model. ${Ut([...oi])} should only be used if the user specifically requests one of them or has a matching model preference.`),prompt:p.string().min(1).catch("A beautiful song").transform(t=>t.length>2e3?t.slice(0,2e3):t).describe("A description of the music specifying style, mood, instrumentation, tempo, vocal style, and scenario. Include the musical arc when helpful. If vocals are desired, specify language, singer presentation, and emotion. If the user wants instrumental music, explicitly say instrumental or no vocals. Max length: 2000 characters."),vocalMode:p.enum(["auto","instrumental","vocal"]).optional().catch("auto").describe("Whether the music should contain vocals. Use 'instrumental' when the user asks for no vocals, no lyrics, background music, a score, or an instrumental track. Use 'vocal' when the user wants singing or a song with lyrics. Use 'auto' only when the user's intent is unclear."),lyrics:p.str
251ing().optional().transform(t=>Z9(t??"")).describe("Optional. Only provide lyrics when the user explicitly supplies lyrics or explicitly asks for specific words. Do not write lyrics just because the user asked for a song about a topic; in those cases leave this blank and express the topic, style, language, and vocal direction in the prompt instead. Every written word may be sung out loud, so keep style notes out of the lyric text itself. Use newline characters (\\n) between lines. Supported structure tags include [Intro], [Verse], [Pre Chorus], [Chorus], [Interlude], [Bridge], [Outro], [Post Chorus], [Transition], [Break], [Hook], [Build Up], [Inst], and [Solo]. If the user does not provide lyrics, leave this blank. Max length: 3500 characters."),response:p.string().describe("Your summary of the actions you took. This will be shared with the user once the edit is complete.")})},[ee.GENERATE_SOUND_EFFECT]:{description:"Sound Effect Generation tool. Use this tool to generate sound effects based on a prompt.",parameters:p.object({prompt:p.string().min(1).catch("A ricochet sound of a projectile hitting a metal surface").transform(t=>t.length>150?t.slice(0,150):t).describe("A short prompt to describe the content of the sound effect. Must be less than 150 characters."),duration:p.number().min(1).max(10).catch(5).transform(t=>t<1?1:t>10?10:t).describe("The duration of the sound effect in seconds. Must be between 1 and 10 seconds."),title:p.string().min(1).catch(`custom sound effect ${Zc(4)}`).transform(t=>t.length>50?t.slice(0,50):t).describe("A short title or name for the sound effect. Must be less than 50 characters."),response:p.string().describe("Your summary of the actions you took. This will be shared with the user once the edit is complete.")})},[ee.EDIT_VIDEO_VIA_TRANSCRIPT]:{description:`Use this tool to edit one or more user-uploaded videos and/or audio files via a transcript-based edit. Use this ONLY when transcript words/timings are the basis of the edit (spoken-word clips, removing filler words, reordering spoken segments). This tool can combine, trim, and reorder multiple uploaded audio/video files into one or more clips, strictly based on the timings of existing transcription words. It can remove filler words, create highlight cuts by deleting unimportant sections, find and stitch together parts of videos based on transcript timings, or reorder existing spoken segments. Prefer this tool for requests to create clips from podcasts, interviews, conversations, talks, lectures, or other speech-heavy media when the requested value is advice, insights, quotes, teachings, lessons, arguments, story points, or other things said, in any language. Do NOT use this for ordered tour, recap, vlog, itinerary, food, travel, venue, product, or place-based assembly requests where the requested anchors are visible subjects, locations, objects, scenes, or source order rather than transcript words. For example, you can create a single clip about a specific topic by combining relevant segments from several videos, as requested for YouTube or other platforms. It can also create multiple clips in one go. If the user asks for clips/highlights in the plural, preserve that plural intent in the prompt; use their explicit count, or default to 3 clips when no count is given. Use one clip only when the user asks for a single clip, says "the best clip/highlight", or asks for one final edit/video. Specify the number/themes in the prompt only; this tool may name result cards and can optionally add title screens, but it cannot add arbitrary text overlays or subtitles. This tool call CANNOT add new content, visual effects, transitions, music, sound effects, text overlays, styling changes, or modify pacing beyond deleting/reordering transcript-aligned spans. If the user asks for a visual montage from uploads (not transcript-word-level editing), do NOT use this tool. Only use this tool for trimming and reordering based on transcript content. If the user asks for stabilization, filters, color correction, reframing/zoom effects, or any other unsupported visual/audio effect, DO NOT call this tool. For supported downstream refinements like transitions, playback-rate changes, or volume changes, keep those requests out of this tool prompt and let the assembled project be refined later. For follow-up requests to tweak a previous transcript edit, pass the user's requested change directly in the prompt; this tool sees prior transcript edit requests/responses from the same chat as conversation history. It still can only source transcript lines from user-uploaded audio/video files in the chat history. DO NOT brainstorm, list ideas, explain video content, ask for confirmation, or propose effects before calling this tool. The tool will already output both the final videos and final user facing response. Do NOT enumerate step-by-step plans, do NOT list creative ideas instead of calling the tool, and do NOT promise additions you cannot perform. It does not resize output video aspect ratio; when the final edit should use a short-form, platform, or requested aspect ratio, include kai_resize_project_ratio as a
251separate tool call in the same plan immediately after this edit step. If the user asks for subtitles/captions, include kai_subtitle_project as a separate downstream tool call in the same plan. If the user asks for automatically generated clip title screens, set includeTitles=true. For arbitrary requested overlay text, use a separate text/title tool call in the same plan.`,parameters:p.object({prompt:p.string().describe("Edit intent ONLY: trimming, reorder strategy, number of variants, thematic focus. For follow-up tweaks to a previous transcript edit, pass the user's requested change directly rather than rewriting the full previous edit prompt. DO NOT include title-layer wording, title durations, subtitle requests, or text overlay requests."),referenceAudioVideoIndexes:p.array(p.number()).optional().catch(void 0).describe("Indexes (latest first) of which user-uploaded audio/video assets in the chat history to use (assistant generated media is NOT accessible). Index 0 = most recent uploaded audio/video file, 1 = second most recent, etc. with the oldest index being the highest number. If omitted, all audio/video files from the latest user message will be used. If the user adds a new audio/video file and asks to add it to the edit, you must include indices of all the relevant audio/video files (the new one and the old ones) that should be included, and this is required."),postToolCallResponse:p.string().describe(ve),includeTitles:p.boolean().optional().default(!1).describe("Boolean flag: true if the user explicitly wants each output clip to start with an automatically generated top title text overlay.")})},[ee.EDIT_VIDEO_VIA_MULTIMODAL]:{description:"Use this tool to analyze user-uploaded images and videos with multimodal understanding, then select clip segments from those assets. Use this ONLY when the user explicitly requests visual/multimodal understanding (for example visual moments, scenes, actions, objects, framing, or non-transcript cues), or asks to assemble a visual montage from uploaded media based on visual content. Do NOT use this for speech-heavy podcast/interview/conversation clip requests where the best clips are determined by what is said; use transcript edit instead. Prefer this for ordered tour, recap, vlog, itinerary, food, travel, venue, product, or place-based edits where the requested anchors are visible subjects, locations, objects, scenes, or source order, unless the user explicitly asks to select based on what is said. When the user asks for one final edit/video from multiple uploaded media assets, create the best single edit from all selected media. When the user asks for clips/highlights in the plural, preserve that plural intent in the prompt; use their explicit count, or default to 3 clips when no count is given. Incorporate each selected asset meaningfully unless the user explicitly asks to use only specific assets or an asset is unusable for the request. Preserve the user's actual edit intent in the prompt. For broad story/experience/recap requests, do not rewrite the request as a narrower visual-only highlight or montage unless the user explicitly asks for visuals only. If some sources provide narrative/context and others provide supporting visuals, keep both roles available to the edit. The model can return either: (1) separate independent clip outputs, or (2) a single compiled output composed of multiple ordered segments from different assets. Prompt fidelity rule (strict): the tool prompt should be a near-verbatim restatement of the user's request. Do not enrich it with new editing ideas or inferred constraints. For follow-up requests to tweak a previous multimodal edit, pass the user's requested change directly in the prompt; this tool sees prior multimodal edit selections from the same chat as edit history. It still can only source clips from user-uploaded image/video files in the chat history or explicitly referenced previous project layers. Do NOT invent timestamps, inferred intro/outro durations, per-clip duration targets, clip counts, source-file-specific ranges, or forced ordering/pacing rules unless the user explicitly requested them. Guardrails: each individual video must be 45 minutes or shorter, and total selected video duration must be 120 minutes or shorter. More than 10 selected videos are handled in batches, so do not drop relevant uploads only because there are more than 10. It supports optional title screens. It does not resize output video aspect ratio; when the final edit should use a short-form, platform, or requested aspect ratio, include kai_resize_project_ratio as a
251separate tool call immediately after this edit step. This is a cut-selection tool only: it only selects and arranges relevant parts of uploaded images/videos into clip outputs. It cannot add generated assets, transitions, effects, filters, color grading, speed ramps, text overlays, subtitles, or audio. Do NOT include unsupported edit instructions in this tool prompt. If the user asks for supported downstream refinements like transitions, playback-rate changes, or volume changes, handle those after the base project is assembled rather than inside this prompt. If the user asks for unsupported edits, handle them with other supported tools when possible, otherwise recommend Kapwing's full editor for those parts.",parameters:p.object({prompt:p.string().describe(`Clip-selection intent only. Keep this prompt close to the user's wording and intent. For follow-up tweaks to a previous multimodal edit, pass the user's requested change directly rather than rewriting the full previous edit prompt. If the user asks for clips/highlights in the plural, request multiple clips; preserve explicit counts, or default to 3 clips when no count is given. Use one clip only when the user asks for a single clip, says "the best clip/highlight", or asks for one final edit/video. Do not add new creative directives, timestamps, inferred intro length, per-clip durations, source-file-specific ranges, forced ordering/pacing rules, transitions, effects, text overlays, subtitles, music, or sound design unless the user requested them.`),referenceAudioVideoIndexes:p.array(p.number()).optional().catch(void 0).describe("Indexes (latest first) of which user-uploaded image/video assets in the chat history to use. Index 0 = most recent uploaded media, 1 = second most recent, etc. If omitted, all image/video files from the latest user message will be used. For broad edit requests over attached media, omit this field or include every relevant attached asset; do not narrow to one asset just because it has the strongest standalone visuals."),includeTitles:p.boolean().optional().default(!1).describe("Boolean flag: true if the user explicitly wants each output clip to start with an automatically generated top title text overlay.")})},[ee.MASK_VIDEO]:{description:"Use this tool to apply AI masking effects to a user-uploaded video. It can blur a selected category like faces, license plates, logos, or text; blur the background around a general foreground subject; or remove the background and keep only a general foreground subject. Only use this on uploaded videos. This tool does not support selecting one specific person or object instance. Reject requests that require identity selection, relative position disambiguation, or exclusions.",parameters:p.object({effect:p.enum(["blur_selection","blur_background","remove_background"]).default("blur_selection").describe("Which masking effect to apply. Use 'blur_selection' to blur a category inside the frame, 'blur_background' to blur everything except a general foreground subject, or 'remove_background' to cut out the general foreground subject and remove the rest."),maskSubject:p.string().describe("For 'blur_selection', this is the category to blur in the video. Use the user's exact wording as a short noun phrase â for example if the user says 'people', use 'people', not 'faces'. Common examples: 'people', 'faces', 'license plates', 'logos', 'text'. For 'blur_background' and 'remove_background', this is the foreground subject to keep. If the user explicitly names the subject type, use that short noun phrase, for example 'product', 'car', or 'dog'. If the user does not explicitly name the subject type and only asks to blur or remove the background, always use 'foreground subject'."),referenceAudioVideoIndexes:p.array(p.number()).optional().catch(void 0).describe("Indexes (latest first) of which user-uploaded video assets in the chat history to use. Index 0 = most recent uploaded video, 1 = second most recent, etc. If omitted, the most recent uploaded video is used."),postToolCallResponse:p.string().describe(ve)})},[ee.GET_TRANSCRIPTION]:{description:"Use this tool to transcribe one or more user-uploaded audio/video files and return their transcript text. Only use this tool when the user directly asks for a transcript or explicitly asks to download the transcript of a video/audio file. NEVER use this tool for translation or language-conversion requests. For translation requests on uploaded speech/audio/video, use Subtitle Project directly instead. Do not call this tool as an intermediate step to read transcript text for later translation, dubbing, or voiceover generation. Do not use this tool as a first step for broader editing requests (for example: highlights, b-roll, subtitles, pacing changes, or other edits). This tool only performs transcription retrieval and does not perform transcript-based editing. Only call this tool once per set of audio/video files, as the tool will return the full transcript text for all included files in one go. If the user wants to edit the video based on transcript content, use the Edit Video via Transcript tool instead of calling this tool separately.",parameters:p.object({referenceAudioVideoIndexes:p.array(p.number()).optional().catch(void 0).describe("Indexes (latest first) of user-uploaded audio/video assets to transcribe. Index 0 = most recent uploaded media, 1 = second most recent, etc. If omitted, all audio/video files from the latest user message will be used."),postToolCallResponse:p.string().describe(ve)})},[ee.GENERATE_MULTI_SCENE_VIDEO]:l5(e),[ee.MERGE_MEDIA]:{description:"Merge multiple video clips and/
251or images into a single linear video. Use this tool when: - The user wants to combine 2 or more uploaded images and/or videos into one video (including the case where ALL inputs are images). - The user asks to make a video *with*, *of*, or *from* the (plural) images or videos they uploaded. - The user wants a simple concatenation / sequence / slideshow of provided media without new animated content from a single image. - The user wants to merge generated outputs from earlier tool calls into one file. - The user provides an ordering (list of names, titles, or short identifiers) or asks for 'put these together' / 'combine them'. NEVER use Generate Video from Image when there are multiple media inputs, EXCEPT when the user is explicitly describing start-frame/end-frame animation behavior for a single generated scene; in that case use Generate Video from Image. Output is a single video with each media item placed one after another (no intelligent content analysis). Ordering rules: If the user supplies an explicit ordered list of names, populate fileNameOrder exactly (no confirmation). Otherwise you may use 'images_first' or 'videos_first' if they request that style. If both fileNameOrder and ordering could apply, fileNameOrder takes precedence. DO NOT call this tool if the user requests ordering by color scheme, palette, theme, brightness, content quality, or any semantic criteria you cannot perform. In that case, first ask the user to provide a supported ordering (a list of names, or choose images_first / videos_first). If the user does not provide any ordering, leave out the ordering param, as it will default to the order uploaded. Don't ask for clarification. Examples that SHOULD NOT call this tool yet: - 'Make a video and arrange these clips from darkest to lightest.' - 'Combine these images ordered by their color palette.' - 'Put these videos together sorted by energy level.' For these, respond asking for a supported ordering before calling the tool.",parameters:p.object({ordering:p.enum(["images_first","videos_first"]).optional().describe("The order to merge the media files. 'images_first' means all images will appear before all videos. 'videos_first' means all videos will appear before all images. If not specified, the order will follow the message iteration order, which typically matches the order in which the user uploaded the media, unless fileNameOrder is provided by the user."),fileNameOrder:p.array(p.string()).optional().describe("Exact sequence (user-specified) of media items to merge, using short unique name/title fragments. Populate this whenever the user gives an ordered list. Never ask for confirmation if the user explicitly listed an order."),numMessagesToConsider:p.number().min(1).catch(1).describe("How many most recent messages (user uploads OR assistant tool outputs) containing media to include. Default: 1 (only the latest message with media)."),postToolCallResponse:p.string().describe(ve)})},[ee.GENERATE_SINGLE_IMAGE]:{description:"Versatile image generation tool that can use multiple input images as references to generate a single image. This tool can be used with just a prompt, or it can use input images as well as a prompt to guide the generation. If referencing reference images in the prompt, use descriptions of the the image content instead of their order / position. For example, say 'a portrait of landscape' instead of 'a portrait of the first image'.",parameters:p.object({prompt:p.string().describe(`A detailed and descriptive prompt to generate an image. ${no("image")}`),...na})},[ee.GENERATE_MULTIPLE_IMAGES]:{description:"Advanced image generation tool that can use multiple input images as references and is able to generate 1-15 images. Works like the single image generator, but can create multiple images at once. Use this tool if and ONLY IF the user explicitly requests multiple images to be generated. If the user only requests a single image, use the single image generator tool instead. WARNING: do not use this tool unless the user specifically requests to generate multiple images.",parameters:p.object({prompts:p.array(p.string().describe(`A detailed and descriptive prompt for each image. Each prompt will be used independently to generate a new, different image. ${no("image")}`)),...na})},[ee.RESIZE_IMAGE_KAI]:{description:"Resize an image using a prompt and an aspect ratio.",parameters:p.object({prompt:p.string().describe("A detailed and descriptive prompt to resize the image."),aspectRatio:p.enum(ft).describe("The aspect ratio of the resized image in W:H format."),postToolCallResponse:p.string().describe(ve),referenceImages:p.enum(["latest","original"]).default("latest").describe("The version of the input images to use as references. 'original' uses the original images uploaded by the user, 'latest' uses the latest version of each image after all edits have been applied. If the user uploads new images, they will automatically be included as reference images. Latest is often a good option. If the user asks to redo an edit, then it is better to use original to avoid picking up unwanted edits.")})},[ee.UPSCALE_VIDEO]:{description:"Use this tool to upscale and or denoise a single video using AI. - Use this tool if the user requests to improve video quality or make a video higher resolution. - Only works on videos, not images. - The upscale setting increases the resolution of a video - The denoise setting keeps the resolution the same while improving the clarity of the video - Treat the selected video's upscaleSupported and upscaleUnsupportedReason metadata as authoritative. If upscaleUnsupportedReason is above-maximum, never request upscale; request denoise only and describe the work as denoising in user-facing plan text. If upscaleUnsupportedReason is below-minimum, do not call this tool be
251cause neither upscaling nor denoising is supported. - When the user isn't clear on what to do, use upscale when upscaleSupported is true, use denoise when upscaleUnsupportedReason is above-maximum, and do not use this tool when upscaleUnsupportedReason is below-minimum. - Only supports upscaling 1 video at a time",parameters:p.object({referenceVideoIndex:p.number().optional().catch(void 0).describe("Indexes (latest first) of which user-uploaded video assets in the chat history to use (assistant generated media is NOT accessible). Index 0 = most recent uploaded video, 1 = second most recent, etc. with the oldest index being the highest number. If omitted, the last video from the latest user message will be used. If the user adds a new video and asks to add it to the edit, you must include indices of all the videos (the new one and the old ones) that should be included, and this is required."),postToolCallResponse:p.string().describe(ve),upscale:p.boolean().default(!0).describe("Set to true to upscale the video. This will result in a higher resolution file. Never set this to true when the selected video's upscaleSupported metadata is false, and do not call this tool at all when upscaleUnsupportedReason is below-minimum."),denoise:p.boolean().default(!1).describe("Set to true to denoise the video. This will result in a clearer video with less film grain and other types of noise. Set this to true and upscale to false when upscaleUnsupportedReason is above-maximum. Do not call this tool when upscaleUnsupportedReason is below-minimum because denoising is also unsupported.")})},[ee.EDIT_IMAGE]:{description:"Edit or change image content with AI. Use this tool only for generative image edits such as inpainting, adding/removing/replacing objects, changing the subject/background/content of an image, extending an image, reimagining visual content, or removing watermarks. This tool can only be used on images, not videos. Do not use this tool for deterministic layer styling or presentation settings such as filters, sepia/black-and-white, brightness, contrast, saturation, opacity, blur, tint, preset looks, border radius/rounding, stroke/outline, line width, drop shadows, placement/positioning, fit/crop-style layout, layer ordering, or aspect ratio/canvas changes.",parameters:p.object({prompt:p.string().describe("A detailed description of how to edit the image."),postToolCallResponse:p.string().describe(ve),referenceImages:p.enum(["latest","original"]).default("latest").describe("The version of the input images to use as references. 'original' uses the original images uploaded by the user, 'latest' uses the latest version of each image after all edits have been applied. If the user uploads new images, they will automatically be included as reference images. Latest is often a good option. If the user asks to redo an edit, then it is better to use original to avoid picking up unwanted edits."),model:p.enum(Vr).catch(Ja(Vr)).describe(`The model to use for the generation. ${ld(Vr)}`),size:p.enum(ft).optional().catch(void 0).describe("The aspect ratio to edit the image to. WARNING: only use this if the user specifically requests to change the aspect ratio of the image. If left blank, the original aspect ratio of the image will be preserved.")})},[ee.SUBTITLE_PROJECT]:{description:"Use this tool to generate subtitles for a video project. This tool only supports a defined list of languages and is the only supported translation path for uploaded speech/audio/video content. If the user asks to translate spoken content to another language, always use this tool and set subtitleLanguageCode accordingly. Never call Get Transcription first as an intermediate translation step. If the user asks to add subtitles/captions without an edit, always use this tool.",parameters:p.object({color:p.string().regex(/^#?[0-9a-fA-F]{6}$/).transform(t=>t.startsWith("#")?t:`#${t}`).optional().catch(void 0).describe("Hex color (e.g. #FFFFFF) for the subtitle text. Only set this if the user explicitly requests a subtitle text color."),size:p.enum(["small","medium","large"]).optional().catch(void 0).describe("Relative subtitle size: small, medium, or large. Only set this if the user explicitly requests a subtitle size."),subtitlePlacement:p.enum(["top","bottom"]).optional().catch(void 0).describe("Explicit subtitle placement requested by the user. Set to 'top' for requests like top subtitles/captions, or 'bottom' for requests like bottom subtitles/captions. Leave unset when the user does not specify; subtitles default to bottom."),postToolCallResponse:p.string().describe(ve),subtitleLanguageCode:p.string().optional().describe("This is the language the subtitles will be in. Use ISO 639-1 language codes (e.g., 'es' for Spanish, 'fr' for French). Leave blank if the user does not specify the language.")})},[ee.TTS]:{description:"Use this tool to generate text to speech. This may also be referred to by users as a voice over, or TTS. This tool is used to generate speech in any language.",parameters:hd},[ee.RESIZE_PROJECT_RATIO]:{description:"Resize a video project to a new aspect ratio while preserving the existing framing. Use this for standard aspect-ratio conversion, including platform, short
251-form, vertical, square, horizontal, or custom aspect-ratio output. Use loaded platform-format skill guidance when platform or shape sizing rules are needed. By default this center-crops media to fill the resized canvas. This does not intelligently re-crop for the active speaker or main subject. Only works on videos and video projects, not images. Defaults are correct for plain aspect-ratio changes; only set fitToCenter/blurBackground when the user explicitly asks to fit, letterbox, or add a blurred background.",parameters:p.object({sizingMode:p.enum(["aspect-ratio","pixels"]).default("aspect-ratio").describe("How to interpret width/height. Use 'aspect-ratio' (default) for normal requests like 9:16 or '1080:1920' â width/height are treated as a ratio and resolved to a standard canvas size. Use 'pixels' only when the user explicitly asks for exact output dimensions like '1280 by 720' â width/height are then used as literal pixel dimensions (clamped to 3840 per axis)."),width:p.number().min(1).describe("The width value of the resized project. Interpreted as an aspect-ratio numerator when sizingMode='aspect-ratio', or as exact output pixels when sizingMode='pixels'."),height:p.number().min(1).describe("The height value of the resized project. Interpreted as an aspect-ratio denominator when sizingMode='aspect-ratio', or as exact output pixels when sizingMode='pixels'."),blurBackground:p.boolean().default(!1).describe("Whether to add a blurred background behind fit-to-center media. Only use with fitToCenter. Default is false."),fitToCenter:p.boolean().default(!1).describe("Whether to fit the media to the center of the canvas instead of center-cropping to fill the canvas. Default is false."),postToolCallResponse:p.string().describe(ve)})},[ee.SMART_RESIZE_PROJECT]:{description:"Reframe a video project for a new aspect ratio by cropping to keep the active speaker or main subject centered. Use this only when the user explicitly asks for speaker-focused crops, active speaker centering, subject-centered smart crops, or to keep faces/the main subject centered. Do not use this for generic requests like resize for mobile unless the user also asks for semantic reframing. Do not use this when the user says to avoid aggressive cropping, keep the full horizontal frame/person visible, or use a blurred background/canvas if the frame cannot safely fit; use kai_resize_project_ratio with fitToCenter and blurBackground for that fallback-fit layout. Call this once for the whole current video/project context, not once per upload or clip. This is a semantic crop, not the default fit-to-center resize. For mobile formats, use 9:16. Only works on videos and video projects, not images.",parameters:p.object({width:p.number().min(1).describe("The new aspect ratio width of the smart resized project."),height:p.number().min(1).describe("The new aspect ratio height of the smart resized project."),postToolCallResponse:p.string().describe(ve)})},[ee.REMOVE_SUBTITLES]:{description:"Remove / hide previously added subtitles or captions from the last generated project. Use when the user asks to remove, hide, delete, clear, or turn off subtitles/captions.",parameters:p.object({postToolCallResponse:p.string().describe(ve)})},[ee.REMOVE_IMAGE_BACKGROUND]:{description:"Remove the background of an image. Use this tool call only when the user explicitly requests to remove or erase the background of an image. Only call this if the user has provided an image in their message history.",parameters:p.object({postToolCallResponse:p.string().describe(ve),referenceImages:p.enum(["latest","original"]).default("latest").describe("A reference to which input images to apply remove background to. 'original' uses the original images uploaded by the user, 'latest' uses the latest version of each image after other have been applied. Return the most appropriate image reference that matches the user's intent. If you're unsure, use 'latest'.")})},[ee.PASTED_LINK_DOWNLOAD]:{description:"Download the media from a user-pasted link. Use this tool call only if the user request to only download a link without any subsequent action. If the user wants to apply a different tool call with the downloaded pasted link, you should choose that tool call.",parameters:p.object({postToolCallResponse:p.string().describe(ve)})}}),md=e=>({...pd(e)}),$f=md({isPaid:!1}),Yf=md({isPaid:!0}),ni={description:"Add a text overlay layer to a video/project timeline at a specific time. Use this when the user asks to add visible overlay text, captions, labels, a short phrase, or title text to a video/project. Do not use this for image-only outputs; use image editing when the user wants text baked into an image. Emit one call per distinct text str
251ing. For title text, use position top, startTimeSec 0, and endTimeSec 5 unless the user requests different timing. For other overlay text, prefer top or bottom unless the user asks for centered text. If no timing is given, default to the relevant clip or project duration. This tool only controls text, font, position, relative size, and timing; it cannot set text color, bold/weight, outline/stroke, shadow, opacity, animation, rotation, or exact pixel size. Do not claim those unsupported styling changes will be applied. This is not subtitles generated from speech. Can be combined with INCLUDE_UPLOADS or other media tools to add timed text overlays to the assembled project.",parameters:p.object({text:p.string().min(1).max(300).describe("The exact text content to add to the project."),font:p.string().min(1).max(80).catch("Montserrat").describe("Font family to use for the text. Use a supported common font name like Montserrat, Arial, Inter, Times New Roman, Orbitron, or Permanent Marker. For cursive, handwritten, marker, or casual script requests, use Permanent Marker unless the user specifies a concrete supported font."),position:p.enum(["top","center","bottom"]).catch("top").describe("Vertical placement of the text overlay. Prefer 'top' or 'bottom' so the text does not cover the underlying video. Only use 'center' when the user explicitly asks for centered text."),size:p.enum(["small","medium","large"]).optional().catch(void 0).describe("Optional relative text size. Defaults to medium, which is the standard add-text size. Use small when the user asks for smaller text, and large when the user asks for larger text."),startTimeSec:p.number().min(0).optional().catch(void 0).describe("Optional: The time in seconds when the text should appear on the timeline. Defaults to the start of the video."),endTimeSec:p.number().min(0).optional().catch(void 0).describe("Optional: The time in seconds when the text should disappear from the timeline. Defaults to the end of the video.")})},Fe={layerId:p.string().min(1).describe("Exact layer id in the assembled project draft. Use ids from earlier project observations or explicit project context.")},_e={reason:p.string().optional().describe("Brief reason this project mutation is needed.")},c5=p.object({opacity:p.number().min(0).max(200).optional(),contrast:p.number().min(0).max(200).optional(),brightness:p.number().min(0).max(200).optional(),saturate:p.number().min(0).max(200).optional(),blurPercent:p.number().min(0).max(10).optional(),temperature:p.number().min(-1).max(1).optional(),tint:p.number().min(-1).max(1).optional(),highlights:p.number().min(-1).max(1).optional(),shadows:p.number().min(-1).max(1).optional(),whites:p.number().min(-1).max(1).optional(),blacks:p.number().min(-1).max(1).optional()}).strict(),Wr=p.record(p.string(),p.unknown()).describe("Studio ILayer-shaped layer properties. Do not provide an id; the server assigns one."),u5={[E.SET_FILTERS]:{description:"Project mutation tool. Set visual filter adjustments on an existing image, video, or persona layer in the assembled project draft.",parameters:p.object({..._e,...Fe,filters:c5})},[E.SET_VISUAL_STYLE]:{description:"Project mutation tool. Set direct visual style fields such as stroke, line width, or border radius on an existing layer.",parameters:p.object({..._e,...Fe,style:p.object({stroke:p.string().optional(),lineWidth:p.number().min(0).max(100).optional(),borderRadius:p.number().min(0).max(100).optional()})})},[E.SET_AUDIO_FADE]:{description:"Project mutation tool. Add or update audio fade-in/fade-out behavior on an audio-capable layer.",parameters:p.object({..._e,...Fe,fadePosition:p.enum(["intro","outro","both","none"]),fadeSpeed:p.enum(["default","slow","fast"])})},[E.SET_VIDEO_BACKGROUND_EFFECT]:{description:"Project mutation tool. Apply foreground video background effects such as remove background, blur background, green screen, blue screen, or none.",parameters:p.object({..._e,...Fe,effect:p.enum(["removeBackground","blurBackground","greenScreen","blueScreen","none"])})},[E.SET_IMAGE_DROP_SHADOW]:{description:"Project mutation tool. Add, update, or remove a drop shadow on an image layer.",parameters:p.object({..._e,...Fe,action:p.enum(["add","remove"])})},[E.DETACH_AUDIO]:{description:"Project mutation tool. Detach a video's audio into its own layer.",parameters:p.object({..._e,...Fe})},[E.DELETE_LAYER]:{description:"Project mutation tool. Delete an existing layer from the assembled project draft.",parameters:p.object({..._e,...Fe})},[E.SET_VOLUME]:{description:"Project mutation tool. Set layer playback volume. Use 0 to mute, 1 for original volume, 2 for double volume.",parameters:p.object({..._e,...Fe,volume:p.number().min(0).max(2)})},[E.SET_PLAYBACK_RATE]:{description:"Project mutation tool. Speed up or slow down a media layer.",parameters:p.object({..._e,...Fe,playbackRate:p.number().min(.25).max(4)})},[E.SET_TRANSITION]:{description:"Project mutation tool. Add a supp
251orted transition between two timeline-adjacent layers.",parameters:p.object({..._e,leftLayerId:p.string().min(1),rightLayerId:p.string().min(1),transitionId:p.enum(["cross-dissolve","cross-blur"]),durationSec:p.number().min(0).max(5).optional()})},[E.SET_POSITION_PRESET]:{description:"Project mutation tool. Apply a named canvas position/size preset to a layer.",parameters:p.object({..._e,...Fe,preset:p.string().min(1)})},[E.SET_PRESET_FILTER]:{description:"Project mutation tool. Apply a named Studio preset filter such as sepia, grayscale, vintage, cinematic, or original.",parameters:p.object({..._e,...Fe,presetFilterId:p.string().min(1)})},[E.SET_LAYER_DEPTH_ORDER]:{description:"Project mutation tool. Move a layer forward/backward in the visual stack.",parameters:p.object({..._e,...Fe,action:p.enum(["bringToFront","sendToBack"])})},[E.MOVE_LAYER]:{description:"Project mutation tool. Move one layer on the timeline and optionally retrim it. A timelineStartSec-only call preserves the current duration and source trim. This operation does not ripple downstream layers.",parameters:p.object({..._e,...Fe,timelineStartSec:p.number().min(0),timelineEndSec:p.number().min(0).optional(),sourceStartSec:p.number().min(0).optional()})},[E.ADD_LAYER]:{description:"Project mutation tool. Add a fully specified Studio layer to the assembled project draft.",parameters:p.object({..._e,layers:p.array(Wr).min(1)})},[E.DUPLICATE_LAYER]:{description:"Project mutation tool. Duplicate an existing layer with optional property overrides.",parameters:p.object({..._e,sourceLayerId:p.string().min(1),layer:Wr.optional()})},[E.REPLACE_LAYER]:{description:"Project mutation tool. Replace one layer with another Studio layer-shaped object while preserving replacement-safe timeline properties.",parameters:p.object({..._e,layerId:p.string().min(1),layer:Wr})},[E.ADD_SUBTITLES]:{description:"Project mutation tool. Apply subtitles to eligible assembled media layers when transcription metadata is already available.",parameters:p.object({..._e,applyToAllEligibleLayers:p.boolean().default(!0),layerIds:p.array(p.string()).optional()})},[E.CLEAR_SUBTITLES]:{description:"Project mutation tool. Clear generated subtitle metadata from the assembled project draft.",parameters:p.object({..._e})}},Ee=(()=>{const e=pd({isPaid:!0});return{[E.CREATE_IMAGE]:{description:"Single image generation tool for exactly one image from a text prompt. Do not use when the user wants to keep and sequence their uploaded images/videos as-is; use kai_include_uploads for that.",parameters:p.object({prompt:p.string().describe(`A detailed and descriptive prompt to generate an image. If characters have already been selected for this plan, reference them using the exact provided @tag notation when relevant and restate the important visual traits needed to preserve their appearance and consistency. ${no("image")}`),...$e,...ud,...we,...Nr})},[E.CREATE_VIDEO]:{description:`Single video generation tool for one short clip/scene from a prompt or Seedance 2.0/2.5 omni references. Route attached reference videos and MP3/WAV audio clips here, including generative edits that add/remove/replace/repair elements in a supplied video and requests to extend a video forward or backward; do not route those to CREATE_VIDEO_FROM_IMAGE or category masking. Seedance 2.5 accepts audio-only references and generates clips up to 30 seconds. Seedance 2.0 requires at least one image or video when audio references are used and generates clips up to 15 seconds. Use multiple calls for multi-scene scripts. Avoid specifying text in the video, as it renders poorly. If the video needs legible on-screen text, do not bake it into this call â instead create that frame as an image (e.g. with CREATE_IMAGE) and route to the CREATE_VIDEO_FROM_IMAGE tool call, wiring the image in as startFrame via inputBindings. Do not use this for upload-only slideshows or when the user asks to keep original uploads unchanged; use kai_include_uploads instead unless motion generation is explicitly requested. Attached PDFs can supply source text/context for this video when the user wants a video based on a document. Always control spoken language in the prompt: specify the language when words are desired, or explicitly request no spoken/sung words when separate TTS/music/sound effects are used. When inputBindings are present, focus the prompt on motion, framing, timing, and sync rather than re-describing the bound input
251s. ${cd}`,parameters:e[ee.GENERATE_SINGLE_SCENE_VIDEO].parameters.omit({postToolCallResponse:!0}).extend({prompt:p.string().describe(`Describe the video with: subject + action, environment + atmosphere, and camera behavior. Be specific about visible details and motion (who, what they look like, what they do, where they are, and how the camera moves). Use concise, concrete language. ${nr} ${dr} ${no("video")}`),...$e,...jr({speechAudio:Ko().describe("Speech audio from an earlier CREATE_TTS step in the same plan."),startFrameImage:Ko().describe("Starting frame image from an earlier CREATE_IMAGE step in the same plan.")}),...Ae,...we}).check(lr("from-prompt")).check(cr)},[E.CREATE_VIDEO_FROM_IMAGE]:{description:`${e[ee.GENERATE_VIDEO_FROM_IMAGE].description} This tool accepts image handles only. Route attached reference videos and MP3/WAV audio clips to CREATE_VIDEO instead. Seedance 2.0 supports clips up to 15 seconds and Seedance 2.5 supports clips up to 30 seconds. Do not use this to merely preserve, place, sequence, combine, or assemble user-uploaded media. When the user supplied uploads and asks to edit or assemble those uploads, use the uploaded media as source material by default: use kai_include_uploads for deterministic placement/order, or kai_edit_video_via_multimodal for visually anchored multi-upload selection/assembly. Use this tool only when the user explicitly asks for generative image-to-video transformation, such as animating a still image, restaging a scene, or creating new footage guided by reference images. If the video needs legible on-screen text, create the start frame as an image (e.g. with CREATE_IMAGE) and feed it into this tool call as startFrame via inputBindings, since text rendered directly by video generation is often illegible.`,parameters:e[ee.GENERATE_VIDEO_FROM_IMAGE].parameters.omit({postToolCallResponse:!0}).extend({prompt:p.string().describe(`Describe how to animate the input image using: subject + action, environment + atmosphere, and camera behavior. Be explicit about visible identity details, setting details, and intended motion. ${nr} ${dr}`),...$e,...Ae,...we,...jr({startFrame:Ko().describe("Starting frame image from an earlier CREATE_IMAGE step in the same plan.")}
251)}).check(lr("from-image")).check(cr)},[E.CREATE_MUSIC]:{description:"Single music generation tool. Use this tool to generate one standalone music or song deliverable by default. Only treat it as background music for a larger visual project when the user explicitly asks for visuals, a video, or scene-based accompaniment. For generic song requests where the user does not provide lyrics, do not invent full lyrics yourself; leave lyrics blank and express the topic, style, vocal language, singer presentation, and mood in the prompt so the music model can write the lyrics. If the user wants different music across scenes, create multiple calls.",parameters:e[ee.GENERATE_MUSIC].parameters.omit({response:!0}).extend({...$e})},[E.CREATE_SOUND_EFFECT]:{description:"Single sound effect generation tool. Use one call per distinct sound cue or per scene when audio cues are specified. Do not use this when the selected video model already generates synced audio, unless the user explicitly asks for additional/different sound design or asks for no model-generated audio.",parameters:e[ee.GENERATE_SOUND_EFFECT].parameters.omit({response:!0}).extend({...$e})},[E.CREATE_TTS]:{description:"Text-to-speech generation tool. Use this tool to create narration/voiceover audio from text; for multi-scene scripts, create one call per scene/segment and place each one on the timeline. Generated TTS is captioned by default when used in a project. Set includeSubtitles=false only when the user explicitly asks for no subtitles or captions. If the user explicitly asks for captions, keep the default true; do not add a second caption implementation for the same speech.",parameters:hd.omit({postToolCallResponse:!0}).extend({includeSubtitles:p.boolean().optional().describe("Whether generated TTS should receive subtitles when placed in a project. Defaults to true. Set false only for an explicit opt-out such as no captions, don't add subtitles, or without captions."),characterTag:p.string().catch("").describe("If the audio belongs to a character, the @tag of the character (for example @emma_lee) to ensure generated audio uses voice associated with that character. Otherwise return empty string."),...$e,...Nr})},[E.EXTRACT_PASTED_LINK]:{description:"Extract exactly one user-pasted media URL into a reusable project asset. Use this when a URL appears to point to media, including direct image/video/audio file links or common hosted media/video sites. This tool only downloads/extracts the linked asset; use kai_include_uploads with inputBindings.extractedAsset to place the extracted asset into the final project.",parameters:p.object({url:p.string().trim().min(1).describe("The exact URL to extract. Use one tool call per URL."),...Nr})},[E.INCLUDE_UPLOADS]:{description:["Places exactly one already-existing media asset (video, audio, or image) onto the final video timeline per call. This tool does NOT generate new media â it only places media that already exists, either from a user upload or from a completed prior tool result.","Call this tool multiple times to include multiple assets and build a single final output in sequence.","Source selection: provide EITHER uploadIndexId to place a user upload from the message history, OR (sourceToolCallIndexId + sourceProjectLayerIndexId) to place a media asset from a completed prior tool call that is already visible in the conversation as a tool result, OR inputBindings.extractedAsset to place an asset from an earlier kai_extract_pasted_link step in this same plan. Do not mix these source types in one call. Do NOT use sourceToolCallIndexId to reference a step in the current plan â those steps have not run and have no asset to place yet.","Never call this tool without a source. Always provide uploadIndexId, sourceToolCallIndexId, sourceStudioAssetId/sourceStudioAssetIds, or inputBindings.extractedAsset to place an actual media asset.","Do NOT use this tool to re-include outputs produced by earlier steps in this same plan, such as transcript edit, multimodal edit, generated music, or other current-plan steps. Downstream project steps in the same plan are composed with those results automatically. The only current-plan exception is inputBindings.extractedAsset from kai_extract_pasted_link, which should use kai_include_uploads to display the extracted asset. This does not apply to completed prior tool results referenced with sourceToolCallIndexId/sourceProjectLayerIndexId.","When using sourceToolCallIndexId, the referenced prior tool call MUST have actually produced a usable media asset (e.g. a generated video/image/audio, an image edit, an INCLUDE_UPLOADS result, or a previous project). Tools that don't produce a placeable media asset (e.g. transcription text, planner-only tools, output-mode signals) cannot be used as a source.","Set sourceToolCallIndexId to the exact toolCallIndexId shown in the prior tool result, such as tool_index_2 from (toolCallIndexId=tool_index_2). Do not renumber tool results yourself.","sourceProjectLayerIndexId is required when sourceToolCallIndexId is set: use it to pick which asset/layer from that tool call result (layer_index_1 = first layer/asset, layer_index_2 = second, etc.). For single-asset tool call outputs (e.g. a generated video or image), set sourceProjectLayerIndexId to layer_index_1.","Prefer this tool over generation tools when the user asks to use their own uploads/original media as-is, especially with explicit per-upload placement/order instructions or when combining uploads with generated assets/audio in a multi-tool plan.","Also use this tool to carry over unchanged clips from a previous project when the user asks to modify only some clips, except when the previous project came from transcript edit or multimodal edit and the requested change affects clip selection, ordering, or edit boundaries.","Do NOT use this tool to fix clip selection, clip order, clip count, story/theme, transcript boundaries, highlight ranges, or per-clip duration from a previous transcript edit or multimodal edit. For those follow-up corrections, call the same base edit tool again with the user's requested change; those edit tools are seeded with previous edit results/history and can preserve unchanged clips while regenerating the corrected clip set.","For clearly visual curation requests (for example highlights, best visual moments, montage pacing, scenic shots, or thematic sce
251ne selection from many uploads), prefer the multimodal edit tool instead of INCLUDE_UPLOADS.","Use this when transcript-based edit is not viable: no spoken words, empty/missing transcripts, image-only uploads, or requests that are visual/manual assembly rather than transcript-word edits.","When in doubt between transcript editing and upload inclusion for non-speech media, choose this tool.","This tool can also be used as the base-project step for downstream server-side playback/timeline refinements on the included upload.","Supported downstream refinements currently include volume changes such as mute, lower volume, raise volume, or ducking; playback-rate changes such as speed up or slow down; and basic transitions between assembled timeline layers.","If the user asks to mute a clip, change its volume, slow it down, speed it up, or add a transition between uploaded clips, still use this tool to include the upload in the plan rather than refusing the request.","For a request like 'mute this video' with a single uploaded video, it is valid for the plan to contain only kai_include_uploads.","Duration rule: uploaded images can use any requested timeline span.","Uploaded video/audio must not exceed source duration when known (endTimeSec must be <= startTimeSec + media duration; if video/audio duration is unknown, omit endTimeSec).","Do not try to encode those refinement instructions inside the include_uploads prompt itself. Use this tool to assemble the base project, then rely on the downstream refinement pass to apply the supported playback/timeline changes.","Unsupported refinements beyond those supported server-side still require other tooling or the full Kapwing editor."].join(" "),parameters:p.object({layerVolume:p.number().min(0).max(2).optional().catch(1).describe("For video/audio assets, this is a decimal value that controls the volume level. 1 means original volume, 0.5 means half volume, 2 means double volume, etc. This should only be called when carrying over assets from previous projects, and it should preserve layer volume changes across tool calls.")}).extend({...$e,...Ae,...we,...ur,...jr({extractedAsset:Ko().describe("Extracted media asset from an earlier kai_extract_pasted_link step in the same plan.")}
251)})},[E.EDIT_IMAGE]:{description:`${e[ee.EDIT_IMAGE].description} ${pt}`,parameters:e[ee.EDIT_IMAGE].parameters.omit({postToolCallResponse:!0}).extend({...$e,...Ae,...we})},[E.RESIZE_IMAGE]:{description:`${e[ee.RESIZE_IMAGE_KAI].description} ${pt}`,parameters:e[ee.RESIZE_IMAGE_KAI].parameters.omit({postToolCallResponse:!0}).extend({...$e,...Ae,...we})},[E.REMOVE_IMAGE_BACKGROUND]:{description:`${e[ee.REMOVE_IMAGE_BACKGROUND].description} ${pt}`,parameters:e[ee.REMOVE_IMAGE_BACKGROUND].parameters.omit({postToolCallResponse:!0}).extend({...$e,...Ae,...we})},[E.UPSCALE_VIDEO]:{description:`${e[ee.UPSCALE_VIDEO].description} ${pt}`,parameters:e[ee.UPSCALE_VIDEO].parameters.omit({postToolCallResponse:!0}).extend({...$e,...Ae,...we})},[E.MASK_VIDEO]:{description:`${e[ee.MASK_VIDEO].description} ${pt}`,parameters:e[ee.MASK_VIDEO].parameters.omit({postToolCallResponse:!0}).extend({...Ae,...we})},[E.EDIT_MEDIA]:{description:"Create one or more edited clips from user-uploaded image, video, and audio media. This is the single semantic media editor: it automatically chooses the evidence needed for the request, including transcript words and sentence boundaries, visual scenes/actions/objects, non-speech audio cues, source metadata, or a combination. Use it when clips must be selected, trimmed, reordered, or compiled based on media content. Re-call it for follow-up duration or content revisions to a previous semantic edit. With no new media, it automatically resolves the prior edit and seeds the same evidence path with the original sources, previous constraints, and selected clip ranges unless the user asks to start over. Keep the prompt close to the user's requested selection intent. It cannot add generated assets, transitions, effects, filters, arbitrary text overlays, subtitles, music, or sound design; use downstream tools for those. Do not use it merely to include full uploads before deterministic layer adjustments. Multimodal analysis is limited to 45 minutes per video, 120 minutes of selected video in total, and per-file sizes of 2 GB for audio/video or 30 MB for images. These limits do not apply to transcript-based editing, which selects clips using speech rather than visual or non-speech audio cues.",parameters:p.object({prompt:p.string().describe("Clip-selection intent only, close to the user's wording. Preserve explicit ordering and per-source/per-clip duration requirements here; pass output count and total/final-output duration through the structured fields. For speech-driven edits, keep spoken topics, quotes, cleanup, and sentence-boundary requirements here. Omit soft presentation preferences such as prioritizing the speaker directly to camera when they do not determine the spoken ranges. Do not invent timestamps, durations, effects, overlays, subtitles, music, or other unsupported directives."),referenceMediaIndexes:p.array(p.number()).optional().catch(void 0).describe("Indexes (latest first) of user-uploaded image, video, or audio assets in chat history. Index 0 is the most recent media asset. If omitted, all media from the latest user message is used."),includeTitles:p.boolean().optional().default(!1).describe("True only when the user explicitly wants each output clip to start with an automatically generated top title."),output:p.discriminatedUnion("mode",[p.strictObject({mode:p.literal("separate_clips"),outputCount:p.number().int().min(1).max(50).optional().describe("Exact number of standalone output projects to return. Use separate_clips for independent clips, highlights, files, variants, or outputs; do not infer separate outputs merely because multiple source assets are selected."),minDurationSec:p.number().positive().max(7200).optional().describe("Requested minimum duration in seconds for each standalone output. Required bound. For approximate targets, choose an acceptable min/max range; select complete thoughts within that range."),maxDurationSec:p.number().positive().max(7200).optional().describe("Requested maximum duration in seconds for each standalone output. Required bound. For approximate targets, choose an acceptable min/max range; select complete thoughts within that range.")}).refine(({minDurationSec:t,maxDurationSec:o})=>t===void 0||o===void 0||t<=o,{message:"minDurationSec must be less than or equal to maxDurationSec",path:["maxDurationSec"]}),p.strictObject({mode:p.literal("single_compilation"),minDurationSec:p.number().positive().max(7200).optional().describe("Requested minimum total duration in seconds for the single compiled project. Required bound. For approximate targets, choose an acceptable min/max range; select complete thoughts within that range."),maxDurationSec:p.number().positive().max(7200).optional().describe("Requested maximum total duration in seconds for the single compiled project. Required bound. For approximate targets, choose an acceptable min/max range; select complete thoughts within that range.")}).refine(({minDurationSec:t,maxDurationSec:o})=>t===void 0||o===void 0||t<=o,{message:"minDurationSec must be less than or equal to maxDurationSec",path:["maxDurationSec"]})]).optional().describe("Structured output packaging and duration constraints. Use single_compilation for one combined deliverable, montage, reel, story, stitched edit, or a request to trim/use multiple supplied sources together. Use separate_clips for independent clips, highlights, files, variants, or outputs. Preserve the realized mode on follow-ups unless the user changes the packaging. For approximate requested durations, choose a reasonable acceptable range. Omit output when the user did not request packaging, count, or duration constraints.")}).extend({...Ae,...we})},[E.EDIT_VIDEO_VIA_TRANSCRIPT]:{description:e[ee.EDIT_VIDEO_VIA_TRANSCRIPT].description,parameters:e[ee.EDIT_VIDEO_VIA_TRANSCRIPT].parameters.omit({postToolCallResponse:!0}).extend({...Ae,...we})},[E.EDIT_VIDEO_VIA_MULTIMODAL]:{description:`${e[ee.EDIT_VIDEO_VIA_MULTIMODAL].description} 252 Agent-mode requirement: use this only when editing actual user-uploaded image/video media or an explicitly referenced previous project layer. Proposed plans and unexecuted tool calls are not source media.`,parameters:e[ee.EDIT_VIDEO_VIA_MULTIMODAL].parameters.extend({...Ae,...we})},[E.GET_TRANSCRIPTION]:{description:`${e[ee.GET_TRANSCRIPTION].description} ${pt}`,parameters:e[ee.GET_TRANSCRIPTION].parameters.omit({postToolCallResponse:!0}).extend({...Ae,...we})},[E.SUBTITLE_PROJECT]:{description:`${e[ee.SUBTITLE_PROJECT].description} 253 When adding subtitles to a previous project output, call this tool with sourceToolCallIndexId set to that previous tool result. This tool applies subtitles to the entire referenced project output, including every result card/clip in a multi-result project; sourceProjectLayerIndexId is ignored.`,parameters:e[ee.SUBTITLE_PROJECT].parameters.omit({postToolCallResponse:!0}).extend({...Ae,...we})},[E.REMOVE_SUBTITLES]:{description:e[ee.REMOVE_SUBTITLES].description,parameters:e[ee.REMOVE_SUBTITLES].parameters.omit({postToolCallResponse:!0}).extend({...Ae,...we})},[E.RESIZE_PROJECT_RATIO]:{description:`${e[ee.RESIZE_PROJECT_RATIO].description} 254 Use sourceToolCallIndexId only when resizing a previous project result from the conversation history; do not set it when resizing an earlier step in the same plan. A resize step applies to the whole project output, not to individual layers or clips.`,parameters:e[ee.RESIZE_PROJECT_RATIO].parameters.omit({postToolCallResponse:!0}).extend({sourceToolCallIndexId:Ae.sourceToolCallIndexId})},[E.SMART_RESIZE_PROJECT]:{description:e[ee.SMART_RESIZE_PROJECT].description,parameters:e[ee.SMART_RESIZE_PROJECT].parameters.omit({postToolCallResponse:!0}).extend({...Ae,...we})},[E.ADD_TEXT]:{description:ni.description,parameters:ni.parameters.extend(Ae)},[E.GET_FILE_CONTEXT]:{description:"File context lookup for any uploaded or previously generated media. Call this whenever answering or planning requires specific content from a file â what is said in it (transcripts, quotes, who appears, topics covered), word boundaries for cuts, waveform-derived onset/activity timing, cached visual frame references, basic visual metadata, or explicitly requested bounded frame extraction. Use it for comprehension/Q&A turns (e.g. 'summarize this video', 'who is the guest', 'what do they talk about at 2:30') just as much as for edit planning. Prefer this over answering from memory whenever the user's question is about file contents. Reads cached lightweight context except visual_frame_extract, which may extract a few frames from small videos and return frame URLs.",parameters:p.object({mediaRefs:p.array(p.object({label:p.string().optional().describe("Optional planner-facing label, such as reference video, music track, or clip to retrim.")}).extend({...ur,...Ae})).min(1).describe("Media to inspect. Use either uploadIndexId for user uploads, or sourceToolCallIndexId/sourceProjectLayerIndexId for previous tool/project outputs."),contextKinds:p.array(p.enum(["transcript","audio_onsets","audio_activity","visual_frames","visual_frame_extract","visual_metadata_summary"])).min(1).describe("Bounded context kinds to retrieve."),window:p.object({basis:
254p.enum(["source","timeline"]).describe("Whether startSec/endSec refer to source asset time or assembled project timeline time."),startSec:p.number().min(0).optional(),endSec:p.number().min(0).optional()}).optional().describe("Optional bounded time window. Use source time for raw asset windows and timeline time for project-layer follow-ups."),...gt})},[E.PICK_CHARACTERS]:{description:ai(!1),parameters:ii(!1).extend({...Ae,...gt})},[E.PICK_AND_CREATE_CHARACTERS]:{description:ai(!0),parameters:ii(!0).extend({...Ae,...gt})},[E.SET_OUTPUT_MODE]:{description:"Signal that each generation in this plan should be delivered as a separate, independent output rather than assembled into a single combined project. Only call this when the user explicitly requests multiple distinct deliverables (e.g. '3 separate images', '2 different songs', '3 videos of X'). Do NOT call this for video projects that combine multiple clips, music, and/or voiceover into one timeline. Do not call this in plans that use inputBindings.",parameters:p.object({reason:p.string().optional().describe("Brief reason why outputs should be separate"),...gt})},[E.SEARCH_STUDIO_ASSETS]:{description:"Read-only search over compact Studio asset summaries in the currently open Side Kai project.",parameters:p.object({query:p.string().optional(),assetTypes:p.array(p.enum(["image","video","audio","pdf","other"])).optional(),selectedOnly:p.boolean().optional(),currentTimeOnly:p.boolean().optional(),limit:p.number().int().positive().optional()})}}})(),h5={[E.GET_TRANSCRIPT_CONTEXT]:{description:"Lower-level transcript context tool. Returns bounded transcript words, segments, timestamps, speakers, and matching transcript ranges for uploaded or previously generated audio/video media. Use this instead of opaque transcript editing when the agent needs to decide clip ranges itself.",parameters:p.object({mediaRefs:p.array(p.object({label:p.string().optional()}).extend({...ur,...Ae})).min(1),query:p.string().optional().describe("Optional topic, quote, speaker, or phrase to search for."),window:p.object({basis:p.enum(["source","timeline"]),startSec:p.number().min(0).optional(),endSec:p.number().min(0).optional()}).optional(),...gt})},[E.MAKE_TRANSCRIPT_CLIP_PLAN]:{description:"Lower-level transcript clip planning tool. Converts transcript ranges selected by the agent into timeline-ready clip ranges with source offsets. Use after kai_get_transcript_context when the agent needs to reason about exact source ranges before assembling or repairing clips.",parameters:p.object({ranges:p.array(p.object({mediaLabel:p.string().optional(),sourceStartSec:p.number().min(0),sourceEndSec:p.number().min(0),reason:p.string().optional()})).min(1),timelineStartSec:p.number().min(0).default(0),gapSec:p.number().min(0).default(0),...gt})},[E.GET_MULTIMODAL_CONTEXT]:{description:"Lower-level multimodal context tool. Returns bounded visual/audio observations and timestamps for moments that transcripts cannot answer well, such as scenes, objects, actions, framing, onsets, and visual metadata.",parameters:p.object({mediaRefs:p.array(p.object({label:p.string().optional()}).extend({...ur,...Ae})).min(1),contextKinds:p.array(p.enum(["audio_onsets","audio_activity","visual_frames","visual_frame_extract","visual_metadata_summary"])).min(1),window:p.object({basis:p.enum(["source","timeline"]),startSec:p.number().min(0).optional(),endSec:p.number().min(0).optional()}).optional(),...gt})}},p5=()=>Ee[E.INCLUDE_UPLOADS].description.replace("Supported downstream refinements currently include volume changes such as mute, lower volume, raise volume, or ducking; playback-rate changes such as speed up or slow down; and basic transitions between assembled timeline layers.","Supported downstream refinements currently include volume changes such as mute, lower volume, raise volume, or ducking; visual filters/color correction such as black-and-white, grayscale, sepia, saturation, brightness, contrast, op
254acity, blur, tint, highlights, and shadows; preset looks; playback-rate changes such as speed up or slow down; and basic transitions between assembled timeline layers.").replace("If the user asks to mute a clip, change its volume, slow it down, speed it up, or add a transition between uploaded clips, still use this tool to include the upload in the plan rather than refusing the request.","If the user asks to mute a clip, change its volume, make it black-and-white/grayscale, apply a visual filter, adjust color/brightness/contrast/saturation, slow it down, speed it up, or add a transition between uploaded clips, still use this tool to include the upload in the plan rather than refusing the request or calling a clip-selection edit tool.").replace("For a request like 'mute this video' with a single uploaded video, it is valid for the plan to contain only kai_include_uploads.","For a request like 'mute this video' or 'make this video silent and black and white' with a single uploaded video, it is valid for the base plan to contain kai_include_uploads followed by the needed mutation/refinement steps.").replace("Do not try to encode those refinement instructions inside the include_uploads prompt itself. Use this tool to assemble the base project, then rely on the downstream refinement pass to apply the supported playback/timeline changes.","Do not try to encode those refinement instructions inside the include_uploads prompt itself. Use this tool to assemble the base project, then rely on the downstream refinement pass to apply the supported layer changes."),Rt=e=>Ee[e].description.replace(` ${pt}`,""),zf={...Ee,[E.CREATE_IMAGE]:{...Ee[E.CREATE_IMAGE],parameters:Ee[E.CREATE_IMAGE].parameters.extend(a5)},[E.INCLUDE_UPLOADS]:{...Ee[E.INCLUDE_UPLOADS],description:p5()},[E.EDIT_IMAGE]:{...Ee[E.EDIT_IMAGE],description:Rt(E.EDIT_IMAGE)},[E.RESIZE_IMAGE]:{...Ee[E.RESIZE_IMAGE],description:Rt(E.RESIZE_IMAGE)},[E.REMOVE_IMAGE_BACKGROUND]:{...Ee[E.REMOVE_IMAGE_BACKGROUND],description:Rt(E.REMOVE_IMAGE_BACKGROUND)},[E.UPSCALE_VIDEO]:{...Ee[E.UPSCALE_VIDEO],description:Rt(E.UPSCALE_VIDEO)},[E.MASK_VIDEO]:{...Ee[E.MASK_VIDEO],description:Rt(E.MASK_VIDEO)},[E.EDIT_MEDIA]:{...Ee[E.EDIT_MEDIA],description:`${Ee[E.EDIT_MEDIA].description} 255 The runtime inspects the request and selected assets, reuses cached transcripts, transcribes only when speech evidence is needed, and combines transcript evidence with multimodal analysis for mixed requests. Do not pre-route the request to a transcript-only or visual-only editor.`},[E.GET_TRANSCRIPTION]:{...Ee[E.GET_TRANSCRIPTION],description:Rt(E.GET_TRANSCRIPTION)},[E.EDIT_VIDEO_VIA_MULTIMODAL]:{...Ee[E.EDIT_VIDEO_VIA_MULTIMODAL],description:`${Ee[E.EDIT_VIDEO_VIA_MULTIMODAL].description} 256 Do not use this tool merely to include the full uploaded media before deterministic layer adjustments such as mute, volume changes, black-and-white/grayscale, preset filters, color correction, brightness, contrast, saturation, opacity, blur, playback speed, transitions, placement, or layer ordering. For those requests, assemble the uploaded media with kai_include_uploads, then apply the relevant mutation/refinement tools. 257 For speech-heavy requests about answers, responses, quotes, what people said, advice, lessons, stories, or opinions, inspect transcript context first and prefer transcript edit unless the transcript context is unavailable or the requested anchors are visual/non-speech moments. If this tool is still used for a speech-heavy compilation, its prompt must include the transcript-derived selection criteria and any relevant spoken phrases/timing context the agent inspected.`},...u5,...h5};const Qf=100,Jf=300,Xf=2e3,Zf="Character names cannot use the reserved stock character tag prefix.";var m5="character_";const Xa="KAI_STOCK_CHARACTER_";var f5=`${Er(Xa)}_`;function Er(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/_+/g,"_")}function fd({name:e,id:t}){const o=Er(e);return o||`${m5}${t.slice(-6)}`}function eg(e){const t=String(e.id??e._id??""),o=fd({name:e.name,id:t});return e.type==="stock"?`${Xa}${o}`:o}function tg(e){const t=String(e.id??e._id??"");return fd({name:e.name,id:t})}function og(e){return Er(e.replace(/^@+/,""))}function rg(e){return Er(e).startsWith(f5)}function ag(e){return`@${e}`}
257function sg(e){return e.trim().split(/\s+/).filter(Boolean).slice(0,2).map(t=>t[0]?.toUpperCase()??"").join("")||"?"}const g5=/[\s([{"'`]/,A5=/[\s)\]}"'`.,!?;:]/;function y5(e,t){const o=e[t-1];return t===0||g5.test(o??"")}function b5(e,t){const o=e[t];return o===void 0||A5.test(o??"")}function ig({text:e,oldMentionText:t,nextMentionText:o}){if(t===o||!e.includes(t))return e;let r="",s=0;for(;s<e.length;){const a=e.indexOf(t,s);if(a===-1){r+=e.slice(s);break}const n=a+t.length,i=y5(e,a)&&b5(e,n);r+=e.slice(s,a),r+=i?o:e.slice(a,n),s=n}return r}const ng=e=>`${sc}/${e}`;var _5=new RegExp(`@${Xa}`,"g"),di=e=>e.replace(_5,"@");const I5=e=>{for(const t of e){if(t.role!=="user")continue;const{content:o}=t;if(typeof o=="string")return di(o);if(Array.isArray(o)&&o.length>0){for(const r of o)if(r.type==="text"&&r.text)return di(r.text)}}return null},T5=e=>{const t=I5(e);return t?t.length>100?t.slice(0,100)+"...":t:null};function dg(e){if(!("tool_calls"in e))return null;const{tool_calls:t}=e;if(!t)return null;const o=t[0];return o||null}const lg={"multiscene-video-premium-suggestion":"You can switch to the Advanced model for script to video generations to generate outputs with higher quality images and more consistent characters."};const cg=({creditEstimateIsExact:e,estimatedCredits:t})=>e?t:Math.min(Number.MAX_SAFE_INTEGER,t+10),v5=({messageHistory:e,toolCallId:t})=>{let o=-1;for(let n=0;n<e.length;n+=1)if(e[n]?.tool_calls?.some(i=>i.id===t&&i.function.name==="kai_agent_project")){o=n;break}if(o===-1)return"unavailable";const r=e.slice(o+1),s=r.some(n=>n.role==="user"),a=r.some(n=>n.tool_calls?.some(i=>i.function.name===dd));return s||a?"superseded":"confirmable"};var S5=e=>mr()?Be(e):e.kai.teamId,w5=e=>e.kai.accountSettingsOpen,gd=e=>e.kai.currentChatId,Ad=e=>e.kai.allChatsById,E5=e=>e.kai.customKaisById,yd=(e,t)=>e.kai.customKaisById[t],C5=e=>e.kai.loadingAllChats,x5=e=>e.kai.hasFetchedAllCustomKais,Lo=Re(gd,Ad,(e,t)=>e?t[e]??null:null),k5=(e,t)=>e.kai.customKaiUsageByKaiUsageId[t],R5=e=>e.kai.hasFetchedCustomKaiUsage,li="New Chat",L5=(e,t)=>{const o=e.kai.allChatsById[t];if(!o)return li;if(o.name)return o.name;if(o.customKaiId)return`${yd(e,o.customKaiId)?.name??"Custom Kai"} Chat`;if(o.messageHistory){const r=T5(o.messageHistory);if(r)return r}return li},ci=(e,t)=>new Date(e).getTime()<=new Date(t).getTime()?1:-1,D5=Re(e=>e.kai.customKaiUsageByKaiUsageId,e=>e.kai.teamId,(e,t)=>Object.values(e).filter(o=>o.team_id===t).sort((o,r)=>o.pinnedAt&&!r.pinnedAt?-1:!o.pinnedAt&&r.pinnedAt?1:o?.pinnedAt&&r?.pinnedAt?ci(r.pinnedAt,o.pinnedAt):ci(o.last_used_at,r.last_used_at))),M5=(e,t)=>e.kai.customKaiUsageByKaiUsageId[t],U5=(e,t)=>e.kai.toolCallJobsById[t],P5=e=>e.kai.toolCallJobsById,ui=[],O5=[],bd=(e,t)=>t?e.kai.assetIdsByToolCallIds[t]??ui:ui,B5=Re(bd,e=>e.assets.byId,(e,t)=>{if(!e.length)return O5;const o=[];for(const r of e){const s=t[r];s&&o.push(s)}return o}),F5=(e,t)=>e.kai.toolCallSubtitlePresetsById[t],j5=(e,t)=>e.kai.chatLoadingTextByChatId[t]??null,N5=Re((e,t)=>t.tool_calls?.[0]?.id,e=>e.kai.toolCallJobsById,(e,t)=>e?t[e]??null:null),lo=[],_d=Re(Be,e=>e.teams.brandkitByTeamId,(e,t)=>e?(t[e]?.kaiCharacters??lo).filter(o=>o.type==="brandkit"):lo),V5=Re(_d,Re(Lo,e=>e.kai.chatCharactersByChatId,(e,t)=>{if(!e?._id||!e.chatCharacters?.length)return lo;const o=t[e._id]??lo,r=new Set(e.chatCharacters.map(String));return o.filter(s=>s.type==="chat"&&r.has(String(s._id)))}),(e,t)=>{if(!e.length&&!t.length)return lo;const o=new Map;return e.forEach(r=>{o.set(String(r._id),r)}),t.forEach(r=>{o.has(String(r._id))||o.set(String(r._id),r)}),Array.from(o.values())}),Id=Re(Lo,e=>{const t=e?.messageHistory;if(!t?.length)return null;for(let o=t.length-1;o>=0;o--){const r=t[o];if(!r||!Ji(r))continue;const s=r.tool_calls?.[0];if(s&&s.function.name==="kai_agent_plan")return s.id}return null}),G5=Re(Lo,P5,(e,t)=>{const o=e?.messageHistory;if(!o?.length)return null;for(let r=o.length-1;r>=0;r--){const s=o[r];if(!s||!Ji(s))continue;const a=s.tool_calls?.find(i=>i.function.name===dd);if(!a)continue;const n=t[a.id];return n&&fa(n)?n:null}return null}
257),K5=Re(Id,(e,t)=>t,(e,t)=>t?e!=null?t===e:!0:!1),W5=Re(Lo,(e,t)=>t,(e,t)=>t?v5({messageHistory:e?.messageHistory??[],toolCallId:t}):"unavailable"),H5={teamId:S5,teamKaiCharacters:_d,allMentionableCharacters:V5,accountSettingsOpen:w5,currentChatId:gd,currentChat:Lo,allChatsById:Ad,mostRecentChatIds:Re(e=>e.kai.allChatsById,e=>Object.values(e).sort((t,o)=>new Date(o.createdAt).getTime()-new Date(t.createdAt).getTime()).map(t=>t._id)),allCustomKaisById:E5,customKaiById:yd,orderedCustomKaiUsage:D5,customKaiUsageById:M5,customKaiUserByKaiId:k5,loadingAllChats:C5,hasFetchedAllCustomKais:x5,hasFetchedCustomKaiUsage:R5,chatName:L5,toolCallJobById:U5,toolCallAssetIds:bd,toolCallAssets:B5,toolCallSubtitlePresetById:F5,chatLoadingTextByChatId:j5,toolCallJobByMessage:N5,latestAgentPlanToolCallId:Id,latestAutonomousAgentProjectJob:G5,agentPlanAllowConfirm:K5,autonomousPlanConfirmationState:W5},co=H5;function q5(e){return e.type!=="agent_mode:complete"&&e.type!=="llm_response:complete"&&e.type!=="chat_response:complete"&&e.type!=="send_message:complete"&&e.type!=="create_chat:complete"}const da=({chat:e,assets:t,cmlFiles:o,jobs:r,updateTeamLimits:s=!1})=>{const{dispatch:a}=I();a(he.setChatById(e)),a(Te(t)),a(Ia(o)),a(he.setToolCallJobs(r)),s&&un()};function $5({kaiProjectId:e}){const t=gr(),o=L9(),r=We(co.currentChat),s=(0,v.useRef)(null),a=(0,v.useRef)(new Set),n=(0,v.useRef)(new Set),[i,l]=(0,v.useState)(!1),[d,c]=(0,v.useState)(null),[u,h]=(0,v.useState)(null),A=!!r&&r._id===d,g=!!r&&r._id===u,y=We(co.latestAutonomousAgentProjectJob),b=(0,v.useCallback)(L=>{t(he.setChatLoadingText({chatId:L,text:null})),c(L),h(L)},[t]),_=(0,v.useCallback)(()=>{d&&t(he.setChatLoadingText({chatId:d,text:null})),c(null),h(null)},[t,d]),S=(0,v.useCallback)(L=>{h(f=>f!==L?f:null)},[]);(0,v.useEffect)(function(){a.current=new Set,n.current=new Set},[e]);const T=Di(function(f){switch(f.type){case"chat:created":f.payload.chat&&(t(he.setChatById(f.payload.chat)),t(he.setCurrentChatId(f.payload.chat._id))),b(f.payload.chat._id);break;case"chat:updated":f.payload.chat&&(t(he.setChatById(f.payload.chat)),kt(f.payload.chat)||b(f.payload.chat._id));break;case"custom_kai_usage:updated":f.payload.usage&&t(he.modifyCustomKaiUsage({kaiUsageId:f.payload.usage._id,updates:f.payload.usage}));break;case"message:text_delta":S(f.payload.chatId),t(he.appendTextDeltaToChatMessage({chatId:f.payload.chatId,messageIndex:f.payload.messageIndex,textDelta:f.payload.textDelta}));break;case"message:tool_call":S(f.payload.chatId),t(he.appendToolCallToChatMessage({chatId:f.payload.chatId,messageIndex:f.payload.messageIndex,toolCall:f.payload.toolCall}));break;case"message:tool_call_updated":S(f.payload.chatId),t(he.updateToolCallInChatMessage({chatId:f.payload.chatId,messageIndex:f.payload.messageIndex,toolCall:f.payload.toolCall}));break;case"tool_call_job:updated":{S(f.payload.chatId),f.payload.assets?.length&&(t(Te(f.payload.assets)),t(he.addToolCallAssetIds({toolCallId:f.payload.toolCallId,assetIds:f.payload.assets.map(N=>N._id)}))),t(he.setToolCallJob({toolCallId:f.payload.toolCallId,job:f.payload.job}));const{chatId:U,toolCallId:P,job:F}=f.payload,H=new Jm(F).isSettled;fa(F)&&H&&!a.current.has(P)&&(a.current.add(P),(async()=>{try{const{chat:N,assets:W,cmlFiles:se,jobs:G}=await ne.kai.getChatById.query({chatId:U});t(he.setChatById(N)),t(Te(W)),t(he.setToolCallAssetIds({toolCallId:P,assetIds:W.map(z=>z._id)})),t(Ia(se)),t(he.setToolCallJobs(G))}catch(N){a.current.delete(P),console.error("Failed to refresh chat after autonomous tool call settled:",N)}})()),H&&!n.current.has(P)&&(n.current.add(P),un());break}case"chat_loading_text:updated":S(f.payload.chatId),t(he.setChatLoadingText({chatId:f.payload.chatId,text:f.payload.text}));break}});(0,v.useEffect)(function(){if(!r){s.current=null;return}s.current!==r._id&&(s.current=r._id,o("chatLoaded",{chatId:r._id}),r9(r._id))},[r,o]);const w=(0,v.useRef)(null);(0,v.useEffect)(function(){if(!r){w.current=null;return}const f=!kt(r),U=w.current,P={chatId:r._id,isLoading:f},F=U9(U,P);F&&o("responseFinished",{chatId:F}),w.current=P},[r,o]),(0,v.useEffect)(function(){if(!r||!e){l(!1);return}l(!kt(r))},[r,e]),Zu({callback:(0,v.useCallback)(async()=>
257{if(r)try{const{chat:L,assets:f,cmlFiles:U,jobs:P}=await ne.kai.getChatById.query({chatId:r._id});da({chat:L,assets:f,cmlFiles:U,jobs:P,updateTeamLimits:kt(L)})}catch(L){console.error("Error polling chat status:",L)}},[r]),intervalMs:Fm,shouldPoll:!!(e&&r&&r._id===e&&!kt(r)&&!A)});const x=(0,v.useRef)(void 0),k=(0,v.useRef)(!1),M=(0,v.useRef)(()=>{}),j=(0,v.useCallback)(async({streamId:L,lastEventId:f})=>{if(!(!e||k.current)){k.current=!0;try{const{chat:U,assets:P,cmlFiles:F,jobs:H}=await ne.kai.getChatById.query({chatId:e});if(da({chat:U,assets:P,cmlFiles:F,jobs:H,updateTeamLimits:kt(U)}),(U.activeAgentResponseInfo?.streamId?String(U.activeAgentResponseInfo.streamId):null)===L){const N=U.activeAgentResponseInfo?.mostRecentStreamJobId??U.activeAgentResponseJobId;if(!N)return;M.current(L,N,f);return}_()}catch(U){console.error("Failed to refresh chat after Kai agent response stream ended:",U),_()}finally{k.current=!1}}},[e,_]),O=(0,v.useCallback)((L,f,U)=>{!e||x.current||(b(e),x.current=a9({jobId:f,lastEventId:U,onSharedEvent:T,onComplete:()=>{const P=x.current?.getLastEventId();x.current=void 0,j({streamId:L,lastEventId:P})},onError(P){console.error("Failed to resume Kai agent response stream:",P);const F=x.current?.getLastEventId();x.current=void 0,j({streamId:L,lastEventId:F})}}))},[e,b,T,j]);M.current=O;const B=r?.activeAgentResponseInfo?.streamId??r?.activeAgentResponseJobId,$=r?._id;(0,v.useEffect)(function(){return()=>{x.current?.unsubscribe(),x.current=void 0,k.current=!1}},[e,$]),(0,v.useEffect)(function(){if(!e||$!==e||k.current||x.current||!B)return;const f=r?.activeAgentResponseInfo?.mostRecentStreamJobId??r?.activeAgentResponseJobId;f&&O(B,f)},[e,$,B,O,r]);const Z=(0,v.useCallback)(async L=>{const f=await ne.kai.characters.getByChatId.query({chatId:L});return t(he.setChatCharacters({chatId:L,characters:f.characters})),f.characters},[t]),Y=We(co.currentChatId),Q=r?.chatCharacters;return(0,v.useEffect)(function(){if(!Y)return;if(!Q?.length){t(he.setChatCharacters({chatId:Y,characters:[]}));return}let f=!1,U;const P=Y;async function F(){try{const H=await Z(P);if(f)return;H.some(N=>N.referenceImageStatus==="pending")&&(U=window.setTimeout(F,1500))}catch(H){f||console.error("Failed to fetch chat characters:",H)}}return F(),()=>{f=!0,U!=null&&window.clearTimeout(U)}},[Y,Q,t,Z]),{handleStreamedKaiEvent:T,isLoadingChatResponse:i,isStreamingChatResponse:A,isWaitingForFirstStreamEvent:g,isActiveAutonomousGeneration:!!(i&&y?.status==="pending"&&(y.agentRun.phase==="executing"||y.agentRun.phase==="verifying"||y.agentRun.phase==="waiting_for_long_poll")),onChatResponseStreamFinished:_}}function Y5(){const e=Hc(),t=gr(),o=We(co.teamId),r=We(co.hasFetchedCustomKaiUsage);(0,v.useEffect)(function(){e&&(async()=>{if(!o)return;const n=await ne.kai.getAllChats.query({teamId:o});if(n){const i=n.reduce((l,d)=>(l[d._id]=d,l),{});t(he.setAllChatsById(i))}})()},[t,e,o]),(0,v.useEffect)(function(){if(!e||r||!o)return;(async()=>{try{const n=await ne.kai.getCustomKaiUsage.query({teamId:o}),i=n?.customKaiUsers??[],l=n?.customKais??[];t(he.setCustomKaiUsage(i)),l.forEach(d=>{t(he.addCustomKaiToCustomKaisById(d))})}catch{}})()},[t,r,e,o])}const z5="kapwing-request-action";function ug(e){window.parent.postMessage({type:z5,payload:e},window.location.origin)}var Q5=ae(ye()),Td="kai:adminViewModeEnabled";const J5=()=>mr();var X5={isViewingChatUsingAdminPowers:!1,isLoadingChat:!1,adminViewModeEnabled:!1,setAdminViewModeEnabled:()=>{},isInitializing:!1,sideKaiSelectedLayerAttachments:[],sideKaiSelectedLayerAttachmentTotalCount:0,isLoadingChatResponse:!1,isStreamingChatResponse:!1,isWaitingForFirstStreamEvent:!1,isActiveAutonomousGeneration:!1,handleStreamedKaiEvent:()=>{},onChatResponseStreamFinished:()=>{}};const vd=(0,v.createContext)(X5);function hg(){return(0,v.useContext)(vd)}function pg(e){const t=(0,Q5.c)(36),{children:o}=e;Y5();const r=We(hl),s=qu(),a=Bd(),n=We(o7);let i;e:{if(mr()){i=n;break e}let re;t[0]!==a.pathname?(re=a.pathname.match(/\/kai\/chat\/([^/]+)/),t[0]=a.pathname,t[1]=re):re=t[1];const J=re;i=J?J[1]:void 0}const l=i,[d,c]=(0,v.useState)(!1),[u,h]=(0,v.useState)(!1),[A,g]=(0,v.useState)(t7),y=s&&A;let b;t[2]===Symbol.for("react.memo_cache_sentinel")?(b=[],t[2]=b):b=t[2];const[_,S]=(0,v.useState)(b),[T,w]=(0,v.useState)(0),[x,k]=(0,v.useState)(e7),M=gr(),j=Vd();let O;
257t[3]!==l?(O={kaiProjectId:l},t[3]=l,t[4]=O):O=t[4];const{handleStreamedKaiEvent:B,isLoadingChatResponse:$,isStreamingChatResponse:Z,isWaitingForFirstStreamEvent:Y,isActiveAutonomousGeneration:Q,onChatResponseStreamFinished:L}=$5(O);let f;t[5]!==s?(f=re=>{s&&g(J=>{const q=typeof re=="function"?re(J):re;return Ie.set(Td,q),q})},t[5]=s,t[6]=f):f=t[6];const U=f;let P,F;t[7]!==r||t[8]!==M||t[9]!==s||t[10]!==l||t[11]!==j?(P=function(){const J=()=>{M(ke({type:"warning",description:"You don't have access to this chat."})),j(os),c(!1)};(async()=>{if(l){if(!r){J();return}try{c(!0);const{chat:te,assets:X,cmlFiles:oe,jobs:pe}=await ne.kai.getChatById.query({chatId:l});if(h(!1),te.userId!==r){if(!s){h(!1),J();return}h(!0)}te.userId===r&&M(he.setTeamId(te.teamId)),da({chat:te,assets:X,cmlFiles:oe,jobs:pe}),M(he.setCurrentChatId(te._id)),c(!1)}catch(te){const X=te;nu(X)&&X.data?.httpStatus===404&&(M(ke({type:"warning",description:"This chat does not exist."})),j(os)),console.error("Error fetching chat:",X),c(!1)}}})()},F=[l,M,j,r,s,h],t[7]=r,t[8]=M,t[9]=s,t[10]=l,t[11]=j,t[12]=P,t[13]=F):(P=t[12],F=t[13]),(0,v.useEffect)(P,F);let H,N;t[14]===Symbol.for("react.memo_cache_sentinel")?(H=function(){if(window.top===window.self){k(!1);return}const J=Z5;J();const q=window.setInterval(J,1e3),te=window.setTimeout(()=>{k(!1)},3e3),X=oe=>{oe.source!==window.parent||!oe.data||typeof oe.data!="object"||!("type"in oe.data)||(oe.data.type==="kapwing-handshake-response"&&(window.clearInterval(q),window.clearTimeout(te),k(!1)),oe.data.type==="kapwing-set-selected-layer-attachments"&&Array.isArray(oe.data.attachments)&&typeof oe.data.totalCount=="number"&&(S(oe.data.attachments),w(oe.data.totalCount)))};return window.addEventListener("message",X),()=>{window.clearInterval(q),window.clearTimeout(te),window.removeEventListener("message",X)}},N=[],t[14]=H,t[15]=N):(H=t[14],N=t[15]),(0,v.useEffect)(H,N);let W,se;t[16]!==a.pathname?(se=function(){window.top!==window.self&&a.pathname==="/kai"&&window.parent.postMessage({type:"kapwing-side-kai-zero-state-loaded"},window.location.origin)},W=[a.pathname],t[16]=a.pathname,t[17]=W,t[18]=se):(W=t[17],se=t[18]),(0,v.useEffect)(se,W);let G;t[19]!==y||t[20]!==B||t[21]!==Q||t[22]!==x||t[23]!==d||t[24]!==$||t[25]!==Z||t[26]!==u||t[27]!==Y||t[28]!==L||t[29]!==U||t[30]!==T||t[31]!==_?(G={isViewingChatUsingAdminPowers:u,isLoadingChat:d,adminViewModeEnabled:y,setAdminViewModeEnabled:U,isInitializing:x,sideKaiSelectedLayerAttachments:_,sideKaiSelectedLayerAttachmentTotalCount:T,isLoadingChatResponse:$,isStreamingChatResponse:Z,isWaitingForFirstStreamEvent:Y,isActiveAutonomousGeneration:Q,handleStreamedKaiEvent:B,onChatResponseStreamFinished:L},t[19]=y,t[20]=B,t[21]=Q,t[22]=x,t[23]=d,t[24]=$,t[25]=Z,t[26]=u,t[27]=Y,t[28]=L,t[29]=U,t[30]=T,t[31]=_,t[32]=G):G=t[32];let z;return t[33]!==o||t[34]!==G?(z=(0,C.jsx)(vd.Provider,{value:G,children:o}),t[33]=o,t[34]=G,t[35]=z):z=t[35],z}function Z5(){return window.parent.postMessage({type:"kapwing-handshake"},"*")}function e7(){return typeof window<"u"&&window.top!==window.self}function t7(){return Ie.get(Td,{disabled:!1})??!1}function o7(e){return e.studio.kai_chat_id}function ut({formatter:e,sideKaiSideEffect:t}){const o=(...s)=>{const a=e(...s);if(!J5())return a;const n=window.location.pathname.match(/^((?:\/[^/]+)?\/studio\/editor)(?:\/|$)/);if(!n)return a;const i=n[1];return a==="/kai"?`${i}/kai`:a.startsWith("/kai/chat/")?`${i}/kai/${a.slice(10)}`:a},r=s=>(...a)=>(t&&mr()&&t(...a),s(...a));return{format:(...s)=>{const a=o(...s);return`${window.location.origin}${a}`},go:r((...s)=>$r(o(...s))),openNewTab(...s){Pl(o(...s))},replace:r((...s)=>Kl(o(...s)))}}var r7=ut({formatter:()=>"/kai",sideKaiSideEffect:()=>{const{dispatch:e}=I();e(br(void 0))}}),a7=ut({formatter:e=>`/kai/chat/${e}`,sideKaiSideEffect:e=>{const{dispatch:t}=I();t(br(e))}}),s7=ut({formatter:e=>{const{state:t}=I(),o=t.kai.customKaisById[e];return o?.slug?`/kai/create${o.slug}`:`/kai/create/${e}`}}),i7=ut({formatter:Jn}),n7=ut({formatter:(e="")=>`/kai/new/${e}`}),d7=ut({formatter:e=>`/kai/share/${e}`}),l7=ut({formatter:(e,t)=>`/kai/edit/${e}/${t}`}),c7=ut({formatter:(e,t,o)=>{const s=(i=>!i||i===cl?"/kai/explore":`/kai/explore/${i}`)(e),a=new URLSearchParams;t&&a.set("q",t),o&&a.set("page",o);const n=a.toString();return n?`${s}?${n}`:s}}),Za="overlay",Ho={add:"addCharacter",edit:"editCharacter"};function hi(e,t){return new URLSearchParams(e).get(Za)===t}function pi(e){const{pathname:t,search:o}=window.location,r=new URLSearchParams(o);r.set(Za,e);const s=r.toString();return s?`${t}?${s}`:t}function u7(){const{pathname:e,search:t}=window.location,o=new URLSearchParams(t);o.delete(Za);const r=o.toString();return r?`${e}?${r}`:e}const mg={isAddOpen:e=>hi(e,Ho.add),isEditOpen:e=>hi(e,Ho.edit),openAdd:()=>$r(pi(Ho.add)),openEdit:()=>$r(pi(Ho.edit)),close:()=>ha().replace(u7())},es={home:r7,chat:a7,share:d7,custom:s7,recreate:i7,createCustom:n7,editInKapwing:l7,explore:c7};var h7=ae(po());function p7(e){const{dispatch:t}=I(),o=Fc(e);t(he.addAttachedMediaCacheId(o))}function m7(e){const{dispatch:t}=I(),{mediaCache:o}=I().state,r=o.uploadIdToMediaCacheId[e]||(0,h7.default)();t(ma({uploadId:e,mediaCacheId:r})),t(he.addAttachedMediaCacheId(r))}function f7(e){const{dispatch:t}=I();t(he.addAttachedMediaCacheId(e))}function g7(){const{dispatch:e}=I(),t=ts();for(const o of t)Sd(o);e(he.clearAttachedMediaCacheIds())}function Sd(e){const{dispatch:t}=I(),{mediaCache:o}=I().state,r=o.mediaCacheIdToUploadId[e],s=o.mediaCacheIdToAssetId[e];t(he.removeAttachedMediaCacheId(e)),r&&!s&&ar(r)}function ts(e=I().state){return e.kai.attachedMediaCacheIds}const A7=Re([e=>e.kai.attachedMediaCacheIds,e=>e.mediaCache.mediaCacheIdToAssetId],(e,t)=>e.map(o=>t[o]).filter(Gu));function y7(e=I().state){const t=ts(e);for(const o of t){const r=e.mediaCache.mediaCacheIdToAssetId[o];if(e.mediaCache.mediaCacheIdToUploadId[o]&&!r)return!0}return!1}var b7={attachAssetId:p7,attachMediaCacheId:f7,attachUploadId:m7,clearAllAttachments:g7,clearAttachedMediaCacheId:Sd,getAttachedAssetIds:A7,getAttachedMediaCacheIds:ts,hasPendingUploads:y7},Hr=b7;
257const _7=e=>`kai_recreate_draft_${e}`,I7=e=>e.map(t=>t.layerId?t:{...t,assetId:void 0,url:void 0,thumbnailUrl:void 0,isUnavailable:!0});var T7=(e,t)=>{const o=Object.entries(e),r=t;return o.length===Object.keys(t).length&&o.every(([s,a])=>r[s]===a)};const fg=({mentionableMedia:e,currentStudioLayers:t})=>{const o=new Map(t.map(a=>[a.resourceId,a]));let r=!1;const s=e.map(a=>{if(!a.layerId)return a;const n=o.get(a.resourceId);let i;if(n?.layerId===a.layerId){const{isUnavailable:l,...d}={...a,...n};i={...d,handle:a.handle}}else i={...a,assetId:void 0,url:void 0,thumbnailUrl:void 0,isUnavailable:!0};return T7(a,i)?a:(r=!0,i)});return r?s:e},gg=async({draft:e,isCurrent:t=()=>!0})=>{const o=e.mentionableMedia??[];if(!t())return{status:"cancelled",mentionableMedia:o};if(Hr.clearAllAttachments(),e.attachedAssetIds.length===0)return{status:t()?"ready":"cancelled",mentionableMedia:o};try{return await Pu(e.attachedAssetIds,Aa.ai),t()?(e.attachedAssetIds.forEach(Hr.attachAssetId),{status:"ready",mentionableMedia:o}):{status:"cancelled",mentionableMedia:o}}catch(r){return t()?(Hr.clearAllAttachments(),Se({description:"Failed to load the original reference assets.",error:r}),{status:"unavailable",mentionableMedia:I7(o)}):{status:"cancelled",mentionableMedia:o}}};var wd=ae(po());const Ag=async({teamId:e,...t})=>{const o=await ne.kai.prepareChatRecreate.mutate({...t,teamId:e});return{id:(0,wd.default)(),initialInput:o.initialMessage,attachedAssetIds:o.attachedAssetIds,mentionableMedia:o.mentionableMedia,customKaiId:o.customKaiId,hasUnavailableReferences:o.hasUnavailableReferences}},v7=async({assetId:e,teamId:t})=>{const o=await ne.kai.prepareAssetRecreate.mutate({assetId:e,teamId:t});return{id:(0,wd.default)(),initialInput:o.initialMessage,attachedAssetIds:o.attachedAssetIds,mentionableMedia:o.mentionableMedia,recreateSourceAssetId:o.recreateSourceAssetId,hasUnavailableReferences:o.hasUnavailableReferences}},yg=async({assetId:e,teamId:t})=>{const o=window.open("about:blank","_blank");if(!o)return Se({description:"Allow pop-ups to open Recreate in a new tab.",error:new Error("The browser blocked the Kai Recreate tab."),sendToSentry:!1}),!1;try{const r=await v7({assetId:e,teamId:t});return Ie.set(_7(r.id),r),o.location.replace(`${es.home.format()}?recreateDraft=${r.id}`),!0}catch(r){return o.close(),Se({description:"Failed to prepare this asset for Recreate.",error:r}),!1}};var S7={music:"Generate inspirational background music for my travel vlog","sound-effects":"Generate a trumpet sound effect",images:"Generate an image of a golden retriever puppy",videos:"Generate a video of a sports car driving through snowy mountains"};function bg(e){const{dispatch:t}=I();t(Si(!0)),t(wa({tabId:pr.KAI,tabContainerId:ca})),es.home.go(),t(br()),t(xi(e?S7[e]:void 0)),t(ki(null))}function _g(e){const{dispatch:t}=I();t(qr(null)),t(Si(!0)),t(wa({tabId:pr.KAI,tabContainerId:ca})),es.home.go(),t(br()),t(xi(void 0)),t(ki(e))}var w7=ae(ye());function Ig(e){const t=(0,w7.c)(9),{assetId:o,teamId:r,enabled:s}=e,[a,n]=(0,v.useState)(null),i=r&&o?`${r}:${o}`:void 0;let l,d;t[0]!==o||t[1]!==i||t[2]!==s||t[3]!==r?(l=function(){if(!s||!o||!r||!i){n(null);return}n(null);let y=!1;return ne.kai.getAssetRecreateInfo.query({assetId:o,teamId:r}).then(b=>{y||n({assetKey:i,canRecreate:b.canRecreate,originalPrompt:b.originalPrompt})}).catch(()=>{y||n(null)}),()=>{y=!0}},d=[o,i,s,r],t[0]=o,t[1]=i,t[2]=s,t[3]=r,t[4]=l,t[5]=d):(l=t[4],d=t[5]),(0,v.useEffect)(l,d);const c=a?.assetKey===i,u=!!(s&&c&&a?.canRecreate),h=s&&c?a?.originalPrompt:void 0;let A;return t[6]!==u||t[7]!==h?(A={canRecreate:u,originalPrompt:h},t[6]=u,t[7]=h,t[8]=A):A=t[8],A}const Ed="application/x-kapwing-kai-generated-asset";var At=null;function Tg(e,t){At=t,e.effectAllowed="copy",e.setData(Ed,JSON.stringify(t))}function vg(e){const t=Array.from(e.types);return t.includes("application/x-kapwing-kai-generated-asset")?!0:t.length>0?(At=null,!1):At!==null}function E7(e){if(!e)return null;try{const t=JSON.parse(e);return typeof t.assetId!="string"||t.kind!=="image"?null:{assetId:t.assetId,kind:t.kind}}catch{return null}}function Sg(e){const t=Array.from(e.types),o=e.getData(Ed);return o?E7(o):t.includes("application/x-kapwing-kai-generated-asset")?At:t.length>0?(At=null,null):At}function wg(){At=null}var Cd=ae(ye()),C7=ae(jd()),xd={loading:"loading",apiLoading:{}},x7=(e,t)=>{switch(t.type){case"UPDATE_GAPI_LOADING":return{...e,loading:t.loadingState};
257case"UPDATE_GAPI_API_LOADING":return{...e,apiLoading:{...e.apiLoading,[t.api]:t.loadingState}};default:return e}},kd=(0,v.createContext)({state:xd,requestAPI:()=>{}});const Eg=v.memo(e=>{const t=(0,Cd.c)(16),{children:o}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];const[s,a]=(0,v.useState)(r),[n,i]=(0,v.useReducer)(x7,xd),l=n.loading==="loaded";let d,c;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=function(){(0,C7.default)(k7,k=>{if(k){i({type:"UPDATE_GAPI_LOADING",loadingState:"error"});return}i({type:"UPDATE_GAPI_LOADING",loadingState:"loaded"})})},c=[],t[1]=d,t[2]=c):(d=t[1],c=t[2]),(0,v.useEffect)(d,c);let u,h;t[3]!==l||t[4]!==n.apiLoading||t[5]!==s?(u=function(){if(l)for(const k of s)n.apiLoading[k]||(i({type:"UPDATE_GAPI_API_LOADING",api:k,loadingState:"loading"}),gapi.load(k,()=>{k==="client"&&(gapi.client.load("photoslibrary","v1"),gapi.client.load("youtube","v3")),i({type:"UPDATE_GAPI_API_LOADING",api:k,loadingState:"loaded"})}))},h=[l,n.apiLoading,s],t[3]=l,t[4]=n.apiLoading,t[5]=s,t[6]=u,t[7]=h):(u=t[6],h=t[7]),(0,v.useEffect)(u,h);let A;t[8]===Symbol.for("react.memo_cache_sentinel")?(A=x=>{a(k=>k.includes(x)?k:[...k,x])},t[8]=A):A=t[8];const g=A;let y,b;t[9]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{g("client")},b=[g],t[9]=y,t[10]=b):(y=t[9],b=t[10]),(0,v.useEffect)(y,b);let _,S;t[11]!==n?(S={state:n,requestAPI:g},t[11]=n,t[12]=S):S=t[12],_=S;const T=_;let w;return t[13]!==o||t[14]!==T?(w=(0,C.jsx)(kd.Provider,{value:T,children:o}),t[13]=o,t[14]=T,t[15]=w):w=t[15],w});var k7="https://apis.google.com/js/api.js";function Cg(e){const t=(0,Cd.c)(7),{requestAPI:o,state:r}=(0,v.useContext)(kd),s=r.loading==="error",a=!s&&(r.loading!=="loaded"||r.apiLoading[e]!=="loaded");let n,i;t[0]!==e||t[1]!==o?(n=()=>{o(e)},i=[e,o],t[0]=e,t[1]=o,t[2]=n,t[3]=i):(n=t[2],i=t[3]),(0,v.useEffect)(n,i);let l;return t[4]!==s||t[5]!==a?(l={loading:a,error:s},t[4]=s,t[5]=a,t[6]=l):l=t[6],l}export{Of as $,z7 as $i,s6 as $n,C8 as $r,Y6 as $t,Xf as A,A8 as Ai,T6 as An,U8 as Ar,zn as At,sg as B,n8 as Bi,h6 as Bn,j8 as Br,af as Bt,ug as C,Xr as Ci,C6 as Cn,Ht as Cr,gf as Ct,ng as D,f8 as Di,ep as Dn,ar as Dr,Jn as Dt,lg as E,d8 as Ei,S6 as En,K8 as Er,pf as Et,rg as F,fh as Fi,I6 as Fn,Wt as Fr,lf as Ft,ig as G,Z0 as Gi,Pa as Gn,R as Gr,J6 as Gt,y5 as H,o8 as Hi,g6 as Hn,D8 as Hr,ef as Ht,Er as I,i8 as Ii,Q3 as In,N8 as Ir,o4 as It,Nf as J,J7 as Ji,c6 as Jn,Tn as Jr,Z6 as Jt,jf as K,X7 as Ki,Ro as Kn,R8 as Kr,X6 as Kt,ag as L,s8 as Li,f6 as Ln,Dn as Lr,nf as Lt,Qf as M,l8 as Mi,Nn as Mn,F8 as Mr,cf as Mt,Zf as N,y8 as Ni,_6 as Nn,B8 as Nr,t4 as Nt,dg as O,m8 as Oi,A6 as On,Rn as Or,hf as Ot,g5 as P,Lh as Pi,b6 as Pn,En as Pr,e4 as Pt,ft as Q,Q7 as Qi,l6 as Qn,Fh as Qr,Ap as Qt,eg as R,hh as Ri,q3 as Rn,P8 as Rr,df as Rt,hg as S,yn as Si,sp as Sn,V8 as Sr,bf as St,cg as T,c8 as Ti,w6 as Tn,G8 as Tr,mf as Tt,b5 as U,t8 as Ui,F3 as Un,vn as Ur,tf as Ut,fd as V,r8 as Vi,p6 as Vn,M8 as Vr,rf as Vt,og as W,e8 as Wi,u6 as Wn,L8 as Wr,of as Wt,ee as X,V as Xi,d6 as Xn,Lr as Xr,z6 as Xt,dd as Y,rr as Yi,o6 as Yn,Kh as Yr,Wn as Yt,Ff as Z,or as Zi,a6 as Zn,jh as Zr,V6 as Zt,mg as _,u8 as _i,R6 as _n,E3 as _r,wf as _t,vg as a,k8 as ai,K6 as an,xe as ar,L9 as at,vd as b,bn as bi,k6 as bn,w3 as br,kt as bt,_g as c,I8 as ci,F6 as cn,e6 as cr,w9 as ct,v7 as d,E8 as di,gp as dn,Q8 as dr,c9 as dt,Y7 as ea,Vh as ei,q6 as en,r6 as er,Pf as et,Ag as f,_8 as fi,M6 as fn,Fn as fr,od as ft,Hr as g,oo as gi,L6 as gn,C3 as gr,Ef as gt,fg as h,bs as hi,O6 as hn,J8 as hr,Tf as ht,Sg as i,x8 as ii,W6 as in,$8 as ir,Lf as it,Jf as j,g8 as ji,v6 as jn,kn as jr,q4 as jt,I5 as k,p8 as ki,y6 as kn,ka as kr,uf as kt,bg as l,T8 as li,B6 as ln,t6 as lr,E9 as lt,gg as m,w8 as mi,P6 as mn,X8 as mr,Cf as mt,Cg as n,Ph as ni,H6 as nn,P3 as nr,sd as nt,Tg as o,ea as oi,N6 as on,z8 as or,kf as ot,_7 as p,S8 as pi,D6 as pn,Z8 as pr,td as pt,E as q,$0 as qi,n6 as qn,Wh as qr,Q6 as qt,wg as r,Oh as ri,G6 as rn,N3 as rr,xf as rt,Ig as s,_s as si,j6 as sn,Y8 as sr,Rf as st,Eg as t,Ts as ti,$6 as tn,i6 as tr,Bf as tt,yg as u,v8 as ui,U6 as un,D3 as ur,h9 as ut,es as v,xh as vi,dp as vn,W8 as vr,Sf as vt,co as w,_h as wi,E6 as wn,q8 as wr,ff as wt,J5 as x,h8 as xi,x6 as xn,ko as xr,Jm as xt,pg as y,b8 as yi,np as yn,H8 as yr,vf as yt,tg as z,a8 as zi,m6 as zn,O8 as zr,sf as zt}; 258 259//# sourceMappingURL=GAPIContext-DkpqN2_P.js.map
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.