import{bv as t,b$ as e,bV as n,c0 as i,aL as a,I as s,aw as o,E as r,ab as u,r as c,c1 as l,bJ as f}from"./main-D8Z-8iPZ.js";function v(t){return!!i()&&(a(t),!0)}const m="undefined"!=typeof window&&"undefined"!=typeof document;"undefined"!=typeof WorkerGlobalScope&&(globalThis,WorkerGlobalScope);const p=Object.prototype.toString,b=t=>"[object Object]"===p.call(t),d=()=>{};const y=t=>t();function g(t=y,n={}){const{initialState:i="active"}=n,a=function(...t){if(1!==t.length)return u(...t);const n=t[0];return"function"==typeof n?e(l((()=>({get:n,set:d})))):c(n)}("active"===i);return{isActive:e(a),pause:function(){a.value=!1},resume:function(){a.value=!0},eventFilter:(...e)=>{a.value&&t(...e)}}}function h(t){return Array.isArray(t)?t:[t]}function A(t,e,n={}){const{eventFilter:i=y,...a}=n;return r(t,(s=i,o=e,function(...t){return new Promise(((e,n)=>{Promise.resolve(s((()=>o.apply(this,t)),{fn:o,thisArg:this,args:t})).then(e).catch(n)}))}),a);var s,o}function S(t,e,n={}){const{eventFilter:i,initialState:a="active",...s}=n,{eventFilter:o,pause:r,resume:u,isActive:c}=g(i,{initialState:a});return{stop:A(t,e,{...s,eventFilter:o}),pause:r,resume:u,isActive:c}}function w(t,e=!0,n){f()?s(t,n):e?t():o(t)}function F(i,a,s={}){const{immediate:o=!0,immediateCallback:r=!1}=s,u=t(!1);let c=null;function l(){c&&(clearTimeout(c),c=null)}function f(){u.value=!1,l()}function p(...t){r&&i(),l(),u.value=!0,c=setTimeout((()=>{u.value=!1,c=null,i(...t)}),n(a))}return o&&(u.value=!0,m&&p()),v(f),{isPending:e(u),start:p,stop:f}}function j(t,e,n){return r(t,e,{...n,immediate:!0})}export{h as a,j as b,v as c,b as d,m as i,w as t,F as u,S as w};
