mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-19 01:30:36 +03:00
1 line
21 KiB
JavaScript
1 line
21 KiB
JavaScript
function t(t,n){const{o:e,s:o,u:r}=t;let i,s=e;const a=(t,n)=>{const e=s,a=t,l=n||(o?!o(e,a):e!==a);return(l||r)&&(s=a,i=e),[s,l,i]};return[n?t=>a(n(s,i),t):a,t=>[s,!!t,i]]}const n=Node.ELEMENT_NODE,{toString:e,hasOwnProperty:o}=Object.prototype;function r(t){return void 0===t}function i(t){return null===t}function s(t){return"number"==typeof t}function a(t){return"string"==typeof t}function l(t){return"boolean"==typeof t}function c(t){return"function"==typeof t}function u(t){return Array.isArray(t)}function d(t){return"object"==typeof t&&!u(t)&&!i(t)}function _(t){const n=!!t&&t.length,e=s(n)&&n>-1&&n%1==0;return!!(u(t)||!c(t)&&e)&&(!(n>0&&d(t))||n-1 in t)}function f(t){if(!t||!d(t)||"object"!==(t=>r(t)||i(t)?`${t}`:e.call(t).replace(/^\[object (.+)\]$/,"$1").toLowerCase())(t))return!1;let n;const s="constructor",a=t[s],l=a&&a.prototype,c=o.call(t,s),u=l&&o.call(l,"isPrototypeOf");if(a&&!c&&!u)return!1;for(n in t);return r(n)||o.call(t,n)}function g(t){const e=window.HTMLElement;return!!t&&(e?t instanceof e:t.nodeType===n)}function h(t){const e=window.Element;return!!t&&(e?t instanceof e:t.nodeType===n)}function v(t,n){if(_(t))for(let e=0;e<t.length&&!1!==n(t[e],e,t);e++);else t&&v(Object.keys(t),e=>n(t[e],e,t));return t}const w=(t,n,e)=>t.indexOf(n,e),p=(t,n,e)=>(e||a(n)||!_(n)?t.push(n):Array.prototype.push.apply(t,n),t),b=t=>{if(Array.from&&t)return Array.from(t);const n=[];return t instanceof Set?t.forEach(t=>{p(n,t)}):v(t,t=>{p(n,t)}),n},y=t=>!!t&&0===t.length,m=(t,n)=>{const e=t=>t&&t.apply(void 0,n||[]);t instanceof Set?t.forEach(e):v(t,e)},S=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),x=t=>t?Object.keys(t):[];function O(t,n,e,o,r,s,a){const l=[n,e,o,r,s,a];return"object"==typeof t&&!i(t)||c(t)||(t={}),v(l,n=>{v(x(n),e=>{const o=n[e];if(t===o)return!0;const r=u(o);if(o&&(f(o)||r)){const n=t[e];let i=n;r&&!u(n)?i=[]:r||f(n)||(i={}),t[e]=O(i,o)}else t[e]=o})}),t}function $(t,n,e,o){if(r(o))return e?e[t]:n;e&&(e[t]=o)}function C(t,n,e){if(r(e))return t?t.getAttribute(n):null;t&&t.setAttribute(n,e)}const z=(t,n)=>{t&&t.removeAttribute(n)};function A(t,n){return $("scrollLeft",0,t,n)}function I(t,n){return $("scrollTop",0,t,n)}const M=Element.prototype,L=(t,n)=>{const e=[],o=n?h(n)?n:null:document;return o?p(e,o.querySelectorAll(t)):e},T=(t,n)=>{if(h(t)){return(M.matches||M.msMatchesSelector).call(t,n)}return!1},R=t=>t?b(t.childNodes):[],j=t=>t?t.parentElement:null,P=(t,n,e)=>{if(e){let o,r=n;t&&(_(e)?(o=document.createDocumentFragment(),v(e,t=>{t===r&&(r=t.previousSibling),o.appendChild(t)})):o=e,n&&(r?r!==n&&(r=r.nextSibling):r=t.firstChild),t.insertBefore(o,r||null))}},H=(t,n)=>{P(t,null,n)},V=(t,n)=>{P(t,t&&t.firstChild,n)},E=(t,n)=>{P(j(t),t&&t.nextSibling,n)},B=t=>{if(_(t))v(b(t),t=>B(t));else if(t){const n=j(t);n&&n.removeChild(t)}},k=t=>{const n=document.createElement("div");return t&&C(n,"class",t),n},D=t=>{const n=k();return n.innerHTML=t.trim(),v(R(n),t=>B(t))},N=t=>t.charAt(0).toUpperCase()+t.slice(1),q=["-webkit-","-moz-","-o-","-ms-"],G=["WebKit","Moz","O","MS","webkit","moz","o","ms"],W={},Y={},F=t=>{let n=Y[t];if(S(Y,t))return n;const e=N(t),o=k().style;return v(q,r=>{const i=r.replace(/-/g,""),s=[t,r+t,i+e,N(i)+e];return!(n=s.find(t=>void 0!==o[t]))}),Y[t]=n||""},X=t=>{let n=W[t]||window[t];return S(W,t)||(v(G,e=>(n=n||window[e+N(t)],!n)),W[t]=n),n},U=X("MutationObserver"),J=X("IntersectionObserver"),K=X("ResizeObserver"),Q=X("cancelAnimationFrame"),Z=X("requestAnimationFrame"),tt=/[^\x20\t\r\n\f]+/g,nt=(t,n,e)=>{let o,r=0,i=!1;if(t&&a(n)){const s=n.match(tt)||[];for(i=s.length>0;o=s[r++];)i=!!e(t.classList,o)&&i}return i},et=(t,n)=>{nt(t,n,(t,n)=>t.add(n))},ot=(t,n)=>{nt(t,n,(t,n)=>t.remove(n))},rt={w:0,h:0},it=()=>({w:window.innerWidth,h:window.innerHeight}),st=t=>t?{w:t.offsetWidth,h:t.offsetHeight}:rt,at=t=>t?{w:t.clientWidth,h:t.clientHeight}:rt,lt=t=>t?{w:t.scrollWidth,h:t.scrollHeight}:rt,ct=t=>t.getBoundingClientRect();let ut;const dt=t=>t.split(" "),_t=(t,n,e,o)=>{v(dt(n),n=>{t.removeEventListener(n,e,o)})},ft=(t,n,e,o)=>{const i=(()=>{if(r(ut)){ut=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){ut=!0}}))}catch(t){}}return ut})(),s=i&&o&&o._||!1,a=o&&o.g||!1,l=o&&o.v||!1,c=[],u=i?{passive:s,capture:a}:a;return v(dt(n),n=>{const o=l?r=>{t.removeEventListener(n,o,a),e&&e(r)}:e;p(c,_t.bind(null,t,n,o,a)),t.addEventListener(n,o,u)}),m.bind(0,c)},gt=t=>(t=>t.stopPropagation())(t)||(t=>t.preventDefault())(t),ht=(t,n,e,o)=>{if(t&&n){let r=!0;return v(e,e=>{(o?o(t[e]):t[e])!==(o?o(n[e]):n[e])&&(r=!1)}),r}return!1},vt=(t,n)=>ht(t,n,["w","h"]),wt=(t,n)=>ht(t,n,["t","r","b","l"]),pt=(t,n,e)=>ht(t,n,["width","height"],e&&(t=>Math.round(t))),bt=t=>{t&&window.clearTimeout(t),t&&Q(t)},yt=()=>{},mt=(t,n)=>{let e,o,r,i;const{p:a,m:l,S:u}=n||{},d=window.setTimeout,_=function(n){bt(e),bt(o),o=e=r=void 0,t.apply(this,n)},f=t=>u&&r?u(r,t):t,g=()=>{e&&_(f(i)||i)},h=function(){const t=b(arguments),n=c(a)?a():a,u=s(n)&&n>=0;if(u){const a=c(l)?l():l,u=s(a)&&a>=0,h=n>0?d:Z,v=f(t)||t,w=_.bind(0,v);bt(e),e=h(w,n),u&&!o&&(o=d(g,a)),r=i=v}else _(t)};return h.O=g,h},St={opacity:1,zindex:1},xt=(t,n)=>{const e=n?parseFloat(t):parseInt(t,10);return Number.isNaN(e)?0:e},Ot=(t,n,e)=>null!=n?n[e]||n.getPropertyValue(e):t.style[e],$t=(t,n,e)=>{try{if(t){const{style:o}=t;r(o[n])?o.setProperty(n,e):o[n]=((t,n)=>!St[t.toLowerCase()]&&s(n)?`${n}px`:n)(n,e)}}catch(o){}};function Ct(t,n){const e=a(n);if(u(n)||e){let o=e?"":{};if(t){const r=window.getComputedStyle(t,null);o=e?Ot(t,r,n):n.reduce((n,e)=>(n[e]=Ot(t,r,e),n),o)}return o}v(x(n),e=>$t(t,e,n[e]))}const zt=(t,n,e)=>{const o=n?`${n}-`:"",r=e?`-${e}`:"",i=`${o}top${r}`,s=`${o}right${r}`,a=`${o}bottom${r}`,l=`${o}left${r}`,c=Ct(t,[i,s,a,l]);return{t:xt(c[i]),r:xt(c[s]),b:xt(c[a]),l:xt(c[l])}},At={x:0,y:0},It=t=>{const n=t?ct(t):0;return n?{x:n.left+window.pageYOffset,y:n.top+window.pageXOffset}:At},Mt=(t,n)=>{v(u(n)?n:[n],t)},Lt=(t,n)=>t?n.split(".").reduce((t,n)=>t&&S(t,n)?t[n]:void 0,t):void 0,Tt=(t,n,e)=>o=>[Lt(t,o),e||void 0!==Lt(n,o)],Rt=t=>{let n=t;return[()=>n,t=>{n=O({},n,t)}]};var jt={exports:{}};!function(t){function n(){return t.exports=n=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},t.exports.$=!0,t.exports["default"]=t.exports,n.apply(this,arguments)}t.exports=n,t.exports.$=!0,t.exports["default"]=t.exports}(jt);const Pt=(Ht=jt.exports)&&Ht.$&&Object.prototype.hasOwnProperty.call(Ht,"default")?Ht["default"]:Ht;var Ht;const Vt="os-environment",Et=`${Vt}-flexbox-glue`,Bt=`${Et}-max`,kt="os-host",Dt="os-padding",Nt="os-viewport",qt=`${Nt}-arrange`,Gt="os-content",Wt=`${Nt}-scrollbar-styled`,Yt="os-size-observer",Ft=`${Yt}-appear`,Xt=`${Yt}-listener`,Ut=`${Xt}-scroll`,Jt=`${Xt}-item`,Kt=`${Jt}-final`,Qt="os-trinsic-observer",Zt="os-scrollbar",tn=`${Zt}-horizontal`,nn=`${Zt}-vertical`,en="os-scrollbar-track",on="os-scrollbar-handle",rn=t=>JSON.stringify(t,(t,n)=>{if(c(n))throw new Error;return n}),sn={resize:"none",paddingAbsolute:!1,updating:{elementEvents:[["img","load"]],attributes:null,debounce:[0,33]},overflow:{x:"scroll",y:"scroll"},scrollbars:{visibility:"auto",autoHide:"never",autoHideDelay:800,dragScroll:!0,clickScroll:!1,touch:!0},textarea:{dynWidth:!1,dynHeight:!1,inheritedAttrs:["style","class"]},nativeScrollbarsOverlaid:{show:!1,initialize:!1},callbacks:{onUpdated:null}},an=(t,n)=>{const e={};return v(x(n).concat(x(t)),o=>{const r=t[o],i=n[o];if(d(r)&&d(i))O(e[o]={},an(r,i));else if(S(n,o)&&i!==r){let t=!0;if(u(r)||u(i))try{rn(r)===rn(i)&&(t=!1)}catch(s){}t&&(e[o]=i)}}),e};let ln;const{abs:cn,round:un}=Math,dn=(t,n)=>{H(t,n);const e=at(n),o=st(n);return{x:o.h-e.h,y:o.w-e.w}},_n=(t,n)=>{const e="hidden";Ct(t,{overflowX:e,overflowY:e,direction:"rtl"}),A(t,0);const o=It(t),r=It(n);A(t,-999);const i=It(n);return{i:o.x===r.x,n:r.x!==i.x}},fn=(t,n)=>{et(t,Et);const e=ct(t),o=ct(n),r=pt(o,e,!0);et(t,Bt);const i=ct(t),s=ct(n),a=pt(s,i,!0);return r&&a},gn=()=>{const t=window.screen.deviceXDPI||0,n=window.screen.logicalXDPI||1;return window.devicePixelRatio||t/n},hn=()=>{const{body:t}=document,n=D(`<div class="${Vt}"><div></div></div>`)[0],e=n.firstChild,o=new Set,r=dn(t,n),i=(t=>{let n=!1;et(t,Wt);try{n="none"===Ct(t,F("scrollbar-width"))||"none"===window.getComputedStyle(t,"::-webkit-scrollbar").getPropertyValue("display")}catch(e){}return n})(n),s={x:0===r.x,y:0===r.y},a={C:null,A:null,I:null,M:null,L:null};let l=a,c=sn;const u={T:r,R:s,j:i,P:"-1"===Ct(n,"zIndex"),H:_n(n,e),V:fn(n,e),B:t=>(o.add(t),()=>o.delete(t)),k:()=>Pt({},l),D(t){l=O({},l,t)},N:()=>Pt({},c),q(t){c=O({},c,t)},G:a,W:c};if(z(n,"style"),B(n),!(i||s.x&&s.y)){let e=it(),i=gn(),s=r;window.addEventListener("resize",()=>{if(o.size){const r=it(),a={w:r.w-e.w,h:r.h-e.h};if(0===a.w&&0===a.h)return;const l={w:cn(a.w),h:cn(a.h)},c={w:cn(un(r.w/(e.w/100))),h:cn(un(r.h/(e.h/100)))},u=gn(),d=l.w>2&&l.h>2,_=!((t,n)=>{const e=cn(t),o=cn(n);return!(e===o||e+1===o||e-1===o)})(c.w,c.h),f=u!==i&&i>0;if(d&&_&&f){const e=dn(t,n);ln.T.x=e.x,ln.T.y=e.y,B(n),s.x===e.x&&s.y===e.y||m(o),s=e}e=r,i=u}})}return u},vn=()=>(ln||(ln=hn()),ln);let wn=0;const pn=t=>{H(j(t),R(t)),B(t)},bn=()=>{const{j:t,R:n,P:e}=vn(),o=!!(!e&&!t&&(n.x||n.y))&&document.createElement("style");return o&&(C(o,"id",`${qt}-${wn}`),wn++),o},yn=(t,n,e,o)=>n||(c(e)?e(t):e)||k(o),mn=(t,n,e,o,r)=>{const i=l(n)||n?n:c(e)?e(t):e;return null===i?!!r&&k(o):!0===i?k(o):i},Sn=t=>{const{k:n,j:e}=vn(),{C:o,A:r,I:i,M:s}=n(),a=g(t),l=t,c=a?t:l.target,u=T(c,"textarea"),d=!u&&T(c,"body"),_=c.ownerDocument,f=_.body,h=_.defaultView,v={Y:c,C:u?yn(c,l.host,o,kt):c,A:yn(c,l.viewport,r,Nt),I:mn(c,l.padding,i,Dt,!e),M:mn(c,l.content,s,Gt,!1),F:bn(),X:h,U:_,J:j(f),K:f,Z:u,tt:d,nt:a},b=x(v).reduce((t,n)=>{const e=v[n];return p(t,!(!e||j(e))&&e)},[]),y=t=>t?w(b,t)>-1:null,{Y:S,C:O,I:$,A:C,M:z,F:A}=v,I=[],M=u&&y(O),L=u?S:R([z,C,$,O,S].find(t=>!1===y(t))),V=z||C;var k,D;return M&&(E(S,O),p(I,()=>{E(O,S),B(O)})),H(V,L),H(O,$),H($||O,C),H(C,z),et(O,kt),et($,Dt),et(C,Nt),et(z,Gt),p(I,()=>{a?(H(O,R(V)),B($||C),ot(O,kt)):(y(z)&&pn(z),y(C)&&pn(C),y($)&&pn($),ot(O,kt),ot($,Dt),ot(C,Nt),ot(z,Gt))}),e&&p(I,ot.bind(0,C,Wt)),A&&(D=A,P(j(k=C),k,D),p(I,B.bind(0,A))),[v,m.bind(0,I)]},xn=t=>{const{M:n}=t;return t=>{const{et:e}=t,[o,r]=e;return r&&Ct(n,{height:o?"":"100%",display:o?"":"inline"}),{ot:r,rt:r}}},On=(n,e)=>{const[,o]=e,{C:r,I:i,A:s}=n,[a,l]=t({s:wt,o:zt()},zt.bind(0,r,"padding",""));return(t,n,e)=>{let[r,c]=l(e);const{j:u,V:d}=vn(),{ot:_,it:f,rt:g}=t,[h,v]=f,[w,p]=n("paddingAbsolute");(_||c||!d&&g)&&([r,c]=a(e));const b=p||v||c;if(b){const t=!w||!i&&!u,n=r.r+r.l,e=r.t+r.b,a={marginRight:t&&!h?-n:0,marginBottom:t?-e:0,marginLeft:t&&h?-n:0,top:t?-r.t:0,right:t?h?-r.r:"auto":0,left:t?h?"auto":-r.l:0,width:t?`calc(100% + ${n}px)`:""},l={paddingTop:t?r.t:0,paddingRight:t?r.r:0,paddingBottom:t?r.b:0,paddingLeft:t?r.l:0};Ct(i||s,a),Ct(s,l),o({I:r,st:!t,lt:i?l:O({},a,l)})}return{ct:b}}},{max:$n,abs:Cn,round:zn}=Math,An=42,In={s:vt,o:{w:0,h:0}},Mn={s:(t,n)=>ht(t,n,["x","y"]),o:{x:!1,y:!1}},Ln=t=>{const n=st(t),e=ct(t);return{w:e.width-n.w,h:e.height-n.h}},Tn=()=>window.devicePixelRatio%1==0?0:1,Rn=(t,n,e,o)=>{const r=t?"overflowX":"overflowY",i=0===e.indexOf("visible"),s="visible-hidden"===e,a="scroll"===e,l=n>0;return i&&(o[r]="visible"),a&&l&&(o[r]=e),{ut:i,dt:s?"hidden":"scroll"}},jn=(n,e)=>{const[o,r]=e,{C:i,A:s,F:a}=n,{T:l,V:c,j:u,R:d}=vn(),_=!u&&(d.x||d.y),[f,g]=t(In,Ln.bind(0,s)),[h,w]=t(In,lt.bind(0,s)),[p,b]=t(In),[y]=t(Mn),m=(t,n)=>{if(Ct(s,{height:""}),n){const{st:n,I:e}=o(),{_t:r,ft:a}=t,l=Ln(i),c=at(i),u="content-box"===Ct(s,"boxSizing"),_=n||u?e.b+e.t:0,f=c.h+(Cn(l.h)<1?l.h:0),g=!(d.x&&u);Ct(s,{height:f+(r.x&&g?a.x:0)-_})}},S=(t,n)=>{const{x:e,y:o}=d,r=u||t?0:An,i=!n?Ct(s,["overflowX","overflowY"]):n,a={x:"scroll"===i.overflowX,y:"scroll"===i.overflowY},c={x:e?r:l.x,y:o?r:l.y};return{_t:a,gt:{x:e&&!!r,y:o&&!!r},ft:{x:a.x&&!u?c.x:0,y:a.y&&!u?c.y:0}}},O=(t,n,e,r)=>{if(_){const{lt:i}=o(),{ft:l,gt:c}=t,{x:u,y:d}=c,{x:_,y:f}=l,g=i[r?"paddingRight":"paddingLeft"],h=i.paddingTop,v=n.w+(Cn(e.w)<1?e.w:0),w=n.h+(Cn(e.h)<1?e.h:0),p={w:f&&d?`${f+v-g}px`:"",h:_&&u?`${_+w-h}px`:""};if(a){const{sheet:t}=a;if(t){const{cssRules:n}=t;if(n){n.length||t.insertRule(`#${C(a,"id")} + .${qt}::before {}`,0);const e=n[0].style;e.width=p.w,e.height=p.h}}}else Ct(s,{"--os-vaw":p.w,"--os-vah":p.h})}return _},$=(t,n,e,r)=>{const{ft:i,gt:s}=t,{x:a,y:l}=s,{x:c,y:u}=i,{lt:d}=o(),_=n?"marginLeft":"marginRight",f=n?"paddingLeft":"paddingRight",g=d[_],h=d.marginBottom,v=d[f],w=d.paddingBottom;r.width=`calc(100% + ${u+-1*g}px)`,r[_]=-u+g,r.marginBottom=-c+h,e&&(r[f]=v+(l?u:0),r.paddingBottom=w+(a?c:0))};return(t,n,e)=>{const{it:i,et:a,ot:l,ht:C,rt:z,ct:A}=t,[I,M]=a,[L,T]=i,[R,j]=n("nativeScrollbarsOverlaid.show"),P=R&&d.x&&d.y,H=!c&&(l||z||C||j||M);let V,E=g(e),B=w(e),k=b(e);if(j&&u&&(P?ot(s,Wt):et(s,Wt)),H&&(V=S(P),m(V,!!I)),l||A||z||j||T){const[t,n]=((t,n,e)=>{if(_){const r=e||S(t),{lt:i}=o(),{gt:a}=r,{x:l,y:u}=a,d={},f=t=>v(t.split(" "),t=>{d[t]=i[t]});c||(d.height=""),l&&f("marginBottom paddingTop paddingBottom"),u&&f("marginLeft marginRight paddingLeft paddingRight");const g=Ct(s,x(d));return ot(s,qt),Ct(s,d),[()=>{$(r,n,_,g),Ct(s,g),et(s,qt)},r]}return[yt]})(P,L,V),[r,i]=E=f(e),[a,l]=B=h(e),u=at(s);let d=a,g=u;t(),(l||i||j)&&n&&!P&&O(n,a,r,L)&&(g=at(s),d=lt(s)),k=p(((t,n,e)=>({w:$n(0,zn($n(0,t.w-n.w)-(Tn()||$n(0,e.w)))),h:$n(0,zn($n(0,t.h-n.h)-(Tn()||$n(0,e.h))))}))({w:$n(a.w,d.w),h:$n(a.h,d.h)},{w:g.w+$n(0,u.w-a.w),h:g.h+$n(0,u.h-a.h)},r),e)}const[D,N]=E,[q,G]=B,[W,Y]=k,[F,X]=n("overflow");if(A||N||G||Y||X||j||T||H){const t={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},n=((t,n,e,o)=>{const{ut:r,dt:i}=Rn(!0,n.w,e.x,o),{ut:s,dt:a}=Rn(!1,n.h,e.y,o);return r&&!s&&(o.overflowX=i),s&&!r&&(o.overflowY=a),S(t,o)})(P,W,F,t),e=O(n,q,D,L);$(n,L,e,t),H&&m(n,!!I),Ct(s,t),r({vt:y(n._t),wt:k})}}},Pn=[!1,!1,!1],Hn=(t,n,e)=>{const o={},r=n||{};return v(x(t).concat(x(r)),n=>{const i=t[n],s=r[n];o[n]=l(i)?!!e||!!i||!!s:((t,n)=>[t[0],n||t[1],t[2]])(i||Pn,e)}),o},Vn="animationstart",En="scroll",Bn=3333333,kn=t=>"rtl"===Ct(t,"direction"),Dn=t=>t&&(t.height||t.width),Nn=(n,e,o)=>{const{pt:r=!1,bt:i=!1}=o||{},{H:s}=vn(),a=D(`<div class="${Yt}"><div class="${Xt}"></div></div>`)[0],c=a.firstChild,_=kn.bind(0,a),[f]=t({o:void 0,u:!0,s:(t,n)=>!(!t||!Dn(t)&&Dn(n))}),g=t=>{const n=u(t)&&t.length>0&&d(t[0]),o=!n&&l(t[0]);let i=!1,c=!1,_=!0;if(n){const[n,,e]=f(t.pop().contentRect),o=Dn(n),r=Dn(e);i=!e||!o,c=!r&&o,_=!i}else o?[,_]=t:c=!0===t;if(r&&_){const n=o?t[0]:kn(a);A(a,n?s.n?-Bn:s.i?0:Bn:Bn),I(a,Bn)}i||e({ot:!o,yt:o?t:void 0,bt:!!c})},h=[];let v,w=!!i&&g;if(K){const t=new K(g);t.observe(c),p(h,()=>{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>`);H(c,t),et(c,Ut);const n=t[0],e=n.lastChild,o=n.firstChild,r=null==o?void 0:o.firstChild;let s,a=st(n),l=a,u=!1;const d=()=>{A(o,Bn),I(o,Bn),A(e,Bn),I(e,Bn)},_=t=>{s=0,u&&(a=l,g(!0===t))},f=t=>{l=st(n),u=!t||!vt(l,a),t?(gt(t),u&&!s&&(Q(s),s=Z(_))):_(!1===t),d()};p(h,[ft(o,En,f),ft(e,En,f)]),Ct(r,{width:Bn,height:Bn}),d(),w=i?f.bind(0,!1):d}if(r){v=t({o:!_()},_);const[n]=v;p(h,ft(a,En,t=>{const e=n(),[o,r]=e;r&&(ot(c,"ltr rtl"),et(c,o?"rtl":"ltr"),g(e)),gt(t)}))}return w&&(et(a,Ft),p(h,ft(a,Vn,w,{v:!!K}))),V(n,a),()=>{m(h),B(a)}},qn=(t,n,e,o)=>{let r=!1;const{St:i,xt:s,Ot:l,$t:c,Ct:u,zt:d,At:_}=o||{},[f,g]=((t,n,e)=>{let o,r=!1;const i=i=>{if(e){v(e.reduce((n,e)=>{if(e){const o=e[0],r=e[1],s=r&&o&&(i?i(o):L(o,t));s&&s.length&&r&&a(r)&&p(n,[s,r.trim()],!0)}return n},[]),t=>v(t[0],e=>{const i=t[1],s=o.get(e);if(s){const t=s[0],n=s[1];t===i&&n()}const a=ft(e,i,t=>{r?(a(),o.delete(e)):n(t)});o.set(e,[i,a])}))}};return e&&(o=new WeakMap,i()),[()=>{r=!0},i]})(t,mt(()=>{r&&e(!0)},{p:33,m:99}),l),h=s||[],b=(i||[]).concat(h),m=r=>{const i=(n?d:u)||yt,s=_||yt,l=[],f=[];let b=!1,m=!1,S=!1;v(r,e=>{const{attributeName:r,target:u,type:d,oldValue:_,addedNodes:g}=e,v="attributes"===d,y="childList"===d,x=t===u,O=v&&a(r)?C(u,r):0,$=0!==O&&_!==O,z=w(h,r)>-1&&$;if(n&&!x){const n=!v,a=v&&z,l=a&&c&&T(u,c),d=(l?!i(u,r,_,O):n||a)&&!s(e,!!l,t,o);p(f,g),m=m||d,S=S||y}!n&&x&&$&&!i(u,r,_,O)&&(p(l,r),b=b||z)}),S&&!y(f)&&g(t=>f.reduce((n,e)=>(p(n,L(t,e)),T(e,t)?p(n,e):n),[])),n?m&&e(!1):y(l)&&!b||e(l,b)},S=new U(m);return S.observe(t,{attributes:!0,attributeOldValue:!0,attributeFilter:b,subtree:n,childList:n,characterData:n}),r=!0,[()=>{r&&(f(),S.disconnect(),r=!1)},()=>{r&&m(S.takeRecords())}]},Gn="os-",Wn=["tabindex"],Yn=["wrap","cols","rows"],Fn=["id","class","style","open"],Xn=(t,n,e,o)=>{if("class"===n&&e&&o){return!!((t,n)=>{const e=t&&t.split(" "),o=n&&n.split(" "),r={};return v(e,t=>{r[t]=1}),v(o,t=>{r[t]?delete r[t]:r[t]=1}),x(r)})(e,o).find(t=>0!==t.indexOf(Gn))}return!1},Un=(n,e)=>{let o,r,i;const{C:l,A:c,M:d,Z:_}=n,{j:f,V:g}=vn(),h=_?Yn:Fn.concat(Yn),b=mt(e,{p:()=>o,m:()=>r,S(t,n){const{ot:e,ht:o,rt:r}=t[0],{ot:i,ht:s,rt:a}=n[0];return[{ot:e||i,ht:o||s,rt:r||a}]}}),y=t=>{v(t||Wn,t=>{if(w(Wn,t)>-1){const n=C(l,t);a(n)?C(c,t,n):z(c,t)}})},S=t=>{(t?e:b)({rt:!0})},x=(d||!g)&&((n,e)=>{const o=k(Qt),r=[],[i]=t({o:!1}),s=t=>{if(t){const o=i(0===(n=t).h||n.isIntersecting||n.intersectionRatio>0),[,r]=o;r&&e(o)}var n};if(J){const t=new J(t=>{t&&t.length>0&&s(t.pop())},{root:n});t.observe(o),p(r,()=>{t.disconnect()})}else{const t=()=>{const t=st(o);s(t)};p(r,Nn(o,t)),t()}return V(n,o),()=>{m(r),B(o)}})(l,t=>{e({et:t})}),O=Nn(l,({ot:t,yt:n,bt:o})=>{(!t||o?e:b)({ot:t,it:n})},{bt:!0,pt:!f}),[$]=qn(l,!1,(t,n)=>{n?b({ht:!0}):y(t)},{xt:Fn,St:Fn.concat(Wn),Ct:Xn});return y(),[t=>{const[n,e]=t("updating.elementEvents"),[a,l]=t("updating.attributes"),[_,f]=t("updating.debounce");if((e||l)&&(i&&(i[1](),i[0]()),i=qn(d||c,!0,S,{xt:h.concat(a||[]),St:h.concat(a||[]),Ot:n,zt:Xn})),f)if(b.O(),u(_)){const t=_[0],n=_[1];o=!!s(t)&&t,r=!!s(n)&&n}else s(_)?(o=_,r=!1):(o=!1,r=!1)},()=>{i&&i[0](),x&&x(),O(),$()}]},Jn={I:{t:0,r:0,b:0,l:0},st:!1,vt:[{x:!1,y:!1},!1],wt:[{w:0,h:0},!1],lt:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0}},Kn=(t,n)=>{const e=Tt(n,{}),o=Rt(Jn),r=new Set,[i]=o,a=(t,n,e)=>{m(r,[t,n||{},!!e])},[l,c]=Sn(t),u=((t,n)=>{const{A:e}=t,{j:o,R:r,V:i}=vn(),a=!o&&(r.x||r.y),l=[xn(t),On(t,n),jn(t,n)];return(t,n,o)=>{const r=Hn(O({ot:!1,ht:!1,rt:!1,ct:!1,it:Pn,et:Pn},n),{},o),c=a||!i,u=c&&A(e),d=c&&I(e);let _=r;return v(l,n=>{_=Hn(_,n(_,t,!!o)||{},o)}),s(u)&&A(e,u),s(d)&&I(e,d),_}})(l,o),[d,_]=Un(l,t=>{a(u(e,t))}),f=vn().B(u.bind(0,e,{},!0)),g=i.bind(0);return g.It=t=>{r.add(t)},g.Mt=l,[(t,e)=>{const o=Tt(n,t,e);d(o),a(u(o,{},e))},g,()=>{r.clear(),f(),_(),c()}]},Qn=t=>{const n=k(`${Zt} ${t}`),e=k(en),o=k(on);return H(n,e),H(e,o),{Lt:n,Tt:e,Rt:o}},Zn=(t,n,e)=>{const o=Rt({}),[r]=o,[i,s]=((t,n)=>{const{k:e}=vn(),{L:o}=e(),{Y:r,C:i,A:s,nt:a}=n,l=!a&&t.scrollbarsSlot,u=(c(l)?l(r,i,s):l)||(c(o)?o(r,i,s):o)||i,d=Qn(tn),_=Qn(nn),{Lt:f}=d,{Lt:g}=_;return H(u,f),H(u,g),[{jt:d,Pt:_},B.bind(0,[f,g])]})(t,e),a=r.bind(0);return a.Mt=i,[(t,e)=>{const o=Tt(n,t,e);console.log(o)},a,()=>{s()}]},te={},ne=["__TPL_","_TYPE__"],ee=["boolean","number","string","array","object","function","null"].reduce((t,n)=>(t[n]=ne[0]+n+ne[1],t),{});ee.number,ee.boolean,ee.array,ee.null,ee.string,ee.array,ee.null;ee.number,ee.array,ee.null,ee.function,ee.null;const oe="__osOptionsValidationPlugin",re=new Set,ie=new WeakMap,se=t=>(t=>{const n=new Map,e=(t,e)=>{if(t){const o=n.get(t);Mt(t=>{o&&o[t?"delete":"clear"](t)},e)}else n.forEach(t=>{t.clear()}),n.clear()},o=(t,o)=>{const r=n.get(t)||new Set;return n.set(t,r),Mt(t=>{t&&r.add(t)},o),e.bind(0,t,o)};return v(x(t),n=>{o(n,t[n])}),[o,e,(t,e)=>{const o=n.get(t);v(b(o),t=>{e?t(e):t()})}]})(t),ae=(t,n)=>({amount:{x:t.w,y:t.h},overflow:{x:t.w>0,y:t.h>0},scrollableOverflow:O({},n)}),le=(t,n,e)=>{const{N:o,R:r}=vn(),i=O({},te),s=g(t)?t:t.target,a=(t=>ie.get(t))(s);if(a)return a;const l=i[oe],u=t=>{const n=t||{},e=l&&l.Ht;return e?e(n,!0):n},d=O({},o(),u(n)),[_,f,h]=se(e);r.x&&r.y&&!d.nativeScrollbarsOverlaid.initialize&&h("initializationWithdrawn");const[w,p,b]=Kn(t,d),[y,,m]=Zn(t,d,p.Mt),S=(t,n)=>{w(t,n),y(t,n)};p.It((t,n,e)=>{const{wt:o,vt:r}=p(),[i,s,a]=o,[l,c,u]=r;(s||c)&&h("overflowChanged",O({},ae(i,l),{previous:ae(a,u)})),h("updated",{updateHints:{sizeChanged:t.ot,contentMutation:t.rt,hostMutation:t.ht,directionChanged:t.it[1],heightIntrinsicChanged:t.et[1]},changedOptions:n,force:e})});const $={options(t){if(t){const n=an(d,u(t));(function(t){for(const n in t)return!1;return!0})(n)||(O(d,n),S(n))}return d},on:_,off:f,state:()=>({Vt:p().wt[0]}),update(t){S({},t)},destroy:()=>{(t=>{ie.delete(t),re.delete(t)})(s),f(),m(),b(),h("destroyed")}};return v(x(i),t=>{const n=i[t];c(n)&&n(le,$)}),$.update(!0),((t,n)=>{ie.set(t,n),re.add(t)})(s,$),h("initialized"),$};le.extend=t=>v(u(t)?t:[t],t=>{te[t[0]]=t[1]});export{le as default}; |