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