PageSourceSearch

https://imageser-webui.hf.space/_app/immutable/nodes/34.Br1abYto.js

js imageser-webui.hf.space collected 2026-10-03 16:58:48 UTC 6,827 bytes, 2 lines download raw bytes

1import"../chunks/CWj6FrbW.js";import"../chunks/69_IOA4Y.js";import{p as xe,g as ye,o as _e,t as y,l as a,q as c,a as m,b as we,s as ke,n as h,c as o,d as L,k as g,f as p,m as _,e as X,r,aK as Re,aG as Y,aC as Le}from"../chunks/DtFjAPax.js";import{i as A}from"../chunks/BKqLVPYF.js";import{e as Z,i as ee}from"../chunks/Bmj-FQU9.js";import{a as j}from"../chunks/BLgWsK8X.js";import{b as je}from"../chunks/nkKv9Po_.js";import{b as te}from"../chunks/DazRNbaE.js";import{p as De}from"../chunks/Bfc47y5P.js";import{i as Ee}from"../chunks/CWPhcWBV.js";import{b as Ie}from"../chunks/DbfCRrim.js";import{t as F}from"../chunks/B4BhJv0K.js";import{g as Ue}from"../chunks/pzP2z9pO.js";import{u as ze}from"../chunks/BTPG6at6.js";import{i as Ce,a as $e}from"../chunks/BgjfWAEp.js";import{S as Ae}from"../chunks/Bea1P_wb.js";var Fe=p('<button class="relative group cursor-pointer"><img alt="" class="w-full aspect-square object-cover rounded-lg border border-gray-100/30 dark:border-gray-850/30"/> <div class="absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition rounded-lg flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 text-white" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7,10 12,15 17,10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg></div></button>'),Ge=p('<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3"></div>'),Me=p('<div class="h-full flex items-center justify-center text-gray-400 dark:text-gray-600 text-sm"> </div>'),Se=p('<div class=" relative group"><div class="relative flex items-center"><img alt="" class="size-10 rounded-xl object-cover"/></div> <div class=" absolute -top-1 -right-1"><button class=" bg-white text-black border border-white rounded-full hover-reveal transition" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="size-4"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg></button></div></div>'),He=p('<div class="flex flex-wrap gap-2 mb-2"></div>'),Ke=p('<button class="px-3.5 py-1.5 text-sm font-normal bg-black hover:bg-gray-900 text-white dark:bg-white dark:text-black dark:hover:bg-gray-100 transition rounded-lg disabled:opacity-50 disabled:cursor-not-allowed"> </button>'),Te=p('<button class="px-3.5 py-1.5 text-sm font-normal bg-gray-300 text-black transition rounded-lg flex items-center gap-2" disabled=""><!> </button>'),qe=p('<div class=" flex flex-col justify-between w-full overflow-y-auto h-full"><div class="mx-auto w-full md:px-0 h-full"><div class=" flex flex-col h-full px-2.5"><div class=" pt-0.5 pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-0" id="images-container"><div class=" h-full w-full flex flex-col"><div class="flex-1 p-1"><!></div></div></div> <div class="pb-3"><div class="border border-gray-100/30 dark:border-gray-850/30 w-full px-3 py-2.5 rounded-xl"><!> <div class="py-0.5"><textarea class=" w-full h-full bg-transparent resize-none outline-hidden text-sm" rows="2"></textarea></div> <div class="flex justify-between items-center gap-2 mt-2"><div class="shrink-0"><input type="file" accept="image/*" multiple="" class="hidden"/> <button type="button" class="px-3.5 py-1.5 text-sm font-normal bg-gray-50 hover:bg-gray-100 text-gray-900 dark:bg-gray-850 dark:hover:bg-gray-800 dark:text-gray-200 transition rounded-lg"> </button></div> <div class="flex gap-2 shrink-0"><!></div></div></div></div></div></div></div>');function Be(D,G){xe(G,!1);const v=()=>X(oe,"$i18n",M),ae=()=>X(ze,"$user",M),[M,re]=ke(),oe=ye("i18n");let k=_(!1),x=_(""),d=_([]),R=_([]),u=_(),E=_();const S=()=>{a(u)&&(Y(u,a(u).style.height=""),Y(u,a(u).style.height=Math.min(a(u).scrollHeight,150)+"px"))},ie=e=>{const t=e.target;t.files&&Array.from(t.files).forEach(i=>{const s=new FileReader;s.onload=n=>{var l;(l=n.target)!=null&&l.result&&g(d,[...a(d),n.target.result])},s.readAsDataURL(i)})},se=e=>{var i;e.preventDefault();const t=(i=e.dataTransfer)==null?void 0:i.files;t&&Array.from(t).forEach(s=>{if(s.type.startsWith("image/")){const n=new FileReader;n.onload=l=>{var f;(f=l.target)!=null&&f.result&&g(d,[...a(d),l.target.result])},n.readAsDataURL(s)}})},le=e=>{g(d,a(d).filter((t,i)=>i!==e))},H=async()=>
1{if(!a(x).trim()){F.error(v().t("Please enter a prompt"));return}g(k,!0);try{let e;a(d).length>0?(a(d).length,e=await Ce(localStorage.token,a(d).length===1?a(d)[0]:a(d),a(x))):e=await $e(localStorage.token,a(x)),e&&g(R,[...e,...a(R)])}catch(e){F.error(`${e}`)}finally{g(k,!1)}},ne=async(e,t)=>{try{const s=await(await fetch(e)).blob(),n=URL.createObjectURL(s),l=document.createElement("a");l.href=n,l.download=`image-${Date.now()}-${t}.png`,l.click(),URL.revokeObjectURL(n)}catch{F.error(v().t("Failed to download image"))}};_e(async()=>{var e;if(((e=ae())==null?void 0:e.role)!=="admin"){await Ue("/");return}}),Ee();var I=qe(),K=o(I),T=o(K),U=o(T),q=o(U),B=o(q),de=o(B);{var ce=e=>{var t=Ge();Z(t,5,()=>a(R),ee,(i,s,n)=>{var l=Fe(),f=o(l);Le(2),r(l),y(()=>j(f,"src",a(s).url)),c("click",l,()=>ne(a(s).url,n)),m(i,l)}),r(t),m(e,t)},ve=e=>{var t=Me(),i=o(t,!0);r(t),y(s=>L(i,s),[()=>v().t("Generated images will appear here")]),m(e,t)};A(de,e=>{a(R).length>0?e(ce):e(ve,-1)})}r(B),r(q),r(U);var O=h(U,2),P=o(O),N=o(P);{var ge=e=>{var t=He();Z(t,5,()=>a(d),ee,(i,s,n)=>{var l=Se(),f=o(l),be=o(f);r(f);var Q=h(f,2),V=o(Q);r(Q),r(l),y(he=>{j(be,"src",a(s)),j(V,"aria-label",he)},[()=>v().t("Remove image")]),c("click",V,()=>le(n)),m(i,l)}),r(t),m(e,t)};A(N,e=>{a(d).length>0&&e(ge)})}var z=h(N,2),b=o(z);Re(b),te(b,e=>g(u,e),()=>a(u)),r(z);var W=h(z,2),C=o(W),$=o(C);te($,e=>g(E,e),()=>a(E));var w=h($,2),ue=o(w,!0);r(w),r(C);var J=h(C,2),fe=o(J);{var me=e=>{var t=Ke(),i=o(t,!0);r(t),y((s,n)=>{t.disabled=s,L(i,n)},[()=>a(x).trim()==="",()=>v().t("Run")]),c("click",t,H),m(e,t)},pe=e=>{var t=Te(),i=o(t);Ae(i,{className:"size-4"});var s=h(i);r(t),y(n=>L(s,` ${n??""}`),[()=>v().t("Running...")]),m(e,t)};A(fe,e=>{a(k)?e(pe,-1):e(me)})}r(J),r(W),r(P),r(O),r(T),r(K),r(I),y((e,t)=>{j(b,"placeholder",e),L(ue,t)},[()=>a(d).length>0?v().t("Describe the edit..."):v().t("Describe the image..."),()=>v().t("Add Image")]),je(b,()=>a(x),e=>g(x,e)),c("input",b,S),c("focus",b,S),c("keydown",b,e=>{e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!a(k)&&(e.preventDefault(),H())}),c("change",$,ie),c("click",w,()=>{var e;return(e=a(E))==null?void 0:e.click()}),c("dragover",w,De(function(e){Ie.call(this,G,e)})),c("drop",w,se),m(D,I),we(),re()}function st(D){Be(D,{})}export{st as component};
2//# sourceMappingURL=34.Br1abYto.js.map

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.