import{k as X,j as r,t as Y,m as R,n as Z,p as i,q as ee,i as o,v as te,A as H,w as q,x as c,s as le}from"./web.Os7kOAdY.js";import{g as B,t as ae}from"./i18n-runtime._BAkvU05.js";var ne=H('<div class=tool-container><div class="tool-grid mobile-stack-grid"style="display:grid;grid-template-columns:1fr 1fr;gap:12px"><label class=field><span class=field-label></span><input type=number class=input min=1 max=4096></label><label class=field><span class=field-label></span><input type=number class=input min=1 max=4096></label><label class=field><span class=field-label></span><input type=color class=input></label><label class=field><span class=field-label></span><input type=color class=input></label></div><label class=field style=margin-top:12px><span class=field-label></span><input type=text class=input></label><div style=display:flex;gap:12px;margin-top:16px><button class=btn></button><button class="btn btn-secondary"></button></div><!$><!/>'),ie=H('<div style="margin-top:16px;border:1px solid var(--border);border-radius:8px;overflow:hidden;max-width:100%"><img alt="placeholder preview"style=display:block;max-width:100%;height:auto>');function oe(){const[I,h]=r(B(),{equals:!1}),s=e=>ae(e,I());Y(()=>{const e=l=>{const a=l.detail?.locale;a&&h(a)};window.addEventListener("taitan:locale-change",e),h(B()),le(()=>window.removeEventListener("taitan:locale-change",e))});const[p,j]=r(800),[u,z]=r(600),[_,D]=r("#cccccc"),[y,G]=r("#333333"),[S,U]=r(""),[g,W]=r("");function F(){const e=p(),l=u(),a=document.createElement("canvas");a.width=e,a.height=l;const n=a.getContext("2d");n.fillStyle=_(),n.fillRect(0,0,e,l);const $=S()||`${e} × ${l}`,b=Math.max(16,Math.min(e,l)/8);n.font=`bold ${b}px sans-serif`,n.fillStyle=y(),n.textAlign="center",n.textBaseline="middle",n.fillText($,e/2,l/2),W(a.toDataURL("image/png"))}function J(){const e=g();if(!e)return;const l=document.createElement("a");l.href=e,l.download=`placeholder-${p()}x${u()}.png`,l.click()}return(()=>{var e=R(ne),l=e.firstChild,a=l.firstChild,n=a.firstChild,$=n.nextSibling,b=a.nextSibling,w=b.firstChild,C=w.nextSibling,T=b.nextSibling,k=T.firstChild,E=k.nextSibling,K=T.nextSibling,L=K.firstChild,M=L.nextSibling,P=l.nextSibling,A=P.firstChild,f=A.nextSibling,N=P.nextSibling,v=N.firstChild,m=v.nextSibling,O=N.nextSibling,[Q,V]=Z(O.nextSibling);return i(n,()=>s("宽度 (px)")),$.$$input=t=>j(parseInt(t.currentTarget.value)||800),i(w,()=>s("高度 (px)")),C.$$input=t=>z(parseInt(t.currentTarget.value)||600),i(k,()=>s("背景色")),E.$$input=t=>D(t.currentTarget.value),i(L,()=>s("文字色")),M.$$input=t=>G(t.currentTarget.value),i(A,()=>s("自定义文字（留空显示尺寸）")),f.$$input=t=>U(t.currentTarget.value),v.$$click=F,i(v,()=>s("生成预览")),m.$$click=J,i(m,()=>s("下载 PNG")),i(e,(()=>{var t=ee(()=>!!g());return()=>t()&&(()=>{var d=R(ie),x=d.firstChild;return o(()=>q(x,"src",g())),d})()})(),Q,V),o(t=>{var d=`${p()} × ${u()}`,x=!g();return d!==t.e&&q(f,"placeholder",t.e=d),x!==t.t&&c(m,"disabled",t.t=x),t},{e:void 0,t:void 0}),o(()=>c($,"value",p())),o(()=>c(C,"value",u())),o(()=>c(E,"value",_())),o(()=>c(M,"value",y())),o(()=>c(f,"value",S())),te(),e})()}X(["input","click"]);export{oe as default};
