var y;($=>{let o=null,i=document.createElement("style"),a=Array(),u=new MutationObserver(S);u.observe(document.documentElement,{attributes:!0}),u.observe(document.body,{attributes:!0}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",d);function C(n,l){let e=Array(),t=window.getComputedStyle(n);if(Array.isArray(l))for(let r of l)e.push(`${r}:${t.getPropertyValue(r)}`);else for(let[r,s]of Object.entries(l))e.push(`${r}:${t.getPropertyValue(s)}`);return e.join(";").concat(";")}$.extractStyles=C;function f(n,l,e,t,r){let s=()=>{let w=window.getComputedStyle(t).getPropertyValue("transition"),b=t.hidden;t.style.transition="none",t.hidden=!1,r&&t.classList.add(r);let v=Object.entries(e).map(([x,A])=>`${x}:${window.getComputedStyle(t).getPropertyValue(A)};`).join("");return r&&t.classList.remove(r),t.hidden=b,t.style.transition=w,v},c=n.insertRule(`${l}{${s()}}`,n.cssRules.length);return()=>{n.deleteRule(c),n.insertRule(`${l}{${s()}}`,c)}}$.mutableStyles=f;function E(n,l=!1){a.push([n.map(([e,t,r,s,c])=>f(e,t,r,s,c)),l])}$.pushMediaQueryStyles=E;function d(){a.forEach(([n,l])=>{l&&m(),n.forEach(e=>e()),l&&g()})}function S(n,l){n.forEach(e=>{var t;e.type==="attributes"&&((t=e.attributeName)!=null&&t.includes("theme"))&&d()})}function p(){if(!o)throw new Error("Style Sheet is not initialized");let n=document.styleSheets.length;for(let l=0;l<n;l++){let e=document.styleSheets[l];try{for(let t=0;t<e.cssRules.length;t++){let r=e.cssRules.item(t);r&&h(r,o)}}catch(t){if(t instanceof DOMException)console.warn('Could not read stylesheet, try adding crossorigin="anonymous"',e,t);else throw t}}}function m(){var n,l,e,t;if(document.head.appendChild(i),o===null)o=i.sheet,p();else{for(;(n=i.sheet)!=null&&n.cssRules.length;)(l=i.sheet)==null||l.deleteRule(0);for(let r=0;r<o.cssRules.length;r++){let s=(e=o.cssRules.item(r))==null?void 0:e.cssText;s&&((t=i.sheet)==null||t.insertRule(s))}}}$.attachPseudoStyles=m;function g(){document.head.removeChild(i)}$.detachPseudoStyles=g;function R(n){var l,e,t;for(let r=document.styleSheets.length-1;r>=0;--r){let s=(t=(e=(l=document==null?void 0:document.styleSheets)==null?void 0:l.item(r))==null?void 0:e.cssRules)==null?void 0:t.item(0);if(s instanceof CSSStyleRule&&s.selectorText.trim()===n)return document.styleSheets.item(r)}return null}$.stylesAreInstalled=R;function h(n,l){if(n instanceof CSSImportRule)try{if(!n.styleSheet)return;for(let e of n.styleSheet.cssRules)h(e,l)}catch(e){if(e instanceof DOMException)console.warn("Could not traverse CSS import",n,e);else throw e}else if(n instanceof CSSStyleRule){if(!n.selectorText)return;let e=n.selectorText.replaceAll(":focus",".-focus-").replaceAll(":focus-visible",".-focus-visible-").replaceAll(":hover",".-hover-").replaceAll(":disabled",".-disabled-").replaceAll(":invalid",".-invalid-").replaceAll(":valid",".-valid-").replaceAll("::placeholder-shown",".-placeholder-shown").replaceAll(":placeholder-shown",".-placeholder-shown").replaceAll("::placeholder",".-placeholder-").replaceAll(":placeholder",".-placeholder-");e!==n.selectorText&&l.insertRule(`${e}{${n.style.cssText}}`)}}})(y||(y={}));export{y as a};
