import{c as t,M as e,V as c}from"./p-dcc98162.js";import{vegaNonceManager as n}from"./p-503d32d7.js";import{h as o,s}from"./p-f0e828d8.js";var l=function(t,e,c,n){var o,s=arguments.length,l=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,c):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,c,n);else for(var i=t.length-1;i>=0;i--)(o=t[i])&&(l=(s<3?o(l):s>3?o(e,c,l):o(e,c))||l);return s>3&&l&&Object.defineProperty(e,c,l),l};class i extends c{constructor(t){super(),this.style=t}connectedCallback(){const t=this.host.tagName,e=i.connectedComponents.get(t);e?e.add(this.host):i.connectedComponents.set(t,new Set([this.host]))}disconnectedCallback(){const t=i.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),n.nonce&&t.setAttribute("nonce",n.nonce),document.head.append(t))}getStyleElement(){return document.head.querySelector(`style#${this.id}`)}}i.connectedComponents=new Map,l([t()],i.prototype,"host",void 0),l([e("connectedCallback")],i.prototype,"connectedCallback",null),l([e("disconnectedCallback")],i.prototype,"disconnectedCallback",null),l([e("componentWillLoad")],i.prototype,"componentWillLoad",null);export{i as C}