import{k as Q,j as u,t as V,m,n as g,p as a,f as _,A as f,s as W,S as L,F as X,i as Y,w as k,z as ee,v as te}from"./web.Os7kOAdY.js";import{g as F,t as ne}from"./i18n-runtime._BAkvU05.js";var le=f("<p style=margin-top:8px;color:var(--text-2)><!$><!/><!$><!/>"),ae=f("<div style=margin-top:20px><h3 style=margin-bottom:12px></h3><div style=display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:16px>"),ie=f("<div class=tool-container><label class=field><span class=field-label></span><input type=file class=input accept=image/*></label><!$><!/><!$><!/>"),re=f('<div style="text-align:center;padding:12px;border:1px solid var(--border);border-radius:8px"><img><p style="margin:8px 0 4px;font-size:13px"><!$><!/>×<!$><!/></p><button class="btn btn-small">');const se=[16,32,48,180,512];function de(){const[I,v]=u(F(),{equals:!1}),d=t=>ne(t,I());V(()=>{const t=n=>{const e=n.detail?.locale;e&&v(e)};window.addEventListener("taitan:locale-change",t),v(F()),W(()=>window.removeEventListener("taitan:locale-change",t))});const[oe,M]=u(null),[h,N]=u([]),[b,R]=u("");function A(t){const n=t.target.files?.[0];if(!n)return;R(n.name);const e=new Image;e.onload=()=>{M(e),U(e)},e.src=URL.createObjectURL(n)}function U(t){const n=[];for(const e of se){const s=document.createElement("canvas");s.width=e,s.height=e,s.getContext("2d").drawImage(t,0,0,e,e),n.push({size:e,url:s.toDataURL("image/png")})}N(n)}function j(t,n){const e=document.createElement("a");e.href=t,e.download=`favicon-${n}x${n}.png`,e.click()}return(()=>{var t=m(ie),n=t.firstChild,e=n.firstChild,s=e.nextSibling,S=n.nextSibling,[w,q]=g(S.nextSibling),D=w.nextSibling,[H,O]=g(D.nextSibling);return a(e,()=>d("上传图片")),s.addEventListener("change",A),a(t,_(L,{get when(){return b()},get children(){var i=m(le),$=i.firstChild,[x,l]=g($.nextSibling),p=x.nextSibling,[o,c]=g(p.nextSibling);return a(i,()=>d("已选择:"),x,l),a(i,b,o,c),i}}),w,q),a(t,_(L,{get when(){return h().length>0},get children(){var i=m(ae),$=i.firstChild,x=$.nextSibling;return a($,()=>d("生成结果")),a(x,_(X,{get each(){return h()},children:l=>(()=>{var p=m(re),o=p.firstChild,c=o.nextSibling,P=c.firstChild,[y,T]=g(P.nextSibling),Z=y.nextSibling,B=Z.nextSibling,[G,J]=g(B.nextSibling),C=c.nextSibling;return a(c,()=>l.size,y,T),a(c,()=>l.size,G,J),C.$$click=()=>j(l.url,l.size),a(C,()=>d("下载")),Y(r=>{var E=l.url,z=`${l.size}x${l.size}`,K=`width:${Math.min(l.size,64)}px;height:${Math.min(l.size,64)}px;image-rendering:pixelated;`;return E!==r.e&&k(o,"src",r.e=E),z!==r.t&&k(o,"alt",r.t=z),r.a=ee(o,K,r.a),r},{e:void 0,t:void 0,a:void 0}),te(),p})()})),i}}),H,O),t})()}Q(["click"]);export{de as default};
