/* esm.sh - style-mod@4.1.4 */
var m=typeof Symbol>"u"?"__\u037C":Symbol.for("\u037C"),c=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),w=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},T=class{constructor(e,i){this.rules=[];let{finish:l}=i||{};function n(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function t(s,r,h,a){let f=[],d=/^@(\w+)\b/.exec(s[0]),S=d&&d[1]=="keyframes";if(d&&r==null)return h.push(s[0]+";");for(let u in r){let o=r[u];if(/&/.test(u))t(u.split(/,\s*/).map(p=>s.map(y=>p.replace(/&/,y))).reduce((p,y)=>p.concat(y)),o,h);else if(o&&typeof o=="object"){if(!d)throw new RangeError("The value of a property ("+u+") should be a primitive value.");t(n(u),o,f,S)}else o!=null&&f.push(u.replace(/_.*/,"").replace(/[A-Z]/g,p=>"-"+p.toLowerCase())+": "+o+";")}(f.length||S)&&h.push((l&&!d&&!a?s.map(l):s).join(", ")+" {"+f.join(" ")+"}")}for(let s in e)t(n(s),e[s],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let e=w[m]||1;return w[m]=e+1,"\u037C"+e.toString(36)}static mount(e,i,l){let n=e[c],t=l&&l.nonce;n?t&&n.setNonce(t):n=new g(e,t),n.mount(Array.isArray(i)?i:[i],e)}},b=new Map,g=class{constructor(e,i){let l=e.ownerDocument||e,n=l.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let t=b.get(l);if(t)return e[c]=t;this.sheet=new n.CSSStyleSheet,b.set(l,this)}else this.styleTag=l.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[c]=this}mount(e,i){let l=this.sheet,n=0,t=0,s=!1;for(let r=0;r<e.length;r++){let h=e[r],a=this.modules.indexOf(h);if(a<t&&a>-1&&(this.modules.splice(a,1),s=!0,t--,a=-1),a==-1){if(this.modules.splice(t++,0,h),s=!0,l)for(let f=0;f<h.rules.length;f++)l.insertRule(h.rules[f],n++)}else{for(;t<a;)n+=this.modules[t++].rules.length;n+=h.rules.length,t++}}if(l)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{if(s){let h="";for(let a=0;a<this.modules.length;a++)h+=this.modules[a].getRules()+`
`;this.styleTag.textContent=h}let r=i.head||i;this.styleTag.parentNode!=r&&r.insertBefore(this.styleTag,r.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};export{T as StyleModule};
//# sourceMappingURL=style-mod.mjs.map