import{t as A,w as j,a as M,i as F,n as H,b as x,c as _}from"./@vueuse_shared@10.6.1_vue@3.3.8-fG4vX-4M.js";function V(e){var n;const t=A(e);return(n=t==null?void 0:t.$el)!=null?n:t}const S=F?window:void 0;function D(...e){let n,t,s,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([t,s,i]=e,n=S):[n,t,s,i]=e,!n)return H;Array.isArray(t)||(t=[t]),Array.isArray(s)||(s=[s]);const a=[],u=()=>{a.forEach(d=>d()),a.length=0},l=(d,o,p,w)=>(d.addEventListener(o,p,w),()=>d.removeEventListener(o,p,w)),c=VueDemi.watch(()=>[V(n),A(i)],([d,o])=>{if(u(),!d)return;const p=x(o)?{...o}:o;a.push(...t.flatMap(w=>s.map(g=>l(d,w,g,p))))},{immediate:!0,flush:"post"}),f=()=>{c(),u()};return _(f),f}function B(){const e=VueDemi.ref(!1);return VueDemi.getCurrentInstance()&&VueDemi.onMounted(()=>{e.value=!0}),e}function L(e){const n=B();return VueDemi.computed(()=>(n.value,!!e()))}function P(e,n={}){const{window:t=S}=n,s=L(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let i;const a=VueDemi.ref(!1),u=f=>{a.value=f.matches},l=()=>{i&&("removeEventListener"in i?i.removeEventListener("change",u):i.removeListener(u))},c=VueDemi.watchEffect(()=>{s.value&&(l(),i=t.matchMedia(A(e)),"addEventListener"in i?i.addEventListener("change",u):i.addListener(u),a.value=i.matches)});return _(()=>{c(),l(),i=void 0}),a}const O=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},N="__vueuse_ssr_handlers__",Q=Y();function Y(){return N in O||(O[N]=O[N]||{}),O[N]}function K(e,n){return Q[e]||n}function $(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const q={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},W="vueuse-storage";function X(e,n,t,s={}){var i;const{flush:a="pre",deep:u=!0,listenToStorageChanges:l=!0,writeDefaults:c=!0,mergeDefaults:f=!1,shallow:d,window:o=S,eventFilter:p,onError:w=r=>{console.error(r)},initOnMounted:g}=s,h=(d?VueDemi.shallowRef:VueDemi.ref)(typeof n=="function"?n():n);if(!t)try{t=K("getDefaultStorage",()=>{var r;return(r=S)==null?void 0:r.localStorage})()}catch(r){w(r)}if(!t)return h;const m=A(n),z=$(m),b=(i=s.serializer)!=null?i:q[z],{pause:T,resume:I}=j(h,()=>C(h.value),{flush:a,deep:u,eventFilter:p});return o&&l&&M(()=>{D(o,"storage",E),D(o,W,J),g&&E()}),g||E(),h;function C(r){try{if(r==null)t.removeItem(e);else{const v=b.write(r),y=t.getItem(e);y!==v&&(t.setItem(e,v),o&&o.dispatchEvent(new CustomEvent(W,{detail:{key:e,oldValue:y,newValue:v,storageArea:t}})))}}catch(v){w(v)}}function R(r){const v=r?r.newValue:t.getItem(e);if(v==null)return c&&m!==null&&t.setItem(e,b.write(m)),m;if(!r&&f){const y=b.read(v);return typeof f=="function"?f(y,m):z==="object"&&!Array.isArray(y)?{...m,...y}:y}else return typeof v!="string"?v:b.read(v)}function J(r){E(r.detail)}function E(r){if(!(r&&r.storageArea!==t)){if(r&&r.key==null){h.value=m;return}if(!(r&&r.key!==e)){T();try{(r==null?void 0:r.newValue)!==b.write(h.value)&&(h.value=R(r))}catch(v){w(v)}finally{r?VueDemi.nextTick(I):I()}}}}}function G(e,n,t={}){const{window:s=S,...i}=t;let a;const u=L(()=>s&&"ResizeObserver"in s),l=()=>{a&&(a.disconnect(),a=void 0)},c=VueDemi.computed(()=>Array.isArray(e)?e.map(o=>V(o)):[V(e)]),f=VueDemi.watch(c,o=>{if(l(),u.value&&s){a=new ResizeObserver(n);for(const p of o)p&&a.observe(p,i)}},{immediate:!0,flush:"post",deep:!0}),d=()=>{l(),f()};return _(d),{isSupported:u,stop:d}}function Z(e,n={}){const{reset:t=!0,windowResize:s=!0,windowScroll:i=!0,immediate:a=!0}=n,u=VueDemi.ref(0),l=VueDemi.ref(0),c=VueDemi.ref(0),f=VueDemi.ref(0),d=VueDemi.ref(0),o=VueDemi.ref(0),p=VueDemi.ref(0),w=VueDemi.ref(0);function g(){const h=V(e);if(!h){t&&(u.value=0,l.value=0,c.value=0,f.value=0,d.value=0,o.value=0,p.value=0,w.value=0);return}const m=h.getBoundingClientRect();u.value=m.height,l.value=m.bottom,c.value=m.left,f.value=m.right,d.value=m.top,o.value=m.width,p.value=m.x,w.value=m.y}return G(e,g),VueDemi.watch(()=>V(e),h=>!h&&g()),i&&D("scroll",g,{capture:!0,passive:!0}),s&&D("resize",g,{passive:!0}),M(()=>{a&&g()}),{height:u,bottom:l,left:c,right:f,top:d,width:o,x:p,y:w,update:g}}function k(e={}){const{window:n=S,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:s=Number.POSITIVE_INFINITY,listenOrientation:i=!0,includeScrollbar:a=!0}=e,u=VueDemi.ref(t),l=VueDemi.ref(s),c=()=>{n&&(a?(u.value=n.innerWidth,l.value=n.innerHeight):(u.value=n.document.documentElement.clientWidth,l.value=n.document.documentElement.clientHeight))};if(c(),M(c),D("resize",c,{passive:!0}),i){const f=P("(orientation: portrait)");VueDemi.watch(f,()=>c())}return{width:u,height:l}}export{G as a,Z as b,X as c,k as u};