1var e=Object.defineProperty,r=Object.defineProperties,t=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,i=(r,t,a)=>t in r?e(r,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[t]=a,s=(e,r)=>{for(var t in r||(r={}))n.call(r,t)&&i(e,t,r[t]);if(a)for(var t of a(r))o.call(r,t)&&i(e,t,r[t]);return e},d=(e,a)=>r(e,t(a)),l=(e,r,t)=>new Promise((a,n)=>{var o=e=>{try{s(t.next(e))}catch(r){n(r)}},i=e=>{try{s(t.throw(e))}catch(r){n(r)}},s=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,i);s((t=t.apply(e,r)).next())});import{u as c,j as p,U as u,B as m,c as x,T as g,al as h,aE as f,Y as b,aa as y,bh as v,R as j,r as C,ag as w,bk as P,a1 as S,a6 as k,a4 as z,ak as I,bx as A,aA as W,c5 as R,aW as F,d6 as G,cT as B,cm as N,bW as D,d7 as T}from"./vendor-mui-CBxi4-UE.js";import{a as U,b as E}from"./vendor-react-DJCar8wk.js";import{u as O}from"./useSimpleToastNotification-YKhq3dyl.js";import{P as $,a as M,G as _,b as L}from"./mutations-DwsXgF39.js";import{b as Y,e as q,a as H,u as V,a4 as Q,s as J,i as X,t as K}from"./main-fFbGxLEq.js";import{c as Z}from"./fileUtils-DErkkPEz.js";import"./index-Cc7IhL_s.js";import"./vendor-utils-hGafao2v.js";const ee=T` 2 0%, 100% { transform: translateY(0px); } 3 50% { transform: translateY(-10px); } 4`,re=T` 5 0%, 100% { opacity: 1; } 6 50% { opacity: 0.6; } 7`,te=()=>{var e;const{t:r}=Y(),t=c(),{showError:a,showSuccess:n}=O(),{account:o}=q(),i=U.useRef(null),T=U.useRef(!1),[te,ae]=U.useState(null),[ne,oe]=U.useState(null),[ie,se]=U.useState(!1),[de,le]=U.useState(!1),[ce,pe]=U.useState([]),[ue,me]=U.useState([]),[xe,ge]=U.useState(!1),[he,fe]=U.useState(null),[be,ye]=U.useState(1),[ve,je]=U.useState("bytedance"),[Ce,we]=U.useState("auto"),[Pe,Se]=U.useState(""),[ke,ze]=U.useState(3),[Ie,Ae]=U.useState([]),[We,Re]=U.useState(!1),[Fe,Ge]=U.useState(null),[Be]=H($),[Ne]=H(M),{data:De,startPolling:Te,stopPolling:Ue}=V(_,{variables:{ids:Ie},skip:0===Ie.length,pollInterval:0,notifyOnNetworkStatusChange:!0}),{data:Ee,refetch:Oe}=V(L,{variables:{limit:12},fetchPolicy:"cache-and-network"});E.useEffect(()=>(Ie.length>0?Te(3e3):Ue(),()=>Ue()),[Ie,Te,Ue]),E.useEffect(()=>{if(null==De?void 0:De.videoPicturesByIds){const e=De.videoPicturesByIds;me(e.map((e,r)=>{var t,a,n;return{id:e.id,status:e.status,url:e.s3Url||e.url,title:(null==(t=e.metadata)?void 0:t.creative_style)||(null==(a=e.metadata)?void 0:a.product_card_title)||(null==(n=ce[r])?void 0:n.title),description:e.prompt,errorMessage:e.errorMessage}}));if(e.every(e=>"completed"===e.status||"failed"===e.status)&&(Ue(),Oe(),!T.current)){T.current=!0;const t=e.filter(e=>"completed"===e.status).length,o=e.filter(e=>"failed"===e.status).length;if(t>0){n(r("productCard.cardsCompleted","{{completed}} product card(s) completed!{{failed}}",{completed:t,failed:o>0?` (${o} failed)`:""}))}o>0&&0===t&&a(r("productCard.allFailed","All product card generations failed"))}}},[De,ce,Ue,Oe,n,a,r]);const $e=e=>{"completed"===e.status&&e.url&&(Ge(e),Re(!0))},Me=e=>{e&&(e.type.startsWith("image/")?e.size>10485760?a(r("productCard.imageTooLarge","Image size should be less than 10MB")):(ae(e),oe(URL.createObjectURL(e)),fe(null),ye(1),pe([]),me([])):a(r("productCard.invalidImageFile","Please upload an image file")))},_e=()=>{ae(null),oe(null),pe([]),me([]),Ae([]),ye(1),fe(null),T.current=!1,i.current&&(i.current.value="")},Le=({step:e,current:r,label:t})=>{const a=r>=e,n=r===e;return p.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1,opacity:a?1:.5},children:[p.jsx(m,{sx:{width:32,height:32,borderRadius:"50%",bgcolor:a?"primary.main":"action.disabledBackground",color:a?"white":"text.disabled",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,boxShadow:n?"0 0 0 4px rgba(99, 102, 241, 0.2)":"none",transition:"all 0.3s ease"},children:e}),p.jsx(g,{variant:"subtitle2",sx:{fontWeight:a?600:400},children:t})]})};return p.jsxs(u,{maxWidth:"lg",sx:{py:6,position:"relative",overflow:"hidden"},children:[p.jsx(m,{sx:{position:"absolute",top:-100,left:-100,width:400,height:400,borderRadius:"50%",bgcolor:x(t.palette.primary.main,.15),filter:"blur(100px)",zIndex:-1}}),p.jsx(m,{sx:{position:"absolute",top:100,right:-100,width:300,height:300,borderRadius:"50%",bgcolor:x(t.palette.secondary.main,.15),filter:"blur(80px)",zIndex:-1}}),p.jsxs(m,{sx:{mb:6,textAlign:"center",position:"relative"},children:[p.jsx(g,{variant:"h2",component:"h1",sx:{mb:2,fontWeight:800,fontSize:{xs:"2.5rem",md:"3.5rem"},letterSpacing:"-0.02em",background:"linear-gradient(135deg, #fff 30%, #a855f7 100%)",backgroundClip:"text",WebkitBackgroun
7dClip:"text",WebkitTextFillColor:"transparent",textShadow:"0 20px 40px rgba(168, 85, 247, 0.2)"},children:r("productCard.title","AI Product Card Creator")}),p.jsx(g,{variant:"h6",color:"text.secondary",sx:{maxWidth:600,mx:"auto",fontWeight:400,lineHeight:1.6},children:r("productCard.subtitle","Upload your product photo and let AI create stunning, professional product cards with creative backgrounds and effects")}),p.jsxs(m,{sx:{mt:5,display:"flex",justifyContent:"center",gap:4,flexWrap:"wrap"},children:[p.jsx(Le,{step:1,current:be,label:r("productCard.step1","Upload")}),p.jsx(m,{sx:{width:40,height:2,bgcolor:"divider",alignSelf:"center",opacity:.5}}),p.jsx(Le,{step:2,current:be,label:r("productCard.step2","AI Analysis")}),p.jsx(m,{sx:{width:40,height:2,bgcolor:"divider",alignSelf:"center",opacity:.5}}),p.jsx(Le,{step:3,current:be,label:r("productCard.step3","Generate")})]})]}),he&&p.jsx(h,{severity:"error",sx:{mb:3},onClose:()=>fe(null),children:he}),!te&&p.jsxs(m,{sx:{maxWidth:900,mx:"auto"},children:[p.jsxs(f,{container:!0,spacing:3,sx:{mb:4},children:[p.jsx(f,{item:!0,xs:12,md:4,children:p.jsxs(b,{elevation:0,sx:{p:2,height:"100%",bgcolor:x(t.palette.background.paper,.5),border:"1px solid",borderColor:"divider",borderRadius:3},children:[p.jsx(g,{variant:"subtitle2",color:"text.secondary",sx:{mb:2,fontWeight:700,textTransform:"uppercase",fontSize:"0.75rem",letterSpacing:"0.05em"},children:r("productCard.aiProvider","AI Model")}),p.jsx(m,{sx:{display:"flex",flexDirection:"column",gap:1},children:[{id:"bytedance",name:"Seedream-4.5",cost:"100 credits",recommended:!0},{id:"nano-banana-pro",name:"Nano Banana Pro",cost:"500 credits",recommended:!1},{id:"nano-banana-2",name:"Nano Banana 2",cost:"350 credits",recommended:!1},{id:"nano-banana",name:"Nano Banana",cost:"100 credits"}].map(e=>p.jsxs(m,{onClick:()=>je(e.id),sx:{p:1.5,borderRadius:2,cursor:"pointer",border:"1px solid",borderColor:ve===e.id?"primary.main":"transparent",bgcolor:ve===e.id?x(t.palette.primary.main,.1):"action.hover",transition:"all 0.2s","&:hover":{bgcolor:x(t.palette.primary.main,.05)}},children:[p.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[p.jsx(g,{variant:"body2",fontWeight:600,color:ve===e.id?"primary.main":"text.primary",children:e.name}),e.recommended&&p.jsx(y,{label:"BEST",size:"small",color:"primary",sx:{height:20,fontSize:"0.65rem"}})]}),p.jsx(g,{variant:"caption",color:"text.secondary",children:e.cost})]},e.id))})]})}),p.jsx(f,{item:!0,xs:12,md:8,children:p.jsx(b,{elevation:0,sx:{p:2,height:"100%",bgcolor:x(t.palette.background.paper,.5),border:"1px solid",borderColor:"divider",borderRadius:3},children:p.jsxs(f,{container:!0,spacing:3,children:[p.jsxs(f,{item:!0,xs:12,sm:8,children:[p.jsx(g,{variant:"subtitle2",color:"text.secondary",sx:{mb:2,fontWeight:700,textTransform:"uppercase",fontSize:"0.75rem",letterSpacing:"0.05em"},children:r("productCard.styleDirection","Creative Style")}),p.jsx(m,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:[{id:"auto",name:"Auto",icon:p.jsx(v,{fontSize:"small"})},{id:"minimalist",name:"Minimalist",icon:p.jsx(j,{fontSize:"small"})},{id:"luxury",name:"Luxury",icon:p.jsx(C,{fontSize:"small"})},{id:"dynamic",name:"Dynamic",icon:p.jsx(w,{fontSize:"small"})},{id:"lifestyle",name:"Lifestyle",icon:p.jsx(P,{fontSize:"small"})},{id:"artistic",name:"Artistic",icon:p.jsx(v,{fontSize:"small"})},{id:"custom",name:"Custom",icon:p.jsx(S,{fontSize:"small"})}].map(e=>p.jsxs(m,{onClick:()=>we(e.id),sx:{flex:"1 1 calc(33.33% - 8px)",minWidth:"80px",p:1,borderRadius:2,cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"center",gap:.5,border:"1px solid",borderColor:Ce===e.id?"primary.main":"divider",bgcolor:Ce===e.id?x(t.palette.primary.main,.1):"transparent",color:Ce===e.id?"primary.main":"text.secondary",transition:"all 0.2s","&:hover":{bgcolor:Ce===e.id?x(t.palette.primary.main,.15):"action.hover",borderColor:Ce===e.id?"primary.main":"text.disabled"}},children:[e.icon,p.jsx(g,{variant:"caption",sx:{fontWeight:600,fontSize:"0.7rem",textTransform:"capitalize"},children:e.name})]},e.id))}),"custom"===Ce&&p.jsx(k,{fullWidth:!0,size:"small",placeholder:r("productCard.customStylePlaceholder","e.g., Cyberpunk forest with neon rain..."),value:Pe,onChange:e=>Se(e.target.value),sx:{mt:2},InputProps:{startAdornment:p.jsx(S,{fontSize:"small",sx:{mr:1,color:"text.secondary"}})}})]}),p.jsxs(f,{item:!0,xs:12,sm:4,children:[p.jsx(g,{variant:"subtitle2",color:"text.secondary",sx:{mb:2,fontWeight:700,textTransform:"uppercase",fontSize:"0.75rem",letterSpacing:"0.05em"},children:r("productCard.count","Variations")}),p.jsx(m,{sx:{display:"flex",gap:1},children:[3,5,10].map(e=>p.jsx(m,{onClick:()=>ze(e),sx:{width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"1px solid",borderColor:ke===e?"primary.main":"divider",bgcolor:ke===e?"primary.main":"transparent",color:ke===e?"white":"text.secondary",cursor:"pointer",fontWeight:600,transition:"all 0.2s","&:hover":{transform:"scale(1.1)"}},children:e},e))})]})]})})})]}),p.jsxs(b,{elevation:0,sx:{p:6,mb:3,textAlign:"center",cursor:"pointer",borderRadius:4,border:"2px dashed",borderColor:xe?"primary.main":"divider",background:xe?x(t.palette.primary.main,.08):x(t.palette.background.paper,.4),backdropFilter:"blur(20px)",animation:xe?`${re} 2s ease-in-out infinite`:"none",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{borderColor:"primary.main",transform:"translateY(-4px)",boxShadow:"0 20px 40px -12px rgba(0,0,0,0.1)",bgcolor:x(t.palette.background.paper,.6)}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),ge(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),ge(!1)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:e=>{e.preventDefault(),e.stopPropagation(),ge(!1);const r=e.dataTransfer.files;r&&r.length>0&&Me(r[0])},onClick:()=>{var e;return null==(e=i.current)?void 0:e.click()},children:[p.jsxs(m,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:2.5},children:[p.jsx(m,{sx:{width:80,height:80,borderRadius:"20px",background:"linear-gradient(135deg, #6366f1 0%, #a855f7 100%)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 8px 32px -8px rgba(99, 102, 241, 0.4)",animation:xe?"none":`${ee} 3s ease-in-out infinite`},children:p.jsx(P,{sx:{fontSize:40,color:"white"}})}),p.jsxs(m,{children:[p.jsx(g,{variant:"h6",sx:{mb:.5,fontWeight:700,background:"dark"===t.palette.mode?"linear-gradient(135deg, #e5e7eb 0%, #9ca3af 100%)":"linear-gradient(135deg, #1f2937 0%, #4b5
7563 100%)",backgroundClip:"text",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"},children:r("productCard.uploadProductPhoto","Upload Product Photo")}),p.jsx(g,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:r("productCard.dragDropHint","Drag and drop your product image here, or click to select")}),p.jsx(g,{variant:"caption",color:"text.secondary",children:r("productCard.supportedFormats","Supported: JPG, PNG, GIF, WebP (Max 10MB)")})]}),p.jsx(z,{variant:"contained",startIcon:p.jsx(j,{}),sx:{textTransform:"none",borderRadius:2.5,px:4,py:1.5,fontWeight:600,background:"linear-gradient(135deg, #6366f1 0%, #a855f7 100%)","&:hover":{background:"linear-gradient(135deg, #4f46e5 0%, #9333ea 100%)"}},children:r("productCard.selectImage","Select Image")})]}),p.jsx("input",{ref:i,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>{e.target.files&&e.target.files.length>0&&Me(e.target.files[0])}})]})]}),te&&!ie&&0===ce.length&&p.jsx(b,{sx:{p:3,mb:3,borderRadius:3},children:p.jsxs(f,{container:!0,spacing:3,children:[p.jsxs(f,{item:!0,xs:12,md:6,children:[p.jsx(g,{variant:"h6",sx:{mb:2,fontWeight:600},children:"Uploaded Product Image"}),p.jsx(m,{component:"img",src:ne,alt:"Uploaded product",sx:{width:"100%",height:"auto",borderRadius:2,boxShadow:2}})]}),p.jsx(f,{item:!0,xs:12,md:6,children:p.jsxs(m,{sx:{display:"flex",flexDirection:"column",height:"100%",justifyContent:"center"},children:[p.jsx(g,{variant:"h6",sx:{mb:2,fontWeight:600},children:"Ready for AI Analysis"}),p.jsx(g,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"Our AI will analyze your product and generate 3 creative prompts for stunning product cards with different styles, backgrounds, and effects."}),p.jsxs(m,{sx:{display:"flex",gap:2},children:[p.jsx(z,{variant:"contained",size:"large",startIcon:p.jsx(v,{}),onClick:()=>l(null,null,function*(){var e,t,o;if(!te)return void a(r("productCard.pleaseUploadImage","Please upload an image first"));const i="number"==typeof ke?ke:parseInt(ke);if(isNaN(i)||i<1||i>50)return void a(r("productCard.invalidImageCount","Please select a valid number of images (1-50)"));let l=Ce;if("custom"===Ce){if(!Pe.trim())return void a(r("productCard.enterCustomStyle","Please enter a description for your custom style"));l=Pe.trim()}J.info("Starting product card analysis","ProductCardCreator",{fileName:null==te?void 0:te.name,fileType:null==te?void 0:te.type,fileSize:null==te?void 0:te.size,isFile:te instanceof File,promptCount:i,style:l}),se(!0),me([]),fe(null);try{const{data:a}=yield Be({variables:{input:{image:te,stylePreset:l,promptCount:i}}});if((null==(t=null==(e=null==a?void 0:a.productCardAnalyze)?void 0:e.errors)?void 0:t.length)>0)throw J.error("Product card analysis failed","ProductCardCreator",{errors:a.productCardAnalyze.errors}),new Error(a.productCardAnalyze.errors[0]);if(!((null==(o=null==a?void 0:a.productCardAnalyze)?void 0:o.prompts)&&a.productCardAnalyze.prompts.length>0))throw J.warn("No prompts generated from analysis","ProductCardCreator"),new Error("No prompts generated");J.info("Product card prompts generated successfully","ProductCardCreator",{promptCount:a.productCardAnalyze.prompts.length}),pe(a.productCardAnalyze.prompts.map(e=>d(s({},e),{selected:!0}))),ye(2),n(r("productCard.promptsGenerated","Generated {{count}} creative prompts!",{count:a.productCardAnalyze.prompts.length}))}catch(c){J.error("Error analyzing product image","ProductCardCreator",{error:c.message,stack:c.stack}),fe(c.message||r("productCard.failedToAnalyze","Failed to analyze image")),a(r("productCard.failedToAnalyze","Failed to analyze image"))}finally{se(!1)}}),disabled:ie,sx:{flex:1,py:1.5,fontWeight:600,background:"linear-gradient(135deg, #6366f1 0%, #a855f7 100%)","&:hover":{background:"linear-gradient(135deg, #4f46e5 0%, #9333ea 100%)"}},children:r("productCard.analyzeWithAI","Analyze with AI")}),p.jsx(z,{variant:"outlined",onClick:_e,disabled:ie,children:r("productCard.reset","Reset")})]})]})})]})}),ie&&p.jsxs(b,{sx:{p:4,mb:3,textAlign:"center",borderRadius:3},children:[p.jsx(I,{size:60,sx:{mb:2}}),p.jsx(g,{variant:"h6",sx:{mb:1},children:"AI is analyzing your product..."}),p.jsx(g,{variant:"body2",color:"text.secondary",children:"Generating creative prompts for stunning product cards"}),p.jsx(A,{sx:{mt:3,borderRadius:1}})]}),ce.length>0&&0===ue.length&&p.jsxs(b,{sx:{p:3,mb:3,borderRadius:3},children:[p.jsx(g,{variant:"h5",sx:{mb:3,fontWeight:600},children:"Generated Creative Prompts"}),p.jsx(f,{container:!0,spacing:2,children:ce.map((e,r)=>p.jsx(f,{item:!0,xs:12,children:p.jsx(W,{onClick:()=>(e=>{pe(r=>r.map((r,t)=>t===e?d(s({},r),{selected:!r.selected}):r))}
7)(r),sx:{cursor:"pointer",borderLeft:4,border:"2px solid",borderColor:e.selected?`hsl(${120*r}, 70%, 55%)`:"divider",borderLeftColor:`hsl(${120*r}, 70%, 55%)`,opacity:e.selected?1:.6,transform:e.selected?"scale(1)":"scale(0.98)",transition:"all 0.2s","&:hover":{transform:"translateX(4px)",opacity:1,borderColor:e.selected?`hsl(${120*r}, 70%, 55%)`:"text.disabled"},position:"relative"},children:p.jsxs(R,{children:[p.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[p.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[p.jsx(y,{label:`Style ${r+1}`,size:"small",sx:{mr:1,background:`hsl(${120*r}, 70%, 55%)`,color:"white"}}),p.jsx(g,{variant:"h6",sx:{fontWeight:600},children:e.title})]}),e.selected?p.jsx(F,{sx:{color:"primary.main",fontSize:28}}):p.jsx(G,{sx:{color:"text.disabled",fontSize:28}})]}),p.jsx(g,{variant:"body2",color:"text.secondary",children:e.description})]})})},r))}),p.jsxs(m,{sx:{mt:3,display:"flex",gap:2,justifyContent:"center"},children:[p.jsx(z,{variant:"contained",size:"large",startIcon:de?p.jsx(I,{size:20}):p.jsx(v,{}),onClick:()=>l(null,null,function*(){var e,t,i;const s=ce.filter(e=>e.selected);if(0===s.length)return void a(r("productCard.noPromptsSelected","Please select at least one prompt"));let d=0;"nano-banana-pro"===ve?d=500:"nano-banana-2"===ve?d=350:"bytedance"===ve&&(d=100);const l=s.length*d;if(l>0&&!X(o,l))return J.info("Insufficient credits for product card generation - showing billing dialog","ProductCardCreator",{requiredCredits:l,currentCredits:(null==o?void 0:o.sumActiveCredits)||0,deficit:l-((null==o?void 0:o.sumActiveCredits)||0),promptCount:s.length,provider:ve,hasVerifiedCard:(null==o?void 0:o.stripePaymentMethodId)&&(null==o?void 0:o.paymentMethodVerifiedAt)}),a(r("productCard.notEnoughCredits","Not enough credits to generate product cards")),void K({source:"product-card-generation"});T.current=!1,J.info("Starting async product card generation","ProductCardCreator",{promptCount:s.length,fileName:null==te?void 0:te.name,provider:ve,estimatedCredits:l}),le(!0),fe(null);try{const{data:a}=yield Ne({variables:{input:{image:te,prompts:s,aspectRatio:"1:1",provider:ve}}});if((null==(t=null==(e=null==a?void 0:a.productCardGenerateAsync)?void 0:e.errors)?void 0:t.length)>0)throw J.error("Product card generation failed","ProductCardCreator",{errors:a.productCardGenerateAsync.errors}),new Error(a.productCardGenerateAsync.errors[0]);if(!((null==(i=null==a?void 0:a.productCardGenerateAsync)?void 0:i.videoPictures)&&a.productCardGenerateAsync.videoPictures.length>0))throw J.warn("No jobs created","ProductCardCreator"),new Error("Failed to create generation jobs");{const e=a.productCardGenerateAsync.videoPictures;J.info("Product card jobs created successfully","ProductCardCreator",{jobCount:e.length,ids:e.map(e=>e.id)}),ye(3);const t={bytedance:"Seedream-4.5","nano-banana-pro":"Nano Banana Pro","nano-banana":"Nano Banana"}[ve]||ve;let o=0;"nano-banana-pro"===ve?o=500:"bytedance"===ve&&(o=100);const i=s.length*o,d=i>0?r("productCard.costPaid"," ({{credits}} credits)",{credits:i}):r("productCard.costFree"," (Free)");n(r("productCard.generationStarted","Started generating {{count}} product cards with {{provider}}{{cost}}! Results will appear below when ready.",{count:e.length,provider:t,cost:d})),Ae(e.map(e=>e.id)),me(e.map(e=>{var r,t;return{id:e.id,status:e.status,url:null,title:(null==(r=e.metadata)?void 0:r.creative_style)||(null==(t=e.metadata)?void 0:t.product_card_title),description:e.prompt}}))}}catch(c){J.error("Error generating product cards","ProductCardCreator",{error:c.message,stack:c.stack,graphQLErrors:c.graphQLErrors,networkError:c.networkError});const e=c.message||r("productCard.failedToGenerate","Failed to generate product cards");fe(e),a(e)}finally{le(!1)}}),disabled:de||0===ce.filter(e=>e.selected).length,sx:{px:6,py:1.5,fontWeight:600,background:"linear-gradient(135deg, #6366f1 0%, #a855f7 100%)","&:hover":{background:"linear-gradient(135deg, #4f46e5 0%, #9333ea 100%)"},"&.Mui-disabled":{background:"action.disabledBackground",color:"text.disabled"}},children:de?r("productCard.generating","Generating..."):r("productCard.generateSelected","Generate {{count}} Product Cards{{cost}}",{count:ce.filter(e=>e.selected).length,cost:(()=>{let e=0;
7"nano-banana-pro"===ve?e=500:"nano-banana-2"===ve?e=350:"bytedance"===ve&&(e=100);const r=ce.filter(e=>e.selected).length*e;return r>0?` (${r} credits)`:" (Free)"})()})}),p.jsx(z,{variant:"outlined",onClick:_e,disabled:de,children:r("productCard.startOver","Start Over")})]})]}),de&&p.jsxs(b,{sx:{p:4,mb:3,textAlign:"center",borderRadius:3},children:[p.jsx(I,{size:60,sx:{mb:2}}),p.jsx(g,{variant:"h6",sx:{mb:1},children:"Creating stunning product cards..."}),p.jsx(g,{variant:"body2",color:"text.secondary",children:"This may take a minute. AI is working its magic!"}),p.jsx(A,{sx:{mt:3,borderRadius:1}})]}),ue.length>0&&p.jsxs(b,{sx:{p:3,borderRadius:3},children:[p.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:[p.jsx(g,{variant:"h5",sx:{fontWeight:600},children:ue.some(e=>"processing"===e.status)?r("productCard.productCardsGenerating","Product Cards Generating..."):r("productCard.yourProductCards","Your Product Cards")}),p.jsx(z,{variant:"outlined",startIcon:p.jsx(w,{}),onClick:_e,children:r("productCard.createNew","Create New")})]}),ue.some(e=>"processing"===e.status)&&p.jsx(h,{severity:"info",sx:{mb:3,borderRadius:2},children:p.jsxs(g,{variant:"body2",children:[p.jsx("strong",{children:r("productCard.cardsBeingGenerated","Your product cards are being generated!")})," ","bytedance"===ve?r("productCard.bytedanceInfo","Using ByteDance Seedream for high-quality results (1-2 min per image)."):"nano-banana-pro"===ve?r("productCard.nanoBananaProInfo","Using Nano Banana Pro for premium quality (500 credits, 1-2 min per image)."):"nano-banana-2"===ve?r("productCard.nanoBanana2Info","Using Nano Banana 2 for high quality (350 credits, 1-2 min per image)."):r("productCard.nanoBananaInfo","Using Nano Banana (Free, 30-60 sec per image).")," ",r("productCard.resultsAppearAutomatically","Results will appear below automatically.")]})}),p.jsx(f,{container:!0,spacing:3,children:ue.map((e,a)=>{var n,o;return p.jsx(f,{item:!0,xs:12,md:4,children:p.jsxs(W,{sx:{height:"100%",display:"flex",flexDirection:"column",transition:"transform 0.3s",border:"completed"===e.status?"none":"2px solid",borderColor:"failed"===e.status?t.palette.error.main:t.palette.primary.main,"&:hover":"completed"===e.status?{transform:"translateY(-8px)",boxShadow:6}:{}},children:["completed"===e.status&&e.url?p.jsx(B,{component:"img",image:e.url,alt:e.title,onClick:()=>$e(e),sx:{height:300,objectFit:"cover",cursor:"pointer"}}):p.jsx(m,{sx:{height:300,display:"flex",alignItems:"center",justifyContent:"center",background:"failed"===e.status?`linear-gradient(135deg, ${x(t.palette.error.main,.1)} 0%, ${x(t.palette.error.dark,.1)} 100%)`:`linear-gradient(135deg, ${x(t.palette.primary.main,.1)} 0%, ${x(t.palette.secondary.main,.1)} 100%)`},children:p.jsx(m,{sx:{textAlign:"center",px:2},children:"failed"===e.status?p.jsxs(p.Fragment,{children:[p.jsx(g,{variant:"h6",sx:{fontWeight:600,color:"error.main",mb:1},children:r("productCard.generationFailed","Generation Failed")}),p.jsx(g,{variant:"body2",color:"text.secondary",children:e.errorMessage||r("productCard.errorOccurred","An error occurred")})]}):p.jsxs(p.Fragment,{children:[p.jsx(I,{size:60,sx:{mb:2}}),p.jsx(g,{variant:"h6",sx:{fontWeight:600},children:"Generating..."}),p.jsx(g,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"bytedance"===ve?"~1-2 minutes":"~30-60 seconds"})]})})}),p.jsxs(R,{sx:{flexGrow:1},children:[p.jsx(g,{variant:"h6",sx:{mb:1,fontWeight:600},children:e.title||(null==(n=ce[a])?void 0:n.title)}),p.jsxs(g,{variant:"body2",color:"text.secondary",children:[null==(o=e.description)?void 0:o.substring(0,150),"..."]}),p.jsx(y,{label:"completed"===e.status?r("productCard.completed","Completed"):"failed"===e.status?r("productCard.failed","Failed"):r("productCard.processing","Processing"),size:"small",color:"completed"===e.status?"success":"failed"===e.status?"error":"primary",sx:{mt:2}})]}),"completed"===e.status&&e.url&&p.jsx(N,{children:p.jsx(z,{fullWidth:!0,variant:"contained",startIcon:p.jsx(D,{}),onClick:()=>(e=>{if(!e)return;const r=Z(e),t=r.includes("?")?`${r}&dl=true`:`${r}?dl=true`;window.open(t,"_blank")})(e.url),sx:{background:"linear-gradient(135deg, #6366f1 0%, #a855f7 100%)","&:hover":{background:"linear-gradient(135deg, #4f46e5 0%, #9333ea 100%)"}},children:r("productCard.download","Download")})})]})},e.id||a)})})]}),(null==(e=null==Ee?void 0:Ee.productCardHistory)?void 0:e.length)>0&&p.jsxs(b,{sx:{p:3,mt:4,borderRadius:3},children:[p.jsx(g,{variant:"h5",sx:{mb:3,fontWeight:600},children:r("productCard.recentCreations","Recent Creations")}),p.jsx(f,{container:!0,spacing:2,children:Ee.productCardHistory.filter(e=>"completed"===e.status&&(e.s3Url||e.url)).map(e=>{var r;return p.jsx(f,{item:!0,xs:6,sm:4,md:3,lg:2,children:p.jsx(m,{onClick:()=>{var r;return $e({id:e.id,url:e.s3Url||e.url,title:(null==(r=e.metadata)?void 0:r.product_card_title)||"Product Card",description:e.prompt,status:"completed"})},sx:{position:"relative",paddingTop:"100%",borderRadius:2,overflow:"hidden",cursor:"pointer","&:hover":{transform:"scale(1.02)",boxShadow:4},transition:"all 0.2s ease"},children:p.jsx(m,{component:"img",src:e.s3Url||e.url,alt:(null==(r=e.metadata)?void 0:r.product_card_title)||"Product card",sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover"}})})},e.id)})})]}),p.jsx(Q,{open:We,onClose:()=>Re(!1),imageUrl:null==Fe?void 0:Fe.url,prompt:(null==Fe?void 0:Fe.description)||(null==Fe?void 0:Fe.title)})]})};export{te as default};
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.