1 |
- import{i as S,a as F,n as O,t as j,p as H,w as C}from"./index.b9aedd1d.js";import{a2 as W,b6 as z,S as c,b7 as L}from"./index.394decd7.js";function P(e){var r;const t=L(e);return(r=t==null?void 0:t.$el)!=null?r:t}const m=S?window:void 0;S&&window.document;S&&window.navigator;S&&window.location;function x(...e){let r,t,n,o;if(F(e[0])?([t,n,o]=e,r=m):[r,t,n,o]=e,!r)return O;let l=O;const i=W(()=>P(r),s=>{l(),s&&(s.addEventListener(t,n,o),l=()=>{s.removeEventListener(t,n,o),l=O})},{immediate:!0,flush:"post"}),u=()=>{i(),l()};return j(u),u}function Q(e,r,t){const{immediate:n=!0,delay:o=0,onError:l=O,resetOnExecute:i=!0,shallow:u=!0}=t!=null?t:{},s=u?z(r):c(r),b=c(!1),f=c(!1),d=c(void 0);async function g(p=0,...w){i&&(s.value=r),d.value=void 0,b.value=!1,f.value=!0,p>0&&await H(p);const h=typeof e=="function"?e(...w):e;try{const v=await h;s.value=v,b.value=!0}catch(v){d.value=v,l(v)}finally{f.value=!1}return s.value}return n&&g(o),{state:s,isReady:b,isLoading:f,error:d,execute:g}}const _=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},N="__vueuse_ssr_handlers__";_[N]=_[N]||{};const G=_[N];function I(e,r){return G[e]||r}function M(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"||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}const U={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()}};function X(e,r,t,n={}){var o;const{flush:l="pre",deep:i=!0,listenToStorageChanges:u=!0,writeDefaults:s=!0,shallow:b,window:f=m,eventFilter:d,onError:g=a=>{console.error(a)}}=n,p=(b?z:c)(r);if(!t)try{t=I("getDefaultStorage",()=>{var a;return(a=m)==null?void 0:a.localStorage})()}catch(a){g(a)}if(!t)return p;const w=L(r),h=M(w),v=(o=n.serializer)!=null?o:U[h],{pause:J,resume:A}=C(p,()=>$(p.value),{flush:l,deep:i,eventFilter:d});return f&&u&&x(f,"storage",E),E(),p;function $(a){try{a==null?t.removeItem(e):t.setItem(e,v.write(a))}catch(y){g(y)}}function D(a){if(!(a&&a.key!==e)){J();try{const y=a?a.newValue:t.getItem(e);return y==null?(s&&w!==null&&t.setItem(e,v.write(w)),w):typeof y!="string"?y:v.read(y)}catch(y){g(y)}finally{A()}}}function E(a){a&&a.key!==e||(p.value=D(a))}}var R=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,V=(e,r)=>{var t={};for(var n in e)Y.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&R)for(var n of R(e))r.indexOf(n)<0&&K.call(e,n)&&(t[n]=e[n]);return t};function Z(e,r,t={}){const n=t,{window:o=m}=n,l=V(n,["window"]);let i;const u=o&&"ResizeObserver"in o,s=()=>{i&&(i.disconnect(),i=void 0)},b=W(()=>P(e),d=>{s(),u&&o&&d&&(i=new ResizeObserver(r),i.observe(d,l))},{immediate:!0,flush:"post"}),f=()=>{s(),b()};return j(f),{isSupported:u,stop:f}}function k(e,r,t={}){const{window:n=m}=t;return X(e,r,n==null?void 0:n.localStorage,t)}var T;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(T||(T={}));function ee({window:e=m}={}){if(!e)return{x:c(0),y:c(0)};const r=c(e.pageXOffset),t=c(e.pageYOffset);return x("scroll",()=>{r.value=e.pageXOffset,t.value=e.pageYOffset},{capture:!1,passive:!0}),{x:r,y:t}}export{x as a,ee as b,Q as c,k as d,Z as u};
|