import{j as Y,u as $,e as q,n as B,k as J,l as K,d as N,g as Q,r as O,c as F,a as H,w as U}from"./@vue-CYXGItLc.js";function Z(e){return J()?(K(e),!0):!1}function ae(e){let o=!1,t;const n=Y(!0);return(...r)=>(o||(t=n.run(()=>e(...r)),o=!0),t)}function y(e){return typeof e=="function"?e():$(e)}const ee=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const te=Object.prototype.toString,ne=e=>te.call(e)==="[object Object]",D=()=>{};function I(e,o){function t(...n){return new Promise((r,i)=>{Promise.resolve(e(()=>o.apply(this,n),{fn:o,thisArg:this,args:n})).then(r).catch(i)})}return t}function oe(e,o={}){let t,n,r=D;const i=a=>{clearTimeout(a),r(),r=D};return a=>{const h=y(e),s=y(o.maxWait);return t&&i(t),h<=0||s!==void 0&&s<=0?(n&&(i(n),n=null),Promise.resolve(a())):new Promise((u,c)=>{r=o.rejectOnCancel?c:u,s&&!n&&(n=setTimeout(()=>{t&&i(t),n=null,u(a())},s)),t=setTimeout(()=>{n&&i(n),n=null,u(a())},h)})}}function le(...e){let o=0,t,n=!0,r=D,i,d,a,h,s;!N(e[0])&&typeof e[0]=="object"?{delay:d,trailing:a=!0,leading:h=!0,rejectOnCancel:s=!1}=e[0]:[d,a=!0,h=!0,s=!1]=e;const u=()=>{t&&(clearTimeout(t),t=void 0,r(),r=D)};return m=>{const f=y(d),S=Date.now()-o,x=()=>i=m();return u(),f<=0?(o=Date.now(),x()):(S>f&&(h||!n)?(o=Date.now(),x()):a&&(i=new Promise((w,v)=>{r=s?v:w,t=setTimeout(()=>{o=Date.now(),n=!0,w(x()),u()},Math.max(0,f-S))})),!h&&!t&&(t=setTimeout(()=>n=!0,f)),n=!1,i)}}function re(e){return Q()}function se(e,o=200,t={}){return I(oe(o,t),e)}function ie(e,o=200,t=!1,n=!0,r=!1){return I(le(o,t,n,r),e)}function ue(e,o=!0,t){re()?q(e,t):o?e():B(e)}const V=ee?window:void 0;function X(e){var o;const t=y(e);return(o=t==null?void 0:t.$el)!=null?o:t}function k(...e){let o,t,n,r;if(typeof e[0]=="string"||Array.isArray(e[0])?([t,n,r]=e,o=V):[o,t,n,r]=e,!o)return D;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const i=[],d=()=>{i.forEach(u=>u()),i.length=0},a=(u,c,m,f)=>(u.addEventListener(c,m,f),()=>u.removeEventListener(c,m,f)),h=U(()=>[X(o),y(r)],([u,c])=>{if(d(),!u)return;const m=ne(c)?{...c}:c;i.push(...t.flatMap(f=>n.map(S=>a(u,f,S,m))))},{immediate:!0,flush:"post"}),s=()=>{h(),d()};return Z(s),s}const G=1;function fe(e,o={}){const{throttle:t=0,idle:n=200,onStop:r=D,onScroll:i=D,offset:d={left:0,right:0,top:0,bottom:0},eventListenerOptions:a={capture:!1,passive:!0},behavior:h="auto",window:s=V,onError:u=l=>{console.error(l)}}=o,c=O(0),m=O(0),f=F({get(){return c.value},set(l){x(l,void 0)}}),S=F({get(){return m.value},set(l){x(void 0,l)}});function x(l,E){var p,L,j,T;if(!s)return;const b=y(e);if(!b)return;(j=b instanceof Document?s.document.body:b)==null||j.scrollTo({top:(p=y(E))!=null?p:S.value,left:(L=y(l))!=null?L:f.value,behavior:y(h)});const A=((T=b==null?void 0:b.document)==null?void 0:T.documentElement)||(b==null?void 0:b.documentElement)||b;f!=null&&(c.value=A.scrollLeft),S!=null&&(m.value=A.scrollTop)}const w=O(!1),v=H({left:!0,right:!1,top:!0,bottom:!1}),g=H({left:!1,right:!1,top:!1,bottom:!1}),M=l=>{w.value&&(w.value=!1,g.left=!1,g.right=!1,g.top=!1,g.bottom=!1,r(l))},z=se(M,t+n),C=l=>{var E;if(!s)return;const p=((E=l==null?void 0:l.document)==null?void 0:E.documentElement)||(l==null?void 0:l.documentElement)||X(l),{display:L,flexDirection:j}=getComputedStyle(p),T=p.scrollLeft;g.left=T<c.value,g.right=T>c.value;const b=Math.abs(T)<=(d.left||0),A=Math.abs(T)+p.clientWidth>=p.scrollWidth-(d.right||0)-G;L==="flex"&&j==="row-reverse"?(v.left=A,v.right=b):(v.left=b,v.right=A),c.value=T;let _=p.scrollTop;l===s.document&&!_&&(_=s.document.body.scrollTop),g.top=_<m.value,g.bottom=_>m.value;const P=Math.abs(_)<=(d.top||0),R=Math.abs(_)+p.clientHeight>=p.scrollHeight-(d.bottom||0)-G;L==="flex"&&j==="column-reverse"?(v.top=R,v.bottom=P):(v.top=P,v.bottom=R),m.value=_},W=l=>{var E;if(!s)return;const p=(E=l.target.documentElement)!=null?E:l.target;C(p),w.value=!0,z(l),i(l)};return k(e,"scroll",t?ie(W,t,!0,!1):W,a),ue(()=>{try{const l=y(e);if(!l)return;C(l)}catch(l){u(l)}}),k(e,"scrollend",M,a),{x:f,y:S,isScrolling:w,arrivedState:v,directions:g,measure(){const l=y(e);s&&l&&C(l)}}}export{ae as c,fe as u};
