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