Files
OverlayScrollbars/packages/overlayscrollbars/dist/overlayscrollbars.esm.min.js
T
2022-06-24 20:20:51 +02:00

1 line
20 KiB
JavaScript

function t(t,e){const{o:n,s:r,u:o}=t;let i,a=n;const s=(t,e)=>{const n=a,s=t,l=e||(r?!r(n,s):n!==s);return(l||o)&&(a=s,i=n),[a,l,i]};return[e?t=>s(e(a,i),t):s,t=>[a,!!t,i]]}const e=Node.ELEMENT_NODE,{toString:n,hasOwnProperty:r}=Object.prototype;function o(t){return void 0===t}function i(t){return null===t}function a(t){return"number"==typeof t}function s(t){return"string"==typeof t}function l(t){return"boolean"==typeof t}function c(t){return"function"==typeof t}function u(t){return Array.isArray(t)}function d(t){return"object"==typeof t&&!u(t)&&!i(t)}function _(t){const e=!!t&&t.length,n=a(e)&&e>-1&&e%1==0;return!!(u(t)||!c(t)&&n)&&(!(e>0&&d(t))||e-1 in t)}function f(t){if(!t||!d(t)||"object"!==(t=>o(t)||i(t)?`${t}`:n.call(t).replace(/^\[object (.+)\]$/,"$1").toLowerCase())(t))return!1;let e;const a="constructor",s=t[a],l=s&&s.prototype,c=r.call(t,a),u=l&&r.call(l,"isPrototypeOf");if(s&&!c&&!u)return!1;for(e in t);return o(e)||r.call(t,e)}function g(t){const n=window.HTMLElement;return!!t&&(n?t instanceof n:t.nodeType===e)}function h(t){const n=window.Element;return!!t&&(n?t instanceof n:t.nodeType===e)}function v(t,e){if(_(t))for(let n=0;n<t.length&&!1!==e(t[n],n,t);n++);else t&&v(Object.keys(t),n=>e(t[n],n,t));return t}const w=(t,e,n)=>t.indexOf(e,n),p=(t,e,n)=>(n||s(e)||!_(e)?t.push(e):Array.prototype.push.apply(t,e),t),b=t=>{if(Array.from&&t)return Array.from(t);const e=[];return t instanceof Set?t.forEach(t=>{p(e,t)}):v(t,t=>{p(e,t)}),e},y=t=>!!t&&0===t.length,m=(t,e)=>{const n=t=>t&&t(e);t instanceof Set?t.forEach(n):v(t,n)},S=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),x=t=>t?Object.keys(t):[];function O(t,e,n,r,o,a,s){const l=[e,n,r,o,a,s];return"object"==typeof t&&!i(t)||c(t)||(t={}),v(l,e=>{v(x(e),n=>{const r=e[n];if(t===r)return!0;const o=u(r);if(r&&(f(r)||o)){const e=t[n];let i=e;o&&!u(e)?i=[]:o||f(e)||(i={}),t[n]=O(i,r)}else t[n]=r})}),t}function C(t,e,n,r){if(o(r))return n?n[t]:e;n&&(n[t]=r)}function $(t,e,n){if(o(n))return t?t.getAttribute(e):null;t&&t.setAttribute(e,n)}const z=(t,e)=>{t&&t.removeAttribute(e)};function A(t,e){return C("scrollLeft",0,t,e)}function L(t,e){return C("scrollTop",0,t,e)}const I=Element.prototype,M=(t,e)=>{const n=[],r=e?h(e)?e:null:document;return r?p(n,r.querySelectorAll(t)):n},T=(t,e)=>{if(h(t)){return(I.matches||I.msMatchesSelector).call(t,e)}return!1},j=t=>t?b(t.childNodes):[],R=t=>t?t.parentElement:null,P=(t,e,n)=>{if(n){let r,o=e;t&&(_(n)?(r=document.createDocumentFragment(),v(n,t=>{t===o&&(o=t.previousSibling),r.appendChild(t)})):r=n,e&&(o?o!==e&&(o=o.nextSibling):o=t.firstChild),t.insertBefore(r,o||null))}},V=(t,e)=>{P(t,null,e)},H=(t,e)=>{P(t,t&&t.firstChild,e)},B=(t,e)=>{P(R(t),t&&t.nextSibling,e)},E=t=>{if(_(t))v(b(t),t=>E(t));else if(t){const e=R(t);e&&e.removeChild(t)}},k=t=>{const e=document.createElement("div");return t&&$(e,"class",t),e},D=t=>{const e=k();return e.innerHTML=t.trim(),v(j(e),t=>E(t))},N=t=>t.charAt(0).toUpperCase()+t.slice(1),q=["-webkit-","-moz-","-o-","-ms-"],G=["WebKit","Moz","O","MS","webkit","moz","o","ms"],W={},Y={},F=t=>{let e=Y[t];if(S(Y,t))return e;const n=N(t),r=k().style;return v(q,o=>{const i=o.replace(/-/g,""),a=[t,o+t,i+n,N(i)+n];return!(e=a.find(t=>void 0!==r[t]))}),Y[t]=e||""},X=t=>{let e=W[t]||window[t];return S(W,t)||(v(G,n=>(e=e||window[n+N(t)],!e)),W[t]=e),e},U=X("MutationObserver"),J=X("IntersectionObserver"),K=X("ResizeObserver"),Q=X("cancelAnimationFrame"),Z=X("requestAnimationFrame"),tt=/[^\x20\t\r\n\f]+/g,et=(t,e,n)=>{let r,o=0,i=!1;if(t&&s(e)){const a=e.match(tt)||[];for(i=a.length>0;r=a[o++];)i=!!n(t.classList,r)&&i}return i},nt=(t,e)=>{et(t,e,(t,e)=>t.add(e))},rt=(t,e)=>{et(t,e,(t,e)=>t.remove(e))},ot={w:0,h:0},it=()=>({w:window.innerWidth,h:window.innerHeight}),at=t=>t?{w:t.offsetWidth,h:t.offsetHeight}:ot,st=t=>t?{w:t.clientWidth,h:t.clientHeight}:ot,lt=t=>t?{w:t.scrollWidth,h:t.scrollHeight}:ot,ct=t=>t.getBoundingClientRect();let ut;const dt=t=>t.split(" "),_t=(t,e,n,r)=>{v(dt(e),e=>{t.removeEventListener(e,n,r)})},ft=(t,e,n,r)=>{const i=(()=>{if(o(ut)){ut=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){ut=!0}}))}catch(t){}}return ut})(),a=i&&r&&r._||!1,s=r&&r.g||!1,l=r&&r.v||!1,c=[],u=i?{passive:a,capture:s}:s;return v(dt(e),e=>{const r=l?o=>{t.removeEventListener(e,r,s),n&&n(o)}:n;p(c,_t.bind(null,t,e,r,s)),t.addEventListener(e,r,u)}),m.bind(0,c)},gt=t=>(t=>t.stopPropagation())(t)||(t=>t.preventDefault())(t),ht=(t,e,n,r)=>{if(t&&e){let o=!0;return v(n,n=>{(r?r(t[n]):t[n])!==(r?r(e[n]):e[n])&&(o=!1)}),o}return!1},vt=(t,e)=>ht(t,e,["w","h"]),wt=(t,e)=>ht(t,e,["t","r","b","l"]),pt=(t,e,n)=>ht(t,e,["width","height"],n&&(t=>Math.round(t))),bt=t=>{t&&window.clearTimeout(t),t&&Q(t)},yt=()=>{},mt=(t,e)=>{let n,r,o,i;const{p:s,m:l,S:u}=e||{},d=window.setTimeout,_=function(e){bt(n),bt(r),r=n=o=void 0,t.apply(this,e)},f=t=>u&&o?u(o,t):t,g=()=>{n&&_(f(i)||i)},h=function(){const t=b(arguments),e=c(s)?s():s,u=a(e)&&e>=0;if(u){const s=c(l)?l():l,u=a(s)&&s>=0,h=e>0?d:Z,v=f(t)||t,w=_.bind(0,v);bt(n),n=h(w,e),u&&!r&&(r=d(g,s)),o=i=v}else _(t)};return h.O=g,h},St={opacity:1,zindex:1},xt=(t,e)=>{const n=e?parseFloat(t):parseInt(t,10);return Number.isNaN(n)?0:n},Ot=(t,e,n)=>null!=e?e[n]||e.getPropertyValue(n):t.style[n],Ct=(t,e,n)=>{try{if(t){const{style:r}=t;o(r[e])?r.setProperty(e,n):r[e]=((t,e)=>!St[t.toLowerCase()]&&a(e)?`${e}px`:e)(e,n)}}catch(r){}};function $t(t,e){const n=s(e);if(u(e)||n){let r=n?"":{};if(t){const o=window.getComputedStyle(t,null);r=n?Ot(t,o,e):e.reduce((e,n)=>(e[n]=Ot(t,o,n),e),r)}return r}v(x(e),n=>Ct(t,n,e[n]))}const zt=(t,e,n)=>{const r=e?`${e}-`:"",o=n?`-${n}`:"",i=`${r}top${o}`,a=`${r}right${o}`,s=`${r}bottom${o}`,l=`${r}left${o}`,c=$t(t,[i,a,s,l]);return{t:xt(c[i]),r:xt(c[a]),b:xt(c[s]),l:xt(c[l])}},At={x:0,y:0},Lt=t=>{const e=t?ct(t):0;return e?{x:e.left+window.pageYOffset,y:e.top+window.pageXOffset}:At},It="os-environment",Mt=`${It}-flexbox-glue`,Tt=`${Mt}-max`,jt="os-host",Rt="os-padding",Pt="os-viewport",Vt=`${Pt}-arrange`,Ht="os-content",Bt=`${Pt}-scrollbar-styled`,Et="os-size-observer",kt=`${Et}-appear`,Dt=`${Et}-listener`,Nt=`${Dt}-scroll`,qt=`${Dt}-item`,Gt=`${qt}-final`,Wt="os-trinsic-observer",Yt="os-scrollbar",Ft=`${Yt}-horizontal`,Xt=`${Yt}-vertical`,Ut="os-scrollbar-track",Jt="os-scrollbar-handle";var Kt={exports:{}};!function(t){function e(){return t.exports=e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},t.exports.C=!0,t.exports["default"]=t.exports,e.apply(this,arguments)}t.exports=e,t.exports.C=!0,t.exports["default"]=t.exports}(Kt);const Qt=(Zt=Kt.exports)&&Zt.C&&Object.prototype.hasOwnProperty.call(Zt,"default")?Zt["default"]:Zt;var Zt;const te=t=>JSON.stringify(t,(t,e)=>{if(c(e))throw new Error;return e}),ee={resize:"none",paddingAbsolute:!1,updating:{elementEvents:[["img","load"]],attributes:null,debounce:[0,33]},overflow:{x:"scroll",y:"scroll"},scrollbars:{visibility:"auto",autoHide:"never",autoHideDelay:800,dragScroll:!0,clickScroll:!1,touch:!0},textarea:{dynWidth:!1,dynHeight:!1,inheritedAttrs:["style","class"]},nativeScrollbarsOverlaid:{show:!1,initialize:!1},callbacks:{onUpdated:null}},ne=(t,e)=>{const n={};return v(x(e).concat(x(t)),r=>{const o=t[r],i=e[r];if(d(o)&&d(i))O(n[r]={},ne(o,i));else if(S(e,r)&&i!==o){let t=!0;if(u(o)||u(i))try{te(o)===te(i)&&(t=!1)}catch(a){}t&&(n[r]=i)}}),n};let re;const{abs:oe,round:ie}=Math,ae=(t,e)=>{V(t,e);const n=st(e),r=at(e);return{x:r.h-n.h,y:r.w-n.w}},se=(t,e)=>{const n="hidden";$t(t,{overflowX:n,overflowY:n,direction:"rtl"}),A(t,0);const r=Lt(t),o=Lt(e);A(t,-999);const i=Lt(e);return{i:r.x===o.x,n:o.x!==i.x}},le=(t,e)=>{nt(t,Mt);const n=ct(t),r=ct(e),o=pt(r,n,!0);nt(t,Tt);const i=ct(t),a=ct(e),s=pt(a,i,!0);return o&&s},ce=()=>{const t=window.screen.deviceXDPI||0,e=window.screen.logicalXDPI||1;return window.devicePixelRatio||t/e},ue=()=>{const{body:t}=document,e=D(`<div class="${It}"><div></div></div>`)[0],n=e.firstChild,r=new Set,o=ae(t,e),i=(t=>{let e=!1;nt(t,Bt);try{e="none"===$t(t,F("scrollbar-width"))||"none"===window.getComputedStyle(t,"::-webkit-scrollbar").getPropertyValue("display")}catch(n){}return e})(e),a={x:0===o.x,y:0===o.y},s={$:null,A:null,L:null,I:null,M:null};let l=s,c=ee;const u={T:o,j:a,R:i,P:"-1"===$t(e,"zIndex"),V:se(e,n),H:le(e,n),B(t){r.add(t)},k(t){r.delete(t)},D:()=>Qt({},l),N(t){l=O({},l,t)},q:()=>Qt({},c),G(t){c=O({},c,t)},W:s,Y:c};if(z(e,"style"),E(e),!(i||a.x&&a.y)){let n=it(),i=ce(),a=o;window.addEventListener("resize",()=>{if(r.size){const o=it(),s={w:o.w-n.w,h:o.h-n.h};if(0===s.w&&0===s.h)return;const l={w:oe(s.w),h:oe(s.h)},c={w:oe(ie(o.w/(n.w/100))),h:oe(ie(o.h/(n.h/100)))},u=ce(),d=l.w>2&&l.h>2,_=!((t,e)=>{const n=oe(t),r=oe(e);return!(n===r||n+1===r||n-1===r)})(c.w,c.h),f=u!==i&&i>0;if(d&&_&&f){const n=re.T=ae(t,e);E(e),a.x===n.x&&a.y===n.y||m(r),a=n}n=o,i=u}})}return u},de=()=>(re||(re=ue()),re);let _e=0;const fe=t=>{V(R(t),j(t)),E(t)},ge=()=>{const{R:t,j:e,P:n}=de(),r=!!(!n&&!t&&(e.x||e.y))&&document.createElement("style");return r&&($(r,"id",`${Vt}-${_e}`),_e++),r},he=(t,e,n,r)=>e||(c(n)?n(t):n)||k(r),ve=(t,e,n,r,o)=>{const i=l(e)||e?e:c(n)?n(t):n;return null===i?!!o&&k(r):!0===i?k(r):i},we=t=>{const{D:e,R:n}=de(),{$:r,A:o,L:i,I:a}=e(),s=g(t),l=t,c=s?t:l.target,u=T(c,"textarea"),d=!u&&T(c,"body"),_=c.ownerDocument,f=_.body,h=_.defaultView,v={F:c,$:u?he(c,l.host,r,jt):c,A:he(c,l.viewport,o,Pt),L:ve(c,l.padding,i,Rt,!n),I:ve(c,l.content,a,Ht,!1),X:ge()},b={U:h,J:_,K:R(f),Z:f,tt:u,et:d,nt:s},y=x(v).reduce((t,e)=>{const n=v[e];return p(t,!(!n||R(n))&&n)},[]),S=t=>t?w(y,t)>-1:null,{F:O,$:C,L:$,A:z,I:A,X:L}=v,I=[],M=u&&S(C),H=u?O:j([A,z,$,C,O].find(t=>!1===S(t))),k=A||z;var D,N;return M&&(B(O,C),p(I,()=>{B(C,O),E(C)})),V(k,H),V(C,$),V($||C,z),V(z,A),nt(C,jt),nt($,Rt),nt(z,Pt),nt(A,Ht),p(I,()=>{s?(V(C,j(k)),E($||z),rt(C,jt)):(S(A)&&fe(A),S(z)&&fe(z),S($)&&fe($),rt(C,jt),rt($,Rt),rt(z,Pt),rt(A,Ht))}),n&&p(I,rt.bind(0,z,Bt)),L&&(N=L,P(R(D=z),D,N),p(I,E.bind(0,L))),{rt:v,ot:b,it:()=>{m(I)}}},pe=t=>{const e=k(`${Yt} ${t}`),n=k(Ut),r=k(Jt);return V(e,n),V(n,r),{st:e,lt:n,ct:r}},be="animationstart",ye="scroll",me=3333333,Se=t=>"rtl"===$t(t,"direction"),xe=t=>t&&(t.height||t.width),Oe=(e,n,r)=>{const{ut:o=!1,dt:i=!1}=r||{},{V:a}=de(),s=D(`<div class="${Et}"><div class="${Dt}"></div></div>`)[0],c=s.firstChild,_=Se.bind(0,s),[f]=t({o:void 0,u:!0,s:(t,e)=>!(!t||!xe(t)&&xe(e))}),g=t=>{const e=u(t)&&t.length>0&&d(t[0]),r=!e&&l(t[0]);let i=!1,c=!1,_=!0;if(e){const[e,,n]=f(t.pop().contentRect),r=xe(e),o=xe(n);i=!n||!r,c=!o&&r,_=!i}else r?[,_]=t:c=!0===t;if(o&&_){const e=r?t[0]:Se(s);A(s,e?a.n?-me:a.i?0:me:me),L(s,me)}i||n({_t:!r,ft:r?t:void 0,dt:!!c})},h=[];let v,w=!!i&&g;if(K){const t=new K(g);t.observe(c),p(h,()=>{t.disconnect()})}else{const t=D(`<div class="${qt}" dir="ltr"><div class="${qt}"><div class="${Gt}"></div></div><div class="${qt}"><div class="${Gt}" style="width: 200%; height: 200%"></div></div></div>`);V(c,t),nt(c,Nt);const e=t[0],n=e.lastChild,r=e.firstChild,o=null==r?void 0:r.firstChild;let a,s=at(e),l=s,u=!1;const d=()=>{A(r,me),L(r,me),A(n,me),L(n,me)},_=t=>{a=0,u&&(s=l,g(!0===t))},f=t=>{l=at(e),u=!t||!vt(l,s),t?(gt(t),u&&!a&&(Q(a),a=Z(_))):_(!1===t),d()};p(h,[ft(r,ye,f),ft(n,ye,f)]),$t(o,{width:me,height:me}),d(),w=i?f.bind(0,!1):d}if(o){v=t({o:!_()},_);const[e]=v;p(h,ft(s,ye,t=>{const n=e(),[r,o]=n;o&&(rt(c,"ltr rtl"),nt(c,r?"rtl":"ltr"),g(n)),gt(t)}))}return w&&(nt(s,kt),p(h,ft(s,be,w,{v:!!K}))),H(e,s),()=>{m(h),E(s)}},Ce=(t,e,n,r)=>{let o=!1;const{gt:i,ht:a,vt:l,wt:c,pt:u,bt:d,yt:_}=r||{},[f,g]=((t,e,n)=>{let r,o=!1;const i=i=>{if(n){v(n.reduce((e,n)=>{if(n){const r=n[0],o=n[1],a=o&&r&&(i?i(r):M(r,t));a&&a.length&&o&&s(o)&&p(e,[a,o.trim()],!0)}return e},[]),t=>v(t[0],n=>{const i=t[1],a=r.get(n);if(a){const t=a[0],e=a[1];t===i&&e()}const s=ft(n,i,t=>{o?(s(),r.delete(n)):e(t)});r.set(n,[i,s])}))}};return n&&(r=new WeakMap,i()),[()=>{o=!0},i]})(t,mt(()=>{o&&n(!0)},{p:33,m:99}),l),h=a||[],b=(i||[]).concat(h),m=o=>{const i=(e?d:u)||yt,a=_||yt,l=[],f=[];let b=!1,m=!1,S=!1;v(o,n=>{const{attributeName:o,target:u,type:d,oldValue:_,addedNodes:g}=n,v="attributes"===d,y="childList"===d,x=t===u,O=v&&s(o)?$(u,o):0,C=0!==O&&_!==O,z=w(h,o)>-1&&C;if(e&&!x){const e=!v,s=v&&z,l=s&&c&&T(u,c),d=(l?!i(u,o,_,O):e||s)&&!a(n,!!l,t,r);p(f,g),m=m||d,S=S||y}!e&&x&&C&&!i(u,o,_,O)&&(p(l,o),b=b||z)}),S&&!y(f)&&g(t=>f.reduce((e,n)=>(p(e,M(t,n)),T(n,t)?p(e,n):e),[])),e?m&&n(!1):y(l)&&!b||n(l,b)},S=new U(m);return S.observe(t,{attributes:!0,attributeOldValue:!0,attributeFilter:b,subtree:e,childList:e,characterData:e}),o=!0,[()=>{o&&(f(),S.disconnect(),o=!1)},()=>{o&&m(S.takeRecords())}]},$e="os-",ze=["tabindex"],Ae=["wrap","cols","rows"],Le=["id","class","style","open"],Ie=(t,e,n,r)=>{if("class"===e&&n&&r){return!!((t,e)=>{const n=t&&t.split(" "),r=e&&e.split(" "),o={};return v(n,t=>{o[t]=1}),v(r,t=>{o[t]?delete o[t]:o[t]=1}),x(o)})(n,r).find(t=>0!==t.indexOf($e))}return!1},Me=(e,n)=>{let r,o,i;const{St:l}=e,{rt:c,ot:d}=l,{$:_,A:f,I:g}=c,{tt:h}=d,{R:b,H:y}=de(),S=h?Ae:Le.concat(Ae),x=mt(n,{p:()=>r,m:()=>o,S(t,e){const{_t:n,xt:r,Ot:o}=t[0],{_t:i,xt:a,Ot:s}=e[0];return[{_t:n||i,xt:r||a,Ot:o||s}]}}),O=t=>{v(t||ze,t=>{if(w(ze,t)>-1){const e=$(_,t);s(e)?$(f,t,e):z(f,t)}})},C=t=>{(t?n:x)({Ot:!0})},A=(g||!y)&&((e,n)=>{const r=k(Wt),o=[],[i]=t({o:!1}),a=t=>{if(t){const r=i(0===(e=t).h||e.isIntersecting||e.intersectionRatio>0),[,o]=r;o&&n(r)}var e};if(J){const t=new J(t=>{t&&t.length>0&&a(t.pop())},{root:e});t.observe(r),p(o,()=>{t.disconnect()})}else{const t=()=>{const t=at(r);a(t)};p(o,Oe(r,t)),t()}return H(e,r),()=>{m(o),E(r)}})(_,t=>{n({Ct:t})}),L=Oe(_,({_t:t,ft:e,dt:r})=>{(!t||r?n:x)({_t:t,$t:e})},{dt:!0,ut:!b}),[I]=Ce(_,!1,(t,e)=>{e?x({xt:!0}):O(t)},{ht:Le,gt:Le.concat(ze),pt:Ie});return O(),[t=>{const[e,n]=t("updating.elementEvents"),[s,l]=t("updating.attributes"),[c,d]=t("updating.debounce");if((n||l)&&(i&&(i[1](),i[0]()),i=Ce(g||f,!0,C,{ht:S.concat(s||[]),gt:S.concat(s||[]),vt:e,bt:Ie})),d)if(x.O(),u(c)){const t=c[0],e=c[1];r=!!a(t)&&t,o=!!a(e)&&e}else a(c)?(r=c,o=!1):(r=!1,o=!1)},()=>{i&&i[0](),A&&A(),L(),I()}]},Te=t=>{const{St:e}=t,{I:n}=e.rt;return t=>{const{Ct:e}=t,[r,o]=e;return o&&$t(n,{height:r?"":"100%",display:r?"":"inline"}),{_t:o,Ot:o}}},je=e=>{const{St:n,zt:r}=e,{$:o,L:i,A:a}=n.rt,[s,l]=t({s:wt,o:zt()},zt.bind(0,o,"padding",""));return(t,e,n)=>{let[o,c]=l(n);const{R:u,H:d}=de(),{_t:_,$t:f,Ot:g}=t,[h,v]=f,[w,p]=e("paddingAbsolute");(_||c||!d&&g)&&([o,c]=s(n));const b=p||v||c;if(b){const t=!w||!i&&!u,e=o.r+o.l,n=o.t+o.b,s={marginRight:t&&!h?-e:0,marginBottom:t?-n:0,marginLeft:t&&h?-e:0,top:t?-o.t:0,right:t?h?-o.r:"auto":0,left:t?h?"auto":-o.l:0,width:t?`calc(100% + ${e}px)`:""},l={paddingTop:t?o.t:0,paddingRight:t?o.r:0,paddingBottom:t?o.b:0,paddingLeft:t?o.l:0};$t(i||a,s),$t(a,l),r({L:o,At:!t,Lt:i?l:O({},s,l)})}return{It:b}}},{max:Re,abs:Pe,round:Ve}=Math,He=42,Be={s:vt,o:{w:0,h:0}},Ee={s:(t,e)=>ht(t,e,["x","y"]),o:{x:!1,y:!1}},ke=t=>{const e=at(t),n=ct(t);return{w:n.width-e.w,h:n.height-e.h}},De=()=>window.devicePixelRatio%1==0?0:1,Ne=(t,e,n,r)=>{const o=t?"overflowX":"overflowY",i=0===n.indexOf("visible"),a="visible-hidden"===n,s="scroll"===n,l=e>0;return i&&(r[o]="visible"),s&&l&&(r[o]=n),{Mt:i,Tt:a?"hidden":"scroll"}},qe=e=>{const{St:n,jt:r,Rt:o,zt:i}=e,{$:a,A:s,X:l}=n.rt,[c,u]=t(Be,ke.bind(0,s)),[d,_]=t(Be,lt.bind(0,s)),[f,g]=t(Be),[h]=t(Ee),w=(t,e)=>{if($t(s,{height:""}),e){const{j:e}=de(),{At:n,L:r}=o(),{Pt:i,Vt:l}=t,c=ke(a),u=st(a),d="content-box"===$t(s,"boxSizing"),_=n||d?r.b+r.t:0,f=u.h+(Pe(c.h)<1?c.h:0),g=!(e.x&&d);$t(s,{height:f+(i.x&&g?l.x:0)-_})}},p=(t,e)=>{const{T:n,j:r,R:o}=de(),{x:i,y:a}=r,l=o||t?0:He,c=!e?$t(s,["overflowX","overflowY"]):e,u={x:"scroll"===c.overflowX,y:"scroll"===c.overflowY},d={x:i?l:n.x,y:a?l:n.y};return{Pt:u,Ht:{x:i&&!!l,y:a&&!!l},Vt:{x:u.x&&!o?d.x:0,y:u.y&&!o?d.y:0}}},b=(t,e,n,i)=>{if(r){const{Lt:r}=o(),{Vt:a,Ht:c}=t,{x:u,y:d}=c,{x:_,y:f}=a,g=r[i?"paddingRight":"paddingLeft"],h=r.paddingTop,v=e.w+(Pe(n.w)<1?n.w:0),w=e.h+(Pe(n.h)<1?n.h:0),p={w:f&&d?`${f+v-g}px`:"",h:_&&u?`${_+w-h}px`:""};if(l){const{sheet:t}=l;if(t){const{cssRules:e}=t;if(e){e.length||t.insertRule(`#${$(l,"id")} + .${Vt}::before {}`,0);const n=e[0].style;n.width=p.w,n.height=p.h}}}else $t(s,{"--os-vaw":p.w,"--os-vah":p.h})}return r},y=(t,e,n,r)=>{const{Vt:i,Ht:a}=t,{x:s,y:l}=a,{x:c,y:u}=i,{Lt:d}=o(),_=e?"marginLeft":"marginRight",f=e?"paddingLeft":"paddingRight",g=d[_],h=d.marginBottom,v=d[f],w=d.paddingBottom;r.width=`calc(100% + ${u+-1*g}px)`,r[_]=-u+g,r.marginBottom=-c+h,n&&(r[f]=v+(l?u:0),r.paddingBottom=w+(s?c:0))};return(t,e,n)=>{const{$t:a,Ct:l,_t:m,xt:S,Ot:O,It:C}=t,{H:$,R:z,j:A}=de(),[L,I]=l,[M,T]=a,[j,R]=e("nativeScrollbarsOverlaid.show"),P=j&&A.x&&A.y,V=!$&&(m||O||S||R||I);let H,B=u(n),E=_(n),k=g(n);if(R&&z&&(P?rt(s,Bt):nt(s,Bt)),V&&(H=p(P),w(H,!!L)),m||C||O||R||T){const[t,e]=((t,e,n)=>{if(r){const i=n||p(t),{Lt:a}=o(),{H:l}=de(),{Ht:c}=i,{x:u,y:d}=c,_={},f=t=>v(t.split(" "),t=>{_[t]=a[t]});l||(_.height=""),u&&f("marginBottom paddingTop paddingBottom"),d&&f("marginLeft marginRight paddingLeft paddingRight");const g=$t(s,x(_));return rt(s,Vt),$t(s,_),[()=>{y(i,e,r,g),$t(s,g),nt(s,Vt)},i]}return[yt]})(P,M,H),[i,a]=B=c(n),[l,u]=E=d(n),_=st(s);let g=l,h=_;t(),(u||a||R)&&e&&!P&&b(e,l,i,M)&&(h=st(s),g=lt(s)),k=f(((t,e,n)=>({w:Re(0,Ve(Re(0,t.w-e.w)-(De()||Re(0,n.w)))),h:Re(0,Ve(Re(0,t.h-e.h)-(De()||Re(0,n.h))))}))({w:Re(l.w,g.w),h:Re(l.h,g.h)},{w:h.w+Re(0,_.w-l.w),h:h.h+Re(0,_.h-l.h)},i),n)}const[D,N]=B,[q,G]=E,[W,Y]=k,[F,X]=e("overflow");if(C||N||G||Y||X||R||T||V){const t={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},e=((t,e,n,r)=>{const{Mt:o,Tt:i}=Ne(!0,e.w,n.x,r),{Mt:a,Tt:s}=Ne(!1,e.h,n.y,r);return o&&!a&&(r.overflowX=i),a&&!o&&(r.overflowY=s),p(t,r)})(P,W,F,t),n=b(e,q,D,M);y(e,M,n,t),V&&w(e,!!L),$t(s,t),i({Bt:h(e.Pt),Et:k})}}},Ge=(t,e)=>t?e.split(".").reduce((t,e)=>t&&S(t,e)?t[e]:void 0,t):void 0,We=[!1,!1,!1],Ye={L:{t:0,r:0,b:0,l:0},At:!1,Bt:[{x:!1,y:!1},!1],Et:[{w:0,h:0},!1],Lt:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0}},Fe=(t,e,n)=>{const r={},o=e||{};return v(x(t).concat(x(o)),e=>{const i=t[e],a=o[e];r[e]=l(i)?!!n||!!i||!!a:((t,e)=>[t[0],e||t[1],t[2]])(i||We,n)}),r},Xe=(t,e)=>({amount:{x:t.w,y:t.h},overflow:{x:t.w>0,y:t.h>0},scrollableOverflow:O({},e)}),Ue={},Je=["__TPL_","_TYPE__"],Ke=["boolean","number","string","array","object","function","null"].reduce((t,e)=>(t[e]=Je[0]+e+Je[1],t),{});Ke.number,Ke.boolean,Ke.array,Ke.null,Ke.string,Ke.array,Ke.null;Ke.number,Ke.array,Ke.null,Ke.function,Ke.null;const Qe="__osOptionsValidationPlugin",Ze=new Set,tn=new WeakMap,en=(t,e)=>{v(u(e)?e:[e],t)},nn=(t,e,n)=>{const{q:r,j:o}=de(),i=O({},Ue),s=g(t)?t:t.target,l=(t=>tn.get(t))(s);if(l)return l;const u=i[Qe],d=t=>{const e=t||{},n=u&&u.kt;return n?n(e,!0):e},_=O({},r(),d(e)),[f,h,w]=(t=>{const e=new Map,n=(t,n)=>{if(t){const r=e.get(t);en(t=>{r&&r[t?"delete":"clear"](t)},n)}else e.forEach(t=>{t.clear()}),e.clear()},r=(t,r)=>{const o=e.get(t)||new Set;return e.set(t,o),en(t=>{o.add(t)},r),n.bind(0,t,r)};return v(x(t),e=>{r(e,t[e])}),[r,n,(t,n)=>{const r=e.get(t);v(b(r),t=>{n?t(n):t()})}]})(n);o.x&&o.y&&!_.nativeScrollbarsOverlaid.initialize&&w("initializationWithdrawn");const p=we(t),y=((t,e)=>{const{D:n}=de(),{M:r}=n(),{rt:o,ot:i}=e,{F:a,$:s,A:l}=o,u=!i.nt&&t.scrollbarsSlot,d=(c(u)?u(a,s,l):u)||(c(r)?r(a,s,l):r)||s,_=pe(Ft),f=pe(Xt),{st:g}=_,{st:h}=f;return V(d,g),V(d,h),{Dt:_,Nt:f,it(){E([g,h])}}})(t,p),m=((t,e,n,r)=>{let o,i,s=Ye;const{A:l}=n.rt,{R:c,j:u,H:d,B:_,k:f}=de(),g=!c&&(u.x||u.y),h={qt:t,St:n,jt:g,Rt:()=>s,zt(t){s=O({},s,t)}},w=[Te(h),je(h),qe(h)],p=(n,r,i)=>{const c=Fe(O({_t:!1,xt:!1,Ot:!1,It:!1,$t:We,Ct:We},n),{},i),u=e=>[Ge(t,e),i||void 0!==Ge(r,e)],_=g||!d,f=_&&A(l),h=_&&L(l);o&&o(u);let p=c;v(w,t=>{p=Fe(p,t(p,u,!!i)||{},i)}),a(f)&&A(l,f),a(h)&&L(l,h);const{Et:b,Bt:y}=s,[m,S,x]=b,[C,$,z]=y;(S||$)&&e("overflowChanged",O({},Xe(m,C),{previous:Xe(x,z)})),e("updated",{updateHints:{sizeChanged:p._t,contentMutation:p.Ot,hostMutation:p.xt,directionChanged:p.$t[1],heightIntrinsicChanged:p.Ct[1]},changedOptions:r||{},force:!!i})};[o,i]=Me(h,p);const b=(t,e)=>p({},t,e),y=b.bind(0,{},!0);return _(y),{Gt:b,Wt:()=>({Yt:s.Et[0]}),it(){i(),f(y),n.it(),r.it()}}})(_,w,p,y),S={options(t){if(t){const e=ne(_,d(t));(function(t){for(const e in t)return!1;return!0})(e)||(O(_,e),m.Gt(e))}return _},on:f,off:h,state:()=>m.Wt(),update(t){m.Gt({},t)},destroy:()=>{m.it(),(t=>{tn.delete(t),Ze.delete(t)})(s),h(),w("destroyed")}};return v(x(i),t=>{const e=i[t];c(e)&&e(nn,S)}),S.update(!0),((t,e)=>{tn.set(t,e),Ze.add(t)})(s,S),w("initialized"),S};nn.extend=t=>v(u(t)?t:[t],t=>{Ue[t[0]]=t[1]});export{nn as default};