1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[248],{20248:(e,t,n)=>{n.r(t),n.d(t,{AiGeneratorPolloVision:()=>ep,default:()=>eg});var l=n(60390),r=n(62310),a=n(25317),i=n(99079),o=n(12645),s=n(8456),d=n(90139),c=n(18859),u=n(47991),m=n(34084),p=n(91620),g=n(11626),h=n(49011),f=n(28500),x=n(90730),v=n(6166),b=n(86719),w=n(40156),j=n(3281),y=n(39040);function N(e){let t,n,r,a,i,o,s,d,c,u=(0,v.c)(39),{hasRatio:p,displayRatio:g,hasDuration:h,displayDuration:f,hasResolution:x,displayResolution:N,hasOutputNumber:k,displayNumOutputs:R,hasMode:C,mode:E,hasQuality:S,quality:I,hasStyle:U,displayStyle:z,isImage:A,fullWidth:L,onClick:W,onPointerEnter:P,onFocus:_}=e,M="adaptive"===g?"Auto":g,D="4k"===N?"4K":N,T=L&&"sm:w-full";return u[0]!==T?(t=(0,m.cn)("flex h-8 w-full min-w-0 cursor-pointer items-center gap-1.5 overflow-hidden rounded-lg px-2.5 text-[13px] transition-colors sm:h-9 sm:w-auto sm:max-w-[220px] sm:gap-2 sm:px-3 sm:text-sm",T,y.Dv,"hover:bg-white/10"),u[0]=T,u[1]=t):t=u[1],u[2]!==g||u[3]!==p||u[4]!==M?(n=p&&g&&(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:(0,m.cn)("rounded border-2 border-white/60","1:1"===g&&"h-4 w-4","4:3"===g&&"h-4 w-5","3:4"===g&&"h-5 w-4","16:9"===g&&"h-3.5 w-6","9:16"===g&&"h-6 w-3.5","2:3"===g&&"h-5 w-3.5","3:2"===g&&"h-3.5 w-5","21:9"===g&&"h-3 w-7","9:21"===g&&"h-7 w-3","adaptive"===g&&"h-5 w-5")}),(0,l.jsx)("span",{className:"text-white",children:M})]}),u[2]=g,u[3]=p,u[4]=M,u[5]=n):n=u[5],u[6]!==f||u[7]!==h||u[8]!==A?(r=!A&&h&&f&&(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)(b.A,{size:16,className:"text-white/60"}),(0,l.jsx)("span",{className:"text-white",children:f})]}),u[6]=f,u[7]=h,u[8]=A,u[9]=r):r=u[9],u[10]!==N||u[11]!==x||u[12]!==D?(a=x&&N&&(0,l.jsx)("span",{className:"text-white",children:D}),u[10]=N,u[11]=x,u[12]=D,u[13]=a):a=u[13],u[14]!==R||u[15]!==k||u[16]!==A?(i=k&&(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[A?(0,l.jsx)(w.A,{size:16,className:"text-white/60"}):(0,l.jsx)(j.A,{size:16,className:"text-white/60"}),(0,l.jsx)("span",{className:"text-white",children:R})]}),u[14]=R,u[15]=k,u[16]=A,u[17]=i):i=u[17],u[18]!==C||u[19]!==E?(o=C&&E&&(0,l.jsx)("span",{className:"truncate text-white capitalize",children:E}),u[18]=C,u[19]=E,u[20]=o):o=u[20],u[21]!==S||u[22]!==I?(s=S&&I&&(0,l.jsx)("span",{className:"truncate text-white capitalize",children:I}),u[21]=S,u[22]=I,u[23]=s):s=u[23],u[24]!==z||u[25]!==U?(d=U&&z&&(0,l.jsx)("span",{className:"truncate text-white capitalize",children:z}),u[24]=z,u[25]=U,u[26]=d):d=u[26],u[27]!==W||u[28]!==_||u[29]!==P||u[30]!==t||u[31]!==n||u[32]!==r||u[33]!==a||u[34]!==i||u[35]!==o||u[36]!==s||u[37]!==d?(c=(0,l.jsxs)("button",{type:"button",onClick:W,onPointerEnter:P,onFocus:_,className:t,children:[n,r,a,i,o,s,d]}),u[27]=W,u[28]=_,u[29]=P,u[30]=t,u[31]=n,u[32]=r,u[33]=a,u[34]=i,u[35]=o,u[36]=s,u[37]=d,u[38]=c):c=u[38],c}var k=n(60711),R=n(34442),C=n(48663);function E(e){return(0,m.cn)("h-8 w-full min-w-0 overflow-hidden rounded-lg border-none px-2.5 text-[13px] text-white focus:ring-0 focus:ring-offset-0 sm:h-9 sm:w-auto sm:px-3 sm:text-sm",e&&"sm:w-full","**:data-placeholder:text-white! **:data-[slot=select-value]:text-white!",y.Dv,"transition-colors hover:bg-white/10")}function S(e){let t,n,r,a,i,o,s,d,u,m,p,g,h,f=(0,v.c)(28),{isImage:x,onFeatureChange:b,fullWidth:y}=e,N=(0,c.c)("common.generator_config"),k=x?"ai-image":"ai-video";return f[0]!==b?(t=e=>{b("ai-image"===e?"text-to-image":"text-to-video")},f[0]=b,f[1]=t):t=f[1],f[2]!==N?(n=N("content_type"),f[2]=N,f[3]=n):n=f[3],f[4]!==y?(r=E(y),f[4]=y,f[5]=r):r=f[5],f[6]===Symbol.for("react.memo_cache_sentinel")?(a=(0,l.jsx)("div",{className:"flex min-w-0 items-center gap-2",children:(0,l.jsx)(C.yv,{})}),f[6]=a):a=f[6],f[7]!==n||f[8]!==r?(i=(0,l.jsx)(C.bq,{"aria-label":n,className:r,children:a}),f[7]=n,f[8]=r,f[9]=i):i=f[9],f[10]===Symbol.for("react.memo_cache_sentinel")?(o=(0,l.jsx)(j.A,{size:14,className:"text-white/80"}),f[10]=o):o=f[10],f[11]!==N?(s=N("ai_video"),f[11]=N,f[12]=s):s=f[12],f[13]!==s?(d=(0,l.jsx)(C.eb,{value:"ai-video",className:"cursor-pointer rounded-lg focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[o,(0,l.jsx)("span",{children:s})]})}),f[13]=s,f[14]=d):d=f[14],f[15]===Symbol.for("react.memo_cache_sentinel")?(u=(0,l.jsx)(w.A,{size:14,className:"text-white/80"}),f[15]=u):u=f[15],f[16]!==N?(m=N("ai_image"),f[16]=N,f[17]=m):m=f[17],f[18]!==m?(p=(0,l.jsx)(C.eb,{value:"ai-image",className:"cursor-pointer rounded-lg focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[u,(0,l.jsx)("span",{children:m})]})}),f[18]=m,f[19]=p):p=f[19],f[20]!==p||f[21]!==d?(g=(0,l.jsxs)(C.gC,{className:"rounded-xl border-white/10 bg-[#1a1a1a] p-2 text-white shadow-2xl",children:[d,p]}),f[20]=p,f[21]=d,f[22]=g):g=f[22],f[23]!==k||f[24]!==g||f[25]!==t||f[26]!==i?(h=(0,l.jsxs)(C.l6,{value:k,onValueChange:t,children:[i,g]}),f[23]=k,f[24]=g,f[25]=t,f[26]=i,f[27]=h):h=f[27],h}function I(e){let t,n,r,a,i,o,s,d,u,m,p,g,h,f=(0,v.c)(37),{isImage:x,resolvedFeature:b,onFeatureChange:N,fullWidth:k}=e,S=(0,c.c)("common.generator_config");f[0]!==b||f[1]!==S?(t=(0,y.GB)(b,S),f[0]=b,f[1]=S,f[2]=t):t=f[2];let I=t,U=x?"feature-image":"feature-video";return f[3]!==N?(n=e=>N(e),f[3]=N,f[4]=n):n=f[4],f[5]!==S?(r=S("features"),f[5]=S,f[6]=r):r=f[6],f[7]!==k?(a=E(k),f[7]=k,f[8]=a):a=f[8],f[9]!==x||f[10]!==b?(i=x?"text-to-image"===b?(0,l.jsx)(R.A,{size:16}):(0,l.jsx)(w.A,{size:16}
1):"text-to-video"===b?(0,l.jsx)(R.A,{size:16}):"image-to-video"===b||"frames-to-video"===b?(0,l.jsx)(w.A,{size:16}):(0,l.jsx)(j.A,{size:16}),f[9]=x,f[10]=b,f[11]=i):i=f[11],f[12]!==I?(o=(0,l.jsx)("span",{className:"truncate",children:I}),f[12]=I,f[13]=o):o=f[13],f[14]!==i||f[15]!==o?(s=(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[i,o]}),f[14]=i,f[15]=o,f[16]=s):s=f[16],f[17]!==r||f[18]!==a||f[19]!==s?(d=(0,l.jsx)(C.bq,{"aria-label":r,className:a,children:s}),f[17]=r,f[18]=a,f[19]=s,f[20]=d):d=f[20],f[21]!==S?(u=S("features"),f[21]=S,f[22]=u):u=f[22],f[23]!==u?(m=(0,l.jsx)("div",{className:"mb-1 flex min-h-6 items-center px-3 py-1.5 text-xs text-white/40",children:u}),f[23]=u,f[24]=m):m=f[24],f[25]!==x||f[26]!==S?(p=x?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(C.eb,{value:"text-to-image",className:"cursor-pointer rounded-lg px-3 py-2 focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(R.A,{size:16}),(0,l.jsx)("span",{children:S("text_to_image")})]})}),(0,l.jsx)(C.eb,{value:"image-to-image",className:"cursor-pointer rounded-lg px-3 py-2 focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(w.A,{size:16}),(0,l.jsx)("span",{children:S("image_to_image")})]})})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(C.eb,{value:"text-to-video",className:"cursor-pointer rounded-lg px-3 py-2 focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(R.A,{size:16}),(0,l.jsx)("span",{children:S("text_to_video")})]})}),y.XK&&(0,l.jsx)(C.eb,{value:"image-to-video",className:"cursor-pointer rounded-lg px-3 py-2 focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(w.A,{size:16}),(0,l.jsx)("span",{children:S("image_to_video")})]})}),y.e1&&(0,l.jsx)(C.eb,{value:"frames-to-video",className:"cursor-pointer rounded-lg px-3 py-2 focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(w.A,{size:16}),(0,l.jsx)("span",{children:S("frame_to_video")})]})}),y.$Y&&(0,l.jsx)(C.eb,{value:"reference-to-video",className:"cursor-pointer rounded-lg px-3 py-2 focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(j.A,{size:16}),(0,l.jsx)("span",{children:S("reference_to_video")})]})}),y.f5&&(0,l.jsx)(C.eb,{value:"video-to-video",className:"cursor-pointer rounded-lg px-3 py-2 focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(j.A,{size:16}),(0,l.jsx)("span",{children:S("video_to_video")})]})}
1),y.KM&&(0,l.jsx)(C.eb,{value:"extend-video",className:"cursor-pointer rounded-lg px-3 py-2 focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(j.A,{size:16}),(0,l.jsx)("span",{children:"Extend Video"})]})})]}),f[25]=x,f[26]=S,f[27]=p):p=f[27],f[28]!==m||f[29]!==p?(g=(0,l.jsxs)(C.gC,{className:"rounded-xl border-white/10 bg-[#1a1a1a] p-2 text-white shadow-2xl",children:[m,p]}),f[28]=m,f[29]=p,f[30]=g):g=f[30],f[31]!==b||f[32]!==g||f[33]!==U||f[34]!==n||f[35]!==d?(h=(0,l.jsxs)(C.l6,{value:b,onValueChange:n,children:[d,g]},U),f[31]=b,f[32]=g,f[33]=U,f[34]=n,f[35]=d,f[36]=h):h=f[36],h}function U(e){let t,n,r,a,i,o,s,d,u,p,g,h,b,w,j=(0,v.c)(37),{model:N,resolvedFeature:R,hiddenModels:S,onModelChange:I,fullWidth:U}=e,A=(0,c.c)("common.generator_config");j[0]!==N?(t=(0,y.iT)(N),j[0]=N,j[1]=t):t=j[1];let L=t;j[2]!==N?(n=(0,y.tL)(N),j[2]=N,j[3]=n):n=j[3];let W=n;j[4]!==N?(r=(0,y.Vf)(N),j[4]=N,j[5]=r):r=j[5];let P=r,_=(0,x.Ww)(R)?"model-image":"model-video";return j[6]!==I?(a=e=>I(e),j[6]=I,j[7]=a):a=j[7],j[8]!==A?(i=A("model"),j[8]=A,j[9]=i):i=j[9],j[10]!==U?(o=(0,m.cn)(E(U),"relative","[&>svg:last-child]:hidden"),j[10]=U,j[11]=o):o=j[11],j[12]!==W?(s=W&&(0,l.jsx)(k.default,{src:W,alt:"",width:16,height:16,className:"shrink-0"}),j[12]=W,j[13]=s):s=j[13],j[14]!==L?(d=(0,l.jsx)("span",{className:"truncate",children:L}),j[14]=L,j[15]=d):d=j[15],j[16]!==s||j[17]!==d?(u=(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-2 pr-4",children:[s,d]}),j[16]=s,j[17]=d,j[18]=u):u=j[18],j[19]!==P?(p=P&&(0,l.jsx)("span",{className:"pointer-events-none absolute top-0.5 right-2 rounded bg-linear-to-r from-[#C721FF] to-[#FF3466] px-1 py-0.5 text-[8px] leading-none font-bold text-white",children:P}),j[19]=P,j[20]=p):p=j[20],j[21]!==u||j[22]!==p||j[23]!==i||j[24]!==o?(g=(0,l.jsxs)(C.bq,{"aria-label":i,className:o,children:[u,p]}),j[21]=u,j[22]=p,j[23]=i,j[24]=o,j[25]=g):g=j[25],j[26]!==S||j[27]!==R?(h=y.tT.map(e=>{let t=e.models.filter(e=>!S.has(e.value)&&(0,f.iK)(e.value,R));return 0===t.length?null:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-white/40",children:(0,l.jsx)("span",{children:e.label})}),t.map(z)]},e.label)}),j[26]=S,j[27]=R,j[28]=h):h=j[28],j[29]!==h?(b=(0,l.jsx)(C.gC,{className:"max-h-[400px] min-w-[200px] rounded-xl border-white/10 bg-[#1a1a1a] p-2 text-white shadow-2xl",children:h}),j[29]=h,j[30]=b):b=j[30],j[31]!==N||j[32]!==g||j[33]!==b||j[34]!==_||j[35]!==a?(w=(0,l.jsxs)(C.l6,{value:N,onValueChange:a,defaultValue:"seedance-1.5-pro",children:[g,b]},_),j[31]=N,j[32]=g,j[33]=b,j[34]=_,j[35]=a,j[36]=w):w=j[36],w}function z(e){return(0,l.jsx)(C.eb,{value:e.value,className:"relative cursor-pointer rounded-lg pl-6 focus:bg-white/10",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[e.logo&&(0,l.jsx)(k.default,{src:e.logo,alt:"",width:16,height:16,className:"shrink-0"}),(0,l.jsx)("span",{children:e.label}),e.badge&&(0,l.jsx)("span",{className:"ml-2 rounded bg-linear-to-r from-[#C721FF] to-[#FF3466] px-1.5 py-0.5 text-[9px] font-bold text-white",children:(0,l.jsx)("span",{children:e.badge})})]})},e.value)}let A=(0,a.default)(()=>n.e(9131).then(n.bind(n,29131)).then(e=>e.ParamsPanel),{loadableGenerated:{webpack:()=>[29131]},ssr:!1,loading:()=>(0,l.jsx)("div",{className:"min-h-[180px] rounded-lg bg-[#2a2d33]"})}),L=(0,a.default)(()=>n.e(1312).then(n.bind(n,71312)).then(e=>e.MoreOptionsPanel),{loadableGenerated:{webpack:()=>[71312]},ssr:!1,loading:()=>(0,l.jsx)("div",{className:"min-h-[160px] rounded-lg bg-[#2a2d33]"})}),W=(0,a.default)(()=>n.e(7033).then(n.bind(n,77033)).then(e=>e.WanAudioPanel),{loadableGenerated:{webpack:()=>[77033]},ssr:!1,loading:()=>(0,l.jsx)("div",{className:"min-h-[120px] rounded-lg bg-[#2a2d33]"})}),P=e=>{var t,a,i,o,s,d,v,b,w,j,k,R,C,E,z,P,_,M,D,T,F,O,G;let{model:B,feature:V,params:H,onModelChange:K,onFeatureChange:q,onParamsChange:Y,onPremiumGate:$,compact:Z=!1,onDesktopWidthChange:X}=e,Q=(0,c.c)("common.generator_config"),{configs:J}=(0,u.U)(),ee=(0,r.useRef)(null),et=function(e){return(0,x.Ww)(e)?"text-to-image"===e||"image-to-image"===e?e:"text-to-image":(0,x._h)(e)&&("text-to-vi
1deo"===e||"image-to-video"===e||"frames-to-video"===e||"reference-to-video"===e||"video-to-video"===e||"extend-video"===e||"multiref-to-video"===e)?"multiref-to-video"===e?"reference-to-video":e:"text-to-video"}(V),en=(0,x.Ww)(et),el=(0,f.Ac)(B,et),er=(0,y.GB)(et,Q),ea=new Set(f.eo),ei=null==(t=J.seedance_provider)?void 0:t.trim().toLowerCase(),eo="seedance-2.0"===B||"seedance-2.0-fast"===B||"seedance-2.0-mini"===B,es=eo&&"kinovi"===ei,ed=eo&&"kie"===ei&&el.resolutions?el.resolutions.filter(e=>["480p","720p","1080p","4k"].includes(e.toLowerCase())):el.resolutions,ec=(null!=(C=H.resolution)?C:"").toLowerCase(),eu=(null==ed?void 0:ed.some(e=>e.toLowerCase()===ec))?H.resolution:(null==ed?void 0:ed[0])||"",em=new Set(ea),[ep,eg]=(0,r.useState)(!1),[eh,ef]=(0,r.useState)(!1),[ex,ev]=(0,r.useState)(!1),[eb,ew]=(0,r.useState)(0),ej=(0,r.useRef)(null),ey=(0,r.useRef)(null),eN=(0,r.useRef)(null),ek=(0,r.useRef)(null),eR=(0,r.useRef)(null),eC=(0,r.useRef)(null),eE=(0,r.useRef)(null),eS=(0,r.useRef)(null),eI=(0,r.useRef)(null);(0,r.useEffect)(()=>{V!==et&&q(et)},[V,q,et]),(0,r.useEffect)(()=>{var e;if(!(null==ed?void 0:ed.length))return;let t=(null!=(e=H.resolution)?e:"").toLowerCase();ed.some(e=>e.toLowerCase()===t)||Y({resolution:ed[0]})},[Y,H.resolution,ed]),(0,r.useEffect)(()=>{if("gpt-image-2"!==B&&"gpt-image-2-5"!==B)return;let e=(0,f.Rm)(H,B,et);(e.ratio!==H.ratio||e.resolution!==H.resolution||e.numOutputs!==H.numOutputs)&&Y({ratio:e.ratio,resolution:e.resolution,numOutputs:e.numOutputs})},[B,Y,H,H.numOutputs,H.ratio,H.resolution,et]);let eU=H.duration||(null==(a=el.videoLengths)?void 0:a[0])||"",ez="gpt-image-2"===B||"gpt-image-2-5"===B?(0,f.Rm)(H,B,et):H,eA=ez.ratio||(null==(i=el.aspectRatios)?void 0:i[0])||"",eL=es?"":"gpt-image-2"===B||"gpt-image-2-5"===B?ez.resolution:eu,eW=null!=(z=null!=(E=H.numOutputs)?E:null==(o=el.outputNumbers)?void 0:o[0])?z:1,eP=H.style||(null==(s=el.styles)?void 0:s[0])||"",e_=null!=(P=null==(d=el.modes)?void 0:d.find(e=>("string"==typeof e?e:e.value)===H.mode))?P:null,eM="string"==typeof e_?e_:e_?e_.labelKey?Q(e_.labelKey):e_.label:H.mode,eD=(null!=(_=null==(v=el.aspectRatios)?void 0:v.length)?_:0)>1,eT=(null!=(M=null==(b=el.videoLengths)?void 0:b.length)?M:0)>1,eF=!es&&(null!=(D=null==ed?void 0:ed.length)?D:0)>1,eO=(null!=(T=null==(w=el.outputNumbers)?void 0:w.length)?T:0)>1,eG=(null!=(F=null==(j=el.styles)?void 0:j.length)?F:0)>0,eB=(null!=(O=null==(k=el.qualities)?void 0:k.length)?O:0)>1,eV=(null!=(G=null==(R=el.modes)?void 0:R.length)?G:0)>0,eH=eD||eT||eF||eO||eG||eB||eV,eK="wan-2.6"===B&&!en;(0,r.useEffect)(()=>{let e=!1,t=()=>{!e&&(n.e(9131).then(n.bind(n,29131)),n.e(1312).then(n.bind(n,71312)),eK&&n.e(7033).then(n.bind(n,77033)))};if("requestIdleCallback"in window){let n=window.requestIdleCallback(t,{timeout:1500});return()=>{e=!0,window.cancelIdleCallback(n)}}let l=globalThis.setTimeout(t,900);return()=>{e=!0,globalThis.clearTimeout(l)}},[eK]);let eq=()=>{n.e(9131).then(n.bind(n,29131)),n.e(1312).then(n.bind(n,71312))};(0,r.useEffect)(()=>{let e=e=>{var t,n,l;let r=e.target;if(!r)return;let a=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.some(e=>{var t;return null==(t=e.current)?void 0:t.contains(r)})};!ej.current&&!ek.current||a(ej,ek)||(null==(t=eE.current)?void 0:t.contains(r))||eg(!1),!ey.current&&!eR.current||a(ey,eR)||(null==(n=eS.current)?void 0:n.contains(r))||ef(!1),!eN.current&&!eC.current||a(eN,eC)||(null==(l=eI.current)?void 0:l.contains(r))||ev(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[]),(0,r.useEffect)(()=>{let e=ee.current;if(!e||!X)return;let t=()=>{X(Math.ceil(e.scrollWidth))};t();let n=window.requestAnimationFrame(t),l=new ResizeObserver(t);return l.observe(e),()=>{window.cancelAnimationFrame(n),l.disconnect()}},[eU,eW,eA,eL,eP,eH,eB,B,X,H.mode,H.quality,et,er]),(0,r.useEffect)(()=>{if(!ep&&!eh&&!ex)return;let e=()=>{ew(e=>e+1)},t=window.scrollY,n=n=>{var l,r,a;let i=n.target;if(!(i&&((null==(l=eE.current)?void 0:l.contains(i))||(null==(r=eS.current)?void 0:r.contains(i))||(null==(a=eI.current)?void 0:a.contains(i))))){if(Math.abs(window.scrollY-t)>48){eg(!1),ef(!1),ev(!1);return}e()}};return window.addEventListener("resize",e,{passive:!0}),window.addEventListener("orientationchange",e,{passive:!0}),document.addEventListener("scroll",n,{passive:!0,capture:!0}),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e),document.removeEventListener("scroll",n,{capture:!0})}},[ex,eh,ep]);let eY=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!eH)return null;let n=Z?ek:ej;return(0,l.jsxs)("div",{ref:t?void 0:n,className:"pointer-events-auto relative z-40",children:[(0,l.jsx)(N,{hasRatio:eD,displayRatio:eA,hasDuration:eT,displayDuration:eU,hasResolution:eF,displayRes
1olution:eL,hasOutputNumber:eO,displayNumOutputs:eW,hasMode:eV,mode:eM,hasQuality:eB,quality:H.quality,hasStyle:eG,displayStyle:eP,isImage:en,fullWidth:e,onClick:()=>eg(e=>!e),onPointerEnter:eq,onFocus:eq}),!t&&eJ(ep,n,eE,Z?360:560,Z?420:520,Z?"right":"left",(0,l.jsx)(A,{model:B,feature:et,params:H,onParamsChange:Y,hideResolution:es,resolutionOptions:ed,compact:Z}))]})},e$=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=Z?eR:ey;return(0,l.jsxs)("div",{ref:e?void 0:t,className:"pointer-events-auto relative z-40",children:[(0,l.jsx)("button",{type:"button","aria-label":"Open more generation options",onClick:()=>ef(e=>!e),onPointerEnter:eq,onFocus:eq,className:(0,m.cn)("relative z-40 flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-white transition-colors sm:h-9 sm:w-9",y.Dv,"hover:bg-white/10"),children:(0,l.jsx)(p.A,{size:16})}),!e&&eJ(eh,t,eS,Z?340:380,Z?420:520,"right",(0,l.jsx)(L,{model:B,feature:et,params:H,onParamsChange:Y,onPremiumGate:$}))]})},eZ=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!eK)return null;let t=Z?eC:eN;return(0,l.jsxs)("div",{ref:e?void 0:t,className:"pointer-events-auto relative z-40",children:[(0,l.jsxs)("button",{type:"button",onClick:()=>ev(e=>!e),onPointerEnter:()=>{n.e(7033).then(n.bind(n,77033))},onFocus:()=>{n.e(7033).then(n.bind(n,77033))},className:(0,m.cn)("relative z-40 flex h-8 cursor-pointer items-center gap-1.5 rounded-lg px-2.5 text-[13px] transition-colors sm:h-9 sm:text-sm",y.Dv,"hover:bg-white/10"),children:[(0,l.jsx)(g.A,{size:16,className:"text-white"}),(0,l.jsx)("span",{className:"text-white",children:Q("music")})]}),!e&&eJ(ex,t,eI,320,Z?320:420,"left",(0,l.jsx)(W,{params:H,onParamsChange:Y}))]})},eX=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,l.jsxs)("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[(0,l.jsx)("div",{className:"min-w-0 flex-none",children:(0,l.jsx)(S,{isImage:en,onFeatureChange:q,fullWidth:e})}),(0,l.jsx)("div",{className:"min-w-0 flex-none",children:(0,l.jsx)(I,{isImage:en,resolvedFeature:et,onFeatureChange:q,fullWidth:e})}),(0,l.jsx)("div",{className:"min-w-0 flex-none",children:(0,l.jsx)(U,{model:B,resolvedFeature:et,hiddenModels:em,onModelChange:K,fullWidth:e})}),eH&&(0,l.jsx)("div",{className:"flex-none",children:eY(e,t)}),eK&&(0,l.jsx)("div",{className:"flex-none",children:eZ(t)}),(0,l.jsx)("div",{className:"flex-none",children:e$(t)})]})},eQ=function(e,t,n){var l;let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"center",a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=null==(l=e.current)?void 0:l.getBoundingClientRect(),o=window.innerWidth,s=Math.min(t,o-16);if(!i)return{left:8,top:8,width:s,maxHeight:n};let d=i.left+i.width/2-s/2;"left"===r?d=i.left:"right"===r&&(d=i.right-s);let c=Math.min(Math.max(d,8),o-s-8),u=i.top-8,m=window.innerHeight-i.bottom-8;return(a?u<220&&m>u:m>=n||m>=u)?{left:c,top:i.bottom+8,width:s,maxHeight:Math.max(Math.min(n,m),180)}:{left:c,bottom:window.innerHeight-i.top+8,width:s,maxHeight:Math.max(Math.min(n,u),180)}},eJ=(e,t,n,r,a,i,o)=>{if(!e||"undefined"==typeof document)return null;let s=eQ(t,r,a,i,!Z);return s?(0,h.createPortal)((0,l.jsx)("div",{ref:n,style:s,className:(0,m.cn)("fixed z-30 overflow-y-auto rounded-xl border border-white/10 p-2 shadow-2xl",y.zB),children:o}),document.body):null};return(0,l.jsxs)("div",{className:"relative z-30 overflow-visible transition-all duration-300 ease-in-out",children:[(0,l.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute top-0 left-0 -z-10 h-0 overflow-hidden opacity-0",children:(0,l.jsx)("div",{ref:ee,className:"inline-flex w-max",children:eX(!0,!0)})}),Z?(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("div",{className:"w-[104px] flex-none",children:(0,l.jsx)(S,{isImage:en,onFeatureChange:q,fullWidth:!0})}),(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsx)(I,{isImage:en,resolvedFeature:et,onFeatureChange:q,fullWidth:!0})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("div",{className:"min-w-0 flex-[0_0_42%]",children:(0,l.jsx)(U,{model:B,resolvedFeature:et,hiddenModels:em,onModelChange:K,fullWidth:!0})}),eH&&(0,l.jsx)("div",{className:"min-w-0 flex-1",children:eY(!0)}),(0,l.jsx)("div",{className:"flex-none",children:e$()})]}),eK&&(0,l.jsx)("div",{className:"flex",children:eZ()})]}):eX(!0)]})};var _=n(63397),M=n(62693),D=n(67682),T=n(73727),F=n(12244);let O=(0,n(34208).A)("arrow-left-right",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);var G=n(16752),B=n(90024);function V(e){let t=window.getSelection();if(!t||0===t.rangeCount)return -1;try{let n=t.getRangeAt(0),l=document.createRange();return l.selectNodeContents(e),l.setEnd(n.startContainer,n.startOffset),l.toString().length}catch(e){return -1}}function H(e,t){let n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=0;for(;n.nextNode();){let e=n.currentNode;if(l+e.length>=t){let n=document.createRange();n.setStart(e,t-l),n.collapse(!0);let r=window.getSelection();null==r||r.removeAllRanges(),null==r||r.addRange(n);return}l+=e.length}
1let r=document.createRange();r.selectNodeContents(e),r.collapse(!1);let a=window.getSelection();null==a||a.removeAllRanges(),null==a||a.addRange(r)}function K(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function q(e,t){if(0===t.length)return K(e);let n=K(e),l=new Map(t.map(e=>[e.displayRef.toLowerCase(),e]));return n.replace(B.r5,(e,t)=>{let n=l.get(String(t).toLowerCase());return n?'<span class="mention-ref" data-mention="'.concat(e,'" data-type="').concat(n.type,'" data-display-ref="').concat(n.displayRef,'" data-asset-id="').concat(n.id,'" contenteditable="false">').concat(e,"</span>"):e})}function Y(e){return(0,B.ZR)(e).sort().join(",")}let $=(0,a.default)(()=>n.e(9457).then(n.bind(n,29457)).then(e=>e.MentionDropdown),{loadableGenerated:{webpack:()=>[29457]},ssr:!1}),Z=(0,a.default)(()=>n.e(4966).then(n.bind(n,84966)).then(e=>e.PromptPreviewDialog),{loadableGenerated:{webpack:()=>[84966]},ssr:!1}),X=(0,a.default)(()=>n.e(6354).then(n.bind(n,76354)).then(e=>e.PromptUploadedMediaItems),{loadableGenerated:{webpack:()=>[76354]},ssr:!1}),Q=(0,a.default)(()=>n.e(9181).then(n.bind(n,41562)).then(e=>e.PromptDesktopUploadPreviews),{loadableGenerated:{webpack:()=>[41562]},ssr:!1}),J={image:["A majestic lion standing on a cliff at sunset...","ä¸åªå¨æ¦çç®åç«å¨æ¬å´è¾¹ï¼å¤é³è¥¿ä¸...","夿®ãã®å´ã«ç«ã¤å¨å³ããã©ã¤ãªã³...","Un le\xf3n majestuoso de pie en un acantilado al atardecer...","Un lion majestueux debout sur une falaise au coucher du soleil...","Ein majest\xe4tischer L\xf6we steht bei Sonnenuntergang auf einer Klippe...","ììì ì ë²½ ìì ì ìë ìì ìë ì¬ì...","Um le\xe3o majestoso em p\xe9 sobre um penhasco ao p\xf4r do sol..."],video:["A drone flying through a neon-lit cyberpunk city at night...","æ 人æºå¨éè¹ç¯éªççèµåæå
åå¸å¤ç©ºä¸é£è¡...","ããªã³ã«ç
§ãããããµã¤ãã¼ãã³ã¯ã®è¡ãå¤ã«é£ã¶ããã¼ã³...","Un dron volando por una ciudad cyberpunk iluminada con ne\xf3n por la noche...","Un drone volant dans une ville cyberpunk \xe9clair\xe9e au n\xe9on la nuit...","Eine Drohne fliegt nachts durch eine neonbeleuchtete Cyberpunk-Stadt...","ë°¤ì ë¤ì¨ì¼ë¡ ë¹ëë ì¬ì´ë²íí¬ ëì를 ë¹ííë ëë¡ ...","Um drone voando por uma cidade cyberpunk iluminada por neon \xe0 noite..."]},ee=new Set(["seedance-2.0","seedance-2.0-fast","seedance-2.5","seedance-1.5-pro","kling-3","kling-3-pro","kling-v3-standard"]),et=e=>!Number.isFinite(e)||e<0?0:Math.round(e),en=e=>!Number.isFinite(e)||e<0?"unknown":"".concat(e.toFixed(2),"s"),el=(0,r.forwardRef)((e,t)=>{var n,a,i,o,s,d,c;
1let{value:p="",onChange:g,onUploadsChange:h,onUploadsVersionChange:b,onSubmit:j,onActivateRuntime:y,feature:N,model:k,credits:R}=e,C=e=>{(null==e?void 0:e.startsWith("blob:"))&&URL.revokeObjectURL(e)},E=(0,r.useRef)(null),S=(0,r.useRef)(null),I=(0,r.useRef)([]),{user:U,setIsShowSignModal:z}=(0,u.U)(),[A,L]=(0,r.useState)([]),[W,P]=(0,r.useState)([]),[K,el]=(0,r.useState)(null),[er,ea]=(0,r.useState)(!1),[ei,eo]=(0,r.useState)(!1),[es,ed]=(0,r.useState)(!1),[ec,eu]=(0,r.useState)({}),em=(0,r.useRef)(p),ep=(0,r.useRef)(null),eg=(0,r.useRef)({}),eh=(0,r.useRef)(0),ef=(0,r.useRef)(null),ex=(0,r.useRef)(null),ev=(0,r.useRef)(null),[eb,ew]=(0,r.useState)([]),ej=(0,r.useRef)({}),ey=((e,t,n,l,a)=>{let i,o,s=(0,v.c)(10),d=void 0===n?50:n,c=void 0===l?30:l,u=void 0===a?2e3:a,[m,p]=(0,r.useState)(""),[g,h]=(0,r.useState)(0),[f,x]=(0,r.useState)(!1);return s[0]!==g||s[1]!==c||s[2]!==m||s[3]!==t||s[4]!==f||s[5]!==u||s[6]!==d||s[7]!==e?(i=()=>{if(!t)return void p("");let n=e[g],l=setTimeout(()=>{f?m.length>0?p(m.slice(0,-1)):(x(!1),h(t=>(t+1)%e.length)):m.length<n.length?p(n.slice(0,m.length+1)):setTimeout(()=>x(!0),u)},f?c:d);return()=>clearTimeout(l)},o=[m,f,g,e,t,d,c,u],s[0]=g,s[1]=c,s[2]=m,s[3]=t,s[4]=f,s[5]=u,s[6]=d,s[7]=e,s[8]=i,s[9]=o):(i=s[8],o=s[9]),(0,r.useEffect)(i,o),m})(N&&(0,x.Ww)(N)?J.image:J.video,!p||""===p.trim()),eN=k&&N?(0,f.Ac)(k,N):void 0,ek=null==eN?void 0:eN.imageUpload,eR=null==eN?void 0:eN.multimodalUpload,eC=!!eR,eE=null==eN?void 0:eN.promptMaxLength,eS=null!=(i=null==ek?void 0:ek.type)?i:"image",eI=null!=(o=null==ek?void 0:ek.maxImages)?o:0,eU=()=>{A.forEach(e=>C(e)),W.forEach(e=>C(e.url)),eb.forEach(e=>C(e.url)),L([]),P([]),ew([]),eu({}),ex.current=null,ev.current=null};(0,r.useImperativeHandle)(t,()=>({getUploadedImages:()=>A,getUploadedVideos:()=>W,getUploadedMedia:()=>eb,clearUploads:()=>{eU()},applyPresetMedia:e=>{eU();let t=Array.isArray(e)?e.filter(e=>!!(null==e?void 0:e.url)):[];if(0!==t.length){if(eC){let e={image:0,video:0,audio:0};ew(t.map(t=>{var n;return e[t.type]+=1,{id:crypto.randomUUID(),url:t.url,type:t.type,displayRef:(0,B.zG)(t.type,e[t.type]),name:null!=(n=t.name)?n:"".concat(t.type,"-").concat(e[t.type]).concat("image"===t.type?".png":"video"===t.type?".mp4":".mp3"),duration:t.duration}}));return}if("video"===eS)return void P(t.filter(e=>"video"===e.type).slice(0,eI).map((e,t)=>{var n;return{url:e.url,name:null!=(n=e.name)?n:"video-".concat(t+1,".mp4")}}));L(t.filter(e=>"image"===e.type).slice(0,eI).map(e=>e.url))}}}));let ez=(0,r.useRef)(null),eA=function(e){let{contentRef:t,mediaItems:n,isMultimodal:l,onChange:a,onLocalTextChange:i}=e,[o,s]=(0,r.useState)(!1),[d,c]=(0,r.useState)({top:0,left:0}),[u,m]=(0,r.useState)(0),[p,g]=(0,r.useState)([]),h=(0,r.useRef)(-1),f=(0,r.useRef)(-1),x=(0,r.useRef)(""),v=(0,r.useRef)(!1),b=n.map(e=>{let t=e.type.charAt(0).toUpperCase()+e.type.slice(1);return null!=e.duration&&(t+=" ".concat(e.duration,"s")),{displayRef:e.displayRef,label:t,type:e.type}}),w=(0,r.useCallback)(()=>{let e=window.getSelection();if(e&&0!==e.rangeCount)try{let n=e.getRangeAt(0).getBoundingClientRect(),l=t.current;if(!l)return;let r=l.getBoundingClientRect();c({top:n.bottom-r.top+4,left:n.left-r.left})}catch(e){}},[t]),j=(0,r.useCallback)(()=>{if(!l||0===n.length||v.current){o&&s(!1);return}let e=t.current;if(!e)return;let r=e.innerText,a=V(e);if(f.current=a,a<=0)return void s(!1);let i=r.slice(0,a),d=i.lastIndexOf("@");if(-1===d){s(!1),h.current=-1,f.current=-1,y(r);return}let c=i.slice(d+1).toLowerCase();if(c.includes(" ")||c.includes("\n")){s(!1),h.current=-1,f.current=-1,y(r);return}let u=b.filter(e=>{if(""===c)return!0;let t=e.type.toLowerCase();return e.displayRef.toLowerCase().startsWith(c)||t.startsWith(c)});if(0===u.length){s(!1),h.current=-1,f.current=-1,y(r);return}h.current=d,g(u),m(0),s(!0),w()},[l,n,b,t,w,o]),y=(0,r.useCallback)(e=>{let l=Y(e);if(l!==x.current){x.current=l;let r=t.current;if(!r)return;let a=V(r);r.innerHTML=q(e,n),a>=0&&H(r,a)}},[t,n]),N=(0,r.useCallback)(e=>!!o&&0!==p.length&&("ArrowDown"===e.key?(e.preventDefault(),m(e=>(e+1)%p.length),!0):"ArrowUp"===e.key?(e.preventDefault(),m(e=>(e-1+p.length)%p.length),!0):"Enter"===e.key?(e.preventDefault(),k(p[u].displayRef),!0):"Escape"===e.key?(e.preventDefault(),s(!1),!0):"Tab"===e.key&&(e.preventDefault(),k(p[u].displayRef),!0)),[o,p,u]),k=(0,r.useCallback)(e=>{let l=t.current;if(!l)return;let r=l.innerText,o=h.current;if(o<0)return;let d=V(l),c=d>=o?d:f.current;if(c<0)return;let u="@".concat(e," "),m=r.slice(0,o)+u+r.slice(c),p=o+u.length;x.current=Y(m),l.innerHTML=q(m,n),l.focus(),H(l,p),null==i||i(m),null==a||a(m),s(!1),h.current=-1,f.current=p},[t,n,a,i]);return{isDropdownOpen:o,dropdownPosition:d,selectedIndex:u,filteredItems:p,handleInput:j,handleKeyDown:N,handleSelect:k,syncHighlights:(0,r.useCallback)(e=>{let l=t.current;if(!l)return;let r=V(l),a=r>=0?r:f.current;x.current=Y(e),l.innerHTML=q(e,n),a>=0&&H(l,a)},[t,n]),_isComposingRef:v}}({contentRef:E,mediaItems:eb,isMultimodal:eC,onChange:g,onLocalTextChange:e=>{em.current=e}}),eL=!eC&&eI>0,eW="frames-to-video"===N&&!!k&&ee.has(k),eP=eL&&"image"===eS&&eW&&2===eI&&(null!=(s=null==ek||null==(n=ek.labels)?void 0:n.length)?s:0)>=2,e_=eL&&!eP&&"image"===eS&&eI>1&&A.length>0,eM=null!=(d=null==ek?void 0:ek.accept)?d:"video"===eS?"video/*":"image/jpeg,image/png,image/webp";(0,r.useEffect)(()=>{E.current&&(p!==em.current||E.current.innerText!==p)&&(E.current.innerText!==p&&(eC&&eb.length>0?eA.syncHighlights(p):E.current.innerText=p),em.current=p)}
1,[p,eC,eb.length,eA]),(0,r.useEffect)(()=>{if(!E.current||!eC)return;let e=em.current||p;if(e){if(eb.length>0)return void eA.syncHighlights(e);E.current.innerText!==e&&(E.current.innerText=e)}},[eC,eb,eA,p]),(0,r.useEffect)(()=>{null==h||h(A.length>0||W.length>0||eb.length>0)},[h,A.length,W.length,eb.length]),(0,r.useEffect)(()=>{null==b||b()},[b,A,W,eb]);let eD=(e,t)=>{let n=eg.current[e];n&&(clearTimeout(n),delete eg.current[e]),eu(n=>({...n,[e]:t})),("success"===t||"error"===t)&&(eg.current[e]=setTimeout(()=>{eu(t=>{let n={...t};return delete n[e],n}),delete eg.current[e]},1400))},eT=e=>{let t=eg.current[e];t&&(clearTimeout(t),delete eg.current[e]),eu(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})},eF=()=>(null==y||y(),!!U||(z(!0),G.oR.error("Please sign in to upload files."),!1)),eO=async e=>{var t,n;let l=new FormData;l.append("files",e);let r=await fetch("/api/storage/upload-image",{method:"POST",body:l}),a=await r.json().catch(()=>null);if(!r.ok||(null==a?void 0:a.code)!==0)throw 401===r.status&&z(!0),Error((null==a?void 0:a.message)||"File upload failed");let i=null==a||null==(n=a.data)||null==(t=n.urls)?void 0:t[0];if(!i)throw Error("Uploaded file URL missing");return i},eG=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"absolute inset-0 z-20 flex items-center justify-center rounded bg-black/45";return e&&"idle"!==e?"uploading"===e?(0,l.jsx)("div",{className:t,children:(0,l.jsx)(tt,{})}):(0,l.jsx)("div",{className:t,children:"success"===e?(0,l.jsx)(_.A,{className:"size-4 text-emerald-400"}):(0,l.jsx)(M.A,{className:"size-4 text-red-400"})}):null},eB={"image/jpg":"image/jpeg","audio/mp3":"audio/mpeg","audio/x-wav":"audio/wav","video/mov":"video/quicktime","video/m4v":"video/x-m4v"},eV=e=>{var t;return null!=(t=eB[e.toLowerCase()])?t:e.toLowerCase()},eH=(e,t)=>{var n;if(!t)return!0;let l=eV(e.type||""),r=e.name.includes(".")?".".concat(null==(n=e.name.split(".").pop())?void 0:n.toLowerCase()):"";return t.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean).some(e=>{if(e.startsWith("."))return r===e;if(e.endsWith("/*")){let t=e.slice(0,e.length-1);return l.startsWith(t)}return eV(e)===l})},eK=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return!(e.size>1024*t*1024)||(G.oR.error("Image must be smaller than ".concat(t,"MB.")),!1)},eq=null!=(c=null==ek||null==(a=ek.constraints)?void 0:a.maxFileSizeMB)?c:10,eY=e=>eH(e,null==ek?void 0:ek.accept)?!!eK(e,eq):(G.oR.error("Unsupported image format for this model."),!1),e$=async e=>{let t=null==ek?void 0:ek.constraints;if(!t)return!0;let n=URL.createObjectURL(e);try{let e=await new Promise((e,t)=>{let l=new Image;l.onload=()=>e({width:l.naturalWidth,height:l.naturalHeight}),l.onerror=()=>t(Error("Invalid image file")),l.src=n});if(t.minWidth&&e.width<t.minWidth)return G.oR.error("Image width must be at least ".concat(t.minWidth,"px")),!1;if(t.minHeight&&e.height<t.minHeight)return G.oR.error("Image height must be at least ".concat(t.minHeight,"px")),!1;let l=e.width/e.height;if(t.minAspectRatio&&l<t.minAspectRatio)return G.oR.error("Image aspect ratio must be at least ".concat(t.minAspectRatio)),!1;if(t.maxAspectRatio&&l>t.maxAspectRatio)return G.oR.error("Image aspect ratio must be at most ".concat(t.maxAspectRatio)),!1;return!0}catch(e){return G.oR.error((null==e?void 0:e.message)||"Failed to read image dimensions"),!1}finally{URL.revokeObjectURL(n)}},eZ=async e=>{if(!eF()){ev.current=null;return}let t=ev.current;if(null!==t){let n=e[0];if(ev.current=null,!n||(e.length>1&&G.oR.error("Replace only accepts one image at a time."),!eY(n)||!await e$(n)))return;let l="image-".concat(t),r=A[t],a=URL.createObjectURL(n);L(e=>{let n=[...e];return n[t]=a,n.filter(Boolean)}),eD(l,"uploading");try{let e=await eO(n);L(n=>{let l=[...n];return l[t]===a&&(l[t]=e),l.filter(Boolean)}),C(a),eD(l,"success")}catch(e){G.oR.error((null==e?void 0:e.message)||"Image upload failed"),L(e=>{let n=[...e];return n[t]===a&&(r?n[t]=r:n.splice(t,1)),n.filter(Boolean)}),C(a),eD(l,"error")}return}let n=e.filter(eY);if(0===n.length)return;let l=Math.max(0,eI-A.length);if(l<=0)return void G.oR.error("Maximum ".concat(eI," image").concat(eI>1?"s":""," allowed for this model"));let r=[];for(let e of n){if(r.length>=l)break;await e$(e)&&r.push(e)}r.length<n.length&&G.oR.error("Only valid images within the model limits will be kept");let a=0,i=r.map(e=>({file:e,tempUrl:URL.createObjectURL(e)}));for(let[e,t]of(L(e=>(a=e.length,[...e,...i.map(e=>e.tempUrl)])),i.entries())){let n="image-".concat(a+e);eD(n,"uploading");try{let l=await eO(t.file);L(n=>{let r=[...n];return r[a+e]===t.tempUrl&&(r[a+e]=l),r}),C(t.tempUrl),eD(n,"success")}catch(l){G.oR.error((null==l?void 0:l.message)||"Image upload failed"),eD(n,"error"),L(n=>{let l=[...n];return l[a+e]===t.tempUrl&&l.splice(a+e,1),l}),C(t.tempUrl)}}},eX=async(e,t)=>{var n;if(!eF()){t.target.value="";return}let l=null==(n=t.target.files)?void 0:n[0];if(!l)return;if(!eY(l)||!await e$(l)){t.target.value="";return}let r="frame-".concat(e),a=A[e],i=URL.createObjectURL(l);L(t=>{let n=[...t];
1return n[e]=i,n.filter(Boolean)}),eD(r,"uploading");try{let t=await eO(l);L(n=>{let l=[...n];return l[e]===i&&(l[e]=t),l.filter(Boolean)}),C(i),eD(r,"success")}catch(t){G.oR.error((null==t?void 0:t.message)||"Frame upload failed"),L(t=>{let n=[...t];return n[e]===i&&(a?n[e]=a:n.splice(e,1)),n.filter(Boolean)}),C(i),eD(r,"error")}t.target.value=""},eQ=async e=>{var t;if(!eF())return;let n=e[0];if(!n||!(eH(n,null==ek?void 0:ek.accept)||(G.oR.error("Unsupported video format for this model."),0)))return;let l=ev.current,r=null!==l?"video-".concat(l):"standard-add",a=null!=(t=W[null!=l?l:0])?t:null,i=URL.createObjectURL(n);P([{url:i,name:n.name}]),eD(r,"uploading");try{let e=await eO(n);P(t=>{var l;return(null==(l=t[0])?void 0:l.url)===i?[{url:e,name:n.name}]:t}),C(i),null!==l&&(ev.current=null),eD(r,null!==l?"success":"idle"),eD("video-0","success")}catch(e){G.oR.error((null==e?void 0:e.message)||"Video upload failed"),P(e=>{var t;return(null==(t=e[0])?void 0:t.url)===i?a?[a]:[]:e}),C(i),eD(r,"error")}},eJ=e=>{var t;eF()&&(ev.current="number"==typeof e?e:null,null==(t=S.current)||t.click())},e0=e=>{ev.current===e&&(ev.current=null),C(A[e]),eT("image-".concat(e)),eT("frame-".concat(e)),L(t=>t.filter((t,n)=>n!==e))},e1=()=>{A.length<2||L(e=>{let[t,n,...l]=e;return t&&n?[n,t,...l].filter(Boolean):[t,n,...l].filter(Boolean)})},e2=e=>{var t;let n=null==(t=W[e])?void 0:t.url;n&&C(n),eT("video-".concat(e)),P(t=>t.filter((t,n)=>n!==e))},e5=(e,t)=>{let n=(0,B.o_)(t.displayRef,t.type);if(null===n)return[...e,t];let l=e.findIndex(e=>{if(e.type!==t.type)return!1;let l=(0,B.o_)(e.displayRef,e.type);return null!==l&&l>n});if(l>=0)return[...e.slice(0,l),t,...e.slice(l)];let r=(()=>{for(let l=e.length-1;l>=0;l-=1){var n;if((null==(n=e[l])?void 0:n.type)===t.type)return l}return -1})();return r>=0?[...e.slice(0,r+1),t,...e.slice(r+1)]:[...e,t]},e3=e=>{var t;eF()&&(null==(t=I.current[e])||t.click())},e4=e=>new Promise((t,n)=>{let l=URL.createObjectURL(e),r=e.type.startsWith("video/")?document.createElement("video"):document.createElement("audio");r.preload="metadata",r.onloadedmetadata=()=>{let e=r.duration;URL.revokeObjectURL(l),t(e)},r.onerror=()=>{URL.revokeObjectURL(l),n(Error("Cannot read media duration"))},r.src=l}),e6=async(e,t)=>{if(!eF()){ex.current=null,t.target.value="";return}if(!eR)return;let n=Array.from(t.target.files||[]);if(0===n.length){ex.current=null;return}let l=eR.slots.find(t=>t.type===e);if(!l){ex.current=null;return}let r=ex.current,a=r?eb.find(t=>t.id===r&&t.type===e):null,i=!!a,o=eb.filter(t=>t.type===e).length,s=i?1:Math.max(0,l.maxCount-o);if(s<=0){G.oR.error("Maximum ".concat(l.maxCount," ").concat(e," file").concat(l.maxCount>1?"s":""," allowed")),ex.current=null,t.target.value="";return}let d=eR.maxTotal,c=i?1:d?Math.max(0,d-eb.length):1/0;if(c<=0){G.oR.error("Maximum ".concat(d," files allowed in total")),ex.current=null,t.target.value="";return}i&&n.length>1&&G.oR.error("Replace only accepts one file at a time.");let u=i?n.slice(0,1):n.slice(0,Math.min(s,c)),m=null,p=[...eb],g=a?"media-".concat(a.id):null,h="slot-".concat(e);for(let t of u){let n;if(!eH(t,l.accept)){G.oR.error("Unsupported ".concat(e," format for this model.")),eD(h,"error");continue}if("image"===e&&!eK(t)){eD(h,"error");continue}if(g&&eT(h),("video"===e||"audio"===e)&&l.maxDurationSeconds)try{let r=await e4(t),a=et(r);if(r>l.maxDurationSeconds+.5&&a>l.maxDurationSeconds){G.oR.error("".concat("video"===e?"Video":"Audio"," must display as ").concat(l.maxDurationSeconds,"s or shorter (detected ").concat(en(r),")")),g?eD(g,"error"):eD(h,"error");continue}n=a}catch(n){G.oR.error("Failed to read ".concat(e," file: ").concat(t.name)),g?eD(g,"error"):eD(h,"error");continue}let r=URL.createObjectURL(t);if(a){m={...a,url:r,name:t.name,duration:n},ew(e=>e.map(e=>e.id===a.id?m:e)),eD(g,"uploading");try{let e=await eO(t);a&&(m={...a,url:e,name:t.name,duration:n}),ew(e=>e.map(e=>e.id===a.id?m:e)),C(r),eD(g,"success");break}catch(t){G.oR.error((null==t?void 0:t.message)||"".concat(e," upload failed")),ew(e=>e.map(e=>e.id===a.id?a:e)),C(r),eD(g,"error");break}}let i=(0,B.Q)(e,p),o={id:crypto.randomUUID(),url:r,type:e,displayRef:(0,B.zG)(e,i),name:t.name,duration:n};p.push(o),ew(e=>e5(e,o)),eD("media-".concat(o.id),"uploading");try{let e=await eO(t);ew(t=>t.map(t=>
1t.id===o.id?{...t,url:e}:t)),C(r),eD("media-".concat(o.id),"success")}catch(t){G.oR.error((null==t?void 0:t.message)||"".concat(e," upload failed")),eD("media-".concat(o.id),"error"),ew(e=>e.filter(e=>e.id!==o.id)),C(r)}}ex.current=null;let f=ej.current[e];f&&(f.value="")},e8=e=>{el(e),ea(!0)},e7=e=>{e8({url:e,type:"image"})},e9=()=>{ep.current&&(clearTimeout(ep.current),ep.current=null),ed(!0)},te=()=>{ep.current=setTimeout(()=>{ed(!1),ep.current=null},300)};(0,r.useEffect)(()=>{let e=ef.current;if(ef.current=eS,null!==e&&e!==eS)return void("video"===eS?(A.forEach(e=>C(e)),L([])):(W.forEach(e=>C(e.url)),P([])));"image"===eS&&A.length>eI&&eI>0&&(A.slice(eI).forEach(e=>C(e)),L(e=>e.slice(0,eI))),"video"===eS&&W.length>eI&&eI>0&&(W.slice(eI).forEach(e=>C(e.url)),P(e=>e.slice(0,eI)))},[eI,eI,eS]),(0,r.useEffect)(()=>()=>{A.forEach(e=>C(e)),W.forEach(e=>C(e.url)),eb.forEach(e=>C(e.url)),Object.values(eg.current).forEach(e=>clearTimeout(e)),ep.current&&clearTimeout(ep.current)},[]),(0,r.useEffect)(()=>{!eC&&(ex.current=null,ev.current=null,eb.length>0&&(eb.forEach(e=>C(e.url)),ew([])))},[eC]);let tt=()=>(0,l.jsx)("span",{"aria-hidden":"true",className:"inline-block h-5 w-5 animate-spin rounded-full border-2 border-white/20 border-t-white/80"}),tn=e=>{let{label:t,slotIndex:n,optional:r=!1,disabled:a=!1,size:i="mobile"}=e,o=A[n],s=ec["frame-".concat(n)],d="mobile"===i;return(0,l.jsxs)("div",{className:"flex shrink-0 flex-col items-center gap-0.5",children:[(0,l.jsx)("div",{role:"button",tabIndex:a?-1:0,"aria-label":t,onClick:()=>{var e;if(a)return void G.oR.error("Please upload the first frame before adding the last frame");eF()&&(null==(e=I.current[n])||e.click())},onKeyDown:e=>{if(!a&&("Enter"===e.key||" "===e.key)){var t;e.preventDefault(),eF()&&(null==(t=I.current[n])||t.click())}},className:(0,m.cn)("group relative flex items-center justify-center rounded border transition-transform duration-500 ease-out will-change-transform","h-[60px] w-[45px]",o?"overflow-visible border-white/60 bg-transparent":"border-dashed border-white/20 bg-[rgba(255,255,255,0.04)]",a?"cursor-not-allowed opacity-45":"cursor-pointer hover:scale-110"),children:o?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"absolute inset-0 overflow-hidden rounded-[inherit]",children:[(0,l.jsx)("img",{src:o,alt:"",className:"h-full w-full object-cover"}),eG(s),d?ta(()=>e7(o),"".concat(t.toLowerCase()," frame"),"absolute inset-0 z-[1]"):null]}),!d&&tr(()=>e7(o),"".concat(t.toLowerCase()," frame"),"absolute inset-0 z-[1] hidden cursor-pointer items-center justify-center rounded bg-[rgba(0,0,0,0.7)] opacity-0 transition-opacity sm:flex sm:group-hover:opacity-100"),d&&ti(()=>e3(n),"".concat(t.toLowerCase()," frame"),"absolute top-[-7px] left-[-7px] z-10 flex size-[14px] cursor-pointer items-center justify-center rounded-full bg-black opacity-100 transition-opacity"),!d&&ti(()=>e3(n),"".concat(t.toLowerCase()," frame")),(0,l.jsx)("button",{type:"button","aria-label":"Remove ".concat(t.toLowerCase()),className:"absolute top-[-7px] right-[-7px] z-10 flex size-[14px] cursor-pointer items-center justify-center rounded-full bg-black opacity-100 transition-opacity",onClick:e=>{e.stopPropagation(),e0(n)},children:(0,l.jsx)(M.A,{className:"size-[10px] text-white"})})]}):(0,l.jsxs)("div",{className:"flex h-full w-full items-center justify-center text-white/38",children:[eG(s,"absolute inset-0 z-20 flex items-center justify-center rounded bg-black/15"),(0,l.jsxs)("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("path",{d:"M12 5v14"}),(0,l.jsx)("path",{d:"M5 12h14"})]})]})}),(0,l.jsxs)("div",{className:"flex min-h-[20px] flex-col items-center leading-none",children:[(0,l.jsx)("span",{className:(0,m.cn)("text-white/78",d?"text-[9px]":"text-[10px]"),children:t}),r&&(0,l.jsx)("span",{className:(0,m.cn)("mt-0.5 text-white/32",d?"text-[8px]":"text-[9px]"),children:"Optional"})]})]})},tl=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"absolute inset-0 flex cursor-pointer items-center justify-center rounded bg-[rgba(0,0,0,0.7)] opacity-0 transition-opacity hover:opacity-100",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"preview";return(0,l.jsx)("button",{type:"button","aria-label":"Preview ".concat(n),title:"Preview ".concat(n),className:t,onClick:t=>{t.stopPropagation(),e()},children:(0,l.jsx)("span",{className:"text-white transition-colors hover:text-pink-500",children:(0,l.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,l.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,l.jsx)("path",{d:"m21 21-4.35-4.35"}),(0,l.jsx)("path",{d:"M11 8v6"}),(0,l.jsx)("path",{d:"M8 11h6"})]})})})},tr=(e,t,n)=>tl(e,"".concat(n),t),ta=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"absolute inset-0 z-[1] sm:hidden";return(0,l.jsx)("button",{type:"button","aria-label":"Preview ".concat(t),title:"Preview ".concat(t),className:n,onClick:t=>{t.stopPropagation(),e()}})},ti=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"absolute top-[-7px] left-[-7px] z-10 flex size-[14px] curs
1or-pointer items-center justify-center rounded-full bg-black opacity-100 transition-opacity";return(0,l.jsx)("button",{type:"button","aria-label":"Replace ".concat(t),title:"Replace ".concat(t),className:n,onClick:t=>{t.stopPropagation(),e()},children:(0,l.jsx)(F.A,{className:"size-[10px] text-white"})})};return(0,l.jsxs)("div",{className:(0,m.cn)("relative flex h-full flex-1 flex-col gap-2 pe-0",eC?"pt-0.5":"pt-3",ei&&"rounded-2xl bg-white/[0.03] ring-2 ring-white/30"),onDragEnter:e=>{(eL||eC)&&(e.preventDefault(),eh.current+=1,eo(!0))},onDragOver:e=>{(eL||eC)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",ei||eo(!0))},onDragLeave:e=>{(eL||eC)&&(e.preventDefault(),eh.current=Math.max(0,eh.current-1),0===eh.current&&eo(!1))},onDrop:e=>{if(!eL&&!eC||(e.preventDefault(),eh.current=0,eo(!1),!eF()))return;ex.current=null,ev.current=null;let t=Array.from(e.dataTransfer.files||[]);if(0!==t.length)if(eC&&eR){let e=[],n=[],l=[];for(let r of t)r.type.startsWith("image/")?e.push(r):r.type.startsWith("video/")?n.push(r):r.type.startsWith("audio/")&&l.push(r);let r=e=>{let t=new DataTransfer;return e.forEach(e=>t.items.add(e)),{target:{files:t.files}}};e.length>0&&e6("image",r(e)),n.length>0&&e6("video",r(n)),l.length>0&&e6("audio",r(l))}else"video"===eS?eQ(t):eZ(t)},children:[eL&&!eP&&(0,l.jsx)("input",{ref:S,type:"file",accept:eM,multiple:"image"===eS&&eI>1,onChange:e=>{let t=Array.from(e.target.files||[]);t.length>0?"video"===eS?eQ(t):eZ(t):ev.current=null,S.current&&(S.current.value="")},className:"hidden"}),eP&&(0,l.jsx)(l.Fragment,{children:[0,1].map(e=>(0,l.jsx)("input",{ref:t=>{I.current[e]=t},type:"file",accept:eM,onChange:t=>eX(e,t),className:"hidden"},e))}),eC&&eR&&eR.slots.map(e=>(0,l.jsx)("input",{ref:t=>{ej.current[e.type]=t},type:"file",accept:e.accept,multiple:e.maxCount>1,onChange:t=>e6(e.type,t),className:"hidden"},e.type)),eC&&eR&&(0,l.jsxs)("div",{className:"scrollbar-hide flex items-center gap-2 overflow-x-auto px-2 pt-0 pb-1",children:[eb.length>0&&(0,l.jsx)(X,{mediaItems:eb,uploadStates:ec,onReplaceMedia:e=>{var t;eF()&&(ex.current=e.id,null==(t=ej.current[e.type])||t.click())},onRemoveMedia:e=>{var t,n;let l=eb[e];if(!l)return;ex.current===l.id&&(ex.current=null),ew(t=>(C(t[e].url),t.filter((t,n)=>n!==e))),eT("media-".concat(l.id));let r=null!=(n=null==(t=E.current)?void 0:t.innerText)?n:"";if(r.includes("@")){let e=(0,B.sR)(r,l.displayRef);e!==r&&(em.current=e,null==g||g(e))}},onPreviewAsset:e8}),eR.slots.map(e=>{let t=eb.filter(t=>t.type===e.type).length,n=t>=e.maxCount,r=!!eR.maxTotal&&eb.length>=eR.maxTotal,a=n||r,i=e.maxDurationSeconds?"â¤".concat(e.maxDurationSeconds,"s"):null;return(0,l.jsxs)("div",{className:"flex shrink-0 flex-col items-center gap-0.5",children:[(0,l.jsxs)("button",{type:"button",onClick:()=>{var t;!a&&eF()&&(ex.current=null,null==(t=ej.current[e.type])||t.click())},className:(0,m.cn)("relative flex h-[60px] w-[45px] cursor-pointer flex-col items-center justify-center rounded border border-dashed border-white/20 bg-[rgba(255,255,255,0.04)] px-1.5 text-center transition-transform duration-500 ease-out will-change-transform",a?"cursor-not-allowed opacity-45":"hover:scale-110"),disabled:a,children:[eG(ec["slot-".concat(e.type)],"absolute inset-0 z-20 flex items-center justify-center rounded bg-black/20"),(0,l.jsx)("span",{className:"mb-1 flex items-center justify-center",children:(e=>"image"===e?(0,l.jsx)(w.A,{className:"h-4.5 w-4.5 text-white/72"}):"video"===e?(0,l.jsx)(D.A,{className:"h-4.5 w-4.5 text-white/72"}):(0,l.jsx)(T.A,{className:"h-4.5 w-4.5 text-white/72"}))(e.type)}),(0,l.jsx)("span",{className:"text-[9px] leading-none text-white/80",children:(e=>"image"===e?"Image":"video"===e?"Video":"Audio")(e.type)}),(0,l.jsx)("span",{className:(0,m.cn)("mt-0.5 text-[8px] leading-none text-white/40",!i&&"invisible"),children:null!=i?i:"â¤15s"})]}),(0,l.jsxs)("span",{className:"text-[10px] leading-none text-white/34",children:["(",t,"/",e.maxCount,")"]})]},e.type)})]}),eP&&(0,l.jsxs)("div",{className:"flex items-start justify-center gap-0.5 pb-1 sm:hidden",children:[tn({label:"Start",slotIndex:0,size:"mobile"}),(0,l.jsx)("button",{type:"button",onClick:e1,disabled:A.length<2,className:(0,m.cn)("mt-[11px] inline-flex h-5 w-5 shrink-0 items-center justify-center transition-colors",A.length<2?"curs
1or-not-allowed text-white/18":"text-white/50 hover:text-white/85"),"aria-label":"Swap first and last frame",title:"Swap first and last frame",children:(0,l.jsx)(O,{className:"h-3 w-3"})}),tn({label:"End",slotIndex:1,optional:!0,size:"mobile"})]}),eL&&!eP&&(0,l.jsx)("div",{className:(0,m.cn)("scrollbar-hide flex items-center gap-2 overflow-x-auto px-2 pt-2 pb-1",e_?"":"sm:hidden"),children:"video"===eS?(0,l.jsxs)(l.Fragment,{children:[W.map((e,t)=>(0,l.jsxs)("div",{className:"group relative h-[68px] w-[52px] shrink-0 cursor-pointer overflow-visible rounded border border-white/60 transition-transform duration-500 ease-out will-change-transform sm:h-[60px] sm:w-[45px] sm:hover:z-[2] sm:hover:scale-110",children:[(0,l.jsx)("button",{className:"absolute top-[-7px] right-[-7px] z-10 flex size-[14px] cursor-pointer items-center justify-center rounded-full bg-black",onClick:e=>{e.stopPropagation(),e2(t)},children:(0,l.jsx)(M.A,{className:"size-[10px] text-white"})}),(0,l.jsxs)("div",{className:"h-full w-full cursor-pointer overflow-hidden rounded-[inherit]",children:[eG(ec["video-".concat(t)]),(0,l.jsx)("video",{src:e.url,className:"h-full w-full object-cover",muted:!0,playsInline:!0}),ta(()=>e8({url:e.url,type:"video"}),"video","absolute inset-0 z-[1] sm:hidden")]}),tr(()=>e8({url:e.url,type:"video"}),"video","absolute inset-0 z-[1] hidden cursor-pointer items-center justify-center rounded bg-[rgba(0,0,0,0.7)] opacity-0 transition-opacity sm:flex sm:group-hover:opacity-100")]},e.url)),W.length<eI&&(0,l.jsxs)("div",{onClick:()=>eJ(),className:(0,m.cn)("relative flex shrink-0 items-center justify-center","h-[68px] w-[52px] rounded border border-dashed border-white/20 bg-white/[0.04] sm:h-[60px] sm:w-[45px]","cursor-pointer transition-transform duration-500 ease-out will-change-transform sm:hover:scale-110"),children:[eG(ec["standard-add"],"absolute inset-0 z-20 flex items-center justify-center rounded bg-black/15"),"uploading"===ec["standard-add"]?(0,l.jsx)(tt,{}):(0,l.jsx)("span",{className:"text-2xl text-white/40",children:"+"})]})]}):(0,l.jsxs)(l.Fragment,{children:[A.map((e,t)=>(0,l.jsxs)("div",{className:"group relative h-[68px] w-[52px] shrink-0 cursor-pointer overflow-visible rounded border border-white/60 transition-transform duration-500 ease-out will-change-transform sm:h-[60px] sm:w-[45px] sm:hover:z-[2] sm:hover:scale-110",children:[ti(()=>eJ(t),"image","absolute top-[-7px] left-[-7px] z-10 flex size-[14px] cursor-pointer items-center justify-center rounded-full bg-black opacity-100 transition-opacity"),(0,l.jsx)("button",{className:"absolute top-[-7px] right-[-7px] z-10 flex size-[14px] cursor-pointer items-center justify-center rounded-full bg-black",onClick:e=>{e.stopPropagation(),e0(t)},children:(0,l.jsx)(M.A,{className:"size-[10px] text-white"})}),(0,l.jsxs)("div",{className:"h-full w-full cursor-pointer overflow-hidden rounded-[inherit]",children:[eG(ec["image-".concat(t)]),(0,l.jsx)("img",{src:e,className:"h-full w-full cursor-pointer object-cover",alt:"",onClick:()=>e7(e)}),ta(()=>e7(e),"image","absolute inset-0 z-[1] sm:hidden")]}),tr(()=>e7(e),"image","absolute inset-0 z-[1] hidden cursor-pointer items-center justify-center rounded bg-[rgba(0,0,0,0.7)] opacity-0 transition-opacity sm:flex sm:group-hover:opacity-100")]},e)),A.length<eI&&(0,l.jsxs)("div",{onClick:()=>eJ(),className:(0,m.cn)("relative flex shrink-0 items-center justify-center","h-[68px] w-[52px] rounded border border-dashed border-white/20 bg-white/[0.04] sm:h-[60px] sm:w-[45px]","cursor-pointer transition-transform duration-500 ease-out will-change-transform sm:hover:scale-110"),children:[eG(ec["standard-add"],"absolute inset-0 z-20 flex items-center justify-center rounded bg-black/15"),"uploading"===ec["standard-add"]?(0,l.jsx)(tt,{}):(0,l.jsx)("span",{className:"text-2xl text-white/40",children:"+"})]})]})}),(0,l.jsxs)("div",{className:(0,m.cn)("flex items-start justify-start gap-4",eC?"min-h-[44px] sm:min-h-[56px]":"min-h-[60
1px] sm:min-h-[80px]"),children:[eL&&!eP&&!e_&&(0,l.jsx)("div",{className:"hidden shrink-0 sm:block",children:(0,l.jsx)("div",{className:"flex items-start gap-0.5",children:"video"===eS?(0,l.jsxs)(l.Fragment,{children:[W.length>0&&(0,l.jsx)(Q,{mode:"video",uploadedImages:A,uploadedVideos:W,uploadStates:ec,isImageExpanded:es,onImageExpandEnter:e9,onImageExpandLeave:te,onReplaceImage:eJ,onRemoveImage:e0,onRemoveVideo:e2,onPreviewImage:e7}),W.length<eI&&(0,l.jsxs)("div",{onClick:()=>eJ(),className:(0,m.cn)("relative flex cursor-pointer items-center justify-center","rounded border border-dashed border-white/20 bg-[rgba(255,255,255,0.04)]","h-[60px] w-[45px]","transition-transform duration-500 ease-out will-change-transform hover:scale-110"),children:[eG(ec["standard-add"],"absolute inset-0 z-20 flex items-center justify-center rounded bg-black/15"),(0,l.jsx)("span",{className:"text-2xl text-white/40",children:"+"})]})]}):(0,l.jsxs)(l.Fragment,{children:[A.length>0&&(0,l.jsx)(Q,{mode:"image",uploadedImages:A,uploadedVideos:W,uploadStates:ec,isImageExpanded:es,onImageExpandEnter:e9,onImageExpandLeave:te,onReplaceImage:eJ,onRemoveImage:e0,onRemoveVideo:e2,onPreviewImage:e7}),A.length<eI&&(0,l.jsxs)("div",{onClick:()=>eJ(),className:(0,m.cn)("relative flex cursor-pointer items-center justify-center","rounded border border-dashed border-white/20 bg-[rgba(255,255,255,0.04)]","h-[60px] w-[45px]","transition-transform duration-500 ease-out will-change-transform hover:scale-110"),children:[eG(ec["standard-add"],"absolute inset-0 z-20 flex items-center justify-center rounded bg-black/15"),"uploading"===ec["standard-add"]?(0,l.jsx)(tt,{}):(0,l.jsx)("span",{className:"text-2xl text-white/40",children:"+"})]})]})})}),eP&&(0,l.jsx)("div",{className:"hidden shrink-0 sm:block",children:(0,l.jsxs)("div",{className:"flex items-start gap-0.5",children:[tn({label:"Start",slotIndex:0,size:"desktop"}),(0,l.jsx)("button",{type:"button",onClick:e1,disabled:A.length<2,className:(0,m.cn)("mt-[11px] inline-flex h-5 w-5 shrink-0 items-center justify-center transition-colors",A.length<2?"cursor-not-allowed text-white/18":"text-white/50 hover:text-white/85"),"aria-label":"Swap first and last frame",title:"Swap first and last frame",children:(0,l.jsx)(O,{className:"h-3 w-3"})}),tn({label:"End",slotIndex:1,optional:!0,size:"desktop"})]})}),(0,l.jsxs)("div",{ref:ez,className:"relative flex min-w-0 flex-1 flex-col items-start text-left",children:[(!p||""===p.trim())&&ey&&(0,l.jsxs)("div",{className:(0,m.cn)("pointer-events-none absolute inset-0 text-base leading-relaxed sm:text-lg",eC?"text-white/28":"text-white/20"),style:{textAlign:"left"},children:[ey,(0,l.jsx)("span",{className:"ml-0.5 inline-block h-5 w-0.5 animate-pulse bg-white/40"})]}),(0,l.jsx)("div",{ref:E,contentEditable:!0,onFocus:()=>null==y?void 0:y(),onInput:e=>{let t=e.currentTarget.innerText;eE&&t.length>eE&&(t=t.slice(0,eE),e.currentTarget.innerText=t),em.current=t,null==g||g(t),eC&&eb.length>0&&eA.handleInput()},onKeyDown:e=>{!(eC&&eA.handleKeyDown(e))&&("Enter"!==e.key||e.shiftKey||(e.preventDefault(),null==y||y(),null==j||j()))},onPaste:e=>{if(eC){e.preventDefault();let t=e.clipboardData.getData("text/plain");document.execCommand("insertText",!1,t)}},onCompositionStart:()=>{eA._isComposingRef&&(eA._isComposingRef.current=!0)},onCompositionEnd:()=>{eA._isComposingRef&&(eA._isComposingRef.current=!1)},className:(0,m.cn)("relative z-10 w-full overflow-y-auto text-left outline-none","text-base leading-relaxed text-white sm:text-lg","scrollbar-hide",eC?"max-h-[112px] min-h-[44px] sm:max-h-[132px] sm:min-h-[56px]":"max-h-[160px] min-h-[80px] sm:max-h-[200px] sm:min-h-[110px]"),style:{textAlign:"left"}}),eA.isDropdownOpen&&(0,l.jsx)($,{items:eA.filteredItems,selectedIndex:eA.selectedIndex,position:eA.dropdownPosition,onSelect:eA.handleSelect,containerRef:ez}),(0,l.jsx)("style",{dangerouslySetInnerHTML:{__html:'\n .mention-ref {\n color: #60a5fa;\n background-color: rgba(96, 165, 250, 0.12);\n border-radius: 3px;\n padding: 1px 4px 1px 2px;\n font-weight: 500;\n }\n .mention-ref::before {\n margin-right: 2px;\n font-size: 0.8em;\n }\n .mention-ref[data-type="image"]::before { content: "\uD83D\uDDBC"; }\n .mention-ref[data-type="video"]::before { content: "\uD83C\uDFAC"; }\n .mention-ref[data-type="audio"]::before { content: "\uD83C\uDFB5"; }\n '}})]})]}),(0,l.jsx)("div",{className:"mt-auto flex items-center justify-between pt-2"}),er&&(0,l.jsx)(Z,{open:er,asset:K,onOpenChange:ea})]})});el.displayName="PromptInput";var er=n(51562),ea=n(50125);
1let ei={"image-to-video":"text-to-video","frames-to-video":"text-to-video","reference-to-video":"text-to-video","image-to-image":"text-to-image","multiref-to-video":"text-to-video"};function eo(e,t){return("reference-to-video"===e||"multiref-to-video"===e)&&("seedance-2.0"===t||"seedance-2.0-fast"===t||"seedance-2.0-mini"===t||"seedance-2.5"===t||"wan-2.6"===t)}function es(){return"Reference tags are supported in Reference to Video for Seedance 2.0 models and Wan 2.6. Wan 2.6 uses video references such as @video1."}let ed=(0,a.default)(()=>n.e(4223).then(n.bind(n,74223)).then(e=>e.CreditsPricingModal),{loadableGenerated:{webpack:()=>[74223]},ssr:!1}),ec=(0,a.default)(()=>n.e(5062).then(n.bind(n,85062)).then(e=>e.IdeaChips),{loadableGenerated:{webpack:()=>[85062]},ssr:!1}),eu=(0,a.default)(()=>n.e(655).then(n.bind(n,50655)).then(e=>e.ResultStage),{loadableGenerated:{webpack:()=>[50655]},ssr:!1}),em=(0,a.default)(()=>n.e(833).then(n.bind(n,80833)).then(e=>e.TaskHistory),{loadableGenerated:{webpack:()=>[80833]},ssr:!1});function ep(){let{defaultModel:e="seedance-2.0",defaultFeature:t="image-to-video",defaultParams:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},p=(0,r.useRef)(null);null==p.current&&"undefined"!=typeof performance&&(p.current=performance.now());let g=(0,f.$p)(e),{user:h,configs:v,markGeneratorIntent:b}=(0,u.U)(),w=(0,c.c)("common.generator_config"),j=(0,r.useRef)(null),y=(0,r.useRef)(null),N=(0,r.useRef)(!1),[k,R]=(0,r.useState)(""),[C,E]=(0,r.useState)(!1),[S,I]=(0,r.useState)(0),[U,z]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),[W,_]=(0,r.useState)(g),[M,D]=(0,r.useState)(t),[T,F]=(0,r.useState)(0),[O,V]=(0,r.useState)(0),[H,K]=(0,r.useState)(0),[q,Y]=(0,r.useState)(()=>{let e=(0,f.i9)(g,t);return a?(0,f.Rm)({...e,...a},g,t):e}),$=(0,r.useRef)(null),{currentTask:Z,taskHistory:X,isSubmitting:Q,isGenerating:J,requiredCredits:ee,isShowCreditsPricing:et,setIsShowCreditsPricing:en,handleSubmit:ep,handleRetry:eg,handleContinueWaiting:eh,handleSelectHistoryTask:ef}=function(e){let{prompt:t,model:l,feature:a,params:i,promptInputRef:o,uploadsVersion:s}=e,{user:d,configs:c,setIsShowSignModal:m,fetchUserCredits:p}=(0,u.U)(),g=(0,r.useCallback)((e,t)=>("seedance-2.0"===e||"seedance-2.0-fast"===e||"seedance-2.0-mini"===e)&&c.seedance_provider?c.seedance_provider:"seedance-2.0"===e||"seedance-2.0-fast"===e||"seedance-2.0-mini"===e?"kie":t,[c.seedance_provider]),[h,v]=(0,r.useState)(null),[b,w]=(0,r.useState)(null),[j,y]=(0,r.useState)([]),[N,k]=(0,r.useState)(!1),[R,C]=(0,r.useState)(!1),E=(0,r.useRef)(null),S=(0,r.useRef)(d),I=(0,r.useRef)(null),U=null!==b,z=(0,r.useMemo)(()=>{try{var e,t,n,r,s,d;let c=null!=(r=null==(e=o.current)?void 0:e.getUploadedImages())?r:[],u=null!=(s=null==(t=o.current)?void 0:t.getUploadedVideos())?s:[],m=null!=(d=null==(n=o.current)?void 0:n.getUploadedMedia())?d:[],p=[...c,...u.map(e=>e.url)],h={...(0,ea.p)({prompt:"",model:l,feature:a,genParams:i,uploadedFileUrls:p,uploadedMediaItems:m}).body};return h.provider=g(l,h.provider),(0,er.b)(h)}catch(e){return 0}},[l,a,i,o,g,s]);(0,r.useEffect)(()=>{if(null===S.current&&null!==d&&E.current){let e=E.current;E.current=null,L(e)}S.current=d},[d]),(0,r.useEffect)(()=>{if(!(null==b?void 0:b.taskId)||"success"===b.status||"failed"===b.status||"timeout"===b.status)return;let e=b.id,t=()=>{},l=!1;return n.e(105).then(n.bind(n,30105)).then(n=>{let{startGenerationPolling:r}=n;l||(t=r({generatingTask:b,generationStartedAt:I.current,onPending:t=>{w(e=>e?{...e,status:t}:e),v(n=>(null==n?void 0:n.id)===e?{...n,status:t}:n)},onSuccess:t=>{let n={status:"success",result:t};w(null),v(t=>(null==t?void 0:t.id)===e?{...t,...n}:t),y(t=>t.map(t=>t.id===e?{...t,...n}:t)),p()},onFailed:t=>{let n={status:"failed",error:t};w(null),v(t=>(null==t?void 0:t.id)===e?{...t,...n}:t),y(t=>t.map(t=>t.id===e?{...t,...n}:t)),p()},onTimeout:()=>{let t={status:"timeout",error:"Generation timed out"};w(e=>e?{...e,...t}:e),v(n=>(null==n?void 0:n.id)===e?{...n,...t}:n),y(n=>n.map(n=>n.id===e?{...n,...t}:n))}}))}),()=>{l=!0,t()}},[null==b?void 0:b.taskId,null==b?void 0:b.status]);let A=(0,r.useCallback)(e=>{y(t=>t.some(t=>t.id===e.id)?t.map(t=>
1t.id===e.id?e:t):[e,...t].slice(0,x.oe))},[]),L=(0,r.useCallback)(async e=>{var t,l,r;if(!d)return;let a=null!=(l=null==(t=d.credits)?void 0:t.remainingCredits)?l:0,i=0;try{let t={...(0,ea.p)({prompt:null!=(r=e.submissionPrompt)?r:e.prompt,model:e.model,feature:e.feature,genParams:e.params,uploadedFileUrls:e.blobUrls,uploadedMediaItems:e.mediaItems}).body};t.provider=g(e.model,t.provider);let n=(0,er.a)(t);if(!n.valid)return void G.oR.error(n.message);i=(0,er.b)(t)}catch(e){G.oR.error((null==e?void 0:e.message)||"Unable to calculate credits for current params.");return}if(a<i)return void C(!0);k(!0);let o=crypto.randomUUID(),s=(0,x.Ww)(e.feature)?"image":"video",c={id:o,taskId:null,status:"submitting",prompt:e.prompt,model:e.model,feature:e.feature,params:e.params,mediaType:s,result:null,error:null,creditsCost:i,createdAt:Date.now(),uploadedFileUrls:[],mediaItems:e.mediaItems};v(c),w(c),A(c);try{let{executeGenerationRuntime:t}=await n.e(278).then(n.bind(n,70278)),l=await t({pending:e,remainingCredits:a,previewCost:i,mediaType:s,newTask:c,resolvePricingProvider:g});if(I.current=Date.now(),l.task.creditsCost!==i){let e={creditsCost:l.task.creditsCost};v(t=>(null==t?void 0:t.id)===o?{...t,...e}:t),w(t=>(null==t?void 0:t.id)===o?{...t,...e}:t)}if("completed"===l.type){v(l.task),w(null),A(l.task),k(!1),p();return}w(l.task),v(e=>(null==e?void 0:e.id)===o?l.task:e),A(l.task),k(!1),p()}catch(t){console.error("Generation error:",t),G.oR.error(t.message||"Failed to generate");let e={...c,status:"failed",error:t.message||"Failed to generate"};v(e),w(null),A(e),k(!1)}},[d,p,C,A,g]),W=(0,r.useCallback)(()=>{var e,n,r,s,c,u;let p,g,h=t.trim();if(!h||b)return;let x="multiref-to-video"===a?"reference-to-video":a;if((0,B.ZR)(h).length>0&&!eo(x,l))return void G.oR.error(es());let v=(0,f.Ac)(l,x),w=v.imageUpload,j=v.multimodalUpload,y=[];if(j){let t=null!=(n=null==(e=o.current)?void 0:e.getUploadedMedia())?n:[];if("kling-3.0-motion-control"===l){let e=t.some(e=>"image"===e.type),n=t.some(e=>"video"===e.type);if(!e||!n)return void G.oR.error("Please upload one image and one video for motion control.")}if(0===t.length&&(y=[]),t.length>0){let e=(0,B.Y8)(h,t);if(!e.ok)return void G.oR.error("".concat(e.missingRefs.map(e=>"@".concat(e)).join(", ")," ").concat(e.missingRefs.length>1?"are":"is"," missing. Remove the reference or re-upload the media before generating."));y=e.blobUrls,p=e.orderedMediaItems,g=h}}else y=[...w&&null!=(c=null==(r=o.current)?void 0:r.getUploadedImages())?c:[],...((null==w?void 0:w.type)==="video"&&null!=(u=null==(s=o.current)?void 0:s.getUploadedVideos())?u:[]).map(e=>e.url)];let N=!l.startsWith("wan-")&&0===y.length&&a in ei?ei[a]:x;if(N!==x&&(h.includes("@image")||h.includes("@video")||h.includes("@audio")))return void G.oR.error(function(e){switch(e){case"image-to-video":case"image-to-image":return"Upload an image before generating.";case"frames-to-video":return"Upload at least one frame before generating.";case"reference-to-video":case"multiref-to-video":return"Upload at least one reference file before generating.";case"video-to-video":return"Upload a video before generating.";default:return"Upload the required reference files before generating."}}(a));let k={prompt:h,model:l,feature:N,params:i,blobUrls:y,mediaItems:p,submissionPrompt:g};if(!d){E.current=k,m(!0);return}L(k)},[t,l,a,i,d,o,m,L,b]),P=(0,r.useCallback)(e=>{var t;if(b)return void G.oR.error("A generation is already in progress");let n={prompt:e.prompt,model:e.model,feature:e.feature,params:e.params,blobUrls:e.uploadedFileUrls,mediaItems:e.mediaItems};if((0,B.ZR)(e.prompt).length>0&&!eo(e.feature,e.model))return void G.oR.error(es());if(null==(t=e.mediaItems)?void 0:t.length){let t=(0,B.Y8)(e.prompt,e.mediaItems);if(!t.ok)return void G.oR.error("".concat(t.missingRefs.map(e=>"@".concat(e)).join(", ")," ").concat(t.missingRefs.length>1?"are":"is"," missing."));n.blobUrls=t.blobUrls,n.mediaItems=t.orderedMediaItems,n.submissionPrompt=e.prompt}L(n)},[L,b]);return{currentTask:h,taskHistory:j,isSubmitting:N,isGenerating:U,requiredCredits:z,isShowCreditsPricing:R,setIsShowCreditsPricing:C,handleSubmit:W,handleRetry:P,handleContinueWaiting:(0,r.useCallback)(()=>
1{if(!b||"timeout"!==b.status)return;let e=b.id;I.current=Date.now();let t={status:"pending",error:null};w(e=>e?{...e,...t}:e),v(n=>(null==n?void 0:n.id)===e?{...n,...t}:n),y(n=>n.map(n=>n.id===e?{...n,...t}:n))},[b]),handleSelectHistoryTask:(0,r.useCallback)(e=>{v(e)},[])}}({prompt:k,model:W,feature:M,params:q,promptInputRef:$,uploadsVersion:S}),ex=(0,r.useCallback)((e,t,n)=>{let l=(0,f.i9)(e,t),r="seedance-2.0-mini"===e?{...l,...n,resolution:l.resolution}:{...l,...n};return(0,f.Rm)(r,e,t)},[]),ev=(0,r.useCallback)(()=>{var e;R(""),null==(e=$.current)||e.clearUploads()},[]),eb=(0,r.useCallback)(()=>{I(e=>e+1)},[]),ew=(0,r.useCallback)(()=>{N.current||(N.current=!0,n.e(4223).then(n.bind(n,74223)),n.e(5062).then(n.bind(n,85062)),n.e(655).then(n.bind(n,50655)),n.e(833).then(n.bind(n,80833)))},[]),ej=(0,r.useCallback)(()=>{L(!0),ew()},[ew]),ey=(0,r.useCallback)(()=>{b(),ej()},[ej,b]),eN=k.trim().length>0||C,ek=!!h&&("seedance-2.0"===W||"seedance-2.0-fast"===W||"seedance-2.0-mini"===W),eR=T>0&&H>0&&O>0&&T<860&&T<H+O+12;return(0,r.useEffect)(()=>{p.current},[]),(0,r.useEffect)(()=>{var e,t,n,l,r,a;let i=(0,f.Ac)(W,M);(null!=(l=null==(e=i.videoLengths)?void 0:e.length)?l:0)>0&&!q.duration||(null!=(r=null==(t=i.aspectRatios)?void 0:t.length)?r:0)>0&&!q.ratio||(null!=(a=null==(n=i.resolutions)?void 0:n.length)?a:0)>0&&q.resolution},[W,M,q]),(0,r.useEffect)(()=>{(Z||X.length>0||et||k.trim().length>0||C)&&ej()},[ej,Z,C,et,k,X.length]),(0,r.useEffect)(()=>{if(A)return;if("requestIdleCallback"in window){let e=window.requestIdleCallback(()=>{L(!0)},{timeout:2500});return()=>window.cancelIdleCallback(e)}let e=globalThis.setTimeout(()=>{L(!0)},1500);return()=>globalThis.clearTimeout(e)},[A]),(0,r.useEffect)(()=>{var e;U&&(null==(e=$.current)||e.applyPresetMedia(U),z(null))},[M,W,U]),(0,r.useEffect)(()=>{let e=j.current,t=y.current;if(!e&&!t)return;let n=()=>{e&&F(e.clientWidth),t&&V(Math.ceil(t.offsetWidth))};n();let l=new ResizeObserver(n);return e&&l.observe(e),t&&l.observe(t),()=>l.disconnect()},[]),(0,l.jsxs)("div",{className:"flex w-full flex-col items-center justify-center p-4",children:[(0,l.jsx)("div",{className:(0,m.cn)("group relative mx-auto w-full max-w-[980px] rounded-3xl transition-all duration-300","will-change-[max-width]"),children:(0,l.jsx)("div",{className:(0,m.cn)("relative h-full rounded-3xl p-4","bg-[#151515]/85","border-t border-white/10","shadow-xl shadow-black/40"),children:(0,l.jsx)("div",{className:"h-full",children:(0,l.jsxs)("form",{className:"h-full",onSubmit:e=>{e.preventDefault(),ep()},children:[(0,l.jsx)("div",{className:"flex-1",children:(0,l.jsx)(el,{ref:$,value:k,onChange:R,onUploadsChange:E,onUploadsVersionChange:eb,onSubmit:ep,onActivateRuntime:ey,feature:M,model:W,credits:ee})}),(0,l.jsxs)("div",{ref:j,className:(0,m.cn)("flex gap-3 pt-4",eR?"flex-col":"flex-row items-center justify-between"),children:[(0,l.jsx)("div",{className:(0,m.cn)("w-full",!eR&&"min-w-0 flex-1"),children:(0,l.jsx)("div",{className:"w-full",children:(0,l.jsx)(P,{model:W,feature:M,params:q,onModelChange:e=>{let t=(0,f.$p)(e),n=ex(t,M,q);_(t),Y(n)},onFeatureChange:e=>{let t=(0,f.Cn)(W,e),n=ex(t,e,q);t!==W&&_(t),D(e),Y(n)},onParamsChange:e=>Y(t=>({...t,...e})),onPremiumGate:()=>{ey(),en(!0)},compact:eR,onDesktopWidthChange:K})})}),eN&&(0,l.jsx)("button",{type:"button",onPointerDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation(),ev()},className:(0,m.cn)("absolute top-3 right-3 z-20 inline-flex h-11 w-11 touch-manipulation items-center justify-center rounded-full select-none sm:top-4 sm:right-4 sm:h-8 sm:w-8","border border-white/10 bg-white/[0.04] text-white/55","pointer-events-auto transition-all duration-200 hover:border-white/20 hover:bg-white/[0.08] hover:text-white active:scale-95"),"aria-label":"Clear prompt and uploads",title:"Clear prompt and uploads",children:(0,l.jsx)(s.A,{className:"pointer-events-none h-4 w-4"})}),(0,l.jsxs)("div",{className:(0,m.cn)("flex h-9 items-center justify-between gap-2",eR?"w-full":"w-auto justify-end"),children:[(0,l.jsx)("div",{className:"block",children:(0,l.jsx)("div",{className:"flex flex-col items-end gap-[2px]",children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-[2px] text-xs leading-none text-[rgba(255,255,255,0.4)]",children:[ee," Credits"]})})}),(0,l.jsx)("button",{type:"submit","aria-label":Q||J?"Generating content":"Submit prompt",className:(0,m.cn)("flex h-9 w-9 items-center justify-center rounded-full transition-all duration-300",!k.trim()||Q||J?"curs
1or-not-allowed bg-white/10 text-white/20":"bg-white text-black hover:bg-white/90"),disabled:!k.trim()||Q||J,children:(0,l.jsx)(i.N,{mode:"wait",children:Q||J?(0,l.jsx)(o.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:(0,l.jsx)(d.A,{className:"h-4 w-4 animate-spin"})},"spinner"):(0,l.jsx)(o.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:(0,l.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("path",{d:"M12 19V5"}),(0,l.jsx)("path",{d:"M5 12l7-7 7 7"})]})},"arrow")})})]})]}),(0,l.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute top-0 left-0 -z-10 h-0 overflow-hidden opacity-0",children:(0,l.jsxs)("div",{ref:y,className:"inline-flex items-center gap-2 whitespace-nowrap",children:[(0,l.jsx)("div",{className:"block",children:(0,l.jsx)("div",{className:"flex flex-col items-end gap-[2px]",children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-[2px] text-xs leading-none text-[rgba(255,255,255,0.4)]",children:[ee," Credits"]})})}),(0,l.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-full"})]})}),ek&&(0,l.jsx)("div",{className:(0,m.cn)("mt-3 rounded-2xl border border-amber-400/20 bg-amber-500/8 px-4 py-3","text-sm leading-6 text-amber-100/88"),children:w("seedance_v2_notice")})]})})})}),(0,l.jsx)(i.N,{children:!Z&&A&&(0,l.jsx)(ec,{onSelectIdea:e=>{var t,n,l;ey(),R(e.value);let r=e.model?(0,f.$p)(e.model):W,a=null!=(t=e.feature)?t:M,i=(0,f.Cn)(r,a),o={...ex(i,a,q),...null!=(n=e.params)?n:{}};i!==W&&_(i),a!==M&&D(a),Y(o),z(null!=(l=e.presetMedia)?l:[])}})}),(0,l.jsx)(i.N,{children:Z&&(0,l.jsx)(eu,{currentTask:Z,onRetry:eg,onContinueWaiting:eh})}),X.length>0&&A&&(0,l.jsx)("div",{className:(0,m.cn)("mx-auto mt-4 w-full max-w-[980px]","rounded-2xl bg-[#151515]/70 backdrop-blur-xl","border border-white/5","px-4 py-3 md:px-6"),children:(0,l.jsx)(em,{tasks:X,onSelect:ef})}),et&&(0,l.jsx)(ed,{open:et,onOpenChange:en})]})}let eg=ep},39040:(e,t,n)=>{n.d(t,{$Y:()=>i,Dv:()=>d,GB:()=>x,KM:()=>s,Vf:()=>f,XK:()=>r,e1:()=>a,f5:()=>o,iT:()=>h,qb:()=>u,sZ:()=>m,tL:()=>g,tT:()=>p,zB:()=>c});var l=n(28500);let r=(0,l.sK)("image-to-video").length>0,a=(0,l.sK)("frames-to-video").length>0,i=(0,l.sK)("reference-to-video").length>0,o=(0,l.sK)("video-to-video").length>
10,s=(0,l.sK)("extend-video").length>0,d="bg-[linear-gradient(0deg,rgba(255,255,255,0.06),rgba(255,255,255,0.06)),linear-gradient(0deg,rgba(0,0,0,0.04),rgba(0,0,0,0.04))]",c="bg-[#1a1a1a]",u="bg-[#2a2d33]",m="bg-[#202329]",p=[{label:"Wan",logo:"/imgs/logos/wan.webp",models:[{value:"wan-2.7",label:"Wan 2.7",badge:"NEW",logo:"/imgs/logos/wan.webp"},{value:"wan-2.6",label:"Wan 2.6",logo:"/imgs/logos/wan.webp"},{value:"wan-2.5-preview",label:"Wan 2.5 Preview",logo:"/imgs/logos/wan.webp"},{value:"wan-2.7-image",label:"Wan 2.7 Image",badge:"NEW",logo:"/imgs/logos/wan.webp"}]},{label:"xAI",logo:"/imgs/logos/grok.webp",models:[{value:"grok-imagine-image",label:"Grok Imagine Image",badge:"NEW",logo:"/imgs/logos/grok.webp"},{value:"grok-imagine-video",label:"Grok Imagine Video",badge:"NEW",logo:"/imgs/logos/grok.webp"},{value:"grok-imagine-video-1.5-preview",label:"Grok Imagine Video 1.5",badge:"NEW",logo:"/imgs/logos/grok.webp"}]},{label:"Google",logo:"/imgs/logos/google.webp",models:[{value:"gemini-omni-video",label:"Gemini Omni Video",badge:"NEW",logo:"/imgs/logos/google.webp"},{value:"nano-banana",label:"Nano Banana",badge:"NEW",logo:"/imgs/logos/google.webp"},{value:"nano-banana-2",label:"Nano Banana 2",badge:"NEW",logo:"/imgs/logos/google.webp"},{value:"nano-banana-pro",label:"Nano Banana Pro",badge:"NEW",logo:"/imgs/logos/google.webp"}]},{label:"Seedance",logo:"/imgs/logos/bytedance.webp",models:[{value:"seedance-2.5",label:"Seedance 2.5",badge:"NEW",logo:"/imgs/logos/bytedance.webp"},{value:"seedance-2.0",label:"Seedance 2.0",badge:"NEW",logo:"/imgs/logos/bytedance.webp"},{value:"seedance-2.0-fast",label:"Seedance 2.0 Fast",badge:"HOT",logo:"/imgs/logos/bytedance.webp"},{value:"seedance-2.0-mini",label:"Seedance 2.0 Mini",badge:"NEW",logo:"/imgs/logos/bytedance.webp"},{value:"seedance-1.5-pro",label:"Seedance 1.5 Pro",logo:"/imgs/logos/bytedance.webp"},{value:"seedance-1.0-pro-fast",label:"Seedance 1.0 Pro Fast",logo:"/imgs/logos/bytedance.webp"}]},{label:"Seedream",logo:"/imgs/logos/bytedance.webp",models:[{value:"seedream-5.0-lite",label:"Seedream 5.0 Lite",badge:"NEW",logo:"/imgs/logos/bytedance.webp"},{value:"seedream-4.5",label:"Seedream 4.5",logo:"/imgs/logos/bytedance.webp"},{value:"seedream-4.0",label:"Seedream 4.0",logo:"/imgs/logos/bytedance.webp"}]},{label:"Alibaba",logo:"/imgs/logos/happyhorse-alibaba.jpeg",models:[{value:"happyhorse",label:"HappyHorse 1.0",badge:"NEW",logo:"/imgs/logos/happyhorse-alibaba.jpeg"}]},{label:"Openai",logo:"/imgs/logos/openai.webp",models:[{value:"gpt-image-2-5",label:"GPT Image 2.5",badge:"NEW",logo:"/imgs/logos/openai.webp"},{value:"gpt-image-2",label:"GPT Image 2",badge:"NEW",logo:"/imgs/logos/openai.webp"}]},{label:"Kling",logo:"/imgs/logos/klingai.webp",models:[{value:"kling-3-turbo",label:"Kling 3 Turbo",badge:"NEW",logo:"/imgs/logos/klingai.webp"},{value:"kling-3-pro",label:"Kling 3 Pro",badge:"NEW",logo:"/imgs/logos/klingai.webp"},{value:"kling-3",label:"Kling 3",badge:"NEW",logo:"/imgs/logos/klingai.webp"},{value:"kling-3.0-motion-control",label:"Kling 3.0 Motion Control",badge:"NEW",logo:"/imgs/logos/klingai.webp"}]}];function g(e){for(let t of p){let n=t.models.find(t=>t.value===e);if(null==n?void 0:n.logo)return n.logo}}function h(e){for(let t of p){let n=t.models.find(t=>t.value===e);if(n)return n.label}return e}function f(e){for(let t of p){let n=t.models.find(t=>t.value===e);if(null==n?void 0:n.badge)return n.badge}}function x(e,t){return"reference-to-video"===e?"Reference":"text-to-image"===e?t("text_to_image"):"image-to-image"===e?t("image_to_image"):"text-to-video"===e?t("text_to_video"):"image-to-video"===e?t("image_to_video"):"frames-to-video"===e?t("frame_to_video"):"video-to-video"===e?t("video_to_video"):"extend-v
1ideo"===e?"Extend Video":e}}}]);
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.