"use strict";/*! * v-offline v3.5.0 * (c) 2024 Vinayak Kulkarni * @license MIT */Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("ping.js"),n=require("vue"),f=n.defineComponent({name:"VOffline",props:{onlineClass:{type:String,required:!1,default:""},offlineClass:{type:String,required:!1,default:""},pingUrl:{type:String,required:!1,default:"https://google.com"}},emits:["detected-condition"],setup(e,{slots:u,emit:l}){const t=n.ref(navigator.onLine||!1),o=n.ref(["online","offline","load"]),c=n.ref(e.pingUrl||"https://google.com"),d=n.computed(()=>t.value?typeof e.onlineClass=="string"?e.onlineClass:"":typeof e.offlineClass=="string"?e.offlineClass:"");o.value.forEach(i=>window.addEventListener(i,a)),n.onBeforeUnmount(()=>{o.value.forEach(i=>window.removeEventListener(i,a))});async function a(){const i=new g;try{(await i.ping(c.value)||navigator.onLine)&&(t.value=!0,l("detected-condition",t.value))}catch(s){(s||!navigator.onLine)&&(t.value=!1,l("detected-condition",t.value))}}return()=>n.h("div",{class:d.value},u)}});let r=!1;const v=e=>{r||(e.component("VOffline",f),r=!0)},p=v;exports.VOffline=f;exports.default=p; //# sourceMappingURL=v-offline.cjs.map