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-DuIk5FiX.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 v=y(e),s=y(o.maxWait);return t&&i(t),v<=0||s!==void 0&&s<=0?(n&&(i(n),n=null),Promise.resolve(a())):new Promise((c,u)=>{r=o.rejectOnCancel?u:c,s&&!n&&(n=setTimeout(()=>{t&&i(t),n=null,c(a())},s)),t=setTimeout(()=>{n&&i(n),n=null,c(a())},v)})}}function le(...e){let o=0,t,n=!0,r=D,i,d,a,v,s;!N(e[0])&&typeof e[0]=="object"?{delay:d,trailing:a=!0,leading:v=!0,rejectOnCancel:s=!1}=e[0]:[d,a=!0,v=!0,s=!1]=e;const c=()=>{t&&(clearTimeout(t),t=void 0,r(),r=D)};return m=>{const f=y(d),S=Date.now()-o,x=()=>i=m();return c(),f<=0?(o=Date.now(),x()):(S>f&&(v||!n)?(o=Date.now(),x()):a&&(i=new Promise((w,h)=>{r=s?h:w,t=setTimeout(()=>{o=Date.now(),n=!0,w(x()),c()},Math.max(0,f-S))})),!v&&!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 ce(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(c=>c()),i.length=0},a=(c,u,m,f)=>(c.addEventListener(u,m,f),()=>c.removeEventListener(u,m,f)),v=U(()=>[X(o),y(r)],([c,u])=>{if(d(),!c)return;const m=ne(u)?{...u}:u;i.push(...t.flatMap(f=>n.map(S=>a(c,f,S,m))))},{immediate:!0,flush:"post"}),s=()=>{v(),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:v="auto",window:s=V,onError:c=l=>{console.error(l)}}=o,u=O(0),m=O(0),f=F({get(){return u.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(v)});const A=((T=b==null?void 0:b.document)==null?void 0:T.documentElement)||(b==null?void 0:b.documentElement)||b;f!=null&&(u.value=A.scrollLeft),S!=null&&(m.value=A.scrollTop)}const w=O(!1),h=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<u.value,g.right=T>u.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"?(h.left=A,h.right=b):(h.left=b,h.right=A),u.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"?(h.top=R,h.bottom=P):(h.top=P,h.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),ce(()=>{try{const l=y(e);if(!l)return;C(l)}catch(l){c(l)}}),k(e,"scrollend",M,a),{x:f,y:S,isScrolling:w,arrivedState:h,directions:g,measure(){const l=y(e);s&&l&&C(l)}}}export{ae as c,fe as u};
