import{_ as v}from"./G24rXNST.js";import{f as C,k as r,g,w as n,o as m,b as l,a as o,u as e,d as c,c as y,h as L,t as U,x as B}from"./CHE_Tp0v.js";import{_ as I,L as V}from"./5Comp21f.js";import{_ as h}from"./BhsDC82x.js";import{_ as j}from"./DLpLuxJb.js";import{_ as N}from"./CIAQ9kt7.js";import{a as R}from"./CC9JbaFT.js";import"./KpqJrd4k.js";import"./3jpnglT2.js";import"./YmayMpXp.js";import"./Cx7biS1C.js";import"./CVjz9atH.js";/**
 * @license lucide-vue-next v0.376.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $=R("CloudUploadIcon",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]]),q={class:"grid gap-6 rounded-lg border p-4"},G=o("legend",{class:"-ml-1 px-1 text-sm font-medium"},"Options",-1),M={class:"flex items-center justify-center w-full"},P={for:"dropzone-file",class:"flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50"},S={key:0,class:"flex flex-col items-center justify-center pt-5 pb-6"},z=o("p",{class:"mb-2 text-sm text-gray-500"},[o("span",{class:"font-semibold"},"Click to upload"),c(" an image ")],-1),A=o("p",{class:"text-xs text-gray-500"},"PNG, JPEG or WEBP, max 10MB",-1),D=["src"],E={class:"grid gap-3"},T=2,se=C({__name:"image2logo",setup(F){const i=r(!1),a=r({keywords:"",image:null,mimeType:"",extension:""}),f=r(null),u=r(null),k=()=>{f.value.makeRequest()},b=()=>{i.value=!1,u.value.refreshCredit()},p=r(null),x=_=>{var d;const t=(d=_.target.files)==null?void 0:d[0];if(t){p.value=URL.createObjectURL(t);const s=new FileReader;s.readAsDataURL(t),s.onload=()=>{const w=s.result.split(",")[1];a.value.image=w,a.value.mimeType=t.type,a.value.extension=t.name.split(".").pop()}}};return(_,t)=>{const d=v;return m(),g(I,{ref_key:"dashboard",ref:u},{default:n(()=>[l(N,{modelName:"Image to Logo",endpoint:"image2logo",reqConfig:e(a),ref_key:"logoGen",ref:f,onStarted:t[1]||(t[1]=s=>i.value=!0),onCompleted:b},{default:n(()=>[o("form",{class:"grid w-full items-start gap-6 overflow-auto",onSubmit:B(k,["prevent"])},[o("fieldset",q,[G,l(e(h),null,{default:n(()=>[c("Upload an image")]),_:1}),o("div",M,[o("label",P,[e(p)?(m(),y("img",{key:1,src:e(p),alt:"Selected Image",class:"object-contain h-64 w-full p-2 rounded-lg"},null,8,D)):(m(),y("div",S,[l(e($),{class:"h-12 w-12 text-gray-500"}),z,A])),o("input",{id:"dropzone-file",type:"file",class:"hidden",onChange:x},null,32)])]),o("div",E,[l(e(h),{for:"keywords"},{default:n(()=>[c("Additional prompt (optional)")]),_:1}),l(e(j),{modelValue:e(a).keywords,"onUpdate:modelValue":t[0]||(t[0]=s=>e(a).keywords=s),id:"keywords",placeholder:"make the background blue"},null,8,["modelValue"])])]),l(d,{type:"submit",disabled:e(i)},{default:n(()=>[e(i)?(m(),g(e(V),{key:0,class:"h-5 w-5 me-2 animate-spin"})):L("",!0),c(" Generate logo ("+U(T)+" credits) ")]),_:1},8,["disabled"])],32)]),_:1},8,["reqConfig"])]),_:1},512)}}});export{se as default};
