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AAN,GAAMA,GACeC,WAAa,iEAD5BD,GAEeE,YAAc,GAAKD,WAAa,UAF/CD,GAGenF,SAAW,GAAKqF,YAAc,QAH7CF,GAIe9E,QAAU,GAAKgF,YAAc,OAJ5CF,GAKe7E,UAAY,GAAK8E,WAAa,qBAgM1D/rB,SAAS2O,iBAAiB,oBAAoB,WAAgC,iCAC1E,MAAMsd,QAAWH,GAAkBI,cAE7BpW,EAAWmW,EAAGtU,cACpB,UAAWsO,KAAKnQ,EAAU,CACtB,MAAMqW,EAAKF,EAAG9O,YAAY8I,GACtBA,EAAE/Z,SAAS,SAIX+Z,EAAE/Z,SAAS,YAAc4f,GAAkBtF,gBAAgB2F,EAAG9qB,SAC9D6M,OAAOke,OAAOC,kBAAmB,GAE3B,oBAANpG,GAA2B6F,GAAkBtF,gBAAgB2F,EAAG9qB,SAChE6M,OAAOke,OAAOE,gBAAiB,GAEvC,CACAC,QAAQC,QAAQ,UACpB,M","sources":["webpack:///../../../../../node_modules/dom-mutator/dist/dom-mutator.esm.js","webpack:///../../../../../node_modules/@growthbook/growthbook/dist/esm/util.mjs","webpack:///../../../../../node_modules/@growthbook/growthbook/dist/esm/mongrule.mjs","webpack:///../../../../../node_modules/@growthbook/growthbook/dist/esm/feature-repository.mjs","webpack:///../../../../../node_modules/@growthbook/growthbook/dist/esm/GrowthBook.mjs","webpack:///../growthbook.ts"],"sourcesContent":["var validAttributeName = /^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/;\nvar nullController = {\n revert: function revert() {}\n};\nvar elements = /*#__PURE__*/new Map();\nvar mutations = /*#__PURE__*/new Set();\n\nfunction getObserverInit(attr) {\n return attr === 'html' ? {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true\n } : {\n childList: false,\n subtree: false,\n attributes: true,\n attributeFilter: [attr]\n };\n}\n\nfunction getElementRecord(element) {\n var record = elements.get(element);\n\n if (!record) {\n record = {\n element: element,\n attributes: {}\n };\n elements.set(element, record);\n }\n\n return record;\n}\n\nfunction createElementPropertyRecord(el, attr, getCurrentValue, setValue, mutationRunner) {\n var currentValue = getCurrentValue(el);\n var record = {\n isDirty: false,\n originalValue: currentValue,\n virtualValue: currentValue,\n mutations: [],\n el: el,\n _positionTimeout: null,\n observer: new MutationObserver(function () {\n // enact a 1 second timeout that blocks subsequent firing of the\n // observer until the timeout is complete. This will prevent multiple\n // mutations from firing in quick succession, which can cause the\n // mutation to be reverted before the DOM has a chance to update.\n if (attr === 'position' && record._positionTimeout) return;else if (attr === 'position') record._positionTimeout = setTimeout(function () {\n record._positionTimeout = null;\n }, 1000);\n var currentValue = getCurrentValue(el);\n if (attr === 'position' && currentValue.parentNode === record.virtualValue.parentNode && currentValue.insertBeforeNode === record.virtualValue.insertBeforeNode) return;\n if (currentValue === record.virtualValue) return;\n record.originalValue = currentValue;\n mutationRunner(record);\n }),\n mutationRunner: mutationRunner,\n setValue: setValue,\n getCurrentValue: getCurrentValue\n };\n\n if (attr === 'position' && el.parentNode) {\n record.observer.observe(el.parentNode, {\n childList: true,\n subtree: true,\n attributes: false,\n characterData: false\n });\n } else {\n record.observer.observe(el, getObserverInit(attr));\n }\n\n return record;\n}\n\nfunction queueIfNeeded(val, record) {\n var currentVal = record.getCurrentValue(record.el);\n record.virtualValue = val;\n\n if (val && typeof val !== 'string') {\n if (!currentVal || val.parentNode !== currentVal.parentNode || val.insertBeforeNode !== currentVal.insertBeforeNode) {\n record.isDirty = true;\n runDOMUpdates();\n }\n } else if (val !== currentVal) {\n record.isDirty = true;\n runDOMUpdates();\n }\n}\n\nfunction htmlMutationRunner(record) {\n var val = record.originalValue;\n record.mutations.forEach(function (m) {\n return val = m.mutate(val);\n });\n queueIfNeeded(getTransformedHTML(val), record);\n}\n\nfunction classMutationRunner(record) {\n var val = new Set(record.originalValue.split(/\\s+/).filter(Boolean));\n record.mutations.forEach(function (m) {\n return m.mutate(val);\n });\n queueIfNeeded(Array.from(val).filter(Boolean).join(' '), record);\n}\n\nfunction attrMutationRunner(record) {\n var val = record.originalValue;\n record.mutations.forEach(function (m) {\n return val = m.mutate(val);\n });\n queueIfNeeded(val, record);\n}\n\nfunction _loadDOMNodes(_ref) {\n var parentSelector = _ref.parentSelector,\n insertBeforeSelector = _ref.insertBeforeSelector;\n var parentNode = document.querySelector(parentSelector);\n if (!parentNode) return null;\n var insertBeforeNode = insertBeforeSelector ? document.querySelector(insertBeforeSelector) : null;\n if (insertBeforeSelector && !insertBeforeNode) return null;\n return {\n parentNode: parentNode,\n insertBeforeNode: insertBeforeNode\n };\n}\n\nfunction positionMutationRunner(record) {\n var val = record.originalValue;\n record.mutations.forEach(function (m) {\n var selectors = m.mutate();\n\n var newNodes = _loadDOMNodes(selectors);\n\n val = newNodes || val;\n });\n queueIfNeeded(val, record);\n}\n\nvar getHTMLValue = function getHTMLValue(el) {\n return el.innerHTML;\n};\n\nvar setHTMLValue = function setHTMLValue(el, value) {\n return el.innerHTML = value;\n};\n\nfunction getElementHTMLRecord(element) {\n var elementRecord = getElementRecord(element);\n\n if (!elementRecord.html) {\n elementRecord.html = createElementPropertyRecord(element, 'html', getHTMLValue, setHTMLValue, htmlMutationRunner);\n }\n\n return elementRecord.html;\n}\n\nvar getElementPosition = function getElementPosition(el) {\n return {\n parentNode: el.parentElement,\n insertBeforeNode: el.nextElementSibling\n };\n};\n\nvar setElementPosition = function setElementPosition(el, value) {\n if (value.insertBeforeNode && !value.parentNode.contains(value.insertBeforeNode)) {\n // skip position mutation - insertBeforeNode not a child of parent. happens\n // when mutation observer for indvidual element fires out of order\n return;\n }\n\n value.parentNode.insertBefore(el, value.insertBeforeNode);\n};\n\nfunction getElementPositionRecord(element) {\n var elementRecord = getElementRecord(element);\n\n if (!elementRecord.position) {\n elementRecord.position = createElementPropertyRecord(element, 'position', getElementPosition, setElementPosition, positionMutationRunner);\n }\n\n return elementRecord.position;\n}\n\nvar setClassValue = function setClassValue(el, val) {\n return val ? el.className = val : el.removeAttribute('class');\n};\n\nvar getClassValue = function getClassValue(el) {\n return el.className;\n};\n\nfunction getElementClassRecord(el) {\n var elementRecord = getElementRecord(el);\n\n if (!elementRecord.classes) {\n elementRecord.classes = createElementPropertyRecord(el, 'class', getClassValue, setClassValue, classMutationRunner);\n }\n\n return elementRecord.classes;\n}\n\nvar getAttrValue = function getAttrValue(attrName) {\n return function (el) {\n var _el$getAttribute;\n\n return (_el$getAttribute = el.getAttribute(attrName)) != null ? _el$getAttribute : null;\n };\n};\n\nvar setAttrValue = function setAttrValue(attrName) {\n return function (el, val) {\n return val !== null ? el.setAttribute(attrName, val) : el.removeAttribute(attrName);\n };\n};\n\nfunction getElementAttributeRecord(el, attr) {\n var elementRecord = getElementRecord(el);\n\n if (!elementRecord.attributes[attr]) {\n elementRecord.attributes[attr] = createElementPropertyRecord(el, attr, getAttrValue(attr), setAttrValue(attr), attrMutationRunner);\n }\n\n return elementRecord.attributes[attr];\n}\n\nfunction deleteElementPropertyRecord(el, attr) {\n var element = elements.get(el);\n if (!element) return;\n\n if (attr === 'html') {\n var _element$html, _element$html$observe;\n\n (_element$html = element.html) == null ? void 0 : (_element$html$observe = _element$html.observer) == null ? void 0 : _element$html$observe.disconnect();\n delete element.html;\n } else if (attr === 'class') {\n var _element$classes, _element$classes$obse;\n\n (_element$classes = element.classes) == null ? void 0 : (_element$classes$obse = _element$classes.observer) == null ? void 0 : _element$classes$obse.disconnect();\n delete element.classes;\n } else if (attr === 'position') {\n var _element$position, _element$position$obs;\n\n (_element$position = element.position) == null ? void 0 : (_element$position$obs = _element$position.observer) == null ? void 0 : _element$position$obs.disconnect();\n delete element.position;\n } else {\n var _element$attributes, _element$attributes$a, _element$attributes$a2;\n\n (_element$attributes = element.attributes) == null ? void 0 : (_element$attributes$a = _element$attributes[attr]) == null ? void 0 : (_element$attributes$a2 = _element$attributes$a.observer) == null ? void 0 : _element$attributes$a2.disconnect();\n delete element.attributes[attr];\n }\n}\n\nvar transformContainer;\n\nfunction getTransformedHTML(html) {\n if (!transformContainer) {\n transformContainer = document.createElement('div');\n }\n\n transformContainer.innerHTML = html;\n return transformContainer.innerHTML;\n}\n\nfunction setPropertyValue(el, attr, m) {\n if (!m.isDirty) return;\n m.isDirty = false;\n var val = m.virtualValue;\n\n if (!m.mutations.length) {\n deleteElementPropertyRecord(el, attr);\n }\n\n m.setValue(el, val);\n}\n\nfunction setValue(m, el) {\n m.html && setPropertyValue(el, 'html', m.html);\n m.classes && setPropertyValue(el, 'class', m.classes);\n m.position && setPropertyValue(el, 'position', m.position);\n Object.keys(m.attributes).forEach(function (attr) {\n setPropertyValue(el, attr, m.attributes[attr]);\n });\n}\n\nfunction runDOMUpdates() {\n elements.forEach(setValue);\n} // find or create ElementPropertyRecord, add mutation to it, then run\n\n\nfunction startMutating(mutation, element) {\n var record = null;\n\n if (mutation.kind === 'html') {\n record = getElementHTMLRecord(element);\n } else if (mutation.kind === 'class') {\n record = getElementClassRecord(element);\n } else if (mutation.kind === 'attribute') {\n record = getElementAttributeRecord(element, mutation.attribute);\n } else if (mutation.kind === 'position') {\n record = getElementPositionRecord(element);\n }\n\n if (!record) return;\n record.mutations.push(mutation);\n record.mutationRunner(record);\n} // get (existing) ElementPropertyRecord, remove mutation from it, then run\n\n\nfunction stopMutating(mutation, el) {\n var record = null;\n\n if (mutation.kind === 'html') {\n record = getElementHTMLRecord(el);\n } else if (mutation.kind === 'class') {\n record = getElementClassRecord(el);\n } else if (mutation.kind === 'attribute') {\n record = getElementAttributeRecord(el, mutation.attribute);\n } else if (mutation.kind === 'position') {\n record = getElementPositionRecord(el);\n }\n\n if (!record) return;\n var index = record.mutations.indexOf(mutation);\n if (index !== -1) record.mutations.splice(index, 1);\n record.mutationRunner(record);\n} // maintain list of elements associated with mutation\n\n\nfunction refreshElementsSet(mutation) {\n // if a position mutation has already found an element to move, don't move\n // any more elements\n if (mutation.kind === 'position' && mutation.elements.size === 1) return;\n var existingElements = new Set(mutation.elements);\n var matchingElements = document.querySelectorAll(mutation.selector);\n matchingElements.forEach(function (el) {\n if (!existingElements.has(el)) {\n mutation.elements.add(el);\n startMutating(mutation, el);\n }\n });\n}\n\nfunction revertMutation(mutation) {\n mutation.elements.forEach(function (el) {\n return stopMutating(mutation, el);\n });\n mutation.elements.clear();\n mutations[\"delete\"](mutation);\n}\n\nfunction refreshAllElementSets() {\n mutations.forEach(refreshElementsSet);\n} // Observer for elements that don't exist in the DOM yet\n\n\nvar observer;\nfunction disconnectGlobalObserver() {\n observer && observer.disconnect();\n}\nfunction connectGlobalObserver() {\n if (typeof document === 'undefined') return;\n\n if (!observer) {\n observer = new MutationObserver(function () {\n refreshAllElementSets();\n });\n }\n\n refreshAllElementSets();\n observer.observe(document.documentElement, {\n childList: true,\n subtree: true,\n attributes: false,\n characterData: false\n });\n} // run on init\n\nconnectGlobalObserver();\n\nfunction newMutation(m) {\n // Not in a browser\n if (typeof document === 'undefined') return nullController; // add to global index of mutations\n\n mutations.add(m); // run refresh on init to establish list of elements associated w/ mutation\n\n refreshElementsSet(m);\n return {\n revert: function revert() {\n revertMutation(m);\n }\n };\n}\n\nfunction html(selector, mutate) {\n return newMutation({\n kind: 'html',\n elements: new Set(),\n mutate: mutate,\n selector: selector\n });\n}\n\nfunction position(selector, mutate) {\n return newMutation({\n kind: 'position',\n elements: new Set(),\n mutate: mutate,\n selector: selector\n });\n}\n\nfunction classes(selector, mutate) {\n return newMutation({\n kind: 'class',\n elements: new Set(),\n mutate: mutate,\n selector: selector\n });\n}\n\nfunction attribute(selector, attribute, mutate) {\n if (!validAttributeName.test(attribute)) return nullController;\n\n if (attribute === 'class' || attribute === 'className') {\n return classes(selector, function (classnames) {\n var mutatedClassnames = mutate(Array.from(classnames).join(' '));\n classnames.clear();\n if (!mutatedClassnames) return;\n mutatedClassnames.split(/\\s+/g).filter(Boolean).forEach(function (c) {\n return classnames.add(c);\n });\n });\n }\n\n return newMutation({\n kind: 'attribute',\n attribute: attribute,\n elements: new Set(),\n mutate: mutate,\n selector: selector\n });\n}\n\nfunction declarative(_ref2) {\n var selector = _ref2.selector,\n action = _ref2.action,\n value = _ref2.value,\n attr = _ref2.attribute,\n parentSelector = _ref2.parentSelector,\n insertBeforeSelector = _ref2.insertBeforeSelector;\n\n if (attr === 'html') {\n if (action === 'append') {\n return html(selector, function (val) {\n return val + (value != null ? value : '');\n });\n } else if (action === 'set') {\n return html(selector, function () {\n return value != null ? value : '';\n });\n }\n } else if (attr === 'class') {\n if (action === 'append') {\n return classes(selector, function (val) {\n if (value) val.add(value);\n });\n } else if (action === 'remove') {\n return classes(selector, function (val) {\n if (value) val[\"delete\"](value);\n });\n } else if (action === 'set') {\n return classes(selector, function (val) {\n val.clear();\n if (value) val.add(value);\n });\n }\n } else if (attr === 'position') {\n if (action === 'set' && parentSelector) {\n return position(selector, function () {\n return {\n insertBeforeSelector: insertBeforeSelector,\n parentSelector: parentSelector\n };\n });\n }\n } else {\n if (action === 'append') {\n return attribute(selector, attr, function (val) {\n return val !== null ? val + (value != null ? value : '') : value != null ? value : '';\n });\n } else if (action === 'set') {\n return attribute(selector, attr, function () {\n return value != null ? value : '';\n });\n } else if (action === 'remove') {\n return attribute(selector, attr, function () {\n return null;\n });\n }\n }\n\n return nullController;\n}\n\nvar index = {\n html: html,\n classes: classes,\n attribute: attribute,\n position: position,\n declarative: declarative\n};\n\nexport default index;\nexport { connectGlobalObserver, disconnectGlobalObserver, validAttributeName };\n//# sourceMappingURL=dom-mutator.esm.js.map\n","const polyfills = {\n fetch: globalThis.fetch ? globalThis.fetch.bind(globalThis) : undefined,\n SubtleCrypto: globalThis.crypto ? globalThis.crypto.subtle : undefined,\n EventSource: globalThis.EventSource\n};\nexport function getPolyfills() {\n return polyfills;\n}\nfunction hashFnv32a(str) {\n let hval = 0x811c9dc5;\n const l = str.length;\n for (let i = 0; i < l; i++) {\n hval ^= str.charCodeAt(i);\n hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);\n }\n return hval >>> 0;\n}\nexport function hash(seed, value, version) {\n // New unbiased hashing algorithm\n if (version === 2) {\n return hashFnv32a(hashFnv32a(seed + value) + \"\") % 10000 / 10000;\n }\n // Original biased hashing algorithm (keep for backwards compatibility)\n if (version === 1) {\n return hashFnv32a(value + seed) % 1000 / 1000;\n }\n\n // Unknown hash version\n return null;\n}\nexport function getEqualWeights(n) {\n if (n <= 0) return [];\n return new Array(n).fill(1 / n);\n}\nexport function inRange(n, range) {\n return n >= range[0] && n < range[1];\n}\nexport function inNamespace(hashValue, namespace) {\n const n = hash(\"__\" + namespace[0], hashValue, 1);\n if (n === null) return false;\n return n >= namespace[1] && n < namespace[2];\n}\nexport function chooseVariation(n, ranges) {\n for (let i = 0; i < ranges.length; i++) {\n if (inRange(n, ranges[i])) {\n return i;\n }\n }\n return -1;\n}\nexport function getUrlRegExp(regexString) {\n try {\n const escaped = regexString.replace(/([^\\\\])\\//g, \"$1\\\\/\");\n return new RegExp(escaped);\n } catch (e) {\n console.error(e);\n return undefined;\n }\n}\nexport function isURLTargeted(url, targets) {\n if (!targets.length) return false;\n let hasIncludeRules = false;\n let isIncluded = false;\n for (let i = 0; i < targets.length; i++) {\n const match = _evalURLTarget(url, targets[i].type, targets[i].pattern);\n if (targets[i].include === false) {\n if (match) return false;\n } else {\n hasIncludeRules = true;\n if (match) isIncluded = true;\n }\n }\n return isIncluded || !hasIncludeRules;\n}\nfunction _evalSimpleUrlPart(actual, pattern, isPath) {\n try {\n // Escape special regex characters and change wildcard `_____` to `.*`\n let escaped = pattern.replace(/[*.+?^${}()|[\\]\\\\]/g, \"\\\\$&\").replace(/_____/g, \".*\");\n if (isPath) {\n // When matching pathname, make leading/trailing slashes optional\n escaped = \"\\\\/?\" + escaped.replace(/(^\\/|\\/$)/g, \"\") + \"\\\\/?\";\n }\n const regex = new RegExp(\"^\" + escaped + \"$\", \"i\");\n return regex.test(actual);\n } catch (e) {\n return false;\n }\n}\nfunction _evalSimpleUrlTarget(actual, pattern) {\n try {\n // If a protocol is missing, but a host is specified, add `https://` to the front\n // Use \"_____\" as the wildcard since `*` is not a valid hostname in some browsers\n const expected = new URL(pattern.replace(/^([^:/?]*)\\./i, \"https://$1.\").replace(/\\*/g, \"_____\"), \"https://_____\");\n\n // Compare each part of the URL separately\n const comps = [[actual.host, expected.host, false], [actual.pathname, expected.pathname, true]];\n // We only want to compare hashes if it's explicitly being targeted\n if (expected.hash) {\n comps.push([actual.hash, expected.hash, false]);\n }\n expected.searchParams.forEach((v, k) => {\n comps.push([actual.searchParams.get(k) || \"\", v, false]);\n });\n\n // If any comparisons fail, the whole thing fails\n return !comps.some(data => !_evalSimpleUrlPart(data[0], data[1], data[2]));\n } catch (e) {\n return false;\n }\n}\nfunction _evalURLTarget(url, type, pattern) {\n try {\n const parsed = new URL(url, \"https://_\");\n if (type === \"regex\") {\n const regex = getUrlRegExp(pattern);\n if (!regex) return false;\n return regex.test(parsed.href) || regex.test(parsed.href.substring(parsed.origin.length));\n } else if (type === \"simple\") {\n return _evalSimpleUrlTarget(parsed, pattern);\n }\n return false;\n } catch (e) {\n return false;\n }\n}\nexport function getBucketRanges(numVariations, coverage, weights) {\n coverage = coverage === undefined ? 1 : coverage;\n\n // Make sure coverage is within bounds\n if (coverage < 0) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Experiment.coverage must be greater than or equal to 0\");\n }\n coverage = 0;\n } else if (coverage > 1) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Experiment.coverage must be less than or equal to 1\");\n }\n coverage = 1;\n }\n\n // Default to equal weights if missing or invalid\n const equal = getEqualWeights(numVariations);\n weights = weights || equal;\n if (weights.length !== numVariations) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Experiment.weights array must be the same length as Experiment.variations\");\n }\n weights = equal;\n }\n\n // If weights don't add up to 1 (or close to it), default to equal weights\n const totalWeight = weights.reduce((w, sum) => sum + w, 0);\n if (totalWeight < 0.99 || totalWeight > 1.01) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Experiment.weights must add up to 1\");\n }\n weights = equal;\n }\n\n // Covert weights to ranges\n let cumulative = 0;\n return weights.map(w => {\n const start = cumulative;\n cumulative += w;\n return [start, start + coverage * w];\n });\n}\nexport function getQueryStringOverride(id, url, numVariations) {\n if (!url) {\n return null;\n }\n const search = url.split(\"?\")[1];\n if (!search) {\n return null;\n }\n const match = search.replace(/#.*/, \"\") // Get rid of anchor\n .split(\"&\") // Split into key/value pairs\n .map(kv => kv.split(\"=\", 2)).filter(_ref => {\n let [k] = _ref;\n return k === id;\n }) // Look for key that matches the experiment id\n .map(_ref2 => {\n let [, v] = _ref2;\n return parseInt(v);\n }); // Parse the value into an integer\n\n if (match.length > 0 && match[0] >= 0 && match[0] < numVariations) return match[0];\n return null;\n}\nexport function isIncluded(include) {\n try {\n return include();\n } catch (e) {\n console.error(e);\n return false;\n }\n}\nconst base64ToBuf = b => Uint8Array.from(atob(b), c => c.charCodeAt(0));\nexport async function decrypt(encryptedString, decryptionKey, subtle) {\n decryptionKey = decryptionKey || \"\";\n subtle = subtle || globalThis.crypto && globalThis.crypto.subtle || polyfills.SubtleCrypto;\n if (!subtle) {\n throw new Error(\"No SubtleCrypto implementation found\");\n }\n try {\n const key = await subtle.importKey(\"raw\", base64ToBuf(decryptionKey), {\n name: \"AES-CBC\",\n length: 128\n }, true, [\"encrypt\", \"decrypt\"]);\n const [iv, cipherText] = encryptedString.split(\".\");\n const plainTextBuffer = await subtle.decrypt({\n name: \"AES-CBC\",\n iv: base64ToBuf(iv)\n }, key, base64ToBuf(cipherText));\n return new TextDecoder().decode(plainTextBuffer);\n } catch (e) {\n throw new Error(\"Failed to decrypt\");\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function toString(input) {\n if (typeof input === \"string\") return input;\n return JSON.stringify(input);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function paddedVersionString(input) {\n if (typeof input === \"number\") {\n input = input + \"\";\n }\n if (!input || typeof input !== \"string\") {\n input = \"0\";\n }\n // Remove build info and leading `v` if any\n // Split version into parts (both core version numbers and pre-release tags)\n // \"v1.2.3-rc.1+build123\" -> [\"1\",\"2\",\"3\",\"rc\",\"1\"]\n const parts = input.replace(/(^v|\\+.*$)/g, \"\").split(/[-.]/);\n\n // If it's SemVer without a pre-release, add `~` to the end\n // [\"1\",\"0\",\"0\"] -> [\"1\",\"0\",\"0\",\"~\"]\n // \"~\" is the largest ASCII character, so this will make \"1.0.0\" greater than \"1.0.0-beta\" for example\n if (parts.length === 3) {\n parts.push(\"~\");\n }\n\n // Left pad each numeric part with spaces so string comparisons will work (\"9\">\"10\", but \" 9\"<\"10\")\n // Then, join back together into a single string\n return parts.map(v => v.match(/^[0-9]+$/) ? v.padStart(5, \" \") : v).join(\"-\");\n}\nexport function loadSDKVersion() {\n let version;\n try {\n // @ts-expect-error right-hand value to be replaced by build with string literal\n version = \"1.1.0\";\n } catch (e) {\n version = \"\";\n }\n return version;\n}\nexport function mergeQueryStrings(oldUrl, newUrl) {\n let currUrl;\n let redirectUrl;\n try {\n currUrl = new URL(oldUrl);\n redirectUrl = new URL(newUrl);\n } catch (e) {\n console.error(\"Unable to merge query strings: \".concat(e));\n return newUrl;\n }\n currUrl.searchParams.forEach((value, key) => {\n // skip if search param already exists in redirectUrl\n if (redirectUrl.searchParams.has(key)) {\n return;\n }\n redirectUrl.searchParams.set(key, value);\n });\n return redirectUrl.toString();\n}\nfunction isObj(x) {\n return typeof x === \"object\" && x !== null;\n}\nexport function getAutoExperimentChangeType(exp) {\n if (exp.urlPatterns && exp.variations.some(variation => isObj(variation) && \"urlRedirect\" in variation)) {\n return \"redirect\";\n } else if (exp.variations.some(variation => isObj(variation) && (variation.domMutations || \"js\" in variation || \"css\" in variation))) {\n return \"visual\";\n }\n return \"unknown\";\n}\n//# sourceMappingURL=util.mjs.map","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { paddedVersionString } from \"./util.mjs\";\nconst _regexCache = {};\n\n// The top-level condition evaluation function\nexport function evalCondition(obj, condition,\n// Must be included for `condition` to correctly evaluate group Operators\nsavedGroups) {\n savedGroups = savedGroups || {};\n // Condition is an object, keys are either specific operators or object paths\n // values are either arguments for operators or conditions for paths\n for (const [k, v] of Object.entries(condition)) {\n switch (k) {\n case \"$or\":\n if (!evalOr(obj, v, savedGroups)) return false;\n break;\n case \"$nor\":\n if (evalOr(obj, v, savedGroups)) return false;\n break;\n case \"$and\":\n if (!evalAnd(obj, v, savedGroups)) return false;\n break;\n case \"$not\":\n if (evalCondition(obj, v, savedGroups)) return false;\n break;\n default:\n if (!evalConditionValue(v, getPath(obj, k), savedGroups)) return false;\n }\n }\n return true;\n}\n\n// Return value at dot-separated path of an object\nfunction getPath(obj, path) {\n const parts = path.split(\".\");\n let current = obj;\n for (let i = 0; i < parts.length; i++) {\n if (current && typeof current === \"object\" && parts[i] in current) {\n current = current[parts[i]];\n } else {\n return null;\n }\n }\n return current;\n}\n\n// Transform a regex string into a real RegExp object\nfunction getRegex(regex) {\n if (!_regexCache[regex]) {\n _regexCache[regex] = new RegExp(regex.replace(/([^\\\\])\\//g, \"$1\\\\/\"));\n }\n return _regexCache[regex];\n}\n\n// Evaluate a single value against a condition\nfunction evalConditionValue(condition, value, savedGroups) {\n // Simple equality comparisons\n if (typeof condition === \"string\") {\n return value + \"\" === condition;\n }\n if (typeof condition === \"number\") {\n return value * 1 === condition;\n }\n if (typeof condition === \"boolean\") {\n return !!value === condition;\n }\n if (condition === null) {\n return value === null;\n }\n if (Array.isArray(condition) || !isOperatorObject(condition)) {\n return JSON.stringify(value) === JSON.stringify(condition);\n }\n\n // This is a special operator condition and we should evaluate each one separately\n for (const op in condition) {\n if (!evalOperatorCondition(op, value, condition[op], savedGroups)) {\n return false;\n }\n }\n return true;\n}\n\n// If the object has only keys that start with '$'\nfunction isOperatorObject(obj) {\n const keys = Object.keys(obj);\n return keys.length > 0 && keys.filter(k => k[0] === \"$\").length === keys.length;\n}\n\n// Return the data type of a value\nfunction getType(v) {\n if (v === null) return \"null\";\n if (Array.isArray(v)) return \"array\";\n const t = typeof v;\n if ([\"string\", \"number\", \"boolean\", \"object\", \"undefined\"].includes(t)) {\n return t;\n }\n return \"unknown\";\n}\n\n// At least one element of actual must match the expected condition/value\nfunction elemMatch(actual, expected, savedGroups) {\n if (!Array.isArray(actual)) return false;\n const check = isOperatorObject(expected) ? v => evalConditionValue(expected, v, savedGroups) : v => evalCondition(v, expected, savedGroups);\n for (let i = 0; i < actual.length; i++) {\n if (actual[i] && check(actual[i])) {\n return true;\n }\n }\n return false;\n}\nfunction isIn(actual, expected) {\n // Do an intersection if attribute is an array\n if (Array.isArray(actual)) {\n return actual.some(el => expected.includes(el));\n }\n return expected.includes(actual);\n}\n\n// Evaluate a single operator condition\nfunction evalOperatorCondition(operator, actual, expected, savedGroups) {\n switch (operator) {\n case \"$veq\":\n return paddedVersionString(actual) === paddedVersionString(expected);\n case \"$vne\":\n return paddedVersionString(actual) !== paddedVersionString(expected);\n case \"$vgt\":\n return paddedVersionString(actual) > paddedVersionString(expected);\n case \"$vgte\":\n return paddedVersionString(actual) >= paddedVersionString(expected);\n case \"$vlt\":\n return paddedVersionString(actual) < paddedVersionString(expected);\n case \"$vlte\":\n return paddedVersionString(actual) <= paddedVersionString(expected);\n case \"$eq\":\n return actual === expected;\n case \"$ne\":\n return actual !== expected;\n case \"$lt\":\n return actual < expected;\n case \"$lte\":\n return actual <= expected;\n case \"$gt\":\n return actual > expected;\n case \"$gte\":\n return actual >= expected;\n case \"$exists\":\n // Using `!=` and `==` instead of strict checks so it also matches for undefined\n return expected ? actual != null : actual == null;\n case \"$in\":\n if (!Array.isArray(expected)) return false;\n return isIn(actual, expected);\n case \"$inGroup\":\n return isIn(actual, savedGroups[expected] || []);\n case \"$notInGroup\":\n return !isIn(actual, savedGroups[expected] || []);\n case \"$nin\":\n if (!Array.isArray(expected)) return false;\n return !isIn(actual, expected);\n case \"$not\":\n return !evalConditionValue(expected, actual, savedGroups);\n case \"$size\":\n if (!Array.isArray(actual)) return false;\n return evalConditionValue(expected, actual.length, savedGroups);\n case \"$elemMatch\":\n return elemMatch(actual, expected, savedGroups);\n case \"$all\":\n if (!Array.isArray(actual)) return false;\n for (let i = 0; i < expected.length; i++) {\n let passed = false;\n for (let j = 0; j < actual.length; j++) {\n if (evalConditionValue(expected[i], actual[j], savedGroups)) {\n passed = true;\n break;\n }\n }\n if (!passed) return false;\n }\n return true;\n case \"$regex\":\n try {\n return getRegex(expected).test(actual);\n } catch (e) {\n return false;\n }\n case \"$type\":\n return getType(actual) === expected;\n default:\n console.error(\"Unknown operator: \" + operator);\n return false;\n }\n}\n\n// Recursive $or rule\nfunction evalOr(obj, conditions, savedGroups) {\n if (!conditions.length) return true;\n for (let i = 0; i < conditions.length; i++) {\n if (evalCondition(obj, conditions[i], savedGroups)) {\n return true;\n }\n }\n return false;\n}\n\n// Recursive $and rule\nfunction evalAnd(obj, conditions, savedGroups) {\n for (let i = 0; i < conditions.length; i++) {\n if (!evalCondition(obj, conditions[i], savedGroups)) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=mongrule.mjs.map","import { getPolyfills } from \"./util.mjs\";\n// Config settings\nconst cacheSettings = {\n // Consider a fetch stale after 1 minute\n staleTTL: 1000 * 60,\n // Max time to keep a fetch in cache (24 hours default)\n maxAge: 1000 * 60 * 60 * 24,\n cacheKey: \"gbFeaturesCache\",\n backgroundSync: true,\n maxEntries: 10,\n disableIdleStreams: false,\n idleStreamInterval: 20000,\n disableCache: false\n};\nconst polyfills = getPolyfills();\nexport const helpers = {\n fetchFeaturesCall: _ref => {\n let {\n host,\n clientKey,\n headers\n } = _ref;\n return polyfills.fetch(\"\".concat(host, \"/api/features/\").concat(clientKey), {\n headers\n });\n },\n fetchRemoteEvalCall: _ref2 => {\n let {\n host,\n clientKey,\n payload,\n headers\n } = _ref2;\n const options = {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...headers\n },\n body: JSON.stringify(payload)\n };\n return polyfills.fetch(\"\".concat(host, \"/api/eval/\").concat(clientKey), options);\n },\n eventSourceCall: _ref3 => {\n let {\n host,\n clientKey,\n headers\n } = _ref3;\n if (headers) {\n return new polyfills.EventSource(\"\".concat(host, \"/sub/\").concat(clientKey), {\n headers\n });\n }\n return new polyfills.EventSource(\"\".concat(host, \"/sub/\").concat(clientKey));\n },\n startIdleListener: () => {\n let idleTimeout;\n const isBrowser = typeof window !== \"undefined\" && typeof document !== \"undefined\";\n if (!isBrowser) return;\n const onVisibilityChange = () => {\n if (document.visibilityState === \"visible\") {\n window.clearTimeout(idleTimeout);\n onVisible();\n } else if (document.visibilityState === \"hidden\") {\n idleTimeout = window.setTimeout(onHidden, cacheSettings.idleStreamInterval);\n }\n };\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return () => document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n },\n stopIdleListener: () => {\n // No-op, replaced by startIdleListener\n }\n};\ntry {\n if (globalThis.localStorage) {\n polyfills.localStorage = globalThis.localStorage;\n }\n} catch (e) {\n // Ignore localStorage errors\n}\n\n// Global state\nconst subscribedInstances = new Map();\nlet cacheInitialized = false;\nconst cache = new Map();\nconst activeFetches = new Map();\nconst streams = new Map();\nconst supportsSSE = new Set();\n\n// Public functions\nexport function setPolyfills(overrides) {\n Object.assign(polyfills, overrides);\n}\nexport function configureCache(overrides) {\n Object.assign(cacheSettings, overrides);\n if (!cacheSettings.backgroundSync) {\n clearAutoRefresh();\n }\n}\nexport async function clearCache() {\n cache.clear();\n activeFetches.clear();\n clearAutoRefresh();\n cacheInitialized = false;\n await updatePersistentCache();\n}\n\n// Get or fetch features and refresh the SDK instance\nexport async function refreshFeatures(_ref4) {\n let {\n instance,\n timeout,\n skipCache,\n allowStale,\n backgroundSync\n } = _ref4;\n if (!backgroundSync) {\n cacheSettings.backgroundSync = false;\n }\n return fetchFeaturesWithCache({\n instance,\n allowStale,\n timeout,\n skipCache\n });\n}\n\n// Subscribe a GrowthBook instance to feature changes\nexport function subscribe(instance) {\n const key = getKey(instance);\n const subs = subscribedInstances.get(key) || new Set();\n subs.add(instance);\n subscribedInstances.set(key, subs);\n}\nexport function unsubscribe(instance) {\n subscribedInstances.forEach(s => s.delete(instance));\n}\nexport function onHidden() {\n streams.forEach(channel => {\n if (!channel) return;\n channel.state = \"idle\";\n disableChannel(channel);\n });\n}\nexport function onVisible() {\n streams.forEach(channel => {\n if (!channel) return;\n if (channel.state !== \"idle\") return;\n enableChannel(channel);\n });\n}\n\n// Private functions\n\nasync function updatePersistentCache() {\n try {\n if (!polyfills.localStorage) return;\n await polyfills.localStorage.setItem(cacheSettings.cacheKey, JSON.stringify(Array.from(cache.entries())));\n } catch (e) {\n // Ignore localStorage errors\n }\n}\n\n// SWR wrapper for fetching features. May indirectly or directly start SSE streaming.\nasync function fetchFeaturesWithCache(_ref5) {\n let {\n instance,\n allowStale,\n timeout,\n skipCache\n } = _ref5;\n const key = getKey(instance);\n const cacheKey = getCacheKey(instance);\n const now = new Date();\n const minStaleAt = new Date(now.getTime() - cacheSettings.maxAge + cacheSettings.staleTTL);\n await initializeCache();\n const existing = !cacheSettings.disableCache && !skipCache ? cache.get(cacheKey) : undefined;\n if (existing && (allowStale || existing.staleAt > now) && existing.staleAt > minStaleAt) {\n // Restore from cache whether SSE is supported\n if (existing.sse) supportsSSE.add(key);\n\n // Reload features in the background if stale\n if (existing.staleAt < now) {\n fetchFeatures(instance);\n }\n // Otherwise, if we don't need to refresh now, start a background sync\n else {\n startAutoRefresh(instance);\n }\n return {\n data: existing.data,\n success: true,\n source: \"cache\"\n };\n } else {\n const res = await promiseTimeout(fetchFeatures(instance), timeout);\n return res || {\n data: null,\n success: false,\n source: \"timeout\",\n error: new Error(\"Timeout\")\n };\n }\n}\nfunction getKey(instance) {\n const [apiHost, clientKey] = instance.getApiInfo();\n return \"\".concat(apiHost, \"||\").concat(clientKey);\n}\nfunction getCacheKey(instance) {\n const baseKey = getKey(instance);\n if (!instance.isRemoteEval()) return baseKey;\n const attributes = instance.getAttributes();\n const cacheKeyAttributes = instance.getCacheKeyAttributes() || Object.keys(instance.getAttributes());\n const ca = {};\n cacheKeyAttributes.forEach(key => {\n ca[key] = attributes[key];\n });\n const fv = instance.getForcedVariations();\n const url = instance.getUrl();\n return \"\".concat(baseKey, \"||\").concat(JSON.stringify({\n ca,\n fv,\n url\n }));\n}\n\n// Guarantee the promise always resolves within {timeout} ms\n// Resolved value will be `null` when there's an error or it takes too long\n// Note: The promise will continue running in the background, even if the timeout is hit\nfunction promiseTimeout(promise, timeout) {\n return new Promise(resolve => {\n let resolved = false;\n let timer;\n const finish = data => {\n if (resolved) return;\n resolved = true;\n timer && clearTimeout(timer);\n resolve(data || null);\n };\n if (timeout) {\n timer = setTimeout(() => finish(), timeout);\n }\n promise.then(data => finish(data)).catch(() => finish());\n });\n}\n\n// Populate cache from localStorage (if available)\nasync function initializeCache() {\n if (cacheInitialized) return;\n cacheInitialized = true;\n try {\n if (polyfills.localStorage) {\n const value = await polyfills.localStorage.getItem(cacheSettings.cacheKey);\n if (!cacheSettings.disableCache && value) {\n const parsed = JSON.parse(value);\n if (parsed && Array.isArray(parsed)) {\n parsed.forEach(_ref6 => {\n let [key, data] = _ref6;\n cache.set(key, {\n ...data,\n staleAt: new Date(data.staleAt)\n });\n });\n }\n cleanupCache();\n }\n }\n } catch (e) {\n // Ignore localStorage errors\n }\n if (!cacheSettings.disableIdleStreams) {\n const cleanupFn = helpers.startIdleListener();\n if (cleanupFn) {\n helpers.stopIdleListener = cleanupFn;\n }\n }\n}\n\n// Enforce the maxEntries limit\nfunction cleanupCache() {\n const entriesWithTimestamps = Array.from(cache.entries()).map(_ref7 => {\n let [key, value] = _ref7;\n return {\n key,\n staleAt: value.staleAt.getTime()\n };\n }).sort((a, b) => a.staleAt - b.staleAt);\n const entriesToRemoveCount = Math.min(Math.max(0, cache.size - cacheSettings.maxEntries), cache.size);\n for (let i = 0; i < entriesToRemoveCount; i++) {\n cache.delete(entriesWithTimestamps[i].key);\n }\n}\n\n// Called whenever new features are fetched from the API\nfunction onNewFeatureData(key, cacheKey, data) {\n // If contents haven't changed, ignore the update, extend the stale TTL\n const version = data.dateUpdated || \"\";\n const staleAt = new Date(Date.now() + cacheSettings.staleTTL);\n const existing = !cacheSettings.disableCache ? cache.get(cacheKey) : undefined;\n if (existing && version && existing.version === version) {\n existing.staleAt = staleAt;\n updatePersistentCache();\n return;\n }\n if (!cacheSettings.disableCache) {\n // Update in-memory cache\n cache.set(cacheKey, {\n data,\n version,\n staleAt,\n sse: supportsSSE.has(key)\n });\n cleanupCache();\n }\n // Update local storage (don't await this, just update asynchronously)\n updatePersistentCache();\n\n // Update features for all subscribed GrowthBook instances\n const instances = subscribedInstances.get(key);\n instances && instances.forEach(instance => refreshInstance(instance, data));\n}\nasync function refreshInstance(instance, data) {\n await instance.setPayload(data || instance.getPayload());\n}\n\n// Fetch the features payload from helper function or from in-mem injected payload\nasync function fetchFeatures(instance) {\n const {\n apiHost,\n apiRequestHeaders\n } = instance.getApiHosts();\n const clientKey = instance.getClientKey();\n const remoteEval = instance.isRemoteEval();\n const key = getKey(instance);\n const cacheKey = getCacheKey(instance);\n let promise = activeFetches.get(cacheKey);\n if (!promise) {\n const fetcher = remoteEval ? helpers.fetchRemoteEvalCall({\n host: apiHost,\n clientKey,\n payload: {\n attributes: instance.getAttributes(),\n forcedVariations: instance.getForcedVariations(),\n forcedFeatures: Array.from(instance.getForcedFeatures().entries()),\n url: instance.getUrl()\n },\n headers: apiRequestHeaders\n }) : helpers.fetchFeaturesCall({\n host: apiHost,\n clientKey,\n headers: apiRequestHeaders\n });\n\n // TODO: auto-retry if status code indicates a temporary error\n promise = fetcher.then(res => {\n if (!res.ok) {\n throw new Error(\"HTTP error: \".concat(res.status));\n }\n if (res.headers.get(\"x-sse-support\") === \"enabled\") {\n supportsSSE.add(key);\n }\n return res.json();\n }).then(data => {\n onNewFeatureData(key, cacheKey, data);\n startAutoRefresh(instance);\n activeFetches.delete(cacheKey);\n return {\n data,\n success: true,\n source: \"network\"\n };\n }).catch(e => {\n process.env.NODE_ENV !== \"production\" && instance.log(\"Error fetching features\", {\n apiHost,\n clientKey,\n error: e ? e.message : null\n });\n activeFetches.delete(cacheKey);\n return {\n data: null,\n source: \"error\",\n success: false,\n error: e\n };\n });\n activeFetches.set(cacheKey, promise);\n }\n return promise;\n}\n\n// Start SSE streaming, listens to feature payload changes and triggers a refresh or re-fetch\nexport function startAutoRefresh(instance) {\n let forceSSE = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n const key = getKey(instance);\n const cacheKey = getCacheKey(instance);\n const {\n streamingHost,\n streamingHostRequestHeaders\n } = instance.getApiHosts();\n const clientKey = instance.getClientKey();\n if (forceSSE) {\n supportsSSE.add(key);\n }\n if (cacheSettings.backgroundSync && supportsSSE.has(key) && polyfills.EventSource) {\n if (streams.has(key)) return;\n const channel = {\n src: null,\n host: streamingHost,\n clientKey,\n headers: streamingHostRequestHeaders,\n cb: event => {\n try {\n if (event.type === \"features-updated\") {\n const instances = subscribedInstances.get(key);\n instances && instances.forEach(instance => {\n fetchFeatures(instance);\n });\n } else if (event.type === \"features\") {\n const json = JSON.parse(event.data);\n onNewFeatureData(key, cacheKey, json);\n }\n // Reset error count on success\n channel.errors = 0;\n } catch (e) {\n process.env.NODE_ENV !== \"production\" && instance.log(\"SSE Error\", {\n streamingHost,\n clientKey,\n error: e ? e.message : null\n });\n onSSEError(channel);\n }\n },\n errors: 0,\n state: \"active\"\n };\n streams.set(key, channel);\n enableChannel(channel);\n }\n}\nfunction onSSEError(channel) {\n if (channel.state === \"idle\") return;\n channel.errors++;\n if (channel.errors > 3 || channel.src && channel.src.readyState === 2) {\n // exponential backoff after 4 errors, with jitter\n const delay = Math.pow(3, channel.errors - 3) * (1000 + Math.random() * 1000);\n disableChannel(channel);\n setTimeout(() => {\n if ([\"idle\", \"active\"].includes(channel.state)) return;\n enableChannel(channel);\n }, Math.min(delay, 300000)); // 5 minutes max\n }\n}\n\nfunction disableChannel(channel) {\n if (!channel.src) return;\n channel.src.onopen = null;\n channel.src.onerror = null;\n channel.src.close();\n channel.src = null;\n if (channel.state === \"active\") {\n channel.state = \"disabled\";\n }\n}\nfunction enableChannel(channel) {\n channel.src = helpers.eventSourceCall({\n host: channel.host,\n clientKey: channel.clientKey,\n headers: channel.headers\n });\n channel.state = \"active\";\n channel.src.addEventListener(\"features\", channel.cb);\n channel.src.addEventListener(\"features-updated\", channel.cb);\n channel.src.onerror = () => onSSEError(channel);\n channel.src.onopen = () => {\n channel.errors = 0;\n };\n}\nfunction destroyChannel(channel, key) {\n disableChannel(channel);\n streams.delete(key);\n}\nfunction clearAutoRefresh() {\n // Clear list of which keys are auto-updated\n supportsSSE.clear();\n\n // Stop listening for any SSE events\n streams.forEach(destroyChannel);\n\n // Remove all references to GrowthBook instances\n subscribedInstances.clear();\n\n // Run the idle stream cleanup function\n helpers.stopIdleListener();\n}\n//# sourceMappingURL=feature-repository.mjs.map","import mutate from \"dom-mutator\";\nimport { chooseVariation, decrypt, getAutoExperimentChangeType, getBucketRanges, getQueryStringOverride, getUrlRegExp, hash, inNamespace, inRange, isIncluded, isURLTargeted, loadSDKVersion, mergeQueryStrings, toString } from \"./util.mjs\";\nimport { evalCondition } from \"./mongrule.mjs\";\nimport { refreshFeatures, startAutoRefresh, subscribe, unsubscribe } from \"./feature-repository.mjs\";\nconst isBrowser = typeof window !== \"undefined\" && typeof document !== \"undefined\";\nconst SDK_VERSION = loadSDKVersion();\nexport class GrowthBook {\n // context is technically private, but some tools depend on it so we can't mangle the name\n // _ctx below is a clone of this property that we use internally\n\n // Properties and methods that start with \"_\" are mangled by Terser (saves ~150 bytes)\n\n // eslint-disable-next-line\n\n constructor(context) {\n context = context || {};\n // These properties are all initialized in the constructor instead of above\n // This saves ~80 bytes in the final output\n this.version = SDK_VERSION;\n this._ctx = this.context = context;\n this._renderer = context.renderer || null;\n this._trackedExperiments = new Set();\n this._completedChangeIds = new Set();\n this._trackedFeatures = {};\n this.debug = !!context.debug;\n this._subscriptions = new Set();\n this._rtQueue = [];\n this._rtTimer = 0;\n this.ready = false;\n this._assigned = new Map();\n this._forcedFeatureValues = new Map();\n this._attributeOverrides = {};\n this._activeAutoExperiments = new Map();\n this._triggeredExpKeys = new Set();\n this._initialized = false;\n this._redirectedUrl = \"\";\n this._deferredTrackingCalls = new Map();\n this._autoExperimentsAllowed = !context.disableExperimentsOnLoad;\n if (context.remoteEval) {\n if (context.decryptionKey) {\n throw new Error(\"Encryption is not available for remoteEval\");\n }\n if (!context.clientKey) {\n throw new Error(\"Missing clientKey\");\n }\n let isGbHost = false;\n try {\n isGbHost = !!new URL(context.apiHost || \"\").hostname.match(/growthbook\\.io$/i);\n } catch (e) {\n // ignore invalid URLs\n }\n if (isGbHost) {\n throw new Error(\"Cannot use remoteEval on GrowthBook Cloud\");\n }\n } else {\n if (context.cacheKeyAttributes) {\n throw new Error(\"cacheKeyAttributes are only used for remoteEval\");\n }\n }\n if (context.features) {\n this.ready = true;\n }\n if (isBrowser && context.enableDevMode) {\n window._growthbook = this;\n document.dispatchEvent(new Event(\"gbloaded\"));\n }\n if (context.experiments) {\n this.ready = true;\n this._updateAllAutoExperiments();\n } else if (context.antiFlicker) {\n this._setAntiFlicker();\n }\n\n // Hydrate sticky bucket service\n if (this._ctx.stickyBucketService && this._ctx.stickyBucketAssignmentDocs) {\n for (const key in this._ctx.stickyBucketAssignmentDocs) {\n const doc = this._ctx.stickyBucketAssignmentDocs[key];\n if (doc) {\n this._ctx.stickyBucketService.saveAssignments(doc).catch(() => {\n // Ignore hydration errors\n });\n }\n }\n }\n\n // Legacy - passing in features/experiments into the constructor instead of using init\n if (this.ready) {\n this.refreshStickyBuckets(this.getPayload());\n }\n }\n async setPayload(payload) {\n this._payload = payload;\n const data = await this.decryptPayload(payload);\n this._decryptedPayload = data;\n await this.refreshStickyBuckets(data);\n if (data.features) {\n this._ctx.features = data.features;\n }\n if (data.savedGroups) {\n this._ctx.savedGroups = data.savedGroups;\n }\n if (data.experiments) {\n this._ctx.experiments = data.experiments;\n this._updateAllAutoExperiments();\n }\n this.ready = true;\n this._render();\n }\n initSync(options) {\n this._initialized = true;\n const payload = options.payload;\n if (payload.encryptedExperiments || payload.encryptedFeatures) {\n throw new Error(\"initSync does not support encrypted payloads\");\n }\n if (this._ctx.stickyBucketService && !this._ctx.stickyBucketAssignmentDocs) {\n throw new Error(\"initSync requires you to pass stickyBucketAssignmentDocs into the GrowthBook constructor\");\n }\n this._payload = payload;\n this._decryptedPayload = payload;\n if (payload.features) {\n this._ctx.features = payload.features;\n }\n if (payload.experiments) {\n this._ctx.experiments = payload.experiments;\n this._updateAllAutoExperiments();\n }\n this.ready = true;\n if (options.streaming) {\n if (!this._ctx.clientKey) {\n throw new Error(\"Must specify clientKey to enable streaming\");\n }\n startAutoRefresh(this, true);\n subscribe(this);\n }\n return this;\n }\n async init(options) {\n this._initialized = true;\n options = options || {};\n if (options.payload) {\n await this.setPayload(options.payload);\n if (options.streaming) {\n if (!this._ctx.clientKey) {\n throw new Error(\"Must specify clientKey to enable streaming\");\n }\n startAutoRefresh(this, true);\n subscribe(this);\n }\n return {\n success: true,\n source: \"init\"\n };\n } else {\n const {\n data,\n ...res\n } = await this._refresh({\n ...options,\n allowStale: true\n });\n if (options.streaming) {\n subscribe(this);\n }\n await this.setPayload(data || {});\n return res;\n }\n }\n\n /** @deprecated Use {@link init} */\n async loadFeatures(options) {\n this._initialized = true;\n options = options || {};\n if (options.autoRefresh) {\n // interpret deprecated autoRefresh option as subscribeToChanges\n this._ctx.subscribeToChanges = true;\n }\n const {\n data\n } = await this._refresh({\n ...options,\n allowStale: true\n });\n await this.setPayload(data || {});\n if (this._canSubscribe()) {\n subscribe(this);\n }\n }\n async refreshFeatures(options) {\n const res = await this._refresh({\n ...(options || {}),\n allowStale: false\n });\n if (res.data) {\n await this.setPayload(res.data);\n }\n }\n getApiInfo() {\n return [this.getApiHosts().apiHost, this.getClientKey()];\n }\n getApiHosts() {\n const defaultHost = this._ctx.apiHost || \"https://cdn.growthbook.io\";\n return {\n apiHost: defaultHost.replace(/\\/*$/, \"\"),\n streamingHost: (this._ctx.streamingHost || defaultHost).replace(/\\/*$/, \"\"),\n apiRequestHeaders: this._ctx.apiHostRequestHeaders,\n streamingHostRequestHeaders: this._ctx.streamingHostRequestHeaders\n };\n }\n getClientKey() {\n return this._ctx.clientKey || \"\";\n }\n getPayload() {\n return this._payload || {\n features: this.getFeatures(),\n experiments: this.getExperiments()\n };\n }\n getDecryptedPayload() {\n return this._decryptedPayload || this.getPayload();\n }\n isRemoteEval() {\n return this._ctx.remoteEval || false;\n }\n getCacheKeyAttributes() {\n return this._ctx.cacheKeyAttributes;\n }\n async _refresh(_ref) {\n var _ref2;\n let {\n timeout,\n skipCache,\n allowStale,\n streaming\n } = _ref;\n if (!this._ctx.clientKey) {\n throw new Error(\"Missing clientKey\");\n }\n // Trigger refresh in feature repository\n return refreshFeatures({\n instance: this,\n timeout,\n skipCache: skipCache || this._ctx.disableCache,\n allowStale,\n backgroundSync: (_ref2 = streaming !== null && streaming !== void 0 ? streaming : this._ctx.backgroundSync) !== null && _ref2 !== void 0 ? _ref2 : true\n });\n }\n _render() {\n if (this._renderer) {\n try {\n this._renderer();\n } catch (e) {\n console.error(\"Failed to render\", e);\n }\n }\n }\n\n /** @deprecated Use {@link setPayload} */\n setFeatures(features) {\n this._ctx.features = features;\n this.ready = true;\n this._render();\n }\n\n /** @deprecated Use {@link setPayload} */\n async setEncryptedFeatures(encryptedString, decryptionKey, subtle) {\n const featuresJSON = await decrypt(encryptedString, decryptionKey || this._ctx.decryptionKey, subtle);\n this.setFeatures(JSON.parse(featuresJSON));\n }\n\n /** @deprecated Use {@link setPayload} */\n setExperiments(experiments) {\n this._ctx.experiments = experiments;\n this.ready = true;\n this._updateAllAutoExperiments();\n }\n\n /** @deprecated Use {@link setPayload} */\n async setEncryptedExperiments(encryptedString, decryptionKey, subtle) {\n const experimentsJSON = await decrypt(encryptedString, decryptionKey || this._ctx.decryptionKey, subtle);\n this.setExperiments(JSON.parse(experimentsJSON));\n }\n async decryptPayload(data, decryptionKey, subtle) {\n data = {\n ...data\n };\n if (data.encryptedFeatures) {\n try {\n data.features = JSON.parse(await decrypt(data.encryptedFeatures, decryptionKey || this._ctx.decryptionKey, subtle));\n } catch (e) {\n console.error(e);\n }\n delete data.encryptedFeatures;\n }\n if (data.encryptedExperiments) {\n try {\n data.experiments = JSON.parse(await decrypt(data.encryptedExperiments, decryptionKey || this._ctx.decryptionKey, subtle));\n } catch (e) {\n console.error(e);\n }\n delete data.encryptedExperiments;\n }\n if (data.encryptedSavedGroups) {\n try {\n data.savedGroups = JSON.parse(await decrypt(data.encryptedSavedGroups, decryptionKey || this._ctx.decryptionKey, subtle));\n } catch (e) {\n console.error(e);\n }\n delete data.encryptedSavedGroups;\n }\n return data;\n }\n async setAttributes(attributes) {\n this._ctx.attributes = attributes;\n if (this._ctx.stickyBucketService) {\n await this.refreshStickyBuckets();\n }\n if (this._ctx.remoteEval) {\n await this._refreshForRemoteEval();\n return;\n }\n this._render();\n this._updateAllAutoExperiments();\n }\n async updateAttributes(attributes) {\n return this.setAttributes({\n ...this._ctx.attributes,\n ...attributes\n });\n }\n async setAttributeOverrides(overrides) {\n this._attributeOverrides = overrides;\n if (this._ctx.stickyBucketService) {\n await this.refreshStickyBuckets();\n }\n if (this._ctx.remoteEval) {\n await this._refreshForRemoteEval();\n return;\n }\n this._render();\n this._updateAllAutoExperiments();\n }\n async setForcedVariations(vars) {\n this._ctx.forcedVariations = vars || {};\n if (this._ctx.remoteEval) {\n await this._refreshForRemoteEval();\n return;\n }\n this._render();\n this._updateAllAutoExperiments();\n }\n\n // eslint-disable-next-line\n setForcedFeatures(map) {\n this._forcedFeatureValues = map;\n this._render();\n }\n async setURL(url) {\n this._ctx.url = url;\n this._redirectedUrl = \"\";\n if (this._ctx.remoteEval) {\n await this._refreshForRemoteEval();\n this._updateAllAutoExperiments(true);\n return;\n }\n this._updateAllAutoExperiments(true);\n }\n getAttributes() {\n return {\n ...this._ctx.attributes,\n ...this._attributeOverrides\n };\n }\n getForcedVariations() {\n return this._ctx.forcedVariations || {};\n }\n getForcedFeatures() {\n // eslint-disable-next-line\n return this._forcedFeatureValues || new Map();\n }\n getStickyBucketAssignmentDocs() {\n return this._ctx.stickyBucketAssignmentDocs || {};\n }\n getUrl() {\n return this._ctx.url || \"\";\n }\n getFeatures() {\n return this._ctx.features || {};\n }\n getExperiments() {\n return this._ctx.experiments || [];\n }\n getCompletedChangeIds() {\n return Array.from(this._completedChangeIds);\n }\n subscribe(cb) {\n this._subscriptions.add(cb);\n return () => {\n this._subscriptions.delete(cb);\n };\n }\n _canSubscribe() {\n var _this$_ctx$background;\n return ((_this$_ctx$background = this._ctx.backgroundSync) !== null && _this$_ctx$background !== void 0 ? _this$_ctx$background : true) && this._ctx.subscribeToChanges;\n }\n async _refreshForRemoteEval() {\n if (!this._ctx.remoteEval) return;\n if (!this._initialized) return;\n const res = await this._refresh({\n allowStale: false\n });\n if (res.data) {\n await this.setPayload(res.data);\n }\n }\n getAllResults() {\n return new Map(this._assigned);\n }\n destroy() {\n // Release references to save memory\n this._subscriptions.clear();\n this._assigned.clear();\n this._trackedExperiments.clear();\n this._completedChangeIds.clear();\n this._deferredTrackingCalls.clear();\n this._trackedFeatures = {};\n this._rtQueue = [];\n this._payload = undefined;\n if (this._rtTimer) {\n clearTimeout(this._rtTimer);\n }\n unsubscribe(this);\n if (isBrowser && window._growthbook === this) {\n delete window._growthbook;\n }\n\n // Undo any active auto experiments\n this._activeAutoExperiments.forEach(exp => {\n exp.undo();\n });\n this._activeAutoExperiments.clear();\n this._triggeredExpKeys.clear();\n }\n setRenderer(renderer) {\n this._renderer = renderer;\n }\n forceVariation(key, variation) {\n this._ctx.forcedVariations = this._ctx.forcedVariations || {};\n this._ctx.forcedVariations[key] = variation;\n if (this._ctx.remoteEval) {\n this._refreshForRemoteEval();\n return;\n }\n this._updateAllAutoExperiments();\n this._render();\n }\n run(experiment) {\n const result = this._run(experiment, null);\n this._fireSubscriptions(experiment, result);\n return result;\n }\n triggerExperiment(key) {\n this._triggeredExpKeys.add(key);\n if (!this._ctx.experiments) return null;\n const experiments = this._ctx.experiments.filter(exp => exp.key === key);\n return experiments.map(exp => {\n return this._runAutoExperiment(exp);\n }).filter(res => res !== null);\n }\n triggerAutoExperiments() {\n this._autoExperimentsAllowed = true;\n this._updateAllAutoExperiments(true);\n }\n _runAutoExperiment(experiment, forceRerun) {\n const existing = this._activeAutoExperiments.get(experiment);\n\n // If this is a manual experiment and it's not already running, skip\n if (experiment.manual && !this._triggeredExpKeys.has(experiment.key) && !existing) return null;\n\n // Check if this particular experiment is blocked by context settings\n // For example, if all visualEditor experiments are disabled\n const isBlocked = this._isAutoExperimentBlockedByContext(experiment);\n if (isBlocked) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Auto experiment blocked\", {\n id: experiment.key\n });\n }\n\n // Run the experiment (if blocked exclude)\n const result = isBlocked ? this._getResult(experiment, -1, false, \"\") : this.run(experiment);\n\n // A hash to quickly tell if the assigned value changed\n const valueHash = JSON.stringify(result.value);\n\n // If the changes are already active, no need to re-apply them\n if (!forceRerun && result.inExperiment && existing && existing.valueHash === valueHash) {\n return result;\n }\n\n // Undo any existing changes\n if (existing) this._undoActiveAutoExperiment(experiment);\n\n // Apply new changes\n if (result.inExperiment) {\n const changeType = getAutoExperimentChangeType(experiment);\n if (changeType === \"redirect\" && result.value.urlRedirect && experiment.urlPatterns) {\n const url = experiment.persistQueryString ? mergeQueryStrings(this._getContextUrl(), result.value.urlRedirect) : result.value.urlRedirect;\n if (isURLTargeted(url, experiment.urlPatterns)) {\n this.log(\"Skipping redirect because original URL matches redirect URL\", {\n id: experiment.key\n });\n return result;\n }\n this._redirectedUrl = url;\n const navigate = this._getNavigateFunction();\n if (navigate) {\n if (isBrowser) {\n var _this$_ctx$navigateDe;\n this._setAntiFlicker();\n window.setTimeout(() => {\n try {\n navigate(url);\n } catch (e) {\n console.error(e);\n }\n }, (_this$_ctx$navigateDe = this._ctx.navigateDelay) !== null && _this$_ctx$navigateDe !== void 0 ? _this$_ctx$navigateDe : 100);\n } else {\n try {\n navigate(url);\n } catch (e) {\n console.error(e);\n }\n }\n }\n } else if (changeType === \"visual\") {\n const undo = this._ctx.applyDomChangesCallback ? this._ctx.applyDomChangesCallback(result.value) : this._applyDOMChanges(result.value);\n if (undo) {\n this._activeAutoExperiments.set(experiment, {\n undo,\n valueHash\n });\n }\n }\n }\n return result;\n }\n _undoActiveAutoExperiment(exp) {\n const data = this._activeAutoExperiments.get(exp);\n if (data) {\n data.undo();\n this._activeAutoExperiments.delete(exp);\n }\n }\n _updateAllAutoExperiments(forceRerun) {\n if (!this._autoExperimentsAllowed) return;\n const experiments = this._ctx.experiments || [];\n\n // Stop any experiments that are no longer defined\n const keys = new Set(experiments);\n this._activeAutoExperiments.forEach((v, k) => {\n if (!keys.has(k)) {\n v.undo();\n this._activeAutoExperiments.delete(k);\n }\n });\n\n // Re-run all new/updated experiments\n for (const exp of experiments) {\n const result = this._runAutoExperiment(exp, forceRerun);\n\n // Once you're in a redirect experiment, break out of the loop and don't run any further experiments\n if (result !== null && result !== void 0 && result.inExperiment && getAutoExperimentChangeType(exp) === \"redirect\") {\n break;\n }\n }\n }\n _fireSubscriptions(experiment, result) {\n const key = experiment.key;\n\n // If assigned variation has changed, fire subscriptions\n const prev = this._assigned.get(key);\n // TODO: what if the experiment definition has changed?\n if (!prev || prev.result.inExperiment !== result.inExperiment || prev.result.variationId !== result.variationId) {\n this._assigned.set(key, {\n experiment,\n result\n });\n this._subscriptions.forEach(cb => {\n try {\n cb(experiment, result);\n } catch (e) {\n console.error(e);\n }\n });\n }\n }\n _trackFeatureUsage(key, res) {\n // Don't track feature usage that was forced via an override\n if (res.source === \"override\") return;\n\n // Only track a feature once, unless the assigned value changed\n const stringifiedValue = JSON.stringify(res.value);\n if (this._trackedFeatures[key] === stringifiedValue) return;\n this._trackedFeatures[key] = stringifiedValue;\n\n // Fire user-supplied callback\n if (this._ctx.onFeatureUsage) {\n try {\n this._ctx.onFeatureUsage(key, res);\n } catch (e) {\n // Ignore feature usage callback errors\n }\n }\n\n // In browser environments, queue up feature usage to be tracked in batches\n if (!isBrowser || !window.fetch) return;\n this._rtQueue.push({\n key,\n on: res.on\n });\n if (!this._rtTimer) {\n this._rtTimer = window.setTimeout(() => {\n // Reset the queue\n this._rtTimer = 0;\n const q = [...this._rtQueue];\n this._rtQueue = [];\n\n // Skip logging if a real-time usage key is not configured\n if (!this._ctx.realtimeKey) return;\n window.fetch(\"https://rt.growthbook.io/?key=\".concat(this._ctx.realtimeKey, \"&events=\").concat(encodeURIComponent(JSON.stringify(q))), {\n cache: \"no-cache\",\n mode: \"no-cors\"\n }).catch(() => {\n // TODO: retry in case of network errors?\n });\n }, this._ctx.realtimeInterval || 2000);\n }\n }\n _getFeatureResult(key, value, source, ruleId, experiment, result) {\n const ret = {\n value,\n on: !!value,\n off: !value,\n source,\n ruleId: ruleId || \"\"\n };\n if (experiment) ret.experiment = experiment;\n if (result) ret.experimentResult = result;\n\n // Track the usage of this feature in real-time\n this._trackFeatureUsage(key, ret);\n return ret;\n }\n isOn(key) {\n return this.evalFeature(key).on;\n }\n isOff(key) {\n return this.evalFeature(key).off;\n }\n getFeatureValue(key, defaultValue) {\n const value = this.evalFeature(key).value;\n return value === null ? defaultValue : value;\n }\n\n /**\n * @deprecated Use {@link evalFeature}\n * @param id\n */\n // eslint-disable-next-line\n feature(id) {\n return this.evalFeature(id);\n }\n evalFeature(id) {\n return this._evalFeature(id);\n }\n _evalFeature(id, evalCtx) {\n evalCtx = evalCtx || {\n evaluatedFeatures: new Set()\n };\n if (evalCtx.evaluatedFeatures.has(id)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"evalFeature: circular dependency detected: \".concat(evalCtx.id, \" -> \").concat(id), {\n from: evalCtx.id,\n to: id\n });\n return this._getFeatureResult(id, null, \"cyclicPrerequisite\");\n }\n evalCtx.evaluatedFeatures.add(id);\n evalCtx.id = id;\n\n // Global override\n if (this._forcedFeatureValues.has(id)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Global override\", {\n id,\n value: this._forcedFeatureValues.get(id)\n });\n return this._getFeatureResult(id, this._forcedFeatureValues.get(id), \"override\");\n }\n\n // Unknown feature id\n if (!this._ctx.features || !this._ctx.features[id]) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Unknown feature\", {\n id\n });\n return this._getFeatureResult(id, null, \"unknownFeature\");\n }\n\n // Get the feature\n const feature = this._ctx.features[id];\n\n // Loop through the rules\n if (feature.rules) {\n rules: for (const rule of feature.rules) {\n // If there are prerequisite flag(s), evaluate them\n if (rule.parentConditions) {\n for (const parentCondition of rule.parentConditions) {\n const parentResult = this._evalFeature(parentCondition.id, evalCtx);\n // break out for cyclic prerequisites\n if (parentResult.source === \"cyclicPrerequisite\") {\n return this._getFeatureResult(id, null, \"cyclicPrerequisite\");\n }\n const evalObj = {\n value: parentResult.value\n };\n const evaled = evalCondition(evalObj, parentCondition.condition || {});\n if (!evaled) {\n // blocking prerequisite eval failed: feature evaluation fails\n if (parentCondition.gate) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Feature blocked by prerequisite\", {\n id,\n rule\n });\n return this._getFeatureResult(id, null, \"prerequisite\");\n }\n // non-blocking prerequisite eval failed: break out of parentConditions loop, jump to the next rule\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip rule because prerequisite evaluation fails\", {\n id,\n rule\n });\n continue rules;\n }\n }\n }\n\n // If there are filters for who is included (e.g. namespaces)\n if (rule.filters && this._isFilteredOut(rule.filters)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip rule because of filters\", {\n id,\n rule\n });\n continue;\n }\n\n // Feature value is being forced\n if (\"force\" in rule) {\n // If it's a conditional rule, skip if the condition doesn't pass\n if (rule.condition && !this._conditionPasses(rule.condition)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip rule because of condition ff\", {\n id,\n rule\n });\n continue;\n }\n\n // If this is a percentage rollout, skip if not included\n if (!this._isIncludedInRollout(rule.seed || id, rule.hashAttribute, this._ctx.stickyBucketService && !rule.disableStickyBucketing ? rule.fallbackAttribute : undefined, rule.range, rule.coverage, rule.hashVersion)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip rule because user not included in rollout\", {\n id,\n rule\n });\n continue;\n }\n process.env.NODE_ENV !== \"production\" && this.log(\"Force value from rule\", {\n id,\n rule\n });\n\n // If this was a remotely evaluated experiment, fire the tracking callbacks\n if (rule.tracks) {\n rule.tracks.forEach(t => {\n this._track(t.experiment, t.result);\n });\n }\n return this._getFeatureResult(id, rule.force, \"force\", rule.id);\n }\n if (!rule.variations) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip invalid rule\", {\n id,\n rule\n });\n continue;\n }\n\n // For experiment rules, run an experiment\n const exp = {\n variations: rule.variations,\n key: rule.key || id\n };\n if (\"coverage\" in rule) exp.coverage = rule.coverage;\n if (rule.weights) exp.weights = rule.weights;\n if (rule.hashAttribute) exp.hashAttribute = rule.hashAttribute;\n if (rule.fallbackAttribute) exp.fallbackAttribute = rule.fallbackAttribute;\n if (rule.disableStickyBucketing) exp.disableStickyBucketing = rule.disableStickyBucketing;\n if (rule.bucketVersion !== undefined) exp.bucketVersion = rule.bucketVersion;\n if (rule.minBucketVersion !== undefined) exp.minBucketVersion = rule.minBucketVersion;\n if (rule.namespace) exp.namespace = rule.namespace;\n if (rule.meta) exp.meta = rule.meta;\n if (rule.ranges) exp.ranges = rule.ranges;\n if (rule.name) exp.name = rule.name;\n if (rule.phase) exp.phase = rule.phase;\n if (rule.seed) exp.seed = rule.seed;\n if (rule.hashVersion) exp.hashVersion = rule.hashVersion;\n if (rule.filters) exp.filters = rule.filters;\n if (rule.condition) exp.condition = rule.condition;\n\n // Only return a value if the user is part of the experiment\n const res = this._run(exp, id);\n this._fireSubscriptions(exp, res);\n if (res.inExperiment && !res.passthrough) {\n return this._getFeatureResult(id, res.value, \"experiment\", rule.id, exp, res);\n }\n }\n }\n process.env.NODE_ENV !== \"production\" && this.log(\"Use default value\", {\n id,\n value: feature.defaultValue\n });\n\n // Fall back to using the default value\n return this._getFeatureResult(id, feature.defaultValue === undefined ? null : feature.defaultValue, \"defaultValue\");\n }\n _isIncludedInRollout(seed, hashAttribute, fallbackAttribute, range, coverage, hashVersion) {\n if (!range && coverage === undefined) return true;\n if (!range && coverage === 0) return false;\n const {\n hashValue\n } = this._getHashAttribute(hashAttribute, fallbackAttribute);\n if (!hashValue) {\n return false;\n }\n const n = hash(seed, hashValue, hashVersion || 1);\n if (n === null) return false;\n return range ? inRange(n, range) : coverage !== undefined ? n <= coverage : true;\n }\n _conditionPasses(condition) {\n return evalCondition(this.getAttributes(), condition, this._ctx.savedGroups || {});\n }\n _isFilteredOut(filters) {\n return filters.some(filter => {\n const {\n hashValue\n } = this._getHashAttribute(filter.attribute);\n if (!hashValue) return true;\n const n = hash(filter.seed, hashValue, filter.hashVersion || 2);\n if (n === null) return true;\n return !filter.ranges.some(r => inRange(n, r));\n });\n }\n _run(experiment, featureId) {\n const key = experiment.key;\n const numVariations = experiment.variations.length;\n\n // 1. If experiment has less than 2 variations, return immediately\n if (numVariations < 2) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Invalid experiment\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 2. If the context is disabled, return immediately\n if (this._ctx.enabled === false) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Context disabled\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 2.5. Merge in experiment overrides from the context\n experiment = this._mergeOverrides(experiment);\n\n // 2.6 New, more powerful URL targeting\n if (experiment.urlPatterns && !isURLTargeted(this._getContextUrl(), experiment.urlPatterns)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of url targeting\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 3. If a variation is forced from a querystring, return the forced variation\n const qsOverride = getQueryStringOverride(key, this._getContextUrl(), numVariations);\n if (qsOverride !== null) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Force via querystring\", {\n id: key,\n variation: qsOverride\n });\n return this._getResult(experiment, qsOverride, false, featureId);\n }\n\n // 4. If a variation is forced in the context, return the forced variation\n if (this._ctx.forcedVariations && key in this._ctx.forcedVariations) {\n const variation = this._ctx.forcedVariations[key];\n process.env.NODE_ENV !== \"production\" && this.log(\"Force via dev tools\", {\n id: key,\n variation\n });\n return this._getResult(experiment, variation, false, featureId);\n }\n\n // 5. Exclude if a draft experiment or not active\n if (experiment.status === \"draft\" || experiment.active === false) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because inactive\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 6. Get the hash attribute and return if empty\n const {\n hashAttribute,\n hashValue\n } = this._getHashAttribute(experiment.hashAttribute, this._ctx.stickyBucketService && !experiment.disableStickyBucketing ? experiment.fallbackAttribute : undefined);\n if (!hashValue) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because missing hashAttribute\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n let assigned = -1;\n let foundStickyBucket = false;\n let stickyBucketVersionIsBlocked = false;\n if (this._ctx.stickyBucketService && !experiment.disableStickyBucketing) {\n const {\n variation,\n versionIsBlocked\n } = this._getStickyBucketVariation({\n expKey: experiment.key,\n expBucketVersion: experiment.bucketVersion,\n expHashAttribute: experiment.hashAttribute,\n expFallbackAttribute: experiment.fallbackAttribute,\n expMinBucketVersion: experiment.minBucketVersion,\n expMeta: experiment.meta\n });\n foundStickyBucket = variation >= 0;\n assigned = variation;\n stickyBucketVersionIsBlocked = !!versionIsBlocked;\n }\n\n // Some checks are not needed if we already have a sticky bucket\n if (!foundStickyBucket) {\n // 7. Exclude if user is filtered out (used to be called \"namespace\")\n if (experiment.filters) {\n if (this._isFilteredOut(experiment.filters)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of filters\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n } else if (experiment.namespace && !inNamespace(hashValue, experiment.namespace)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of namespace\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 7.5. Exclude if experiment.include returns false or throws\n if (experiment.include && !isIncluded(experiment.include)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of include function\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 8. Exclude if condition is false\n if (experiment.condition && !this._conditionPasses(experiment.condition)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of condition exp\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 8.05. Exclude if prerequisites are not met\n if (experiment.parentConditions) {\n for (const parentCondition of experiment.parentConditions) {\n const parentResult = this._evalFeature(parentCondition.id);\n // break out for cyclic prerequisites\n if (parentResult.source === \"cyclicPrerequisite\") {\n return this._getResult(experiment, -1, false, featureId);\n }\n const evalObj = {\n value: parentResult.value\n };\n if (!evalCondition(evalObj, parentCondition.condition || {})) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because prerequisite evaluation fails\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n }\n }\n\n // 8.1. Exclude if user is not in a required group\n if (experiment.groups && !this._hasGroupOverlap(experiment.groups)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of groups\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n }\n\n // 8.2. Old style URL targeting\n if (experiment.url && !this._urlIsValid(experiment.url)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of url\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 9. Get the variation from the sticky bucket or get bucket ranges and choose variation\n const n = hash(experiment.seed || key, hashValue, experiment.hashVersion || 1);\n if (n === null) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of invalid hash version\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n if (!foundStickyBucket) {\n const ranges = experiment.ranges || getBucketRanges(numVariations, experiment.coverage === undefined ? 1 : experiment.coverage, experiment.weights);\n assigned = chooseVariation(n, ranges);\n }\n\n // 9.5 Unenroll if any prior sticky buckets are blocked by version\n if (stickyBucketVersionIsBlocked) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because sticky bucket version is blocked\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId, undefined, true);\n }\n\n // 10. Return if not in experiment\n if (assigned < 0) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of coverage\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 11. Experiment has a forced variation\n if (\"force\" in experiment) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Force variation\", {\n id: key,\n variation: experiment.force\n });\n return this._getResult(experiment, experiment.force === undefined ? -1 : experiment.force, false, featureId);\n }\n\n // 12. Exclude if in QA mode\n if (this._ctx.qaMode) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because QA mode\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 12.5. Exclude if experiment is stopped\n if (experiment.status === \"stopped\") {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because stopped\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 13. Build the result object\n const result = this._getResult(experiment, assigned, true, featureId, n, foundStickyBucket);\n\n // 13.5. Persist sticky bucket\n if (this._ctx.stickyBucketService && !experiment.disableStickyBucketing) {\n const {\n changed,\n key: attrKey,\n doc\n } = this._generateStickyBucketAssignmentDoc(hashAttribute, toString(hashValue), {\n [this._getStickyBucketExperimentKey(experiment.key, experiment.bucketVersion)]: result.key\n });\n if (changed) {\n // update local docs\n this._ctx.stickyBucketAssignmentDocs = this._ctx.stickyBucketAssignmentDocs || {};\n this._ctx.stickyBucketAssignmentDocs[attrKey] = doc;\n // save doc\n this._ctx.stickyBucketService.saveAssignments(doc);\n }\n }\n\n // 14. Fire the tracking callback\n this._track(experiment, result);\n\n // 14.1 Keep track of completed changeIds\n \"changeId\" in experiment && experiment.changeId && this._completedChangeIds.add(experiment.changeId);\n\n // 15. Return the result\n process.env.NODE_ENV !== \"production\" && this.log(\"In experiment\", {\n id: key,\n variation: result.variationId\n });\n return result;\n }\n log(msg, ctx) {\n if (!this.debug) return;\n if (this._ctx.log) this._ctx.log(msg, ctx);else console.log(msg, ctx);\n }\n getDeferredTrackingCalls() {\n return Array.from(this._deferredTrackingCalls.values());\n }\n setDeferredTrackingCalls(calls) {\n this._deferredTrackingCalls = new Map(calls.filter(c => c && c.experiment && c.result).map(c => {\n return [this._getTrackKey(c.experiment, c.result), c];\n }));\n }\n fireDeferredTrackingCalls() {\n if (!this._ctx.trackingCallback) return;\n this._deferredTrackingCalls.forEach(call => {\n if (!call || !call.experiment || !call.result) {\n console.error(\"Invalid deferred tracking call\", {\n call: call\n });\n } else {\n this._track(call.experiment, call.result);\n }\n });\n this._deferredTrackingCalls.clear();\n }\n setTrackingCallback(callback) {\n this._ctx.trackingCallback = callback;\n this.fireDeferredTrackingCalls();\n }\n _getTrackKey(experiment, result) {\n return result.hashAttribute + result.hashValue + experiment.key + result.variationId;\n }\n _track(experiment, result) {\n const k = this._getTrackKey(experiment, result);\n if (!this._ctx.trackingCallback) {\n // Add to deferred tracking if it hasn't already been added\n if (!this._deferredTrackingCalls.has(k)) {\n this._deferredTrackingCalls.set(k, {\n experiment,\n result\n });\n }\n return;\n }\n\n // Make sure a tracking callback is only fired once per unique experiment\n if (this._trackedExperiments.has(k)) return;\n this._trackedExperiments.add(k);\n try {\n this._ctx.trackingCallback(experiment, result);\n } catch (e) {\n console.error(e);\n }\n }\n _mergeOverrides(experiment) {\n const key = experiment.key;\n const o = this._ctx.overrides;\n if (o && o[key]) {\n experiment = Object.assign({}, experiment, o[key]);\n if (typeof experiment.url === \"string\") {\n experiment.url = getUrlRegExp(\n // eslint-disable-next-line\n experiment.url);\n }\n }\n return experiment;\n }\n _getHashAttribute(attr, fallback) {\n let hashAttribute = attr || \"id\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let hashValue = \"\";\n if (this._attributeOverrides[hashAttribute]) {\n hashValue = this._attributeOverrides[hashAttribute];\n } else if (this._ctx.attributes) {\n hashValue = this._ctx.attributes[hashAttribute] || \"\";\n } else if (this._ctx.user) {\n hashValue = this._ctx.user[hashAttribute] || \"\";\n }\n\n // if no match, try fallback\n if (!hashValue && fallback) {\n if (this._attributeOverrides[fallback]) {\n hashValue = this._attributeOverrides[fallback];\n } else if (this._ctx.attributes) {\n hashValue = this._ctx.attributes[fallback] || \"\";\n } else if (this._ctx.user) {\n hashValue = this._ctx.user[fallback] || \"\";\n }\n if (hashValue) {\n hashAttribute = fallback;\n }\n }\n return {\n hashAttribute,\n hashValue\n };\n }\n _getResult(experiment, variationIndex, hashUsed, featureId, bucket, stickyBucketUsed) {\n let inExperiment = true;\n // If assigned variation is not valid, use the baseline and mark the user as not in the experiment\n if (variationIndex < 0 || variationIndex >= experiment.variations.length) {\n variationIndex = 0;\n inExperiment = false;\n }\n const {\n hashAttribute,\n hashValue\n } = this._getHashAttribute(experiment.hashAttribute, this._ctx.stickyBucketService && !experiment.disableStickyBucketing ? experiment.fallbackAttribute : undefined);\n const meta = experiment.meta ? experiment.meta[variationIndex] : {};\n const res = {\n key: meta.key || \"\" + variationIndex,\n featureId,\n inExperiment,\n hashUsed,\n variationId: variationIndex,\n value: experiment.variations[variationIndex],\n hashAttribute,\n hashValue,\n stickyBucketUsed: !!stickyBucketUsed\n };\n if (meta.name) res.name = meta.name;\n if (bucket !== undefined) res.bucket = bucket;\n if (meta.passthrough) res.passthrough = meta.passthrough;\n return res;\n }\n _getContextUrl() {\n return this._ctx.url || (isBrowser ? window.location.href : \"\");\n }\n _urlIsValid(urlRegex) {\n const url = this._getContextUrl();\n if (!url) return false;\n const pathOnly = url.replace(/^https?:\\/\\//, \"\").replace(/^[^/]*\\//, \"/\");\n if (urlRegex.test(url)) return true;\n if (urlRegex.test(pathOnly)) return true;\n return false;\n }\n _hasGroupOverlap(expGroups) {\n const groups = this._ctx.groups || {};\n for (let i = 0; i < expGroups.length; i++) {\n if (groups[expGroups[i]]) return true;\n }\n return false;\n }\n _isAutoExperimentBlockedByContext(experiment) {\n const changeType = getAutoExperimentChangeType(experiment);\n if (changeType === \"visual\") {\n if (this._ctx.disableVisualExperiments) return true;\n if (this._ctx.disableJsInjection) {\n if (experiment.variations.some(v => v.js)) {\n return true;\n }\n }\n } else if (changeType === \"redirect\") {\n if (this._ctx.disableUrlRedirectExperiments) return true;\n\n // Validate URLs\n try {\n const current = new URL(this._getContextUrl());\n for (const v of experiment.variations) {\n if (!v || !v.urlRedirect) continue;\n const url = new URL(v.urlRedirect);\n\n // If we're blocking cross origin redirects, block if the protocol or host is different\n if (this._ctx.disableCrossOriginUrlRedirectExperiments) {\n if (url.protocol !== current.protocol) return true;\n if (url.host !== current.host) return true;\n }\n }\n } catch (e) {\n // Problem parsing one of the URLs\n this.log(\"Error parsing current or redirect URL\", {\n id: experiment.key,\n error: e\n });\n return true;\n }\n } else {\n // Block any unknown changeTypes\n return true;\n }\n if (experiment.changeId && (this._ctx.blockedChangeIds || []).includes(experiment.changeId)) {\n return true;\n }\n return false;\n }\n getRedirectUrl() {\n return this._redirectedUrl;\n }\n _getNavigateFunction() {\n if (this._ctx.navigate) {\n return this._ctx.navigate;\n } else if (isBrowser) {\n return url => {\n window.location.replace(url);\n };\n }\n return null;\n }\n _setAntiFlicker() {\n if (!this._ctx.antiFlicker || !isBrowser) return;\n try {\n var _this$_ctx$antiFlicke;\n const styleTag = document.createElement(\"style\");\n styleTag.innerHTML = \".gb-anti-flicker { opacity: 0 !important; pointer-events: none; }\";\n document.head.appendChild(styleTag);\n document.documentElement.classList.add(\"gb-anti-flicker\");\n\n // Fallback if GrowthBook fails to load in specified time or 3.5 seconds\n setTimeout(() => {\n document.documentElement.classList.remove(\"gb-anti-flicker\");\n }, (_this$_ctx$antiFlicke = this._ctx.antiFlickerTimeout) !== null && _this$_ctx$antiFlicke !== void 0 ? _this$_ctx$antiFlicke : 3500);\n } catch (e) {\n console.error(e);\n }\n }\n _applyDOMChanges(changes) {\n if (!isBrowser) return;\n const undo = [];\n if (changes.css) {\n const s = document.createElement(\"style\");\n s.innerHTML = changes.css;\n document.head.appendChild(s);\n undo.push(() => s.remove());\n }\n if (changes.js) {\n const script = document.createElement(\"script\");\n script.innerHTML = changes.js;\n if (this._ctx.jsInjectionNonce) {\n script.nonce = this._ctx.jsInjectionNonce;\n }\n document.head.appendChild(script);\n undo.push(() => script.remove());\n }\n if (changes.domMutations) {\n changes.domMutations.forEach(mutation => {\n undo.push(mutate.declarative(mutation).revert);\n });\n }\n return () => {\n undo.forEach(fn => fn());\n };\n }\n _deriveStickyBucketIdentifierAttributes(data) {\n const attributes = new Set();\n const features = data && data.features ? data.features : this.getFeatures();\n const experiments = data && data.experiments ? data.experiments : this.getExperiments();\n Object.keys(features).forEach(id => {\n const feature = features[id];\n if (feature.rules) {\n for (const rule of feature.rules) {\n if (rule.variations) {\n attributes.add(rule.hashAttribute || \"id\");\n if (rule.fallbackAttribute) {\n attributes.add(rule.fallbackAttribute);\n }\n }\n }\n }\n });\n experiments.map(experiment => {\n attributes.add(experiment.hashAttribute || \"id\");\n if (experiment.fallbackAttribute) {\n attributes.add(experiment.fallbackAttribute);\n }\n });\n return Array.from(attributes);\n }\n async refreshStickyBuckets(data) {\n if (this._ctx.stickyBucketService) {\n const attributes = this._getStickyBucketAttributes(data);\n this._ctx.stickyBucketAssignmentDocs = await this._ctx.stickyBucketService.getAllAssignments(attributes);\n }\n }\n _getStickyBucketAssignments(expHashAttribute, expFallbackAttribute) {\n if (!this._ctx.stickyBucketAssignmentDocs) return {};\n const {\n hashAttribute,\n hashValue\n } = this._getHashAttribute(expHashAttribute);\n const hashKey = \"\".concat(hashAttribute, \"||\").concat(toString(hashValue));\n const {\n hashAttribute: fallbackAttribute,\n hashValue: fallbackValue\n } = this._getHashAttribute(expFallbackAttribute);\n const fallbackKey = fallbackValue ? \"\".concat(fallbackAttribute, \"||\").concat(toString(fallbackValue)) : null;\n const assignments = {};\n if (fallbackKey && this._ctx.stickyBucketAssignmentDocs[fallbackKey]) {\n Object.assign(assignments, this._ctx.stickyBucketAssignmentDocs[fallbackKey].assignments || {});\n }\n if (this._ctx.stickyBucketAssignmentDocs[hashKey]) {\n Object.assign(assignments, this._ctx.stickyBucketAssignmentDocs[hashKey].assignments || {});\n }\n return assignments;\n }\n _getStickyBucketVariation(_ref3) {\n let {\n expKey,\n expBucketVersion,\n expHashAttribute,\n expFallbackAttribute,\n expMinBucketVersion,\n expMeta\n } = _ref3;\n expBucketVersion = expBucketVersion || 0;\n expMinBucketVersion = expMinBucketVersion || 0;\n expHashAttribute = expHashAttribute || \"id\";\n expMeta = expMeta || [];\n const id = this._getStickyBucketExperimentKey(expKey, expBucketVersion);\n const assignments = this._getStickyBucketAssignments(expHashAttribute, expFallbackAttribute);\n\n // users with any blocked bucket version (0 to minExperimentBucketVersion) are excluded from the test\n if (expMinBucketVersion > 0) {\n for (let i = 0; i <= expMinBucketVersion; i++) {\n const blockedKey = this._getStickyBucketExperimentKey(expKey, i);\n if (assignments[blockedKey] !== undefined) {\n return {\n variation: -1,\n versionIsBlocked: true\n };\n }\n }\n }\n const variationKey = assignments[id];\n if (variationKey === undefined)\n // no assignment found\n return {\n variation: -1\n };\n const variation = expMeta.findIndex(m => m.key === variationKey);\n if (variation < 0)\n // invalid assignment, treat as \"no assignment found\"\n return {\n variation: -1\n };\n return {\n variation\n };\n }\n _getStickyBucketExperimentKey(experimentKey, experimentBucketVersion) {\n experimentBucketVersion = experimentBucketVersion || 0;\n return \"\".concat(experimentKey, \"__\").concat(experimentBucketVersion);\n }\n _getStickyBucketAttributes(data) {\n const attributes = {};\n this._ctx.stickyBucketIdentifierAttributes = !this._ctx.stickyBucketIdentifierAttributes ? this._deriveStickyBucketIdentifierAttributes(data) : this._ctx.stickyBucketIdentifierAttributes;\n this._ctx.stickyBucketIdentifierAttributes.forEach(attr => {\n const {\n hashValue\n } = this._getHashAttribute(attr);\n attributes[attr] = toString(hashValue);\n });\n return attributes;\n }\n _generateStickyBucketAssignmentDoc(attributeName, attributeValue, assignments) {\n const key = \"\".concat(attributeName, \"||\").concat(attributeValue);\n const existingAssignments = this._ctx.stickyBucketAssignmentDocs && this._ctx.stickyBucketAssignmentDocs[key] ? this._ctx.stickyBucketAssignmentDocs[key].assignments || {} : {};\n const newAssignments = {\n ...existingAssignments,\n ...assignments\n };\n const changed = JSON.stringify(existingAssignments) !== JSON.stringify(newAssignments);\n return {\n key,\n doc: {\n attributeName,\n attributeValue,\n assignments: newAssignments\n },\n changed\n };\n }\n}\nexport async function prefetchPayload(options) {\n // Create a temporary instance, just to fetch the payload\n const instance = new GrowthBook(options);\n await refreshFeatures({\n instance,\n skipCache: options.skipCache,\n allowStale: false,\n backgroundSync: options.streaming\n });\n instance.destroy();\n}\n//# sourceMappingURL=GrowthBook.mjs.map","import { GrowthBook } from '@growthbook/growthbook';\n\nexport interface FeatureI {\n active?: false; //default feature values, we only use the targeted ones\n start_date: string;\n start_time: string;\n end_date: string;\n end_time: string;\n position: string;\n template: Template;\n}\n\ninterface PageType {\n type: string;\n match: string;\n post_type: any[];\n post_premium: boolean;\n}\n\ninterface Template {\n [key: string]: string;\n}\n\nfunction log(...a: any[]) {\n if (location.search.includes('gb_debug')) {\n console.log(...a);\n }\n}\nexport class GrowthbookManager {\n private static readonly mainFolder = '\\\\wp-content\\\\themes\\\\observador-child\\\\Features\\\\Growthbook\\\\';\n private static readonly buildFolder = this.mainFolder + 'build\\\\';\n private static readonly cssBuild = this.buildFolder + 'css\\\\';\n private static readonly jsBuild = this.buildFolder + 'js\\\\';\n private static readonly templates = this.mainFolder + 'components\\\\html\\\\';\n\n private static _instance: GrowthBook;\n private static initStatus: {\n success: boolean;\n source: string;\n };\n\n public static getInitStatus() {\n return GrowthbookManager.initStatus;\n }\n\n static isFeatureActive(f: FeatureI) {\n if (!f || f.active === false) {\n return false;\n }\n\n const startDate = new Date(`${f.start_date} ${f.start_time}`);\n const endDate = new Date(`${f.end_date} ${f.end_time}`);\n const now = new Date();\n return !(startDate.getTime() > now.getTime() || endDate.getTime() < now.getTime());\n }\n static handleTemplateFeature(f: FeatureI) {\n if (!GrowthbookManager.isFeatureActive(f)) {\n return;\n }\n\n const templateContainer = document.querySelector(f.position);\n if (!templateContainer) {\n return;\n }\n\n const css = document.createElement('link');\n css.rel = 'stylesheet';\n css.href = `${GrowthbookManager.cssBuild}${f.template.file}.min.css?obs_version=${contextualData.assetsVersion}`;\n\n const js = document.createElement('script');\n js.type = 'text/javascript';\n js.src = `${GrowthbookManager.jsBuild}\\\\${f.template.file}.min.js?obs_version=${contextualData.assetsVersion}`;\n\n document.body.appendChild(css);\n document.body.appendChild(js);\n fetch(`${GrowthbookManager.templates}${f.template.file}.html?obs_version=${contextualData.assetsVersion}`).then(async res => {\n const htmlText = await res.text();\n const element = document.createElement('div');\n element.innerHTML = htmlText;\n\n const el = element.firstChild;\n //set all properties for the web component\n for (const p in f.template) {\n el[p] = f.template[p];\n }\n\n templateContainer.appendChild(el);\n });\n }\n\n public static async getInstance() {\n if (GrowthbookManager._instance) {\n return GrowthbookManager._instance;\n }\n GrowthbookManager._instance = new GrowthBook({\n apiHost: 'https://growthbook-api.observador.pt',\n clientKey: contextualData.GROWTHBOOK_KEY,\n enableDevMode: true,\n trackingCallback: (experiment, result) => {\n log('@@@Tracking', experiment, result);\n dataLayer.push({\n event: 'gb_experiment_exposure',\n experiment_id: experiment.key,\n variation_id: result.key,\n });\n },\n onFeatureUsage(key, res) {\n log('@@@FeatureUsage', key, res);\n //TODO if json feature type\n if (res.value.template) {\n GrowthbookManager.handleTemplateFeature(res.value);\n }\n },\n });\n\n const us = adamastor.getSubscriptionSettings();\n\n await GrowthbookManager._instance.setAttributes({\n user_browser_id: localStorage.getItem('qrbid') ?? '',\n url: window.location.pathname,\n logged_in: adamastor.isLoggedIn(),\n subscriber: adamastor.isSubscriber(),\n subscriptions_plans: adamastor.getSubscriptionsProductsIds(),\n engagement: GrowthbookManager.getUserEngagement(),\n zone_type: contextualData.pageTargeting?.zoneType,\n sub_zone_type: contextualData.pageTargeting?.subZoneType,\n post_type: contextualData?.pageTargeting?.postType,\n post_is_exclusive: contextualData?.pageTargeting?.exclusive,\n top_category: contextualData?.pageTargeting?.topCategory,\n category: contextualData?.pageTargeting?.category,\n device_category: GrowthbookManager.getDeviceCategory(),\n can_be_metered: GrowthbookManager.canBeMetered(),\n page_slug: contextualData?.pageTargeting?.pageSlug,\n id: adamastor?.getSessionProfile()?.sub ?? localStorage.getItem('qrbid') ?? '',\n can_comment: us.canComment,\n exclusive_articles: us.exclusiveArticles,\n exclusive_newsletters: us.exclusiveNewsletters,\n exclusive_opinion: us.exclusiveOpinion,\n exclusive_podcasts: us.exclusivePodcasts,\n less_pub: us.lessPub,\n max_offer_articles: us.maxOfferArticles,\n remove_pub: us.removePub,\n subscription_source: adamastor.getSessionProfile()?.subscription?.products?.[0]?.source ?? null,\n google_subscription_linked: adamastor.getSessionProfile()?.metadata?.find(item => item.name === 'subscriptionLinkingResult')?.value === \"true\",\n google_subscription_linked_show_date: Number(adamastor.getSessionProfile()?.metadata?.find(item => item.name === 'subscriptionLinkingDate')?.value) ?? null\n });\n\n GrowthbookManager.initStatus = await GrowthbookManager._instance.init();\n\n if (!GrowthbookManager.initStatus.success) {\n dataLayer.push({\n event: 'gb_init_error',\n });\n }\n\n return GrowthbookManager._instance;\n }\n\n static getUserEngagement() {\n const sum = articlesCounter.sum(4);\n if (sum <= 2) return 'user-engagement-low';\n if (sum >= 3 && sum <= 10) return 'user-engagement-medium';\n if (sum >= 11) return 'user-engagement-high';\n }\n\n static canBeMetered() {\n if (!contextualData.post) {\n return false;\n }\n\n if (document.body.classList.contains('force-no-premium')) {\n return false;\n }\n\n if (contextualData.post.isAnInitiative == true) {\n return false;\n }\n\n if (contextualData.post.iniativeMediaPartner == true) {\n return false;\n }\n\n const credits = contextualData.post.credits;\n\n if (credits.find(c => c.creditAuthorName === 'obslab') !== undefined) {\n return false;\n }\n\n switch (contextualData.post.postType) {\n case 'obs_opinion':\n return true;\n case 'obs_episode':\n case 'obs_bet':\n case 'obs_bet_brazil':\n case 'obs_liveblog':\n case 'obs_interactive':\n return false;\n default:\n if (credits.find(c => c.creditAuthorName === 'lusa') !== undefined) {\n return false;\n }\n\n /**\n * @type {Array}\n */\n const categories = contextualData.post.categories;\n if (categories.find(c => c === 'auto' || c === 'desporto' || c === 'lifestyle') !== undefined) {\n return false;\n }\n\n return true;\n }\n }\n\n static getDeviceCategory() {\n if (window.innerWidth < 768) return 'mobile';\n if (window.innerWidth >= 768 && window.innerWidth < 1024) return 'tablet';\n if (window.innerWidth >= 1024) return 'desktop';\n }\n}\n\n/**\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#sect3\n * */\ndocument.addEventListener('obsLoginCallback', async function initGrowthBook() {\n const gb = await GrowthbookManager.getInstance();\n // TODO Move the paywall responsability to the paywall component\n const features = gb.getFeatures();\n for (const f in features) {\n const fa = gb.evalFeature(f);\n if (f.includes('app')) {\n continue;\n }\n\n if (f.includes('paywall') && GrowthbookManager.isFeatureActive(fa.value)) {\n window.obs_tp.paywallTriggered = true;\n }\n if (f === 'paywall-metered' && GrowthbookManager.isFeatureActive(fa.value)) {\n window.obs_tp.paywallMetered = true;\n }\n }\n obs_ads.trigger('paywall');\n});\n"],"names":["validAttributeName","nullController","revert","Map","mutations","Set","getElementRecord","element","record","get","attributes","set","createElementPropertyRecord","el","attr","getCurrentValue","setValue","mutationRunner","currentValue","isDirty","originalValue","virtualValue","_positionTimeout","observer","MutationObserver","setTimeout","parentNode","insertBeforeNode","observe","childList","subtree","characterData","attributeFilter","getObserverInit","queueIfNeeded","val","currentVal","runDOMUpdates","htmlMutationRunner","forEach","m","mutate","html","transformContainer","document","createElement","innerHTML","getTransformedHTML","classMutationRunner","split","filter","Boolean","Array","from","join","attrMutationRunner","positionMutationRunner","newNodes","_ref","parentSelector","insertBeforeSelector","querySelector","_loadDOMNodes","getHTMLValue","setHTMLValue","value","getElementHTMLRecord","elementRecord","getElementPosition","parentElement","nextElementSibling","setElementPosition","contains","insertBefore","getElementPositionRecord","position","setClassValue","className","removeAttribute","getClassValue","getElementClassRecord","classes","getAttrValue","attrName","_el$getAttribute","getAttribute","setAttrValue","setAttribute","getElementAttributeRecord","setPropertyValue","length","_element$html","_element$html$observe","disconnect","_element$classes","_element$classes$obse","_element$position","_element$position$obs","_element$attributes","_element$attributes$a","_element$attributes$a2","deleteElementPropertyRecord","Object","keys","refreshElementsSet","mutation","kind","elements","size","existingElements","querySelectorAll","selector","has","add","attribute","push","startMutating","refreshAllElementSets","newMutation","index","indexOf","splice","stopMutating","clear","test","classnames","mutatedClassnames","c","documentElement","_ref2","action","polyfills","fetch","globalThis","bind","undefined","SubtleCrypto","crypto","subtle","EventSource","hashFnv32a","str","hval","l","i","charCodeAt","hash","seed","version","inRange","n","range","getUrlRegExp","regexString","escaped","replace","RegExp","e","console","error","isURLTargeted","url","targets","hasIncludeRules","isIncluded","match","_evalURLTarget","type","pattern","include","parsed","URL","regex","href","substring","origin","actual","expected","comps","host","pathname","searchParams","v","k","some","data","isPath","_evalSimpleUrlPart","_evalSimpleUrlTarget","base64ToBuf","b","Uint8Array","atob","async","decrypt","encryptedString","decryptionKey","Error","key","importKey","name","iv","cipherText","plainTextBuffer","TextDecoder","decode","input","JSON","stringify","paddedVersionString","parts","map","padStart","isObj","x","getAutoExperimentChangeType","exp","urlPatterns","variations","variation","domMutations","_regexCache","evalCondition","obj","condition","savedGroups","entries","evalOr","evalAnd","evalConditionValue","getPath","path","current","isArray","isOperatorObject","op","evalOperatorCondition","isIn","includes","operator","check","elemMatch","passed","j","t","getType","conditions","cacheSettings","staleTTL","maxAge","cacheKey","backgroundSync","maxEntries","disableIdleStreams","idleStreamInterval","disableCache","helpers","fetchFeaturesCall","clientKey","headers","concat","fetchRemoteEvalCall","payload","options","method","body","eventSourceCall","_ref3","startIdleListener","idleTimeout","window","onVisibilityChange","visibilityState","clearTimeout","streams","channel","state","enableChannel","onHidden","addEventListener","removeEventListener","stopIdleListener","localStorage","subscribedInstances","cacheInitialized","cache","activeFetches","supportsSSE","subscribe","instance","getKey","subs","disableChannel","updatePersistentCache","setItem","apiHost","getApiInfo","getCacheKey","baseKey","isRemoteEval","getAttributes","cacheKeyAttributes","getCacheKeyAttributes","ca","fv","getForcedVariations","getUrl","cleanupCache","entriesWithTimestamps","_ref7","staleAt","getTime","sort","a","entriesToRemoveCount","Math","min","max","delete","onNewFeatureData","dateUpdated","Date","now","existing","sse","instances","setPayload","getPayload","refreshInstance","fetchFeatures","apiRequestHeaders","getApiHosts","getClientKey","remoteEval","promise","forcedVariations","forcedFeatures","getForcedFeatures","then","res","ok","status","json","startAutoRefresh","success","source","catch","forceSSE","arguments","streamingHost","streamingHostRequestHeaders","src","cb","event","parse","errors","onSSEError","readyState","delay","pow","random","onopen","onerror","close","isBrowser","SDK_VERSION","loadSDKVersion","GrowthBook","constructor","context","this","_ctx","_renderer","renderer","_trackedExperiments","_completedChangeIds","_trackedFeatures","debug","_subscriptions","_rtQueue","_rtTimer","ready","_assigned","_forcedFeatureValues","_attributeOverrides","_activeAutoExperiments","_triggeredExpKeys","_initialized","_redirectedUrl","_deferredTrackingCalls","_autoExperimentsAllowed","disableExperimentsOnLoad","isGbHost","hostname","features","enableDevMode","_growthbook","dispatchEvent","Event","experiments","_updateAllAutoExperiments","antiFlicker","_setAntiFlicker","stickyBucketService","stickyBucketAssignmentDocs","doc","saveAssignments","refreshStickyBuckets","_payload","decryptPayload","_decryptedPayload","_render","initSync","encryptedExperiments","encryptedFeatures","streaming","_refresh","allowStale","autoRefresh","subscribeToChanges","_canSubscribe","defaultHost","apiHostRequestHeaders","getFeatures","getExperiments","getDecryptedPayload","timeout","skipCache","_ref4","_ref5","minStaleAt","getItem","_ref6","cleanupFn","initializeCache","Promise","resolve","timer","resolved","finish","promiseTimeout","fetchFeaturesWithCache","setFeatures","featuresJSON","setExperiments","experimentsJSON","encryptedSavedGroups","_refreshForRemoteEval","setAttributes","overrides","vars","setForcedFeatures","getStickyBucketAssignmentDocs","getCompletedChangeIds","_this$_ctx$background","getAllResults","destroy","s","undo","setRenderer","forceVariation","run","experiment","result","_run","_fireSubscriptions","triggerExperiment","_runAutoExperiment","triggerAutoExperiments","forceRerun","manual","_isAutoExperimentBlockedByContext","_getResult","valueHash","inExperiment","_undoActiveAutoExperiment","changeType","urlRedirect","persistQueryString","oldUrl","newUrl","currUrl","redirectUrl","toString","mergeQueryStrings","_getContextUrl","log","id","navigate","_getNavigateFunction","_this$_ctx$navigateDe","navigateDelay","applyDomChangesCallback","_applyDOMChanges","prev","variationId","_trackFeatureUsage","stringifiedValue","onFeatureUsage","on","q","realtimeKey","encodeURIComponent","mode","realtimeInterval","_getFeatureResult","ruleId","ret","off","experimentResult","isOn","evalFeature","isOff","getFeatureValue","defaultValue","feature","_evalFeature","evalCtx","evaluatedFeatures","rules","rule","parentConditions","parentCondition","parentResult","gate","filters","_isFilteredOut","_conditionPasses","_isIncludedInRollout","hashAttribute","disableStickyBucketing","fallbackAttribute","coverage","hashVersion","tracks","_track","force","weights","bucketVersion","minBucketVersion","namespace","meta","ranges","phase","passthrough","hashValue","_getHashAttribute","r","featureId","numVariations","enabled","_mergeOverrides","qsOverride","search","kv","parseInt","getQueryStringOverride","active","assigned","foundStickyBucket","stickyBucketVersionIsBlocked","versionIsBlocked","_getStickyBucketVariation","expKey","expBucketVersion","expHashAttribute","expFallbackAttribute","expMinBucketVersion","expMeta","inNamespace","groups","_hasGroupOverlap","_urlIsValid","chooseVariation","equal","fill","totalWeight","reduce","w","sum","cumulative","start","getBucketRanges","qaMode","changed","attrKey","_generateStickyBucketAssignmentDoc","_getStickyBucketExperimentKey","changeId","msg","ctx","getDeferredTrackingCalls","values","setDeferredTrackingCalls","calls","_getTrackKey","fireDeferredTrackingCalls","trackingCallback","call","setTrackingCallback","callback","o","assign","fallback","user","variationIndex","hashUsed","bucket","stickyBucketUsed","location","urlRegex","pathOnly","expGroups","disableVisualExperiments","disableJsInjection","js","disableUrlRedirectExperiments","disableCrossOriginUrlRedirectExperiments","protocol","blockedChangeIds","getRedirectUrl","_this$_ctx$antiFlicke","styleTag","head","appendChild","classList","remove","antiFlickerTimeout","changes","css","script","jsInjectionNonce","nonce","fn","_deriveStickyBucketIdentifierAttributes","_getStickyBucketAttributes","getAllAssignments","_getStickyBucketAssignments","hashKey","fallbackValue","fallbackKey","assignments","variationKey","findIndex","experimentKey","experimentBucketVersion","stickyBucketIdentifierAttributes","attributeName","attributeValue","existingAssignments","newAssignments","initStatus","static","f","startDate","start_date","start_time","endDate","end_date","end_time","isFeatureActive","templateContainer","rel","cssBuild","template","file","contextualData","assetsVersion","jsBuild","templates","htmlText","text","firstChild","p","_instance","GROWTHBOOK_KEY","dataLayer","experiment_id","variation_id","handleTemplateFeature","us","adamastor","getSubscriptionSettings","user_browser_id","logged_in","isLoggedIn","subscriber","isSubscriber","subscriptions_plans","getSubscriptionsProductsIds","engagement","getUserEngagement","zone_type","pageTargeting","zoneType","sub_zone_type","subZoneType","post_type","postType","post_is_exclusive","exclusive","top_category","topCategory","category","device_category","getDeviceCategory","can_be_metered","canBeMetered","page_slug","pageSlug","getSessionProfile","sub","can_comment","canComment","exclusive_articles","exclusiveArticles","exclusive_newsletters","exclusiveNewsletters","exclusive_opinion","exclusiveOpinion","exclusive_podcasts","exclusivePodcasts","less_pub","lessPub","max_offer_articles","maxOfferArticles","remove_pub","removePub","subscription_source","subscription","products","google_subscription_linked","metadata","find","item","google_subscription_linked_show_date","Number","init","articlesCounter","post","isAnInitiative","iniativeMediaPartner","credits","creditAuthorName","categories","innerWidth","GrowthbookManager","mainFolder","buildFolder","gb","getInstance","fa","obs_tp","paywallTriggered","paywallMetered","obs_ads","trigger"],"sourceRoot":""}