{"version":3,"sources":["jsdelivr-header.js","/npm/check-online-offline@1.0.4/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCLS,UAAW,aAAgB,QAGpC,IAAI,OAGJ,MAAM,UAAa,IAGX,SADA,UAAU,OAQd,MAAO,EAAU,GAAe,SAAS,QA0BzC,OAxBA,WAAU,KAEN,MAAM,EAA+B,KACjC,GAAY,GACZ,GAAS,SAAS,KAAI,GAAK,KAAI,EAI7B,EAA8B,KAChC,GAAY,GACZ,GAAS,QAAQ,KAAI,GAAK,KAAI,EAQlC,OAJA,iBAAiB,UAAW,GAC5B,iBAAiB,SAAU,GAGpB,KACH,oBAAoB,UAAW,GAC/B,oBAAoB,SAAU,EAA4B,CAC7D,GACF,IAEI,CAAQ,iBAGJ","file":"/npm/check-online-offline@1.0.4/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/check-online-offline@1.0.4/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// Importing necessary hooks from the 'react' library\r\nimport { useEffect, useState } from 'react';\r\n\r\n// Variable to store the online status\r\nlet online;\r\n\r\n// Custom hook to track online/offline status and execute corresponding functions\r\nconst useOnline = (funcObj) => {\r\n    // Checking if the navigator indicates the user is online\r\n    if (navigator.onLine) {\r\n        online = true;\r\n    }\r\n    else {\r\n        online = false;\r\n    }\r\n\r\n    // Creating a state variable to manage online status\r\n    const [isOnline, setIsOnline] = useState(online);\r\n\r\n    useEffect(() => {\r\n        // Function to be called when offline event occurs\r\n        const offlineEventListenerFunction = () => {\r\n            setIsOnline(false); // Set online status to false\r\n            funcObj?.offline?.map(e => e()); // Execute offline callback functions if provided\r\n        };\r\n\r\n        // Function to be called when online event occurs\r\n        const onlineEventListenerFunction = () => {\r\n            setIsOnline(true); // Set online status to true\r\n            funcObj?.online?.map(e => e()); // Execute online callback functions if provided\r\n        };\r\n\r\n        // Adding event listeners for online and offline events\r\n        addEventListener('offline', offlineEventListenerFunction);\r\n        addEventListener('online', onlineEventListenerFunction);\r\n\r\n        // Cleanup function to remove event listeners when the component unmounts\r\n        return () => {\r\n            removeEventListener('offline', offlineEventListenerFunction);\r\n            removeEventListener('online', onlineEventListenerFunction);\r\n        };\r\n    }, []); // Empty dependency array ensures this effect runs only once\r\n\r\n    return isOnline; // Returning the current online status\r\n};\r\n\r\nexport default useOnline; // Exporting the custom hook\r\n\r\n\r\n"]}