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KACT,IACI,IAAK,OACD,OAEkD,MAAlD,eAAe,QAAQ,wBACvB,2BAER,CACA,MAAO,GACH,OAAO,MAAM,EACjB,GAIE,KAAO,CACT,KA9GgB,UA+GhB,UACA,gBACA,SAEJ,IACQ,SACK,OAAO,mBACR,OAAO,iBAAmB,IAE9B,OAAO,iBAAiB,KAAK,MAErC,CACA,MAEA,CAEA,OAAO,QAAU","file":"/npm/@blotoutio/providers-klaviyo-sdk@1.57.0/index.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.48.0.\n * Original file: /npm/@blotoutio/providers-klaviyo-sdk@1.57.0/index.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nconst packageName = 'klaviyo';\n\nconst decodeCookie = (value) => {\n    if (!value)\n        return null;\n    try {\n        return JSON.parse(atob(value));\n    }\n    catch {\n        return null;\n    }\n};\nconst capture = (rule, value) => {\n    if (rule.key == '__kla_id' && rule.location == 'cookie' && value) {\n        try {\n            const decoded = decodeCookie(value);\n            return (decoded === null || decoded === void 0 ? void 0 : decoded.$exchange_id) || null;\n        }\n        catch (e) {\n            console.error('Error decoding Klaviyo exchange ID', e);\n            return null;\n        }\n    }\n    return value;\n};\n\nconst sdkVersion = \"1.57.0\" ;\nconst tag = () => ({\n    sdkVersion,\n    isIdentified: sessionStorage.getItem('identifiedByKlaviyo') === '1',\n});\n\nconst canLog = () => {\n    try {\n        return localStorage.getItem('edgeTagDebug') === '1';\n    }\n    catch {\n        return false;\n    }\n};\nconst prefix = `[EdgeTag]`;\nconst logger = {\n    log: (...args) => {\n        if (canLog()) {\n            console.log(prefix, ...args);\n        }\n    },\n    error: (...args) => {\n        if (canLog()) {\n            console.error(prefix, ...args);\n        }\n    },\n    info: (...args) => {\n        if (canLog()) {\n            console.info(prefix, ...args);\n        }\n    },\n    trace: (...args) => {\n        if (canLog()) {\n            console.trace(prefix, ...args);\n        }\n    },\n};\n\nconst RETRY_COUNT = 5;\nconst RETRY_INTERVAL = 2000;\nlet klaviyoSdkCheckCount = 0;\nconst registerIdentifiedPolling = () => {\n    const timer = setInterval(() => {\n        var _a;\n        try {\n            if (klaviyoSdkCheckCount > RETRY_COUNT) {\n                clearInterval(timer);\n            }\n            (_a = window === null || window === void 0 ? void 0 : window.klaviyo) === null || _a === void 0 ? void 0 : _a.isIdentified().then((identified) => {\n                if (identified) {\n                    sessionStorage.setItem('identifiedByKlaviyo', '1');\n                    clearInterval(timer);\n                }\n            });\n        }\n        catch (e) {\n            logger.error(e);\n            clearInterval(timer);\n        }\n        finally {\n            klaviyoSdkCheckCount++;\n        }\n    }, RETRY_INTERVAL);\n    return () => {\n        clearInterval(timer);\n    };\n};\n\nconst init = () => {\n    try {\n        if (!window) {\n            return;\n        }\n        if (sessionStorage.getItem('identifiedByKlaviyo') !== '1') {\n            registerIdentifiedPolling();\n        }\n    }\n    catch (error) {\n        logger.error(error);\n    }\n};\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nconst data = {\n    name: packageName,\n    init,\n    capture,\n    tag,\n};\ntry {\n    if (window) {\n        if (!window.edgetagProviders) {\n            window.edgetagProviders = [];\n        }\n        window.edgetagProviders.push(data);\n    }\n}\ncatch {\n    // No window\n}\n\nmodule.exports = data;\n"]}