index.601919da.js 2.3 KB

1
  1. import{i as w,a as L,n as b,t as N}from"./index.ef638512.js";import{$ as T,U as s,aL as x}from"./ResizeObserver.es.7b3c8c20.js";function k(e){var t;const n=x(e);return(t=n==null?void 0:n.$el)!=null?t:n}const O=w?window:void 0;w&&window.document;w&&window.navigator;w&&window.location;function p(...e){let t,n,o,a;if(L(e[0])?([n,o,a]=e,t=O):[t,n,o,a]=e,!t)return b;let l=b;const i=T(()=>k(t),f=>{l(),f&&(f.addEventListener(n,o,a),l=()=>{f.removeEventListener(n,o,a),l=b})},{immediate:!0,flush:"post"}),r=()=>{i(),l()};return N(r),r}const y=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},g="__vueuse_ssr_handlers__";y[g]=y[g]||{};y[g];var h=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,R=(e,t)=>{var n={};for(var o in e)D.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&h)for(var o of h(e))t.indexOf(o)<0&&P.call(e,o)&&(n[o]=e[o]);return n};function I(e,t,n={}){const o=n,{window:a=O}=o,l=R(o,["window"]);let i;const r=a&&"ResizeObserver"in a,f=()=>{i&&(i.disconnect(),i=void 0)},d=T(()=>k(e),c=>{f(),r&&a&&c&&(i=new ResizeObserver(t),i.observe(c,l))},{immediate:!0,flush:"post"}),v=()=>{f(),d()};return N(v),{isSupported:r,stop:v}}function j(e={}){const{window:t=O}=e,n=t==null?void 0:t.navigator,o=Boolean(n&&"connection"in n),a=s(!0),l=s(!1),i=s(void 0),r=s(void 0),f=s(void 0),d=s(void 0),v=s(void 0),c=s(void 0),_=s("unknown"),u=o&&n.connection;function m(){!n||(a.value=n.onLine,i.value=a.value?void 0:Date.now(),r.value=a.value?Date.now():void 0,u&&(f.value=u.downlink,d.value=u.downlinkMax,c.value=u.effectiveType,v.value=u.rtt,l.value=u.saveData,_.value=u.type))}return t&&(p(t,"offline",()=>{a.value=!1,i.value=Date.now()}),p(t,"online",()=>{a.value=!0,r.value=Date.now()})),u&&p(u,"change",m,!1),m(),{isSupported:o,isOnline:a,saveData:l,offlineAt:i,onlineAt:r,downlink:f,downlinkMax:d,effectiveType:c,rtt:v,type:_}}var E;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(E||(E={}));function S({window:e=O}={}){if(!e)return{x:s(0),y:s(0)};const t=s(e.pageXOffset),n=s(e.pageYOffset);return p("scroll",()=>{t.value=e.pageXOffset,n.value=e.pageYOffset},{capture:!1,passive:!0}),{x:t,y:n}}export{p as a,S as b,j as c,I as u};