1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,7791,e=>{"use strict";var t=e.i(41931),r=e.i(64014),a=e.i(10761),n=e.i(77600);let i="/aigc/aiMvAgentV2";async function s(e){return(0,n.getFileDownloadUrl)(e)}async function o(e){let a=await t.apiClient.POST(`${i}/createTask`,(0,t.withCommonParams)({commonParams:"headers",body:e}));return(0,r.unwrapApiData)(a)}async function l(e){return(0,a.dedupeInFlightRequest)(`mv-agent-story:${e.taskId}`,async()=>{let a=await t.apiClient.POST(`${i}/queryStory`,(0,t.withCommonParams)({commonParams:"headers",body:e}));return(0,r.unwrapApiData)(a)})}async function u(e){let a=await t.apiClient.POST(`${i}/updateStoryline`,(0,t.withCommonParams)({commonParams:"headers",body:e}));return(0,r.unwrapApiData)(a)}async function d(e){let a=await t.apiClient.POST(`${i}/updateLyrics`,(0,t.withCommonParams)({commonParams:"headers",body:e}));return(0,r.unwrapApiData)(a)}async function c(e){let a=await t.apiClient.POST(`${i}/regenerateAsset`,(0,t.withCommonParams)({commonParams:"headers",body:e}));return(0,r.unwrapApiData)(a)}async function p(e){let a=await t.apiClient.POST(`${i}/regenerateSegment`,(0,t.withCommonParams)({commonParams:"headers",body:e}));return(0,r.unwrapApiData)(a)}async function m(e){let a=await t.apiClient.POST(`${i}/submitProduction`,(0,t.withCommonParams)({commonParams:"headers",body:e}));return(0,r.unwrapApiData)(a)}async function h(e){return(0,a.dedupeInFlightRequest)(`mv-agent-production:${e.taskId}`,async()=>{let a=await t.apiClient.POST(`${i}/queryProduction`,(0,t.withCommonParams)({commonParams:"headers",body:e}));return(0,r.unwrapApiData)(a)})}e.s(["createMvAgentTask",0,o,"getMvAgentDownloadUrl",0,s,"queryMvAgentProduction",0,h,"queryMvAgentStory",0,l,"regenerateMvAgentAsset",0,c,"regenerateMvAgentSegment",0,p,"submitMvAgentProduction",0,m,"updateMvAgentLyrics",0,d,"updateMvAgentStoryline",0,u])},14619,26093,e=>{"use strict";var t=e.i(95979),r=e.i(40795),a=e.i(85214),n=e.i(4050),i=e.i(72253),s=e.i(2829),o=e.i(73635),l=e.i(75157);let u=new Set(["audio/mpeg","audio/mp3"]),d=new Set(["mp3"]);function c(e,t,r,a){let n=Math.min(e,(a??r)*1e3);return(0,s.normalizeTrimRange)(e,0,n,1e3*t,1e3*r)}function p(e){return(0,t.jsx)("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:(0,t.jsx)("path",{d:"M7 5.5L14 10L7 14.5V5.5Z",fill:"currentColor"})})}function m(e){return(0,t.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:[(0,t.jsx)("path",{d:"M6.5 5H8.75V15H6.5V5Z",fill:"currentColor"}),(0,t.jsx)("path",{d:"M11.25 5H13.5V15H11.25V5Z",fill:"currentColor"})]})}function h(e){return(0,t.jsxs)("svg",{viewBox:"0 0 40 40",fill:"none","aria-hidden":"true",...e,children:[(0,t.jsx)("path",{d:"M23.27 8.32A12 12 0 1 0 32.36 18.15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,t.jsx)("path",{d:"M22.13 12.01c1.32.18 3.56 1.11 5.19 3.41a1 1 0 0 1-1.64 1.15A7.13 7.13 0 0 0 23 14.34v8.46c0 .01 0 .02-.01.03.2 1.79-.9 3.52-2.68 4.05l-1.92.57a3.8 3.8 0 1 1-2.16-7.27l1.92-.57c.99-.29 2-.16 2.85.28V13.2c0-.03 0-.06.01-.09a1 1 0 0 1 1.12-1.1Zm-1.18 10.73a1.8 1.8 0 0 0-2.23-1.21l-1.92.57a1.8 1.8 0 1 0 1.02 3.44l1.92-.57a1.8 1.8 0 0 0 1.21-2.23Z",fill:"currentColor"}),(0,t.jsx)("path",{d:"M30.5 7.1a.9.9 0 0 1 .9.9v1.6H33a.9.9 0 1 1 0 1.8h-1.6V13a.9.9 0 1 1-1.8 0v-1.6H28a.9.9 0 1 1 0-1.8h1.6V8a.9.9 0 0 1 .9-.9Z",fill:"currentColor"})]})}function f(e){return(0,t.jsxs)("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[(0,t.jsx)("rect",{width:"32",height:"32",rx:"16",fill:"currentColor",fillOpacity:"0.05"}),(0,t.jsx)("path",{d:"M10.394 18.636h11.212L18.242 22",stroke:"currentColor",strokeWidth:"1.86667",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M21.606 13.363H10.394L13.758 10",stroke:"currentColor",strokeWidth:"1.86667",strokeLinecap:"round",strokeLinejoin:"round"})]})}e.s(["MvAgentAudioField",0,function({remoteUrl:e,minDuration:x,maxDuration:v,defaultDuration:g,onDraftChange:w,onRemoteUrlClear:b}){var y;let _=(0,a.useTranslations)(),M=(0,r.useRef)(null),j=(0,r.useRef)(null),C=(0,r.useRef)(null),k=(0,r.useRef)(0),[A,N]=(0,r.useState)(null),[L,S]=(0,r.useState)(),[R,E]=(0,r.useState)(0),[T,P]=(0,r.useState)(!1),[U,D]=(0,r.useState)(!1),[I,O]=(0,r.useState)(.5),[z,F]=(0,r.useState)(null),V=A?.previewUrl,$=A?.fileName??function(e){if(!e)return"";try{let t=new URL(e,"https://placeholder.local").pathname;return decodeURIComponent(t.split("/").pop()??"")||"audio.mp3"}catch{return"audio.mp3"}}(e),q=A?.durationSeconds??L,B=V??e,H=!!B,W=!!A,Z=q?Math.round(1e3*q):0,G=(0,r.useMemo)(()=>A?.trimRange?A.trimRange:Z?c(Z,x,v,g):null,[g,A?.trimRange,Z,v,x]);(0,r.useEffect)(()=>{w(A)},[A,w]),(0,r.useEffect)(()=>
1{if(!e||A)return;let t=!1;return(0,n.readAudioDurationFromUrl)(e).then(e=>{t||S(e)}).catch(()=>void 0),()=>{t=!0}},[A,e]),(0,r.useEffect)(()=>{if(!B)return;let e=!1;return(0,i.decodeWaveformPeaks)(B,i.AUDIO_WAVEFORM_SOURCE_BAR_COUNT).then(t=>{!e&&t.length>0&&F({url:B,peaks:t})}).catch(()=>void 0),()=>{e=!0}},[B]),(0,r.useEffect)(()=>{let e=C.current;if(!H||!e||(E(e.getBoundingClientRect().width),"u"<typeof ResizeObserver))return;let t=new ResizeObserver(e=>{E(e[0]?.contentRect.width??0)});return t.observe(e),()=>t.disconnect()},[H]);let X=!Number.isFinite(y=R)||y<=0?140:Math.max(1,Math.floor((y+3)/(i.AUDIO_WAVEFORM_BAR_WIDTH+3))),K=(0,r.useMemo)(()=>{let e=B&&z?.url===B?z.peaks:(0,i.buildFallbackPeaks)(i.AUDIO_WAVEFORM_SOURCE_BAR_COUNT);return(0,i.resampleWaveformPeaks)(e,X)},[z,B,X]);(0,r.useEffect)(()=>{let e=j.current;if(e&&G)return e.addEventListener("timeupdate",t),e.addEventListener("pause",r),e.addEventListener("ended",r),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("pause",r),e.removeEventListener("ended",r)};function t(){if(!Number.isFinite(e.duration)||e.duration<=0)return;let t=1e3*e.currentTime;t>=G.endMs&&(e.pause(),e.currentTime=G.startMs/1e3,D(!1));let r=Math.max(G.endMs-G.startMs,1);O((t-G.startMs)/r)}function r(){D(!1)}},[G]),(0,r.useEffect)(()=>()=>{V?.startsWith("blob:")&&URL.revokeObjectURL(V)},[V]);let J=(0,r.useMemo)(()=>G?Math.round((G.endMs-G.startMs)/1e3):q?Math.round(q):void 0,[q,G]),Q=(0,r.useMemo)(()=>G&&Z?{start:(0,s.trimMsToRatio)(G.startMs,Z),end:(0,s.trimMsToRatio)(G.endMs,Z)}:{start:0,end:0},[Z,G]),Y={left:`${100*Q.start}%`,width:`${100*Math.max(Q.end-Q.start,0)}%`},ee=Q.start+Math.min(Math.max(I,0),1)*(Q.end-Q.start),et=(0,r.useCallback)(e=>{A&&Z&&N(t=>{if(!t)return t;let r=(0,s.normalizeTrimRange)(Z,e.startMs,e.endMs,1e3*x,1e3*v);return{...t,trimRange:{startMs:r.startMs,endMs:r.endMs}}})},[A,Z,v,x]),er=(0,r.useCallback)(e=>{let t=C.current?.getBoundingClientRect();return t&&Z?(0,s.clientXToTrimMs)(e,t,Z):null},[Z]),ea=(0,r.useCallback)(e=>{let t=j.current;t&&(t.currentTime=e/1e3),O(G?(e-G.startMs)/Math.max(G.endMs-G.startMs,1):.5)},[G]),en=(0,r.useCallback)(e=>{if(!G)return;let t=er(e.clientX);if(null===t)return;if(t>=G.startMs&&t<=G.endMs)return void ea(t);if(!A)return;let r=G.endMs-G.startMs;r>=1e3*v?t<G.startMs?et({startMs:t,endMs:t+r}):et({startMs:t-r,endMs:t}):Math.abs(t-G.startMs)<=Math.abs(t-G.endMs)?et({startMs:t,endMs:G.endMs}):et({startMs:G.startMs,endMs:t})},[et,A,v,er,ea,G]),ei=(0,r.useCallback)((e,t)=>{if(!G||!A)return;t.preventDefault(),t.stopPropagation();let r=t=>{let r=er(t);if(null!==r){if("start"===e)return void et({startMs:r,endMs:G.endMs});et({startMs:G.startMs,endMs:r})}},a=e=>{e.pointerId===t.pointerId&&r(e.clientX)},n=e=>{e.pointerId===t.pointerId&&(window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n))};r(t.clientX),window.addEventListener("pointermove",a),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n)},[et,A,er,G]),es=(0,r.useCallback)(e=>{if(!G)return;e.preventDefault(),e.stopPropagation(),j.current?.pause(),D(!1);let t=e=>{let t=er(e);null===t||ea(Math.min(Math.max(t,G.startMs),G.endMs))},r=r=>{r.pointerId===e.pointerId&&t(r.clientX)},a=t=>{t.pointerId===e.pointerId&&(window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a))};t(e.clientX),window.addEventListener("pointermove",r),window.addEventListener("pointerup",a),window.addEventListener("pointercancel",a)},[er,ea,G]),eo=(0,r.useCallback)(async e=>{if(!function(e){if(u.has(e.type))return!0;let t=e.name.split(".").pop()?.toLowerCase();return!!t&&d.has(t)}(e))return void o.default.error(_("str_04_audio_format"));let t=++k.current,r=URL.createObjectURL(e);try{let a=await (0,n.readAudioDurationFromUrl)(r);if(k.current!==t)return void URL.revokeObjectURL(r);let i=(0,n.validateAudioDuration)(a,{minDuration:x});if(i){o.default.error(_(i.key,i.values)),URL.revokeObjectURL(r);return}V?.startsWith("blob:")&&URL.revokeObjectURL(V),b(),S(void 0),N({f
1ile:e,fileName:e.name,previewUrl:r,durationSeconds:a,trimRange:c(Math.round(1e3*a),x,v,g)}),O(.5)}catch{URL.revokeObjectURL(r),o.default.error(_("str_04_audio_format"))}},[g,V,v,x,b,_]),el=(0,r.useCallback)(e=>{let t=e.target.files?.[0];e.target.value="",t&&eo(t)},[eo]),eu=(0,r.useCallback)(()=>{let e=j.current;if(e&&B){if(U){e.pause(),D(!1);return}if(G){let t=G.startMs/1e3,r=G.endMs/1e3;(e.currentTime<t||e.currentTime>=r-.05)&&(e.currentTime=t)}else e.currentTime=0;e.play().then(()=>D(!0)).catch(()=>D(!1))}},[U,B,G]),ed=(0,r.useCallback)(()=>{M.current?.click()},[]),ec=(0,r.useCallback)((e,t)=>{if(!G||!A||"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.preventDefault();let r="ArrowLeft"===t.key?-1:1,a=t.shiftKey?5e3:1e3;"start"===e?et({startMs:G.startMs+r*a,endMs:G.endMs}):et({startMs:G.startMs,endMs:G.endMs+r*a})},[et,A,G]),ep=(0,r.useCallback)(e=>{e.preventDefault(),P(!1);let t=e.dataTransfer.files?.[0];t&&eo(t)},[eo]);return(0,t.jsxs)("div",{className:(0,l.cn)("relative h-[114px] overflow-hidden rounded-[12px] border transition-colors",T?"border-[#aa99f0]/80 bg-[#4e23fb]/10":"border-white/10 bg-white/[0.02] hover:border-white/20"),onDragEnter:e=>{e.preventDefault(),P(!0)},onDragOver:e=>e.preventDefault(),onDragLeave:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||P(!1)},onDrop:ep,children:[H?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"px-3 pt-3",children:(0,t.jsxs)("div",{ref:C,className:"relative h-[39px] cursor-crosshair touch-none select-none overflow-hidden rounded-[8px]","aria-label":_("str_1031_audio_waveform_selected_range"),onPointerDown:en,children:[(0,t.jsx)("div",{className:"absolute inset-x-0 top-0 flex h-[39px] items-end",style:{gap:"3px"},children:K.map((e,r)=>{let a=(r+.5)/K.length,n=a>=Q.start&&a<=Q.end;return(0,t.jsx)("span",{className:(0,l.cn)("shrink-0 rounded-[25px]",n?"bg-white":"bg-white/40"),style:{width:`${i.AUDIO_WAVEFORM_BAR_WIDTH}px`,height:Math.max(Math.round(39*e),3)}},r)})}),G?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"pointer-events-none absolute top-0 h-[39px] rounded-[8px] border-2 border-[#aa99f0] bg-[#4e23fb]/[0.08]",style:Y}),(0,t.jsx)("span",{className:"pointer-events-none absolute top-0 z-10 h-[39px] w-[3px] -translate-x-1/2 rounded-[28px] bg-white shadow-[-1px_0_4px_rgba(0,0,0,0.25)]",style:{left:`${100*ee}%`}}),(0,t.jsx)("button",{type:"button",tabIndex:-1,"aria-hidden":"true",onPointerDown:es,style:{left:`${100*ee}%`},className:"absolute top-0 z-20 h-[39px] w-4 -translate-x-1/2 cursor-ew-resize touch-none bg-transparent"}),W?(0,t.jsxs)("div",{className:"pointer-events-none absolute top-0 z-20 h-[39px] overflow-hidden rounded-[8px]",style:Y,children:[(0,t.jsx)("button",{type:"button",role:"slider","aria-label":_("str_1031_adjust_audio_trim_start"),"aria-valuemin":0,"aria-valuemax":Math.round(G.endMs/1e3),"aria-valuenow":Math.round(G.startMs/1e3),onKeyDown:e=>ec("start",e),onPointerDown:e=>ei("start",e),className:"pointer-events-auto absolute left-0 top-0 flex h-[39px] w-[11px] cursor-ew-resize items-center justify-center bg-[#aa99f0] focus-visible:outline focus-visible:outline-2 focus-visible:outline-white",children:(0,t.jsx)("span",{className:"h-[26px] w-[3px] rounded-[28px] bg-white/80"})}),(0,t.jsx)("button",{type:"button",role:"slider","aria-label":_("str_1031_adjust_audio_trim_end"),"aria-valuemin":Math.round(G.startMs/1e3),"aria-valuemax":Math.round(Z/1e3),"aria-valuenow":Math.round(G.endMs/1e3),onKeyDown:e=>ec("end",e),onPointerDown:e=>ei("end",e),className:"pointer-events-auto absolute right-0 top-0 flex h-[39px] w-[11px] cursor-ew-resize items-center justify-center bg-[#aa99f0] focus-visible:outline focus-visible:outline-2 focus-visible:outline-white",children:(0,t.jsx)("span",{className:"h-[26px] w-[3px] rounded-[28px] bg-white/80"})})]}):null]}):null]})}),(0,t.jsxs)("div",{className:"mt-[11px] flex h-10 items-center justify-between px-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,t.jsx)("button",{type:"button",onClick:eu,className:"flex size-[28px] shrink-0 items-center justify-center rounded-full bg-white/5 text-white transition-colors hover:bg-white/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#aa99f0]","aria-label":U?_("str_i18n_pause"):_("str_i18n_play"),children:U?(0,t.jsx)(m,{className:"size-[16
1px]"}):(0,t.jsx)(p,{className:"size-[16px]"})}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"truncate text-[11px] font-semibold uppercase leading-[15px] text-white",children:$.replace(/\.mp3$/i,"")||"Audio"}),(0,t.jsx)("p",{className:"mt-px text-[10px] leading-[14px] text-white/40",children:J?`Selected: ${J}s`:"Reading audioâ¦"})]})]}),(0,t.jsx)("button",{type:"button",onClick:ed,className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-white/5 text-white transition-colors hover:bg-white/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#aa99f0]","aria-label":_("str_1031_replace_audio"),children:(0,t.jsx)(f,{className:"size-8"})})]})]}):(0,t.jsxs)("button",{type:"button",onClick:ed,className:"flex size-full flex-col items-center justify-center gap-2 text-white/60 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[#aa99f0]","aria-label":_("str_1031_upload_music"),children:[(0,t.jsx)(h,{className:"size-10"}),(0,t.jsxs)("span",{className:"flex items-start justify-center gap-1.5 font-outfit leading-4",children:[(0,t.jsx)("span",{className:"text-[12px] text-white/60",children:_("str_1031_upload_music")}),(0,t.jsx)("span",{className:"text-[10px] text-white/60",children:"MP3"})]})]}),(0,t.jsx)("input",{ref:M,type:"file",accept:"audio/mpeg,.mp3",className:"hidden",onChange:el}),B?(0,t.jsx)("audio",{ref:j,src:B,preload:"metadata",className:"hidden"}):null]})}],14619);let x="selfyzai:mv-agent-created-task",v=new Map;e.s(["markMvAgentTaskCreated",0,function(e){try{window.sessionStorage.setItem(x,e)}catch{}},"readMvAgentCreationFlow",0,function(e){let t=v.get(e);if(void 0!==t)return t;let r=function(e){try{if(window.sessionStorage.getItem(x)!==e)return!1;return window.sessionStorage.removeItem(x),!0}catch{return!1}}(e);return v.set(e,r),r}],26093)},26697,e=>{"use strict";let t={home_top_banner:"home_banner",home_top_banner_fixed:"home_banner",home_trending_banner:"home_banner",home_whats_new:"home_banner",home_activity_popup:"popup"},r=["cover","outline","role","scenes","script","shot"];function a(e){var t;let r=function(e){if(!e?.trim())return null;try{var t;let r=JSON.parse(e);return(t=r,"object"!=typeof t||null===t||Array.isArray(t))?null:r}catch{return null}}(e),a="ugc"===(t=r?.templateSource??r?.template_source)||"idea_selected"===t?t:void 0;return{from:i(r?.creationFrom??r?.from),templateId:a?n(r?.templateId??r?.template_id):void 0,templateSource:a}}function n(e){return"string"==typeof e?e.trim()||void 0:"number"==typeof e&&Number.isFinite(e)?String(e):void 0}function i(e){let r=n(e);return r?t[r]??r:void 0}function s(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}e.s(["buildMvAgentAnalyticsParams",0,function({storyId:e,step:t,frontParams:o,attribution:l,component:u,index:d,modified:c,errorCode:p}){let m=a(o),h={from:l?.from??m.from,templateId:l?.templateId??m.templateId,templateSource:l?.templateSource??m.templateSource},f=function(e){if(!e)return[];let t=new Set(e);return r.filter(e=>t.has(e))}(c);return s({agent:"mv",template_id:h.templateSource?n(h.templateId):void 0,from:i(h.from),story_id:n(e),step:t,component:u,idx:Number.isFinite(d)?d:void 0,modified:f.length?f.join(","):void 0,error_code:n(p)})},"buildMvAgentDownloadAnalyticsParams",0,function({taskId:e,frontParams:t}){let r=a(t);return s({function:"mv",task_id:n(e),template_id:r.templateId,rm_watermark:1})},"resolveMvAgentAnalyticsStep",0,function(e){return Math.max(1,e-1)}])},98065,e=>{"use strict";var t=e.i(95979),r=e.i(40795),a=e.i(72894),n=e.i(85214),i=e.i(7791),s=e.i(5605),o=e.i(57079),l=e.i(14619),u=e.i(73635),d=e.i(49669),c=e.i(77599),p=e.i(20133),m=e.i(96836),h=e.i(26093),f=e.i(68558),x=e.i(26697),v=e.i(81815),g=e.i(76862),w=e.i(75157);function b({className:e}){return(0,t.jsx)("span",{"aria-hidden":!0,className:(0,w.cn)("relative inline-block h-[30px] w-16 shrink-0 overflow-hidden rounded-full align-middle shadow-[0_0_13px_rgba(0,0,0,1)] drop-shadow-[0_0_5.2px_rgba(0,0,0,0.38)]",e),children:(0,t.jsx)("img",{className:"size-full object-cover",src:"https://res.selfyz.ai/common/custom/file/0/c7e89161d4d74480b6ed7321fbe6e391.webp",alt:""})})}var y=e.i(45363);function _({ariaLabel:e,panelTitle:a,icon:n,value:i,options:s,disabled:o,showChevron:l,variant:u="list",showRatioIcon:d,buttonClassName:c,onChange:p}){let[m,h]=(0,r.useState)(!1),f=(0,r.useRef)(null),x=(0,r.useRef)(null),v=(0,r.useRef)(null),[g,b]=(0,r.useState)(null),C=s.find(e=>e.value===i||e.displayValue===i),k=(0,r.useCallback)(()=>{let e=x.current;if(!e)return;let t=e.getBoundingClientRect();b({left:t.left,top:t.bottom+8})},[]);(0,r.useEffect)(()=>
1{if(m)return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)};function e(e){let t=e.target;f.current?.contains(t)||v.current?.contains(t)||h(!1)}function t(e){"Escape"===e.key&&h(!1)}},[m]),(0,r.useEffect)(()=>{if(m)return k(),window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[m,k]);let A=o||0===s.length,N=m&&g?(0,y.createPortal)((0,t.jsxs)("div",{ref:v,style:{left:g.left,top:g.top},className:"fixed z-50 w-max max-w-[90vw] min-w-[160px] rounded-[18px] bg-white/5 p-3 backdrop-blur-[20px] shadow-[0_24px_80px_rgba(0,0,0,0.55)]",children:[(0,t.jsx)("p",{className:"mb-2 px-1 type-body-2-strong text-white",children:a}),(0,t.jsx)("div",{role:"listbox",className:(0,w.cn)("ui-scrollbar max-h-[280px] overflow-y-auto","row"===u?"flex flex-wrap gap-2":"flex flex-col gap-2"),children:s.map(e=>{let r=e.value===i;return(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":r,disabled:!e.value,onClick:()=>{p(e.value),h(!1)},className:(0,w.cn)("shrink-0 whitespace-nowrap transition-colors","row"===u?"rounded-[8px] border px-2 py-1 text_r_boby2":(0,w.cn)("w-full rounded-[8px] px-2 py-1 text_r_boby2",d?"flex items-center gap-2 text-left":"text-left"),e.value?r?"border-transparent bg-white text-black":"row"===u?"border-white/15 bg-transparent text-white/40 hover:bg-white/5":"border-white/15 border bg-transparent text-white/40 hover:bg-white/5":"cursor-not-allowed opacity-30"),children:[d?(0,t.jsx)(j,{ratio:e.value,active:r}):null,(0,t.jsx)("span",{children:e.displayValue})]},e.value)})})]}),document.body):null;return(0,t.jsxs)("div",{ref:f,className:"relative shrink-0",children:[(0,t.jsxs)("button",{ref:x,type:"button","aria-label":e,"aria-haspopup":"listbox","aria-expanded":m,disabled:A,onClick:()=>h(e=>!e),className:(0,w.cn)("flex h-[38px] items-center gap-[6px] rounded-[10px] border border-white/[0.08] bg-white/5 px-3 text-[14px] text-white/80 transition-colors",A?"cursor-not-allowed opacity-40":"hover:bg-white/10",c),children:[(0,t.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center",children:n}),(0,t.jsx)("span",{className:"whitespace-nowrap text-white/80",children:C?.displayValue??i??"--"}),l?(0,t.jsx)(M,{className:"size-3.5 text-white/50"}):null]}),N]})}function M({className:e}){return(0,t.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[(0,t.jsx)("path",{d:"M8.24492 6.34774C8.4731 6.06615 8.42979 5.6529 8.1482 5.42472C7.8666 5.19654 7.45335 5.23985 7.22517 5.52144L5.14736 8.08569C4.98808 8.28227 4.95598 8.5529 5.06487 8.78127C5.17375 9.00965 5.40423 9.15509 5.65723 9.15509H14.5937C14.9561 9.15509 15.2499 8.86128 15.2499 8.49884C15.2499 8.13641 14.9561 7.84259 14.5937 7.84259H7.03364L8.24492 6.34774Z",fill:"white",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M12.006 14.1097C11.7778 14.3913 11.8211 14.8045 12.1027 15.0327C12.3843 15.2609 12.7976 15.2176 13.0258 14.936L15.1036 12.3717C15.2629 12.1751 15.295 11.9045 15.1861 11.6761C15.0772 11.4478 14.8467 11.3023 14.5937 11.3023H5.65723C5.29479 11.3023 5.00098 11.5961 5.00098 11.9586C5.00098 12.321 5.29479 12.6148 5.65723 12.6148H13.2173L12.006 14.1097Z",fill:"white",fillOpacity:"0.8"})]})}function j({ratio:e,active:r}){let[a,n]=function(e){let[t,r]=e.split(":"),a=Number(t),n=Number(r);return a>0&&n>0?[a,n]:[1,1]}(e),i=a/n,s=i>=1?20:Math.round(20*i),o=i>=1?Math.round(20/i):20;return(0,t.jsx)("span",{className:"flex shrink-0 items-center justify-center",style:{width:20,height:20},"aria-hidden":"true",children:(0,t.jsx)("span",{className:(0,w.cn)("rounded-[3px] border-[1.5px]",r?"border-black":"border-white/40"),style:{width:s,height:o}})})}var C=e.i(21136),k=e.i(18753),A=e.i(97957),N=e.i(72839);let L={kind:"upload",id:"imageUrls",label:"str_1031_role",actionLabel:"str_1031_upload_character",supportingText:"PNG / JPG",required:!0,maxCount:1},S={outputType:"image/jpeg",outputQuality:.9,maxLongSide:1920},R=15,E=180,T=R??15,P=E??180;function U({embedded:e,readOnly:v=!1,audioDraft:b,onAudioDraftChange:y,prompt:M,onPromptChange:j,quality:C,onQualityChange:R,ratio:E,onRatioChange:O,values:z,onValueChange:F,analyticsAttribution:V}){let $=(0,n.useTranslations)(),q=(0,p.useRouter)(),{ensureGenerationAccess:B}=(0,d.useGenerationAccess)(),{glassFilterId:H,backdropFilter:W}=(0,A.useGlassBackdropFilter)("blur(6px) saturate(1.28) brightness(1.04)"),{modelDetail:Z,phasePreCredit:G,qualityOptions:X,ratioOptions:K,cropOptions:J,audioConstraints:Q,isPending:Y}
1=(0,c.useMvAgentConfig)(),[ee,et]=(0,r.useState)(!1),[er,ea]=(0,r.useState)(!1),en=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=en.current;e&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)},[M]);let ei=(0,r.useMemo)(()=>({...L,cropOptions:J?{...J,...S}:void 0}),[J]),es=C??X.find(e=>e.isDefaultValue)?.value??X[0]?.value,eo=E??K.find(e=>e.isDefaultValue)?.value??K[0]?.value,el=(0,r.useMemo)(()=>Array.isArray(z.imageUrls)?z.imageUrls:[],[z.imageUrls]),eu="string"==typeof z.audioUrl?z.audioUrl:"",ed=(0,c.resolveMvAgentQualityTemplate)(Z?.templateList,es),ec=!!(!v&&el.length>0&&(eu||b)&&es&&eo&&ed?.example&&!Y),ep=(0,r.useMemo)(()=>({tool:"mv-agent",modelAbility:c.MV_AGENT_ABILITY_CODE,stage:1,creationFrom:V.from,templateId:V.templateId,templateSource:V.templateSource,formValues:{imageUrls:el,audioUrl:eu,prompt:M,quality:es,ratio:eo}}),[V,eu,el,M,es,eo]);function em(e){u.default.error(e),ea(!1),requestAnimationFrame(()=>ea(!0))}async function eh(){if(!v&&!ee){if(0===el.length)return void em($("str_1031_person_image_required"));if(!eu&&!b)return void em($("str_1031_audio_required"));if(ec&&ed?.example&&eo&&((0,m.trackAnalyticsEvent)("agent_create_click",(0,x.buildMvAgentAnalyticsParams)({step:1,attribution:V})),await B({creditsCost:G}))){et(!0);try{let e=eu;if(b){let t=await (0,s.uploadFile)(b.file,{endpoint:"clip",startTime:b.trimRange?.startMs,endTime:b.trimRange?.endMs});if(200!==t.c||!t.d)throw Error("audio-upload-failed");e=t.d}let t=await (0,i.createMvAgentTask)({audioUrls:[e],imageUrls:el,prompt:M.trim(),ratio:eo,quality:es,example:ed.example,frontParams:JSON.stringify({...ep,formValues:{...ep.formValues,audioUrl:e}}),projectName:`MV Agent ${new Date().toLocaleDateString()}`});(0,g.requestUserSummaryRefresh)(),(0,h.markMvAgentTaskCreated)(t.taskId),(0,f.notifyMvAgentTaskCreated)(t.taskId);let r="doing"===t.taskStatus?"agent_task_in_process_show":"success"===t.taskStatus?"agent_task_success_show":"agent_task_fail_show";(0,m.trackAnalyticsEventOnce)(`mv-agent-task:${t.taskId}:1:${t.taskStatus}`,r,(0,x.buildMvAgentAnalyticsParams)({storyId:t.taskId,step:1,attribution:V,errorCode:t.errorCode})),u.default.success($("task_create_success")),q.push(`/mv-agent-workspace?taskId=${encodeURIComponent(t.taskId)}`)}catch(e){e instanceof Error&&"audio-upload-failed"===e.message?u.default.error($("str_1031_audio_upload_failed")):u.default.apiError(e,$),et(!1)}}}}return(0,t.jsxs)("section",{className:(0,w.cn)("glass-input relative z-30 mx-auto w-full max-w-[1001px] rounded-[20px] px-4 py-4","min-h-[287px]"),style:{backdropFilter:W,WebkitBackdropFilter:W}
1,children:[(0,t.jsx)(N.GlassRefractionFilterDefs,{id:H}),(0,t.jsxs)("div",{className:(0,w.cn)("relative z-10 grid gap-5 md:grid-cols-[208px_1fr]",v&&"pointer-events-none opacity-60"),"aria-disabled":v||void 0,children:[(0,t.jsx)(o.DualUploadField,{field:ei,values:z,variant:"mv-agent",onValueChange:F}),(0,t.jsx)(l.MvAgentAudioField,{remoteUrl:eu,minDuration:Q?.minDuration??T,maxDuration:Q?.maxDuration??P,defaultDuration:Q?.defaultDuration,onDraftChange:y,onRemoteUrlClear:()=>F("audioUrl","")})]}),(0,t.jsxs)("div",{className:"relative z-10 mt-4 min-h-[71px]",children:[(0,t.jsx)("textarea",{ref:en,value:M,onChange:function(e){let t=e.target.value.slice(0,2e3);e.target.value.length>2e3&&u.default.error($("str_1031_text_description_exceeds_s_words",{s:2e3})),j(t)},readOnly:v,placeholder:$("str_1031_optional_describe_story_visuals_camera_key_moments"),className:(0,w.cn)("ui-scrollbar max-h-[130px] min-h-[48px] mb-[14px] w-full resize-none overflow-y-auto bg-transparent text-[14px] leading-6 text-white/88 outline-none placeholder:text-white/36",v&&"cursor-not-allowed text-white/60")}),(0,t.jsxs)("div",{className:"absolute -bottom-0 right-0 flex items-center gap-2 text-[12px] text-white/35",children:[(0,t.jsxs)("span",{children:[M.length,"/",2e3]}),!v&&M?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("svg",{"aria-hidden":!0,width:"1",height:"12",viewBox:"0 0 1 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M0.5 0V12",stroke:"white",strokeOpacity:"0.2"})}),(0,t.jsx)("button",{type:"button",onClick:()=>j(""),"aria-label":$("clear"),className:"transition-colors hover:text-white/70",children:(0,t.jsx)(a.Trash2,{className:"size-3.5",strokeWidth:1.7})})]}):null]})]}),(0,t.jsxs)("div",{className:"relative z-10 mt-4 flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2.5",children:[(0,t.jsx)(_,{ariaLabel:$("str_842_resolution"),panelTitle:$("str_842_resolution"),variant:"list",icon:(0,t.jsx)(D,{}),value:es,options:X,disabled:v||0===X.length||ee,onChange:R,buttonClassName:"rounded-[10px] border-white/10 bg-white/[0.03] px-[13px]"}),(0,t.jsx)(_,{ariaLabel:$("str_ratio"),panelTitle:$("str_ratio"),variant:"list",showRatioIcon:!0,icon:(0,t.jsx)(I,{}),value:eo,options:K,disabled:v||0===K.length||ee,onChange:O,buttonClassName:"rounded-[10px] border-white/10 bg-white/[0.03] px-[13px]"})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-4",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] text-white",children:[(0,t.jsx)(k.CreditIcon,{className:"size-5"}),G??"--"]}),(0,t.jsx)("button",{type:"button",onClick:()=>void eh(),disabled:ee,onAnimationEnd:()=>ea(!1),className:(0,w.cn)("h-[38px] min-w-[118px] rounded-[10px] bg-white px-4 text-[14px] font-semibold text-black transition hover:bg-white/85 disabled:cursor-not-allowed",er&&"animate-shake"),children:ee?$("str_1031_status_generating"):$("str_0102_start_creating")})]})]})]})}function D(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8.26117 5.4672C8.32846 5.21731 8.683 5.21731 8.75028 5.4672L9.01997 6.46884C9.15407 6.96689 9.5431 7.35592 10.0412 7.49002L11.0428 7.75971C11.2927 7.82699 11.2927 8.18153 11.0428 8.24881L10.0412 8.5185C9.5431 8.6526 9.15407 9.04164 9.01997 9.53969L8.75028 10.5413C8.683 10.7912 8.32846 10.7912 8.26117 10.5413L7.99149 9.53969C7.85739 9.04164 7.46835 8.6526 6.9703 8.5185L5.96867 8.24881C5.71878 8.18153 5.71878 7.82699 5.96867 7.75971L6.9703 7.49002C7.46835 7.35592 7.85739 6.96689 7.99149 6.46884L8.26117 5.4672Z",fill:"white","fill-opacity":"0.8"}),(0,t.jsx)("path",{d:"M13.01 1.86823C13.0492 1.72296 13.2553 1.72296 13.2944 1.86823L13.4512 2.45052C13.5291 2.74005 13.7553 2.96622 14.0448 3.04417L14.6271 3.20096C14.7724 3.24007 14.7724 3.44618 14.6271 3.48529L14.0448 3.64207C13.7553 3.72003 13.5291 3.94619 13.4512 4.23573L13.2944 4.81802C13.2553 4.96329 13.0492 4.96329 13.01 4.81802L12.8533 4.23573C12.7753 3.94619 12.5491 3.72003 12.2596 3.64207L11.6773 3.48529C11.532 3.44618 11.532 3.24007 11.6773 3.20096L12.2596 3.04417C12.5491 2.96622 12.7753 2.74006 12.8533 2.45052L13.01 1.86823Z",fill:"white","fill-opacity":"0.8"}),(0,t.jsx)("path",{d:"M9.26125 2.6665H8.49935C6.31141 2.6665 5.21744 2.6665 4.44239 3.21019C4.15749 3.41005 3.90956 3.65798 3.7097 3.94288C3.16602 4.71793 3.16602 5.8119 3.16602 7.99984C3.16602 10.1878 3.16602 11.2817 3.7097 12.0568C3.90956 12.3417 4.15749 12.5896 4.44239 12.7895C5.21744 13.3332 6.31141 13.3332 8.49935 13.3332C10.
16873 13.3332 11.7813 13.3332 12.5563 12.7895C12.8412 12.5896 13.0891 12.3417 13.289 12.0568C13.8327 11.2817 13.8327 10.1878 13.8327 7.99984V7.23793",stroke:"white","stroke-opacity":"0.8","stroke-width":"1.2","stroke-linecap":"round"})]})}function I(){return(0,t.jsxs)("svg",{className:" size-5",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{x:"3.83398",y:"3.3335",width:"13.3333",height:"13.3333",rx:"1.8",stroke:"white","stroke-opacity":"0.8","stroke-width":"1.2"}),(0,t.jsx)("path",{d:"M3.83398 10H8.58065C9.25271 10 9.58875 10 9.84544 10.1308C10.0712 10.2458 10.2548 10.4294 10.3699 10.6552C10.5007 10.9119 10.5007 11.2479 10.5007 11.92V16.6667",stroke:"white","stroke-opacity":"0.8","stroke-width":"1.2"}),(0,t.jsx)("path",{d:"M14.7715 5.1582C15.1029 5.1582 15.3711 5.42644 15.3711 5.75781V8.75781C15.3711 9.08918 15.1029 9.35742 14.7715 9.35742C14.4401 9.35742 14.1719 9.08918 14.1719 8.75781V7.20508L12.1953 9.18164C11.961 9.41596 11.582 9.41596 11.3477 9.18164C11.1133 8.94733 11.1133 8.5683 11.3477 8.33398L13.3242 6.35742H11.7715C11.4401 6.35742 11.1719 6.08918 11.1719 5.75781C11.1719 5.42644 11.4401 5.1582 11.7715 5.1582H14.7715Z",fill:"white","fill-opacity":"0.8"})]})}e.s(["MvAgentPageView",0,function({embedded:e=!1,showHero:a=!e,frontParams:i,readOnly:s=!1,trackEditShow:o=!0}){let l=(0,n.useTranslations)(),u=(0,r.useMemo)(()=>(function(e){if(e?.trim())try{var t;let r=JSON.parse(e),a=r.formValues;if(!a)return;return{imageUrls:Array.isArray(a.imageUrls)?a.imageUrls.filter(e=>"string"==typeof e):[],audioUrl:"string"==typeof a.audioUrl?a.audioUrl:"",prompt:"string"==typeof a.prompt?a.prompt.slice(0,2e3):"",quality:"string"==typeof a.quality?a.quality:void 0,ratio:"string"==typeof a.ratio?a.ratio:void 0,creationFrom:"string"==typeof r.creationFrom&&r.creationFrom.trim()||void 0,templateId:(t=r.templateId??r.template_id,"string"==typeof t?t.trim()||void 0:"number"==typeof t&&Number.isFinite(t)?String(t):void 0),templateSource:"ugc"===r.templateSource||"idea_selected"===r.templateSource?r.templateSource:"ugc"===r.template_source||"idea_selected"===r.template_source?r.template_source:void 0}}catch{return}})(i),[i]),[d,p]=(0,r.useState)(u?.prompt??""),[h,f]=(0,r.useState)(u?.quality),[g,y]=(0,r.useState)(u?.ratio),[_,M]=(0,r.useState)(null),[j,k]=(0,r.useState)({imageUrls:u?.imageUrls??[],audioUrl:u?.audioUrl??""}),{qualityOptions:A}=(0,c.useMvAgentConfig)(),[N]=(0,r.useState)(()=>e||s?null:(0,v.consumeMvAgentTemplateDraft)()),[L]=(0,r.useState)(()=>u?.creationFrom??(e?"home":(0,m.consumeAnalyticsFrom)())),[S,R]=(0,r.useState)(()=>u?.templateId??N?.templateId),[E,T]=(0,r.useState)(()=>u?.templateSource??N?.templateSource),P=(0,r.useRef)(!1),D=(0,r.useRef)(!1),I=(0,r.useMemo)(()=>({from:L,templateId:S,templateSource:E}),[L,S,E]),O=(0,r.useCallback)(e=>{if(e){if(e.prompt?.trim()&&p(e.prompt.trim().slice(0,2e3)),e.quality?.trim()){let t=A.find(t=>t.displayValue===e.quality.trim());t?.value&&f(t.value)}e.outputRatio?.trim()&&y(e.outputRatio.trim())}},[A]),z=(0,r.useCallback)(e=>{R(String(e.resId)),T("idea_selected"),(0,m.trackAnalyticsEvent)("agent_edit_hint_click",(0,x.buildMvAgentAnalyticsParams)({step:1,attribution:{from:L,templateId:String(e.resId),templateSource:"idea_selected"}})),O(e.effectConfig)},[L,O]);return(0,r.useEffect)(()=>{o&&!D.current&&(D.current=!0,(0,m.trackAnalyticsEvent)("agent_edit_show",(0,x.buildMvAgentAnalyticsParams)({step:1,attribution:I})))},[I,o]),(0,r.useEffect)(()=>{if(!e&&!s&&!P.current){if(!N){P.current=!0;return}N.effectConfig.quality?.trim()&&0===A.length||(P.current=!0,O(N.effectConfig))}},[O,e,A.length,s,N]),(0,t.jsxs)("div",{className:(0,w.cn)("relative w-full text-white",e?"":"overflow-hidden",e?"":"min-h-[100vh] bg-[#0a0a09]"),children:[e?null:(0,t.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",children:(0,t.jsx)("video",{src:"https://res.selfyz.ai/common/custom/file/5/3c10734637af4e1f94993b8b7e64a21e.mp4",poster:"https://res.selfyz.ai/common/custom/file/4/3961ca16e15844ab9ae54ebb69a38eab.jpg",autoPlay:!0,loop:!0,muted:!0,playsInl
1ine:!0,preload:"metadata",className:"size-full object-cover opacity-75"})}),(0,t.jsxs)("div",{className:(0,w.cn)("relative z-10 mx-auto flex w-full max-w-[1536px] flex-col px-4",e?"px-0 pb-0 pt-0 md:px-0":"pb-10 pt-16 md:px-8 md:pt-[123px]"),children:[a?(0,t.jsxs)("div",{className:(0,w.cn)("text-center",e?"mb-8 pt-2":"mb-8"),children:[(0,t.jsx)("h1",{className:"font-serif text-[44px] font-bold italic leading-none md:text-[52px]",children:l("str_0102_mv_agent")}),(0,t.jsxs)("p",{className:"mx-auto mt-6 max-w-[702px] font-serif text-[20px] capitalize leading-8 md:text-[24px]",children:[l("str_1031_fuse_visuals_with_music")," ",(0,t.jsx)(b,{})," ",l("str_1031_craft_stunning_narrative")]})]}):null,(0,t.jsx)(U,{embedded:e,readOnly:s,audioDraft:_,onAudioDraftChange:M,prompt:d,onPromptChange:p,quality:h,onQualityChange:f,ratio:g,onRatioChange:y,values:j,onValueChange:(e,t)=>k(r=>({...r,[e]:t})),analyticsAttribution:I}),e?null:(0,t.jsx)(C.MyStoryTryOneRail,{resType:c.MV_AGENT_TEMPLATE_RES_TYPE,title:l("str_1031_suggestion_no_idea_try_one"),onSelectTemplate:z})]})]})}],98065)}]);
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.