Files
OverlayScrollbars/packages/overlayscrollbars/dist/overlayscrollbars.esm.min.js
T
2022-07-11 11:20:58 +02:00

1 line
22 KiB
JavaScript

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