PageSourceSearch

https://generatemusic.net/_next/static/chunks/b4d6ee1238c77af0.js

js generatemusic.net collected 2026-10-06 12:51:05 UTC 44,465 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,70522,e=>{"use strict";var t,r=e.i(466471),a=e.i(536355),s=e.i(884702);function l(e,t){let r=e.split(","),a=r[0].match(/:(.*?);/)?.[1]||"image/png",s=atob(r[1]),l=s.length,n=new Uint8Array(l);for(;l--;)n[l]=s.charCodeAt(l);return new File([n],t,{type:a})}async function n(e,t){let r=await fetch(e);if(!r.ok)throw Error(`Failed to fetch image: ${r.statusText}`);let a=await r.blob();return new File([a],t,{type:a.type||"image/png"})}function o(e){return"mask"===e?"none":"mask"}var i=e.i(247835);let m=(0,s.createContext)("ai.image.face-swap"),d=m.Provider,c=()=>(0,s.useContext)(m);var u=((t={}).IMAGE_TO_IMAGE="image-to-image",t.EFFECT_TO_IMAGE="effect-to-image",t.EFFECT2IMAGE_TO_IMAGE="effect2image-to-image",t.PROMPT_TO_IMAGE="prompt-to-image",t.EDIT_TO_IMAGE="edit-to-image",t.UPSCALE_TO_IMAGE="upscale-to-image",t);function p(e){return"prompt-to-image"===e.transformationType}function g(e){return"effect2image-to-image"===e.transformationType}let x=1e3,h={maxLength:1500,warningThreshold:.8};u.EFFECT2IMAGE_TO_IMAGE,u.EFFECT2IMAGE_TO_IMAGE,u.EFFECT2IMAGE_TO_IMAGE;var f=e.i(791768),b=e.i(960568);function y(e){let t="string"==typeof e.taskResult?JSON.parse(e.taskResult):e.taskResult||{},r="string"==typeof e.taskInfo?JSON.parse(e.taskInfo):e.taskInfo||{},a=t.resultImageUrl||r.images?.[0]?.imageUrl||null;return{taskId:e.taskId||e.id,status:e.status,resultImageUrl:a,extra:{...r,failureReason:r.failureReason,errorMessage:r.errorMessage},effect:e.scene,prompt:e.prompt}}async function w(e,t){let r=new FormData;r.append("files",e),t&&r.append("storagePath",t);let a=await fetch("/api/storage/upload-image",{method:"POST",body:r});if(!a.ok)throw Error(`Upload failed: ${a.status}`);let s=await a.json();if(0!==s.code)throw Error(s.message||"Upload failed");let l=s.data?.urls?.[0];if(!l)throw Error("Upload succeeded but no URL returned");return l}var v=e.i(103979);let j=e=>{let t,l,n,o,m,d,u,p,g,x,h,f,b,y,w,j,N,_,U,S,C,I,T,L,M,E,F,R,P,D,A,G,O,z,$,B,V,H=(0,a.c)(88),{imageUrl:W,onClose:q}=e,J=c(),X=(0,i.useTranslations)(J),[Y,K]=(0,s.useState)(1),[Q,Z]=(0,s.use
1State)(!1);H[0]===Symbol.for("react.memo_cache_sentinel")?(t={x:0,y:0},H[0]=t):t=H[0];let[ee,et]=(0,s.useState)(t),[er,ea]=(0,s.useState)(!1);H[1]===Symbol.for("react.memo_cache_sentinel")?(l={x:0,y:0},H[1]=l):l=H[1];let[es,el]=(0,s.useState)(l),en=(0,s.useRef)(null);if(H[2]!==q||H[3]!==Y?(n=()=>{let e=e=>{"Escape"===e.key&&q()},t=e=>{if(en.current&&en.current.contains(e.target)){e.preventDefault();let t=Math.max(.1,Math.min(3,Y+(e.deltaY>0?-.2:.2)));K(t),t<=1&&et({x:0,y:0})}};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},o=[q,Y],H[2]=q,H[3]=Y,H[4]=n,H[5]=o):(n=H[4],o=H[5]),(0,s.useEffect)(n,o),!W)return null;H[6]!==W?(m=async()=>{try{let e=await fetch(W),t=await e.blob(),r=URL.createObjectURL(t),a=document.createElement("a");a.href=r,a.download=`face-swap-${Date.now()}.jpg`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r)}catch{window.open(W,"_blank")}},H[6]=W,H[7]=m):m=H[7];let eo=m;H[8]!==Y?(d=()=>K(Math.min(3,Y+.2)),H[8]=Y,H[9]=d):d=H[9];let ei=d;H[10]!==Y?(u=()=>{let e=Math.max(.1,Y-.2);K(e),e<=1&&et({x:0,y:0})},H[10]=Y,H[11]=u):u=H[11];let em=u;H[12]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{K(1),et({x:0,y:0})},H[12]=p):p=H[12];let ed=p;H[13]!==ee.x||H[14]!==ee.y||H[15]!==Y?(g=e=>{Y>1&&(ea(!0),el({x:e.clientX-ee.x,y:e.clientY-ee.y}))},H[13]=ee.x,H[14]=ee.y,H[15]=Y,H[16]=g):g=H[16];let ec=g;H[17]!==es||H[18]!==er||H[19]!==Y?(x=e=>{er&&Y>1&&et({x:e.clientX-es.x,y:e.clientY-es.y})},H[17]=es,H[18]=er,H[19]=Y,H[20]=x):x=H[20];let eu=x;H[21]===Symbol.for("react.memo_cache_sentinel")?(h=()=>ea(!1),H[21]=h):h=H[21];let ep=h,eg=Y>1;H[22]!==X?(f=X("preview.title"),H[22]=X,H[23]=f):f=H[23],H[24]!==f?(b=(0,r.jsx)("div",{className:"bg-card/80 backdrop-blur-sm text-foreground px-4 py-2 rounded-lg border border-border pointer-events-auto",children:(0,r.jsx)("h3",{className:"font-medium",children:f})}),H[24]=f,H[25]=b):b=H[25];let ex=Y<=.1;H[26]===Symbol.for("react.memo_cache_sentinel")?(y=(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM13 10H7"})}),H[26]=y):y=H[26],H[27]!==em||H[28]!==ex?(w=(0,r.jsx)("button",{onClick:em,disabled:ex,className:"w-8 h-8 hover:bg-card/80 rounded-full flex items-center justify-center text-foreground transition-all duration-200 disabled:opacity-50",children:y}),H[27]=em,H[28]=ex,H[29]=w):w=H[29],H[30]!==Y?(j=Math.round(100*Y),H[30]=Y,H[31]=j):j=H[31],H[32]!==j?(N=(0,r.jsxs)("span",{className:"px-2 text-sm text-foreground font-mono",children:[j,"%"]}),H[32]=j,H[33]=N):N=H[33];let eh=Y>=3;H[34]===Symbol.for("react.memo_cache_sentinel")?(_=(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"})}),H[34]=_):_=H[34],H[35]!==ei||H[36]!==eh?(U=(0,r.jsx)("button",{onClick:ei,disabled:eh,className:"w-8 h-8 hover:bg-card/80 rounded-full flex items-center justify-center text-foreground transition-all duration-200 disabled:opacity-50",children:_}),H[35]=ei,H[36]=eh,H[37]=U):U=H[37],H[38]!==Y?(S=1!==Y&&(0,r.jsx)("button",{onClick:ed,className:"w-8 h-8 hover:bg-card/80 rounded-full flex items-center justify-center text-foreground transition-all duration-200 ml-1",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),H[38]=Y,H[39]=S):S=H[39],H[40]!==w||H[41]!==N||H[42]!==U||H[43]!==S?(C=(0,r.jsxs)("div",{className:"flex items-center gap-1 bg-card/60 backdrop-blur-sm rounded-full border border-border",children:[w,N,U,S]}),H[40]=w,H[41]=N,H[42]=U,H[43]=S,H[44]=C):C=H[44],H[45]===Symbol.for("react.memo_cache_sentinel")?(I=(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})}),H[45]=I):I=H[45],H[46]!==q?(T=(0,r.jsx)("button",{onClick:q,className:"w-10 h-10 bg-card/60 backdrop-blur-sm hover:bg-destructive rounded-full flex items-center justify-center text-foreground hover:text-destructive-foreground transition-all duration-200 border border-border",children:I}),H[46]=q,H[47]=T):T=H[47],H[48]!==C||H[49]!==T?(L=(0,r.jsxs)("div",{className:"flex items-center gap-2 pointer-events-auto",children:[C,T]}),H[48]=C,H[49]=T,H[50]=L):L=H[50],H[51]!==b||H[52]!==L?(M=(0,r.jsxs)("div",{className:"absolute top-4 left-4 right-4 flex items-center justify-between z-20 pointer-events-none",children:[b,L]}),H[51]=b,H[52]=L,H[53]=M):M=H[53],H[54]!==Q?(E=!Q&&(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,r.jsx)("div",{className:"w-8 h-8 border-2 border-muted-foreground
1/30 border-t-foreground rounded-full animate-spin"})}),H[54]=Q,H[55]=E):E=H[55];let ef=`translate(${ee.x}px, ${ee.y}px) scale(${Y})`,eb=eg?er?"grabbing":"grab":"zoom-in";H[56]!==ef||H[57]!==eb?(F={transform:ef,cursor:eb},H[56]=ef,H[57]=eb,H[58]=F):F=H[58],H[59]!==ei||H[60]!==Y?(R=()=>1===Y&&ei(),H[59]=ei,H[60]=Y,H[61]=R):R=H[61];let ey=`rounded-lg shadow-2xl max-w-full max-h-full object-contain select-none ${!Q?"opacity-0":"opacity-100"}`;return H[62]===Symbol.for("react.memo_cache_sentinel")?(P=()=>Z(!0),H[62]=P):P=H[62],H[63]!==W||H[64]!==ey?(D=(0,r.jsx)(v.default,{src:W,alt:"Preview",width:800,height:600,className:ey,onLoad:P,draggable:!1}),H[63]=W,H[64]=ey,H[65]=D):D=H[65],H[66]!==ec||H[67]!==F||H[68]!==R||H[69]!==D?(A=(0,r.jsx)("div",{className:"transition-transform duration-200",style:F,onMouseDown:ec,onClick:R,children:D}),H[66]=ec,H[67]=F,H[68]=R,H[69]=D,H[70]=A):A=H[70],H[71]!==eu||H[72]!==E||H[73]!==A?(G=(0,r.jsxs)("div",{ref:en,className:"relative flex items-center justify-center h-[80vh] overflow-hidden",onMouseMove:eu,onMouseUp:ep,onMouseLeave:ep,children:[E,A]}),H[71]=eu,H[72]=E,H[73]=A,H[74]=G):G=H[74],H[75]===Symbol.for("react.memo_cache_sentinel")?(O=(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),H[75]=O):O=H[75],H[76]!==X?(z=X("preview.download"),H[76]=X,H[77]=z):z=H[77],H[78]!==eo||H[79]!==z?($=(0,r.jsx)("div",{className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 flex items-center gap-3",children:(0,r.jsxs)("button",{onClick:eo,className:"flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-primary to-accent hover:from-primary/90 hover:to-accent/90 text-primary-foreground rounded-lg transition-all duration-200 shadow-lg backdrop-blur-sm",children:[O,z]})}),H[78]=eo,H[79]=z,H[80]=$):$=H[80],H[81]!==M||H[82]!==G||H[83]!==$?(B=(0,r.jsxs)("div",{className:"relative max-w-6xl max-h-full w-full",onClick:k,children:[M,G,$]}),H[81]=M,H[82]=G,H[83]=$,H[84]=B):B=H[84],H[85]!==q||H[86]!==B?(V=(0,r.jsx)("div",{className:"fixed inset-0 bg-background/95 dark:bg-background/90 flex items-center justify-center z-50 p-4 backdrop-blur-sm",onClick:q,children:B}),H[85]=q,H[86]=B,H[87]=V):V=H[87],V};function k(e){return e.stopPropagation()}let N=e=>{let t,l,n,o,m,d,u,p,g,x,h=(0,a.c)(27),{onImageSelect:f,imageUrl:b,onClear:y,title:w,description:j}=e,[k,N]=(0,s.useState)(!1),_=c(),U=(0,i.useTranslations)(_);h[0]!==f?(t=e=>{let t=function(e,t=24){return["image/jpeg","image/jpg","image/png","image/webp"].includes(e.type)?e.size>1024*t*1024?{isValid:!1,errorType:"size",message:`File too large. Maximum size is ${t}MB.`}:{isValid:!0,errorType:null,message:null}:{isValid:!1,errorType:"format",message:"Unsupported file format. Please use JPEG, PNG, or WebP."}}(e);if(!t.isValid)return void alert(t.message||"Invalid file");let r=new FileReader;r.onload=t=>f(e,t.target?.result),r.readAsDataURL(e)},h[0]=f,h[1]=t):t=h[1];let S=t;h[2]!==S?(l=e=>{e.target.files?.[0]&&S(e.target.files[0])},h[2]=S,h[3]=l):l=h[3];let C=l;h[4]!==S?(n=e=>{e.preventDefault(),e.stopPropagation(),N(!1),e.dataTransfer.files?.[0]&&S(e.dataTransfer.files[0])},h[4]=S,h[5]=n):n=h[5];let I=n;h[6]===Symbol.for("react.memo_cache_sentinel")?(o=e=>{e.preventDefault(),e.stopPropagation(),N(!0)},h[6]=o):o=h[6];let T=o;h[7]===Symbol.for("react.memo_cache_sentinel")?(m=e=>{e.preventDefault(),e.stopPropagation(),N(!1)},h[7]=m):m=h[7];let L=m;h[8]!==w?(d=w.replace(/\s+/g,"-").toLowerCase(),h[8]=w,h[9]=d):d=h[9];let M=`file-upload-${d}`;h[10]!==w?(u=(0,r.jsx)("h3",{className:"text-xs sm:text-sm font-semibold text-foreground",children:w}),h[10]=w,h[11]=u):u=h[11];let E=`relative w-full aspect-square bg-muted rounded-lg flex items-center justify-center transition-colors duration-200 select-none ${k?"outline-dashed outline-2 outline-primary bg-primary/10":""} ${b?"p-0":"p-2 sm:p-3 md:p-4 border-2 border-dashed border-border"}`;return h[12]!==j||h[13]!==C||h[14]!==b||h[15]!==M||h[16]!==y||h[17]!==U||h[18]!==w?(p=b?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(v.default,{src:b,alt:w,fill:!0,className:"object-contain rounded-lg"}),(0,r.jsx)("button",{onClick:y,className:"absolute top-1.5 sm:top-2 right-1.5 sm:right-2 z-10 p-0.5 sm:p-1 bg-background/80 backdrop-blur-sm rounded-full text-foreground hover:bg-destructive hover:text-destructive-foreground transition-colors active:scale-95","aria-label":`Remove ${w} image`,children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 sm:h-5 sm:w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}):(0,r.jsxs)("label",{htmlFor:M,className:"flex flex-col items-center justify-center text-muted-foreground cursor-pointer w-full h-full text-center px-2",children:[(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 sm:h-7 sm:w-7 md:h-8 md:w-8 mb-1 sm:mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.158 0h.008v.008h-.008V8.25z"})}),(0,r.jsx)("p",{className:"mb-0.5 sm:mb-1 text-[10px] sm:text-xs font-semibold text-foreground",children:U("uploader.clickToUpload")}),(0,r.jsx)("p",{className:"text-[9px] sm:text-[10px] md:text-xs leading-tight",children:j}),(0,r.jsx)("input",{id:M,type:"file",className:"hidden",onChange:C,accept:".jpeg,.jpg,.png,.webp"})]}),h[12]=j,h[13]=C,h[14]=b,h[15]=M,h[16]=y,h[17]=U,h[18]=w,h[19]=p):p=h[19],h[20]!==I||h[21]!==E||h[22]!==p?(g=(0,r.jsx)("div",{onDrop:I,onDragOver:T,onDragLeave:L,className:E,
1children:p}),h[20]=I,h[21]=E,h[22]=p,h[23]=g):g=h[23],h[24]!==g||h[25]!==u?(x=(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 sm:gap-2",children:[u,g]}),h[24]=g,h[25]=u,h[26]=x):x=h[26],x},_=e=>{let t,s,l,n,o,m,d,u=(0,a.c)(27),{onPrimarySelect:p,onSecondarySelect:g,primaryImageUrl:x,secondaryImageUrl:h,onClearPrimary:f,onClearSecondary:b,primaryTitle:y,primaryDescription:w,secondaryTitle:v,secondaryDescription:j}=e,k=c(),_=(0,i.useTranslations)(k);return u[0]!==y||u[1]!==_?(t=y??_("uploader.targetImage"),u[0]=y,u[1]=_,u[2]=t):t=u[2],u[3]!==w||u[4]!==_?(s=w??_("uploader.targetDescription"),u[3]=w,u[4]=_,u[5]=s):s=u[5],u[6]!==f||u[7]!==p||u[8]!==x||u[9]!==t||u[10]!==s?(l=(0,r.jsx)(N,{title:t,description:s,imageUrl:x,onImageSelect:p,onClear:f}),u[6]=f,u[7]=p,u[8]=x,u[9]=t,u[10]=s,u[11]=l):l=u[11],u[12]!==v||u[13]!==_?(n=v??_("uploader.faceImage"),u[12]=v,u[13]=_,u[14]=n):n=u[14],u[15]!==j||u[16]!==_?(o=j??_("uploader.faceDescription"),u[15]=j,u[16]=_,u[17]=o):o=u[17],u[18]!==b||u[19]!==g||u[20]!==h||u[21]!==n||u[22]!==o?(m=(0,r.jsx)(N,{title:n,description:o,imageUrl:h,onImageSelect:g,onClear:b}),u[18]=b,u[19]=g,u[20]=h,u[21]=n,u[22]=o,u[23]=m):m=u[23],u[24]!==l||u[25]!==m?(d=(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:[l,m]}),u[24]=l,u[25]=m,u[26]=d):d=u[26],d};var U=e.i(394673);let S=e=>{let t,s,l=(0,a.c)(8),{isLoading:n,isDisabled:o,onClick:m,creditCost:d}=e,u=void 0===d?4:d,p=c(),g=(0,i.useTranslations)(p);return l[0]!==u||l[1]!==n||l[2]!==g?(t=n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-5 h-5 sm:w-6 sm:h-6 border-2 border-current/30 border-t-current rounded-full animate-spin"}),(0,r.jsx)("span",{className:"group-disabled:opacity-75 text-sm sm:text-base md:text-lg",children:g("generate.generating")})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-5 h-5 sm:w-6 sm:h-6 bg-current/20 rounded-lg flex items-center justify-center group-hover:bg-current/30 transition-colors",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3.5 w-3.5 sm:h-4 sm:w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"})})}),(0,r.jsx)("span",{className:"group-hover:scale-105 transition-transform text-sm sm:text-base md:text-lg",children:g("generate.button")}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5 sm:gap-1 ml-1 sm:ml-2",children:[(0,r.jsx)(U.Coins,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),(0,r.jsx)("span",{className:"text-xs sm:text-sm font-medium",children:u})]})]}),l[0]=u,l[1]=n,l[2]=g,l[3]=t):t=l[3],l[4]!==o||l[5]!==m||l[6]!==t?(s=(0,r.jsx)("button",{onClick:m,disabled:o,className:"w-full mt-4 sm:mt-6 md:mt-8 py-3 sm:py-3.5 md:py-4 px-4 sm:px-5 md:px-6 bg-primary hover:bg-primary/90 active:scale-[0.98] disabled:bg-muted text-primary-foreground font-bold rounded-xl sm:rounded-2xl shadow-xl hover:shadow-2xl disabled:shadow-none disabled:cursor-not-allowed transition-all duration-300 flex items-center justify-center gap-2 sm:gap-2.5 md:gap-3 text-base sm:text-lg group disabled:text-muted-foreground",children:t}),l[4]=o,l[5]=m,l[6]=t,l[7]=s):s=l[7],s},C=({selectedTransformation:e,primaryImageUrl:t,secondaryImageUrl:a,customPrompt:l,isLoading:n,isGenerateDisabled:o,onPrimaryImageSelect:m,onSecondaryImageSelect:d,onClearPrimaryImage:u,onClearSecondaryImage:p,onCustomPromptChange:g,onGenerate:f,onSetIsUsingSampleImage:b,error:y})=>{let w,j=c(),k=(0,i.useTranslations)(j),N="object"==typeof(w=h)&&"maxLength"in w?w.maxLength:x,[U,C]=s.default.useState(!1),[I,T]=s.default.useState(!1),L=!!e?.before_image_1&&!!e?.before_image_2,M=s.default.useCallback(async()=>{if(e?.before_image_1&&e?.before_image_2){T(!0);try{let[t,r]=await Promise.all([fetch(e.before_image_1),fetch(e.before_image_2)]),[a,s]=await Promise.all([t.blob(),r.blob()]),l=new File([a],"sample-target.webp",{type:a.type||"image/webp"}),n=new File([s],"sample-face.webp",{type:s.type||"image/webp"});
1m(l,e.before_image_1),d(n,e.before_image_2),b?.(!0)}catch(e){}finally{T(!1)}}},[e,m,d,b]);return(0,r.jsx)("div",{className:"flex flex-col p-3 sm:p-4 bg-card rounded-xl border border-border shadow-sm relative overflow-hidden",children:(0,r.jsxs)("div",{className:"relative z-10",children:[(0,r.jsx)("div",{className:"mb-3 sm:mb-4",children:(0,r.jsx)(_,{onPrimarySelect:m,onSecondarySelect:d,primaryImageUrl:t,secondaryImageUrl:a,onClearPrimary:u,onClearSecondary:p,primaryTitle:e.primaryUploaderTitle,primaryDescription:e.primaryUploaderDescription,secondaryTitle:e.secondaryUploaderTitle,secondaryDescription:e.secondaryUploaderDescription})}),!t&&!a&&L&&(0,r.jsx)("div",{className:"mb-3 sm:mb-4",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 sm:gap-3",children:[(0,r.jsx)("p",{className:"text-[10px] sm:text-xs md:text-sm font-medium text-center text-muted-foreground",children:k("sample.text")}),(0,r.jsxs)("button",{onClick:M,disabled:I,className:"flex items-center gap-2 sm:gap-3 p-2 sm:p-3 rounded-lg sm:rounded-xl border-2 border-dashed border-border hover:border-primary bg-muted/30 hover:bg-muted/50 transition-all active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,r.jsx)("div",{className:"w-12 h-12 sm:w-16 sm:h-16 md:w-20 md:h-20 rounded-lg overflow-hidden flex-shrink-0",children:(0,r.jsx)(v.default,{src:e.before_image_1,alt:k("sample.targetAlt"),width:80,height:80,className:"object-cover w-full h-full"})}),(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 sm:h-5 sm:w-5 text-muted-foreground flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),(0,r.jsx)("div",{className:"w-12 h-12 sm:w-16 sm:h-16 md:w-20 md:h-20 rounded-lg overflow-hidden flex-shrink-0",children:(0,r.jsx)(v.default,{src:e.before_image_2,alt:k("sample.faceAlt"),width:80,height:80,className:"object-cover w-full h-full"})}),I&&(0,r.jsx)("div",{className:"ml-1 sm:ml-2 animate-spin h-4 w-4 border-2 border-primary border-t-transparent rounded-full"})]})]})}),t&&a&&(0,r.jsxs)("div",{className:"mb-3 sm:mb-4",children:[(0,r.jsxs)("button",{onClick:()=>{let t=!U;C(t),t&&!l.trim()&&e?.prompt&&g(e.prompt)},className:"w-full flex items-center gap-2 sm:gap-3 px-3 sm:px-4 py-2 sm:py-3 bg-muted/50 hover:bg-muted/70 rounded-lg sm:rounded-xl border border-border/50 hover:border-border transition-all duration-200 text-xs sm:text-sm font-medium text-foreground group active:scale-[0.98]",children:[(0,r.jsx)("div",{className:`w-4 h-4 sm:w-5 sm:h-5 rounded-md border-2 border-primary flex items-center justify-center flex-shrink-0 transition-all duration-200 ${U?"bg-primary":"bg-transparent"}`,children:U&&(0,r.jsx)("svg",{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-primary-foreground",fill:"currentColor",viewBox:"0 0 20 20",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}),(0,r.jsx)("span",{className:"group-hover:text-primary transition-colors truncate",children:k("input.customPrompt")})]}),U&&(0,r.jsx)("div",{className:"mt-3 sm:mt-4",children:(0,r.jsx)("textarea",{value:l,onChange:e=>{let t=e.target.value;t.length<=N&&g(t)},placeholder:k("input.promptPlaceholder"),rows:3,maxLength:N,className:"w-full p-2 sm:p-2.5 md:p-3 text-sm sm:text-base bg-secondary border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-colors placeholder-muted-foreground resize-none text-foreground"})})]}),y&&(0,r.jsx)("div",{className:"mb-3 sm:mb-4 p-2 sm:p-3 bg-destructive/10 border border-destructive/30 rounded-lg",children:(0,r.jsx)("p",{className:"text-xs sm:text-sm text-destructive",children:y})}),(0,r.jsx)(S,{isLoading:n,isDisabled:o,onClick:f})]})})},I=e=>{let t,s,l,n,o,m,d,u,p,g,x=(0,a.c)(19),{message:h}=e,f=void 0===h?"":h,b=c(),y=(0,i.useTranslations)(b);return x[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("div",{className:"w-20 h-20 border-4 border-primary/20 rounded-full animate-pulse"}),s=(0,r.jsx)("div",{className:"absolute top-1 left-1 w-[72px] h-[72px] border-4 border-transparent border-t-primary/50 border-r-primary/50 rounded-full animate-spin"}),x[0]=t,x[1]=s):(t=x[0],s=x[1]),x[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsxs)("div",{className:"relative",children:[t,s,(0,r.jsx)("div",{className:"absolute top-2 left-2 w-16 h-16 border-4 border-transparent border-t-primary border-r-primary rounded-full animate-spin",style:{animationDirection:"reverse",animationDuration:"0.8s"}})]}),x[2]=l):l=x[2],x[3]!==f?(n=f&&(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("p",{className:"text-lg font-semibold mb-2 bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent",children:f}),(0,r.jsxs)("div",{className:"flex items-center justify-center space-x-1 text-primary",children:[(0,r.jsx)("div",{className:"w-2 h-2 bg-primary/80 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,r.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,r.jsx)("div",{className:"w-2 h-2 bg-accent rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})]}),x[3]=f,x[4]=n):n=x[4],x[5]!==y?(o=y("loading.creating"),x[5]=y,x[6]=o):o=x[6],x[7]!==o?(m=(0,r.jsx)("p",{className:"text-foreground text-sm font-medium mb-1",children:o}),x[7]=o,x[8]=m):m=x[8],x[9]!==y?(d=y("loading.hangTight"),x[9]=y,x[10]=d):d=x[10],x[11]!==d?(u=(0,r.jsx)("p",{className:"text-muted-foreground text-xs",children:d}),x[11]=d,x[12]=u):u=x[12],x[13]!==m||x[14]!==u?(p=(0,r.jsxs)("div",{className:"bg-gradient-to-r from-muted to-secondary rounded-xl p-4 border border-border",children:[m,u]}),x[13]=m,x[14]=u,x[15]=p):p=x[15],x[16]!==p||x[17]!==n?(g=(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 p-8",children:[l,(0,r.jsxs)("div",{className:"text-center max-w-sm",children:[n,p]})]}),x[16]=p,x[17]=n,x[18]=g):g=x[18],g},T=e=>{let t,s,l,n,o,m,d,u=(0,a.c)(15),{message:p}=e,g=c(),x=(0,i.useTranslations)(g);return u[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("div",{className:"relative",children:(0,r.jsx)("div",{className:"w-20 h-20 bg-gradient-to-br from-destructive/10 to-destructive/20 rounded-2xl flex items-center justify-center shadow-lg",children:(0,r.jsx)("div",{className:"w-16 h-16 bg-gradient-to-br from-destructive/80 to-destructive rounded-xl flex items-center justify-center",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 text-destructive-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.732 15.5c-.77.833.192 2.5 1.732 2.5z"})})})})}),u[0]=t):t=u[0],u[1]!==x?(s=x("error.oops"),u[1]=x,u[2]=s):s=u[2],u[3]!==s?(l=(0,r.jsx)("h3",{className:"text-xl font-bold mb-3 bg-gradient-to-r from-destructive to-destructive/80 bg-clip-text text-transparent",children:s}),u[3]=s,u[4]=l):l=u[4],u[5]!==p?(n=(0,r.jsx)("p",{className:"text-foreground text-sm leading-relaxed bg-muted rounded-lg p-3 border border-border",children:p}),u[5]=p,u[6]=n):n=u[6],u[7]!==x?(o=x("error.tryAgain"),u[7]=x,u[8]=o):o=u[8],u[9]!==o?(m=(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-3",children:o}),u[9]=o,u[10]=m):m=u[10],u[11]!==l||u[12]!==n||u[13]!==m?(d=(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 p-8",children:[t,(0,r.jsxs)("div",{className:"text-center max-w-sm",children:[l,n,m]})]}),u[11]=l,u[12]=n,u[13]=m,u[14]=d):d=u[14],d},L=e=>{let t,s,l,n,o,m,d,u,p,g=(0,a.c)(24),{content:x,onUseImageAsInput:h,onImageClick:f}=e,b=c(),y=(0,i.useTranslations)(b);if(!x.imageUrl)return null;g[0]!==x.imageUrl?(t=async()=>{try{let e=await fetch(x.imageUrl),t=await e.blob(),r=URL.createObjectURL(t),a=document.createElement("a");a.href=r,a.download=`face-swap-${Date.now()}.jpg`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r)}catch{window.open(x.imageUrl,"_blank")}},g[0]=x.imageUrl,g[1]=t):t=g[1];let w=t;return g[2]!==x.imageUrl||g[3]!==f?(s=()=>f(x.imageUrl),g[2]=x.imageUrl,g[3]=f,g[4]=s):s=g[4],g[5]!==x.imageUrl||g[6]!==s?(l=(0,r.jsx)("div",{className:"relative w-full h-auto",children:(0,r.jsx)(v.default,{src:x.imageUrl,alt:"Generated result",width:800,height:600,className:"w-full h-auto rounded-lg cursor-pointer",onClick:s})}),g[5]=x.imageUrl,g[6]=s,g[7]=l):l=g[7],g[8]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3 w-3 sm:h-3.5 sm:w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),g[8]=n):n=g[8],g[9]!==y?(o=y("output.download"),g[9]=y,g[10]=o):o=g[10
1],g[11]!==w||g[12]!==o?(m=(0,r.jsxs)("button",{onClick:w,className:"flex-1 min-w-[100px] sm:min-w-[120px] py-1.5 sm:py-2 px-2 sm:px-3 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 active:scale-95 transition-all flex items-center justify-center gap-1 sm:gap-1.5 text-xs sm:text-sm font-medium",children:[n,o]}),g[11]=w,g[12]=o,g[13]=m):m=g[13],g[14]!==x.imageUrl||g[15]!==h||g[16]!==y?(d=x.imageUrl&&(0,r.jsxs)("button",{onClick:()=>h(x.imageUrl),className:"flex-1 min-w-[100px] sm:min-w-[120px] py-1.5 sm:py-2 px-2 sm:px-3 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/80 active:scale-95 transition-all flex items-center justify-center gap-1 sm:gap-1.5 text-xs sm:text-sm font-medium",children:[(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3 w-3 sm:h-3.5 sm:w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),y("output.useAsInput")]}),g[14]=x.imageUrl,g[15]=h,g[16]=y,g[17]=d):d=g[17],g[18]!==m||g[19]!==d?(u=(0,r.jsxs)("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:[m,d]}),g[18]=m,g[19]=d,g[20]=u):u=g[20],g[21]!==l||g[22]!==u?(p=(0,r.jsxs)("div",{className:"flex flex-col space-y-3 sm:space-y-4",children:[l,u]}),g[21]=l,g[22]=u,g[23]=p):p=g[23],p},M=()=>{let e,t,s,l,n,o,m,d,u,p,g,x=(0,a.c)(21),h=c(),f=(0,i.useTranslations)(h);return x[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"w-16 h-16 sm:w-20 sm:h-20 md:w-24 md:h-24 bg-gradient-to-br from-muted to-secondary rounded-2xl sm:rounded-3xl flex items-center justify-center mb-4 sm:mb-5 md:mb-6 shadow-inner",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),x[0]=e):e=x[0],x[1]!==f?(t=f("empty.readyToCreate"),x[1]=f,x[2]=t):t=x[2],x[3]!==t?(s=(0,r.jsx)("h3",{className:"text-base sm:text-lg md:text-xl font-semibold text-foreground mb-2 sm:mb-3",children:t}),x[3]=t,x[4]=s):s=x[4],x[5]!==f?(l=f("empty.description"),x[5]=f,x[6]=l):l=x[6],x[7]!==l?(n=(0,r.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground max-w-sm leading-relaxed px-4",children:l}),x[7]=l,x[8]=n):n=x[8],x[9]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)("div",{className:"w-1.5 h-1.5 sm:w-2 sm:h-2 bg-primary/60 rounded-full animate-pulse"}),x[9]=o):o=x[9],x[10]!==f?(m=f("empty.uploadHint"),x[10]=f,x[11]=m):m=x[11],x[12]!==m?(d=(0,r.jsx)("span",{className:"text-center",children:m}),x[12]=m,x[13]=d):d=x[13],x[14]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsx)("div",{className:"w-1.5 h-1.5 sm:w-2 sm:h-2 bg-accent/60 rounded-full animate-pulse",style:{animationDelay:"0.5s"}}),x[14]=u):u=x[14],x[15]!==d?(p=(0,r.jsxs)("div",{className:"mt-4 sm:mt-5 md:mt-6 flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm text-muted-foreground",children:[o,d,u]}),x[15]=d,x[16]=p):p=x[16],x[17]!==s||x[18]!==n||x[19]!==p?(g=(0,r.jsxs)("div",{className:"flex-grow flex flex-col items-center justify-center text-center py-8 sm:py-12 md:py-16 px-4",children:[e,s,n,p]}),x[17]=s,x[18]=n,x[19]=p,x[20]=g):g=x[20],g},E=e=>{let t,s,l=(0,a.c)(11),{isLoading:n,loadingMessage:o,currentTask:i,generatedContent:m,primaryImageUrl:d,onUseImageAsInput:c,onImageClick:u,error:p}=e,g=i?.status==="failed"||!!p,x=p||i?.extra?.errorMessage||i?.extra?.failureReason;l[0]!==x||l[1]!==m||l[2]!==g||l[3]!==n||l[4]!==o||l[5]!==u||l[6]!==c||l[7]!==d?(t=()=>n?(0,r.jsx)("div",{className:"flex-grow flex items-center justify-center",children:(0,r.jsx)(I,{message:o})}):g&&x?(0,r.jsx)("div",{className:"flex-grow flex items-center justify-center w-full",children:(0,r.jsx)(T,{message:x})}):m?(0,r.jsx)(L,{content:m,onUseImageAsInput:c,onImageClick:u,originalImageUrl:d}):(0,r.jsx)(M,{}),l[0]=x,l[1]=m,l[2]=g,l[3]=n,l[4]=o,l[5]=u,l[6]=c,l[7]=d,l[8]=t):t=l[8];let h=t;return l[9]!==h?(s=(0,r.jsx)("div",{className:"flex flex-col p-3 sm:p-4 bg-card rounded-xl border border-border shadow-sm relative overflow-hidden min-h-[300px] sm:min-h-[400px]",children:(0,r.jsx)("div",{className:"relative z-10 flex-1 flex flex-col",children:h()})}),l[9]=h,l[10]=s):s=l[10],s};e.s(["default",0,e=>{let t,m,u,x,h,v,k,N,_,U=(0,a.c)(41),{selectedTransformation:S,scene:I,provider:T,model:L,translationNamespace:M}
1=e,F=void 0===M?"ai.image.face-swap":M,[R,P]=(0,s.useState)(null);U[0]!==L||U[1]!==T||U[2]!==I||U[3]!==S?(t={selectedTransformation:S,scene:I,provider:T,model:L},U[0]=L,U[1]=T,U[2]=I,U[3]=S,U[4]=t):t=U[4];let{primaryImageUrl:D,secondaryImageUrl:A,generatedContent:G,isLoading:O,loadingMessage:z,customPrompt:$,handlePrimaryImageSelect:B,handleSecondaryImageSelect:V,handleClearPrimaryImage:H,handleClearSecondaryImage:W,handleUseImageAsInput:q,setCustomPrompt:J,setIsUsingSampleImage:X,handleGenerate:Y,isGenerateDisabled:K,currentTask:Q,error:Z}=function(e){let t,r,m,d,u,x,h,v,j,k=(0,a.c)(62),{selectedTransformation:N,scene:_,provider:U,model:S}=e,C=function(e){let t,r,i,m,d,c,u,p,g,x,h,f=(0,a.c)(24),[b,y]=(0,s.useState)(null),[w,v]=(0,s.useState)(null),[j,k]=(0,s.useState)(null),[N,_]=(0,s.useState)(null),[U,S]=(0,s.useState)(null),[C,I]=(0,s.useState)(""),[T,L]=(0,s.useState)("1:1"),[M,E]=(0,s.useState)("2"),[F,R]=(0,s.useState)("none"),[P,D]=(0,s.useState)(!1);f[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{y(null),v(null),k(null),_(null),S(null),I(""),R("none"),D(!1)},f[0]=t):t=f[0];let A=t;f[1]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{A()},f[1]=r):r=f[1],f[2]!==e?(i=[e,A],f[2]=e,f[3]=i):i=f[3],(0,s.useEffect)(r,i),f[4]===Symbol.for("react.memo_cache_sentinel")?(m=(e,t)=>{v(e),y(t),S(null),R("none"),D(!1)},f[4]=m):m=f[4];let G=m;f[5]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{y(null),v(null),S(null),R("none"),D(!1)},f[5]=d):d=f[5];let O=d;f[6]===Symbol.for("react.memo_cache_sentinel")?(c=(e,t)=>{_(e),k(t)},f[6]=c):c=f[6];let z=c;f[7]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{k(null),_(null)},f[7]=u):u=f[7];let $=u;f[8]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{R(o)},f[8]=p):p=f[8];let B=p;f[9]!==e?(g=async t=>{if(!t)return;let r=await n(t,`sample-${e}-${Date.now()}.png`),a=new FileReader;a.onload=e=>{let t=e.target?.result;v(r),y(t),S(null),R("none"),D(!0)},a.readAsDataURL(r)},f[9]=e,f[10]=g):g=f[10];let V=g;f[11]===Symbol.for("react.memo_cache_sentinel")?(x=async e=>{let t,r;e&&(e.startsWith("data:")?(t=l(e,`edited-${Date.now()}.png`),r=e):(t=await n(e,`edited-${Date.now()}.png`),r=await new Promise((e,r)=>{let a=new FileReader;a.onload=t=>{let a=t.target?.result;a?e(a):r(Error("Failed to read file"))},a.onerror=()=>r(Error("FileReader error")),a.readAsDataURL(t)})),v(t),y(r),S(null),R("none"),_(null),k(null),D(!1))},f[11]=x):x=f[11];let H=x;return f[12]!==F||f[13]!==T||f[14]!==C||f[15]!==V||f[16]!==P||f[17]!==U||f[18]!==w||f[19]!==b||f[20]!==N||f[21]!==j||f[22]!==M?(h={primaryImageUrl:b,primaryFile:w,handlePrimaryImageSelect:G,handleClearPrimaryImage:O,secondaryImageUrl:j,secondaryFile:N,handleSecondaryImageSelect:z,handleClearSecondaryImage:$,maskDataUrl:U,setMaskDataUrl:S,activeTool:F,toggleMaskTool:B,customPrompt:C,setCustomPrompt:I,aspectRatio:T,setAspectRatio:L,upscaleFactor:M,setUpscaleFactor:E,isUsingSampleImage:P,setIsUsingSampleImage:D,handleSampleImageSelect:V,handleUseImageAsInput:H,resetState:A},f[12]=F,f[13]=T,f[14]=C,f[15]=V,f[16]=P,f[17]=U,f[18]=w,f[19]=b,f[20]=N,f[21]=j,f[22]=M,f[23]=h):h=f[23],h}(N.key);k[0]!==C.aspectRatio||k[1]!==C.customPrompt||k[2]!==C.isUsingSampleImage||k[3]!==C.maskDataUrl||k[4]!==C.primaryFile||k[5]!==C.secondaryFile||k[6]!==C.upscaleFactor||k[7]!==S||k[8]!==U||k[9]!==_||k[10]!==N?(t={selectedTransformation:N,primaryFile:C.primaryFile,secondaryFile:C.secondaryFile,customPrompt:C.customPrompt,aspectRatio:C.aspectRatio,upscaleFactor:C.upscaleFactor,maskDataUrl:C.maskDataUrl,isUsingSampleImage:C.isUsingSampleImage,scene:_,provider:U,model:S},k[0]=C.aspectRatio,k[1]=C.customPrompt,k[2]=C.isUsingSampleImage,k[3]=C.maskDataUrl,k[4]=C.primaryFile,k[5]=C.secondaryFile,k[6]=C.upscaleFactor,k[7]=S,k[8]=U,k[9]=_,k[10]=N,k[11]=t):t=k[11];let I=function(e){let t,r,a,n,{selectedTransformation:o,primaryFile:m,secondaryFile:d,customPrompt:u,aspectRatio:x,maskDataUrl:h,isUsingSampleImage:v,scene:j,provider:k,model:N}=e,_=c(),U=(0,i.useTranslations)(_),{user:S,setIsShowSignModal:C,fetchUserCredits:I}=(0,b.useAppContext)(),[T,L]=(0,s.useState)(null),[M,E]=(0,s.use
1State)(!1),[F,R]=(0,s.useState)(""),[P,D]=(0,s.useState)(null),[A,G]=(0,s.useState)(null),{submitTaskAndPoll:O,cancelPolling:z}=(t=(0,s.useRef)(null),r=(0,s.useRef)(0),a=(0,s.useRef)(null),n=(0,s.useCallback)(()=>{t.current&&(clearInterval(t.current),t.current=null),r.current=0,a.current=null},[]),{submitTaskAndPoll:(0,s.useCallback)(async(e,s,l,o)=>{n();try{let i=await fetch("/api/ai/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),m=await i.json();if(0!==m.code){let e=Error(m.message||"Submit failed");throw e.statusCode=i.status,e}let d=m.data,c=y(d);s(c);let u=d.id,p=d.taskId,g=d.provider,x=d.model;a.current=u,r.current=0,t.current=setInterval(async()=>{try{let e=await fetch("/api/ai/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:u,taskId:p,provider:g,model:x})}),t=await e.json();if(0!==t.code)throw Error(t.message||"Query failed");let a=y(t.data);if(s(a),"success"===a.status||"failed"===a.status){"success"===a.status?l(a):o(a.extra?.errorMessage||a.extra?.failureReason||"Generation failed"),n();return}r.current++,r.current>=36&&(o("Generation timeout - please try again"),n())}catch(t){let e=t instanceof Error?t.message:"Unknown polling error";o(e),n()}},5e3),setTimeout(()=>{t.current&&a.current===u&&(o("Generation timeout - please try again"),n())},18e4)}catch(e){o(e instanceof Error?e.message:"Failed to submit task",e instanceof Error?e:void 0)}},[n]),cancelPolling:n}),$=(0,s.useCallback)(()=>{E(!1),R(""),z()},[z]),B=(0,s.useCallback)(e=>{G(e),("processing"===e.status||"pending"===e.status)&&R("Processing your request...")},[]),V=(0,s.useCallback)(e=>{e.resultImageUrl&&L({imageUrl:e.resultImageUrl,text:null}),E(!1),R(""),!v&&S&&setTimeout(()=>{I().catch(()=>{})},1e3)},[v,S,I]),H=(0,s.useCallback)((e,t)=>{D(e),E(!1),R(""),(t?.statusCode===402||e.includes("insufficient credits"))&&I().catch(()=>{})},[I]),W=(0,s.useCallback)(async()=>{if(!o)return void D("Please select a transformation");if(!p(o)){let e=g(o)||o.isMultiImage&&!o.isSecondaryOptional;if(!m)return void D(U("error.uploadRequired"));if(e&&!d)return void D(U("error.uploadBoth"))}if(!v){if(!S)return void C(!0);if(4>(S.credits?.remainingCredits||0))return void D("Insufficient credits")}let e=u&&u.trim()||o.prompt;if(!e||!e.trim())return void D(U("error.enterPrompt"));E(!0),D(null),L(null),G(null),R(""),z();try{if(v&&o.after_image){R("Generating..."),await new Promise(e=>setTimeout(e,3e3)),L({imageUrl:o.after_image,text:null}),E(!1),R("");return}let t=[];if(m){R("Uploading target image...");let e=await w(m,"ai");t.push(e)}if(d){R("Uploading face image...");let e=await w(d,"ai");t.push(e)}if(h){R("Uploading mask...");let e=l(h,`mask_${Date.now()}.png`),r=await w(e,"ai");t.push(r)}let r=e,a=[];x&&a.push(`aspect ratio is ${x}`),a.length>0&&(r=`${e}. Note: ${a.join(", ")}.`);let s={provider:"mock"===f.env.NEXT_PUBLIC_IMAGE_SERVICE_PROVIDER?"mock":k,mediaType:"image",model:N,prompt:r,scene:j,options:{urls:t,effect:o.key}};R("Submitting generation request..."),await O(s,B,V,H)}catch(e){D(e instanceof Error?e.message:"Unknown error"),E(!1),R(""),z()}},[m,d,o,h,u,x,v,S,C,k,N,j,U,O,B,V,H,z]),q=(()=>{if(!o||M)return!0;let e=u&&u.trim()||o.prompt;return!(e&&e.trim())||!p(o)&&(g(o)||o.isMultiImage&&!o.isSecondaryOptional?!m||!d:!m)})();return{generatedContent:T,isLoading:M,loadingMessage:F,error:P,handleGenerateImage:W,isGenerateDisabled:q,setGeneratedContent:L,setError:D,currentTask:A,cancelGeneration:$}}(t);k[12]!==I||k[13]!==C?(r=(e,t)=>
1{C.handlePrimaryImageSelect(e,t),I.setGeneratedContent(null),I.setError(null)},k[12]=I,k[13]=C,k[14]=r):r=k[14];let T=r;k[15]!==I||k[16]!==C?(m=(e,t)=>{C.handleSecondaryImageSelect(e,t),I.setGeneratedContent(null),I.setError(null)},k[15]=I,k[16]=C,k[17]=m):m=k[17];let L=m;k[18]!==I||k[19]!==C?(d=()=>{C.handleClearPrimaryImage(),I.setGeneratedContent(null),I.setError(null)},k[18]=I,k[19]=C,k[20]=d):d=k[20];let M=d;k[21]!==I||k[22]!==C?(u=()=>{C.handleClearSecondaryImage(),I.setGeneratedContent(null),I.setError(null)},k[21]=I,k[22]=C,k[23]=u):u=k[23];let E=u;k[24]!==I||k[25]!==C?(x=async e=>{try{await C.handleSampleImageSelect(e),I.setGeneratedContent(null),I.setError(null)}catch{I.setError("Failed to load sample image")}},k[24]=I,k[25]=C,k[26]=x):x=k[26];let F=x;k[27]!==I||k[28]!==C?(h=async e=>{try{await C.handleUseImageAsInput(e),I.setGeneratedContent(null),I.setError(null)}catch{I.setError("Failed to use image as input")}},k[27]=I,k[28]=C,k[29]=h):h=k[29];let R=h;k[30]!==I?(v=async()=>{await I.handleGenerateImage()},k[30]=I,k[31]=v):v=k[31];let P=v;return k[32]!==I.currentTask||k[33]!==I.error||k[34]!==I.generatedContent||k[35]!==I.isGenerateDisabled||k[36]!==I.isLoading||k[37]!==I.loadingMessage||k[38]!==M||k[39]!==E||k[40]!==P||k[41]!==T||k[42]!==F||k[43]!==L||k[44]!==R||k[45]!==C.activeTool||k[46]!==C.aspectRatio||k[47]!==C.customPrompt||k[48]!==C.isUsingSampleImage||k[49]!==C.maskDataUrl||k[50]!==C.primaryFile||k[51]!==C.primaryImageUrl||k[52]!==C.secondaryFile||k[53]!==C.secondaryImageUrl||k[54]!==C.setAspectRatio||k[55]!==C.setCustomPrompt||k[56]!==C.setIsUsingSampleImage||k[57]!==C.setMaskDataUrl||k[58]!==C.setUpscaleFactor||k[59]!==C.toggleMaskTool||k[60]!==C.upscaleFactor?(j={primaryImageUrl:C.primaryImageUrl,primaryFile:C.primaryFile,secondaryImageUrl:C.secondaryImageUrl,secondaryFile:C.secondaryFile,maskDataUrl:C.maskDataUrl,customPrompt:C.customPrompt,aspectRatio:C.aspectRatio,upscaleFactor:C.upscaleFactor,activeTool:C.activeTool,isUsingSampleImage:C.isUsingSampleImage,generatedContent:I.generatedContent,isLoading:I.isLoading,loadingMessage:I.loadingMessage,isGenerateDisabled:I.isGenerateDisabled,currentTask:I.currentTask,error:I.error,handlePrimaryImageSelect:T,handleSecondaryImageSelect:L,handleClearPrimaryImage:M,handleClearSecondaryImage:E,handleSampleImageSelect:F,handleUseImageAsInput:R,setMaskDataUrl:C.setMaskDataUrl,setCustomPrompt:C.setCustomPrompt,setAspectRatio:C.setAspectRatio,setUpscaleFactor:C.setUpscaleFactor,toggleMaskTool:C.toggleMaskTool,setIsUsingSampleImage:C.setIsUsingSampleImage,handleGenerate:P},k[32]=I.currentTask,k[33]=I.error,k[34]=I.generatedContent,k[35]=I.isGenerateDisabled,k[36]=I.isLoading,k[37]=I.loadingMessage,k[38]=M,k[39]=E,k[40]=P,k[41]=T,k[42]=F,k[43]=L,k[44]=R,k[45]=C.activeTool,k[46]=C.aspectRatio,k[47]=C.customPrompt,k[48]=C.isUsingSampleImage,k[49]=C.maskDataUrl,k[50]=C.primaryFile,k[51]=C.primaryImageUrl,k[52]=C.secondaryFile,k[53]=C.secondaryImageUrl,k[54]=C.setAspectRatio,k[55]=C.setCustomPrompt,k[56]=C.setIsUsingSampleImage,k[57]=C.setMaskDataUrl,k[58]=C.setUpscaleFactor,k[59]=C.toggleMaskTool,k[60]=C.upscaleFactor,k[61]=j):j=k[61],j}(t);return U[5]!==$||U[6]!==Z||U[7]!==H||U[8]!==W||U[9]!==Y||U[10]!==B||U[11]!==V||U[12]!==K||U[13]!==O||U[14]!==D||U[15]!==A||U[16]!==S||U[17]!==J||U[18]!==X?(m=(0,r.jsx)(C,{selectedTransformation:S,primaryImageUrl:D,secondaryImageUrl:A,customPrompt:$,isLoading:O,isGenerateDisabled:K,onPrimaryImageSelect:B,onSecondaryImageSelect:V,onClearPrimaryImage:H,onClearSecondaryImage:W,onCustomPromptChange:J,onGenerate:Y,onSetIsUsingSampleImage:X,error:Z}),U[5]=$,U[6]=Z,U[7]=H,U[8]=W,U[9]=Y,U[10]=B,U[11]=V,U[12]=K,U[13]=O,U[14]=D,U[15]=A,U[16]=S,U[17]=J,U[18]=X,U[19]=m):m=U[19],U[20]===Symbol.for("react.memo_cache_sentinel")?(u=e=>P(e),U[20]=u):u=U[20],U[21]!==Q||U[22]!==Z||U[23]!==G||U[24]!==q||U[25]!==O||U[26]!==z||U[27]!==D?(x=(0,r.jsx)(E,{isLoading:O,loadingMessage:z,currentTask:Q,generatedContent:G,primaryImageUrl:D,onUseImageAsInput:q,onImageClick:u,error:Z}),U[21]=Q,U[22]=Z,U[23]=G,U[24]=q,U[25]=O,U[26]=z,U[27]=D,U[28]=x):x=U[28],U[29]!==m||U[30]!==x?(h=(0,r.jsx)("main",{children:(0,r.jsx)("div",{className:"w-full",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[m,x]})})}),U[29]=m,U[30]=x,U[31]=h):h=U[31],U[32]===Symbol.for("react.memo_cache_sentinel")?(v=()=>P(null),U[32]=v):v=U[32],U[33]!==R?(k=(0,r.jsx)(j,{imageUrl:R,onClose:v}),U[33]=R,U[34]=k):k=U[34],U[35]!==h||U[36]!==k?(N=(0,r.jsxs)("div",{className:"text-foreground font-sans",children:[h,k]}),U[35]=h,U[36]=k,U[37]=N):N=U[37],U[38]!==N||U[39]!==F?(_=(0,r.jsx)(d,{value:F,children:N}),U[38]=N,U[39]=F,U[40]=_):_=U[40],_}],70522)}]);

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.