import{t}from"./p-b75ee3ba.js";class n{constructor(n){var e;if(n)this._nonce=n;else if("function"==typeof t){const n=t();if(n){const t=null===(e=n.querySelector('meta[name="csp-nonce"]'))||void 0===e?void 0:e.content;t&&(this._nonce=t)}}}set nonce(t){this._nonce=t}get nonce(){return this._nonce}patchHeadInsertBeforeWithNonceToStencil(){const n=t();if(!n)return;const o=n.head,s=o.insertBefore;o.insertBefore=function(t,n){return e.nonce?(t.nodeType===Node.ELEMENT_NODE&&t instanceof HTMLStyleElement&&t.hasAttribute("data-styles")&&(t.innerHTML.includes("vega-")||t.innerHTML.includes(".hydrated"))&&!t.hasAttribute("nonce")&&t.setAttribute("nonce",e.nonce),s.call(this,t,n)):s.call(this,t,n)}}}const e=new n;function o(t){e.nonce=t}export{n as VegaNonceManager,o as setVegaNonce,e as vegaNonceManager}