Files
OverlayScrollbars/packages/overlayscrollbars/dist/overlayscrollbars.esm.min.js
T

1 line
20 KiB
JavaScript

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