1import{j as e}from"./vendor-ui-BRVg3_iW.js";import{d as ae,r as i}from"./vendor-react-fhnP-ZxB.js";import{ah as L,a$ as te,u as re,ae as se,aD as I,$ as F,x as y,_ as A,y as G,S as ie,az as oe,R as ne,bf as le,o as de,b8 as ce}from"./index-BTZS4ZAF.js";import{L as v}from"./label-BPIIQwcF.js";import{T as me}from"./textarea-D-Y40bXc.js";import{u as pe}from"./useRemixHydration-DNXyxCHI.js";import{u as ue}from"./useGenerationHistory-DBXUsrfx.js";import{a as ge,T as u}from"./ToolLayout-Bc2WyZbj.js";import{D as he}from"./download-DVZYklFy.js";import{B as xe}from"./box-CvzJWciA.js";import{C as be}from"./coffee-CLdwYoSj.js";import"./vendor-three-BixXOMS4.js";import"./vendor-charts-CM-rxR9X.js";import"./vendor-radix-B2hiDlNL.js";import"./vendor-query-fmpM_ONB.js";import"./vendor-supabase-BDcQUG0T.js";import"./vendor-date-D8Ds2zcx.js";import"./generate-button-DIINowSl.js";import"./sheet-BF2okP4S.js";import"./collapsible-CSOUtSE9.js";import"./info-BFYLvu4e.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const fe=L("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const ye=L("Droplet",[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const ve=L("Wine",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5Z",key:"10ffi3"}]]),O="label-designer",P=[{id:"bottle-label",name:"Bottle Label",icon:ve,aspect:"2:3",hint:"wine, spirits, sauce, oil"},{id:"box-front",name:"Box / Carton",icon:xe,aspect:"4:5",hint:"cereal, supplements, tea boxes"},{id:"pouch-bag",name:"Pouch / Bag",icon:le,aspect:"3:4",hint:"coffee, snacks, pet food"},{id:"can-wrap",name:"Can Wrap",icon:be,aspect:"16:9",hint:"energy drinks, soda, beer"},{id:"tube-jar",name:"Tube / Jar",icon:ye,aspect:"3:4",hint:"cosmetics, skincare, balms"},{id:"food-package",name:"Food Wrapper",icon:fe,aspect:"1:1",hint:"bars, chocolate, snacks"}],B=[{id:"minimal-luxury",name:"Minimal Luxury",desc:"Aesop / Le Labo â generous space, refined type"},{id:"bold-modern",name:"Bold Modern",desc:"Liquid Death / Athletic Greens â high contrast"},{id:"vintage-craft",name:"Vintage Craft",desc:"Apothecary, woodblock prints, hand-drawn"},{id:"playful-color",name:"Playful Color",desc:"Olipop / Recess â pastel blocks, fun shapes"},{id:"clinical-clean",name:"Clinical Clean",desc:"Cerave / The Ordinary â labels-as-spec-sheets"},{id:"editorial-mono",name:"Editorial Mono",desc:"Black & white, Swiss grid, magazine type"},{id:"organic-natural",name:"Organic Natural",desc:"Kraft, botanicals, earth tones, recycled feel"},{id:"premium-foil",name:"Premium Foil",desc:"Gold foil, embossed, deep saturated brand color"}],T=[{id:"kraft-earth",name:"Kraft Earth",colors:["#8B6F47","#D4B896","#2D2418"]},{id:"matte-black",name:"Matte Black",colors:["#0A0A0A","#1F1F1F","#C9A84C"]},{id:"pharmacy-mint",name:"Pharmacy",colors:["#F4FFFE","#A8E6D9","#1A4D44"]},{id:"blush-cream",name:"Blush Cream",colors:["#FAF0E6","#F5C2B5","#5C3A2E"]},{id:"deep-emerald",name:"Emerald Lux",colors:["#0F3B2E","#1A6B4F","#D4AF37"]},{id:"neon-pop",name:"Neon Pop",colors:["#FF3E5F","#FFD93D","#00C2A8"]},{id:"ocean-cool",name:"Ocean Cool",colors:["#E6F2F5","#5BA9B8","#0C2340"]},{id:"monochrome",name:"Mono",colors:["#FFFFFF","#1A1A1A","#7A7A7A"]}],je=[{id:"flat",name:"Flat Artwork",desc:"Print-ready label, head-on, studio lighting"},{id:"mockup",name:"On Product",desc:"Photorealistic mockup on the actual package"}];function We(){const{toast:l}=te();ae();const{session:g}=re(),{balance:j,deductCredits:U,refundCredits:q,getToolCost:W}=se(),{history:M,addToHistory:z}=ue("label-designer"),k=W(O),[o,H]=i.useState(""),[n,V]=i.useState(""),[N,K]=i.useState(""),[w,S]=i.useState(""),[m,_]=i.useState(P[0].id),[p,J]=i.useState(B[0].id),[h,Y]=i.useState(T[0].id),[x,Z]=i.useState("flat"),[d,D]=i.useState(!1),[c,C]=i.useState(null);pe({onPrompt:a=>S(a),acceptMediaTypes:["image"]});const b=P.find(a=>a.id===m),R=B.find(a=>a.id===p),Q=T.find(a=>a.id===h),X=()=>{const a=Q.colors.join(", ");return[x==="flat"?`Print-ready FLAT ARTWORK of a ${b.name.toLowerCase()} label/packaging design, head-on view, centered on a soft neutral studio background.`:`Photorealistic product photography of a finished ${b.name.toLowerCase()} sitting on a soft neutral studio surface, gentle directional lighting, shallow depth of field â the label/packaging artwork must be perfectly legible.`,`Brand: "${o}"${n?`, product: "${n}"`:""}.`,N?`Tagline: "${N}".`:"",w?`Required copy that MUST appear legibly and correctly spelled on the label: ${w.split(` 17`).map(r=>`"${r.trim()}
17"`).filter(Boolean).join(", ")}.`:"",`Design direction: ${R.name} â ${R.desc}.`,`Color palette: ${a} (use these hex colors precisely; primary surface, accent, type).`,"Typography: confident, hierarchical, real legible letterforms. NO gibberish text, NO lorem ipsum, NO misspellings.",`Composition: professional packaging-design quality, balanced hierarchy, generous margins, premium brand feel. ${b.hint} category cues.`,"Avoid: warped text, blurry type, watermarks, stock-photo cliches, AI artifacts."].filter(Boolean).join(" ")},E=async()=>{var s;if(!o.trim()){l({title:"Brand name required",description:"Enter the brand that appears on the label.",variant:"destructive"});return}if(j!==null&&j<k){l({title:"Insufficient credits",description:`Need ${k} credits, you have ${j}.`,variant:"destructive"});return}const a=await U(O,{});if(!a.success){l({title:"Could not deduct credits",description:a.error||"Try again",variant:"destructive"});return}D(!0),C(null);try{const r=X(),{data:t,error:$}=await de.functions.invoke("gpt-image-2",{body:{prompt:r,mode:"generate",aspectRatio:b.aspect,resolution:"2K"}});if($)throw new Error($.message||"Generation failed");if(t!=null&&t.error)throw new Error(t.error);const f=(t==null?void 0:t.imageUrl)||(t==null?void 0:t.url);if(!f)throw new Error("No image returned");C(f),z({imageUrl:f,tool:"label-designer",model:"gpt-image-2",settings:{brandName:o,productName:n,packageType:m,styleVibe:p,palette:h,renderMode:x}}),(s=g==null?void 0:g.user)!=null&&s.id&&ce({userId:g.user.id,name:`${o}${n?" â "+n:""} Label`,content:f,type:"image_prompt",tags:["label","packaging",o,m,p],metadata:{brandName:o,productName:n,packageType:m,styleVibe:p,palette:h,renderMode:x,model:"gpt-image-2"}}),l({title:"Label generated",description:"Saved to your assets."})}catch(r){const t=r instanceof Error?r.message:"Generation failed";a.transactionId&&await q(a.transactionId),l({title:"Generation failed",description:t,variant:"destructive"})}finally{D(!1)}},ee=async()=>{if(c)try{const s=await(await fetch(c)).blob(),r=URL.createObjectURL(s),t=document.createElement("a");t.href=r,t.download=`${o||"label"}-${Date.now()}.png`,t.click(),URL.revokeObjectURL(r)}catch{l({title:"Download failed",variant:"destructive"})}};return e.jsx(ge,{title:"Label & Packaging Designer",description:"Print-ready labels and product packaging with legible typography â powered by GPT Image 2",icon:e.jsx(I,{className:"w-6 h-6"}),backPath:"/creative-studio",badge:"NEW",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[420px_1fr] gap-6",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsx(u,{title:"Brand",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(v,{htmlFor:"brand",children:"Brand name *"}),e.jsx(F,{id:"brand",value:o,onChange:a=>H(a.target.value),placeholder:"e.g. AURELIA"})]}),e.jsxs("div",{children:[e.jsx(v,{htmlFor:"product",children:"Product name"}),e.jsx(F,{id:"product",value:n,onChange:a=>V(a.target.value),placeholder:"e.g. Vitamin C Serum"})]}),e.jsxs("div",{children:[e.jsx(v,{htmlFor:"tag",children:"Tagline"}),e.jsx(F,{id:"tag",value:N,onChange:a=>K(a.target.value),placeholder:"e.g. Brighten. Restore."})]}),e.jsxs("div",{children:[e.jsx(v,{htmlFor:"must",children:"Must-include copy (one per line)"}),e.jsx(me,{id:"must",value:w,onChange:a=>S(a.target.value),rows:3,placeholder:`30ml / 1 fl oz 18Made in Italy 19Net wt. 250g`})]})]})}),e.jsx(u,{title:"Package format",children:e.jsx("div",{className:"grid grid-cols-3 gap-2",children:P.map(a=>{const s=a.icon,r=m===a.id;return e.jsxs("button",{onClick:()=>_(a.id),className:y("flex flex-col items-center justify-center gap-1.5 p-3 rounded-lg border text-xs font-medium transition-all",r?"border-primary bg-primary/10 text-primary":"border-border hover:border-primary/50"),children:[e.jsx(s,{className:"w-5 h-5"}),e.jsx("span",{children:a.name})]},a.id)})})}),e.jsx(u,{title:"Style vibe",children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:B.map(a=>{const s=p===a.id;return e.jsxs("button",{onClick:()=>J(a.id),className:y("p-3 rounded-lg border text-left transition-all",s?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:[e.jsx("div",{className:"text-xs font-semibold mb-0.5",children:a.name}),e.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:a.desc})]},a.id)})})}),e.jsx(u,{title:"Color palette",children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:T.map(a=>{const s=h===a.id;return e.jsxs("button",{onClick:()=>Y(a.id),className:y("flex items-center gap-2 p-2 rounded-lg border text-left transition-all",s?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:[e.jsx("div",{className:"flex -sp
19ace-x-1",children:a.colors.map(r=>e.jsx("div",{className:"w-5 h-5 rounded-full border-2 border-background",style:{background:r}},r))}),e.jsx("span",{className:"text-xs font-medium",children:a.name})]},a.id)})})}),e.jsx(u,{title:"Render",children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:je.map(a=>{const s=x===a.id;return e.jsxs("button",{onClick:()=>Z(a.id),className:y("p-3 rounded-lg border text-left transition-all",s?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:[e.jsx("div",{className:"text-xs font-semibold mb-0.5",children:a.name}),e.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:a.desc})]},a.id)})})}),e.jsx(A,{onClick:E,disabled:d||!o.trim(),className:"w-full h-12 text-base font-semibold",size:"lg",children:d?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-5 h-5 mr-2 animate-spin"})," Generatingâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-5 h-5 mr-2"})," Generate Label · ",k," credits"]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative aspect-[4/5] rounded-2xl border border-border bg-gradient-to-br from-muted/50 to-muted/20 overflow-hidden flex items-center justify-center",children:[d&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx(G,{className:"w-10 h-10 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Rendering legible typography⦠(~30s)"})]}),!d&&c&&e.jsx("img",{src:c,alt:"Generated label",className:"w-full h-full object-contain"}),!d&&!c&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground text-center px-8",children:[e.jsx(I,{className:"w-12 h-12 opacity-40"}),e.jsx("p",{className:"text-sm",children:"Your generated label or packaging mockup will appear here."}),e.jsx(oe,{variant:"secondary",className:"text-[10px]",children:"GPT Image 2 · best-in-class text rendering"})]})]}),c&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(A,{onClick:ee,variant:"outline",className:"flex-1",children:[e.jsx(he,{className:"w-4 h-4 mr-2"})," Download PNG"]}),e.jsxs(A,{onClick:E,variant:"outline",className:"flex-1",disabled:d,children:[e.jsx(ne,{className:"w-4 h-4 mr-2"})," Regenerate"]})]}),M.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-2",children:"Recent"}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:M.slice(0,8).map(a=>e.jsx("button",{onClick:()=>C(a.imageUrl),className:"aspect-square rounded-lg overflow-hidden border border-border hover:border-primary transition",children:e.jsx("img",{src:a.imageUrl,alt:"Previous generation",className:"w-full h-full object-cover"})},a.id))})]})]})]})})}export{We 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.