import{r as d,bu as A,w as O,bv as E,bw as I,bx as g,e as S,aV as j,y as x}from"./index-869d77fb.js";function m(e){return E()?(I(e),!0):!1}function b(e){return typeof e=="function"?e():g(e)}const y=typeof window<"u",C=()=>{};function M(e,t=1e3,r={}){const{immediate:n=!0,immediateCallback:u=!1}=r;let o=null;const s=d(!1);function l(){o&&(clearInterval(o),o=null)}function i(){s.value=!1,l()}function c(){const a=b(t);a<=0||(s.value=!0,u&&e(),l(),o=setInterval(e,a))}if(n&&y&&c(),A(t)||typeof t=="function"){const a=O(t,()=>{s.value&&y&&c()});m(a)}return m(i),{isActive:s,pause:i,resume:c}}var R=Object.defineProperty,w=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,P=(e,t,r)=>t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,z=(e,t)=>{for(var r in t||(t={}))W.call(t,r)&&P(e,r,t[r]);if(w)for(var r of w(t))V.call(t,r)&&P(e,r,t[r]);return e};function k(e=1e3,t={}){const{controls:r=!1,immediate:n=!0,callback:u}=t,o=d(0),s=()=>o.value+=1,l=()=>{o.value=0},i=M(u?()=>{s(),u(o.value)}:s,e,{immediate:n});return r?z({counter:o,reset:l},i):o}function _(e){var t;const r=b(e);return(t=r==null?void 0:r.$el)!=null?t:r}const h=y?window:void 0;function L(...e){let t,r,n,u;if(typeof e[0]=="string"||Array.isArray(e[0])?([r,n,u]=e,t=h):[t,r,n,u]=e,!t)return C;Array.isArray(r)||(r=[r]),Array.isArray(n)||(n=[n]);const o=[],s=()=>{o.forEach(a=>a()),o.length=0},l=(a,p,f,v)=>(a.addEventListener(p,f,v),()=>a.removeEventListener(p,f,v)),i=O(()=>[_(t),b(u)],([a,p])=>{s(),a&&o.push(...r.flatMap(f=>n.map(v=>l(a,f,v,p))))},{immediate:!0,flush:"post"}),c=()=>{i(),s()};return m(c),c}function D(){const e=d(!1);return j()&&x(()=>{e.value=!0}),e}function X(e){const t=D();return S(()=>(t.value,!!e()))}var $=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable,F=(e,t)=>{var r={};for(var n in e)Y.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&$)for(var n of $(e))t.indexOf(n)<0&&B.call(e,n)&&(r[n]=e[n]);return r};function q(e,t,r={}){const n=r,{window:u=h}=n,o=F(n,["window"]);let s;const l=X(()=>u&&"ResizeObserver"in u),i=()=>{s&&(s.disconnect(),s=void 0)},c=S(()=>Array.isArray(e)?e.map(f=>_(f)):[_(e)]),a=O(c,f=>{if(i(),l.value&&u){s=new ResizeObserver(t);for(const v of f)v&&s.observe(v,o)}},{immediate:!0,flush:"post",deep:!0}),p=()=>{i(),a()};return m(p),{isSupported:l,stop:p}}function G({window:e=h}={}){if(!e)return{x:d(0),y:d(0)};const t=d(e.scrollX),r=d(e.scrollY);return L(e,"scroll",()=>{t.value=e.scrollX,r.value=e.scrollY},{capture:!1,passive:!0}),{x:t,y:r}}export{G as a,k as b,M as c,q as d,L as u};