import{p as i}from"./preact.js";import{g as u}from"./get-nonce.js";function a(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=u();return e&&t.setAttribute("nonce",e),t}function l(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function c(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var s=function(){var t=0,e=null;return{add:function(n){t==0&&(e=a())&&(l(e,n),c(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},d=function(){var t=s();return function(e,n){i(function(){return t.add(e),function(){t.remove()}},[e&&n])}},y=function(){var t=d(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e};export{y as s};
