import{c as t,M as e,V as n}from"./p-6e1ab235.js";import{v as c}from"./p-4866e390.js";import{h as o,s}from"./p-f0e828d8.js";var l=function(t,e,n,c){var o,s=arguments.length,l=s<3?e:null===c?c=Object.getOwnPropertyDescriptor(e,n):c;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,n,c);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(l=(s<3?o(l):s>3?o(e,n,l):o(e,n))||l);return s>3&&l&&Object.defineProperty(e,n,l),l};class a extends n{constructor(t){super(),this.style=t}connectedCallback(){const t=this.host.tagName,e=a.connectedComponents.get(t);e?e.add(this.host):a.connectedComponents.set(t,new Set([this.host]))}disconnectedCallback(){const t=a.connectedComponents.get(this.host.tagName);if(t&&(t.delete(this.host),0===t.size)){const t=this.getStyleElement();t&&t.remove()}}componentWillLoad(){this.id=`${this.host.tagName}-GLOBAL-STYLE`;let t=this.getStyleElement();t||(t=document.createElement("style"),t.id=this.id,t.innerHTML=o.sanitize(this.style,s),c.nonce&&t.setAttribute("nonce",c.nonce),document.head.append(t))}getStyleElement(){return document.head.querySelector(`style#${this.id}`)}}a.connectedComponents=new Map,l([t()],a.prototype,"host",void 0),l([e("connectedCallback")],a.prototype,"connectedCallback",null),l([e("disconnectedCallback")],a.prototype,"disconnectedCallback",null),l([e("componentWillLoad")],a.prototype,"componentWillLoad",null);export{a as C}