// @bun
var{defineProperty:R,getOwnPropertyNames:F,getOwnPropertyDescriptor:V}=Object,D=Object.prototype.hasOwnProperty;function E(B){return this[B]}var W=(B)=>{var C=(M??=new WeakMap).get(B),Z;if(C)return C;if(C=R({},"__esModule",{value:!0}),B&&typeof B==="object"||typeof B==="function"){for(var G of F(B))if(!D.call(C,G))R(C,G,{get:E.bind(B,G),enumerable:!(Z=V(B,G))||Z.enumerable})}return M.set(B,C),C},M;var U=(B)=>B;function z(B,C){this[B]=U.bind(null,C)}var k=(B,C)=>{for(var Z in C)R(B,Z,{get:C[Z],enumerable:!0,configurable:!0,set:z.bind(C,Z)})};var Q=(B,C)=>()=>(B&&(C=B(B=0)),C);var y=import.meta.require;function _(B,C=L,Z={},G){return C.sort((J,K)=>J-K).map((J)=>{return`${Y(B,{...Z,w:J,fm:G})} ${J}w`}).join(", ")}function f(B,C=320,Z=2560,G=0.08,J={},K){let $=w(C,Z,G);return _(B,$,J,K)}function w(B,C,Z=0.08){let G=[],J=B;while(J<C)G.push(Math.round(J)),J*=1+Z*2;if(G[G.length-1]!==C)G.push(C);return G}function g(B,C,Z=A,G={},J){return Z.sort((K,$)=>K-$).map((K)=>{let $=Math.round(C*K);return`${Y(B,{...G,w:$,dpr:K,fm:J})} ${K}x`}).join(", ")}function h(B,C,Z=A,G=80,J={},K){let $={1:G,1.5:Math.round(G*0.9),2:Math.round(G*0.8),3:Math.round(G*0.7),4:Math.round(G*0.6),5:Math.round(G*0.5)};return Z.sort((X,H)=>X-H).map((X)=>{let H=Math.round(C*X),j=$[X]||Math.round(G*Math.max(0.5,1-X*0.1));return`${Y(B,{...J,w:H,q:j,dpr:X,fm:K})} ${X}x`}).join(", ")}function v(B,C="100vw"){if(!B||Object.keys(B).length===0)return C;let G=Object.entries(B).map(([J,K])=>{let $=/^\d+$/.test(J)?`${J}px`:J;return{bp:$,size:K,numericBp:Number.parseInt($)||0}}).sort((J,K)=>J.numericBp-K.numericBp).map(({bp:J,size:K})=>`(max-width: ${J}) ${K}`);return G.push(C),G.join(", ")}function b(B,C="100vw"){if(!B||B.length===0)return C;let G=[...B].sort((J,K)=>(J.maxWidth||0)-(K.maxWidth||0)).filter((J)=>J.maxWidth).map((J)=>`(max-width: ${J.maxWidth}px) ${J.imageWidth}`);return G.push(C),G.join(", ")}function Y(B,C={}){let Z=Object.entries(C).filter(([,K])=>K!==void 0&&K!==null).map(([K,$])=>{if(Array.isArray($))return[K,$.join(",")];return[K,String($)]});if(Z.length===0)return B;let G=Z.map(([K,$])=>`${K}=${encodeURIComponent($)}`).join("&"),J=B.includes("?")?"&":"?";return`${B}${J}${G}`}function o(B){let[C,Z]=B.split("?"),G={};if(Z)new URLSearchParams(Z).forEach((K,$)=>{if(/^\d+$/.test(K))G[$]=Number.parseInt(K,10);else if(/^\d+\.\d+$/.test(K))G[$]=Number.parseFloat(K);else if(K==="true")G[$]=!0;else if(K==="false")G[$]=!1;else G[$]=K});return{src:C,params:G}}function m(B){let{src:C,widths:Z,dprValues:G,fixedWidth:J,formats:K=T,baseUrl:$="",params:X={}}=B,H=[];for(let j of K){let O,q;if(J!==void 0&&G)O=g(C,J,G,X,j),q=G.map((N)=>({path:"",url:Y(C,{...X,w:Math.round(J*N),fm:j}),width:Math.round(J*N),height:0,format:j,size:0,dpr:N}));else{let N=Z||L;O=_(C,N,X,j),q=N.map((P)=>({path:"",url:Y(C,{...X,w:P,fm:j}),width:P,height:0,format:j,size:0}))}H.push({srcset:O,format:j,mimeType:I[j],variants:q})}return H}function u(B,C="100vw"){return B.map(({srcset:Z,mimeType:G})=>`<source type="${G}" srcset="${Z}" sizes="${C}" />`).join(`
`)}function l(B,C){if(B.length===0)return;let Z=[...B].sort((J,K)=>J.width-K.width),G=Z.find((J)=>J.width>=C);if(G)return G;return Z[Z.length-1]}function p(B,C){let Z=C?B.filter((J)=>J.format===C):B;if(Z.length===0){let J=B.filter(($)=>$.format==="jpeg"),K=J.length>0?J:B;return K[Math.floor(K.length/2)]}let G=Z.sort((J,K)=>J.width-K.width);return G[Math.floor(G.length/2)]}function d(B){let C=new Map;for(let Z of B){let G=C.get(Z.format)||[];G.push(Z),C.set(Z.format,G)}return C}function i(B){return I[B]||"application/octet-stream"}function s(B){return x[B]||B}function e(B){switch(B.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var L,A,T,I,x,n;var S=Q(()=>{L=[320,480,640,768,1024,1280,1536,1920,2560],A=[1,1.5,2,3],T=["avif","webp","jpeg"],I={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},x={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};n={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"}});S();export{o as parseImageUrl,d as groupVariantsByFormat,i as getMimeType,s as getFormatExtension,p as getFallbackVariant,l as getBestVariant,_ as generateWidthSrcset,m as generateSrcsetData,u as generateSourceTags,b as generateSizesFromBreakpoints,v as generateSizesAttribute,h as generateDprSrcsetWithVariableQuality,g as generateDprSrcset,f as generateAutoWidthSrcset,e as detectFormat,w as calculateOptimalWidths,Y as buildImageUrl,I as MIME_TYPES,x as FORMAT_EXTENSIONS,L as DEFAULT_WIDTHS,T as DEFAULT_FORMATS,A as DEFAULT_DPR_VALUES,n as COMMON_SIZES};
