1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,855273,e=>{"use strict";let t=(0,e.i(417569).default)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);e.s(["ArrowRight",()=>t],855273)},814891,e=>{"use strict";var t=e.i(243658);async function a(e,t="images"){try{let a=new FormData;a.append("file",e),a.append("folder",t);let s=await fetch("/api/storage/upload",{method:"POST",body:a}),r=await s.json();return{success:!0,...r}}catch(e){return console.error("Image upload error:",e),{success:!1,error:e instanceof Error?e.message:"Upload failed"}}}function s(e,t=10){return e.size<=1024*t*1024}async function r(e,t="images",i=10){return!function(e,t=["image/jpeg","image/png","image/webp","image/gif","image/avif"]){return t.includes(e.type)}(e)?{success:!1,error:"File type not supported. Please upload JPEG, PNG, WebP, GIF, or AVIF images."}:s(e,i)?await a(e,t):{success:!1,error:`File size exceeds ${i}MB limit.`}}function i(e){return["audio/mpeg","audio/mp3","audio/wav","audio/wave","audio/x-wav","audio/ogg","audio/mp4","audio/aac","audio/x-m4a","audio/flac"].includes(e.type)||/\.(mp3|wav|m4a|ogg|aac|flac)$/i.test(e.name)}async function l(e,a="uploads/images",r=10){if(!i(e))throw Error("File type not supported. Please upload MP3, WAV, M4A, OGG, AAC, or FLAC audio files.");if(!s(e,r))throw Error(`File size exceeds ${r}MB limit.`);return await (0,t.uploadFileFromBrowser)(e,a)}e.s(["uploadAudioToR2",()=>l,"uploadImageWithValidation",()=>r,"validateAudioFileType",()=>i,"validateFileSize",()=>s])},831185,e=>{"use strict";let t={TEXT_TO_IMAGE:20,IMAGE_EDIT:20,TEXT_TO_VIDEO_720P_5S:250,TEXT_TO_VIDEO_720P_10S:500,TEXT_TO_VIDEO_1080P_5S:350,TEXT_TO_VIDEO_1080P_10S:700,IMAGE_TO_VIDEO_480P_5S:250,IMAGE_TO_VIDEO_480P_10S:500,IMAGE_TO_VIDEO_720P_5S:250,IMAGE_TO_VIDEO_720P_10S:500,IMAGE_TO_VIDEO_1080P_5S:350,IMAGE_TO_VIDEO_1080P_10S:700,WAN_ANIMATE_480P_PER_5S:140,WAN_ANIMATE_720P_PER_5S:280,INFINITE_TALK_480P_PER_5S:105,INFINITE_TALK_720P_PER_5S:210};function a(e,{resolution:a,duration:s,per:r}){let i=e;return(a&&(i+=`_${a.toUpperCase()}`),s&&(i+=`_${s}S`),r)?Math.ceil(t[i+="_PER_5S"]*Number((r/5).toFixed(2))):t[i]}function s(e,a,s){let r=`${"text-to-video"===s?"TEXT_TO_VIDEO":"IMAGE_TO_VIDEO"}_${e.toUpperCase()}_${a}S`;return console.log("[calculateVideoCredits] Input:",{resolution:e,duration:a,type:s}),console.log("[calculateVideoCredits] Generated key:",r),console.log("[calculateVideoCredits] Credits:",t[r]),t[r]}function r(e,a){let s=Math.ceil(("480p"===e?t.WAN_ANIMATE_480P_PER_5S:t.WAN_ANIMATE_720P_PER_5S)*Number((a/5).toFixed(2)));return console.log("[calculateWanAnimateCredits] Input:",{resolution:e,durationInSeconds:a}),console.log("[calculateWanAnimateCredits] Credits:",s),s}e.s(["WAVESPEED_CREDITS",0,t,"calculateVideoCredits",()=>s,"calculateWanAnimateCredits",()=>r,"wavespeeCredits",()=>a])},853616,e=>{"use strict";var t=e.i(151178);e.s(["Loader2",()=>t.default])},578626,e=>{"use strict";var t=e.i(965848);e.s(["RefreshCw",()=>t.default])},31440,e=>{"use strict";let t=(0,e.i(417569).default)("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);e.s(["Music",()=>t],31440)},639410,e=>{"use strict";let t=(0,e.i(417569).default)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);e.s(["Upload",()=>t],639410)},367692,e=>{"use strict";var t=e.i(352967),a=e.i(341982),s=e.i(527069),r=e.i(291967),i=e.i(188625),l=e.i(352162),n=e.i(575301),o=e.i(950074),d=e.i(898175),c=e.i(607825),u=e.i(6140),m=e.i(408896),p=["PageUp","PageDown"],h=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],x={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},g="Slider",[f,v,j]=(0,m.createCollection)(g),[b,w]=(0,l.createContextScope)(g,[j]),[y,N]=b(g),S=a.forwardRef((e,i)=>{let{name:l,min:o=0,max:d=100,step:c=1,orientation:u="horizontal",disabled:m=!1,minStepsBetweenThumbs:x=0,defaultValue:g=[o],value:v,onValueChange:j=()=>{},onValueCommit:b=()=>{},inverted:w=!1,form:N,...S}=e,C=a.useRef(new Set),k=a.useRef(0),I="horizontal"===u,[_=[],L]=(0,n.useControllableState)({prop:v,defaultProp:g,onChange:e=>{let t=[...C.current];t[k.current]?.focus(),j(e)}}),P=a.useRef(_);function R(e,t,{commit:a}={commit:!1}){let r,i=(String(c).split(".")[1]||"").length,l=Math.round((Math.round((e-o)/c)*c+o)*(r=Math.pow(10,i)))/r,n=(0,s.clamp)(l,[o,d]);L((e=[])=>{let s=function(e=[],t,a){let s=[...e];return s[a]=t,s.sort((e,t)=>
1e-t)}(e,n,t);if(!function(e,t){if(t>0)return Math.min(...e.slice(0,-1).map((t,a)=>e[a+1]-t))>=t;return!0}(s,x*c))return e;{k.current=s.indexOf(n);let t=String(s)!==String(e);return t&&a&&b(s),t?s:e}})}return(0,t.jsx)(y,{scope:e.__scopeSlider,name:l,disabled:m,min:o,max:d,valueIndexToChangeRef:k,thumbs:C.current,values:_,orientation:u,form:N,children:(0,t.jsx)(f.Provider,{scope:e.__scopeSlider,children:(0,t.jsx)(f.Slot,{scope:e.__scopeSlider,children:(0,t.jsx)(I?E:T,{"aria-disabled":m,"data-disabled":m?"":void 0,...S,ref:i,onPointerDown:(0,r.composeEventHandlers)(S.onPointerDown,()=>{m||(P.current=_)}),min:o,max:d,inverted:w,onSlideStart:m?void 0:function(e){let t=function(e,t){if(1===e.length)return 0;let a=e.map(e=>Math.abs(e-t)),s=Math.min(...a);return a.indexOf(s)}(_,e);R(e,t)},onSlideMove:m?void 0:function(e){R(e,k.current)},onSlideEnd:m?void 0:function(){let e=P.current[k.current];_[k.current]!==e&&b(_)},onHomeKeyDown:()=>!m&&R(o,0,{commit:!0}),onEndKeyDown:()=>!m&&R(d,_.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!m){let a=p.includes(e.key)||e.shiftKey&&h.includes(e.key),s=k.current;R(_[s]+c*(a?10:1)*t,s,{commit:!0})}}})})})})});S.displayName=g;var[C,k]=b(g,{startEdge:"left",endEdge:"right",size:"width",direction:1}),E=a.forwardRef((e,s)=>{let{min:r,max:l,dir:n,inverted:d,onSlideStart:c,onSlideMove:u,onSlideEnd:m,onStepKeyDown:p,...h}=e,[g,f]=a.useState(null),v=(0,i.useComposedRefs)(s,e=>f(e)),j=a.useRef(void 0),b=(0,o.useDirection)(n),w="ltr"===b,y=w&&!d||!w&&d;function N(e){let t=j.current||g.getBoundingClientRect(),a=$([0,t.width],y?[r,l]:[l,r]);return j.current=t,a(e-t.left)}return(0,t.jsx)(C,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:(0,t.jsx)(I,{dir:b,"data-orientation":"horizontal",...h,ref:v,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{let t=N(e.clientX);c?.(t)},onSlideMove:e=>{let t=N(e.clientX);u?.(t)},onSlideEnd:()=>{j.current=void 0,m?.()},onStepKeyDown:e=>{let t=x[y?"from-left":"from-right"].includes(e.key);p?.({event:e,direction:t?-1:1})}})})}),T=a.forwardRef((e,s)=>{let{min:r,max:l,inverted:n,onSlideStart:o,onSlideMove:d,onSlideEnd:c,onStepKeyDown:u,...m}=e,p=a.useRef(null),h=(0,i.useComposedRefs)(s,p),g=a.useRef(void 0),f=!n;function v(e){let t=g.current||p.current.getBoundingClientRect(),a=$([0,t.height],f?[l,r]:[r,l]);return g.current=t,a(e-t.top)}return(0,t.jsx)(C,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:(0,t.jsx)(I,{"data-orientation":"vertical",...m,ref:h,style:{...m.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{let t=v(e.clientY);o?.(t)},onSlideMove:e=>{let t=v(e.clientY);d?.(t)},onSlideEnd:()=>{g.current=void 0,c?.()},onStepKeyDown:e=>{let t=x[f?"from-bottom":"from-top"].includes(e.key);u?.({event:e,direction:t?-1:1})}})})}),I=a.forwardRef((e,a)=>{let{__scopeSlider:s,onSlideStart:i,onSlideMove:l,onSlideEnd:n,onHomeKeyDown:o,onEndKeyDown:d,onStepKeyDown:c,...m}=e,x=N(g,s);return(0,t.jsx)(u.Primitive.span,{...m,ref:a,onKeyDown:(0,r.composeEventHandlers)(e.onKeyDown,e=>{"Home"===e.key?(o(e),e.preventDefault()):"End"===e.key?(d(e),e.preventDefault()):p.concat(h).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:(0,r.composeEventHandlers)(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),x.thumbs.has(t)?t.focus():i(e)}),onPointerMove:(0,r.composeEventHandlers)(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&l(e)}),onPointerUp:(0,r.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),n(e))})})}),_="SliderTrack",L=a.forwardRef((e,a)=>{let{__scopeSlider:s,...r}=e,i=N(_,s);return(0,t.jsx)(u.Primitive.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:a})});L.displayName=_;var P="SliderRange",R=a.forwardRef((e,s)=>{let{__scopeSlider:r,...l}=e,n=N(P,r),o=k(P,r),d=a.useRef(null),c=(0,i.useComposedRefs)(s,d),m=n.values.length,p=n.values.map(e=>O(e,n.min,n.max)),h=m>1?Math.min(...p):0,x=100-Math.max(...p);return(0,t.jsx)(u.Primitive.span,{"data-orientation":n.orientation,"data-disabled":n.disabled?"":void 0,...l,ref:c,style:{...e.style,[o.startEdge]:h+"%",[o.endEdge]:x+"%"}})});R.displayName=P;var M="SliderThumb",A=a.forwardRef((e,s)=>{let r=v(e.__scopeSlider),[l,n]=a.useState(null),o=(0,i.useComposedRefs)(s,e=>n(e)),d=a.useMemo(()=>l?r().findIndex(e=>e.ref.current===l):-1,[r,l]);return(0,t.jsx)(D,{...e,ref:o,index:d})}),D=a.forwardRef((e,s)=>{var l,n,o,d,m;let p,h,{__scopeSlider:x,index:g,name:v,...j}=e,b=N(M,x),w=k(M,x),[y,S]=a.useState(null),C=(0,i.useComposedRefs)(s,e=>S(e)),E=!y||b.form||!!y.closest("form"),T=(0,c.useSize)(y),I=b.values[g],_=void 0===I?0:O(I,b.min,b.max),L=(l=g,(n=b.values.length)>2?`Value ${l+1} of ${n}`:2===n?["Minimum","Maximum"][l]:void 0),P=T?.[w.size],R=P?(o=P,d=_,m=w.direction,h=$([0,50],[0,p=o/2]),(p-h(d)*m)*m):0;return a.useEffect(()=>{if(y)return b.thumbs.add(y),()=>{b.thumbs.delete(y)}},[y,b.thumbs]),(0,t.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[w.startEdge]:`calc(${_}% + ${R}px)`},children:[(0,t.jsx)(f.ItemSlot,{scope:e.__scopeSlider,children:(0,t.jsx)(u.Primitive.span,{role:"slider","aria-label":e["aria-label"]||L,"aria-valuemin":b.min,"aria-valuenow":I,"aria-valuemax":b.max,"aria-orientation":b.orientation,"data-orientation":b.orientation,"data-disabled":b.disabled?"":void 0,tabIndex:b.disabled?void 0:0,...j,ref:C,style:void 0===I?{display:"none"}:e.style,onFocus:(0,r.composeEventHandlers)(e.onFocus,()=>{b.valueIndexToChangeRef.current=g})})}),E&&(0,t.jsx)(U,{name:v??(b.name?b.name+(b.values.length>1?"[]":""):void 0),form:b.form,value:I},g)]})});A.displayName=M;var U=a.forwardRef(({__scopeSlider:e,value:s,...r},l)=>{let n=a.useRef(null),o=(0,i.useComposedRefs)(n,l),c=(0,d.usePrevious)(s);return a.useEffect(()=>{let e=n.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(c!==s&&t){let a=new Event("input",{bubbles:!0});t.call(e,s),e.dispatchEvent(a)}},[c,s]),(0,t.jsx)(u.Primitive.input,{style:{display:"none"},...r,ref:o,defaultValue:s})});function O(e,t,a){return(0,s.clamp)(100/(a-t)*(e-t),[0,100])}function $(e,t){return a=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(a-e[0])}}U.displayName="RadioBubbleInput";var F=e.i(975157);function V({className:e,defaultValue:s,value:r,min:i=0,max:l=100,...n}){let o=a.useMemo(()=>Array.isArray(r)?r:Array.isArray(s)?s:[i,l],[r,s,i,l]);return(0,t.jsxs)(S,{"data-slot":"slider",defaultValue:s,value:r,min:i,max:l,className:(0,F.cn)("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e),...n,children:[(0,t.jsx)(L,{"data-slot":"slider-track",className:(0,F.cn)("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:(0,t.jsx)(R,{"data-slot":"slider-range",className:(0,F.cn)("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:o.length},(e,a)=>(0,t.jsx)(A,{"data-slot":"slider-thumb",className:"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},a))]})}e.s(["Slider",()=>V],367692)},613296,e=>{"use strict";var t=e.i(352967),a=e.i(706055),s=e.i(538654),r=e.i(578626),i=e.i(139688),l=e.i(341982);let n=(0,l.forwardRef)(({className:e},n)=>{let o=(0,i.useTranslations)("components.user-credits"),{credits:d,creditsLoading:c,refreshCredits:u}=(0,a.useUnifiedGuestAuth)();return(0,l.useImperativeHandle)(n,()=>({refreshCredits:u})),(0,t.jsxs)("div",{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border border-border/50 rounded-lg text-sm ${e}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(s.Coins,{className:"h-3.5 w-3.5 text-primary"}),(0,t.jsxs)("span",{className:"font-medium text-foreground",children:[(0,t.jsx)("span",{className:"hidden sm:inline",children:o("availableCredits")}),(0,t.jsx)("span",{className:"sm:hidden",children:o("credits")})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"font-bold text-primary",children:c?(0,t.jsx)("span",{className:"animate-pulse",children:(0,t.jsx)("span",{children:"--"})}
1):d?.toLocaleString()||"0"}),(0,t.jsx)("button",{type:"button",onClick:u,disabled:c,className:"p-0.5 hover:bg-muted/50 rounded transition-colors",title:o("refreshBalance"),children:(0,t.jsx)(r.RefreshCw,{className:`h-3 w-3 text-muted-foreground hover:text-foreground ${c?"animate-spin":""}`})})]})]})});n.displayName="UserCredits",e.s(["UserCredits",0,n])},947283,e=>{"use strict";var t=e.i(908982);e.s(["ArrowLeft",()=>t.default])},64163,e=>{"use strict";var t=e.i(271057);e.s(["Settings",()=>t.default])},73420,e=>{"use strict";var t=e.i(540022);e.s(["Zap",()=>t.default])},609199,e=>{"use strict";var t=e.i(352967),a=e.i(975157),s=e.i(227473),r=e.i(341982);function i({children:e,className:i,onClick:l,href:n,disabled:o=!1,fullWidth:d=!1}){let[c,u]=(0,r.useState)([]);(0,r.useEffect)(()=>{u(Array.from({length:20}).map(()=>({size:.5*Math.random()+.25,x:100*Math.random(),y:100*Math.random(),duration:2*Math.random()+1,delay:-2*Math.random()})))},[]);let m=(0,a.cn)("sparkle-button group relative z-10 flex items-center gap-2 whitespace-nowrap rounded-full border-0 px-6 py-3 text-sm font-medium transition-all duration-500 sm:px-7 sm:py-3.5 sm:text-base","overflow-visible",o?"cursor-not-allowed opacity-50":"cursor-pointer",d&&"w-full justify-center",i),p=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"spark pointer-events-none absolute inset-0 z-0 overflow-hidden rounded-full [mask:linear-gradient(white,transparent_50%)]",children:(0,t.jsx)("span",{className:"spark-rotate absolute left-1/2 top-0 aspect-square w-[200%] -translate-x-1/2 -translate-y-[15%] bg-[conic-gradient(from_0deg,transparent_0_340deg,hsl(var(--primary))_360deg)]"})}),(0,t.jsx)("span",{className:"backdrop pointer-events-none absolute inset-[2px] z-[1] rounded-full"}),(0,t.jsxs)("svg",{className:"sparkle relative z-10 h-4 w-4 sm:h-4.5 sm:w-4.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M14.187 8.096L15 5.25L15.813 8.096C16.0231 8.83114 16.4171 9.50062 16.9577 10.0413C17.4984 10.5819 18.1679 10.9759 18.903 11.186L21.75 12L18.904 12.813C18.1689 13.0231 17.4994 13.4171 16.9587 13.9577C16.4181 14.4984 16.0241 15.1679 15.814 15.903L15 18.75L14.187 15.904C13.9769 15.1689 13.5829 14.4994 13.0423 13.9587C12.5016 13.4181 11.8321 13.0241 11.097 12.814L8.25 12L11.096 11.187C11.8311 10.9769 12.5006 10.5829 13.0413 10.0423C13.5819 9.50162 13.9759 8.83214 14.186 8.097L14.187 8.096Z"}),(0,t.jsx)("path",{d:"M6 14.25L5.741 15.285C5.59267 15.8785 5.28579 16.4206 4.85319 16.8532C4.42059 17.2858 3.87853 17.5927 3.285 17.741L2.25 18L3.285 18.259C3.87853 18.4073 4.42059 18.7142 4.85319 19.1468C5.28579 19.5794 5.59267 20.1215 5.741 20.715L6 21.75L6.259 20.715C6.40725 20.1216 6.71398 19.5796 7.14639 19.147C7.5788 18.7144 8.12065 18.4075 8.714 18.259L9.75 18L8.714 17.741C8.12065 17.5925 7.5788 17.2856 7.14639 16.853C6.71398 16.4204 6.40725 15.8784 6.259 15.285L6 14.25Z"}),(0,t.jsx)("path",{d:"M6.5 4L6.303 4.5915C6.24777 4.75718 6.15472 4.90774 6.03123 5.03123C5.90774 5.15472 5.75718 5.24777 5.5915 5.303L5 5.5L5.5915 5.697C5.75718 5.75223 5.90774 5.84528 6.03123 5.96877C6.15472 6.09226 6.24777 6.24282 6.303 6.4085L6.5 7L6.697 6.4085C6.75223 6.24282 6.84528 6.09226 6.96877 5.96877C7.09226 5.84528 7.24282 5.75223 7.4085 5.697L8 5.5L7.4085 5.303C7.24282 5.24777 7.09226 5.15472 6.96877 5.03123C6.84528 4.90774 6.75223 4.75718 6.697 4.5915L6.5 4Z"})]}),(0,t.jsx)("span",{className:"text relative z-10",children:e})]});return(0,t.jsxs)("div",{className:(0,a.cn)("sparkle-wrapper relative",d?"block w-full":"inline-block"),children:[n?(0,t.jsx)(s.default,{href:n,className:m,children:p}):(0,t.jsx)("button",{onClick:l,type:"button",disabled:o,className:m,children:p}),(0,t.jsx)("span",{className:"particle-pen pointer-events-none absolute left-1/2 top-1/2 z-[-1] aspect-square w-[200%] -translate-x-1/2 -translate-y-1/2 [mask:radial-gradient(white,transparent_65%)]","aria-hidden":"true",children:c.map((e,a)=>(0,t.jsx)("svg",{className:"particle absolute",style:{"--size":e.size,"--x":e.x,"--y":e.y,"--duration":e.duration,"--delay":e.delay,width:"calc(var(--size) * 1rem)",left:"calc(var(--x) * 1%)",top:"calc(var(--y) * 1%)"},viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M6.937 3.846L7.75 1L8.563 3.846C8.77313 4.58114 9.1671 5.25062 9.70774 5.79126C10.2484 6.3319 10.9179 6.72587 11.653 6.936L14.5 7.75L11.654 8.563C10.9189 8.77313 10.2494 9.1671 9.70874 9.70774C9.1681 10.2484 8.77413 10.9179 8.564 11.653L7.75 14.5L6.937 11.654C6.72687 10.9189 6.3329 10.2494 5.79226 9.70874C5.25162 9.1681 4.58214 8.77413 3.847 8.564L1 7.75L3.846 6.937C4.58114 6.72687 5.25062 6.3329 5.79126 5.79226C6.3319 5.25162 6.72587 4.58214 6.936 3.847L6.937 3.846Z"})},a))})]})}e.s(["SparkleButton",()=>i])},785496,e=>{"use strict";var t=e.i(794435);e.s(["Video",()=>t.default])},491605,e=>{"use strict";var t=e.i(138278);e.s(["AlertCircle",()=>t.default])},246536,e=>{"use strict";var t=e.i(317369);e.s(["Image",()=>t.default])},326785,e=>{"use strict";var t=e.i(352967),a=e.i(600547);function s({children:e,className:s}){return(0,t.jsxs)("div",{className:`flex items-start gap-2 p-3 rounded-lg bg-blue-500/10 border border-blue-500/20 ${s||""}`,children:[(0,t.jsx)(a.Clock,{className:"h-4 w-4 text-blue-600 dar
1k:text-blue-500 mt-0.5 flex-shrink-0"}),(0,t.jsx)("div",{className:"text-xs text-blue-700 dark:text-blue-400 leading-relaxed",children:e})]})}e.s(["EstimatedTimeNotice",()=>s])},519070,e=>{"use strict";var t=e.i(352967),a=e.i(110204),s=e.i(31440),r=e.i(639410),i=e.i(785496),l=e.i(731310);let n={image:"image/png,image/jpeg,image/jpg,image/webp",audio:"audio/mpeg,audio/mp3,audio/wav,audio/wave,audio/x-wav,audio/ogg,audio/mp4,audio/aac,audio/x-m4a,audio/flac",video:"video/mp4,video/webm,video/quicktime"},o={image:"PNG, JPG, WEBP",audio:"MP3, WAV, OGG, AAC, FLAC",video:"MP4, WEBM, MOV"};function d({type:e,file:d,files:c=[],onChange:u,onFilesChange:m,label:p,description:h,required:x=!1,multiple:g=!1,disabled:f=!1,accept:v,maxSizeMB:j=10,maxFiles:b,uploadText:w,fileTypesText:y,previewSize:N="medium",className:S,warningMessage:C}){let k=`file-upload-${e}-${Date.now()}`,E=v||n[e],T=y||o[e],I=e=>{if(g&&void 0!==e){let t=c.filter((t,a)=>a!==e);m?.(t)}else u?.(null)},_=(()=>{switch(e){case"audio":return s.Music;case"video":return i.Video;default:return r.Upload}})();return g&&c.length,(0,t.jsxs)("div",{className:S,children:[(p||h)&&(0,t.jsxs)("div",{className:"space-y-0.5 mb-3",children:[p&&(0,t.jsxs)(a.Label,{className:"text-sm font-medium",children:[p,x&&(0,t.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),h&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:h})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{id:k,type:"file",accept:E,multiple:g,onChange:e=>{let t=Array.from(e.target.files||[]);if(0!==t.length){if(t.filter(e=>e.size>1024*j*1024).length>0)return void alert(`Some files exceed the maximum size of ${j}MB`);if(g){let e=[...c,...t];b&&e.length>b&&(e=e.slice(0,b)),m?.(e)}else u?.(t[0])}},disabled:f,className:"sr-only"}),(0,t.jsx)("label",{htmlFor:k,className:`group relative flex flex-col items-center justify-center w-full h-24 border-2 border-dashed border-muted-foreground/25 rounded-lg bg-muted/20 hover:bg-muted/30 hover:border-muted-foreground/40 transition-all duration-200 ${f?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:(0,t.jsxs)("div",{className:"flex flex-col items-center space-y-1.5",children:[(0,t.jsx)("div",{className:"p-1.5 rounded-full bg-background/80 group-hover:bg-primary/10 transition-colors",children:(0,t.jsx)(_,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:w||`Click to upload ${e}`}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:[T," (max ",j,"MB)"]})]})]})})]}),g&&"image"===e&&c.length>0&&(0,t.jsxs)("div",{className:"space-y-2 mt-3",children:[(0,t.jsxs)(a.Label,{className:"text-sm font-medium",children:["Uploaded Images (",c.length,b&&` / ${b}`,")"]}),(0,t.jsx)("div",{className:"grid grid-cols-4 gap-3",children:c.map((e,a)=>(0,t.jsxs)("div",{className:"group relative",children:[(0,t.jsx)("img",{src:URL.createObjectURL(e),alt:`Upload ${a+1}`,className:"w-full aspect-square object-cover rounded-lg border border-border/50"}),(0,t.jsx)("button",{type:"button",onClick:()=>I(a),disabled:f,className:"absolute -top-2 -right-2 p-1 bg-destructive text-destructive-foreground rounded-full opacity-0 group-hover:opacity-100 transition-opacity",children:(0,t.jsx)(l.X,{className:"h-3 w-3"})})]},a))})]}),!g&&"image"===e&&d&&(0,t.jsxs)("div",{className:"space-y-2 mt-3",children:[(0,t.jsx)(a.Label,{className:"text-sm font-medium",children:"Uploaded Image"}),(0,t.jsxs)("div",{className:"relative inline-block",children:[(0,t.jsx)("img",{src:URL.createObjectURL(d),alt:"Preview",className:`${(()=>{switch(N){case"small":return"w-24 h-24";case"large":return"w-full h-48";default:return"w-32 h-32"}})()} object-cover rounded-lg border border-border/50`}),(0,t.jsx)("button",{type:"button",onClick:()=>I(),disabled:f,className:"absolute -top-2 -right-2 p-1 bg-destructive text-destructive-foreground rounded-full",children:(0,t.jsx)(l.X,{className:"h-3 w-3"})})]})]}),"audio"===e&&d&&(0,t.jsxs)("div",{className:"space-y-2 mt-3",children:[(0,t.jsx)(a.Label,{className:"text-sm font-medium",children:"Uploaded Audio"}),(0,t.jsxs)("div",{className:"relative inline-block w-full",children:[(0,t.jsxs)("audio",{src:URL.createObjectURL(d),className:"w-full rounded-lg border border-border/50",controls:!0,"aria-label":`Uploaded audio preview: ${d.name}`,children:[(0,t.jsx)("track",{kind:"captions"}),"Your browser does not support the audio element."]}),(0,t.jsx)("button",{type:"button",onClick:()=>I(),disabled:f,className:"absolute -top-2 -right-2 p-1 bg-destructive text-destructive-foreground rounded-full",children:(0,t.jsx)(l.X,{className:"h-3 w-3"})})]})]}),"video"===e&&d&&(0,t.jsxs)("div",{className:"space-y-2 mt-3",children:[(0,t.jsx)(a.Label,{className:"text-sm font-medium",children:"Uploaded Video"}),(0,t.jsxs)("div",{className:"relative inline-block w-full",children:[(0,t.jsxs)("video",{src:URL.createObjectURL(d),className:"w-full rounded-lg border border-border/50",controls:!0,"aria-label":`Uploaded video preview: ${d.name}`,children:[(0,t.jsx)("track",{kind:"captions"}),"Your browser does not support the video element."]}),(0,t.jsx)("button",{type:"button",onClick:()=>I(),disabled:f,className:"absolute -top-2 -right-2 p-1 bg-destructive text-destructive-foreground rounded-full",children:(0,t.jsx)(l.X,{className:"h-3 w-3"})})]})]}),C&&(0,t.jsx)("div",{className:"mt-3 flex items-start gap-2 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:(0,t.jsx)("div",{className:"text-xs text-amber-700 dark:text-amber-400 leading-relaxed",children:C})})]})}e.s(["FileUpload",()=>d])},64283,e=>{"use strict";var t=e.i(352967),a=e.i(110204),s=e.i(624687);function r({id:e,value:r,onChange:i,label:l,required:n=!1,placeholder:o,maxLength:d=2e3,rows:c=4,disabled:u=!1,showCharCount:m=!0,formatCharCount:p=(e,t)=>`${e} / ${t}`,className:h,textareaClassName:x}){return(0,t.jsxs)("div",{className:h,children:[l&&(0,t.jsx)("div",{className:"space-y-0.5 mb-2",children:(0,t.jsxs)(a.Label,{htmlFor:e,className:"text-sm font-medium",children:[l,n&&(0,t.jsx)("span",{className:"text-destructive ml-1",children:"*"})]})}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(s.Textarea,{id:e,placeholder:o,value:r,onChange:e=>i(e.target.value),rows:c,maxLength:d,disabled:u,className:`resize-none min-h-[100px] text-sm leading-relaxed ${x||""}`}),m&&d&&(0,t.jsx)("div",{className:"absolute bottom-3 right-3 text-xs text-muted-foreground
1/70 bg-background/80 px-2 py-1 rounded",children:p(r.length,d)})]})]})}e.s(["PromptTextarea",()=>r])},296665,659837,e=>{"use strict";var t=e.i(352967),a=e.i(139688),s=e.i(341982);let r={"text-to-image":[{id:"1",url:"/girl/1.jpeg",promptKey:"prompts.textToImage.1",type:"image"},{id:"2",url:"/girl/2.jpeg",promptKey:"prompts.textToImage.2",type:"image"},{id:"3",url:"/girl/3.jpeg",promptKey:"prompts.textToImage.3",type:"image"},{id:"4",url:"/girl/4.jpeg",promptKey:"prompts.textToImage.4",type:"image"}],"image-edit":[{id:"5",url:"/girl/5.jpeg",promptKey:"prompts.imageEdit.5",type:"image"},{id:"6",url:"/girl/6.jpeg",promptKey:"prompts.imageEdit.6",type:"image"},{id:"7",url:"/girl/7.jpeg",promptKey:"prompts.imageEdit.7",type:"image"},{id:"8",url:"/girl/8.jpeg",promptKey:"prompts.imageEdit.8",type:"image"}],"text-to-video":[{id:"9",url:"https://d2p7pge43lyniu.cloudfront.net/output/54032357-93f8-4ba3-9eb8-87235d1eb966-u1_3bb5c7dc-4915-43c1-8bf1-d4cdb036fb1d.mp4",promptKey:"prompts.textToVideo.9",type:"video"},{id:"10",url:"https://video.twimg.com/amplify_video/1971367116629811201/vid/avc1/480x636/gQwRBqOb3u1shl-h.mp4",promptKey:"prompts.textToVideo.10",type:"video"},{id:"11",url:"https://d2p7pge43lyniu.cloudfront.net/output/ed337b92-bfd6-4737-bb0b-71cfe48fdede-u1_897ee6d1-2e79-4cd9-91f7-51d1094a619d.mp4",promptKey:"prompts.textToVideo.11",type:"video"},{id:"12",url:"https://d2p7pge43lyniu.cloudfront.net/output/8fac6f12-d600-4509-bcad-675f174d1acf-u1_40ae306e-798f-4c7b-bc5d-326976faa197.mp4",promptKey:"prompts.textToVideo.12",type:"video"}],"image-to-video":[{id:"13",url:"https://d2p7pge43lyniu.cloudfront.net/output/54032357-93f8-4ba3-9eb8-87235d1eb966-u1_3bb5c7dc-4915-43c1-8bf1-d4cdb036fb1d.mp4",promptKey:"prompts.imageToVideo.13",type:"video"},{id:"14",url:"https://video.twimg.com/amplify_video/1971367116629811201/vid/avc1/480x636/gQwRBqOb3u1shl-h.mp4",promptKey:"prompts.imageToVideo.14",type:"video"},{id:"15",url:"https://d2p7pge43lyniu.cloudfront.net/output/ed337b92-bfd6-4737-bb0b-71cfe48fdede-u1_897ee6d1-2e79-4cd9-91f7-51d1094a619d.mp4",promptKey:"prompts.imageToVideo.15",type:"video"}],"wan-animate":[{id:"19",url:"https://d2p7pge43lyniu.cloudfront.net/output/d090edcf-7123-463d-957a-d1d94208f538-u2_06864010-5093-43e3-98da-542a9d5ad5d3.mp4",prompt:"preserve outfit; natural expression; no background changes.",type:"video"},{id:"20",url:"https://d2p7pge43lyniu.cloudfront.net/output/2d4e2f0b-41c3-4306-ab9d-7f9c6b3f90d2-u2_9a15ddb2-78c0-42ad-80c7-be8436020048.mp4",prompt:"preserve outfit; natural expression; no background changes.",type:"video"},{id:"21",url:"https://d2p7pge43lyniu.cloudfront.net/output/832221cb-e761-4705-bb7b-a469e055afc9-u2_d8a2f594-0ff9-4d77-99db-3f702498c614.mp4",prompt:"preserve outfit; natural expression; no background changes.",type:"video"}],"infinite-talk":[{id:"22",url:"https://d2p7pge43lyniu.cloudfront.net/output/562827da-5ebd-4d4b-a88b-d1f6724d91b9-u2_6ecd2bf2-e834-4470-82f9-4038bf0ec57f.mp4",prompt:"",type:"video"}]};function i({type:e,className:i}){let l=(0,a.useTranslations)("components.wavespeed-examples"),[n,o]=(0,s.useState)(0),d=r[e]||[],c=d[0]?.type==="video";if((0,s.useEffect)(()=>{o(0)},[e]),(0,s.useEffect)(()=>{if(0===d.length)return;let e=setInterval(()=>{o(e=>(e+1)%d.length)},3e3);return()=>clearInterval(e)},[d.length]),0===d.length)return(0,t.jsx)("div",{className:`border-2 border-dashed border-muted-foreground/25 rounded-lg h-96 flex items-center justify-center ${i}`,children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)("p",{className:"text-lg font-medium text-foreground",children:(0,t.jsx)("span",{children:l("placeholder.title")})}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:(0,t.jsx)("span",{children:l("placeholder.subtitle")})})]})});let u=Math.min(n,d.length-1),m=d[u];return m?(0,t.jsxs)("div",{className:`space-y-4 ${i}`,children:[(0,t.jsx)("div",{className:"relative overflow-hidden rounded-lg border border-border/50 bg-muted/20",children:(0,t.jsxs)("div",{className:"aspect-square relative",children:[c?(0,t.jsx)("video",{src:m.url,className:"w-full h-full object-cover",autoPlay:!0,muted:!0,loop:!0,playsInl
1ine:!0},m.id):(0,t.jsx)("img",{src:m.url,alt:m?.promptKey?l(m.promptKey):m?.prompt,className:"w-full h-full object-cover transition-opacity duration-500"},m.id),(0,t.jsx)("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/60 to-transparent p-4",children:(0,t.jsx)("p",{className:"text-white text-sm font-medium leading-relaxed",children:(0,t.jsxs)("span",{children:['"',m?.promptKey?l(m.promptKey):m?.prompt,'"']})})})]})}),(0,t.jsx)("div",{className:"flex items-center justify-center space-x-2",children:d.map((e,a)=>(0,t.jsx)("button",{type:"button",onClick:()=>o(a),className:`w-2 h-2 rounded-full transition-all duration-200 ${a===u?"bg-primary scale-125":"bg-muted-foreground/30 hover:bg-muted-foreground/50"}`},a))}),(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-pulse"}),(0,t.jsx)("p",{className:"text-sm font-medium text-primary",children:(0,t.jsx)("span",{children:l("gallery.title")})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,t.jsx)("span",{children:l("gallery.subtitle",{type:l(`types.${e}`)})})})]})]}):(0,t.jsx)("div",{className:`border-2 border-dashed border-muted-foreground/25 rounded-lg h-96 flex items-center justify-center ${i}`,children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)("p",{className:"text-lg font-medium text-foreground",children:(0,t.jsx)("span",{children:l("placeholder.title")})}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:(0,t.jsx)("span",{children:l("placeholder.subtitle")})})]})})}e.s(["WaveSpeedExamples",()=>i],296665);var l=e.i(110204);function n({value:e,onChange:a,options:s,label:r,disabled:i=!1,columns:n=2,className:o}){return(0,t.jsxs)("div",{className:o,children:[r&&(0,t.jsx)(l.Label,{className:"mb-2 block text-sm font-medium",children:r}),(0,t.jsx)("div",{className:`grid gap-2 ${{2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"}[n]}`,children:s.map(s=>(0,t.jsx)("button",{type:"button",onClick:()=>a(s.value),disabled:i||s.disabled,className:`px-3 py-2 text-sm font-medium rounded-lg border transition-colors ${e===s.value?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted border-border"} disabled:opacity-50 disabled:cursor-not-allowed`,children:s.label},String(s.value)))})]})}e.s(["ButtonGroupNative",()=>n],659837)},17534,692209,e=>{"use strict";var t=e.i(724847);e.s(["ChevronDown",()=>t.default],17534);var a=e.i(447443);e.s(["ChevronUp",()=>a.default],692209)},564849,e=>{"use strict";var t=e.i(352967),a=e.i(519455),s=e.i(17534),r=e.i(692209),i=e.i(341982);function l({title:e,icon:l,children:n,defaultOpen:o=!1,open:d,onOpenChange:c,className:u,contentClassName:m}){let[p,h]=(0,i.useState)(o),x=void 0!==d,g=x?d:p;return(0,t.jsxs)("div",{className:`space-y-4 ${u||""}`,children:[(0,t.jsxs)(a.Button,{type:"button",variant:"ghost",onClick:()=>{x?c?.(!d):h(!p)},className:"w-full justify-between h-auto p-3 text-sm",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l,(0,t.jsx)("span",{children:e})]}),g?(0,t.jsx)(r.ChevronUp,{className:"h-4 w-4"}):(0,t.jsx)(s.ChevronDown,{className:"h-4 w-4"})]}),g&&(0,t.jsx)("div",{className:`space-y-4 p-4 border rounded-lg bg-muted/50 ${m||""}`,children:n})]})}e.s(["CollapsibleSection",()=>l])},709798,913426,e=>{"use strict";var t=e.i(352967),a=e.i(519455),s=e.i(396489),r=e.i(110204),i=e.i(367692),l=e.i(417569);let n=(0,l.default)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),o=(0,l.default)("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),d=(0,l.default)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),c=(0,l.default)("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);var u=e.i(139688),m=e.i(341982);function p({sourceImageUrl:e,onMaskChange:l,triggerText:p,disabled:h=!1}){let x=(0,u.useTranslations)("components.form.maskEditor"),g=(0,m.useRef)(null),f=(0,m.useRef)(null),v=(0,m.useRef)(null),j=(0,m.useRef)(null),b=(0,m.useRef)([]),w=(0,m.useRef)([]),[y,N]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),[k,E]=(0,m.useState)(40),[T,I]=(0,m.useState)({width:0,height:0}),[_,L]=(0,m.useState)(null),[P,R]=(0,m.useState)(!1),[M,A]=(0,m.useState)(!1);(0,m.useEffect)(()=>
1{if(!y||!e)return;let t=new Image;t.crossOrigin="anonymous",t.onload=()=>{v.current=t,I({width:t.width,height:t.height});let e=f.current;if(e){e.width=t.width,e.height=t.height;let a=e.getContext("2d");a&&(a.clearRect(0,0,t.width,t.height),b.current=[a.getImageData(0,0,t.width,t.height)],w.current=[],R(!1),A(!1))}},t.src=e},[y,e]);let D=()=>{if(S){let e=f.current;if(e){let t=e.getContext("2d");if(t){let e=t.getImageData(0,0,T.width,T.height);b.current.push(e),w.current=[],R(b.current.length>1),A(!1)}}}C(!1),j.current=null};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(a.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>N(!0),disabled:h,children:[(0,t.jsx)(n,{className:"h-4 w-4 mr-2"}),p||x("editMask")]}),_&&(0,t.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,t.jsx)(r.Label,{className:"text-sm text-muted-foreground",children:x("maskPreview")}),(0,t.jsx)("div",{className:"relative border border-border rounded-lg overflow-hidden bg-muted/20 w-32 h-32",children:(0,t.jsx)("img",{src:_,alt:"Mask Preview",className:"w-full h-full object-cover"})})]}),(0,t.jsx)(s.Dialog,{open:y,onOpenChange:N,children:(0,t.jsxs)(s.DialogContent,{className:"max-w-4xl max-h-[90vh] overflow-hidden",children:[(0,t.jsxs)("div",{className:"space-y-4 overflow-y-auto",children:[(0,t.jsxs)("div",{ref:g,className:"relative border border-border rounded-lg overflow-hidden bg-muted/20",style:{aspectRatio:`${T.width||1} / ${T.height||1}`},children:[v.current&&(0,t.jsx)("img",{src:e,alt:"Background",className:"absolute inset-0 w-full h-full object-contain",style:{pointerEvents:"none"}}),(0,t.jsx)("canvas",{ref:f,className:"absolute inset-0 w-full h-full cursor-crosshair",onMouseDown:e=>{let t=f.current;if(!t)return;let a=t.getBoundingClientRect(),s=T.width/a.width,r=T.height/a.height,i=(e.clientX-a.left)*s,l=(e.clientY-a.top)*r;C(!0),j.current={x:i,y:l};let n=t.getContext("2d");n&&(n.globalCompositeOperation="source-over",n.fillStyle="#ffffff",n.beginPath(),n.arc(i,l,k/2,0,2*Math.PI),n.fill())},onMouseMove:e=>{if(!S)return;let t=f.current;if(!t)return;let a=t.getContext("2d");if(!a)return;let s=t.getBoundingClientRect(),r=T.width/s.width,i=T.height/s.height,l=(e.clientX-s.left)*r,n=(e.clientY-s.top)*i;j.current&&(a.globalCompositeOperation="source-over",a.strokeStyle="#ffffff",a.lineWidth=k,a.lineCap="round",a.lineJoin="round",a.beginPath(),a.moveTo(j.current.x,j.current.y),a.lineTo(l,n),a.stroke()),j.current={x:l,y:n}},onMouseUp:D,onMouseLeave:D,style:{touchAction:"none"}})]}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground p-2 bg-muted/30 rounded-lg",children:(0,t.jsx)("p",{children:x("tip")})})]}),(0,t.jsxs)(s.DialogFooter,{className:"flex-col sm:flex-row gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,t.jsxs)(r.Label,{className:"text-sm text-muted-foreground",children:[x("brushSize"),": ",k,"px"]}),(0,t.jsx)(i.Slider,{value:[k],onValueChange:e=>E(e[0]),min:10,max:100,step:5,className:"w-full"})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)(a.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>{if(b.current.length<=1)return;let e=f.current;if(!e)return;let t=e.getContext("2d");if(!t)return;let a=b.current.pop();a&&w.current.push(a);let s=b.current[b.current.length-1];s&&t.putImageData(s,0,0),R(b.current.length>1),A(w.current.length>0)},disabled:!P,children:[(0,t.jsx)(c,{className:"h-4 w-4 mr-2"}),x("undo")]}),(0,t.jsxs)(a.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>{if(0===w.current.length)return;let e=f.current;if(!e)return;let t=e.getContext("2d");if(!t)return;let a=w.current.pop();a&&(b.current.push(a),t.putImageData(a,0,0)),R(b.current.length>1),A(w.current.length>0)},disabled:!M,children:[(0,t.jsx)(o,{className:"h-4 w-4 mr-2"}),x("redo")]}),(0,t.jsxs)(a.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>{let e=f.current;if(!e)return;let t=e.getContext("2d");t&&(t.clearRect(0,0,T.width,T.height),b.current=[t.getImageData(0,0,T.width,T.height)],w.current=[],R(!1),A(!1))},children:[(0,t.jsx)(d,{className:"h-4 w-4 mr-2"}),x("clear")]}),(0,t.jsx)(a.Button,{type:"button",size:"sm",onClick:()=>{let e=f.current;if(!e)return;let t=document.createElement("canvas");t.width=T.width,t.height=T.height;let a=t.getContext("2d");a&&(a.fillStyle="#000000",a.fillRect(0,0,T.width,T.height),a.drawImage(e,0,0),t.toBlob(e=>{if(e){_&&URL.revokeObjectURL(_);let t=URL.createObjectURL(e);L(t),l?.(e,t),N(!1)}},"image/png"))},children:x("confirm")})]})]})]})})]})}e.s(["MaskImageEditor",()=>p],913426),e.s([],709798)},726129,e=>{"use strict";var t=e.i(352967),a=e.i(110204),s=e.i(699375);
1function r({id:e,label:r,description:i,checked:l,onChange:n,disabled:o=!1,className:d}){return(0,t.jsxs)("div",{className:`flex items-center justify-between ${d||""}`,children:[(0,t.jsxs)("div",{className:"space-y-0.5",children:[(0,t.jsx)(a.Label,{htmlFor:e,className:"text-sm",children:r}),i&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:i})]}),(0,t.jsx)(s.Switch,{id:e,checked:l,onCheckedChange:n,disabled:o})]})}e.s(["SwitchField",()=>r])},395555,e=>{"use strict";var t=e.i(352967),a=e.i(659837),s=e.i(564849),r=e.i(326785),i=e.i(519070);e.i(709798);var l=e.i(913426),n=e.i(64283),o=e.i(726129),d=e.i(515288),c=e.i(793479),u=e.i(110204),m=e.i(967489),p=e.i(609199),h=e.i(677572),x=e.i(613296),g=e.i(144159),f=e.i(170933),v=e.i(831185),j=e.i(600547);let b=(0,e.i(417569).default)("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);var w=e.i(246536),y=e.i(853616),N=e.i(31440),S=e.i(64163),C=e.i(785496),k=e.i(139688),E=e.i(341982),T=e.i(779342);let I={"text-to-image":"/api/ai/image/wavespeed/text-to-image","image-edit":"/api/ai/image/wavespeed/image-edit","text-to-video":"/api/ai/video/wavespeed/text-to-vi
1deo","image-to-video":"/api/ai/video/wavespeed/image-to-video","wan-animate":"/api/ai/video/wavespeed/wan-animate","infinite-talk":"/api/ai/video/wavespeed/Infinite-talk"};function _({type:e,onGenerate:_,onError:L,onGenerationStart:P,onGenerationEnd:R,className:M}){let A=(0,k.useTranslations)("components.wavespeed-generator"),D={"text-to-image":{title:A("textToImage.title"),description:A("textToImage.description"),icon:w.Image},"image-edit":{title:A("imageEdit.title"),description:A("imageEdit.description"),icon:b},"text-to-video":{title:A("textToVideo.title"),description:A("textToVideo.description"),icon:C.Video},"image-to-video":{title:A("imageToVideo.title"),description:A("imageToVideo.description"),icon:C.Video},"wan-animate":{title:"Wan Animate",description:"Character animation and replacement with Wan 2.2",icon:C.Video},"infinite-talk":{title:"Infinite Talk",description:"AI-powered talking character generation with voice sync",icon:N.Music}},[U,O]=(0,E.useState)(!1),[$,F]=(0,E.useState)(""),[V,z]=(0,E.useState)(""),[G,B]=(0,E.useState)(""),[W,K]=(0,E.useState)(!1),[q,H]=(0,E.useState)(-1),[X,Y]=(0,E.useState)(!1),[Z,J]=(0,E.useState)(0),[Q,ee]=(0,E.useState)(0),{requireCredits:et}=(0,g.usePaymentModal)(),ea=(0,E.useRef)(null),{hasAccess:es}=(0,f.useSubscriptionAccess)();(0,E.useEffect)(()=>{if(Z>0){let e=()=>{let t=Math.max(0,5e3-(Date.now()-Z));ee(Math.ceil(t/1e3)),t>0&&setTimeout(e,100)};e()}},[Z]);let[er,ei]=(0,E.useState)("image-edit"===e?"2048*2048":"1024*1024"),[el,en]=(0,E.useState)([]),[eo,ed]=(0,E.useState)([]),[ec,eu]=(0,E.useState)("1280*720"),[em,ep]=(0,E.useState)("720p"),[eh,ex]=(0,E.useState)(5),[eg,ef]=(0,E.useState)(null),[ev,ej]=(0,E.useState)(null),[eb,ew]=(0,E.useState)(null),[ey,eN]=(0,E.useState)(null),[eS,eC]=(0,E.useState)(null),[ek,eE]=(0,E.useState)("animate"),[eT,eI]=(0,E.useState)("480p"),[e_,eL]=(0,E.useState)(5),[eP,eR]=(0,E.useState)(null),[eM,eA]=(0,E.useState)(null),[eD,eU]=(0,E.useState)(null),[eO,e$]=(0,E.useState)(null),[eF,eV]=(0,E.useState)("480p"),[ez,eG]=(0,E.useState)(5),[eB,eW]=(0,E.useState)(null),eK=D[e],eq=eK?.icon,eH=()=>{switch(e){case"text-to-image":default:return v.WAVESPEED_CREDITS.TEXT_TO_IMAGE;case"image-edit":return v.WAVESPEED_CREDITS.IMAGE_EDIT;case"text-to-video":{let e=ec.includes("1920")||ec.includes("1080")?"1080p":"720p";return(0,v.calculateVideoCredits)(e,eh,"text-to-video")}case"image-to-video":return(0,v.calculateVideoCredits)(em,eh,"image-to-video");case"wan-animate":return(0,v.calculateWanAnimateCredits)(eT,e_);case"infinite-talk":return Math.ceil(("480p"===eF?v.WAVESPEED_CREDITS.INFINITE_TALK_480P_PER_5S:v.WAVESPEED_CREDITS.INFINITE_TALK_720P_PER_5S)*Number((ez/5).toFixed(2)))}},eX=async()=>{if("wan-animate"!==e&&"infinite-talk"!==e){if(!V.trim())return void T.toast.error(A("toast.enterPrompt"))}else if("wan-animate"===e){if(!eb)return void T.toast.error("Please upload a character image");if(!ey)return void T.toast.error("Please upload a motion video")}else if("infinite-talk"===e){if(!eP)return void T.toast.error("Please upload a character image");if(!eD)return void T.toast.error("Please upload an audio file")}let t=Date.now();if(t-Z<5e3){let e=Math.ceil((5e3-(t-Z))/1e3);T.toast.warning(A("toast.waitBeforeGenerating",{seconds:e}));return}U?T.toast.warning(A("toast.alreadyInProgress")):(J(t),eY())},eY=async()=>{if(U)return void console.warn("[WaveSpeed Generator] Execution blocked: already generating");if(O(!0),console.log("[WaveSpeed Generator] Starting generation for type:",e),!es){let t="text-to-video"===e||"image-to-video"===e,a=t?240:60;et(0,{context:{source:"generation-delay",feature:A("payment.skipWaitTime"),customTitle:A("payment.skipWaitTime"),customDescription:t?A("payment.skipWaitTimeDescriptionVideo"):A("payment.skipWaitTimeDescriptionImage")},onSuccess:()=>{P?.(!1)}}),P?.(!0,a),await new Promise(e=>setTimeout(e,1e3*a))}P?.(!1);try{let t={prompt:V.trim(),negative_prompt:G.trim()||void 0,enable_prompt_expansion:W,seed:-1===q?-1:q};switch(e){case"text-to-image":t.size=er;break;case"image-edit":if(0===eo.length)return void T.toast.error(A("toast.uploadImages"));try{t.images=await eZ(eo)}catch(e){T.toast.error(A("toast.imageUploadFailed"));return}t.size=er,t.enable_sync_mode=!1,t.enable_base64_output=!1;break;
1case"text-to-video":if(t.size=ec,t.duration=eh,eg)try{t.audio=await eJ(eg)}catch(e){T.toast.error(A("toast.audioUploadFailed"));return}break;case"image-to-video":if(!ev)return void T.toast.error(A("toast.uploadImage"));try{t.image=(await eZ([ev]))[0]}catch(e){T.toast.error(A("toast.imageUploadFailed"));return}if(t.resolution=em,t.duration=eh,eg)try{t.audio=await eJ(eg)}catch(e){T.toast.error(A("toast.audioUploadFailed"));return}break;case"wan-animate":if(!eb)return void T.toast.error("Please upload a character image");if(!ey)return void T.toast.error("Please upload a motion video");try{t.image=(await eZ([eb]))[0]}catch(e){T.toast.error(A("toast.imageUploadFailed"));return}try{t.video=await eJ(ey)}catch(e){T.toast.error("Video upload failed");return}t.mode=ek,t.resolution=eT,t.videoDuration=e_;break;case"infinite-talk":if(!eP)return void T.toast.error("Please upload a character image");if(!eD)return void T.toast.error("Please upload an audio file");try{t.image=(await eZ([eP]))[0]}catch(e){T.toast.error(A("toast.imageUploadFailed"));return}try{t.audio=await eJ(eD)}catch(e){T.toast.error(A("toast.audioUploadFailed"));return}if(eB)try{let e=new File([eB],"mask.png",{type:"image/png"});t.maskImage=(await eZ([e]))[0]}catch(e){T.toast.error("Mask image upload failed");return}t.resolution=eF,t.duration=ez}console.log(`[${e}] Sending request to:`,I[e]),console.log(`[${e}] Request body:`,JSON.stringify(t,null,2));let a=await fetch(I[e],{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});console.log(`[${e}] Response status:`,a.status);let s=await a.json();if(!a.ok){if(401===a.status)return void et(eH(),{context:{source:"wavespeed-generator",feature:eK.title,customTitle:`Generate ${eK.title}`,customDescription:A("auth.loginRequired")}});if(402===a.status){let e=eH();et(e,{context:{source:"wavespeed-generator",feature:eK.title,customTitle:`Generate ${eK.title}`,customDescription:A("auth.insufficientCredits",{credits:e,feature:eK.title.toLowerCase()})},onSuccess:()=>{O(!1),setTimeout(()=>{eY()},100)}});return}throw Error(s.error||`Request failed: ${a.status}`)}if(s.success&&s.taskId){F(A("status.taskSubmitted"));let t=await eQ(s.taskId,e);if(t.success)T.toast.success(A("toast.generationSuccess")),ea.current?.refreshCredits(),_?.(t);else{let e={error:t.error||"Generation failed",code:"GENERATION_FAILED"};L?.(e);return}}else throw Error(s.error||"Generation failed")}catch(t){console.error("Generation error:",t);let e=t instanceof Error?t.message:"Generation failed";T.toast.error(e),L?.({error:e,code:"GENERATION_ERROR"})}finally{O(!1),F(""),R?.()}},eZ=async e=>Promise.all(e.map(async e=>{let t=new FormData;t.append("file",e),t.append("folder","wavespeed/uploads");let a=await fetch("/api/storage/upload",{method:"POST",body:t});if(!a.ok)throw Error(`File upload failed: ${a.statusText}`);return(await a.json()).url})),eJ=async e=>{let t=new FormData;t.append("file",e),t.append("folder","wavespeed/audio");let a=await fetch("/api/storage/upload",{method:"POST",body:t});if(!a.ok)throw Error(`Audio upload failed: ${a.statusText}`);return(await a.json()).url},eQ=async(t,a)=>{let s=Date.now();for(let r=0;r<60;r++)try{F(A("generate.progress",{current:r+1,total:60}));let i=await fetch(`${I[e]}?taskId=${t}`,{method:"GET"});if(!i.ok)throw Error(`Status check failed: ${i.status}`);let l=await i.json();if(console.log(`[${a}] Status check ${r+1}:`,l),"completed"===l.status)return{success:!0,taskId:t,creditsUsed:0,message:"Generation completed",status:"completed",urls:l.urls||[],metadata:{generationTime:(r+1)*5e3,modelVersion:"alibaba-wan-2.5",provider:"wavespeed"}};if("failed"===l.status){let e=l.error||"Generation failed";return e=e.includes("Content flagged as potentially sensitive")?A("toast.contentFlagged"):e.includes("insufficient credits")?A("toast.insufficientCredits"):e.includes("timeout")?A("toast.generationTimeout"):A("toast.generationFailed",{error:e}),{success:!1,error:e,taskId:t,status:"failed",urls:[],creditsUsed:0,message:"Task failed",metadata:{generationTime:Date.now()-s,modelVersion:"unknown",provider:"wavespeed"}}}r<59&&await new Promise(e=>setTimeout(e,5e3))}catch(e){if(console.error(`[${a}] Status check error:`,e),59===r)throw e;await new Promise(e=>setTimeout(e,5e3))}throw Error("Generation timeout, please check results later")};return(0,t.jsxs)(d.Card,{className:`${M}
1 border-border/50 shadow-lg`,children:[(0,t.jsx)(d.CardHeader,{className:"pb-3 px-4",children:(0,t.jsx)("div",{className:"flex items-start justify-between",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"p-1.5 rounded-lg bg-gradient-to-br from-primary/10 to-primary/5 border border-primary/10",children:(0,t.jsx)(eq,{className:"h-4 w-4 text-primary"})}),(0,t.jsx)("div",{children:(0,t.jsx)(d.CardTitle,{className:"text-base font-semibold text-foreground",children:(0,t.jsx)("span",{children:eK.title})})})]})})}),(0,t.jsxs)(d.CardContent,{className:"space-y-4 px-4 pt-1 pb-4",children:["image-edit"===e&&(0,t.jsx)(i.FileUpload,{type:"image",files:eo,onFilesChange:e=>{ed(e),en(e.map(e=>URL.createObjectURL(e)))},label:A("imageUpload.uploadImages"),uploadText:A("imageUpload.clickToUploadImages"),multiple:!0,maxFiles:10}),"image-to-video"===e&&(0,t.jsx)(i.FileUpload,{type:"image",file:ev,onChange:ej,label:A("imageUpload.uploadImage"),uploadText:A("imageUpload.clickToUploadImage"),previewSize:"small"}),"wan-animate"===e&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(i.FileUpload,{type:"image",file:eb,onChange:ew,label:"Character Image",description:"Upload a character image to animate",required:!0,uploadText:"Click to upload character image",previewSize:"small"}),(0,t.jsx)(i.FileUpload,{type:"video",file:ey,onChange:e=>{if(eN(e),e){let t=URL.createObjectURL(e);eC(t);let a=document.createElement("video");a.preload="metadata",a.onloadedmetadata=()=>{eL(Math.floor(a.duration)),URL.revokeObjectURL(t)},a.src=t}else eC(null),eL(5)},label:"Motion Video",description:"Upload a video showing the desired motion (max 120s)",required:!0,uploadText:"Click to upload motion video",maxSizeMB:100}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-2.5",children:[(0,t.jsx)(a.ButtonGroupNative,{label:"Mode",value:ek,onChange:eE,options:[{value:"animate",label:"Animate"},{value:"replace",label:"Replace"}],className:"space-y-2"}),(0,t.jsx)(a.ButtonGroupNative,{label:"Resolution",value:eT,onChange:eI,options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"}],className:"space-y-2"})]}),(0,t.jsx)(n.PromptTextarea,{id:"wan-prompt",label:(0,t.jsxs)(t.Fragment,{children:["Additional Prompt"," ",(0,t.jsx)("span",{className:"text-muted-foreground",children:"(Optional)"})]}),value:V,onChange:z,placeholder:"Additional description for the animation (optional)",maxLength:500,rows:3})]}),"infinite-talk"===e&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(i.FileUpload,{type:"image",file:eP,onChange:e=>{eR(e),e?eA(URL.createObjectURL(e)):(eA(null),eW(null))},label:"Character Image",description:"Upload a character image for talking animation",required:!0,uploadText:"Click to upload character image",previewSize:"small"}),(0,t.jsx)(i.FileUpload,{type:"audio",file:eD,onChange:e=>{if(eU(e),e){let t=URL.createObjectURL(e);e$(t);let a=new Audio;a.preload="metadata",a.onloadedmetadata=()=>{eG(Math.floor(a.duration)),URL.revokeObjectURL(t)},a.src=t}else e$(null),eG(5)},label:"Voice Audio",description:"Upload audio for lip-sync animation (max 600s)",required:!0,uploadText:"Click to upload voice audio",maxSizeMB:50}),(0,t.jsx)(a.ButtonGroupNative,{label:"Resolution",value:eF,onChange:eV,options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"}],className:"space-y-2"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(u.Label,{children:["Mask Image"," ",(0,t.jsx)("span",{className:"text-muted-foreground",children:"(Optional)"})]}),(0,t.jsx)(l.MaskImageEditor,{sourceImageUrl:eM||"",onMaskChange:(e,t)=>
1eW(e),triggerText:"Create Mask",disabled:!eM})]}),(0,t.jsx)(n.PromptTextarea,{id:"infinite-talk-prompt",label:(0,t.jsxs)(t.Fragment,{children:["Additional Prompt"," ",(0,t.jsx)("span",{className:"text-muted-foreground",children:"(Optional)"})]}),value:V,onChange:z,placeholder:"Additional description for the animation (optional)",maxLength:500,rows:3})]}),"wan-animate"!==e&&"infinite-talk"!==e&&(0,t.jsx)(n.PromptTextarea,{id:"prompt",label:A("prompt.label"),value:V,onChange:z,placeholder:A("prompt.placeholder"),maxLength:2e3,rows:4,required:!0,formatCharCount:(e,t)=>A("prompt.charCount",{current:e,max:t}),className:"space-y-3"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-2.5",children:[("text-to-image"===e||"image-edit"===e)&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"space-y-0.5",children:(0,t.jsx)(u.Label,{className:"text-sm font-medium",children:(0,t.jsx)("span",{children:A("imageDimensions.label")})})}),(0,t.jsxs)(m.Select,{value:er,onValueChange:ei,children:[(0,t.jsx)(m.SelectTrigger,{className:"h-9",children:(0,t.jsx)(m.SelectValue,{})}),(0,t.jsx)(m.SelectContent,{children:"image-edit"===e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.SelectItem,{value:"2048*2048",children:(0,t.jsx)("span",{children:A("imageDimensions.square2048")})}),(0,t.jsx)(m.SelectItem,{value:"1024*1024",children:(0,t.jsx)("span",{children:A("imageDimensions.square1024")})}),(0,t.jsx)(m.SelectItem,{value:"2048*1536",children:(0,t.jsx)("span",{children:A("imageDimensions.landscape2048")})}),(0,t.jsx)(m.SelectItem,{value:"1536*2048",children:(0,t.jsx)("span",{children:A("imageDimensions.portrait2048")})}),(0,t.jsx)(m.SelectItem,{value:"4096*2048",children:(0,t.jsx)("span",{children:A("imageDimensions.ultraWide")})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.SelectItem,{value:"768*768",children:(0,t.jsx)("span",{children:A("imageDimensions.square768")})}),(0,t.jsx)(m.SelectItem,{value:"1024*1024",children:(0,t.jsx)("span",{children:A("imageDimensions.square1024")})}),(0,t.jsx)(m.SelectItem,{value:"1440*1440",children:(0,t.jsx)("span",{children:A("imageDimensions.square1440")})}),(0,t.jsx)(m.SelectItem,{value:"1280*720",children:(0,t.jsx)("span",{children:A("imageDimensions.landscape1280")})}),(0,t.jsx)(m.SelectItem,{value:"720*1280",children:(0,t.jsx)("span",{children:A("imageDimensions.portrait720")})}),(0,t.jsx)(m.SelectItem,{value:"1440*810",children:(0,t.jsx)("span",{children:A("imageDimensions.wide1440")})}),(0,t.jsx)(m.SelectItem,{value:"810*1440",children:(0,t.jsx)("span",{children:A("imageDimensions.tall810")})})]})})]})]}),"text-to-video"===e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2 w-full",children:[(0,t.jsx)(u.Label,{className:"text-sm font-medium",children:(0,t.jsx)("span",{children:A("videoSettings.videoSize")})}),(0,t.jsxs)(m.Select,{value:ec,onValueChange:eu,children:[(0,t.jsx)(m.SelectTrigger,{className:"h-9",children:(0,t.jsx)(m.SelectValue,{})}),(0,t.jsxs)(m.SelectContent,{children:[(0,t.jsx)(m.SelectItem,{value:"1280*720",children:(0,t.jsx)("span",{children:A("videoSettings.size1280")})}),(0,t.jsx)(m.SelectItem,{value:"720*1280",children:(0,t.jsx)("span",{children:A("videoSettings.size720")})}),(0,t.jsx)(m.SelectItem,{value:"1920*1080",children:(0,t.jsx)("span",{children:A("videoSettings.size1920")})}),(0,t.jsx)(m.SelectItem,{value:"1080*1920",children:(0,t.jsx)("span",{children:A("videoSettings.size1080")})})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2 w-full",children:[(0,t.jsx)(u.Label,{className:"text-sm font-medium",children:(0,t.jsx)("span",{children:A("videoSettings.duration")})}),(0,t.jsx)(h.Tabs,{value:eh.toString(),onValueChange:e=>ex(Number.parseInt(e)),children:(0,t.jsxs)(h.TabsList,{className:"grid w-full grid-cols-2",children:[(0,t.jsx)(h.TabsTrigger,{value:"5",children:A("videoSettings.5s")}),(0,t.jsx)(h.TabsTrigger,{value:"10",children:A("videoSettings.10s")})]})})]})]}),"image-to-video"===e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.ButtonGroupNative,{label:A("videoSettings.resolution"),value:em,onChange:ep,options:[{value:"720p",label:A("videoSettings.720p")},{value:"1080p",label:A("videoSettings.1080p")}],className:"space-y-2"}),(0,t.jsx)(a.ButtonGroupNative,{label:A("videoSettings.duration"),value:String(eh),onChange:e=>ex(Number(e)),options:[{value:"5",label:A("videoSettings.5s")},{value:"10",label:A("videoSettings.10s")}],className:"space-y-2"})]})]}
1),("text-to-video"===e||"image-to-video"===e)&&(0,t.jsx)(i.FileUpload,{type:"audio",file:eg,onChange:ef,label:A("audio.label"),uploadText:A("audio.addBackground"),maxSizeMB:50}),(0,t.jsxs)(s.CollapsibleSection,{title:A("advanced.title"),icon:(0,t.jsx)(S.Settings,{className:"h-4 w-4"}),open:X,onOpenChange:Y,children:[(0,t.jsx)(o.SwitchField,{id:"prompt-expansion",label:(0,t.jsx)("span",{children:A("advanced.promptEnhancement")}),description:(0,t.jsx)("span",{children:A("advanced.promptEnhancementDesc")}),checked:W,onChange:K}),(0,t.jsx)(n.PromptTextarea,{id:"negative-prompt",label:A("advanced.negativePrompt"),value:G,onChange:B,placeholder:A("advanced.negativePromptPlaceholder"),maxLength:500,rows:2}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(u.Label,{htmlFor:"seed",className:"text-sm",children:(0,t.jsx)("span",{children:A("advanced.seed")})}),(0,t.jsx)(c.Input,{id:"seed",type:"number",placeholder:A("advanced.seedPlaceholder"),value:-1===q?"":q,onChange:e=>H(e.target.value?Number.parseInt(e.target.value):-1),min:-1,max:0x7fffffff,className:"text-sm"})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-2.5",children:[(0,t.jsx)(x.UserCredits,{ref:ea}),("text-to-video"===e||"image-to-video"===e)&&(0,t.jsx)(r.EstimatedTimeNotice,{children:(0,t.jsx)("span",{children:A("estimatedTime.label",{minutes:"3-5"})})})]}),(0,t.jsx)(p.SparkleButton,{onClick:eX,disabled:U||"wan-animate"!==e&&"infinite-talk"!==e&&!V.trim()||"wan-animate"===e&&(!eb||!ey)||"infinite-talk"===e&&(!eP||!eD)||Date.now()-Z<5e3,fullWidth:!0,className:"h-12 text-base font-semibold",children:U?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),(0,t.jsx)("span",{children:$||A("generate.generating")})]}):Q>0?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Clock,{className:"mr-2 h-4 w-4"}),(0,t.jsx)("span",{children:A("generate.wait",{seconds:Q})})]}):(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("span",{children:A("generate.button",{credits:eH()})})})})]})]})}e.s(["WaveSpeedGenerator",()=>_],395555)},759339,e=>{"use strict";var t=e.i(352967),a=e.i(600547),s=e.i(853616),r=e.i(342024),i=e.i(139688),l=e.i(341982);function n({type:e,isDelaying:n=!1,delaySeconds:o=0,className:d,estimatedSeconds:c}){let u=(0,i.useTranslations)("components.wavespeed-loading"),[m,p]=(0,l.useState)(o),[h,x]=(0,l.useState)(0),g="text-to-video"===e||"image-to-video"===e||"wan-animate"===e||"infinite-talk"===e,f=c??(g?300:30);(0,l.useEffect)(()=>{if(n&&m>0){let e=setInterval(()=>{p(e=>e-1)},1e3);return()=>clearInterval(e)}},[n,m]),(0,l.useEffect)(()=>{if(!n&&h<f){let e=setInterval(()=>{x(e=>e+1)},1e3);return()=>clearInterval(e)}},[n,h,f]);let v=e=>{let t=Math.floor(e/60),a=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}`:`${a}s`};return(0,t.jsx)("div",{className:`border-2 border-dashed border-primary/25 rounded-lg h-96 flex items-center justify-center bg-primary/5 ${d}`,children:(0,t.jsxs)("div",{className:"text-center space-y-6 max-w-sm mx-auto px-6",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"mx-auto w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center",children:n?(0,t.jsx)(a.Clock,{className:"h-10 w-10 text-primary animate-pulse"}):(0,t.jsx)(s.Loader2,{className:"h-10 w-10 text-primary animate-spin"})}),(0,t.jsx)("div",{className:"absolute -top-2 -right-2",children:(0,t.jsx)(r.Sparkles,{className:"h-6 w-6 text-primary animate-pulse"})})]}),(0,t.jsx)("div",{className:"space-y-3",children:n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:(0,t.jsx)("span",{children:u("preparing.title",{type:u(g?"type.video":"type.image")})})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:(0,t.jsx)("span",{children:u("preparing.startInLabel")})}),(0,t.jsx)("div",{className:"text-2xl font-bold text-primary",children:v(m)}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,t.jsx)("span",{children:u("preparing.freeUserTip")})})]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:(0,t.jsx)("span",{children:u("generating.title",{type:u(g?"type.video":"type.image")})})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:(0,t.jsx)("span",{children:u("generating.processingTip")})}),(0,t.jsxs)("div",{className:"text-sm text-muted-foreground",children:[v(h)," / ~",v(f)]}),(0,t.jsxs)("div",{className:"flex items-center justify-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-bounce"}),(0,t.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,t.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})]})]})}),(0,t.jsx)("div",{className:"w-full bg-muted/50 rounded-full h-2",children:(0,t.jsx)("div",{className:"bg-primary h-2 rounded-full transition-all duration-1000 ease-out",style:{width:n?`${(o-m)/o*100}%`:`${Math.min(h/f*100,90)}%`}})})]})})}e.s(["WaveSpeedLoading",()=>n])},71411,e=>{"use strict";var t=e.i(391614);e.s(["CheckCircle",()=>t.default])},281671,e=>{"use strict";var t=e.i(352967),a=e.i(487486),s=e.i(519455),r=e.i(515288),i=e.i(772436),l=e.i(491605),n=e.i(71411),o=e.i(600547),d=e.i(489180),c=e.i(246536),u=e.i(853616),m=e.i(785496),p=e.i(73420),h=e.i(139688),x=e.i(341982),g=e.i(779342);function f({result:e,type:f,className:v}){let j=(0,h.useTranslations)("components.wavespeed-result"),[b,w]=(0,x.useState)(null),y=f.includes("video")||"wan-animate"===f||"infinite-talk"===f,N="completed"===e.status,S=e.urls&&e.urls.length>0,C=async(t,a)=>{w(a);try{let s=await fetch(t),r=await s.blob(),i=window.URL.createObjectURL(r),l=document.createElement("a");l.href=i,l.download=`wan25ai-${f}-${e.taskId}-${a+1}.${y?"mp4":"png"}`,document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(i),g.toast.success(j("toast.downloadStarted"))}catch(e){console.error("Download error:",e),g.toast.error(j("toast.downloadFailed"))}finally{w(null)}};return(0,t.jsxs)(r.Card,{className:v,children:[(0,t.jsx)(r.CardHeader,{children:(0,t.jsxs)(r.CardTitle,{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[y?(0,t.jsx)(m.Video,{className:"h-5 w-5"}):(0,t.jsx)(c.Image,{className:"h-5 w-5"}),(0,t.jsx)("span",{children:j("title")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(()=>{switch(e.status){case"completed":return(0,t.jsx)(n.CheckCircle,{className:"h-4 w-4 text-green-500"});case"failed":return(0,t.jsx)(l.AlertCircle,{className:"h-4 w-4 text-red-500"});case"processing":return(0,t.jsx)(u.Loader2,{className:"h-4 w-4 animate-spin text-blue-500"});default:return(0,t.jsx)(o.Clock,{className:"h-4 w-4 text-gray-500"})}})(),(0,t.jsx)(a.Badge,{variant:"outline",className:(()=>{switch(e.status){case"completed":return"bg-green-500";case"failed":return"bg-red-500";case"processing":return"bg-blue-500";default:return"bg-gray-500"}})(),children:(0,t.jsx)("span",{children:(()=>{switch(e.status){case"completed":return j("status.completed");case"failed":return j("status.failed");case"processing":return j("status.processing");case"created":return j("status.created");default:return j("status.unknown")}})()})})]})]})}),(0,t.jsxs)(r.CardContent,{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:(0,t.jsx)("span",{children:j("taskInfo.taskId")})}),(0,t.jsx)("p",{className:"text-muted-foreground font-mono text-xs mt-1",children:e.taskId})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:(0,t.jsx)("span",{children:j("taskInfo.creditsUsed")})}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-1 flex items-center gap-1",children:[(0,t.jsx)(p.Zap,{className:"h-3 w-3"}),e.creditsUsed]})]}),e.metadata?.generationTime&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:(0,t.jsx)("span",{children:j("taskInfo.generationTime")})}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-1 flex items-center gap-1",children:[(0,t.jsx)(o.Clock,{className:"h-3 w-3"}),(e=>{let t=Math.round(e/1e3);if(t<60)return`${t}s`;let a=Math.floor(t/60);return`${a}m ${t%60}s`})(e.metadata.generationTime)]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:(0,t.jsx)("span",{children:j("taskInfo.modelVersion")})}),(0,t.jsx)("p",{className:"text-muted-foreground mt-1",children:e.metadata?.modelVersion||j("taskInfo.na")})]})]}),(0,t.jsx)(i.Separator,{}),!N&&(0,t.jsxs)("div",{className:"text-center py-8",children:[(0,t.jsx)(u.Loader2,{className:"h-8 w-8 animate-spin mx-auto mb-4 text-blue-500"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:(0,t.jsx)("span",{children:e.message||j("messages.generatingWait")})})]}),N&&!S&&(0,t.jsxs)("div",{className:"text-center py-8",children:[(0,t.jsx)(l.AlertCircle,{className:"h-8 w-8 mx-auto mb-4 text-red-500"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:(0,t.jsx)("span",{children:j("messages.noResults")})})]}),N&&S&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h4",{className:"font-medium",children:(0,t.jsx)("span",{children:j(y?"results.generatedVideos":"results.generatedImages",{count:e.urls.length})})}),(0,t.jsx)("div",{className:"grid gap-4",children:e.urls.map((e,a)=>(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"aspect-video not-dark:bg-gray-100 flex items-center justify-center",children:y?(0,t.jsxs)("video",{src:e,controls:!0,className:"w-full h-full object-contain",preload:"metadata","aria-label":j("results.videoLabel",{index:a+1}),children:[(0,t.jsx)("track",{kind:"captions"}),(0,t.jsx)("span",{children:j("results.videoNotSupported")})]}):(0,t.jsx)("img",{src:e,alt:j("results.imageLabel",{index:a+1}),className:"w-full h-full object-contain",onError:e=>{e.currentTarget.src="/placeholder-image.png"}})}),(0,t.jsxs)("div",{className:"p-3 not-dark:bg-gray-50 flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:(0,t.jsx)("span",{children:j(y?"results.itemLabel.video":"results.itemLabel.image",{index:a+1})})}),(0,t.jsx)("div",{className:"flex gap-2",children:(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:()=>C(e,a),disabled:b===a,children:[b===a?(0,t.jsx)(u.Loader2,{className:"h-3 w-3 mr-1 animate-spin"}):(0,t.jsx)(d.Download,{className:"h-3 w-3 mr-1"}),(0,t.jsx)("span",{children:j("actions.download")})]})})]})]},a))})]}),"failed"===e.status&&e.error&&(0,t.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(l.AlertCircle,{className:"h-4 w-4 text-red-500"}),(0,t.jsx)("span",{className:"font-medium text-red-800",children:(0,t.jsx)("span",{children:j("error.title")})})]}),(0,t.jsx)("p",{className:"text-red-700 text-sm",children:e.error})]})]})]})}e.s(["WaveSpeedResult",()=>f])}]);
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.