!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).scrollPadlock={})}(this,(function(t){"use strict";function e({offsetWidth:t,offsetHeight:e,clientWidth:o,clientHeight:l,scrollHeight:n,scrollWidth:i,scrollTop:r,scrollLeft:h}){return`--offset-width:${Math.round(t)}px;--offset-height:${Math.round(e)}px;--client-width:${Math.round(Math.min(t,o))}px;--client-height:${Math.round(Math.min(e,l))}px;--scroll-width:${Math.round(i)}px;--scroll-height:${Math.round(n)}px;--scrollbar-width:${Math.round(Math.max(0,t-o))}px;--scrollbar-height:${Math.round(Math.max(0,e-l))}px;--scroll-top:${Math.round(r)}px;--scroll-left:${Math.round(h)}px;`}const o={};t.setStyle=function(t){const l=globalThis,{document:n}=l,{documentElement:i,scrollingElement:r,head:h,body:s}=n,{selector:c=".scroll-padlock",element:d=r||i,formatter:f=e}=t||{};if(!c||!d||!f)throw new Error("Invalid options provided.");let a=0,p=0,u=0,g=0;d===s||d===i||d===r?({innerWidth:a,innerHeight:p,scrollY:u,scrollX:g}=l):({offsetWidth:a,offsetHeight:p,scrollTop:u,scrollLeft:g}=d);const{clientWidth:x,clientHeight:M,scrollWidth:m,scrollHeight:$}=d,H=o[c]||n.createElement("style");h.contains(H)||h.append(H);const{sheet:W}=H;if(!W)throw new Error("Invalid CSSStyleSheet instance.");for(o[c]=H;W.cssRules.length;)W.deleteRule(0);return W.insertRule(`${c}{${f({offsetWidth:a,offsetHeight:p,clientWidth:x,clientHeight:M,scrollHeight:$,scrollWidth:m,scrollTop:u,scrollLeft:g})}}`),H}}));
//# sourceMappingURL=scroll-padlock.umd.min.js.map
