1import z from"./WRyiheJW.js";import{d as N,k as m,j as k,Q as X,o as r,c as f,a as n,M as g,N as S,u as t,O as P,al as L,H as q,I as H,b as M,G as T,A as $,B as K,e as B,s as b,bj as U,_ as G,t as R}from"./CRcD7-OL.js";import{a as Q}from"./DhXgJQ-f.js";import{a as J,_ as W}from"./DCrCMa3K.js";const Z={style:{display:"flex","flex-grow":"1","flex-shrink":"1","flex-direction":"column",overflow:"hidden"}},ee={class:"p-3"},te={class:"p-3 pt-0",style:{"flex-grow":"1","flex-shrink":"1",overflow:"auto"}},oe={style:{display:"grid","grid-template-columns":"1fr 1fr 1fr 1fr",gap:"10px"}},ae=["onClick"],ne=["src","alt"],se=N({__name:"PhotoLibrary",props:{active:{type:Boolean}},emits:["pick"],setup(u,{emit:y}){const _=y,o=m(""),l=m(!1),e=m([]),p=k(()=>e.value.filter(d=>o.value===""||d.name.indexOf(o.value)!==-1||d.tags.indexOf(o.value)!==-1));async function c(){if(e.value.length>0)return;l.value=!0;const{data:d}=await Q.get("/api/photo-library");e.value=d,l.value=!1}function h(d){_("pick",d)}return X(async()=>{await c()}),(d,v)=>(r(),f("div",Z,[n("div",ee,[g(n("input",{placeholder:"Filter photos...",type:"text",style:{"flex-shrink":"0"},class:"form-control","onUpdate:modelValue":v[0]||(v[0]=i=>P(o)?o.value=i:null)},null,512),[[S,t(o)]])]),n("div",te,[g(n("div",null,"Loading...",512),[[L,t(l)]]),g(n("div",null,"No Photos found.",512),[[L,!t(l)&&t(p).length===0]]),g(n("div",oe,[(r(!0),f(q,null,H(t(p),i=>(r(),f("div",{class:"d-flex align-items-center justify-content-center",style:{cursor:"pointer"},onClick:w=>h(i),key:i.id},[n("img",{style:{"max-width":"100%","max-height":"230px"},src:i.thumb,alt:i.name,loading:"lazy"},null,8,ne)],8,ae))),128))],512),[[L,!t(l)&&t(p).length>0]])])]))}});var V=(u=>(u.CUSTOM_ERROR="CUSTOM_ERROR",u.URL_IN_USE="URL_IN_USE",u.DOMAIN_INVALID="DOMAIN_INVALID",u.DOMAIN_IN_USE="DOMAIN_IN_USE",u.DOMAIN_LIST_FULL="DOMAIN_LIST_FULL",u.AIGENERATOR_EXCEEDED_DAILY_LIMIT="AIGENERATOR_EXCEEDED_DAILY_LIMIT",u))(V||{});const le={style:{display:"flex","flex-grow":"1","flex-shrink":"1","flex-direction":"column",overflow:"hidden"}},ie={class:"p-3 input-group"},re=["disabled"],ue={class:"p-3 pt-0",style:{"flex-grow":"1","flex-shrink":"1",overflow:"auto"}},ce={class:"resultCanvas position-relative"},de={key:0},me=["src"],fe={key:0},_e={class:"pt-3 text-right"},pe={key:1},ve=N({__name:"AIGenerator",emits:["pick"],setup(u,{emit:y}){const _=y,o=m(""),l=m(""),e=m(!1),p=k(()=>o.value.length>3&&!e.value),c=()=>{i.value=!1,D()},h=k(()=>!e.value),d=m(""),v=["Thank you for your prompt. Your image will be ready in a moment...","Our robots are working really hard to generate your image...","Take a small break and stretch your body...","I'm doing my best, please don't close me yet..."],i=m(!1),w=m(""),C=k(()=>w.value===V.AIGENERATOR_EXCEEDED_DAILY_LIMIT);async function D(){e.value=!0,Y();try{const s=await $fetch("/api/generate/image",{method:"POST",body:{query:o.value}});l.value=s.data[0].url||""}catch(s){w.value=s?.data?.errors?.[0]?.code,i.value=!0}e.value=!1}let E=null;const F=s=>new Promise(a=>setTimeout(()=>{a(!0)},s));async function Y(){for(let s=0;s<v.length;s++){if(h.value)return;await O(v[s],0),await F(600),s===v.length-1&&(s=0)}}function O(s,a,x=null){return new Promise(A=>{if(s.length<a||h.value)return clearTimeout(E),x(!0);d.value=s.slice(0,a),E=setTimeout(async()=>{await O(s,a+1,x||A)},66)})}function j(){l.value&&_("pick",{id:1,image:l.value,name:o.value,tags:"",thumb:""})}return(s,a)=>{const x=J,A=W;return r(),f("div",le,[n("div",ie,[g(n("input",{placeholder:"Imagine a laundromat on top of Mont Blanc, surrounded by flowers...",type:"text",style:{"flex-shrink":"0"},disabled:t(e),class:"form-control","onUpdate:modelValue":a[0]||(a[0]=I=>P(o)?o.value=I:null)},null,8,re),[[S,t(o)]]),M(x,{onClick:D,processing:t(e),disabled:!t(p)},{default:T(()=>a[4]||(a[4]=[$("Generate")])),_:1},8,["processing","disabled"])]),n("div",ue,[n("div",ce,[t(e)?(r(),f("div",de,K(t(d)),1)):t(l)?(r(),f("img",{key:1,class:"resultImage",onClick:j,src:t(l),alt:"Generated image"},null,8,me)):B("",!0)])]),(r(),b(U,{to:"body"},[M(A,{title:"Something went wrong",type:"warning",active:t(i),onClose:a[2]||(a[2]=I=>i.value=!1),onCancel:a[3]||(a[3]=I=>i.value=!1),onConfirm:c,"confirm-button-text":"Retry Again","show-buttons":!t(C)},{default:T(()=>[t(C)?(r(),f("div",fe,[a[5]||(a[5]=$(" You have exceeded your daily limit. ")),n("div",_e,[n("button",{class:"btn btn-primary",onClick:a[1]||(a[1]=I=>i.value=!1)}
1," OK ")])])):(r(),f("div",pe," Could not generate the image. Please try again or change your prompt. "))]),_:1},8,["active","show-buttons"])]))])}}}),ye=G(ve,[["__scopeId","data-v-f72e88eb"]]),ge={class:"d-flex flex-row overflow-hidden flex-grow-1"},he={class:"photoLibraryModal__menu"},xe=N({__name:"PhotoLibraryModal",props:{multiSelect:{type:Boolean,default:()=>!1},active:{type:Boolean,default:()=>!1}},emits:["close","pick"],setup(u,{emit:y}){const _=y,o=m(2);return(l,e)=>{const p=z;return r(),b(U,{to:"body"},[M(p,{style:{height:"100vh"},"body-class":"d-flex flex-column p-0",onClose:e[4]||(e[4]=c=>_("close")),title:"Photo Library",size:"lg",active:l.active},{default:T(()=>[n("div",ge,[n("div",he,[n("a",{href:"#",onClick:e[0]||(e[0]=c=>o.value=0),class:R({active:t(o)===0})},"AI Generator",2),n("a",{href:"#",onClick:e[1]||(e[1]=c=>o.value=2),class:R({active:t(o)===2})},"CleanCloud Library",2)]),t(o)===2?(r(),b(se,{key:0,onPick:e[2]||(e[2]=c=>_("pick",c)),active:l.active},null,8,["active"])):t(o)===0?(r(),b(ye,{key:1,onPick:e[3]||(e[3]=c=>_("pick",c))})):B("",!0)])]),_:1},8,["active"])])}}}),Ae=G(xe,[["__scopeId","data-v-8d9c1fc4"]]);export{Ae 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.