// @bun
var{defineProperty:D,getOwnPropertyNames:m,getOwnPropertyDescriptor:h}=Object,c=Object.prototype.hasOwnProperty;function d(j){return this[j]}var r=(j)=>{var q=(y??=new WeakMap).get(j),G;if(q)return q;if(q=D({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var x of m(j))if(!c.call(q,x))D(q,x,{get:d.bind(j,x),enumerable:!(G=h(j,x))||G.enumerable})}return y.set(j,q),q},y;var l=(j)=>j;function a(j,q){this[j]=l.bind(null,q)}var jj=(j,q)=>{for(var G in q)D(j,G,{get:q[G],enumerable:!0,configurable:!0,set:a.bind(q,G)})};var i=(j,q)=>()=>(j&&(q=j(j=0)),q);var qj=import.meta.require;function Q(j){return j.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Y(j,q){if(j.serverDynamic[q]!==void 0)return String(j.serverDynamic[q]);let G=j.static[q];if(typeof G==="string")return G;return}function H(j,q,G=!1){let x=j.serverDynamic[q];if(x!==void 0)return x!==!1&&x!=="false";let M=j.static[q];if(M!==void 0)return M!=="false"&&M!==!1;return G}function w(j){if(j.includes("(")||j.includes(","))return j;let q=j.trim().split(/\s+/),G=[];for(let x of q)if(x.includes(":")){let[M,J]=x.split(":"),X=o[M];if(X)G.push(`(max-width: ${X}px) ${J}`);else{let F=Number.parseInt(M);if(!Number.isNaN(F))G.push(`(max-width: ${F}px) ${J}`)}}else G.push(x);return G.join(", ")}function W(j,q,G,x){return q.map((M)=>`${B(j,M,void 0,G,x)} ${M}w`).join(", ")}function p(j,q,G,x,M){return q.map((J)=>{let X=G?G*J:void 0;return`${B(j,X,void 0,x,M)} ${J}x`}).join(", ")}function B(j,q,G,x,M){if(!x||x==="local"||x==="static")return j;if(x==="cloudinary"){let J=[];if(q)J.push(`w_${q}`);if(G)J.push(`h_${G}`);if(M)J.push(`f_${M}`);J.push("q_auto");let X=J.join(",");return j.replace("/upload/",`/upload/${X}/`)}if(x==="imgix"){let J=new URLSearchParams;if(q)J.set("w",String(q));if(G)J.set("h",String(G));if(M)J.set("fm",M);J.set("auto","format");let X=j.includes("?")?"&":"?";return`${j}${X}${J.toString()}`}if(x==="bunny"){let J=new URLSearchParams;if(q)J.set("width",String(q));if(G)J.set("height",String(G));if(M)J.set("format",M);let X=j.includes("?")?"&":"?";return`${j}${X}${J.toString()}`}return j}function t(j,q,G="#e5e7eb"){let x=`<svg xmlns="http://www.w3.org/2000/svg" width="${j}" height="${q}"><rect width="100%" height="100%" fill="${G}"/></svg>`;return`data:image/svg+xml;base64,${btoa(x)}`}var o,E,Gj;var e=i(()=>{o={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},E=[320,640,768,1024,1280,1536,1920];Gj={name:"StxImage",aliases:["stx-image","stx-img"],render(j,q,G){let x=Y(j,"src")||"",M=Y(j,"alt")||"",J=Y(j,"width"),X=Y(j,"height"),F=Y(j,"sizes"),A=Y(j,"srcset"),k=Y(j,"densities"),O=Y(j,"format"),I=Y(j,"placeholder"),g=Y(j,"placeholderColor")||"#e5e7eb",L=Y(j,"provider"),T=Y(j,"class")||Y(j,"className")||"",P=Y(j,"style")||"",s=Y(j,"quality"),v=H(j,"lazy",!0),S=H(j,"preload",!1),f=H(j,"picture",!1)||!!O,R=J?Number.parseInt(J):void 0,b=X?Number.parseInt(X):void 0,N=A||"",V="";if(!N&&F)N=W(x,E,L,O),V=w(F);else if(!N&&k){let $=k.split(/\s+/).map((K)=>Number.parseFloat(K.replace("x","")));N=p(x,$,R,L,O)}else if(F)V=w(F);let C=[];if(P)C.push(P);if(R&&b)C.push(`aspect-ratio:${R}/${b}`);if(I==="blur"||I==="color"||I==="thumbhash"){let $=t(R||16,b||9,g);C.push(`background-image:url(${$})`),C.push("background-size:cover"),C.push("background-repeat:no-repeat")}else if(I&&I!=="empty"&&I!=="none")C.push(`background-image:url(${Q(I)})`),C.push("background-size:cover"),C.push("background-repeat:no-repeat");let z=B(x,R,b,L,O),Z=[];if(Z.push(`src="${Q(z)}"`),Z.push(`alt="${Q(M)}"`),J)Z.push(`width="${Q(J)}"`);if(X)Z.push(`height="${Q(X)}"`);if(v)Z.push('loading="lazy"');if(Z.push('decoding="async"'),T)Z.push(`class="${Q(T)}"`);if(C.length>0)Z.push(`style="${Q(C.join(";"))}"`);if(N)Z.push(`srcset="${Q(N)}"`);if(V)Z.push(`sizes="${Q(V)}"`);let n=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[$,K]of Object.entries(j.static)){if(n.has($))continue;if(typeof K==="boolean"){if(K)Z.push(Q($))}else Z.push(`${Q($)}="${Q(K)}"`)}let u=`<img ${Z.join(" ")} />`,U="";if(S){let K=O==="webp"?"image/webp":O==="avif"?"image/avif":"";U=`<link rel="preload" as="image" href="${Q(z)}"${K?` type="${K}"`:""}${N?` imagesrcset="${Q(N)}"`:""}${V?` imagesizes="${Q(V)}"`:""} />
`}if(f){let $=[];if(O==="avif"||O==="auto"){let K=B(x,R,b,L,"avif"),_=N?W(x,E,L,"avif"):`${K}`;$.push(`<source type="image/avif" srcset="${Q(_)}"${V?` sizes="${Q(V)}"`:""} />`)}if(O==="webp"||O==="auto"){let K=B(x,R,b,L,"webp"),_=N?W(x,E,L,"webp"):`${K}`;$.push(`<source type="image/webp" srcset="${Q(_)}"${V?` sizes="${Q(V)}"`:""} />`)}return`${U}<picture>
${$.join(`
`)}
${u}
</picture>`}return`${U}${u}`}}});e();export{Gj as StxImageBuiltin};
