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