posthog-js 1.232.6 → 1.232.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/all-external-dependencies.js.map +1 -1
  2. package/dist/array.full.es5.js +1 -1
  3. package/dist/array.full.es5.js.map +1 -1
  4. package/dist/array.full.js +1 -1
  5. package/dist/array.full.js.map +1 -1
  6. package/dist/array.full.no-external.js +1 -1
  7. package/dist/array.full.no-external.js.map +1 -1
  8. package/dist/array.js +1 -1
  9. package/dist/array.js.map +1 -1
  10. package/dist/array.no-external.js +1 -1
  11. package/dist/array.no-external.js.map +1 -1
  12. package/dist/customizations.full.js +1 -1
  13. package/dist/main.js +1 -1
  14. package/dist/main.js.map +1 -1
  15. package/dist/module.d.ts +29 -1
  16. package/dist/module.full.d.ts +29 -1
  17. package/dist/module.full.js +1 -1
  18. package/dist/module.full.js.map +1 -1
  19. package/dist/module.full.no-external.d.ts +29 -1
  20. package/dist/module.full.no-external.js +1 -1
  21. package/dist/module.full.no-external.js.map +1 -1
  22. package/dist/module.js +1 -1
  23. package/dist/module.js.map +1 -1
  24. package/dist/module.no-external.d.ts +29 -1
  25. package/dist/module.no-external.js +1 -1
  26. package/dist/module.no-external.js.map +1 -1
  27. package/dist/src/posthog-core.d.ts +1 -0
  28. package/dist/src/posthog-surveys-types.d.ts +4 -1
  29. package/dist/src/posthog-surveys.d.ts +24 -0
  30. package/dist/surveys-preview.d.ts +29 -1
  31. package/dist/surveys-preview.js.map +1 -1
  32. package/dist/surveys.js.map +1 -1
  33. package/lib/package.json +1 -1
  34. package/lib/src/posthog-core.d.ts +1 -0
  35. package/lib/src/posthog-core.js +17 -0
  36. package/lib/src/posthog-core.js.map +1 -1
  37. package/lib/src/posthog-surveys-types.d.ts +4 -1
  38. package/lib/src/posthog-surveys-types.js.map +1 -1
  39. package/lib/src/posthog-surveys.d.ts +24 -0
  40. package/lib/src/posthog-surveys.js +104 -6
  41. package/lib/src/posthog-surveys.js.map +1 -1
  42. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"all-external-dependencies.js","sources":["../node_modules/.pnpm/@rrweb+record@2.0.0-alpha.17_patch_hash=46frarym7rupyfspsu67b3afhe/node_modules/@rrweb/record/dist/record.js","../node_modules/.pnpm/@rrweb+rrweb-plugin-console-record@2.0.0-alpha.17_patch_hash=ytsspyi7p3hvqcq64vqb7wb6bu_rrweb@2.0.0-alpha.17/node_modules/@rrweb/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.js","../src/utils/globals.ts","../src/types.ts","../src/utils/string-utils.ts","../src/utils/type-utils.ts","../src/utils/logger.ts","../src/utils/index.ts","../src/utils/request-utils.ts","../src/extensions/replay/rrweb-plugins/patch.ts","../src/extensions/replay/external/denylist.ts","../src/constants.ts","../src/utils/element-utils.ts","../src/autocapture-utils.ts","../src/extensions/replay/config.ts","../src/extensions/replay/external/network-plugin.ts","../src/entrypoints/recorder.ts","../src/posthog-surveys-types.ts","../node_modules/.pnpm/preact@10.19.3/node_modules/preact/dist/preact.module.js","../src/extensions/utils/stylesheet-loader.ts","../src/extensions/surveys/surveys-utils.tsx","../src/utils/event-utils.ts","../src/utils/regex-utils.ts","../src/utils/simple-event-emitter.ts","../src/extensions/surveys/action-matcher.ts","../src/utils/survey-event-receiver.ts","../src/posthog-surveys.ts","../node_modules/.pnpm/preact@10.19.3/node_modules/preact/hooks/dist/hooks.module.js","../src/extensions/surveys-widget.ts","../src/extensions/surveys/icons.tsx","../src/extensions/surveys/components/PostHogLogo.tsx","../src/extensions/surveys/components/BottomSection.tsx","../src/extensions/surveys/components/QuestionHeader.tsx","../src/extensions/surveys/components/ConfirmationMessage.tsx","../src/extensions/surveys/hooks/useContrastingTextColor.ts","../src/extensions/surveys/components/QuestionTypes.tsx","../src/extensions/surveys.tsx","../src/extensions/exception-autocapture/type-checking.ts","../src/entrypoints/surveys.ts","../src/extensions/exception-autocapture/stack-trace.ts","../src/extensions/exception-autocapture/chunk-ids.ts","../src/extensions/exception-autocapture/error-conversion.ts","../src/entrypoints/exception-autocapture.ts","../src/entrypoints/tracing-headers.ts","../node_modules/.pnpm/web-vitals@4.2.4/node_modules/web-vitals/dist/web-vitals.attribution.js","../src/entrypoints/web-vitals.ts","../src/autocapture.ts","../src/utils/prototype-utils.ts","../src/entrypoints/dead-clicks-autocapture.ts"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar _a;\nvar __defProp$1 = Object.defineProperty;\nvar __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar NodeType$2 = /* @__PURE__ */ ((NodeType2) => {\n NodeType2[NodeType2[\"Document\"] = 0] = \"Document\";\n NodeType2[NodeType2[\"DocumentType\"] = 1] = \"DocumentType\";\n NodeType2[NodeType2[\"Element\"] = 2] = \"Element\";\n NodeType2[NodeType2[\"Text\"] = 3] = \"Text\";\n NodeType2[NodeType2[\"CDATA\"] = 4] = \"CDATA\";\n NodeType2[NodeType2[\"Comment\"] = 5] = \"Comment\";\n return NodeType2;\n})(NodeType$2 || {});\nconst testableAccessors$1 = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods$1 = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\n\n/*\nAngular zone patches many things and can pass the untainted checks below, causing performance issues\nAngular zone, puts the unpatched originals on the window, and the names for hose on the zone object.\nSo, we get the unpatched versions from the window object if they exist.\nYou can rename Zone, but this is a good enough proxy to avoid going to an iframe to get the untainted versions.\nsee: https://github.com/angular/angular/issues/26948\n*/\nfunction angularZoneUnpatchedAlternative(key) {\n const angularUnpatchedVersionSymbol = (\n globalThis\n )?.Zone?.__symbol__?.(key);\n if (\n angularUnpatchedVersionSymbol &&\n (globalThis)[angularUnpatchedVersionSymbol]\n ) {\n return (globalThis)[\n angularUnpatchedVersionSymbol\n ];\n } else {\n return undefined;\n }\n}\n\nconst untaintedBasePrototype$1 = {};\nfunction getUntaintedPrototype$1(key) {\n if (untaintedBasePrototype$1[key])\n return untaintedBasePrototype$1[key];\n const defaultObj = angularZoneUnpatchedAlternative(key) || globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a2, _b;\n return Boolean(\n (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a2;\n return typeof defaultPrototype[method] === \"function\" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods) {\n untaintedBasePrototype$1[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultObj.prototype;\n return untaintedBasePrototype$1[key] = untaintedObject;\n } catch {\n return defaultObj.prototype;\n }\n}\nconst untaintedAccessorCache$1 = {};\nfunction getUntaintedAccessor$1(key, instance, accessor) {\n var _a2;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache$1[cacheKey])\n return untaintedAccessorCache$1[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype$1(key);\n const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a2.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache$1[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache$1 = {};\nfunction getUntaintedMethod$1(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache$1[cacheKey])\n return untaintedMethodCache$1[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype$1(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache$1[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"childNodes\");\n}\nfunction parentNode$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"parentNode\");\n}\nfunction parentElement$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"parentElement\");\n}\nfunction textContent$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"textContent\");\n}\nfunction contains$1(n2, other) {\n return getUntaintedMethod$1(\"Node\", n2, \"contains\")(other);\n}\nfunction getRootNode$1(n2) {\n return getUntaintedMethod$1(\"Node\", n2, \"getRootNode\")();\n}\nfunction host$1(n2) {\n if (!n2 || !(\"host\" in n2)) return null;\n return getUntaintedAccessor$1(\"ShadowRoot\", n2, \"host\");\n}\nfunction styleSheets$1(n2) {\n return n2.styleSheets;\n}\nfunction shadowRoot$1(n2) {\n if (!n2 || !(\"shadowRoot\" in n2)) return null;\n return getUntaintedAccessor$1(\"Element\", n2, \"shadowRoot\");\n}\nfunction querySelector$1(n2, selectors) {\n return getUntaintedAccessor$1(\"Element\", n2, \"querySelector\")(selectors);\n}\nfunction querySelectorAll$1(n2, selectors) {\n return getUntaintedAccessor$1(\"Element\", n2, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor$1() {\n return getUntaintedPrototype$1(\"MutationObserver\").constructor;\n}\nconst index$1 = {\n childNodes: childNodes$1,\n parentNode: parentNode$1,\n parentElement: parentElement$1,\n textContent: textContent$1,\n contains: contains$1,\n getRootNode: getRootNode$1,\n host: host$1,\n styleSheets: styleSheets$1,\n shadowRoot: shadowRoot$1,\n querySelector: querySelector$1,\n querySelectorAll: querySelectorAll$1,\n mutationObserver: mutationObserverCtor$1\n};\nfunction isElement(n2) {\n return n2.nodeType === n2.ELEMENT_NODE;\n}\nfunction isShadowRoot(n2) {\n const hostEl = (\n // anchor and textarea elements also have a `host` property\n // but only shadow roots have a `mode` property\n n2 && \"host\" in n2 && \"mode\" in n2 && index$1.host(n2) || null\n );\n return Boolean(\n hostEl && \"shadowRoot\" in hostEl && index$1.shadowRoot(hostEl) === n2\n );\n}\nfunction isNativeShadowDom(shadowRoot2) {\n return Object.prototype.toString.call(shadowRoot2) === \"[object ShadowRoot]\";\n}\nfunction fixBrowserCompatibilityIssuesInCSS(cssText) {\n if (cssText.includes(\" background-clip: text;\") && !cssText.includes(\" -webkit-background-clip: text;\")) {\n cssText = cssText.replace(\n /\\sbackground-clip:\\s*text;/g,\n \" -webkit-background-clip: text; background-clip: text;\"\n );\n }\n return cssText;\n}\nfunction escapeImportStatement(rule2) {\n const { cssText } = rule2;\n if (cssText.split('\"').length < 3) return cssText;\n const statement = [\"@import\", `url(${JSON.stringify(rule2.href)})`];\n if (rule2.layerName === \"\") {\n statement.push(`layer`);\n } else if (rule2.layerName) {\n statement.push(`layer(${rule2.layerName})`);\n }\n if (rule2.supportsText) {\n statement.push(`supports(${rule2.supportsText})`);\n }\n if (rule2.media.length) {\n statement.push(rule2.media.mediaText);\n }\n return statement.join(\" \") + \";\";\n}\nfunction stringifyStylesheet(s2) {\n try {\n const rules2 = s2.rules || s2.cssRules;\n if (!rules2) {\n return null;\n }\n const stringifiedRules = Array.from(\n rules2,\n (rule2) => stringifyRule(rule2, s2.href)\n ).join(\"\");\n return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);\n } catch (error) {\n return null;\n }\n}\nfunction stringifyRule(rule2, sheetHref) {\n if (isCSSImportRule(rule2)) {\n let importStringified;\n try {\n importStringified = // for same-origin stylesheets,\n // we can access the imported stylesheet rules directly\n stringifyStylesheet(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement\n escapeImportStatement(rule2);\n } catch (error) {\n importStringified = rule2.cssText;\n }\n if (rule2.styleSheet.href) {\n return absolutifyURLs(importStringified, rule2.styleSheet.href);\n }\n return importStringified;\n } else {\n let ruleStringified = rule2.cssText;\n if (isCSSStyleRule(rule2) && rule2.selectorText.includes(\":\")) {\n ruleStringified = fixSafariColons(ruleStringified);\n }\n if (sheetHref) {\n return absolutifyURLs(ruleStringified, sheetHref);\n }\n return ruleStringified;\n }\n}\nfunction fixSafariColons(cssStringified) {\n const regex = /(\\[(?:[\\w-]+)[^\\\\])(:(?:[\\w-]+)\\])/gm;\n return cssStringified.replace(regex, \"$1\\\\$2\");\n}\nfunction isCSSImportRule(rule2) {\n return \"styleSheet\" in rule2;\n}\nfunction isCSSStyleRule(rule2) {\n return \"selectorText\" in rule2;\n}\nfunction findStylesheet(doc, href) {\n return Array.from(doc.styleSheets).find((s) => s.href === href);\n}\nclass Mirror {\n constructor() {\n __publicField$1(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField$1(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n2) {\n var _a2;\n if (!n2) return -1;\n const id = (_a2 = this.getMeta(n2)) == null ? void 0 : _a2.id;\n return id ?? -1;\n }\n getNode(id) {\n return this.idNodeMap.get(id) || null;\n }\n getIds() {\n return Array.from(this.idNodeMap.keys());\n }\n getMeta(n2) {\n return this.nodeMetaMap.get(n2) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n2) {\n const id = this.getId(n2);\n this.idNodeMap.delete(id);\n if (n2.childNodes) {\n n2.childNodes.forEach(\n (childNode) => this.removeNodeFromMap(childNode)\n );\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node2) {\n return this.nodeMetaMap.has(node2);\n }\n add(n2, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n2);\n this.nodeMetaMap.set(n2, meta);\n }\n replace(id, n2) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n2, meta);\n }\n this.idNodeMap.set(id, n2);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction createMirror$2() {\n return new Mirror();\n}\nfunction maskInputValue({\n element,\n maskInputOptions,\n tagName,\n type,\n value,\n maskInputFn\n}) {\n let text = value || \"\";\n const actualType = type && toLowerCase(type);\n if (maskInputOptions[tagName.toLowerCase()] || actualType && maskInputOptions[actualType]) {\n if (maskInputFn) {\n text = maskInputFn(text, element);\n } else {\n text = \"*\".repeat(text.length);\n }\n }\n return text;\n}\nfunction toLowerCase(str) {\n return str.toLowerCase();\n}\nconst ORIGINAL_ATTRIBUTE_NAME = \"__rrweb_original__\";\nfunction is2DCanvasBlank(canvas) {\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return true;\n const chunkSize = 50;\n for (let x2 = 0; x2 < canvas.width; x2 += chunkSize) {\n for (let y = 0; y < canvas.height; y += chunkSize) {\n const getImageData = ctx.getImageData;\n const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;\n const pixelBuffer = new Uint32Array(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n originalGetImageData.call(\n ctx,\n x2,\n y,\n Math.min(chunkSize, canvas.width - x2),\n Math.min(chunkSize, canvas.height - y)\n ).data.buffer\n );\n if (pixelBuffer.some((pixel) => pixel !== 0)) return false;\n }\n }\n return true;\n}\nfunction getInputType(element) {\n const type = element.type;\n return element.hasAttribute(\"data-rr-is-password\") ? \"password\" : type ? (\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n toLowerCase(type)\n ) : null;\n}\nfunction extractFileExtension(path, baseURL) {\n let url;\n try {\n url = new URL(path, baseURL ?? window.location.href);\n } catch (err) {\n return null;\n }\n const regex = /\\.([0-9a-z]+)(?:$)/i;\n const match = url.pathname.match(regex);\n return (match == null ? void 0 : match[1]) ?? null;\n}\nfunction extractOrigin(url) {\n let origin = \"\";\n if (url.indexOf(\"//\") > -1) {\n origin = url.split(\"/\").slice(0, 3).join(\"/\");\n } else {\n origin = url.split(\"/\")[0];\n }\n origin = origin.split(\"?\")[0];\n return origin;\n}\nconst URL_IN_CSS_REF = /url\\((?:(')([^']*)'|(\")(.*?)\"|([^)]*))\\)/gm;\nconst URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\\/\\//i;\nconst URL_WWW_MATCH = /^www\\..*/i;\nconst DATA_URI = /^(data:)([^,]*),(.*)/i;\nfunction absolutifyURLs(cssText, href) {\n return (cssText || \"\").replace(\n URL_IN_CSS_REF,\n (origin, quote1, path1, quote2, path2, path3) => {\n const filePath = path1 || path2 || path3;\n const maybeQuote = quote1 || quote2 || \"\";\n if (!filePath) {\n return origin;\n }\n if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {\n return `url(${maybeQuote}${filePath}${maybeQuote})`;\n }\n if (DATA_URI.test(filePath)) {\n return `url(${maybeQuote}${filePath}${maybeQuote})`;\n }\n if (filePath[0] === \"/\") {\n return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;\n }\n const stack = href.split(\"/\");\n const parts = filePath.split(\"/\");\n stack.pop();\n for (const part of parts) {\n if (part === \".\") {\n continue;\n } else if (part === \"..\") {\n stack.pop();\n } else {\n stack.push(part);\n }\n }\n return `url(${maybeQuote}${stack.join(\"/\")}${maybeQuote})`;\n }\n );\n}\nlet _id = 1;\nconst tagNameRegex = new RegExp(\"[^a-z0-9-_:]\");\nconst IGNORED_NODE = -2;\nfunction genId() {\n return _id++;\n}\nfunction getValidTagName$1(element) {\n if (element instanceof HTMLFormElement) {\n return \"form\";\n }\n const processedTagName = toLowerCase(element.tagName);\n if (tagNameRegex.test(processedTagName)) {\n return \"div\";\n }\n return processedTagName;\n}\nlet canvasService;\nlet canvasCtx;\nconst SRCSET_NOT_SPACES = /^[^ \\t\\n\\r\\u000c]+/;\nconst SRCSET_COMMAS_OR_SPACES = /^[, \\t\\n\\r\\u000c]+/;\nfunction getAbsoluteSrcsetString(doc, attributeValue) {\n if (attributeValue.trim() === \"\") {\n return attributeValue;\n }\n let pos = 0;\n function collectCharacters(regEx) {\n let chars2;\n const match = regEx.exec(attributeValue.substring(pos));\n if (match) {\n chars2 = match[0];\n pos += chars2.length;\n return chars2;\n }\n return \"\";\n }\n const output = [];\n while (true) {\n collectCharacters(SRCSET_COMMAS_OR_SPACES);\n if (pos >= attributeValue.length) {\n break;\n }\n let url = collectCharacters(SRCSET_NOT_SPACES);\n if (url.slice(-1) === \",\") {\n url = absoluteToDoc(doc, url.substring(0, url.length - 1));\n output.push(url);\n } else {\n let descriptorsStr = \"\";\n url = absoluteToDoc(doc, url);\n let inParens = false;\n while (true) {\n const c2 = attributeValue.charAt(pos);\n if (c2 === \"\") {\n output.push((url + descriptorsStr).trim());\n break;\n } else if (!inParens) {\n if (c2 === \",\") {\n pos += 1;\n output.push((url + descriptorsStr).trim());\n break;\n } else if (c2 === \"(\") {\n inParens = true;\n }\n } else {\n if (c2 === \")\") {\n inParens = false;\n }\n }\n descriptorsStr += c2;\n pos += 1;\n }\n }\n }\n return output.join(\", \");\n}\nconst cachedDocument = /* @__PURE__ */ new WeakMap();\nfunction absoluteToDoc(doc, attributeValue) {\n if (!attributeValue || attributeValue.trim() === \"\") {\n return attributeValue;\n }\n return getHref(doc, attributeValue);\n}\nfunction isSVGElement(el) {\n return Boolean(el.tagName === \"svg\" || el.ownerSVGElement);\n}\nfunction getHref(doc, customHref) {\n let a2 = cachedDocument.get(doc);\n if (!a2) {\n a2 = doc.createElement(\"a\");\n cachedDocument.set(doc, a2);\n }\n if (!customHref) {\n customHref = \"\";\n } else if (customHref.startsWith(\"blob:\") || customHref.startsWith(\"data:\")) {\n return customHref;\n }\n a2.setAttribute(\"href\", customHref);\n return a2.href;\n}\nfunction transformAttribute(doc, tagName, name, value) {\n if (!value) {\n return value;\n }\n if (name === \"src\" || name === \"href\" && !(tagName === \"use\" && value[0] === \"#\")) {\n return absoluteToDoc(doc, value);\n } else if (name === \"xlink:href\" && value[0] !== \"#\") {\n return absoluteToDoc(doc, value);\n } else if (name === \"background\" && (tagName === \"table\" || tagName === \"td\" || tagName === \"th\")) {\n return absoluteToDoc(doc, value);\n } else if (name === \"srcset\") {\n return getAbsoluteSrcsetString(doc, value);\n } else if (name === \"style\") {\n return absolutifyURLs(value, getHref(doc));\n } else if (tagName === \"object\" && name === \"data\") {\n return absoluteToDoc(doc, value);\n }\n return value;\n}\nfunction ignoreAttribute(tagName, name, _value) {\n return (tagName === \"video\" || tagName === \"audio\") && name === \"autoplay\";\n}\nfunction _isBlockedElement(element, blockClass, blockSelector) {\n try {\n if (typeof blockClass === \"string\") {\n if (element.classList.contains(blockClass)) {\n return true;\n }\n } else {\n for (let eIndex = element.classList.length; eIndex--; ) {\n const className = element.classList[eIndex];\n if (blockClass.test(className)) {\n return true;\n }\n }\n }\n if (blockSelector) {\n return element.matches(blockSelector);\n }\n } catch (e2) {\n }\n return false;\n}\nfunction classMatchesRegex(node2, regex, checkAncestors) {\n if (!node2) return false;\n if (node2.nodeType !== node2.ELEMENT_NODE) {\n if (!checkAncestors) return false;\n return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);\n }\n for (let eIndex = node2.classList.length; eIndex--; ) {\n const className = node2.classList[eIndex];\n if (regex.test(className)) {\n return true;\n }\n }\n if (!checkAncestors) return false;\n return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);\n}\nfunction needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors) {\n let el;\n if (isElement(node2)) {\n el = node2;\n if (!index$1.childNodes(el).length) {\n return false;\n }\n } else if (index$1.parentElement(node2) === null) {\n return false;\n } else {\n el = index$1.parentElement(node2);\n }\n try {\n if (typeof maskTextClass === \"string\") {\n if (checkAncestors) {\n if (el.closest(`.${maskTextClass}`)) return true;\n } else {\n if (el.classList.contains(maskTextClass)) return true;\n }\n } else {\n if (classMatchesRegex(el, maskTextClass, checkAncestors)) return true;\n }\n if (maskTextSelector) {\n if (checkAncestors) {\n if (el.closest(maskTextSelector)) return true;\n } else {\n if (el.matches(maskTextSelector)) return true;\n }\n }\n } catch (e2) {\n }\n return false;\n}\nfunction onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {\n const win = iframeEl.contentWindow;\n if (!win) {\n return;\n }\n let fired = false;\n let readyState;\n try {\n readyState = win.document.readyState;\n } catch (error) {\n return;\n }\n if (readyState !== \"complete\") {\n const timer = setTimeout(() => {\n if (!fired) {\n listener();\n fired = true;\n }\n }, iframeLoadTimeout);\n iframeEl.addEventListener(\"load\", () => {\n clearTimeout(timer);\n fired = true;\n listener();\n });\n return;\n }\n const blankUrl = \"about:blank\";\n if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === \"\") {\n setTimeout(listener, 0);\n return iframeEl.addEventListener(\"load\", listener);\n }\n iframeEl.addEventListener(\"load\", listener);\n}\nfunction onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {\n let fired = false;\n let styleSheetLoaded;\n try {\n styleSheetLoaded = link.sheet;\n } catch (error) {\n return;\n }\n if (styleSheetLoaded) return;\n const timer = setTimeout(() => {\n if (!fired) {\n listener();\n fired = true;\n }\n }, styleSheetLoadTimeout);\n link.addEventListener(\"load\", () => {\n clearTimeout(timer);\n fired = true;\n listener();\n });\n}\nfunction serializeNode(n2, options) {\n const {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n inlineStylesheet,\n maskInputOptions = {},\n maskTextFn,\n maskInputFn,\n dataURLOptions = {},\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement = false\n } = options;\n const rootId = getRootId(doc, mirror2);\n switch (n2.nodeType) {\n case n2.DOCUMENT_NODE:\n if (n2.compatMode !== \"CSS1Compat\") {\n return {\n type: NodeType$2.Document,\n childNodes: [],\n compatMode: n2.compatMode\n // probably \"BackCompat\"\n };\n } else {\n return {\n type: NodeType$2.Document,\n childNodes: []\n };\n }\n case n2.DOCUMENT_TYPE_NODE:\n return {\n type: NodeType$2.DocumentType,\n name: n2.name,\n publicId: n2.publicId,\n systemId: n2.systemId,\n rootId\n };\n case n2.ELEMENT_NODE:\n return serializeElementNode(n2, {\n doc,\n blockClass,\n blockSelector,\n inlineStylesheet,\n maskInputOptions,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement,\n rootId\n });\n case n2.TEXT_NODE:\n return serializeTextNode(n2, {\n doc,\n needsMask,\n maskTextFn,\n rootId\n });\n case n2.CDATA_SECTION_NODE:\n return {\n type: NodeType$2.CDATA,\n textContent: \"\",\n rootId\n };\n case n2.COMMENT_NODE:\n return {\n type: NodeType$2.Comment,\n textContent: index$1.textContent(n2) || \"\",\n rootId\n };\n default:\n return false;\n }\n}\nfunction getRootId(doc, mirror2) {\n if (!mirror2.hasNode(doc)) return void 0;\n const docId = mirror2.getId(doc);\n return docId === 1 ? void 0 : docId;\n}\nfunction serializeTextNode(n2, options) {\n var _a2;\n const { needsMask, maskTextFn, rootId } = options;\n const parent = index$1.parentNode(n2);\n const parentTagName = parent && parent.tagName;\n let text = index$1.textContent(n2);\n const isStyle = parentTagName === \"STYLE\" ? true : void 0;\n const isScript = parentTagName === \"SCRIPT\" ? true : void 0;\n if (isStyle && text) {\n try {\n if (n2.nextSibling || n2.previousSibling) {\n } else if ((_a2 = parent.sheet) == null ? void 0 : _a2.cssRules) {\n text = stringifyStylesheet(parent.sheet);\n }\n } catch (err) {\n console.warn(\n `Cannot get CSS styles from text's parentNode. Error: ${err}`,\n n2\n );\n }\n text = absolutifyURLs(text, getHref(options.doc));\n }\n if (isScript) {\n text = \"SCRIPT_PLACEHOLDER\";\n }\n if (!isStyle && !isScript && text && needsMask) {\n text = maskTextFn ? maskTextFn(text, index$1.parentElement(n2)) : text.replace(/[\\S]/g, \"*\");\n }\n return {\n type: NodeType$2.Text,\n textContent: text || \"\",\n isStyle,\n rootId\n };\n}\n\n/**\n * in production, we've seen elements like\n * `<link type=\"text/css\" rel=\"stylesheet\" id=\"dark-mode-custom-link\"></link>`\n * while HTMLLinkElement suggests an href is always present\n * the w3c spec is less specific\n * and regardless we've seen at least one instance of this in the wild\n * let's be defensive and make sure this is typed as possibly undefined\n */\nfunction hrefFrom(n) {\n return n?.href;\n}\n\nfunction serializeElementNode(n2, options) {\n const {\n doc,\n blockClass,\n blockSelector,\n inlineStylesheet,\n maskInputOptions = {},\n maskInputFn,\n dataURLOptions = {},\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement = false,\n rootId\n } = options;\n const needBlock = _isBlockedElement(n2, blockClass, blockSelector);\n const tagName = getValidTagName$1(n2);\n let attributes = {};\n const len = n2.attributes.length;\n for (let i2 = 0; i2 < len; i2++) {\n const attr = n2.attributes[i2];\n if (!ignoreAttribute(tagName, attr.name, attr.value)) {\n attributes[attr.name] = transformAttribute(\n doc,\n tagName,\n toLowerCase(attr.name),\n attr.value\n );\n }\n }\n if (tagName === \"link\" && inlineStylesheet) {\n const href = hrefFrom(n2);\n if (href) {\n let stylesheet = findStylesheet(doc, href);\n if (!stylesheet && href.includes('.css')) {\n const rootDomain = window.location.origin;\n const stylesheetPath = href.replace(window.location.href, '');\n const potentialStylesheetHref = rootDomain + '/' + stylesheetPath;\n stylesheet = findStylesheet(doc, potentialStylesheetHref);\n }\n let cssText = null;\n if (stylesheet) {\n cssText = stringifyStylesheet(stylesheet);\n }\n if (cssText) {\n delete attributes.rel;\n delete attributes.href;\n attributes._cssText = cssText;\n }\n }\n }\n if (tagName === \"style\" && n2.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element\n !(n2.innerText || index$1.textContent(n2) || \"\").trim().length) {\n const cssText = stringifyStylesheet(\n n2.sheet\n );\n if (cssText) {\n attributes._cssText = cssText;\n }\n }\n if (tagName === \"input\" || tagName === \"textarea\" || tagName === \"select\") {\n const value = n2.value;\n const checked = n2.checked;\n if (attributes.type !== \"radio\" && attributes.type !== \"checkbox\" && attributes.type !== \"submit\" && attributes.type !== \"button\" && value) {\n attributes.value = maskInputValue({\n element: n2,\n type: getInputType(n2),\n tagName,\n value,\n maskInputOptions,\n maskInputFn\n });\n } else if (checked) {\n attributes.checked = checked;\n }\n }\n if (tagName === \"option\") {\n if (n2.selected && !maskInputOptions[\"select\"]) {\n attributes.selected = true;\n } else {\n delete attributes.selected;\n }\n }\n if (tagName === \"dialog\" && n2.open) {\n try {\n attributes.rr_open_mode = n2.matches(\"dialog:modal\") ? \"modal\" : \"non-modal\";\n } catch {\n // likely this is safari not able to deal with the `:modal` selector\n // we can't detect whether the dialog is modal or non-modal open, so have to guess\n // hopefully this is only safari 15.4 and 15.5\n attributes.rr_open_mode = \"modal\"\n attributes.ph_rr_could_not_detect_modal = true\n }\n }\n if (tagName === \"canvas\" && recordCanvas) {\n if (n2.__context === \"2d\") {\n if (!is2DCanvasBlank(n2)) {\n attributes.rr_dataURL = n2.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n }\n } else if (!(\"__context\" in n2)) {\n const canvasDataURL = n2.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n const blankCanvas = doc.createElement(\"canvas\");\n blankCanvas.width = n2.width;\n blankCanvas.height = n2.height;\n const blankCanvasDataURL = blankCanvas.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n if (canvasDataURL !== blankCanvasDataURL) {\n attributes.rr_dataURL = canvasDataURL;\n }\n }\n }\n if (tagName === \"img\" && inlineImages) {\n if (!canvasService) {\n canvasService = doc.createElement(\"canvas\");\n canvasCtx = canvasService.getContext(\"2d\");\n }\n const image = n2;\n const imageSrc = image.currentSrc || image.getAttribute(\"src\") || \"<unknown-src>\";\n const priorCrossOrigin = image.crossOrigin;\n const recordInlineImage = () => {\n image.removeEventListener(\"load\", recordInlineImage);\n try {\n canvasService.width = image.naturalWidth;\n canvasService.height = image.naturalHeight;\n canvasCtx.drawImage(image, 0, 0);\n attributes.rr_dataURL = canvasService.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n } catch (err) {\n if (image.crossOrigin !== \"anonymous\") {\n image.crossOrigin = \"anonymous\";\n if (image.complete && image.naturalWidth !== 0)\n recordInlineImage();\n else image.addEventListener(\"load\", recordInlineImage);\n return;\n } else {\n console.warn(\n `Cannot inline img src=${imageSrc}! Error: ${err}`\n );\n }\n }\n if (image.crossOrigin === \"anonymous\") {\n priorCrossOrigin ? attributes.crossOrigin = priorCrossOrigin : image.removeAttribute(\"crossorigin\");\n }\n };\n if (image.complete && image.naturalWidth !== 0) recordInlineImage();\n else image.addEventListener(\"load\", recordInlineImage);\n }\n if (tagName === \"audio\" || tagName === \"video\") {\n const mediaAttributes = attributes;\n mediaAttributes.rr_mediaState = n2.paused ? \"paused\" : \"played\";\n mediaAttributes.rr_mediaCurrentTime = n2.currentTime;\n mediaAttributes.rr_mediaPlaybackRate = n2.playbackRate;\n mediaAttributes.rr_mediaMuted = n2.muted;\n mediaAttributes.rr_mediaLoop = n2.loop;\n mediaAttributes.rr_mediaVolume = n2.volume;\n }\n if (!newlyAddedElement) {\n if (n2.scrollLeft) {\n attributes.rr_scrollLeft = n2.scrollLeft;\n }\n if (n2.scrollTop) {\n attributes.rr_scrollTop = n2.scrollTop;\n }\n }\n if (needBlock) {\n const { width, height } = n2.getBoundingClientRect();\n attributes = {\n class: attributes.class,\n rr_width: `${width}px`,\n rr_height: `${height}px`\n };\n }\n if (tagName === \"iframe\" && !keepIframeSrcFn(attributes.src)) {\n if (!n2.contentDocument) {\n attributes.rr_src = attributes.src;\n }\n delete attributes.src;\n }\n let isCustomElement;\n try {\n if (customElements.get(tagName)) isCustomElement = true;\n } catch (e2) {\n }\n return {\n type: NodeType$2.Element,\n tagName,\n attributes,\n childNodes: [],\n isSVG: isSVGElement(n2) || void 0,\n needBlock,\n rootId,\n isCustom: isCustomElement\n };\n}\nfunction lowerIfExists(maybeAttr) {\n if (maybeAttr === void 0 || maybeAttr === null) {\n return \"\";\n } else {\n return maybeAttr.toLowerCase();\n }\n}\nfunction slimDOMExcluded(sn, slimDOMOptions) {\n if (slimDOMOptions.comment && sn.type === NodeType$2.Comment) {\n return true;\n } else if (sn.type === NodeType$2.Element) {\n if (slimDOMOptions.script && // script tag\n (sn.tagName === \"script\" || // (module)preload link\n sn.tagName === \"link\" && (sn.attributes.rel === \"preload\" || sn.attributes.rel === \"modulepreload\") && sn.attributes.as === \"script\" || // prefetch link\n sn.tagName === \"link\" && sn.attributes.rel === \"prefetch\" && typeof sn.attributes.href === \"string\" && extractFileExtension(sn.attributes.href) === \"js\")) {\n return true;\n } else if (slimDOMOptions.headFavicon && (sn.tagName === \"link\" && sn.attributes.rel === \"shortcut icon\" || sn.tagName === \"meta\" && (lowerIfExists(sn.attributes.name).match(\n /^msapplication-tile(image|color)$/\n ) || lowerIfExists(sn.attributes.name) === \"application-name\" || lowerIfExists(sn.attributes.rel) === \"icon\" || lowerIfExists(sn.attributes.rel) === \"apple-touch-icon\" || lowerIfExists(sn.attributes.rel) === \"shortcut icon\"))) {\n return true;\n } else if (sn.tagName === \"meta\") {\n if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {\n return true;\n } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)\n lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === \"pinterest\")) {\n return true;\n } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === \"robots\" || lowerIfExists(sn.attributes.name) === \"googlebot\" || lowerIfExists(sn.attributes.name) === \"bingbot\")) {\n return true;\n } else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes[\"http-equiv\"] !== void 0) {\n return true;\n } else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === \"author\" || lowerIfExists(sn.attributes.name) === \"generator\" || lowerIfExists(sn.attributes.name) === \"framework\" || lowerIfExists(sn.attributes.name) === \"publisher\" || lowerIfExists(sn.attributes.name) === \"progid\" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {\n return true;\n } else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === \"google-site-verification\" || lowerIfExists(sn.attributes.name) === \"yandex-verification\" || lowerIfExists(sn.attributes.name) === \"csrf-token\" || lowerIfExists(sn.attributes.name) === \"p:domain_verify\" || lowerIfExists(sn.attributes.name) === \"verify-v1\" || lowerIfExists(sn.attributes.name) === \"verification\" || lowerIfExists(sn.attributes.name) === \"shopify-checkout-api-token\")) {\n return true;\n }\n }\n }\n return false;\n}\nfunction serializeNodeWithId(n2, options) {\n const {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n skipChild = false,\n inlineStylesheet = true,\n maskInputOptions = {},\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions = {},\n inlineImages = false,\n recordCanvas = false,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout = 5e3,\n onStylesheetLoad,\n stylesheetLoadTimeout = 5e3,\n keepIframeSrcFn = () => false,\n newlyAddedElement = false\n } = options;\n let { needsMask } = options;\n let { preserveWhiteSpace = true } = options;\n if (!needsMask) {\n const checkAncestors = needsMask === void 0;\n needsMask = needMaskingText(\n n2,\n maskTextClass,\n maskTextSelector,\n checkAncestors\n );\n }\n const _serializedNode = serializeNode(n2, {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement\n });\n if (!_serializedNode) {\n console.warn(n2, \"not serialized\");\n return null;\n }\n let id;\n if (mirror2.hasNode(n2)) {\n id = mirror2.getId(n2);\n } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$2.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\\s+|\\s+$/gm, \"\").length) {\n id = IGNORED_NODE;\n } else {\n id = genId();\n }\n const serializedNode = Object.assign(_serializedNode, { id });\n mirror2.add(n2, serializedNode);\n if (id === IGNORED_NODE) {\n return null;\n }\n if (onSerialize) {\n onSerialize(n2);\n }\n let recordChild = !skipChild;\n if (serializedNode.type === NodeType$2.Element) {\n recordChild = recordChild && !serializedNode.needBlock;\n delete serializedNode.needBlock;\n const shadowRootEl = index$1.shadowRoot(n2);\n if (shadowRootEl && isNativeShadowDom(shadowRootEl))\n serializedNode.isShadowHost = true;\n }\n if ((serializedNode.type === NodeType$2.Document || serializedNode.type === NodeType$2.Element) && recordChild) {\n if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$2.Element && serializedNode.tagName === \"head\") {\n preserveWhiteSpace = false;\n }\n const bypassOptions = {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n skipChild,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn\n };\n if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === \"textarea\" && serializedNode.attributes.value !== void 0) ;\n else {\n for (const childN of Array.from(index$1.childNodes(n2))) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n }\n let shadowRootEl = null;\n if (isElement(n2) && (shadowRootEl = index$1.shadowRoot(n2))) {\n for (const childN of Array.from(index$1.childNodes(shadowRootEl))) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n }\n }\n const parent = index$1.parentNode(n2);\n if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {\n serializedNode.isShadow = true;\n }\n if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === \"iframe\") {\n onceIframeLoaded(\n n2,\n () => {\n const iframeDoc = n2.contentDocument;\n if (iframeDoc && onIframeLoad) {\n const serializedIframeNode = serializeNodeWithId(iframeDoc, {\n doc: iframeDoc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn\n });\n if (serializedIframeNode) {\n onIframeLoad(\n n2,\n serializedIframeNode\n );\n }\n }\n },\n iframeLoadTimeout\n );\n }\n if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === \"link\" && typeof serializedNode.attributes.rel === \"string\" && (serializedNode.attributes.rel === \"stylesheet\" || serializedNode.attributes.rel === \"preload\" && typeof serializedNode.attributes.href === \"string\" && extractFileExtension(serializedNode.attributes.href) === \"css\")) {\n onceStylesheetLoaded(\n n2,\n () => {\n if (onStylesheetLoad) {\n const serializedLinkNode = serializeNodeWithId(n2, {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn\n });\n if (serializedLinkNode) {\n onStylesheetLoad(\n n2,\n serializedLinkNode\n );\n }\n }\n },\n stylesheetLoadTimeout\n );\n }\n return serializedNode;\n}\nfunction snapshot(n2, options) {\n const {\n mirror: mirror2 = new Mirror(),\n blockClass = \"rr-block\",\n blockSelector = null,\n maskTextClass = \"rr-mask\",\n maskTextSelector = null,\n inlineStylesheet = true,\n inlineImages = false,\n recordCanvas = false,\n maskAllInputs = false,\n maskTextFn,\n maskInputFn,\n slimDOM = false,\n dataURLOptions,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn = () => false\n } = options || {};\n const maskInputOptions = maskAllInputs === true ? {\n color: true,\n date: true,\n \"datetime-local\": true,\n email: true,\n month: true,\n number: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n time: true,\n url: true,\n week: true,\n textarea: true,\n select: true,\n password: true\n } : maskAllInputs === false ? {\n password: true\n } : maskAllInputs;\n const slimDOMOptions = slimDOM === true || slimDOM === \"all\" ? (\n // if true: set of sensible options that should not throw away any information\n {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaDescKeywords: slimDOM === \"all\",\n // destructive\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaAuthorship: true,\n headMetaVerification: true\n }\n ) : slimDOM === false ? {} : slimDOM;\n return serializeNodeWithId(n2, {\n doc: n2,\n mirror: mirror2,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn,\n newlyAddedElement: false\n });\n}\nfunction getDefaultExportFromCjs$1(x2) {\n return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, \"default\") ? x2[\"default\"] : x2;\n}\nfunction getAugmentedNamespace$1(n2) {\n if (n2.__esModule) return n2;\n var f2 = n2.default;\n if (typeof f2 == \"function\") {\n var a2 = function a22() {\n if (this instanceof a22) {\n return Reflect.construct(f2, arguments, this.constructor);\n }\n return f2.apply(this, arguments);\n };\n a2.prototype = f2.prototype;\n } else a2 = {};\n Object.defineProperty(a2, \"__esModule\", { value: true });\n Object.keys(n2).forEach(function(k) {\n var d = Object.getOwnPropertyDescriptor(n2, k);\n Object.defineProperty(a2, k, d.get ? d : {\n enumerable: true,\n get: function() {\n return n2[k];\n }\n });\n });\n return a2;\n}\n// Removed postcss\nclass BaseRRNode {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n constructor(..._args) {\n __publicField2(this, \"parentElement\", null);\n __publicField2(this, \"parentNode\", null);\n __publicField2(this, \"ownerDocument\");\n __publicField2(this, \"firstChild\", null);\n __publicField2(this, \"lastChild\", null);\n __publicField2(this, \"previousSibling\", null);\n __publicField2(this, \"nextSibling\", null);\n __publicField2(this, \"ELEMENT_NODE\", 1);\n __publicField2(this, \"TEXT_NODE\", 3);\n __publicField2(this, \"nodeType\");\n __publicField2(this, \"nodeName\");\n __publicField2(this, \"RRNodeType\");\n }\n get childNodes() {\n const childNodes2 = [];\n let childIterator = this.firstChild;\n while (childIterator) {\n childNodes2.push(childIterator);\n childIterator = childIterator.nextSibling;\n }\n return childNodes2;\n }\n contains(node2) {\n if (!(node2 instanceof BaseRRNode)) return false;\n else if (node2.ownerDocument !== this.ownerDocument) return false;\n else if (node2 === this) return true;\n while (node2.parentNode) {\n if (node2.parentNode === this) return true;\n node2 = node2.parentNode;\n }\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n appendChild(_newChild) {\n throw new Error(\n `RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n insertBefore(_newChild, _refChild) {\n throw new Error(\n `RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n removeChild(_node) {\n throw new Error(\n `RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n toString() {\n return \"RRNode\";\n }\n}\nconst testableAccessors = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\n/*\nAngular zone patches many things and can pass the untainted checks below, causing performance issues\nAngular zone, puts the unpatched originals on the window, and the names for hose on the zone object.\nSo, we get the unpatched versions from the window object if they exist.\nYou can rename Zone, but this is a good enough proxy to avoid going to an iframe to get the untainted versions.\nsee: https://github.com/angular/angular/issues/26948\n*/\nfunction angularZoneUnpatchedAlternative$1(key) {\n const angularUnpatchedVersionSymbol = (\n globalThis\n )?.Zone?.__symbol__?.(key);\n if (\n angularUnpatchedVersionSymbol &&\n (globalThis)[angularUnpatchedVersionSymbol]\n ) {\n return (globalThis)[\n angularUnpatchedVersionSymbol\n ];\n } else {\n return undefined;\n }\n}\n\nconst untaintedBasePrototype = {};\nfunction getUntaintedPrototype(key) {\n if (untaintedBasePrototype[key])\n return untaintedBasePrototype[key];\n const defaultObj = angularZoneUnpatchedAlternative$1(key) ||globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a2, _b;\n return Boolean(\n (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods ? testableMethods[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a2;\n return typeof defaultPrototype[method] === \"function\" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods) {\n untaintedBasePrototype[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache = {};\nfunction getUntaintedAccessor(key, instance, accessor) {\n var _a2;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache[cacheKey])\n return untaintedAccessorCache[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a2.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache = {};\nfunction getUntaintedMethod(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache[cacheKey])\n return untaintedMethodCache[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"childNodes\");\n}\nfunction parentNode(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"parentNode\");\n}\nfunction parentElement(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"parentElement\");\n}\nfunction textContent(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"textContent\");\n}\nfunction contains(n2, other) {\n return getUntaintedMethod(\"Node\", n2, \"contains\")(other);\n}\nfunction getRootNode(n2) {\n return getUntaintedMethod(\"Node\", n2, \"getRootNode\")();\n}\nfunction host(n2) {\n if (!n2 || !(\"host\" in n2)) return null;\n return getUntaintedAccessor(\"ShadowRoot\", n2, \"host\");\n}\nfunction styleSheets(n2) {\n return n2.styleSheets;\n}\nfunction shadowRoot(n2) {\n if (!n2 || !(\"shadowRoot\" in n2)) return null;\n return getUntaintedAccessor(\"Element\", n2, \"shadowRoot\");\n}\nfunction querySelector(n2, selectors) {\n return getUntaintedAccessor(\"Element\", n2, \"querySelector\")(selectors);\n}\nfunction querySelectorAll(n2, selectors) {\n return getUntaintedAccessor(\"Element\", n2, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor() {\n return getUntaintedPrototype(\"MutationObserver\").constructor;\n}\nconst index = {\n childNodes,\n parentNode,\n parentElement,\n textContent,\n contains,\n getRootNode,\n host,\n styleSheets,\n shadowRoot,\n querySelector,\n querySelectorAll,\n mutationObserver: mutationObserverCtor\n};\nfunction on(type, fn, target = document) {\n const options = { capture: true, passive: true };\n target.addEventListener(type, fn, options);\n return () => target.removeEventListener(type, fn, options);\n}\nconst DEPARTED_MIRROR_ACCESS_WARNING = \"Please stop import mirror directly. Instead of that,\\r\\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\\r\\nor you can use record.mirror to access the mirror instance during recording.\";\nlet _mirror = {\n map: {},\n getId() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return -1;\n },\n getNode() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return null;\n },\n removeNodeFromMap() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n },\n has() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return false;\n },\n reset() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n};\nif (typeof window !== \"undefined\" && window.Proxy && window.Reflect) {\n _mirror = new Proxy(_mirror, {\n get(target, prop, receiver) {\n if (prop === \"map\") {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n return Reflect.get(target, prop, receiver);\n }\n });\n}\nfunction throttle(func, wait, options = {}) {\n let timeout = null;\n let previous = 0;\n return function(...args) {\n const now = Date.now();\n if (!previous && options.leading === false) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n const context = this;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n func.apply(context, args);\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(() => {\n previous = options.leading === false ? 0 : Date.now();\n timeout = null;\n func.apply(context, args);\n }, remaining);\n }\n };\n}\nfunction hookSetter(target, key, d, isRevoked, win = window) {\n const original = win.Object.getOwnPropertyDescriptor(target, key);\n win.Object.defineProperty(\n target,\n key,\n isRevoked ? d : {\n set(value) {\n setTimeout(() => {\n d.set.call(this, value);\n }, 0);\n if (original && original.set) {\n original.set.call(this, value);\n }\n }\n }\n );\n return () => hookSetter(target, key, original || {}, true);\n}\nfunction patch(source, name, replacement) {\n try {\n if (!(name in source)) {\n return () => {\n };\n }\n const original = source[name];\n const wrapped = replacement(original);\n if (typeof wrapped === \"function\") {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original\n }\n });\n }\n source[name] = wrapped;\n return () => {\n source[name] = original;\n };\n } catch {\n return () => {\n };\n }\n}\nlet nowTimestamp = Date.now;\nif (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {\n nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();\n}\nfunction getWindowScroll(win) {\n var _a2, _b, _c, _d;\n const doc = win.document;\n return {\n left: doc.scrollingElement ? doc.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : doc.documentElement.scrollLeft || (doc == null ? void 0 : doc.body) && ((_a2 = index.parentElement(doc.body)) == null ? void 0 : _a2.scrollLeft) || ((_b = doc == null ? void 0 : doc.body) == null ? void 0 : _b.scrollLeft) || 0,\n top: doc.scrollingElement ? doc.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : (doc == null ? void 0 : doc.documentElement.scrollTop) || (doc == null ? void 0 : doc.body) && ((_c = index.parentElement(doc.body)) == null ? void 0 : _c.scrollTop) || ((_d = doc == null ? void 0 : doc.body) == null ? void 0 : _d.scrollTop) || 0\n };\n}\nfunction getWindowHeight() {\n return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;\n}\nfunction getWindowWidth() {\n return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;\n}\nfunction closestElementOfNode(node2) {\n if (!node2) {\n return null;\n }\n const el = node2.nodeType === node2.ELEMENT_NODE ? node2 : index.parentElement(node2);\n return el;\n}\nfunction isBlocked(node2, blockClass, blockSelector, checkAncestors) {\n if (!node2) {\n return false;\n }\n const el = closestElementOfNode(node2);\n if (!el) {\n return false;\n }\n try {\n if (typeof blockClass === \"string\") {\n if (el.classList.contains(blockClass)) return true;\n if (checkAncestors && el.closest(\".\" + blockClass) !== null) return true;\n } else {\n if (classMatchesRegex(el, blockClass, checkAncestors)) return true;\n }\n } catch (e2) {\n }\n if (blockSelector) {\n if (el.matches(blockSelector)) return true;\n if (checkAncestors && el.closest(blockSelector) !== null) return true;\n }\n return false;\n}\nfunction isSerialized(n2, mirror2) {\n return mirror2.getId(n2) !== -1;\n}\nfunction isIgnored(n2, mirror2, slimDOMOptions) {\n if (n2.tagName === \"TITLE\" && slimDOMOptions.headTitleMutations) {\n return true;\n }\n return mirror2.getId(n2) === IGNORED_NODE;\n}\nfunction isAncestorRemoved(target, mirror2) {\n if (isShadowRoot(target)) {\n return false;\n }\n const id = mirror2.getId(target);\n if (!mirror2.has(id)) {\n return true;\n }\n const parent = index.parentNode(target);\n if (parent && parent.nodeType === target.DOCUMENT_NODE) {\n return false;\n }\n if (!parent) {\n return true;\n }\n return isAncestorRemoved(parent, mirror2);\n}\nfunction legacy_isTouchEvent(event) {\n return Boolean(event.changedTouches);\n}\nfunction polyfill$1(win = window) {\n if (\"NodeList\" in win && !win.NodeList.prototype.forEach) {\n win.NodeList.prototype.forEach = Array.prototype.forEach;\n }\n if (\"DOMTokenList\" in win && !win.DOMTokenList.prototype.forEach) {\n win.DOMTokenList.prototype.forEach = Array.prototype.forEach;\n }\n}\nfunction isSerializedIframe(n2, mirror2) {\n return Boolean(n2.nodeName === \"IFRAME\" && mirror2.getMeta(n2));\n}\nfunction isSerializedStylesheet(n2, mirror2) {\n return Boolean(\n n2.nodeName === \"LINK\" && n2.nodeType === n2.ELEMENT_NODE && n2.getAttribute && n2.getAttribute(\"rel\") === \"stylesheet\" && mirror2.getMeta(n2)\n );\n}\nfunction hasShadowRoot(n2) {\n if (!n2) return false;\n if (n2 instanceof BaseRRNode && \"shadowRoot\" in n2) {\n return Boolean(n2.shadowRoot);\n }\n return Boolean(index.shadowRoot(n2));\n}\nclass StyleSheetMirror {\n constructor() {\n __publicField(this, \"id\", 1);\n __publicField(this, \"styleIDMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"idStyleMap\", /* @__PURE__ */ new Map());\n }\n getId(stylesheet) {\n return this.styleIDMap.get(stylesheet) ?? -1;\n }\n has(stylesheet) {\n return this.styleIDMap.has(stylesheet);\n }\n /**\n * @returns If the stylesheet is in the mirror, returns the id of the stylesheet. If not, return the new assigned id.\n */\n add(stylesheet, id) {\n if (this.has(stylesheet)) return this.getId(stylesheet);\n let newId;\n if (id === void 0) {\n newId = this.id++;\n } else newId = id;\n this.styleIDMap.set(stylesheet, newId);\n this.idStyleMap.set(newId, stylesheet);\n return newId;\n }\n getStyle(id) {\n return this.idStyleMap.get(id) || null;\n }\n reset() {\n this.styleIDMap = /* @__PURE__ */ new WeakMap();\n this.idStyleMap = /* @__PURE__ */ new Map();\n this.id = 1;\n }\n generateId() {\n return this.id++;\n }\n}\nfunction getShadowHost(n2) {\n var _a2;\n let shadowHost = null;\n if (\"getRootNode\" in n2 && ((_a2 = index.getRootNode(n2)) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && index.host(index.getRootNode(n2)))\n shadowHost = index.host(index.getRootNode(n2));\n return shadowHost;\n}\nfunction getRootShadowHost(n2) {\n let rootShadowHost = n2;\n let shadowHost;\n while (shadowHost = getShadowHost(rootShadowHost))\n rootShadowHost = shadowHost;\n return rootShadowHost;\n}\nfunction shadowHostInDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n const shadowHost = getRootShadowHost(n2);\n return index.contains(doc, shadowHost);\n}\nfunction inDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n return index.contains(doc, n2) || shadowHostInDom(n2);\n}\nvar EventType = /* @__PURE__ */ ((EventType2) => {\n EventType2[EventType2[\"DomContentLoaded\"] = 0] = \"DomContentLoaded\";\n EventType2[EventType2[\"Load\"] = 1] = \"Load\";\n EventType2[EventType2[\"FullSnapshot\"] = 2] = \"FullSnapshot\";\n EventType2[EventType2[\"IncrementalSnapshot\"] = 3] = \"IncrementalSnapshot\";\n EventType2[EventType2[\"Meta\"] = 4] = \"Meta\";\n EventType2[EventType2[\"Custom\"] = 5] = \"Custom\";\n EventType2[EventType2[\"Plugin\"] = 6] = \"Plugin\";\n return EventType2;\n})(EventType || {});\nvar IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {\n IncrementalSource2[IncrementalSource2[\"Mutation\"] = 0] = \"Mutation\";\n IncrementalSource2[IncrementalSource2[\"MouseMove\"] = 1] = \"MouseMove\";\n IncrementalSource2[IncrementalSource2[\"MouseInteraction\"] = 2] = \"MouseInteraction\";\n IncrementalSource2[IncrementalSource2[\"Scroll\"] = 3] = \"Scroll\";\n IncrementalSource2[IncrementalSource2[\"ViewportResize\"] = 4] = \"ViewportResize\";\n IncrementalSource2[IncrementalSource2[\"Input\"] = 5] = \"Input\";\n IncrementalSource2[IncrementalSource2[\"TouchMove\"] = 6] = \"TouchMove\";\n IncrementalSource2[IncrementalSource2[\"MediaInteraction\"] = 7] = \"MediaInteraction\";\n IncrementalSource2[IncrementalSource2[\"StyleSheetRule\"] = 8] = \"StyleSheetRule\";\n IncrementalSource2[IncrementalSource2[\"CanvasMutation\"] = 9] = \"CanvasMutation\";\n IncrementalSource2[IncrementalSource2[\"Font\"] = 10] = \"Font\";\n IncrementalSource2[IncrementalSource2[\"Log\"] = 11] = \"Log\";\n IncrementalSource2[IncrementalSource2[\"Drag\"] = 12] = \"Drag\";\n IncrementalSource2[IncrementalSource2[\"StyleDeclaration\"] = 13] = \"StyleDeclaration\";\n IncrementalSource2[IncrementalSource2[\"Selection\"] = 14] = \"Selection\";\n IncrementalSource2[IncrementalSource2[\"AdoptedStyleSheet\"] = 15] = \"AdoptedStyleSheet\";\n IncrementalSource2[IncrementalSource2[\"CustomElement\"] = 16] = \"CustomElement\";\n return IncrementalSource2;\n})(IncrementalSource || {});\nvar MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {\n MouseInteractions2[MouseInteractions2[\"MouseUp\"] = 0] = \"MouseUp\";\n MouseInteractions2[MouseInteractions2[\"MouseDown\"] = 1] = \"MouseDown\";\n MouseInteractions2[MouseInteractions2[\"Click\"] = 2] = \"Click\";\n MouseInteractions2[MouseInteractions2[\"ContextMenu\"] = 3] = \"ContextMenu\";\n MouseInteractions2[MouseInteractions2[\"DblClick\"] = 4] = \"DblClick\";\n MouseInteractions2[MouseInteractions2[\"Focus\"] = 5] = \"Focus\";\n MouseInteractions2[MouseInteractions2[\"Blur\"] = 6] = \"Blur\";\n MouseInteractions2[MouseInteractions2[\"TouchStart\"] = 7] = \"TouchStart\";\n MouseInteractions2[MouseInteractions2[\"TouchMove_Departed\"] = 8] = \"TouchMove_Departed\";\n MouseInteractions2[MouseInteractions2[\"TouchEnd\"] = 9] = \"TouchEnd\";\n MouseInteractions2[MouseInteractions2[\"TouchCancel\"] = 10] = \"TouchCancel\";\n return MouseInteractions2;\n})(MouseInteractions || {});\nvar PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {\n PointerTypes2[PointerTypes2[\"Mouse\"] = 0] = \"Mouse\";\n PointerTypes2[PointerTypes2[\"Pen\"] = 1] = \"Pen\";\n PointerTypes2[PointerTypes2[\"Touch\"] = 2] = \"Touch\";\n return PointerTypes2;\n})(PointerTypes || {});\nvar CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {\n CanvasContext2[CanvasContext2[\"2D\"] = 0] = \"2D\";\n CanvasContext2[CanvasContext2[\"WebGL\"] = 1] = \"WebGL\";\n CanvasContext2[CanvasContext2[\"WebGL2\"] = 2] = \"WebGL2\";\n return CanvasContext2;\n})(CanvasContext || {});\nvar MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {\n MediaInteractions2[MediaInteractions2[\"Play\"] = 0] = \"Play\";\n MediaInteractions2[MediaInteractions2[\"Pause\"] = 1] = \"Pause\";\n MediaInteractions2[MediaInteractions2[\"Seeked\"] = 2] = \"Seeked\";\n MediaInteractions2[MediaInteractions2[\"VolumeChange\"] = 3] = \"VolumeChange\";\n MediaInteractions2[MediaInteractions2[\"RateChange\"] = 4] = \"RateChange\";\n return MediaInteractions2;\n})(MediaInteractions || {});\nfunction isNodeInLinkedList(n2) {\n return \"__ln\" in n2;\n}\nclass DoubleLinkedList {\n constructor() {\n __publicField(this, \"length\", 0);\n __publicField(this, \"head\", null);\n __publicField(this, \"tail\", null);\n }\n get(position) {\n if (position >= this.length) {\n throw new Error(\"Position outside of list range\");\n }\n let current = this.head;\n for (let index2 = 0; index2 < position; index2++) {\n current = (current == null ? void 0 : current.next) || null;\n }\n return current;\n }\n addNode(n2) {\n const node2 = {\n value: n2,\n previous: null,\n next: null\n };\n n2.__ln = node2;\n if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) {\n const current = n2.previousSibling.__ln.next;\n node2.next = current;\n node2.previous = n2.previousSibling.__ln;\n n2.previousSibling.__ln.next = node2;\n if (current) {\n current.previous = node2;\n }\n } else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) {\n const current = n2.nextSibling.__ln.previous;\n node2.previous = current;\n node2.next = n2.nextSibling.__ln;\n n2.nextSibling.__ln.previous = node2;\n if (current) {\n current.next = node2;\n }\n } else {\n if (this.head) {\n this.head.previous = node2;\n }\n node2.next = this.head;\n this.head = node2;\n }\n if (node2.next === null) {\n this.tail = node2;\n }\n this.length++;\n }\n removeNode(n2) {\n const current = n2.__ln;\n if (!this.head) {\n return;\n }\n if (!current.previous) {\n this.head = current.next;\n if (this.head) {\n this.head.previous = null;\n } else {\n this.tail = null;\n }\n } else {\n current.previous.next = current.next;\n if (current.next) {\n current.next.previous = current.previous;\n } else {\n this.tail = current.previous;\n }\n }\n if (n2.__ln) {\n delete n2.__ln;\n }\n this.length--;\n }\n}\nconst moveKey = (id, parentId) => `${id}@${parentId}`;\nclass MutationBuffer {\n constructor() {\n __publicField(this, \"frozen\", false);\n __publicField(this, \"locked\", false);\n __publicField(this, \"texts\", []);\n __publicField(this, \"attributes\", []);\n __publicField(this, \"attributeMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"removes\", []);\n __publicField(this, \"mapRemoves\", []);\n __publicField(this, \"movedMap\", {});\n __publicField(this, \"addedSet\", /* @__PURE__ */ new Set());\n __publicField(this, \"movedSet\", /* @__PURE__ */ new Set());\n __publicField(this, \"droppedSet\", /* @__PURE__ */ new Set());\n __publicField(this, \"mutationCb\");\n __publicField(this, \"blockClass\");\n __publicField(this, \"blockSelector\");\n __publicField(this, \"maskTextClass\");\n __publicField(this, \"maskTextSelector\");\n __publicField(this, \"inlineStylesheet\");\n __publicField(this, \"maskInputOptions\");\n __publicField(this, \"maskTextFn\");\n __publicField(this, \"maskInputFn\");\n __publicField(this, \"keepIframeSrcFn\");\n __publicField(this, \"recordCanvas\");\n __publicField(this, \"inlineImages\");\n __publicField(this, \"slimDOMOptions\");\n __publicField(this, \"dataURLOptions\");\n __publicField(this, \"doc\");\n __publicField(this, \"mirror\");\n __publicField(this, \"iframeManager\");\n __publicField(this, \"stylesheetManager\");\n __publicField(this, \"shadowDomManager\");\n __publicField(this, \"canvasManager\");\n __publicField(this, \"processedNodeManager\");\n __publicField(this, \"unattachedDoc\");\n __publicField(this, \"processMutations\", (mutations) => {\n mutations.forEach(this.processMutation);\n this.emit();\n });\n __publicField(this, \"emit\", () => {\n if (this.frozen || this.locked) {\n return;\n }\n const adds = [];\n const addedIds = /* @__PURE__ */ new Set();\n const addList = new DoubleLinkedList();\n const getNextId = (n2) => {\n let ns = n2;\n let nextId = IGNORED_NODE;\n while (nextId === IGNORED_NODE) {\n ns = ns && ns.nextSibling;\n nextId = ns && this.mirror.getId(ns);\n }\n return nextId;\n };\n const pushAdd = (n2) => {\n const parent = index.parentNode(n2);\n if (!parent || !inDom(n2) || parent.tagName === \"TEXTAREA\") {\n return;\n }\n const parentId = isShadowRoot(parent) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(parent);\n const nextId = getNextId(n2);\n if (parentId === -1 || nextId === -1) {\n return addList.addNode(n2);\n }\n const sn = serializeNodeWithId(n2, {\n doc: this.doc,\n mirror: this.mirror,\n blockClass: this.blockClass,\n blockSelector: this.blockSelector,\n maskTextClass: this.maskTextClass,\n maskTextSelector: this.maskTextSelector,\n skipChild: true,\n newlyAddedElement: true,\n inlineStylesheet: this.inlineStylesheet,\n maskInputOptions: this.maskInputOptions,\n maskTextFn: this.maskTextFn,\n maskInputFn: this.maskInputFn,\n slimDOMOptions: this.slimDOMOptions,\n dataURLOptions: this.dataURLOptions,\n recordCanvas: this.recordCanvas,\n inlineImages: this.inlineImages,\n onSerialize: (currentN) => {\n if (isSerializedIframe(currentN, this.mirror)) {\n this.iframeManager.addIframe(currentN);\n }\n if (isSerializedStylesheet(currentN, this.mirror)) {\n this.stylesheetManager.trackLinkElement(\n currentN\n );\n }\n if (hasShadowRoot(n2)) {\n this.shadowDomManager.addShadowRoot(index.shadowRoot(n2), this.doc);\n }\n },\n onIframeLoad: (iframe, childSn) => {\n this.iframeManager.attachIframe(iframe, childSn);\n this.shadowDomManager.observeAttachShadow(iframe);\n },\n onStylesheetLoad: (link, childSn) => {\n this.stylesheetManager.attachLinkElement(link, childSn);\n }\n });\n if (sn) {\n adds.push({\n parentId,\n nextId,\n node: sn\n });\n addedIds.add(sn.id);\n }\n };\n while (this.mapRemoves.length) {\n this.mirror.removeNodeFromMap(this.mapRemoves.shift());\n }\n for (const n2 of this.movedSet) {\n if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {\n continue;\n }\n pushAdd(n2);\n }\n for (const n2 of this.addedSet) {\n if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) {\n pushAdd(n2);\n } else if (isAncestorInSet(this.movedSet, n2)) {\n pushAdd(n2);\n } else {\n this.droppedSet.add(n2);\n }\n }\n let candidate = null;\n while (addList.length) {\n let node2 = null;\n if (candidate) {\n const parentId = this.mirror.getId(index.parentNode(candidate.value));\n const nextId = getNextId(candidate.value);\n if (parentId !== -1 && nextId !== -1) {\n node2 = candidate;\n }\n }\n if (!node2) {\n let tailNode = addList.tail;\n while (tailNode) {\n const _node = tailNode;\n tailNode = tailNode.previous;\n if (_node) {\n const parentId = this.mirror.getId(index.parentNode(_node.value));\n const nextId = getNextId(_node.value);\n if (nextId === -1) continue;\n else if (parentId !== -1) {\n node2 = _node;\n break;\n } else {\n const unhandledNode = _node.value;\n const parent = index.parentNode(unhandledNode);\n if (parent && parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowHost = index.host(parent);\n const parentId2 = this.mirror.getId(shadowHost);\n if (parentId2 !== -1) {\n node2 = _node;\n break;\n }\n }\n }\n }\n }\n }\n if (!node2) {\n while (addList.head) {\n addList.removeNode(addList.head.value);\n }\n break;\n }\n candidate = node2.previous;\n addList.removeNode(node2.value);\n pushAdd(node2.value);\n }\n const payload = {\n texts: this.texts.map((text) => {\n const n2 = text.node;\n const parent = index.parentNode(n2);\n if (parent && parent.tagName === \"TEXTAREA\") {\n this.genTextAreaValueMutation(parent);\n }\n return {\n id: this.mirror.getId(n2),\n value: text.value\n };\n }).filter((text) => !addedIds.has(text.id)).filter((text) => this.mirror.has(text.id)),\n attributes: this.attributes.map((attribute) => {\n const { attributes } = attribute;\n if (typeof attributes.style === \"string\") {\n const diffAsStr = JSON.stringify(attribute.styleDiff);\n const unchangedAsStr = JSON.stringify(attribute._unchangedStyles);\n if (diffAsStr.length < attributes.style.length) {\n if ((diffAsStr + unchangedAsStr).split(\"var(\").length === attributes.style.split(\"var(\").length) {\n attributes.style = attribute.styleDiff;\n }\n }\n }\n return {\n id: this.mirror.getId(attribute.node),\n attributes\n };\n }).filter((attribute) => !addedIds.has(attribute.id)).filter((attribute) => this.mirror.has(attribute.id)),\n removes: this.removes,\n adds\n };\n if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) {\n return;\n }\n this.texts = [];\n this.attributes = [];\n this.attributeMap = /* @__PURE__ */ new WeakMap();\n this.removes = [];\n this.addedSet = /* @__PURE__ */ new Set();\n this.movedSet = /* @__PURE__ */ new Set();\n this.droppedSet = /* @__PURE__ */ new Set();\n this.movedMap = {};\n this.mutationCb(payload);\n });\n __publicField(this, \"genTextAreaValueMutation\", (textarea) => {\n let item = this.attributeMap.get(textarea);\n if (!item) {\n item = {\n node: textarea,\n attributes: {},\n styleDiff: {},\n _unchangedStyles: {}\n };\n this.attributes.push(item);\n this.attributeMap.set(textarea, item);\n }\n item.attributes.value = Array.from(\n index.childNodes(textarea),\n (cn) => index.textContent(cn) || \"\"\n ).join(\"\");\n });\n __publicField(this, \"processMutation\", (m) => {\n if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {\n return;\n }\n switch (m.type) {\n case \"characterData\": {\n const value = index.textContent(m.target);\n if (!isBlocked(m.target, this.blockClass, this.blockSelector, false) && value !== m.oldValue) {\n this.texts.push({\n value: needMaskingText(\n m.target,\n this.maskTextClass,\n this.maskTextSelector,\n true\n // checkAncestors\n ) && value ? this.maskTextFn ? this.maskTextFn(value, closestElementOfNode(m.target)) : value.replace(/[\\S]/g, \"*\") : value,\n node: m.target\n });\n }\n break;\n }\n case \"attributes\": {\n const target = m.target;\n let attributeName = m.attributeName;\n let value = m.target.getAttribute(attributeName);\n if (attributeName === \"value\") {\n const type = getInputType(target);\n value = maskInputValue({\n element: target,\n maskInputOptions: this.maskInputOptions,\n tagName: target.tagName,\n type,\n value,\n maskInputFn: this.maskInputFn\n });\n }\n if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || value === m.oldValue) {\n return;\n }\n let item = this.attributeMap.get(m.target);\n if (target.tagName === \"IFRAME\" && attributeName === \"src\" && !this.keepIframeSrcFn(value)) {\n if (!target.contentDocument) {\n attributeName = \"rr_src\";\n } else {\n return;\n }\n }\n if (!item) {\n item = {\n node: m.target,\n attributes: {},\n styleDiff: {},\n _unchangedStyles: {}\n };\n this.attributes.push(item);\n this.attributeMap.set(m.target, item);\n }\n if (attributeName === \"type\" && target.tagName === \"INPUT\" && (m.oldValue || \"\").toLowerCase() === \"password\") {\n target.setAttribute(\"data-rr-is-password\", \"true\");\n }\n if (!ignoreAttribute(target.tagName, attributeName)) {\n item.attributes[attributeName] = transformAttribute(\n this.doc,\n toLowerCase(target.tagName),\n toLowerCase(attributeName),\n value\n );\n if (attributeName === \"style\") {\n if (!this.unattachedDoc) {\n try {\n this.unattachedDoc = document.implementation.createHTMLDocument();\n } catch (e2) {\n this.unattachedDoc = this.doc;\n }\n }\n const old = this.unattachedDoc.createElement(\"span\");\n if (m.oldValue) {\n old.setAttribute(\"style\", m.oldValue);\n }\n for (const pname of Array.from(target.style)) {\n const newValue = target.style.getPropertyValue(pname);\n const newPriority = target.style.getPropertyPriority(pname);\n if (newValue !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) {\n if (newPriority === \"\") {\n item.styleDiff[pname] = newValue;\n } else {\n item.styleDiff[pname] = [newValue, newPriority];\n }\n } else {\n item._unchangedStyles[pname] = [newValue, newPriority];\n }\n }\n for (const pname of Array.from(old.style)) {\n if (target.style.getPropertyValue(pname) === \"\") {\n item.styleDiff[pname] = false;\n }\n }\n } else if (attributeName === \"open\" && target.tagName === \"DIALOG\") {\n if (target.matches(\"dialog:modal\")) {\n item.attributes[\"rr_open_mode\"] = \"modal\";\n } else {\n item.attributes[\"rr_open_mode\"] = \"non-modal\";\n }\n }\n }\n break;\n }\n case \"childList\": {\n if (isBlocked(m.target, this.blockClass, this.blockSelector, true))\n return;\n if (m.target.tagName === \"TEXTAREA\") {\n this.genTextAreaValueMutation(m.target);\n return;\n }\n m.addedNodes.forEach((n2) => this.genAdds(n2, m.target));\n m.removedNodes.forEach((n2) => {\n const nodeId = this.mirror.getId(n2);\n const parentId = isShadowRoot(m.target) ? this.mirror.getId(index.host(m.target)) : this.mirror.getId(m.target);\n if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || isIgnored(n2, this.mirror, this.slimDOMOptions) || !isSerialized(n2, this.mirror)) {\n return;\n }\n if (this.addedSet.has(n2)) {\n deepDelete(this.addedSet, n2);\n this.droppedSet.add(n2);\n } else if (this.addedSet.has(m.target) && nodeId === -1) ;\n else if (isAncestorRemoved(m.target, this.mirror)) ;\n else if (this.movedSet.has(n2) && this.movedMap[moveKey(nodeId, parentId)]) {\n deepDelete(this.movedSet, n2);\n } else {\n this.removes.push({\n parentId,\n id: nodeId,\n isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0\n });\n }\n this.mapRemoves.push(n2);\n });\n break;\n }\n }\n });\n __publicField(this, \"genAdds\", (n2, target) => {\n if (this.processedNodeManager.inOtherBuffer(n2, this)) return;\n if (this.addedSet.has(n2) || this.movedSet.has(n2)) return;\n if (this.mirror.hasNode(n2)) {\n if (isIgnored(n2, this.mirror, this.slimDOMOptions)) {\n return;\n }\n this.movedSet.add(n2);\n let targetId = null;\n if (target && this.mirror.hasNode(target)) {\n targetId = this.mirror.getId(target);\n }\n if (targetId && targetId !== -1) {\n this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true;\n }\n } else {\n this.addedSet.add(n2);\n this.droppedSet.delete(n2);\n }\n if (!isBlocked(n2, this.blockClass, this.blockSelector, false)) {\n index.childNodes(n2).forEach((childN) => this.genAdds(childN));\n if (hasShadowRoot(n2)) {\n index.childNodes(index.shadowRoot(n2)).forEach((childN) => {\n this.processedNodeManager.add(childN, this);\n this.genAdds(childN, n2);\n });\n }\n }\n });\n }\n init(options) {\n [\n \"mutationCb\",\n \"blockClass\",\n \"blockSelector\",\n \"maskTextClass\",\n \"maskTextSelector\",\n \"inlineStylesheet\",\n \"maskInputOptions\",\n \"maskTextFn\",\n \"maskInputFn\",\n \"keepIframeSrcFn\",\n \"recordCanvas\",\n \"inlineImages\",\n \"slimDOMOptions\",\n \"dataURLOptions\",\n \"doc\",\n \"mirror\",\n \"iframeManager\",\n \"stylesheetManager\",\n \"shadowDomManager\",\n \"canvasManager\",\n \"processedNodeManager\"\n ].forEach((key) => {\n this[key] = options[key];\n });\n }\n freeze() {\n this.frozen = true;\n this.canvasManager.freeze();\n }\n unfreeze() {\n this.frozen = false;\n this.canvasManager.unfreeze();\n this.emit();\n }\n isFrozen() {\n return this.frozen;\n }\n lock() {\n this.locked = true;\n this.canvasManager.lock();\n }\n unlock() {\n this.locked = false;\n this.canvasManager.unlock();\n this.emit();\n }\n reset() {\n this.shadowDomManager.reset();\n this.canvasManager.reset();\n }\n}\nfunction deepDelete(addsSet, n2) {\n addsSet.delete(n2);\n index.childNodes(n2).forEach((childN) => deepDelete(addsSet, childN));\n}\nfunction isParentRemoved(removes, n2, mirror2) {\n if (removes.length === 0) return false;\n return _isParentRemoved(removes, n2, mirror2);\n}\nfunction _isParentRemoved(removes, n2, mirror2) {\n let node2 = index.parentNode(n2);\n while (node2) {\n const parentId = mirror2.getId(node2);\n if (removes.some((r2) => r2.id === parentId)) {\n return true;\n }\n node2 = index.parentNode(node2);\n }\n return false;\n}\nfunction isAncestorInSet(set, n2) {\n if (set.size === 0) return false;\n return _isAncestorInSet(set, n2);\n}\nfunction _isAncestorInSet(set, n2) {\n const parent = index.parentNode(n2);\n if (!parent) {\n return false;\n }\n if (set.has(parent)) {\n return true;\n }\n return _isAncestorInSet(set, parent);\n}\nlet errorHandler;\nfunction registerErrorHandler(handler) {\n errorHandler = handler;\n}\nfunction unregisterErrorHandler() {\n errorHandler = void 0;\n}\nconst callbackWrapper = (cb) => {\n if (!errorHandler) {\n return cb;\n }\n const rrwebWrapped = (...rest) => {\n try {\n return cb(...rest);\n } catch (error) {\n if (errorHandler && errorHandler(error) === true) {\n return;\n }\n throw error;\n }\n };\n return rrwebWrapped;\n};\nconst mutationBuffers = [];\nfunction getEventTarget(event) {\n try {\n if (\"composedPath\" in event) {\n const path = event.composedPath();\n if (path.length) {\n return path[0];\n }\n } else if (\"path\" in event && event.path.length) {\n return event.path[0];\n }\n } catch {\n }\n return event && event.target;\n}\nfunction initMutationObserver(options, rootEl) {\n const mutationBuffer = new MutationBuffer();\n mutationBuffers.push(mutationBuffer);\n mutationBuffer.init(options);\n const observer = new (mutationObserverCtor())(\n callbackWrapper(mutationBuffer.processMutations.bind(mutationBuffer))\n );\n observer.observe(rootEl, {\n attributes: true,\n attributeOldValue: true,\n characterData: true,\n characterDataOldValue: true,\n childList: true,\n subtree: true\n });\n return observer;\n}\nfunction initMoveObserver({\n mousemoveCb,\n sampling,\n doc,\n mirror: mirror2\n}) {\n if (sampling.mousemove === false) {\n return () => {\n };\n }\n const threshold = typeof sampling.mousemove === \"number\" ? sampling.mousemove : 50;\n const callbackThreshold = typeof sampling.mousemoveCallback === \"number\" ? sampling.mousemoveCallback : 500;\n let positions = [];\n let timeBaseline;\n const wrappedCb = throttle(\n callbackWrapper(\n (source) => {\n const totalOffset = Date.now() - timeBaseline;\n mousemoveCb(\n positions.map((p) => {\n p.timeOffset -= totalOffset;\n return p;\n }),\n source\n );\n positions = [];\n timeBaseline = null;\n }\n ),\n callbackThreshold\n );\n const updatePosition = callbackWrapper(\n throttle(\n callbackWrapper((evt) => {\n const target = getEventTarget(evt);\n const { clientX, clientY } = legacy_isTouchEvent(evt) ? evt.changedTouches[0] : evt;\n if (!timeBaseline) {\n timeBaseline = nowTimestamp();\n }\n positions.push({\n x: clientX,\n y: clientY,\n id: mirror2.getId(target),\n timeOffset: nowTimestamp() - timeBaseline\n });\n wrappedCb(\n typeof DragEvent !== \"undefined\" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove\n );\n }),\n threshold,\n {\n trailing: false\n }\n )\n );\n const handlers = [\n on(\"mousemove\", updatePosition, doc),\n on(\"touchmove\", updatePosition, doc),\n on(\"drag\", updatePosition, doc)\n ];\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initMouseInteractionObserver({\n mouseInteractionCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n sampling\n}) {\n if (sampling.mouseInteraction === false) {\n return () => {\n };\n }\n const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;\n const handlers = [];\n let currentPointerType = null;\n const getHandler = (eventKey) => {\n return (event) => {\n const target = getEventTarget(event);\n if (isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n let pointerType = null;\n let thisEventKey = eventKey;\n if (\"pointerType\" in event) {\n switch (event.pointerType) {\n case \"mouse\":\n pointerType = PointerTypes.Mouse;\n break;\n case \"touch\":\n pointerType = PointerTypes.Touch;\n break;\n case \"pen\":\n pointerType = PointerTypes.Pen;\n break;\n }\n if (pointerType === PointerTypes.Touch) {\n if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) {\n thisEventKey = \"TouchStart\";\n } else if (MouseInteractions[eventKey] === MouseInteractions.MouseUp) {\n thisEventKey = \"TouchEnd\";\n }\n } else if (pointerType === PointerTypes.Pen) ;\n } else if (legacy_isTouchEvent(event)) {\n pointerType = PointerTypes.Touch;\n }\n if (pointerType !== null) {\n currentPointerType = pointerType;\n if (thisEventKey.startsWith(\"Touch\") && pointerType === PointerTypes.Touch || thisEventKey.startsWith(\"Mouse\") && pointerType === PointerTypes.Mouse) {\n pointerType = null;\n }\n } else if (MouseInteractions[eventKey] === MouseInteractions.Click) {\n pointerType = currentPointerType;\n currentPointerType = null;\n }\n const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;\n if (!e2) {\n return;\n }\n const id = mirror2.getId(target);\n const { clientX, clientY } = e2;\n callbackWrapper(mouseInteractionCb)({\n type: MouseInteractions[thisEventKey],\n id,\n x: clientX,\n y: clientY,\n ...pointerType !== null && { pointerType }\n });\n };\n };\n Object.keys(MouseInteractions).filter(\n (key) => Number.isNaN(Number(key)) && !key.endsWith(\"_Departed\") && disableMap[key] !== false\n ).forEach((eventKey) => {\n let eventName = toLowerCase(eventKey);\n const handler = getHandler(eventKey);\n if (window.PointerEvent) {\n switch (MouseInteractions[eventKey]) {\n case MouseInteractions.MouseDown:\n case MouseInteractions.MouseUp:\n eventName = eventName.replace(\n \"mouse\",\n \"pointer\"\n );\n break;\n case MouseInteractions.TouchStart:\n case MouseInteractions.TouchEnd:\n return;\n }\n }\n handlers.push(on(eventName, handler, doc));\n });\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initScrollObserver({\n scrollCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n sampling\n}) {\n const updatePosition = callbackWrapper(\n throttle(\n callbackWrapper((evt) => {\n const target = getEventTarget(evt);\n if (!target || isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n const id = mirror2.getId(target);\n if (target === doc && doc.defaultView) {\n const scrollLeftTop = getWindowScroll(doc.defaultView);\n scrollCb({\n id,\n x: scrollLeftTop.left,\n y: scrollLeftTop.top\n });\n } else {\n scrollCb({\n id,\n x: target.scrollLeft,\n y: target.scrollTop\n });\n }\n }),\n sampling.scroll || 100\n )\n );\n return on(\"scroll\", updatePosition, doc);\n}\nfunction initViewportResizeObserver({ viewportResizeCb }, { win }) {\n let lastH = -1;\n let lastW = -1;\n const updateDimension = callbackWrapper(\n throttle(\n callbackWrapper(() => {\n const height = getWindowHeight();\n const width = getWindowWidth();\n if (lastH !== height || lastW !== width) {\n viewportResizeCb({\n width: Number(width),\n height: Number(height)\n });\n lastH = height;\n lastW = width;\n }\n }),\n 200\n )\n );\n return on(\"resize\", updateDimension, win);\n}\nconst INPUT_TAGS = [\"INPUT\", \"TEXTAREA\", \"SELECT\"];\nconst lastInputValueMap = /* @__PURE__ */ new WeakMap();\nfunction initInputObserver({\n inputCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n ignoreClass,\n ignoreSelector,\n maskInputOptions,\n maskInputFn,\n sampling,\n userTriggeredOnInput\n}) {\n function eventHandler(event) {\n let target = getEventTarget(event);\n const userTriggered = event.isTrusted;\n const tagName = target && target.tagName;\n if (target && tagName === \"OPTION\") {\n target = index.parentElement(target);\n }\n if (!target || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n if (target.classList.contains(ignoreClass) || ignoreSelector && target.matches(ignoreSelector)) {\n return;\n }\n let text = target.value;\n let isChecked = false;\n const type = getInputType(target) || \"\";\n if (type === \"radio\" || type === \"checkbox\") {\n isChecked = target.checked;\n } else if (maskInputOptions[tagName.toLowerCase()] || maskInputOptions[type]) {\n text = maskInputValue({\n element: target,\n maskInputOptions,\n tagName,\n type,\n value: text,\n maskInputFn\n });\n }\n cbWithDedup(\n target,\n userTriggeredOnInput ? { text, isChecked, userTriggered } : { text, isChecked }\n );\n const name = target.name;\n if (type === \"radio\" && name && isChecked) {\n doc.querySelectorAll(`input[type=\"radio\"][name=\"${name}\"]`).forEach((el) => {\n if (el !== target) {\n const text2 = el.value;\n cbWithDedup(\n el,\n userTriggeredOnInput ? { text: text2, isChecked: !isChecked, userTriggered: false } : { text: text2, isChecked: !isChecked }\n );\n }\n });\n }\n }\n function cbWithDedup(target, v2) {\n const lastInputValue = lastInputValueMap.get(target);\n if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {\n lastInputValueMap.set(target, v2);\n const id = mirror2.getId(target);\n callbackWrapper(inputCb)({\n ...v2,\n id\n });\n }\n }\n const events = sampling.input === \"last\" ? [\"change\"] : [\"input\", \"change\"];\n const handlers = events.map(\n (eventName) => on(eventName, callbackWrapper(eventHandler), doc)\n );\n const currentWindow = doc.defaultView;\n if (!currentWindow) {\n return () => {\n handlers.forEach((h) => h());\n };\n }\n const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(\n currentWindow.HTMLInputElement.prototype,\n \"value\"\n );\n const hookProperties = [\n [currentWindow.HTMLInputElement.prototype, \"value\"],\n [currentWindow.HTMLInputElement.prototype, \"checked\"],\n [currentWindow.HTMLSelectElement.prototype, \"value\"],\n [currentWindow.HTMLTextAreaElement.prototype, \"value\"],\n // Some UI library use selectedIndex to set select value\n [currentWindow.HTMLSelectElement.prototype, \"selectedIndex\"],\n [currentWindow.HTMLOptionElement.prototype, \"selected\"]\n ];\n if (propertyDescriptor && propertyDescriptor.set) {\n handlers.push(\n ...hookProperties.map(\n (p) => hookSetter(\n p[0],\n p[1],\n {\n set() {\n callbackWrapper(eventHandler)({\n target: this,\n isTrusted: false\n // userTriggered to false as this could well be programmatic\n });\n }\n },\n false,\n currentWindow\n )\n )\n );\n }\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction getNestedCSSRulePositions(rule2) {\n const positions = [];\n function recurse(childRule, pos) {\n if (hasNestedCSSRule(\"CSSGroupingRule\") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule(\"CSSMediaRule\") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule(\"CSSSupportsRule\") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule(\"CSSConditionRule\") && childRule.parentRule instanceof CSSConditionRule) {\n const rules2 = Array.from(\n childRule.parentRule.cssRules\n );\n const index2 = rules2.indexOf(childRule);\n pos.unshift(index2);\n } else if (childRule.parentStyleSheet) {\n const rules2 = Array.from(childRule.parentStyleSheet.cssRules);\n const index2 = rules2.indexOf(childRule);\n pos.unshift(index2);\n }\n return pos;\n }\n return recurse(rule2, positions);\n}\nfunction getIdAndStyleId(sheet, mirror2, styleMirror) {\n let id, styleId;\n if (!sheet) return {};\n if (sheet.ownerNode) id = mirror2.getId(sheet.ownerNode);\n else styleId = styleMirror.getId(sheet);\n return {\n styleId,\n id\n };\n}\nfunction initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetManager }, { win }) {\n if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) {\n return () => {\n };\n }\n const insertRule = win.CSSStyleSheet.prototype.insertRule;\n win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [rule2, index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n adds: [{ rule: rule2, index: index2 }]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n win.CSSStyleSheet.prototype.addRule = function(selector, styleBlock, index2 = this.cssRules.length) {\n const rule2 = `${selector} { ${styleBlock} }`;\n return win.CSSStyleSheet.prototype.insertRule.apply(this, [rule2, index2]);\n };\n const deleteRule = win.CSSStyleSheet.prototype.deleteRule;\n win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n removes: [{ index: index2 }]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n win.CSSStyleSheet.prototype.removeRule = function(index2) {\n return win.CSSStyleSheet.prototype.deleteRule.apply(this, [index2]);\n };\n let replace;\n if (win.CSSStyleSheet.prototype.replace) {\n replace = win.CSSStyleSheet.prototype.replace;\n win.CSSStyleSheet.prototype.replace = new Proxy(replace, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [text] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n replace: text\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n }\n let replaceSync;\n if (win.CSSStyleSheet.prototype.replaceSync) {\n replaceSync = win.CSSStyleSheet.prototype.replaceSync;\n win.CSSStyleSheet.prototype.replaceSync = new Proxy(replaceSync, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [text] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n replaceSync: text\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n }\n const supportedNestedCSSRuleTypes = {};\n if (canMonkeyPatchNestedCSSRule(\"CSSGroupingRule\")) {\n supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;\n } else {\n if (canMonkeyPatchNestedCSSRule(\"CSSMediaRule\")) {\n supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule;\n }\n if (canMonkeyPatchNestedCSSRule(\"CSSConditionRule\")) {\n supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule;\n }\n if (canMonkeyPatchNestedCSSRule(\"CSSSupportsRule\")) {\n supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule;\n }\n }\n const unmodifiedFunctions = {};\n Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {\n unmodifiedFunctions[typeKey] = {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n insertRule: type.prototype.insertRule,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n deleteRule: type.prototype.deleteRule\n };\n type.prototype.insertRule = new Proxy(\n unmodifiedFunctions[typeKey].insertRule,\n {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [rule2, index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n adds: [\n {\n rule: rule2,\n index: [\n ...getNestedCSSRulePositions(thisArg),\n index2 || 0\n // defaults to 0\n ]\n }\n ]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n }\n );\n type.prototype.deleteRule = new Proxy(\n unmodifiedFunctions[typeKey].deleteRule,\n {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n removes: [\n { index: [...getNestedCSSRulePositions(thisArg), index2] }\n ]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n }\n );\n });\n return callbackWrapper(() => {\n win.CSSStyleSheet.prototype.insertRule = insertRule;\n win.CSSStyleSheet.prototype.deleteRule = deleteRule;\n replace && (win.CSSStyleSheet.prototype.replace = replace);\n replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync);\n Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {\n type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;\n type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;\n });\n });\n}\nfunction initAdoptedStyleSheetObserver({\n mirror: mirror2,\n stylesheetManager\n}, host2) {\n var _a2, _b, _c;\n let hostId = null;\n if (host2.nodeName === \"#document\") hostId = mirror2.getId(host2);\n else hostId = mirror2.getId(index.host(host2));\n const patchTarget = host2.nodeName === \"#document\" ? (_a2 = host2.defaultView) == null ? void 0 : _a2.Document : (_c = (_b = host2.ownerDocument) == null ? void 0 : _b.defaultView) == null ? void 0 : _c.ShadowRoot;\n const originalPropertyDescriptor = (patchTarget == null ? void 0 : patchTarget.prototype) ? Object.getOwnPropertyDescriptor(\n patchTarget == null ? void 0 : patchTarget.prototype,\n \"adoptedStyleSheets\"\n ) : void 0;\n if (hostId === null || hostId === -1 || !patchTarget || !originalPropertyDescriptor)\n return () => {\n };\n Object.defineProperty(host2, \"adoptedStyleSheets\", {\n configurable: originalPropertyDescriptor.configurable,\n enumerable: originalPropertyDescriptor.enumerable,\n get() {\n var _a3;\n return (_a3 = originalPropertyDescriptor.get) == null ? void 0 : _a3.call(this);\n },\n set(sheets) {\n var _a3;\n const result2 = (_a3 = originalPropertyDescriptor.set) == null ? void 0 : _a3.call(this, sheets);\n if (hostId !== null && hostId !== -1) {\n try {\n stylesheetManager.adoptStyleSheets(sheets, hostId);\n } catch (e2) {\n }\n }\n return result2;\n }\n });\n return callbackWrapper(() => {\n Object.defineProperty(host2, \"adoptedStyleSheets\", {\n configurable: originalPropertyDescriptor.configurable,\n enumerable: originalPropertyDescriptor.enumerable,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n get: originalPropertyDescriptor.get,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n set: originalPropertyDescriptor.set\n });\n });\n}\nfunction initStyleDeclarationObserver({\n styleDeclarationCb,\n mirror: mirror2,\n ignoreCSSAttributes,\n stylesheetManager\n}, { win }) {\n const setProperty = win.CSSStyleDeclaration.prototype.setProperty;\n win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n var _a2;\n const [property, value, priority] = argumentsList;\n if (ignoreCSSAttributes.has(property)) {\n return setProperty.apply(thisArg, [property, value, priority]);\n }\n const { id, styleId } = getIdAndStyleId(\n (_a2 = thisArg.parentRule) == null ? void 0 : _a2.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleDeclarationCb({\n id,\n styleId,\n set: {\n property,\n value,\n priority\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n index: getNestedCSSRulePositions(thisArg.parentRule)\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;\n win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n var _a2;\n const [property] = argumentsList;\n if (ignoreCSSAttributes.has(property)) {\n return removeProperty.apply(thisArg, [property]);\n }\n const { id, styleId } = getIdAndStyleId(\n (_a2 = thisArg.parentRule) == null ? void 0 : _a2.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleDeclarationCb({\n id,\n styleId,\n remove: {\n property\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n index: getNestedCSSRulePositions(thisArg.parentRule)\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n return callbackWrapper(() => {\n win.CSSStyleDeclaration.prototype.setProperty = setProperty;\n win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;\n });\n}\nfunction initMediaInteractionObserver({\n mediaInteractionCb,\n blockClass,\n blockSelector,\n mirror: mirror2,\n sampling,\n doc\n}) {\n const handler = callbackWrapper(\n (type) => throttle(\n callbackWrapper((event) => {\n const target = getEventTarget(event);\n if (!target || isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n const { currentTime, volume, muted, playbackRate, loop } = target;\n mediaInteractionCb({\n type,\n id: mirror2.getId(target),\n currentTime,\n volume,\n muted,\n playbackRate,\n loop\n });\n }),\n sampling.media || 500\n )\n );\n const handlers = [\n on(\"play\", handler(MediaInteractions.Play), doc),\n on(\"pause\", handler(MediaInteractions.Pause), doc),\n on(\"seeked\", handler(MediaInteractions.Seeked), doc),\n on(\"volumechange\", handler(MediaInteractions.VolumeChange), doc),\n on(\"ratechange\", handler(MediaInteractions.RateChange), doc)\n ];\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initFontObserver({ fontCb, doc }) {\n const win = doc.defaultView;\n if (!win) {\n return () => {\n };\n }\n const handlers = [];\n const fontMap = /* @__PURE__ */ new WeakMap();\n const originalFontFace = win.FontFace;\n win.FontFace = function FontFace2(family, source, descriptors) {\n const fontFace = new originalFontFace(family, source, descriptors);\n fontMap.set(fontFace, {\n family,\n buffer: typeof source !== \"string\",\n descriptors,\n fontSource: typeof source === \"string\" ? source : JSON.stringify(Array.from(new Uint8Array(source)))\n });\n return fontFace;\n };\n const restoreHandler = patch(\n doc.fonts,\n \"add\",\n function(original) {\n return function(fontFace) {\n setTimeout(\n callbackWrapper(() => {\n const p = fontMap.get(fontFace);\n if (p) {\n fontCb(p);\n fontMap.delete(fontFace);\n }\n }),\n 0\n );\n return original.apply(this, [fontFace]);\n };\n }\n );\n handlers.push(() => {\n win.FontFace = originalFontFace;\n });\n handlers.push(restoreHandler);\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initSelectionObserver(param) {\n const { doc, mirror: mirror2, blockClass, blockSelector, selectionCb } = param;\n let collapsed = true;\n const updateSelection = callbackWrapper(() => {\n const selection = doc.getSelection();\n if (!selection || collapsed && (selection == null ? void 0 : selection.isCollapsed)) return;\n collapsed = selection.isCollapsed || false;\n const ranges = [];\n const count = selection.rangeCount || 0;\n for (let i2 = 0; i2 < count; i2++) {\n const range = selection.getRangeAt(i2);\n const { startContainer, startOffset, endContainer, endOffset } = range;\n const blocked = isBlocked(startContainer, blockClass, blockSelector, true) || isBlocked(endContainer, blockClass, blockSelector, true);\n if (blocked) continue;\n ranges.push({\n start: mirror2.getId(startContainer),\n startOffset,\n end: mirror2.getId(endContainer),\n endOffset\n });\n }\n selectionCb({ ranges });\n });\n updateSelection();\n return on(\"selectionchange\", updateSelection);\n}\nfunction initCustomElementObserver({\n doc,\n customElementCb\n}) {\n const win = doc.defaultView;\n if (!win || !win.customElements) return () => {\n };\n const restoreHandler = patch(\n win.customElements,\n \"define\",\n function(original) {\n return function(name, constructor, options) {\n try {\n customElementCb({\n define: {\n name\n }\n });\n } catch (e2) {\n console.warn(`Custom element callback failed for ${name}`);\n }\n return original.apply(this, [name, constructor, options]);\n };\n }\n );\n return restoreHandler;\n}\nfunction mergeHooks(o2, hooks) {\n const {\n mutationCb,\n mousemoveCb,\n mouseInteractionCb,\n scrollCb,\n viewportResizeCb,\n inputCb,\n mediaInteractionCb,\n styleSheetRuleCb,\n styleDeclarationCb,\n canvasMutationCb,\n fontCb,\n selectionCb,\n customElementCb\n } = o2;\n o2.mutationCb = (...p) => {\n if (hooks.mutation) {\n hooks.mutation(...p);\n }\n mutationCb(...p);\n };\n o2.mousemoveCb = (...p) => {\n if (hooks.mousemove) {\n hooks.mousemove(...p);\n }\n mousemoveCb(...p);\n };\n o2.mouseInteractionCb = (...p) => {\n if (hooks.mouseInteraction) {\n hooks.mouseInteraction(...p);\n }\n mouseInteractionCb(...p);\n };\n o2.scrollCb = (...p) => {\n if (hooks.scroll) {\n hooks.scroll(...p);\n }\n scrollCb(...p);\n };\n o2.viewportResizeCb = (...p) => {\n if (hooks.viewportResize) {\n hooks.viewportResize(...p);\n }\n viewportResizeCb(...p);\n };\n o2.inputCb = (...p) => {\n if (hooks.input) {\n hooks.input(...p);\n }\n inputCb(...p);\n };\n o2.mediaInteractionCb = (...p) => {\n if (hooks.mediaInteaction) {\n hooks.mediaInteaction(...p);\n }\n mediaInteractionCb(...p);\n };\n o2.styleSheetRuleCb = (...p) => {\n if (hooks.styleSheetRule) {\n hooks.styleSheetRule(...p);\n }\n styleSheetRuleCb(...p);\n };\n o2.styleDeclarationCb = (...p) => {\n if (hooks.styleDeclaration) {\n hooks.styleDeclaration(...p);\n }\n styleDeclarationCb(...p);\n };\n o2.canvasMutationCb = (...p) => {\n if (hooks.canvasMutation) {\n hooks.canvasMutation(...p);\n }\n canvasMutationCb(...p);\n };\n o2.fontCb = (...p) => {\n if (hooks.font) {\n hooks.font(...p);\n }\n fontCb(...p);\n };\n o2.selectionCb = (...p) => {\n if (hooks.selection) {\n hooks.selection(...p);\n }\n selectionCb(...p);\n };\n o2.customElementCb = (...c2) => {\n if (hooks.customElement) {\n hooks.customElement(...c2);\n }\n customElementCb(...c2);\n };\n}\nfunction initObservers(o2, hooks = {}) {\n const currentWindow = o2.doc.defaultView;\n if (!currentWindow) {\n return () => {\n };\n }\n mergeHooks(o2, hooks);\n let mutationObserver;\n if (o2.recordDOM) {\n mutationObserver = initMutationObserver(o2, o2.doc);\n }\n const mousemoveHandler = initMoveObserver(o2);\n const mouseInteractionHandler = initMouseInteractionObserver(o2);\n const scrollHandler = initScrollObserver(o2);\n const viewportResizeHandler = initViewportResizeObserver(o2, {\n win: currentWindow\n });\n const inputHandler = initInputObserver(o2);\n const mediaInteractionHandler = initMediaInteractionObserver(o2);\n let styleSheetObserver = () => {\n };\n let adoptedStyleSheetObserver = () => {\n };\n let styleDeclarationObserver = () => {\n };\n let fontObserver = () => {\n };\n if (o2.recordDOM) {\n styleSheetObserver = initStyleSheetObserver(o2, { win: currentWindow });\n adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o2, o2.doc);\n styleDeclarationObserver = initStyleDeclarationObserver(o2, {\n win: currentWindow\n });\n if (o2.collectFonts) {\n fontObserver = initFontObserver(o2);\n }\n }\n const selectionObserver = initSelectionObserver(o2);\n const customElementObserver = initCustomElementObserver(o2);\n const pluginHandlers = [];\n for (const plugin3 of o2.plugins) {\n pluginHandlers.push(\n plugin3.observer(plugin3.callback, currentWindow, plugin3.options)\n );\n }\n return callbackWrapper(() => {\n mutationBuffers.forEach((b) => b.reset());\n mutationObserver == null ? void 0 : mutationObserver.disconnect();\n mousemoveHandler();\n mouseInteractionHandler();\n scrollHandler();\n viewportResizeHandler();\n inputHandler();\n mediaInteractionHandler();\n styleSheetObserver();\n adoptedStyleSheetObserver();\n styleDeclarationObserver();\n fontObserver();\n selectionObserver();\n customElementObserver();\n pluginHandlers.forEach((h) => h());\n });\n}\nfunction hasNestedCSSRule(prop) {\n return typeof window[prop] !== \"undefined\";\n}\nfunction canMonkeyPatchNestedCSSRule(prop) {\n return Boolean(\n typeof window[prop] !== \"undefined\" && // Note: Generally, this check _shouldn't_ be necessary\n // However, in some scenarios (e.g. jsdom) this can sometimes fail, so we check for it here\n window[prop].prototype && \"insertRule\" in window[prop].prototype && \"deleteRule\" in window[prop].prototype\n );\n}\nclass CrossOriginIframeMirror {\n constructor(generateIdFn) {\n __publicField(this, \"iframeIdToRemoteIdMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"iframeRemoteIdToIdMap\", /* @__PURE__ */ new WeakMap());\n this.generateIdFn = generateIdFn;\n }\n getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) {\n const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe);\n const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe);\n let id = idToRemoteIdMap.get(remoteId);\n if (!id) {\n id = this.generateIdFn();\n idToRemoteIdMap.set(remoteId, id);\n remoteIdToIdMap.set(id, remoteId);\n }\n return id;\n }\n getIds(iframe, remoteId) {\n const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe);\n const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);\n return remoteId.map(\n (id) => this.getId(iframe, id, idToRemoteIdMap, remoteIdToIdMap)\n );\n }\n getRemoteId(iframe, id, map) {\n const remoteIdToIdMap = map || this.getRemoteIdToIdMap(iframe);\n if (typeof id !== \"number\") return id;\n const remoteId = remoteIdToIdMap.get(id);\n if (!remoteId) return -1;\n return remoteId;\n }\n getRemoteIds(iframe, ids) {\n const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);\n return ids.map((id) => this.getRemoteId(iframe, id, remoteIdToIdMap));\n }\n reset(iframe) {\n if (!iframe) {\n this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap();\n this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap();\n return;\n }\n this.iframeIdToRemoteIdMap.delete(iframe);\n this.iframeRemoteIdToIdMap.delete(iframe);\n }\n getIdToRemoteIdMap(iframe) {\n let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe);\n if (!idToRemoteIdMap) {\n idToRemoteIdMap = /* @__PURE__ */ new Map();\n this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap);\n }\n return idToRemoteIdMap;\n }\n getRemoteIdToIdMap(iframe) {\n let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe);\n if (!remoteIdToIdMap) {\n remoteIdToIdMap = /* @__PURE__ */ new Map();\n this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap);\n }\n return remoteIdToIdMap;\n }\n}\nclass IframeManager {\n constructor(options) {\n __publicField(this, \"iframes\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"crossOriginIframeMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"crossOriginIframeMirror\", new CrossOriginIframeMirror(genId));\n __publicField(this, \"crossOriginIframeStyleMirror\");\n __publicField(this, \"crossOriginIframeRootIdMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"mirror\");\n __publicField(this, \"mutationCb\");\n __publicField(this, \"wrappedEmit\");\n __publicField(this, \"loadListener\");\n __publicField(this, \"stylesheetManager\");\n __publicField(this, \"recordCrossOriginIframes\");\n this.mutationCb = options.mutationCb;\n this.wrappedEmit = options.wrappedEmit;\n this.stylesheetManager = options.stylesheetManager;\n this.recordCrossOriginIframes = options.recordCrossOriginIframes;\n this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(\n this.stylesheetManager.styleMirror.generateId.bind(\n this.stylesheetManager.styleMirror\n )\n );\n this.mirror = options.mirror;\n if (this.recordCrossOriginIframes) {\n window.addEventListener(\"message\", this.handleMessage.bind(this));\n }\n }\n addIframe(iframeEl) {\n this.iframes.set(iframeEl, true);\n if (iframeEl.contentWindow)\n this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);\n }\n addLoadListener(cb) {\n this.loadListener = cb;\n }\n attachIframe(iframeEl, childSn) {\n var _a2, _b;\n this.mutationCb({\n adds: [\n {\n parentId: this.mirror.getId(iframeEl),\n nextId: null,\n node: childSn\n }\n ],\n removes: [],\n texts: [],\n attributes: [],\n isAttachIframe: true\n });\n if (this.recordCrossOriginIframes)\n (_a2 = iframeEl.contentWindow) == null ? void 0 : _a2.addEventListener(\n \"message\",\n this.handleMessage.bind(this)\n );\n (_b = this.loadListener) == null ? void 0 : _b.call(this, iframeEl);\n if (iframeEl.contentDocument && iframeEl.contentDocument.adoptedStyleSheets && iframeEl.contentDocument.adoptedStyleSheets.length > 0)\n this.stylesheetManager.adoptStyleSheets(\n iframeEl.contentDocument.adoptedStyleSheets,\n this.mirror.getId(iframeEl.contentDocument)\n );\n }\n handleMessage(message) {\n const crossOriginMessageEvent = message;\n if (crossOriginMessageEvent.data.type !== \"rrweb\" || // To filter out the rrweb messages which are forwarded by some sites.\n crossOriginMessageEvent.origin !== crossOriginMessageEvent.data.origin)\n return;\n const iframeSourceWindow = message.source;\n if (!iframeSourceWindow) return;\n const iframeEl = this.crossOriginIframeMap.get(message.source);\n if (!iframeEl) return;\n const transformedEvent = this.transformCrossOriginEvent(\n iframeEl,\n crossOriginMessageEvent.data.event\n );\n if (transformedEvent)\n this.wrappedEmit(\n transformedEvent,\n crossOriginMessageEvent.data.isCheckout\n );\n }\n transformCrossOriginEvent(iframeEl, e2) {\n var _a2;\n switch (e2.type) {\n case EventType.FullSnapshot: {\n this.crossOriginIframeMirror.reset(iframeEl);\n this.crossOriginIframeStyleMirror.reset(iframeEl);\n this.replaceIdOnNode(e2.data.node, iframeEl);\n const rootId = e2.data.node.id;\n this.crossOriginIframeRootIdMap.set(iframeEl, rootId);\n this.patchRootIdOnNode(e2.data.node, rootId);\n return {\n timestamp: e2.timestamp,\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Mutation,\n adds: [\n {\n parentId: this.mirror.getId(iframeEl),\n nextId: null,\n node: e2.data.node\n }\n ],\n removes: [],\n texts: [],\n attributes: [],\n isAttachIframe: true\n }\n };\n }\n case EventType.Meta:\n case EventType.Load:\n case EventType.DomContentLoaded: {\n return false;\n }\n case EventType.Plugin: {\n return e2;\n }\n case EventType.Custom: {\n this.replaceIds(\n e2.data.payload,\n iframeEl,\n [\"id\", \"parentId\", \"previousId\", \"nextId\"]\n );\n return e2;\n }\n case EventType.IncrementalSnapshot: {\n switch (e2.data.source) {\n case IncrementalSource.Mutation: {\n e2.data.adds.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\n \"parentId\",\n \"nextId\",\n \"previousId\"\n ]);\n this.replaceIdOnNode(n2.node, iframeEl);\n const rootId = this.crossOriginIframeRootIdMap.get(iframeEl);\n rootId && this.patchRootIdOnNode(n2.node, rootId);\n });\n e2.data.removes.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\"parentId\", \"id\"]);\n });\n e2.data.attributes.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\"id\"]);\n });\n e2.data.texts.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\"id\"]);\n });\n return e2;\n }\n case IncrementalSource.Drag:\n case IncrementalSource.TouchMove:\n case IncrementalSource.MouseMove: {\n e2.data.positions.forEach((p) => {\n this.replaceIds(p, iframeEl, [\"id\"]);\n });\n return e2;\n }\n case IncrementalSource.ViewportResize: {\n return false;\n }\n case IncrementalSource.MediaInteraction:\n case IncrementalSource.MouseInteraction:\n case IncrementalSource.Scroll:\n case IncrementalSource.CanvasMutation:\n case IncrementalSource.Input: {\n this.replaceIds(e2.data, iframeEl, [\"id\"]);\n return e2;\n }\n case IncrementalSource.StyleSheetRule:\n case IncrementalSource.StyleDeclaration: {\n this.replaceIds(e2.data, iframeEl, [\"id\"]);\n this.replaceStyleIds(e2.data, iframeEl, [\"styleId\"]);\n return e2;\n }\n case IncrementalSource.Font: {\n return e2;\n }\n case IncrementalSource.Selection: {\n e2.data.ranges.forEach((range) => {\n this.replaceIds(range, iframeEl, [\"start\", \"end\"]);\n });\n return e2;\n }\n case IncrementalSource.AdoptedStyleSheet: {\n this.replaceIds(e2.data, iframeEl, [\"id\"]);\n this.replaceStyleIds(e2.data, iframeEl, [\"styleIds\"]);\n (_a2 = e2.data.styles) == null ? void 0 : _a2.forEach((style) => {\n this.replaceStyleIds(style, iframeEl, [\"styleId\"]);\n });\n return e2;\n }\n }\n }\n }\n return false;\n }\n replace(iframeMirror, obj, iframeEl, keys) {\n for (const key of keys) {\n if (!Array.isArray(obj[key]) && typeof obj[key] !== \"number\") continue;\n if (Array.isArray(obj[key])) {\n obj[key] = iframeMirror.getIds(\n iframeEl,\n obj[key]\n );\n } else {\n obj[key] = iframeMirror.getId(iframeEl, obj[key]);\n }\n }\n return obj;\n }\n replaceIds(obj, iframeEl, keys) {\n return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys);\n }\n replaceStyleIds(obj, iframeEl, keys) {\n return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys);\n }\n replaceIdOnNode(node2, iframeEl) {\n this.replaceIds(node2, iframeEl, [\"id\", \"rootId\"]);\n if (\"childNodes\" in node2) {\n node2.childNodes.forEach((child) => {\n this.replaceIdOnNode(child, iframeEl);\n });\n }\n }\n patchRootIdOnNode(node2, rootId) {\n if (node2.type !== NodeType$2.Document && !node2.rootId) node2.rootId = rootId;\n if (\"childNodes\" in node2) {\n node2.childNodes.forEach((child) => {\n this.patchRootIdOnNode(child, rootId);\n });\n }\n }\n}\nclass ShadowDomManager {\n constructor(options) {\n __publicField(this, \"shadowDoms\", /* @__PURE__ */ new WeakSet());\n __publicField(this, \"mutationCb\");\n __publicField(this, \"scrollCb\");\n __publicField(this, \"bypassOptions\");\n __publicField(this, \"mirror\");\n __publicField(this, \"restoreHandlers\", []);\n this.mutationCb = options.mutationCb;\n this.scrollCb = options.scrollCb;\n this.bypassOptions = options.bypassOptions;\n this.mirror = options.mirror;\n this.init();\n }\n init() {\n this.reset();\n this.patchAttachShadow(Element, document);\n }\n addShadowRoot(shadowRoot2, doc) {\n if (!isNativeShadowDom(shadowRoot2)) return;\n if (this.shadowDoms.has(shadowRoot2)) return;\n this.shadowDoms.add(shadowRoot2);\n const observer = initMutationObserver(\n {\n ...this.bypassOptions,\n doc,\n mutationCb: this.mutationCb,\n mirror: this.mirror,\n shadowDomManager: this\n },\n shadowRoot2\n );\n this.restoreHandlers.push(() => observer.disconnect());\n this.restoreHandlers.push(\n initScrollObserver({\n ...this.bypassOptions,\n scrollCb: this.scrollCb,\n // https://gist.github.com/praveenpuglia/0832da687ed5a5d7a0907046c9ef1813\n // scroll is not allowed to pass the boundary, so we need to listen the shadow document\n doc: shadowRoot2,\n mirror: this.mirror\n })\n );\n setTimeout(() => {\n if (shadowRoot2.adoptedStyleSheets && shadowRoot2.adoptedStyleSheets.length > 0)\n this.bypassOptions.stylesheetManager.adoptStyleSheets(\n shadowRoot2.adoptedStyleSheets,\n this.mirror.getId(index.host(shadowRoot2))\n );\n this.restoreHandlers.push(\n initAdoptedStyleSheetObserver(\n {\n mirror: this.mirror,\n stylesheetManager: this.bypassOptions.stylesheetManager\n },\n shadowRoot2\n )\n );\n }, 0);\n }\n /**\n * Monkey patch 'attachShadow' of an IFrameElement to observe newly added shadow doms.\n */\n observeAttachShadow(iframeElement) {\n if (!iframeElement.contentWindow || !iframeElement.contentDocument) return;\n this.patchAttachShadow(\n iframeElement.contentWindow.Element,\n iframeElement.contentDocument\n );\n }\n /**\n * Patch 'attachShadow' to observe newly added shadow doms.\n */\n patchAttachShadow(element, doc) {\n const manager = this;\n this.restoreHandlers.push(\n patch(\n element.prototype,\n \"attachShadow\",\n function(original) {\n return function(option) {\n const sRoot = original.call(this, option);\n const shadowRootEl = index.shadowRoot(this);\n if (shadowRootEl && inDom(this))\n manager.addShadowRoot(shadowRootEl, doc);\n return sRoot;\n };\n }\n )\n );\n }\n reset() {\n this.restoreHandlers.forEach((handler) => {\n try {\n handler();\n } catch (e2) {\n }\n });\n this.restoreHandlers = [];\n this.shadowDoms = /* @__PURE__ */ new WeakSet();\n }\n}\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar lookup = typeof Uint8Array === \"undefined\" ? [] : new Uint8Array(256);\nfor (var i$1 = 0; i$1 < chars.length; i$1++) {\n lookup[chars.charCodeAt(i$1)] = i$1;\n}\nvar encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = \"\";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n return base64;\n};\nconst canvasVarMap = /* @__PURE__ */ new Map();\nfunction variableListFor$1(ctx, ctor) {\n let contextMap = canvasVarMap.get(ctx);\n if (!contextMap) {\n contextMap = /* @__PURE__ */ new Map();\n canvasVarMap.set(ctx, contextMap);\n }\n if (!contextMap.has(ctor)) {\n contextMap.set(ctor, []);\n }\n return contextMap.get(ctor);\n}\nconst saveWebGLVar = (value, win, ctx) => {\n if (!value || !(isInstanceOfWebGLObject(value, win) || typeof value === \"object\"))\n return;\n const name = value.constructor.name;\n const list2 = variableListFor$1(ctx, name);\n let index2 = list2.indexOf(value);\n if (index2 === -1) {\n index2 = list2.length;\n list2.push(value);\n }\n return index2;\n};\nfunction serializeArg(value, win, ctx) {\n if (value instanceof Array) {\n return value.map((arg) => serializeArg(arg, win, ctx));\n } else if (value === null) {\n return value;\n } else if (value instanceof Float32Array || value instanceof Float64Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Int16Array || value instanceof Int8Array || value instanceof Uint8ClampedArray) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [Object.values(value)]\n };\n } else if (\n // SharedArrayBuffer disabled on most browsers due to spectre.\n // More info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/SharedArrayBuffer\n // value instanceof SharedArrayBuffer ||\n value instanceof ArrayBuffer\n ) {\n const name = value.constructor.name;\n const base64 = encode(value);\n return {\n rr_type: name,\n base64\n };\n } else if (value instanceof DataView) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [\n serializeArg(value.buffer, win, ctx),\n value.byteOffset,\n value.byteLength\n ]\n };\n } else if (value instanceof HTMLImageElement) {\n const name = value.constructor.name;\n const { src } = value;\n return {\n rr_type: name,\n src\n };\n } else if (value instanceof HTMLCanvasElement) {\n const name = \"HTMLImageElement\";\n const src = value.toDataURL();\n return {\n rr_type: name,\n src\n };\n } else if (value instanceof ImageData) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [serializeArg(value.data, win, ctx), value.width, value.height]\n };\n } else if (isInstanceOfWebGLObject(value, win) || typeof value === \"object\") {\n const name = value.constructor.name;\n const index2 = saveWebGLVar(value, win, ctx);\n return {\n rr_type: name,\n index: index2\n };\n }\n return value;\n}\nconst serializeArgs = (args, win, ctx) => {\n return args.map((arg) => serializeArg(arg, win, ctx));\n};\nconst isInstanceOfWebGLObject = (value, win) => {\n const webGLConstructorNames = [\n \"WebGLActiveInfo\",\n \"WebGLBuffer\",\n \"WebGLFramebuffer\",\n \"WebGLProgram\",\n \"WebGLRenderbuffer\",\n \"WebGLShader\",\n \"WebGLShaderPrecisionFormat\",\n \"WebGLTexture\",\n \"WebGLUniformLocation\",\n \"WebGLVertexArrayObject\",\n // In old Chrome versions, value won't be an instanceof WebGLVertexArrayObject.\n \"WebGLVertexArrayObjectOES\"\n ];\n const supportedWebGLConstructorNames = webGLConstructorNames.filter(\n (name) => typeof win[name] === \"function\"\n );\n return Boolean(\n supportedWebGLConstructorNames.find(\n (name) => value instanceof win[name]\n )\n );\n};\nfunction initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {\n const handlers = [];\n const props2D = Object.getOwnPropertyNames(\n win.CanvasRenderingContext2D.prototype\n );\n for (const prop of props2D) {\n try {\n if (typeof win.CanvasRenderingContext2D.prototype[prop] !== \"function\") {\n continue;\n }\n const restoreHandler = patch(\n win.CanvasRenderingContext2D.prototype,\n prop,\n function(original) {\n return function(...args) {\n if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {\n setTimeout(() => {\n const recordArgs = serializeArgs(args, win, this);\n cb(this.canvas, {\n type: CanvasContext[\"2D\"],\n property: prop,\n args: recordArgs\n });\n }, 0);\n }\n return original.apply(this, args);\n };\n }\n );\n handlers.push(restoreHandler);\n } catch {\n const hookHandler = hookSetter(\n win.CanvasRenderingContext2D.prototype,\n prop,\n {\n set(v2) {\n cb(this.canvas, {\n type: CanvasContext[\"2D\"],\n property: prop,\n args: [v2],\n setter: true\n });\n }\n }\n );\n handlers.push(hookHandler);\n }\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nfunction getNormalizedContextName(contextType) {\n return contextType === \"experimental-webgl\" ? \"webgl\" : contextType;\n}\nfunction initCanvasContextObserver(win, blockClass, blockSelector, setPreserveDrawingBufferToTrue) {\n const handlers = [];\n try {\n const restoreHandler = patch(\n win.HTMLCanvasElement.prototype,\n \"getContext\",\n function(original) {\n return function(contextType, ...args) {\n if (!isBlocked(this, blockClass, blockSelector, true)) {\n const ctxName = getNormalizedContextName(contextType);\n if (!(\"__context\" in this)) this.__context = ctxName;\n if (setPreserveDrawingBufferToTrue && [\"webgl\", \"webgl2\"].includes(ctxName)) {\n if (args[0] && typeof args[0] === \"object\") {\n const contextAttributes = args[0];\n if (!contextAttributes.preserveDrawingBuffer) {\n contextAttributes.preserveDrawingBuffer = true;\n }\n } else {\n args.splice(0, 1, {\n preserveDrawingBuffer: true\n });\n }\n }\n }\n return original.apply(this, [contextType, ...args]);\n };\n }\n );\n handlers.push(restoreHandler);\n } catch {\n console.error(\"failed to patch HTMLCanvasElement.prototype.getContext\");\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nfunction patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {\n const handlers = [];\n const props = Object.getOwnPropertyNames(prototype);\n for (const prop of props) {\n if (\n //prop.startsWith('get') || // e.g. getProgramParameter, but too risky\n [\n \"isContextLost\",\n \"canvas\",\n \"drawingBufferWidth\",\n \"drawingBufferHeight\"\n ].includes(prop)\n ) {\n continue;\n }\n try {\n if (typeof prototype[prop] !== \"function\") {\n continue;\n }\n const restoreHandler = patch(\n prototype,\n prop,\n function(original) {\n return function(...args) {\n const result2 = original.apply(this, args);\n saveWebGLVar(result2, win, this);\n if (\"tagName\" in this.canvas && !isBlocked(this.canvas, blockClass, blockSelector, true)) {\n const recordArgs = serializeArgs(args, win, this);\n const mutation = {\n type,\n property: prop,\n args: recordArgs\n };\n cb(this.canvas, mutation);\n }\n return result2;\n };\n }\n );\n handlers.push(restoreHandler);\n } catch {\n const hookHandler = hookSetter(prototype, prop, {\n set(v2) {\n cb(this.canvas, {\n type,\n property: prop,\n args: [v2],\n setter: true\n });\n }\n });\n handlers.push(hookHandler);\n }\n }\n return handlers;\n}\nfunction initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {\n const handlers = [];\n handlers.push(\n ...patchGLPrototype(\n win.WebGLRenderingContext.prototype,\n CanvasContext.WebGL,\n cb,\n blockClass,\n blockSelector,\n win\n )\n );\n if (typeof win.WebGL2RenderingContext !== \"undefined\") {\n handlers.push(\n ...patchGLPrototype(\n win.WebGL2RenderingContext.prototype,\n CanvasContext.WebGL2,\n cb,\n blockClass,\n blockSelector,\n win\n )\n );\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nconst encodedJs = \"KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsga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D1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=\";\nconst decodeBase64 = (base64) => Uint8Array.from(atob(base64), (c2) => c2.charCodeAt(0));\nconst blob = typeof window !== \"undefined\" && window.Blob && new Blob([decodeBase64(encodedJs)], { type: \"text/javascript;charset=utf-8\" });\nfunction WorkerWrapper(options) {\n let objURL;\n try {\n objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob);\n if (!objURL) throw \"\";\n const worker = new Worker(objURL, {\n name: options == null ? void 0 : options.name\n });\n worker.addEventListener(\"error\", () => {\n (window.URL || window.webkitURL).revokeObjectURL(objURL);\n });\n return worker;\n } catch (e2) {\n return new Worker(\n \"data:text/javascript;base64,\" + encodedJs,\n {\n name: options == null ? void 0 : options.name\n }\n );\n } finally {\n objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL);\n }\n}\nclass CanvasManager {\n constructor(options) {\n __publicField(this, \"pendingCanvasMutations\", /* @__PURE__ */ new Map());\n __publicField(this, \"rafStamps\", { latestId: 0, invokeId: null });\n __publicField(this, \"mirror\");\n __publicField(this, \"mutationCb\");\n __publicField(this, \"resetObservers\");\n __publicField(this, \"frozen\", false);\n __publicField(this, \"locked\", false);\n __publicField(this, \"processMutation\", (target, mutation) => {\n const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;\n if (newFrame || !this.rafStamps.invokeId)\n this.rafStamps.invokeId = this.rafStamps.latestId;\n if (!this.pendingCanvasMutations.has(target)) {\n this.pendingCanvasMutations.set(target, []);\n }\n this.pendingCanvasMutations.get(target).push(mutation);\n });\n const {\n sampling = \"all\",\n win,\n blockClass,\n blockSelector,\n recordCanvas,\n dataURLOptions\n } = options;\n this.mutationCb = options.mutationCb;\n this.mirror = options.mirror;\n if (recordCanvas && sampling === \"all\")\n this.initCanvasMutationObserver(win, blockClass, blockSelector);\n if (recordCanvas && typeof sampling === \"number\")\n this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector, {\n dataURLOptions\n });\n }\n reset() {\n this.pendingCanvasMutations.clear();\n this.resetObservers && this.resetObservers();\n }\n freeze() {\n this.frozen = true;\n }\n unfreeze() {\n this.frozen = false;\n }\n lock() {\n this.locked = true;\n }\n unlock() {\n this.locked = false;\n }\n initCanvasFPSObserver(fps, win, blockClass, blockSelector, options) {\n const canvasContextReset = initCanvasContextObserver(\n win,\n blockClass,\n blockSelector,\n true\n );\n const snapshotInProgressMap = /* @__PURE__ */ new Map();\n const worker = new WorkerWrapper();\n worker.onmessage = (e2) => {\n const { id } = e2.data;\n snapshotInProgressMap.set(id, false);\n if (!(\"base64\" in e2.data)) return;\n const { base64, type, width, height } = e2.data;\n this.mutationCb({\n id,\n type: CanvasContext[\"2D\"],\n commands: [\n {\n property: \"clearRect\",\n // wipe canvas\n args: [0, 0, width, height]\n },\n {\n property: \"drawImage\",\n // draws (semi-transparent) image\n args: [\n {\n rr_type: \"ImageBitmap\",\n args: [\n {\n rr_type: \"Blob\",\n data: [{ rr_type: \"ArrayBuffer\", base64 }],\n type\n }\n ]\n },\n 0,\n 0\n ]\n }\n ]\n });\n };\n const timeBetweenSnapshots = 1e3 / fps;\n let lastSnapshotTime = 0;\n let rafId;\n const getCanvas = () => {\n const matchedCanvas = [];\n const searchCanvas = (root) => {\n root.querySelectorAll(\"canvas\").forEach((canvas) => {\n if (!isBlocked(canvas, blockClass, blockSelector, true)) {\n matchedCanvas.push(canvas);\n }\n });\n root.querySelectorAll(\"*\").forEach((elem) => {\n if (elem.shadowRoot) {\n searchCanvas(elem.shadowRoot);\n }\n });\n };\n searchCanvas(win.document);\n return matchedCanvas;\n };\n const takeCanvasSnapshots = (timestamp) => {\n if (lastSnapshotTime && timestamp - lastSnapshotTime < timeBetweenSnapshots) {\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n return;\n }\n lastSnapshotTime = timestamp;\n getCanvas().forEach(async (canvas) => {\n var _a2;\n const id = this.mirror.getId(canvas);\n if (snapshotInProgressMap.get(id)) return;\n if (canvas.width === 0 || canvas.height === 0) return;\n snapshotInProgressMap.set(id, true);\n if ([\"webgl\", \"webgl2\"].includes(canvas.__context)) {\n const context = canvas.getContext(canvas.__context);\n if (((_a2 = context == null ? void 0 : context.getContextAttributes()) == null ? void 0 : _a2.preserveDrawingBuffer) === false) {\n context.clear(context.COLOR_BUFFER_BIT);\n }\n }\n // createImageBitmap throws if resizing to 0\n // Fallback to intrinsic size if canvas has not yet rendered\n const width = canvas.clientWidth || canvas.width;\n const height = canvas.clientHeight || canvas.height;\n const bitmap = await createImageBitmap(canvas, {\n resizeWidth: width,\n resizeHeight: height\n });\n worker.postMessage(\n {\n id,\n bitmap,\n width: width,\n height: height,\n dataURLOptions: options.dataURLOptions\n },\n [bitmap]\n );\n });\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n };\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n this.resetObservers = () => {\n canvasContextReset();\n cancelAnimationFrame(rafId);\n };\n }\n initCanvasMutationObserver(win, blockClass, blockSelector) {\n this.startRAFTimestamping();\n this.startPendingCanvasMutationFlusher();\n const canvasContextReset = initCanvasContextObserver(\n win,\n blockClass,\n blockSelector,\n false\n );\n const canvas2DReset = initCanvas2DMutationObserver(\n this.processMutation.bind(this),\n win,\n blockClass,\n blockSelector\n );\n const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(\n this.processMutation.bind(this),\n win,\n blockClass,\n blockSelector\n );\n this.resetObservers = () => {\n canvasContextReset();\n canvas2DReset();\n canvasWebGL1and2Reset();\n };\n }\n startPendingCanvasMutationFlusher() {\n requestAnimationFrame(() => this.flushPendingCanvasMutations());\n }\n startRAFTimestamping() {\n const setLatestRAFTimestamp = (timestamp) => {\n this.rafStamps.latestId = timestamp;\n requestAnimationFrame(setLatestRAFTimestamp);\n };\n requestAnimationFrame(setLatestRAFTimestamp);\n }\n flushPendingCanvasMutations() {\n this.pendingCanvasMutations.forEach(\n (_values, canvas) => {\n const id = this.mirror.getId(canvas);\n this.flushPendingCanvasMutationFor(canvas, id);\n }\n );\n requestAnimationFrame(() => this.flushPendingCanvasMutations());\n }\n flushPendingCanvasMutationFor(canvas, id) {\n if (this.frozen || this.locked) {\n return;\n }\n const valuesWithType = this.pendingCanvasMutations.get(canvas);\n if (!valuesWithType || id === -1) return;\n const values = valuesWithType.map((value) => {\n const { type: type2, ...rest } = value;\n return rest;\n });\n const { type } = valuesWithType[0];\n this.mutationCb({ id, type, commands: values });\n this.pendingCanvasMutations.delete(canvas);\n }\n}\nclass StylesheetManager {\n constructor(options) {\n __publicField(this, \"trackedLinkElements\", /* @__PURE__ */ new WeakSet());\n __publicField(this, \"mutationCb\");\n __publicField(this, \"adoptedStyleSheetCb\");\n __publicField(this, \"styleMirror\", new StyleSheetMirror());\n this.mutationCb = options.mutationCb;\n this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;\n }\n attachLinkElement(linkEl, childSn) {\n if (\"_cssText\" in childSn.attributes)\n this.mutationCb({\n adds: [],\n removes: [],\n texts: [],\n attributes: [\n {\n id: childSn.id,\n attributes: childSn.attributes\n }\n ]\n });\n this.trackLinkElement(linkEl);\n }\n trackLinkElement(linkEl) {\n if (this.trackedLinkElements.has(linkEl)) return;\n this.trackedLinkElements.add(linkEl);\n this.trackStylesheetInLinkElement(linkEl);\n }\n adoptStyleSheets(sheets, hostId) {\n if (sheets.length === 0) return;\n const adoptedStyleSheetData = {\n id: hostId,\n styleIds: []\n };\n const styles = [];\n for (const sheet of sheets) {\n let styleId;\n if (!this.styleMirror.has(sheet)) {\n styleId = this.styleMirror.add(sheet);\n styles.push({\n styleId,\n rules: Array.from(sheet.rules || CSSRule, (r2, index2) => ({\n rule: stringifyRule(r2, sheet.href),\n index: index2\n }))\n });\n } else styleId = this.styleMirror.getId(sheet);\n adoptedStyleSheetData.styleIds.push(styleId);\n }\n if (styles.length > 0) adoptedStyleSheetData.styles = styles;\n this.adoptedStyleSheetCb(adoptedStyleSheetData);\n }\n reset() {\n this.styleMirror.reset();\n this.trackedLinkElements = /* @__PURE__ */ new WeakSet();\n }\n // TODO: take snapshot on stylesheet reload by applying event listener\n trackStylesheetInLinkElement(_linkEl) {\n }\n}\nclass ProcessedNodeManager {\n constructor() {\n __publicField(this, \"nodeMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"active\", false);\n }\n inOtherBuffer(node2, thisBuffer) {\n const buffers = this.nodeMap.get(node2);\n return buffers && Array.from(buffers).some((buffer) => buffer !== thisBuffer);\n }\n add(node2, buffer) {\n if (!this.active) {\n this.active = true;\n requestAnimationFrame(() => {\n this.nodeMap = /* @__PURE__ */ new WeakMap();\n this.active = false;\n });\n }\n this.nodeMap.set(node2, (this.nodeMap.get(node2) || /* @__PURE__ */ new Set()).add(buffer));\n }\n destroy() {\n }\n}\nlet wrappedEmit;\nlet takeFullSnapshot$1;\nlet canvasManager;\nlet recording = false;\ntry {\n if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {\n const cleanFrame = document.createElement(\"iframe\");\n document.body.appendChild(cleanFrame);\n Array.from = ((_a = cleanFrame.contentWindow) == null ? void 0 : _a.Array.from) || Array.from;\n document.body.removeChild(cleanFrame);\n }\n} catch (err) {\n console.debug(\"Unable to override Array.from\", err);\n}\nconst mirror = createMirror$2();\nfunction record(options = {}) {\n const {\n emit,\n checkoutEveryNms,\n checkoutEveryNth,\n blockClass = \"rr-block\",\n blockSelector = null,\n ignoreClass = \"rr-ignore\",\n ignoreSelector = null,\n maskTextClass = \"rr-mask\",\n maskTextSelector = null,\n inlineStylesheet = true,\n maskAllInputs,\n maskInputOptions: _maskInputOptions,\n slimDOMOptions: _slimDOMOptions,\n maskInputFn,\n maskTextFn,\n hooks,\n packFn,\n sampling = {},\n dataURLOptions = {},\n mousemoveWait,\n recordDOM = true,\n recordCanvas = false,\n recordCrossOriginIframes = false,\n recordAfter = options.recordAfter === \"DOMContentLoaded\" ? options.recordAfter : \"load\",\n userTriggeredOnInput = false,\n collectFonts = false,\n inlineImages = false,\n plugins,\n keepIframeSrcFn = () => false,\n ignoreCSSAttributes = /* @__PURE__ */ new Set([]),\n errorHandler: errorHandler2\n } = options;\n registerErrorHandler(errorHandler2);\n const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;\n let passEmitsToParent = false;\n if (!inEmittingFrame) {\n try {\n if (window.parent.document) {\n passEmitsToParent = false;\n }\n } catch (e2) {\n passEmitsToParent = true;\n }\n }\n if (inEmittingFrame && !emit) {\n throw new Error(\"emit function is required\");\n }\n if (!inEmittingFrame && !passEmitsToParent) {\n return () => {\n };\n }\n if (mousemoveWait !== void 0 && sampling.mousemove === void 0) {\n sampling.mousemove = mousemoveWait;\n }\n mirror.reset();\n const maskInputOptions = maskAllInputs === true ? {\n color: true,\n date: true,\n \"datetime-local\": true,\n email: true,\n month: true,\n number: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n time: true,\n url: true,\n week: true,\n textarea: true,\n select: true,\n password: true\n } : _maskInputOptions !== void 0 ? _maskInputOptions : { password: true };\n const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === \"all\" ? {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaVerification: true,\n // the following are off for slimDOMOptions === true,\n // as they destroy some (hidden) info:\n headMetaAuthorship: _slimDOMOptions === \"all\",\n headMetaDescKeywords: _slimDOMOptions === \"all\",\n headTitleMutations: _slimDOMOptions === \"all\"\n } : _slimDOMOptions ? _slimDOMOptions : {};\n polyfill$1();\n let lastFullSnapshotEvent;\n let incrementalSnapshotCount = 0;\n const eventProcessor = (e2) => {\n for (const plugin3 of plugins || []) {\n if (plugin3.eventProcessor) {\n e2 = plugin3.eventProcessor(e2);\n }\n }\n if (packFn && // Disable packing events which will be emitted to parent frames.\n !passEmitsToParent) {\n e2 = packFn(e2);\n }\n return e2;\n };\n wrappedEmit = (r2, isCheckout) => {\n var _a2;\n const e2 = r2;\n e2.timestamp = nowTimestamp();\n if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {\n mutationBuffers.forEach((buf) => buf.unfreeze());\n }\n if (inEmittingFrame) {\n emit == null ? void 0 : emit(eventProcessor(e2), isCheckout);\n } else if (passEmitsToParent) {\n const message = {\n type: \"rrweb\",\n event: eventProcessor(e2),\n origin: window.location.origin,\n isCheckout\n };\n window.parent.postMessage(message, \"*\");\n }\n if (e2.type === EventType.FullSnapshot) {\n lastFullSnapshotEvent = e2;\n incrementalSnapshotCount = 0;\n } else if (e2.type === EventType.IncrementalSnapshot) {\n if (e2.data.source === IncrementalSource.Mutation && e2.data.isAttachIframe) {\n return;\n }\n incrementalSnapshotCount++;\n const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;\n const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;\n if (exceedCount || exceedTime) {\n takeFullSnapshot$1(true);\n }\n }\n };\n const wrappedMutationEmit = (m) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Mutation,\n ...m\n }\n });\n };\n const wrappedScrollEmit = (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Scroll,\n ...p\n }\n });\n const wrappedCanvasMutationEmit = (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.CanvasMutation,\n ...p\n }\n });\n const wrappedAdoptedStyleSheetEmit = (a2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.AdoptedStyleSheet,\n ...a2\n }\n });\n const stylesheetManager = new StylesheetManager({\n mutationCb: wrappedMutationEmit,\n adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit\n });\n const iframeManager = new IframeManager({\n mirror,\n mutationCb: wrappedMutationEmit,\n stylesheetManager,\n recordCrossOriginIframes,\n wrappedEmit\n });\n for (const plugin3 of plugins || []) {\n if (plugin3.getMirror)\n plugin3.getMirror({\n nodeMirror: mirror,\n crossOriginIframeMirror: iframeManager.crossOriginIframeMirror,\n crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror\n });\n }\n const processedNodeManager = new ProcessedNodeManager();\n canvasManager = new CanvasManager({\n recordCanvas,\n mutationCb: wrappedCanvasMutationEmit,\n win: window,\n blockClass,\n blockSelector,\n mirror,\n sampling: sampling.canvas,\n dataURLOptions\n });\n const shadowDomManager = new ShadowDomManager({\n mutationCb: wrappedMutationEmit,\n scrollCb: wrappedScrollEmit,\n bypassOptions: {\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n inlineStylesheet,\n maskInputOptions,\n dataURLOptions,\n maskTextFn,\n maskInputFn,\n recordCanvas,\n inlineImages,\n sampling,\n slimDOMOptions,\n iframeManager,\n stylesheetManager,\n canvasManager,\n keepIframeSrcFn,\n processedNodeManager\n },\n mirror\n });\n takeFullSnapshot$1 = (isCheckout = false) => {\n if (!recordDOM) {\n return;\n }\n wrappedEmit(\n {\n type: EventType.Meta,\n data: {\n href: window.location.href,\n width: getWindowWidth(),\n height: getWindowHeight()\n }\n },\n isCheckout\n );\n stylesheetManager.reset();\n shadowDomManager.init();\n mutationBuffers.forEach((buf) => buf.lock());\n const node2 = snapshot(document, {\n mirror,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n inlineStylesheet,\n maskAllInputs: maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOM: slimDOMOptions,\n dataURLOptions,\n recordCanvas,\n inlineImages,\n onSerialize: (n2) => {\n if (isSerializedIframe(n2, mirror)) {\n iframeManager.addIframe(n2);\n }\n if (isSerializedStylesheet(n2, mirror)) {\n stylesheetManager.trackLinkElement(n2);\n }\n if (hasShadowRoot(n2)) {\n shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);\n }\n },\n onIframeLoad: (iframe, childSn) => {\n iframeManager.attachIframe(iframe, childSn);\n shadowDomManager.observeAttachShadow(iframe);\n },\n onStylesheetLoad: (linkEl, childSn) => {\n stylesheetManager.attachLinkElement(linkEl, childSn);\n },\n keepIframeSrcFn\n });\n if (!node2) {\n return console.warn(\"Failed to snapshot the document\");\n }\n wrappedEmit(\n {\n type: EventType.FullSnapshot,\n data: {\n node: node2,\n initialOffset: getWindowScroll(window)\n }\n },\n isCheckout\n );\n mutationBuffers.forEach((buf) => buf.unlock());\n if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)\n stylesheetManager.adoptStyleSheets(\n document.adoptedStyleSheets,\n mirror.getId(document)\n );\n };\n try {\n const handlers = [];\n const observe = (doc) => {\n var _a2;\n return callbackWrapper(initObservers)(\n {\n mutationCb: wrappedMutationEmit,\n mousemoveCb: (positions, source) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source,\n positions\n }\n }),\n mouseInteractionCb: (d) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.MouseInteraction,\n ...d\n }\n }),\n scrollCb: wrappedScrollEmit,\n viewportResizeCb: (d) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.ViewportResize,\n ...d\n }\n }),\n inputCb: (v2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Input,\n ...v2\n }\n }),\n mediaInteractionCb: (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.MediaInteraction,\n ...p\n }\n }),\n styleSheetRuleCb: (r2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.StyleSheetRule,\n ...r2\n }\n }),\n styleDeclarationCb: (r2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.StyleDeclaration,\n ...r2\n }\n }),\n canvasMutationCb: wrappedCanvasMutationEmit,\n fontCb: (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Font,\n ...p\n }\n }),\n selectionCb: (p) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Selection,\n ...p\n }\n });\n },\n customElementCb: (c2) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.CustomElement,\n ...c2\n }\n });\n },\n blockClass,\n ignoreClass,\n ignoreSelector,\n maskTextClass,\n maskTextSelector,\n maskInputOptions,\n inlineStylesheet,\n sampling,\n recordDOM,\n recordCanvas,\n inlineImages,\n userTriggeredOnInput,\n collectFonts,\n doc,\n maskInputFn,\n maskTextFn,\n keepIframeSrcFn,\n blockSelector,\n slimDOMOptions,\n dataURLOptions,\n mirror,\n iframeManager,\n stylesheetManager,\n shadowDomManager,\n processedNodeManager,\n canvasManager,\n ignoreCSSAttributes,\n plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({\n observer: p.observer,\n options: p.options,\n callback: (payload) => wrappedEmit({\n type: EventType.Plugin,\n data: {\n plugin: p.name,\n payload\n }\n })\n }))) || []\n },\n hooks\n );\n };\n iframeManager.addLoadListener((iframeEl) => {\n try {\n handlers.push(observe(iframeEl.contentDocument));\n } catch (error) {\n console.warn(error);\n }\n });\n const init = () => {\n takeFullSnapshot$1();\n handlers.push(observe(document));\n recording = true;\n };\n if (document.readyState === \"interactive\" || document.readyState === \"complete\") {\n init();\n } else {\n handlers.push(\n on(\"DOMContentLoaded\", () => {\n wrappedEmit({\n type: EventType.DomContentLoaded,\n data: {}\n });\n if (recordAfter === \"DOMContentLoaded\") init();\n })\n );\n handlers.push(\n on(\n \"load\",\n () => {\n wrappedEmit({\n type: EventType.Load,\n data: {}\n });\n if (recordAfter === \"load\") init();\n },\n window\n )\n );\n }\n return () => {\n handlers.forEach((h) => h());\n processedNodeManager.destroy();\n recording = false;\n unregisterErrorHandler();\n };\n } catch (error) {\n console.warn(error);\n }\n}\nrecord.addCustomEvent = (tag, payload) => {\n if (!recording) {\n throw new Error(\"please add custom event after start recording\");\n }\n wrappedEmit({\n type: EventType.Custom,\n data: {\n tag,\n payload\n }\n });\n};\nrecord.freezePage = () => {\n mutationBuffers.forEach((buf) => buf.freeze());\n};\nrecord.takeFullSnapshot = (isCheckout) => {\n if (!recording) {\n throw new Error(\"please take full snapshot after start recording\");\n }\n takeFullSnapshot$1(isCheckout);\n};\nrecord.mirror = mirror;\nvar n;\n!function(t2) {\n t2[t2.NotStarted = 0] = \"NotStarted\", t2[t2.Running = 1] = \"Running\", t2[t2.Stopped = 2] = \"Stopped\";\n}(n || (n = {}));\nexport {\n record\n};\n//# sourceMappingURL=record.js.map\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar __defProp2 = Object.defineProperty;\nvar __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar _a;\nvar __defProp$1 = Object.defineProperty;\nvar __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nconst testableAccessors$1 = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods$1 = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\nconst untaintedBasePrototype$1 = {};\nfunction getUntaintedPrototype$1(key) {\n if (untaintedBasePrototype$1[key])\n return untaintedBasePrototype$1[key];\n const defaultObj = globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a2, _b;\n return Boolean(\n (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a2;\n return typeof defaultPrototype[method] === \"function\" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods) {\n untaintedBasePrototype$1[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype$1[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache$1 = {};\nfunction getUntaintedAccessor$1(key, instance, accessor) {\n var _a2;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache$1[cacheKey])\n return untaintedAccessorCache$1[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype$1(key);\n const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a2.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache$1[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache$1 = {};\nfunction getUntaintedMethod$1(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache$1[cacheKey])\n return untaintedMethodCache$1[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype$1(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache$1[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"childNodes\");\n}\nfunction parentNode$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"parentNode\");\n}\nfunction parentElement$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"parentElement\");\n}\nfunction textContent$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"textContent\");\n}\nfunction contains$1(n2, other) {\n return getUntaintedMethod$1(\"Node\", n2, \"contains\")(other);\n}\nfunction getRootNode$1(n2) {\n return getUntaintedMethod$1(\"Node\", n2, \"getRootNode\")();\n}\nfunction host$1(n2) {\n if (!n2 || !(\"host\" in n2)) return null;\n return getUntaintedAccessor$1(\"ShadowRoot\", n2, \"host\");\n}\nfunction styleSheets$1(n2) {\n return n2.styleSheets;\n}\nfunction shadowRoot$1(n2) {\n if (!n2 || !(\"shadowRoot\" in n2)) return null;\n return getUntaintedAccessor$1(\"Element\", n2, \"shadowRoot\");\n}\nfunction querySelector$1(n2, selectors) {\n return getUntaintedAccessor$1(\"Element\", n2, \"querySelector\")(selectors);\n}\nfunction querySelectorAll$1(n2, selectors) {\n return getUntaintedAccessor$1(\"Element\", n2, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor$1() {\n return getUntaintedPrototype$1(\"MutationObserver\").constructor;\n}\nconst index$1 = {\n childNodes: childNodes$1,\n parentNode: parentNode$1,\n parentElement: parentElement$1,\n textContent: textContent$1,\n contains: contains$1,\n getRootNode: getRootNode$1,\n host: host$1,\n styleSheets: styleSheets$1,\n shadowRoot: shadowRoot$1,\n querySelector: querySelector$1,\n querySelectorAll: querySelectorAll$1,\n mutationObserver: mutationObserverCtor$1\n};\nfunction isShadowRoot(n2) {\n const hostEl = (\n // anchor and textarea elements also have a `host` property\n // but only shadow roots have a `mode` property\n n2 && \"host\" in n2 && \"mode\" in n2 && index$1.host(n2) || null\n );\n return Boolean(\n hostEl && \"shadowRoot\" in hostEl && index$1.shadowRoot(hostEl) === n2\n );\n}\nclass Mirror {\n constructor() {\n __publicField$1(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField$1(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n2) {\n var _a2;\n if (!n2) return -1;\n const id = (_a2 = this.getMeta(n2)) == null ? void 0 : _a2.id;\n return id ?? -1;\n }\n getNode(id) {\n return this.idNodeMap.get(id) || null;\n }\n getIds() {\n return Array.from(this.idNodeMap.keys());\n }\n getMeta(n2) {\n return this.nodeMetaMap.get(n2) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n2) {\n const id = this.getId(n2);\n this.idNodeMap.delete(id);\n if (n2.childNodes) {\n n2.childNodes.forEach(\n (childNode) => this.removeNodeFromMap(childNode)\n );\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node2) {\n return this.nodeMetaMap.has(node2);\n }\n add(n2, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n2);\n this.nodeMetaMap.set(n2, meta);\n }\n replace(id, n2) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n2, meta);\n }\n this.idNodeMap.set(id, n2);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction createMirror$2() {\n return new Mirror();\n}\nconst IGNORED_NODE = -2;\nfunction classMatchesRegex(node2, regex, checkAncestors) {\n if (!node2) return false;\n if (node2.nodeType !== node2.ELEMENT_NODE) {\n if (!checkAncestors) return false;\n return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);\n }\n for (let eIndex = node2.classList.length; eIndex--; ) {\n const className = node2.classList[eIndex];\n if (regex.test(className)) {\n return true;\n }\n }\n if (!checkAncestors) return false;\n return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);\n}\nfunction getDefaultExportFromCjs$1(x2) {\n return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, \"default\") ? x2[\"default\"] : x2;\n}\nfunction getAugmentedNamespace$1(n2) {\n if (n2.__esModule) return n2;\n var f2 = n2.default;\n if (typeof f2 == \"function\") {\n var a2 = function a22() {\n if (this instanceof a22) {\n return Reflect.construct(f2, arguments, this.constructor);\n }\n return f2.apply(this, arguments);\n };\n a2.prototype = f2.prototype;\n } else a2 = {};\n Object.defineProperty(a2, \"__esModule\", { value: true });\n Object.keys(n2).forEach(function(k) {\n var d = Object.getOwnPropertyDescriptor(n2, k);\n Object.defineProperty(a2, k, d.get ? d : {\n enumerable: true,\n get: function() {\n return n2[k];\n }\n });\n });\n return a2;\n}\n// Removed postcss here\nclass BaseRRNode {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n constructor(..._args) {\n __publicField22(this, \"parentElement\", null);\n __publicField22(this, \"parentNode\", null);\n __publicField22(this, \"ownerDocument\");\n __publicField22(this, \"firstChild\", null);\n __publicField22(this, \"lastChild\", null);\n __publicField22(this, \"previousSibling\", null);\n __publicField22(this, \"nextSibling\", null);\n __publicField22(this, \"ELEMENT_NODE\", 1);\n __publicField22(this, \"TEXT_NODE\", 3);\n __publicField22(this, \"nodeType\");\n __publicField22(this, \"nodeName\");\n __publicField22(this, \"RRNodeType\");\n }\n get childNodes() {\n const childNodes2 = [];\n let childIterator = this.firstChild;\n while (childIterator) {\n childNodes2.push(childIterator);\n childIterator = childIterator.nextSibling;\n }\n return childNodes2;\n }\n contains(node2) {\n if (!(node2 instanceof BaseRRNode)) return false;\n else if (node2.ownerDocument !== this.ownerDocument) return false;\n else if (node2 === this) return true;\n while (node2.parentNode) {\n if (node2.parentNode === this) return true;\n node2 = node2.parentNode;\n }\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n appendChild(_newChild) {\n throw new Error(\n `RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n insertBefore(_newChild, _refChild) {\n throw new Error(\n `RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n removeChild(_node) {\n throw new Error(\n `RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n toString() {\n return \"RRNode\";\n }\n}\nconst testableAccessors = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\nconst untaintedBasePrototype = {};\nfunction getUntaintedPrototype(key) {\n if (untaintedBasePrototype[key])\n return untaintedBasePrototype[key];\n const defaultObj = globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a2, _b;\n return Boolean(\n (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods ? testableMethods[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a2;\n return typeof defaultPrototype[method] === \"function\" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods) {\n untaintedBasePrototype[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache = {};\nfunction getUntaintedAccessor(key, instance, accessor) {\n var _a2;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache[cacheKey])\n return untaintedAccessorCache[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a2.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache = {};\nfunction getUntaintedMethod(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache[cacheKey])\n return untaintedMethodCache[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"childNodes\");\n}\nfunction parentNode(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"parentNode\");\n}\nfunction parentElement(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"parentElement\");\n}\nfunction textContent(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"textContent\");\n}\nfunction contains(n2, other) {\n return getUntaintedMethod(\"Node\", n2, \"contains\")(other);\n}\nfunction getRootNode(n2) {\n return getUntaintedMethod(\"Node\", n2, \"getRootNode\")();\n}\nfunction host(n2) {\n if (!n2 || !(\"host\" in n2)) return null;\n return getUntaintedAccessor(\"ShadowRoot\", n2, \"host\");\n}\nfunction styleSheets(n2) {\n return n2.styleSheets;\n}\nfunction shadowRoot(n2) {\n if (!n2 || !(\"shadowRoot\" in n2)) return null;\n return getUntaintedAccessor(\"Element\", n2, \"shadowRoot\");\n}\nfunction querySelector(n2, selectors) {\n return getUntaintedAccessor(\"Element\", n2, \"querySelector\")(selectors);\n}\nfunction querySelectorAll(n2, selectors) {\n return getUntaintedAccessor(\"Element\", n2, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor() {\n return getUntaintedPrototype(\"MutationObserver\").constructor;\n}\nconst index = {\n childNodes,\n parentNode,\n parentElement,\n textContent,\n contains,\n getRootNode,\n host,\n styleSheets,\n shadowRoot,\n querySelector,\n querySelectorAll,\n mutationObserver: mutationObserverCtor\n};\nfunction on(type, fn, target = document) {\n const options = { capture: true, passive: true };\n target.addEventListener(type, fn, options);\n return () => target.removeEventListener(type, fn, options);\n}\nconst DEPARTED_MIRROR_ACCESS_WARNING = \"Please stop import mirror directly. Instead of that,\\r\\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\\r\\nor you can use record.mirror to access the mirror instance during recording.\";\nlet _mirror = {\n map: {},\n getId() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return -1;\n },\n getNode() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return null;\n },\n removeNodeFromMap() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n },\n has() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return false;\n },\n reset() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n};\nif (typeof window !== \"undefined\" && window.Proxy && window.Reflect) {\n _mirror = new Proxy(_mirror, {\n get(target, prop, receiver) {\n if (prop === \"map\") {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n return Reflect.get(target, prop, receiver);\n }\n });\n}\nfunction throttle(func, wait, options = {}) {\n let timeout = null;\n let previous = 0;\n return function(...args) {\n const now = Date.now();\n if (!previous && options.leading === false) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n const context = this;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n func.apply(context, args);\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(() => {\n previous = options.leading === false ? 0 : Date.now();\n timeout = null;\n func.apply(context, args);\n }, remaining);\n }\n };\n}\nfunction hookSetter(target, key, d, isRevoked, win = window) {\n const original = win.Object.getOwnPropertyDescriptor(target, key);\n win.Object.defineProperty(\n target,\n key,\n isRevoked ? d : {\n set(value) {\n setTimeout(() => {\n d.set.call(this, value);\n }, 0);\n if (original && original.set) {\n original.set.call(this, value);\n }\n }\n }\n );\n return () => hookSetter(target, key, original || {}, true);\n}\nfunction patch(source, name, replacement) {\n try {\n if (!(name in source)) {\n return () => {\n };\n }\n const original = source[name];\n const wrapped = replacement(original);\n if (typeof wrapped === \"function\") {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original\n }\n });\n }\n source[name] = wrapped;\n return () => {\n source[name] = original;\n };\n } catch {\n return () => {\n };\n }\n}\nlet nowTimestamp = Date.now;\nif (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {\n nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();\n}\nfunction getWindowScroll(win) {\n var _a2, _b, _c, _d;\n const doc = win.document;\n return {\n left: doc.scrollingElement ? doc.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : doc.documentElement.scrollLeft || (doc == null ? void 0 : doc.body) && ((_a2 = index.parentElement(doc.body)) == null ? void 0 : _a2.scrollLeft) || ((_b = doc == null ? void 0 : doc.body) == null ? void 0 : _b.scrollLeft) || 0,\n top: doc.scrollingElement ? doc.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : (doc == null ? void 0 : doc.documentElement.scrollTop) || (doc == null ? void 0 : doc.body) && ((_c = index.parentElement(doc.body)) == null ? void 0 : _c.scrollTop) || ((_d = doc == null ? void 0 : doc.body) == null ? void 0 : _d.scrollTop) || 0\n };\n}\nfunction getWindowHeight() {\n return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;\n}\nfunction getWindowWidth() {\n return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;\n}\nfunction closestElementOfNode(node2) {\n if (!node2) {\n return null;\n }\n const el = node2.nodeType === node2.ELEMENT_NODE ? node2 : index.parentElement(node2);\n return el;\n}\nfunction isBlocked(node2, blockClass, blockSelector, checkAncestors) {\n if (!node2) {\n return false;\n }\n const el = closestElementOfNode(node2);\n if (!el) {\n return false;\n }\n try {\n if (typeof blockClass === \"string\") {\n if (el.classList.contains(blockClass)) return true;\n if (checkAncestors && el.closest(\".\" + blockClass) !== null) return true;\n } else {\n if (classMatchesRegex(el, blockClass, checkAncestors)) return true;\n }\n } catch (e2) {\n }\n if (blockSelector) {\n if (el.matches(blockSelector)) return true;\n if (checkAncestors && el.closest(blockSelector) !== null) return true;\n }\n return false;\n}\nfunction isSerialized(n2, mirror2) {\n return mirror2.getId(n2) !== -1;\n}\nfunction isIgnored(n2, mirror2, slimDOMOptions) {\n if (n2.tagName === \"TITLE\" && slimDOMOptions.headTitleMutations) {\n return true;\n }\n return mirror2.getId(n2) === IGNORED_NODE;\n}\nfunction isAncestorRemoved(target, mirror2) {\n if (isShadowRoot(target)) {\n return false;\n }\n const id = mirror2.getId(target);\n if (!mirror2.has(id)) {\n return true;\n }\n const parent = index.parentNode(target);\n if (parent && parent.nodeType === target.DOCUMENT_NODE) {\n return false;\n }\n if (!parent) {\n return true;\n }\n return isAncestorRemoved(parent, mirror2);\n}\nfunction legacy_isTouchEvent(event) {\n return Boolean(event.changedTouches);\n}\nfunction polyfill$1(win = window) {\n if (\"NodeList\" in win && !win.NodeList.prototype.forEach) {\n win.NodeList.prototype.forEach = Array.prototype.forEach;\n }\n if (\"DOMTokenList\" in win && !win.DOMTokenList.prototype.forEach) {\n win.DOMTokenList.prototype.forEach = Array.prototype.forEach;\n }\n}\nfunction queueToResolveTrees(queue) {\n const queueNodeMap = {};\n const putIntoMap = (m, parent) => {\n const nodeInTree = {\n value: m,\n parent,\n children: []\n };\n queueNodeMap[m.node.id] = nodeInTree;\n return nodeInTree;\n };\n const queueNodeTrees = [];\n for (const mutation of queue) {\n const { nextId, parentId } = mutation;\n if (nextId && nextId in queueNodeMap) {\n const nextInTree = queueNodeMap[nextId];\n if (nextInTree.parent) {\n const idx = nextInTree.parent.children.indexOf(nextInTree);\n nextInTree.parent.children.splice(\n idx,\n 0,\n putIntoMap(mutation, nextInTree.parent)\n );\n } else {\n const idx = queueNodeTrees.indexOf(nextInTree);\n queueNodeTrees.splice(idx, 0, putIntoMap(mutation, null));\n }\n continue;\n }\n if (parentId in queueNodeMap) {\n const parentInTree = queueNodeMap[parentId];\n parentInTree.children.push(putIntoMap(mutation, parentInTree));\n continue;\n }\n queueNodeTrees.push(putIntoMap(mutation, null));\n }\n return queueNodeTrees;\n}\nfunction iterateResolveTree(tree, cb) {\n cb(tree.value);\n for (let i2 = tree.children.length - 1; i2 >= 0; i2--) {\n iterateResolveTree(tree.children[i2], cb);\n }\n}\nfunction isSerializedIframe(n2, mirror2) {\n return Boolean(n2.nodeName === \"IFRAME\" && mirror2.getMeta(n2));\n}\nfunction isSerializedStylesheet(n2, mirror2) {\n return Boolean(\n n2.nodeName === \"LINK\" && n2.nodeType === n2.ELEMENT_NODE && n2.getAttribute && n2.getAttribute(\"rel\") === \"stylesheet\" && mirror2.getMeta(n2)\n );\n}\nfunction getBaseDimension(node2, rootIframe) {\n var _a2, _b;\n const frameElement = (_b = (_a2 = node2.ownerDocument) == null ? void 0 : _a2.defaultView) == null ? void 0 : _b.frameElement;\n if (!frameElement || frameElement === rootIframe) {\n return {\n x: 0,\n y: 0,\n relativeScale: 1,\n absoluteScale: 1\n };\n }\n const frameDimension = frameElement.getBoundingClientRect();\n const frameBaseDimension = getBaseDimension(frameElement, rootIframe);\n const relativeScale = frameDimension.height / frameElement.clientHeight;\n return {\n x: frameDimension.x * frameBaseDimension.relativeScale + frameBaseDimension.x,\n y: frameDimension.y * frameBaseDimension.relativeScale + frameBaseDimension.y,\n relativeScale,\n absoluteScale: frameBaseDimension.absoluteScale * relativeScale\n };\n}\nfunction hasShadowRoot(n2) {\n if (!n2) return false;\n if (n2 instanceof BaseRRNode && \"shadowRoot\" in n2) {\n return Boolean(n2.shadowRoot);\n }\n return Boolean(index.shadowRoot(n2));\n}\nfunction getNestedRule(rules2, position) {\n const rule2 = rules2[position[0]];\n if (position.length === 1) {\n return rule2;\n } else {\n return getNestedRule(\n rule2.cssRules[position[1]].cssRules,\n position.slice(2)\n );\n }\n}\nfunction getPositionsAndIndex(nestedIndex) {\n const positions = [...nestedIndex];\n const index2 = positions.pop();\n return { positions, index: index2 };\n}\nfunction uniqueTextMutations(mutations) {\n const idSet = /* @__PURE__ */ new Set();\n const uniqueMutations = [];\n for (let i2 = mutations.length; i2--; ) {\n const mutation = mutations[i2];\n if (!idSet.has(mutation.id)) {\n uniqueMutations.push(mutation);\n idSet.add(mutation.id);\n }\n }\n return uniqueMutations;\n}\nclass StyleSheetMirror {\n constructor() {\n __publicField2(this, \"id\", 1);\n __publicField2(this, \"styleIDMap\", /* @__PURE__ */ new WeakMap());\n __publicField2(this, \"idStyleMap\", /* @__PURE__ */ new Map());\n }\n getId(stylesheet) {\n return this.styleIDMap.get(stylesheet) ?? -1;\n }\n has(stylesheet) {\n return this.styleIDMap.has(stylesheet);\n }\n /**\n * @returns If the stylesheet is in the mirror, returns the id of the stylesheet. If not, return the new assigned id.\n */\n add(stylesheet, id) {\n if (this.has(stylesheet)) return this.getId(stylesheet);\n let newId;\n if (id === void 0) {\n newId = this.id++;\n } else newId = id;\n this.styleIDMap.set(stylesheet, newId);\n this.idStyleMap.set(newId, stylesheet);\n return newId;\n }\n getStyle(id) {\n return this.idStyleMap.get(id) || null;\n }\n reset() {\n this.styleIDMap = /* @__PURE__ */ new WeakMap();\n this.idStyleMap = /* @__PURE__ */ new Map();\n this.id = 1;\n }\n generateId() {\n return this.id++;\n }\n}\nfunction getShadowHost(n2) {\n var _a2;\n let shadowHost = null;\n if (\"getRootNode\" in n2 && ((_a2 = index.getRootNode(n2)) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && index.host(index.getRootNode(n2)))\n shadowHost = index.host(index.getRootNode(n2));\n return shadowHost;\n}\nfunction getRootShadowHost(n2) {\n let rootShadowHost = n2;\n let shadowHost;\n while (shadowHost = getShadowHost(rootShadowHost))\n rootShadowHost = shadowHost;\n return rootShadowHost;\n}\nfunction shadowHostInDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n const shadowHost = getRootShadowHost(n2);\n return index.contains(doc, shadowHost);\n}\nfunction inDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n return index.contains(doc, n2) || shadowHostInDom(n2);\n}\nconst utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n StyleSheetMirror,\n get _mirror() {\n return _mirror;\n },\n closestElementOfNode,\n getBaseDimension,\n getNestedRule,\n getPositionsAndIndex,\n getRootShadowHost,\n getShadowHost,\n getWindowHeight,\n getWindowScroll,\n getWindowWidth,\n hasShadowRoot,\n hookSetter,\n inDom,\n isAncestorRemoved,\n isBlocked,\n isIgnored,\n isSerialized,\n isSerializedIframe,\n isSerializedStylesheet,\n iterateResolveTree,\n legacy_isTouchEvent,\n get nowTimestamp() {\n return nowTimestamp;\n },\n on,\n patch,\n polyfill: polyfill$1,\n queueToResolveTrees,\n shadowHostInDom,\n throttle,\n uniqueTextMutations\n}, Symbol.toStringTag, { value: \"Module\" }));\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar lookup = typeof Uint8Array === \"undefined\" ? [] : new Uint8Array(256);\nfor (var i$1 = 0; i$1 < chars.length; i$1++) {\n lookup[chars.charCodeAt(i$1)] = i$1;\n}\nconst encodedJs = \"KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9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UJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=\";\nconst decodeBase64 = (base64) => Uint8Array.from(atob(base64), (c2) => c2.charCodeAt(0));\ntypeof window !== \"undefined\" && window.Blob && new Blob([decodeBase64(encodedJs)], { type: \"text/javascript;charset=utf-8\" });\ntry {\n if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {\n const cleanFrame = document.createElement(\"iframe\");\n document.body.appendChild(cleanFrame);\n Array.from = ((_a = cleanFrame.contentWindow) == null ? void 0 : _a.Array.from) || Array.from;\n document.body.removeChild(cleanFrame);\n }\n} catch (err) {\n console.debug(\"Unable to override Array.from\", err);\n}\ncreateMirror$2();\nvar n;\n!function(t2) {\n t2[t2.NotStarted = 0] = \"NotStarted\", t2[t2.Running = 1] = \"Running\", t2[t2.Stopped = 2] = \"Stopped\";\n}(n || (n = {}));\nclass StackFrame {\n constructor(obj) {\n __publicField(this, \"fileName\");\n __publicField(this, \"functionName\");\n __publicField(this, \"lineNumber\");\n __publicField(this, \"columnNumber\");\n this.fileName = obj.fileName || \"\";\n this.functionName = obj.functionName || \"\";\n this.lineNumber = obj.lineNumber;\n this.columnNumber = obj.columnNumber;\n }\n toString() {\n const lineNumber = this.lineNumber || \"\";\n const columnNumber = this.columnNumber || \"\";\n if (this.functionName)\n return `${this.functionName} (${this.fileName}:${lineNumber}:${columnNumber})`;\n return `${this.fileName}:${lineNumber}:${columnNumber}`;\n }\n}\nconst FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\nconst CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\nconst SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\nconst ErrorStackParser = {\n /**\n * Given an Error object, extract the most information from it.\n */\n parse: function(error) {\n if (!error) {\n return [];\n }\n if (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n typeof error.stacktrace !== \"undefined\" || // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n typeof error[\"opera#sourceloc\"] !== \"undefined\"\n ) {\n return this.parseOpera(\n error\n );\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n console.warn(\n \"[console-record-plugin]: Failed to parse error object:\",\n error\n );\n return [];\n }\n },\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function(urlLike) {\n if (urlLike.indexOf(\":\") === -1) {\n return [urlLike];\n }\n const regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n const parts = regExp.exec(urlLike.replace(/[()]/g, \"\"));\n if (!parts) throw new Error(`Cannot parse given url: ${urlLike}`);\n return [parts[1], parts[2] || void 0, parts[3] || void 0];\n },\n parseV8OrIE: function(error) {\n const filtered = error.stack.split(\"\\n\").filter(function(line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n return filtered.map(function(line) {\n if (line.indexOf(\"(eval \") > -1) {\n line = line.replace(/eval code/g, \"eval\").replace(/(\\(eval at [^()]*)|(\\),.*$)/g, \"\");\n }\n let sanitizedLine = line.replace(/^\\s+/, \"\").replace(/\\(eval code/g, \"(\");\n const location = sanitizedLine.match(/ (\\((.+):(\\d+):(\\d+)\\)$)/);\n sanitizedLine = location ? sanitizedLine.replace(location[0], \"\") : sanitizedLine;\n const tokens = sanitizedLine.split(/\\s+/).slice(1);\n const locationParts = this.extractLocation(\n location ? location[1] : tokens.pop()\n );\n const functionName = tokens.join(\" \") || void 0;\n const fileName = [\"eval\", \"<anonymous>\"].indexOf(locationParts[0]) > -1 ? void 0 : locationParts[0];\n return new StackFrame({\n functionName,\n fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2]\n });\n }, this);\n },\n parseFFOrSafari: function(error) {\n const filtered = error.stack.split(\"\\n\").filter(function(line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n return filtered.map(function(line) {\n if (line.indexOf(\" > eval\") > -1) {\n line = line.replace(\n / line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g,\n \":$1\"\n );\n }\n if (line.indexOf(\"@\") === -1 && line.indexOf(\":\") === -1) {\n return new StackFrame({\n functionName: line\n });\n } else {\n const functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n const matches = line.match(functionNameRegex);\n const functionName = matches && matches[1] ? matches[1] : void 0;\n const locationParts = this.extractLocation(\n line.replace(functionNameRegex, \"\")\n );\n return new StackFrame({\n functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2]\n });\n }\n }, this);\n },\n parseOpera: function(e) {\n if (!e.stacktrace || e.message.indexOf(\"\\n\") > -1 && e.message.split(\"\\n\").length > e.stacktrace.split(\"\\n\").length) {\n return this.parseOpera9(e);\n } else if (!e.stack) {\n return this.parseOpera10(e);\n } else {\n return this.parseOpera11(e);\n }\n },\n parseOpera9: function(e) {\n const lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n const lines = e.message.split(\"\\n\");\n const result2 = [];\n for (let i = 2, len = lines.length; i < len; i += 2) {\n const match = lineRE.exec(lines[i]);\n if (match) {\n result2.push(\n new StackFrame({\n fileName: match[2],\n lineNumber: parseFloat(match[1])\n })\n );\n }\n }\n return result2;\n },\n parseOpera10: function(e) {\n const lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n const lines = e.stacktrace.split(\"\\n\");\n const result2 = [];\n for (let i = 0, len = lines.length; i < len; i += 2) {\n const match = lineRE.exec(lines[i]);\n if (match) {\n result2.push(\n new StackFrame({\n functionName: match[3] || void 0,\n fileName: match[2],\n lineNumber: parseFloat(match[1])\n })\n );\n }\n }\n return result2;\n },\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function(error) {\n const filtered = error.stack.split(\"\\n\").filter(function(line) {\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\n }, this);\n return filtered.map(function(line) {\n const tokens = line.split(\"@\");\n const locationParts = this.extractLocation(tokens.pop());\n const functionCall = tokens.shift() || \"\";\n const functionName = functionCall.replace(/<anonymous function(: (\\w+))?>/, \"$2\").replace(/\\([^)]*\\)/g, \"\") || void 0;\n return new StackFrame({\n functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2]\n });\n }, this);\n }\n};\nfunction pathToSelector(node2) {\n if (!node2 || !node2.outerHTML) {\n return \"\";\n }\n let path = \"\";\n while (node2.parentElement) {\n let name = node2.localName;\n if (!name) {\n break;\n }\n name = name.toLowerCase();\n const parent = node2.parentElement;\n const domSiblings = [];\n if (parent.children && parent.children.length > 0) {\n for (let i = 0; i < parent.children.length; i++) {\n const sibling = parent.children[i];\n if (sibling.localName && sibling.localName.toLowerCase) {\n if (sibling.localName.toLowerCase() === name) {\n domSiblings.push(sibling);\n }\n }\n }\n }\n if (domSiblings.length > 1) {\n name += `:eq(${domSiblings.indexOf(node2)})`;\n }\n path = name + (path ? \">\" + path : \"\");\n node2 = parent;\n }\n return path;\n}\nfunction isObject(obj) {\n return Object.prototype.toString.call(obj) === \"[object Object]\";\n}\nfunction isObjTooDeep(obj, limit) {\n if (limit === 0) {\n return true;\n }\n const keys = Object.keys(obj);\n for (const key of keys) {\n if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {\n return true;\n }\n }\n return false;\n}\nfunction stringify(obj, stringifyOptions) {\n const options = {\n numOfKeysLimit: 50,\n depthOfLimit: 4\n };\n Object.assign(options, stringifyOptions);\n const stack = [];\n const keys = [];\n return JSON.stringify(\n obj,\n function(key, value) {\n if (stack.length > 0) {\n const thisPos = stack.indexOf(this);\n ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);\n ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);\n if (~stack.indexOf(value)) {\n if (stack[0] === value) {\n value = \"[Circular ~]\";\n } else {\n value = \"[Circular ~.\" + keys.slice(0, stack.indexOf(value)).join(\".\") + \"]\";\n }\n }\n } else {\n stack.push(value);\n }\n if (value === null) return value;\n if (value === void 0) return \"undefined\";\n if (shouldIgnore(value)) {\n return toString(value);\n }\n if (typeof value === \"bigint\") {\n return value.toString() + \"n\";\n }\n if (value instanceof Event) {\n const eventResult = {};\n for (const eventKey in value) {\n const eventValue = value[eventKey];\n if (Array.isArray(eventValue)) {\n eventResult[eventKey] = pathToSelector(\n eventValue.length ? eventValue[0] : null\n );\n } else {\n eventResult[eventKey] = eventValue;\n }\n }\n return eventResult;\n } else if (value instanceof Node) {\n if (value instanceof HTMLElement) {\n return value ? value.outerHTML : \"\";\n }\n return value.nodeName;\n } else if (value instanceof Error) {\n return value.stack ? value.stack + \"\\nEnd of stack for Error object\" : value.name + \": \" + value.message;\n }\n return value;\n }\n );\n function shouldIgnore(_obj) {\n if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {\n return true;\n }\n if (typeof _obj === \"function\") {\n return true;\n }\n if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {\n return true;\n }\n return false;\n }\n function toString(_obj) {\n let str = _obj.toString();\n if (options.stringLengthLimit && str.length > options.stringLengthLimit) {\n str = `${str.slice(0, options.stringLengthLimit)}...`;\n }\n return str;\n }\n}\nconst defaultLogOptions = {\n level: [\n \"assert\",\n \"clear\",\n \"count\",\n \"countReset\",\n \"debug\",\n \"dir\",\n \"dirxml\",\n \"error\",\n \"group\",\n \"groupCollapsed\",\n \"groupEnd\",\n \"info\",\n \"log\",\n \"table\",\n \"time\",\n \"timeEnd\",\n \"timeLog\",\n \"trace\",\n \"warn\"\n ],\n lengthThreshold: 1e3,\n logger: \"console\"\n};\nfunction initLogObserver(cb, win, options) {\n const logOptions = options ? Object.assign({}, defaultLogOptions, options) : defaultLogOptions;\n const loggerType = logOptions.logger;\n if (!loggerType) {\n return () => {\n };\n }\n let logger;\n if (typeof loggerType === \"string\") {\n logger = win[loggerType];\n } else {\n logger = loggerType;\n }\n let logCount = 0;\n let inStack = false;\n const cancelHandlers = [];\n if (logOptions.level.includes(\"error\")) {\n const errorHandler = (event) => {\n const message = event.message, error = event.error;\n const trace = ErrorStackParser.parse(error).map(\n (stackFrame) => stackFrame.toString()\n );\n const payload = [stringify(message, logOptions.stringifyOptions)];\n cb({\n level: \"error\",\n trace,\n payload\n });\n };\n win.addEventListener(\"error\", errorHandler);\n cancelHandlers.push(() => {\n win.removeEventListener(\"error\", errorHandler);\n });\n const unhandledrejectionHandler = (event) => {\n let error;\n let payload;\n if (event.reason instanceof Error) {\n error = event.reason;\n payload = [\n stringify(\n `Uncaught (in promise) ${error.name}: ${error.message}`,\n logOptions.stringifyOptions\n )\n ];\n } else {\n error = new Error();\n payload = [\n stringify(\"Uncaught (in promise)\", logOptions.stringifyOptions),\n stringify(event.reason, logOptions.stringifyOptions)\n ];\n }\n const trace = ErrorStackParser.parse(error).map(\n (stackFrame) => stackFrame.toString()\n );\n cb({\n level: \"error\",\n trace,\n payload\n });\n };\n win.addEventListener(\"unhandledrejection\", unhandledrejectionHandler);\n cancelHandlers.push(() => {\n win.removeEventListener(\"unhandledrejection\", unhandledrejectionHandler);\n });\n }\n for (const levelType of logOptions.level) {\n cancelHandlers.push(replace(logger, levelType));\n }\n return () => {\n cancelHandlers.forEach((h) => h());\n };\n function replace(_logger, level) {\n if (!_logger[level]) {\n return () => {\n };\n }\n return utils.patch(\n _logger,\n level,\n (original) => {\n return (...args) => {\n original.apply(this, args);\n if (level === \"assert\" && !!args[0]) {\n return;\n }\n if (inStack) {\n return;\n }\n inStack = true;\n try {\n const trace = ErrorStackParser.parse(new Error()).map((stackFrame) => stackFrame.toString()).splice(1);\n const argsForPayload = level === \"assert\" ? args.slice(1) : args;\n const payload = argsForPayload.map(\n (s) => stringify(s, logOptions.stringifyOptions)\n );\n logCount++;\n if (logCount < logOptions.lengthThreshold) {\n cb({\n level,\n trace,\n payload\n });\n } else if (logCount === logOptions.lengthThreshold) {\n cb({\n level: \"warn\",\n trace: [],\n payload: [\n stringify(\"The number of log records reached the threshold.\")\n ]\n });\n }\n } catch (error) {\n original(\"rrweb logger error:\", error, ...args);\n } finally {\n inStack = false;\n }\n };\n }\n );\n }\n}\nconst PLUGIN_NAME = \"rrweb/console@1\";\nconst getRecordConsolePlugin = (options) => ({\n name: PLUGIN_NAME,\n observer: initLogObserver,\n options\n});\nexport {\n PLUGIN_NAME,\n getRecordConsolePlugin\n};\n//# sourceMappingURL=rrweb-plugin-console-record.js.map\n","import { ErrorProperties } from '../extensions/exception-autocapture/error-conversion'\nimport type { PostHog } from '../posthog-core'\nimport { SessionIdManager } from '../sessionid'\nimport {\n DeadClicksAutoCaptureConfig,\n ErrorConversionArgs,\n ErrorMetadata,\n Properties,\n RemoteConfig,\n SiteAppLoader,\n} from '../types'\n\n/*\n * Global helpers to protect access to browser globals in a way that is safer for different targets\n * like DOM, SSR, Web workers etc.\n *\n * NOTE: Typically we want the \"window\" but globalThis works for both the typical browser context as\n * well as other contexts such as the web worker context. Window is still exported for any bits that explicitly require it.\n * If in doubt - export the global you need from this file and use that as an optional value. This way the code path is forced\n * to handle the case where the global is not available.\n */\n\n// eslint-disable-next-line no-restricted-globals\nconst win: (Window & typeof globalThis) | undefined = typeof window !== 'undefined' ? window : undefined\n\nexport type AssignableWindow = Window &\n typeof globalThis &\n Record<string, any> & {\n __PosthogExtensions__?: PostHogExtensions\n\n _POSTHOG_REMOTE_CONFIG?: Record<\n string,\n {\n config: RemoteConfig\n siteApps: SiteAppLoader[]\n }\n >\n }\n\n/**\n * This is our contract between (potentially) lazily loaded extensions and the SDK\n * changes to this interface can be breaking changes for users of the SDK\n */\n\nexport type PostHogExtensionKind =\n | 'toolbar'\n | 'exception-autocapture'\n | 'web-vitals'\n | 'recorder'\n | 'tracing-headers'\n | 'surveys'\n | 'dead-clicks-autocapture'\n | 'remote-config'\n\nexport interface LazyLoadedDeadClicksAutocaptureInterface {\n start: (observerTarget: Node) => void\n stop: () => void\n}\n\ninterface PostHogExtensions {\n loadExternalDependency?: (\n posthog: PostHog,\n kind: PostHogExtensionKind,\n callback: (error?: string | Event, event?: Event) => void\n ) => void\n\n loadSiteApp?: (posthog: PostHog, appUrl: string, callback: (error?: string | Event, event?: Event) => void) => void\n\n parseErrorAsProperties?: ({ error, event }: ErrorConversionArgs, metadata?: ErrorMetadata) => ErrorProperties\n errorWrappingFunctions?: {\n wrapOnError: (captureFn: (props: Properties) => void) => () => void\n wrapUnhandledRejection: (captureFn: (props: Properties) => void) => () => void\n }\n rrweb?: { record: any; version: string }\n rrwebPlugins?: { getRecordConsolePlugin: any; getRecordNetworkPlugin?: any }\n canActivateRepeatedly?: (survey: any) => boolean\n generateSurveys?: (posthog: PostHog) => any | undefined\n postHogWebVitalsCallbacks?: {\n onLCP: (metric: any) => void\n onCLS: (metric: any) => void\n onFCP: (metric: any) => void\n onINP: (metric: any) => void\n }\n tracingHeadersPatchFns?: {\n _patchFetch: (sessionManager?: SessionIdManager) => () => void\n _patchXHR: (sessionManager?: SessionIdManager) => () => void\n }\n initDeadClicksAutocapture?: (\n ph: PostHog,\n config: DeadClicksAutoCaptureConfig\n ) => LazyLoadedDeadClicksAutocaptureInterface\n}\n\nconst global: typeof globalThis | undefined = typeof globalThis !== 'undefined' ? globalThis : win\n\nexport const ArrayProto = Array.prototype\nexport const nativeForEach = ArrayProto.forEach\nexport const nativeIndexOf = ArrayProto.indexOf\n\nexport const navigator = global?.navigator\nexport const document = global?.document\nexport const location = global?.location\nexport const fetch = global?.fetch\nexport const XMLHttpRequest =\n global?.XMLHttpRequest && 'withCredentials' in new global.XMLHttpRequest() ? global.XMLHttpRequest : undefined\nexport const AbortController = global?.AbortController\nexport const userAgent = navigator?.userAgent\nexport const assignableWindow: AssignableWindow = win ?? ({} as any)\n\nexport { win as window }\n","import type { recordOptions } from './extensions/replay/types/rrweb'\nimport type { SegmentAnalytics } from './extensions/segment-integration'\nimport { PostHog } from './posthog-core'\n\nexport type Property = any\nexport type Properties = Record<string, Property>\n\nexport const COPY_AUTOCAPTURE_EVENT = '$copy_autocapture'\n\nexport const knownUnsafeEditableEvent = [\n '$snapshot',\n '$pageview',\n '$pageleave',\n '$set',\n 'survey dismissed',\n 'survey sent',\n 'survey shown',\n '$identify',\n '$groupidentify',\n '$create_alias',\n '$$client_ingestion_warning',\n '$web_experiment_applied',\n '$feature_enrollment_update',\n '$feature_flag_called',\n] as const\n\n/**\n * These events can be processed by the `beforeCapture` function\n * but can cause unexpected confusion in data.\n *\n * Some features of PostHog rely on receiving 100% of these events\n */\nexport type KnownUnsafeEditableEvent = (typeof knownUnsafeEditableEvent)[number]\n\n/**\n * These are known events PostHog events that can be processed by the `beforeCapture` function\n * That means PostHog functionality does not rely on receiving 100% of these for calculations\n * So, it is safe to sample them to reduce the volume of events sent to PostHog\n */\nexport type KnownEventName =\n | '$heatmaps_data'\n | '$opt_in'\n | '$exception'\n | '$$heatmap'\n | '$web_vitals'\n | '$dead_click'\n | '$autocapture'\n | typeof COPY_AUTOCAPTURE_EVENT\n | '$rageclick'\n\nexport type EventName =\n | KnownUnsafeEditableEvent\n | KnownEventName\n // magic value so that the type of EventName is a set of known strings or any other string\n // which means you get autocomplete for known strings\n // but no type complaints when you add an arbitrary string\n | (string & {})\n\nexport interface CaptureResult {\n uuid: string\n event: EventName\n properties: Properties\n $set?: Properties\n $set_once?: Properties\n timestamp?: Date\n}\n\nexport type AutocaptureCompatibleElement = 'a' | 'button' | 'form' | 'input' | 'select' | 'textarea' | 'label'\nexport type DomAutocaptureEvents = 'click' | 'change' | 'submit'\n\n/**\n * If an array is passed for an allowlist, autocapture events will only be sent for elements matching\n * at least one of the elements in the array. Multiple allowlists can be used\n */\nexport interface AutocaptureConfig {\n /**\n * List of URLs to allow autocapture on, can be strings to match\n * or regexes e.g. ['https://example.com', 'test.com/.*']\n * this is useful when you want to autocapture on specific pages only\n *\n * if you set both url_allowlist and url_ignorelist,\n * we check the allowlist first and then the ignorelist.\n * the ignorelist can override the allowlist\n */\n url_allowlist?: (string | RegExp)[]\n\n /**\n * List of URLs to not allow autocapture on, can be strings to match\n * or regexes e.g. ['https://example.com', 'test.com/.*']\n * this is useful when you want to autocapture on most pages but not some specific ones\n *\n * if you set both url_allowlist and url_ignorelist,\n * we check the allowlist first and then the ignorelist.\n * the ignorelist can override the allowlist\n */\n url_ignorelist?: (string | RegExp)[]\n\n /**\n * List of DOM events to allow autocapture on e.g. ['click', 'change', 'submit']\n */\n dom_event_allowlist?: DomAutocaptureEvents[]\n\n /**\n * List of DOM elements to allow autocapture on\n * e.g. ['a', 'button', 'form', 'input', 'select', 'textarea', 'label']\n *\n * We consider the tree of elements from the root to the target element of the click event\n * so for the tree `div > div > button > svg`\n * if the allowlist has `button` then we allow the capture when the `button` or the `svg` is the click target\n * but not if either of the `div`s are detected as the click target\n */\n element_allowlist?: AutocaptureCompatibleElement[]\n\n /**\n * List of CSS selectors to allow autocapture on\n * e.g. ['[ph-capture]']\n * we consider the tree of elements from the root to the target element of the click event\n * so for the tree div > div > button > svg\n * and allow list config `['[id]']`\n * we will capture the click if the click-target or its parents has any id\n *\n * Everything is allowed when there's no allowlist\n */\n css_selector_allowlist?: string[]\n\n /**\n * Exclude certain element attributes from autocapture\n * E.g. ['aria-label'] or [data-attr-pii]\n */\n element_attribute_ignorelist?: string[]\n\n /**\n * When set to true, autocapture will capture the text of any element that is cut or copied.\n */\n capture_copied_text?: boolean\n}\n\nexport interface BootstrapConfig {\n distinctID?: string\n isIdentifiedID?: boolean\n featureFlags?: Record<string, boolean | string>\n featureFlagPayloads?: Record<string, JsonType>\n\n /**\n * Optionally provide a sessionID, this is so that you can provide an existing sessionID here to continue a user's session across a domain or device. It MUST be:\n * - unique to this user\n * - a valid UUID v7\n * - the timestamp part must be <= the timestamp of the first event in the session\n * - the timestamp of the last event in the session must be < the timestamp part + 24 hours\n * **/\n sessionID?: string\n}\n\nexport type SupportedWebVitalsMetrics = 'LCP' | 'CLS' | 'FCP' | 'INP'\n\nexport interface PerformanceCaptureConfig {\n /**\n * Works with session replay to use the browser's native performance observer to capture performance metrics\n */\n network_timing?: boolean\n\n /**\n * Use chrome's web vitals library to wrap fetch and capture web vitals\n */\n web_vitals?: boolean\n\n /**\n * We observe very large values reported by the Chrome web vitals library\n * These outliers are likely not real, useful values, and we exclude them\n * You can set this to 0 in order to include all values, NB this is not recommended\n *\n * @default 15 * 60 * 1000 (15 minutes)\n */\n __web_vitals_max_value?: number\n\n /**\n * By default all 4 metrics are captured\n * You can set this config to restrict which metrics are captured\n * e.g. ['CLS', 'FCP'] to only capture those two metrics\n * NB setting this does not override whether the capture is enabled\n *\n * @default ['LCP', 'CLS', 'FCP', 'INP']\n */\n web_vitals_allowed_metrics?: SupportedWebVitalsMetrics[]\n\n /**\n * We delay flushing web vitals metrics to reduce the number of events we send\n * This is the maximum time we will wait before sending the metrics\n *\n * @default 5000\n */\n web_vitals_delayed_flush_ms?: number\n}\n\nexport interface DeadClickCandidate {\n node: Element\n originalEvent: MouseEvent\n timestamp: number\n // time between click and the most recent scroll\n scrollDelayMs?: number\n // time between click and the most recent mutation\n mutationDelayMs?: number\n // time between click and the most recent selection changed event\n selectionChangedDelayMs?: number\n // if neither scroll nor mutation seen before threshold passed\n absoluteDelayMs?: number\n}\n\nexport type DeadClicksAutoCaptureConfig = {\n /**\n * We'll not consider a click to be a dead click, if it's followed by a scroll within `scroll_threshold_ms` milliseconds\n *\n * @default 100\n */\n scroll_threshold_ms?: number\n\n /**\n * We'll not consider a click to be a dead click, if it's followed by a selection change within `selection_change_threshold_ms` milliseconds\n *\n * @default 100\n */\n selection_change_threshold_ms?: number\n\n /**\n * We'll not consider a click to be a dead click, if it's followed by a mutation within `mutation_threshold_ms` milliseconds\n *\n * @default 2500\n */\n mutation_threshold_ms?: number\n\n /**\n * Allows setting behavior for when a dead click is captured.\n * For e.g. to support capture to heatmaps\n *\n * If not provided the default behavior is to auto-capture dead click events\n *\n * Only intended to be provided by our own SDK\n */\n __onCapture?: ((click: DeadClickCandidate, properties: Properties) => void) | undefined\n} & Pick<AutocaptureConfig, 'element_attribute_ignorelist'>\n\nexport interface HeatmapConfig {\n /**\n * How often to send batched data in `$heatmap_data` events\n * If set to 0 or not set, sends using the default interval of 1 second\n *\n * @default 1000\n */\n flush_interval_milliseconds: number\n}\n\nexport type BeforeSendFn = (cr: CaptureResult | null) => CaptureResult | null\n\n/**\n * Configuration options for the PostHog JavaScript SDK.\n * @see https://posthog.com/docs/libraries/js#config\n */\nexport interface PostHogConfig {\n /** URL of your PostHog instance.\n *\n * @default 'https://us.i.posthog.com'\n */\n api_host: string\n\n /**\n * If using a reverse proxy for `api_host` then this should be the actual PostHog app URL (e.g. https://us.posthog.com).\n * This ensures that links to PostHog point to the correct host.\n *\n * @default null\n */\n ui_host: string | null\n\n /**\n * The transport method to use for API requests.\n *\n * @default 'fetch'\n */\n api_transport?: 'XHR' | 'fetch'\n\n /**\n * The token for your PostHog project.\n * It should NOT be provided manually in the config, but rather passed as the first parameter to `posthog.init()`.\n */\n token: string\n\n /**\n * The name this instance will be identified by.\n * You don't need to set this most of the time,\n * but can be useful if you have several Posthog instances running at the same time.\n *\n * @default 'posthog'\n */\n name: string\n\n /**\n * Determines whether PostHog should autocapture events.\n * This setting does not affect capturing pageview events (see `capture_pageview`).\n *\n * @default true\n */\n autocapture: boolean | AutocaptureConfig\n\n /**\n * Determines whether PostHog should capture rage clicks.\n *\n * @default true\n */\n rageclick: boolean\n\n /**\n * Determines if cookie should be set on the top level domain (example.com).\n * If PostHog-js is loaded on a subdomain (test.example.com), and `cross_subdomain_cookie` is set to false,\n * it'll set the cookie on the subdomain only (test.example.com).\n *\n * NOTE: It will be set to `false` if we detect that the domain is a subdomain of a platform that is excluded from cross-subdomain cookie setting.\n * The current list of excluded platforms is `herokuapp.com`, `vercel.app`, and `netlify.app`.\n *\n * @see `isCrossDomainCookie`\n * @default true\n */\n cross_subdomain_cookie: boolean\n\n /**\n * Determines how PostHog stores information about the user. See [persistence](https://posthog.com/docs/libraries/js#persistence) for details.\n *\n * @default 'localStorage+cookie'\n */\n persistence: 'localStorage' | 'cookie' | 'memory' | 'localStorage+cookie' | 'sessionStorage'\n\n /**\n * The name for the super properties persistent store\n *\n * @default ''\n */\n persistence_name: string\n\n /** @deprecated - Use 'persistence_name' instead */\n cookie_name?: string\n\n /**\n * A function to be called once the PostHog scripts have loaded successfully.\n *\n * @param posthog_instance - The PostHog instance that has been loaded.\n */\n loaded: (posthog_instance: PostHog) => void\n\n /**\n * Determines whether PostHog should save referrer information.\n *\n * @default true\n */\n save_referrer: boolean\n\n /**\n * Determines whether PostHog should save marketing parameters.\n * These are `utm_*` paramaters and friends.\n *\n * @see {CAMPAIGN_PARAMS} from './utils/event-utils' - Default campaign parameters like utm_source, utm_medium, etc.\n * @default true\n */\n save_campaign_params: boolean\n\n /** @deprecated - Use `save_campaign_params` instead */\n store_google?: boolean\n\n /**\n * Used to extend the list of campaign parameters that are saved by default.\n *\n * @see {CAMPAIGN_PARAMS} from './utils/event-utils' - Default campaign parameters like utm_source, utm_medium, etc.\n * @default []\n */\n custom_campaign_params: string[]\n\n /**\n * Used to extend the list of user agents that are blocked by default.\n *\n * @see {DEFAULT_BLOCKED_UA_STRS} from './utils/blocked-uas' - Default list of blocked user agents.\n * @default []\n */\n custom_blocked_useragents: string[]\n\n /**\n * Determines whether PostHog should be in debug mode.\n * You can enable this to get more detailed logging.\n *\n * You can also enable this on your website by appending `?__posthog_debug=true` at the end of your URL\n * You can also call `posthog.debug()` in your code to enable debug mode\n *\n * @default false\n */\n debug: boolean\n\n /** @deprecated Use `debug` instead */\n verbose?: boolean\n\n /**\n * Determines whether PostHog should capture pageview events automatically.\n *\n * @default true\n */\n capture_pageview: boolean\n\n /**\n * Determines whether PostHog should capture pageleave events.\n * If set to `true`, it will capture pageleave events for all pages.\n * If set to `'if_capture_pageview'`, it will only capture pageleave events if `capture_pageview` is also set to `true`.\n *\n * @default 'if_capture_pageview'\n */\n capture_pageleave: boolean | 'if_capture_pageview'\n\n /**\n * Determines the number of days to store cookies for.\n *\n * @default 365\n */\n cookie_expiration: number\n\n /**\n * Determines whether PostHog should upgrade old cookies.\n * If set to `true`, the library will check for a cookie from our old js library and import super properties from it, then the old cookie is deleted.\n * This option only works in the initialization, so make sure you set it when you create the library.\n *\n * @default false\n */\n upgrade: boolean\n\n /**\n * Determines whether PostHog should disable session recording.\n *\n * @default false\n */\n disable_session_recording: boolean\n\n /**\n * Determines whether PostHog should disable persistence.\n * If set to `true`, the library will not save any data to the browser. It will also delete any data previously saved to the browser.\n *\n * @default false\n */\n disable_persistence: boolean\n\n /** @deprecated - use `disable_persistence` instead */\n disable_cookie?: boolean\n\n /**\n * Determines whether PostHog should disable surveys.\n *\n * @default false\n */\n disable_surveys: boolean\n\n /**\n * Determines whether PostHog should disable web experiments.\n *\n * Currently disabled while we're in BETA. It will be toggled to `true` in a future release.\n *\n * @default true\n */\n disable_web_experiments: boolean\n\n /**\n * Determines whether PostHog should disable any external dependency loading.\n * This will prevent PostHog from requesting any external scripts such as those needed for Session Replay, Surveys or Site Apps.\n *\n * @default false\n */\n disable_external_dependency_loading: boolean\n\n /**\n * A function to be called when a script is being loaded.\n * This can be used to modify the script before it is loaded.\n * This is useful for adding a nonce to the script, for example.\n *\n * @param script - The script element that is being loaded.\n * @returns The modified script element, or null if the script should not be loaded.\n */\n prepare_external_dependency_script?: (script: HTMLScriptElement) => HTMLScriptElement | null\n\n /**\n * A function to be called when a stylesheet is being loaded.\n * This can be used to modify the stylesheet before it is loaded.\n * This is useful for adding a nonce to the stylesheet, for example.\n *\n * @param stylesheet - The stylesheet element that is being loaded.\n * @returns The modified stylesheet element, or null if the stylesheet should not be loaded.\n */\n prepare_external_dependency_stylesheet?: (stylesheet: HTMLStyleElement) => HTMLStyleElement | null\n\n /**\n * Determines whether PostHog should enable recording console logs.\n * When undefined, it falls back to the remote config setting.\n *\n * @default undefined\n */\n enable_recording_console_log?: boolean\n\n /**\n * Determines whether PostHog should use secure cookies.\n * If this is `true`, PostHog cookies will be marked as secure,\n * meaning they will only be transmitted over HTTPS.\n *\n * @default window.location.protocol === 'https:'\n */\n secure_cookie: boolean\n\n /**\n * Determines whether PostHog should capture IP addresses.\n *\n * @default true\n */\n ip: boolean\n\n /**\n * Determines if users should be opted out of PostHog tracking by default,\n * requiring additional logic to opt them into capturing by calling `posthog.opt_in_capturing()`.\n *\n * @default false\n */\n opt_out_capturing_by_default: boolean\n\n /**\n * Determines where we'll save the information about whether users are opted out of capturing.\n *\n * @default 'localStorage'\n */\n opt_out_capturing_persistence_type: 'localStorage' | 'cookie'\n\n /**\n * Determines if users should be opted out of browser data storage by this PostHog instance by default,\n * requiring additional logic to opt them into capturing by calling `posthog.opt_in_capturing()`.\n *\n * @default false\n */\n opt_out_persistence_by_default?: boolean\n\n /**\n * Determines if users should be opted out of user agent filtering such as googlebot or other bots.\n * If this is set to `true`, PostHog will set `$browser_type` to either `bot` or `browser` for all events,\n * but will process all events as if they were from a browser.\n *\n * @default false\n */\n opt_out_useragent_filter: boolean\n\n /**\n * Determines the prefix for the cookie used to store the information about whether users are opted out of capturing.\n * When `null`, it falls back to the default prefix found in `consent.ts`.\n *\n * @default null\n */\n opt_out_capturing_cookie_prefix: string | null\n\n /**\n * Determines if users should be opted in to site apps.\n *\n * @default false\n */\n opt_in_site_apps: boolean\n\n /**\n * Determines whether PostHog should respect the Do Not Track header when computing\n * consent in `ConsentManager`.\n *\n * @see `ConsentManager`\n * @default false\n */\n respect_dnt: boolean\n\n /**\n * A list of properties that should never be sent with capture calls.\n *\n * @default []\n */\n property_denylist: string[]\n\n /** @deprecated - use `property_denylist` instead */\n property_blacklist?: string[]\n\n /**\n * A list of headers that should be sent with requests to the PostHog API.\n *\n * @default {}\n */\n request_headers: { [header_name: string]: string }\n\n /** @deprecated - use `request_headers` instead */\n xhr_headers?: { [header_name: string]: string }\n\n /**\n * A function that is called when a request to the PostHog API fails.\n *\n * @param error - The `RequestResponse` object that occurred.\n */\n on_request_error?: (error: RequestResponse) => void\n\n /** @deprecated - use `on_request_error` instead */\n on_xhr_error?: (failedRequest: XMLHttpRequest) => void\n\n /**\n * Determines whether PostHog should batch requests to the PostHog API.\n *\n * @default true\n */\n request_batching: boolean\n\n /**\n * Determines the maximum length of the properties string that can be sent with capture calls.\n *\n * @default 65535\n */\n properties_string_max_length: number\n\n /**\n * Determines the session recording options.\n *\n * @see `SessionRecordingOptions`\n * @default {}\n */\n session_recording: SessionRecordingOptions\n\n /**\n * Determines the session idle timeout in seconds.\n * Any new event that's happened after this timeout will create a new session.\n *\n * @default 30 * 60 -- 30 minutes\n */\n session_idle_timeout_seconds: number\n\n /**\n * Prevent autocapture from capturing any attribute names on elements.\n *\n * @default false\n */\n mask_all_element_attributes: boolean\n\n /**\n * Prevent autocapture from capturing `textContent` on elements.\n *\n * @default false\n */\n mask_all_text: boolean\n\n /**\n * Prevent autocapture from capturing personal data properties.\n * These include campaign parameters, UTM parameters, and other parameters that could be considered personal data under e.g. GDPR.\n *\n * @default false\n */\n mask_personal_data_properties: boolean\n\n /**\n * Custom list of personal data properties to mask.\n *\n * @default []\n */\n custom_personal_data_properties: string[]\n\n /**\n * One of the very first things the PostHog library does when init() is called\n * is make a request to the /decide endpoint on PostHog's backend.\n * This endpoint contains information on how to run the PostHog library\n * so events are properly received in the backend.\n *\n * This endpoint is required to run most features of the library.\n * However, if you're not using any of the described features,\n * you may wish to turn off the call completely to avoid an extra request\n * and reduce resource usage on both the client and the server.\n *\n * @default false\n */\n advanced_disable_decide: boolean\n\n /**\n * Will keep /decide running, but without any feature flag requests\n *\n * @default false\n */\n advanced_disable_feature_flags: boolean\n\n /**\n * Stops from firing feature flag requests on first page load.\n * Only requests feature flags when user identity or properties are updated,\n * or you manually request for flags to be loaded.\n *\n * @default false\n */\n advanced_disable_feature_flags_on_first_load: boolean\n\n /**\n * Determines whether PostHog should disable toolbar metrics.\n * This is our internal instrumentation for our toolbar in your website.\n *\n * @default false\n */\n advanced_disable_toolbar_metrics: boolean\n\n /**\n * Sets timeout for fetching feature flags\n *\n * @default 3000\n */\n feature_flag_request_timeout_ms: number\n\n /**\n * Sets timeout for fetching surveys\n *\n * @default 10000\n */\n surveys_request_timeout_ms: number\n\n /**\n * Function to get the device ID.\n * This doesn't usually need to be set, but can be useful if you want to use a custom device ID.\n *\n * @param uuid - The UUID we would use for the device ID.\n * @returns The device ID.\n *\n * @default (uuid) => uuid\n */\n get_device_id: (uuid: string) => string\n\n /**\n * This function or array of functions - if provided - are called immediately before sending data to the server.\n * It allows you to edit data before it is sent, or choose not to send it all.\n * if provided as an array the functions are called in the order they are provided\n * any one function returning null means the event will not be sent\n */\n before_send?: BeforeSendFn | BeforeSendFn[]\n\n /** @deprecated - use `before_send` instead */\n sanitize_properties: ((properties: Properties, event_name: string) => Properties) | null\n\n /** @deprecated - use `before_send` instead */\n _onCapture: (eventName: string, eventData: CaptureResult) => void\n\n /**\n * Determines whether to capture performance metrics.\n * These include Network Timing and Web Vitals.\n *\n * When `undefined`, fallback to the remote configuration.\n * If `false`, neither network timing nor web vitals will work.\n * If an object, that will override the remote configuration.\n *\n * @see {PerformanceCaptureConfig}\n * @default undefined\n */\n capture_performance?: boolean | PerformanceCaptureConfig\n\n /**\n * Determines whether to disable compression when sending events to the server.\n * WARNING: Should only be used for testing. Could negatively impact performance.\n *\n * @default false\n */\n disable_compression: boolean\n\n /**\n * An object containing the `distinctID`, `isIdentifiedID`, and `featureFlags` keys,\n * where `distinctID` is a string, and `featureFlags` is an object of key-value pairs.\n *\n * Since there is a delay between initializing PostHog and fetching feature flags,\n * feature flags are not always available immediately.\n * This makes them unusable if you want to do something like redirecting a user\n * to a different page based on a feature flag.\n *\n * You can, therefore, fetch the feature flags in your server and pre-fill them here,\n * allowing PostHog to know the feature flag values immediately.\n *\n * After the SDK fetches feature flags from PostHog, it will use those flag values instead of bootstrapped ones.\n *\n * @default {}\n */\n bootstrap: BootstrapConfig\n\n /**\n * The segment analytics object.\n *\n * @see https://posthog.com/docs/libraries/segment\n */\n segment?: SegmentAnalytics\n\n /**\n * Determines whether to capture heatmaps.\n *\n * @see {HeatmapConfig}\n * @default undefined\n */\n capture_heatmaps?: boolean | HeatmapConfig\n\n /* @deprecated - use `capture_heatmaps` instead */\n enable_heatmaps?: boolean\n\n /**\n * Determines whether to capture dead clicks.\n *\n * @see {DeadClicksAutoCaptureConfig}\n * @default undefined\n */\n capture_dead_clicks?: boolean | DeadClicksAutoCaptureConfig\n\n /**\n * Determines whether to capture exceptions.\n *\n * @default undefined\n */\n capture_exceptions?: boolean\n\n /**\n * Determines whether to disable scroll properties.\n * These allow you to keep track of how far down someone scrolled in your website.\n *\n * @default false\n */\n disable_scroll_properties?: boolean\n\n /**\n * Let the pageview scroll stats use a custom css selector for the root element, e.g. `main`\n * It will use `window.document.documentElement` if not specified.\n */\n scroll_root_selector?: string | string[]\n\n /**\n * You can control whether events from PostHog-js have person processing enabled with the `person_profiles` config setting.\n * There are three options:\n * - `person_profiles: 'always'` - we will process persons data for all events\n * - `person_profiles: 'never'` - we won't process persons for any event. This means that anonymous users will not be merged once they sign up or login, so you lose the ability to create funnels that track users from anonymous to identified. All events (including `$identify`) will be sent with `$process_person_profile: False`.\n * - `person_profiles: 'identified_only'` _(default)_ - we will only process persons when you call `posthog.identify`, `posthog.alias`, `posthog.setPersonProperties`, `posthog.group`, `posthog.setPersonPropertiesForFlags` or `posthog.setGroupPropertiesForFlags` Anonymous users won't get person profiles.\n *\n * @default 'identified_only'\n */\n person_profiles?: 'always' | 'never' | 'identified_only'\n\n /** @deprecated - use `person_profiles` instead */\n process_person?: 'always' | 'never' | 'identified_only'\n\n /**\n * Client side rate limiting\n */\n rate_limiting?: {\n /**\n * The average number of events per second that should be permitted\n *\n * @default 10\n */\n events_per_second?: number\n\n /**\n * How many events can be captured in a burst. This defaults to 10 times the events_per_second count\n *\n * @default 10 * `events_per_second`\n */\n events_burst_limit?: number\n }\n\n /**\n * Used when sending data via `fetch`, use with care.\n * This is intentionally meant to be used with NextJS `fetch`\n *\n * Incorrect `cache` usage may cause out-of-date data for feature flags, actions tracking, etc.\n * See https://nextjs.org/docs/app/api-reference/functions/fetch#fetchurl-options\n */\n fetch_options?: {\n cache?: RequestInit['cache']\n next_options?: NextOptions\n }\n\n /**\n * Used to change the behavior of the request queue.\n * This is an advanced feature and should be used with caution.\n */\n request_queue_config?: RequestQueueConfig\n\n // ------- PREVIEW CONFIGS -------\n\n /**\n * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION\n * Whether to wrap fetch and add tracing headers to the request\n * */\n __add_tracing_headers?: boolean\n\n /**\n * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION\n * Enables the new RemoteConfig approach to loading config instead of decide\n * */\n __preview_remote_config?: boolean\n\n /**\n * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION\n * Whether to send a sentinel value for distinct id, device id, and session id, which will be replaced server-side by a cookieless hash\n * */\n __preview_experimental_cookieless_mode?: boolean\n\n // ------- RETIRED CONFIGS - NO REPLACEMENT OR USAGE -------\n\n /** @deprecated - NOT USED ANYMORE, kept here for backwards compatibility reasons */\n api_method?: string\n\n /** @deprecated - NOT USED ANYMORE, kept here for backwards compatibility reasons */\n inapp_protocol?: string\n\n /** @deprecated - NOT USED ANYMORE, kept here for backwards compatibility reasons */\n inapp_link_new_window?: boolean\n}\n\nexport interface SessionRecordingOptions {\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default 'ph-no-capture'\n */\n blockClass?: string | RegExp\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default null\n */\n blockSelector?: string | null\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default 'ph-ignore-input'\n */\n ignoreClass?: string | RegExp\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default 'ph-mask'\n */\n maskTextClass?: string | RegExp\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n */\n maskTextSelector?: string | null\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n */\n maskTextFn?: ((text: string, element?: HTMLElement) => string) | null\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n */\n maskAllInputs?: boolean\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n */\n maskInputOptions?: recordOptions['maskInputOptions']\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n */\n maskInputFn?: ((text: string, element?: HTMLElement) => string) | null\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default {}\n */\n slimDOMOptions?: recordOptions['slimDOMOptions']\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default false\n */\n collectFonts?: boolean\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default true\n */\n inlineStylesheet?: boolean\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default false\n */\n recordCrossOriginIframes?: boolean\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default false\n */\n recordHeaders?: boolean\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default false\n */\n recordBody?: boolean\n\n /**\n * Allows local config to override remote canvas recording settings from the decide response\n */\n captureCanvas?: SessionRecordingCanvasOptions\n\n /**\n * Modify the network request before it is captured. Returning null or undefined stops it being captured\n */\n maskCapturedNetworkRequestFn?: ((data: CapturedNetworkRequest) => CapturedNetworkRequest | null | undefined) | null\n\n /** @deprecated - use maskCapturedNetworkRequestFn instead */\n maskNetworkRequestFn?: ((data: NetworkRequest) => NetworkRequest | null | undefined) | null\n\n /**\n * ADVANCED: while a user is active we take a full snapshot of the browser every interval.\n * For very few sites playback performance might be better with different interval.\n * Set to 0 to disable\n *\n * @default 1000 * 60 * 5 (5 minutes)\n */\n full_snapshot_interval_millis?: number\n\n /**\n * ADVANCED: whether to partially compress rrweb events before sending them to the server,\n * defaults to true, can be set to false to disable partial compression\n * NB requests are still compressed when sent to the server regardless of this setting\n *\n * @default true\n */\n compress_events?: boolean\n\n /**\n * ADVANCED: alters the threshold before a recording considers a user has become idle.\n * Normally only altered alongside changes to session_idle_timeout_ms.\n *\n * @default 1000 * 60 * 5 (5 minutes)\n */\n session_idle_threshold_ms?: number\n\n /**\n * ADVANCED: alters the refill rate for the token bucket mutation throttling\n * Normally only altered alongside posthog support guidance.\n * Accepts values between 0 and 100\n *\n * @default 10\n */\n __mutationRateLimiterRefillRate?: number\n\n /**\n * ADVANCED: alters the bucket size for the token bucket mutation throttling\n * Normally only altered alongside posthog support guidance.\n * Accepts values between 0 and 100\n *\n * @default 100\n */\n __mutationRateLimiterBucketSize?: number\n}\n\nexport type SessionIdChangedCallback = (\n sessionId: string,\n windowId: string | null | undefined,\n changeReason?: { noSessionId: boolean; activityTimeout: boolean; sessionPastMaximumLength: boolean }\n) => void\n\nexport enum Compression {\n GZipJS = 'gzip-js',\n Base64 = 'base64',\n}\n\n// Request types - these should be kept minimal to what request.ts needs\n\n// Minimal class to allow interop between different request methods (xhr / fetch)\nexport interface RequestResponse {\n statusCode: number\n text?: string\n json?: any\n}\n\nexport type RequestCallback = (response: RequestResponse) => void\n\n// See https://nextjs.org/docs/app/api-reference/functions/fetch#fetchurl-options\ntype NextOptions = { revalidate: false | 0 | number; tags: string[] }\n\nexport interface RequestWithOptions {\n url: string\n // Data can be a single object or an array of objects when batched\n data?: Record<string, any> | Record<string, any>[]\n headers?: Record<string, any>\n transport?: 'XHR' | 'fetch' | 'sendBeacon'\n method?: 'POST' | 'GET'\n urlQueryArgs?: { compression: Compression }\n callback?: RequestCallback\n timeout?: number\n noRetries?: boolean\n compression?: Compression | 'best-available'\n fetchOptions?: {\n cache?: RequestInit['cache']\n next?: NextOptions\n }\n}\n\n// Queued request types - the same as a request but with additional queueing information\n\nexport interface QueuedRequestWithOptions extends RequestWithOptions {\n /** key of queue, e.g. 'sessionRecording' vs 'event' */\n batchKey?: string\n}\n\n// Used explicitly for retriable requests\nexport interface RetriableRequestWithOptions extends QueuedRequestWithOptions {\n retriesPerformedSoFar?: number\n}\n\n// we used to call a request that was sent to the queue with options attached `RequestQueueOptions`\n// so we can't call the options used to configure the behavior of the RequestQueue that as well,\n// so instead we call them config\nexport interface RequestQueueConfig {\n /**\n * ADVANCED - alters the frequency which PostHog sends events to the server.\n * generally speaking this is only set when apps have automatic page refreshes, or very short visits.\n * Defaults to 3 seconds when not set\n * Allowed values between 250 and 5000\n * */\n flush_interval_ms?: number\n}\n\nexport interface CaptureOptions {\n /**\n * Used when `$identify` is called\n * Will set person properties overriding previous values\n */\n $set?: Properties\n\n /**\n * Used when `$identify` is called\n * Will set person properties but only once, it will NOT override previous values\n */\n $set_once?: Properties\n\n /**\n * Used to override the desired endpoint for the captured event\n */\n _url?: string\n\n /**\n * key of queue, e.g. 'sessionRecording' vs 'event'\n */\n _batchKey?: string\n\n /**\n * If set, overrides and disables config.properties_string_max_length\n */\n _noTruncate?: boolean\n\n /**\n * If set, skips the batched queue\n */\n send_instantly?: boolean\n\n /**\n * If set, skips the client side rate limiting\n */\n skip_client_rate_limiting?: boolean\n\n /**\n * If set, overrides the desired transport method\n */\n transport?: RequestWithOptions['transport']\n\n /**\n * If set, overrides the current timestamp\n */\n timestamp?: Date\n}\n\nexport type FlagVariant = { flag: string; variant: string }\n\nexport type SessionRecordingCanvasOptions = {\n /**\n * If set, records the canvas\n *\n * @default false\n */\n recordCanvas?: boolean | null\n\n /**\n * If set, records the canvas at the given FPS\n * Can be set in the remote configuration\n * Limited between 0 and 12\n * When canvas recording is enabled, if this is not set locally, then remote config sets this as 4\n *\n * @default null-ish\n */\n canvasFps?: number | null\n\n /**\n * If set, records the canvas at the given quality\n * Can be set in the remote configuration\n * Must be a string that is a valid decimal between 0 and 1\n * When canvas recording is enabled, if this is not set locally, then remote config sets this as \"0.4\"\n *\n * @default null-ish\n */\n canvasQuality?: string | null\n}\n\n/**\n * Remote configuration for the PostHog instance\n *\n * All of these settings can be configured directly in your PostHog instance\n * Any configuration set in the client overrides the information from the server\n */\nexport interface RemoteConfig {\n /**\n * Supported compression algorithms\n */\n supportedCompression: Compression[]\n\n /**\n * If set, disables autocapture\n */\n autocapture_opt_out?: boolean\n\n /**\n * originally capturePerformance was replay only and so boolean true\n * is equivalent to { network_timing: true }\n * now capture performance can be separately enabled within replay\n * and as a standalone web vitals tracker\n * people can have them enabled separately\n * they work standalone but enhance each other\n * TODO: deprecate this so we make a new config that doesn't need this explanation\n */\n capturePerformance?: boolean | PerformanceCaptureConfig\n\n /**\n * Whether we should use a custom endpoint for analytics\n *\n * @default { endpoint: \"/e\" }\n */\n analytics?: {\n endpoint?: string\n }\n\n /**\n * Whether the `$elements_chain` property should be sent as a string or as an array\n *\n * @default false\n */\n elementsChainAsString?: boolean\n\n /**\n * This is currently in development and may have breaking changes without a major version bump\n */\n autocaptureExceptions?: boolean | { endpoint?: string }\n\n /**\n * Session recording configuration options\n */\n sessionRecording?: SessionRecordingCanvasOptions & {\n endpoint?: string\n consoleLogRecordingEnabled?: boolean\n // the API returns a decimal between 0 and 1 as a string\n sampleRate?: string | null\n minimumDurationMilliseconds?: number\n linkedFlag?: string | FlagVariant | null\n networkPayloadCapture?: Pick<NetworkRecordOptions, 'recordBody' | 'recordHeaders'>\n masking?: Pick<SessionRecordingOptions, 'maskAllInputs' | 'maskTextSelector'>\n urlTriggers?: SessionRecordingUrlTrigger[]\n scriptConfig?: { script?: string | undefined }\n urlBlocklist?: SessionRecordingUrlTrigger[]\n eventTriggers?: string[]\n }\n\n /**\n * Whether surveys are enabled\n */\n surveys?: boolean\n\n /**\n * Parameters for the toolbar\n */\n toolbarParams: ToolbarParams\n\n /**\n * @deprecated renamed to toolbarParams, still present on older API responses\n */\n editorParams?: ToolbarParams\n\n /**\n * @deprecated, moved to toolbarParams\n */\n toolbarVersion: 'toolbar'\n\n /**\n * Whether the user is authenticated\n */\n isAuthenticated: boolean\n\n /**\n * List of site apps with their IDs and URLs\n */\n siteApps: { id: string; url: string }[]\n\n /**\n * Whether heatmaps are enabled\n */\n heatmaps?: boolean\n\n /**\n * Whether to only capture identified users by default\n */\n defaultIdentifiedOnly?: boolean\n\n /**\n * Whether to capture dead clicks\n */\n captureDeadClicks?: boolean\n\n /**\n * Indicates if the team has any flags enabled (if not we don't need to load them)\n */\n hasFeatureFlags?: boolean\n}\n\n/**\n * Decide returns everything we have on the remote config plus feature flags and their payloads\n */\nexport interface DecideResponse extends RemoteConfig {\n featureFlags: Record<string, string | boolean>\n featureFlagPayloads: Record<string, JsonType>\n errorsWhileComputingFlags: boolean\n requestId?: string\n flags: Record<string, FeatureFlagDetail>\n}\n\nexport type SiteAppGlobals = {\n event: {\n uuid: string\n event: EventName\n properties: Properties\n timestamp?: Date\n elements_chain?: string\n distinct_id?: string\n }\n person: {\n properties: Properties\n }\n groups: Record<string, { id: string; type: string; properties: Properties }>\n}\n\nexport type SiteAppLoader = {\n id: string\n init: (config: { posthog: PostHog; callback: (success: boolean) => void }) => {\n processEvent?: (globals: SiteAppGlobals) => void\n }\n}\n\nexport type SiteApp = {\n id: string\n loaded: boolean\n errored: boolean\n processedBuffer: boolean\n processEvent?: (globals: SiteAppGlobals) => void\n}\n\nexport type FeatureFlagsCallback = (\n flags: string[],\n variants: Record<string, string | boolean>,\n context?: {\n errorsLoading?: boolean\n }\n) => void\n\nexport type FeatureFlagDetail = {\n key: string\n enabled: boolean\n // Only used when overriding a flag payload.\n original_enabled?: boolean | undefined\n variant: string | undefined\n // Only used when overriding a flag payload.\n original_variant?: string | undefined\n reason: EvaluationReason | undefined\n metadata: FeatureFlagMetadata | undefined\n}\n\nexport type FeatureFlagMetadata = {\n id: number\n version: number | undefined\n description: string | undefined\n payload: JsonType | undefined\n // Only used when overriding a flag payload.\n original_payload?: JsonType | undefined\n}\n\nexport type EvaluationReason = {\n code: string\n condition_index: number | undefined\n description: string | undefined\n}\n\nexport type RemoteConfigFeatureFlagCallback = (payload: JsonType) => void\n\nexport interface PersistentStore {\n is_supported: () => boolean\n error: (error: any) => void\n parse: (name: string) => any\n get: (name: string) => any\n set: (\n name: string,\n value: any,\n expire_days?: number | null,\n cross_subdomain?: boolean,\n secure?: boolean,\n debug?: boolean\n ) => void\n remove: (name: string, cross_subdomain?: boolean) => void\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport type Breaker = {}\nexport type EventHandler = (event: Event) => boolean | void\n\nexport type ToolbarUserIntent = 'add-action' | 'edit-action'\nexport type ToolbarSource = 'url' | 'localstorage'\nexport type ToolbarVersion = 'toolbar'\n\n/* sync with posthog */\nexport interface ToolbarParams {\n token?: string /** public posthog-js token */\n temporaryToken?: string /** private temporary user token */\n actionId?: number\n userIntent?: ToolbarUserIntent\n source?: ToolbarSource\n toolbarVersion?: ToolbarVersion\n instrument?: boolean\n distinctId?: string\n userEmail?: string\n dataAttributes?: string[]\n featureFlags?: Record<string, string | boolean>\n}\n\nexport type SnippetArrayItem = [method: string, ...args: any[]]\n\nexport type JsonRecord = { [key: string]: JsonType }\nexport type JsonType = string | number | boolean | null | undefined | JsonRecord | Array<JsonType>\n\n/** A feature that isn't publicly available yet.*/\nexport interface EarlyAccessFeature {\n // Sync this with the backend's EarlyAccessFeatureSerializer!\n name: string\n description: string\n stage: 'concept' | 'alpha' | 'beta'\n documentationUrl: string | null\n flagKey: string | null\n}\n\nexport type EarlyAccessFeatureStage = 'concept' | 'alpha' | 'beta' | 'general-availability'\nexport type EarlyAccessFeatureCallback = (earlyAccessFeatures: EarlyAccessFeature[]) => void\n\nexport interface EarlyAccessFeatureResponse {\n earlyAccessFeatures: EarlyAccessFeature[]\n}\n\nexport type Headers = Record<string, string>\n\n/* for rrweb/network@1\n ** when that is released as part of rrweb this can be removed\n ** don't rely on this type, it may change without notice\n */\nexport type InitiatorType =\n | 'audio'\n | 'beacon'\n | 'body'\n | 'css'\n | 'early-hint'\n | 'embed'\n | 'fetch'\n | 'frame'\n | 'iframe'\n | 'icon'\n | 'image'\n | 'img'\n | 'input'\n | 'link'\n | 'navigation'\n | 'object'\n | 'ping'\n | 'script'\n | 'track'\n | 'video'\n | 'xmlhttprequest'\n\nexport type NetworkRecordOptions = {\n initiatorTypes?: InitiatorType[]\n maskRequestFn?: (data: CapturedNetworkRequest) => CapturedNetworkRequest | undefined\n recordHeaders?: boolean | { request: boolean; response: boolean }\n recordBody?: boolean | string[] | { request: boolean | string[]; response: boolean | string[] }\n recordInitialRequests?: boolean\n /**\n * whether to record PerformanceEntry events for network requests\n */\n recordPerformance?: boolean\n /**\n * the PerformanceObserver will only observe these entry types\n */\n performanceEntryTypeToObserve: string[]\n /**\n * the maximum size of the request/response body to record\n * NB this will be at most 1MB even if set larger\n */\n payloadSizeLimitBytes: number\n /**\n * some domains we should never record the payload\n * for example other companies session replay ingestion payloads aren't super useful but are gigantic\n * if this isn't provided we use a default list\n * if this is provided - we add the provided list to the default list\n * i.e. we never record the payloads on the default deny list\n */\n payloadHostDenyList?: string[]\n}\n\n/** @deprecated - use CapturedNetworkRequest instead */\nexport type NetworkRequest = {\n url: string\n}\n\n// In rrweb this is called NetworkRequest, but we already exposed that as having only URL\n// we also want to vary from the rrweb NetworkRequest because we want to include\n// all PerformanceEntry properties too.\n// that has 4 required properties\n// readonly duration: DOMHighResTimeStamp;\n// readonly entryType: string;\n// readonly name: string;\n// readonly startTime: DOMHighResTimeStamp;\n// NB: properties below here are ALPHA, don't rely on them, they may change without notice\n\n// we mirror PerformanceEntry since we read into this type from a PerformanceObserver,\n// but we don't want to inherit its readonly-iness\ntype Writable<T> = { -readonly [P in keyof T]: T[P] }\n\nexport type CapturedNetworkRequest = Writable<Omit<PerformanceEntry, 'toJSON'>> & {\n // properties below here are ALPHA, don't rely on them, they may change without notice\n method?: string\n initiatorType?: InitiatorType\n status?: number\n timeOrigin?: number\n timestamp?: number\n startTime?: number\n endTime?: number\n requestHeaders?: Headers\n requestBody?: string | null\n responseHeaders?: Headers\n responseBody?: string | null\n // was this captured before fetch/xhr could have been wrapped\n isInitial?: boolean\n}\n\nexport type ErrorConversionArgs = {\n event: string | Event\n error?: Error\n}\n\nexport type ErrorEventArgs = [\n event: string | Event,\n source?: string | undefined,\n lineno?: number | undefined,\n colno?: number | undefined,\n error?: Error | undefined,\n]\n\nexport type ErrorMetadata = {\n handled?: boolean\n synthetic?: boolean\n syntheticException?: Error\n overrideExceptionType?: string\n overrideExceptionMessage?: string\n defaultExceptionType?: string\n defaultExceptionMessage?: string\n}\n\n// levels originally copied from Sentry to work with the sentry integration\n// and to avoid relying on a frequently changing @sentry/types dependency\n// but provided as an array of literal types, so we can constrain the level below\nexport const severityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug'] as const\nexport declare type SeverityLevel = (typeof severityLevels)[number]\n\nexport interface ErrorProperties {\n $exception_type: string\n $exception_message: string\n $exception_level: SeverityLevel\n $exception_source?: string\n $exception_lineno?: number\n $exception_colno?: number\n $exception_DOMException_code?: string\n $exception_is_synthetic?: boolean\n $exception_stack_trace_raw?: string\n $exception_handled?: boolean\n $exception_personURL?: string\n}\n\nexport interface ErrorConversions {\n errorToProperties: (args: ErrorEventArgs) => ErrorProperties\n unhandledRejectionToProperties: (args: [ev: PromiseRejectionEvent]) => ErrorProperties\n}\n\nexport interface SessionRecordingUrlTrigger {\n url: string\n matching: 'regex'\n}\n","export function includes(str: string, needle: string): boolean\nexport function includes<T>(arr: T[], needle: T): boolean\nexport function includes(str: unknown[] | string, needle: unknown): boolean {\n return (str as any).indexOf(needle) !== -1\n}\n\nexport const trim = function (str: string): string {\n // Previous implementation was using underscore's trim function.\n // When switching to just using the native trim() function, we ran some tests to make sure that it was able to trim both the BOM character \\uFEFF and the NBSP character \\u00A0.\n // We tested modern Chrome (134.0.6998.118) and Firefox (136.0.2), and IE11 running on Windows 10, and all of them were able to trim both characters.\n // See https://posthog.slack.com/archives/C0113360FFV/p1742811455647359\n return str.trim()\n}\n\n// UNDERSCORE\n// Embed part of the Underscore Library\nexport const stripLeadingDollar = function (s: string): string {\n return s.replace(/^\\$/, '')\n}\n\nexport function isDistinctIdStringLike(value: string): boolean {\n return ['distinct_id', 'distinctid'].includes(value.toLowerCase())\n}\n","import { window } from './globals'\nimport { knownUnsafeEditableEvent, KnownUnsafeEditableEvent } from '../types'\nimport { includes } from './string-utils'\n\n// eslint-disable-next-line posthog-js/no-direct-array-check\nconst nativeIsArray = Array.isArray\nconst ObjProto = Object.prototype\nexport const hasOwnProperty = ObjProto.hasOwnProperty\nconst toString = ObjProto.toString\n\nexport const isArray =\n nativeIsArray ||\n function (obj: any): obj is any[] {\n return toString.call(obj) === '[object Array]'\n }\n\n// from a comment on http://dbj.org/dbj/?p=286\n// fails on only one very rare and deliberate custom object:\n// let bomb = { toString : undefined, valueOf: function(o) { return \"function BOMBA!\"; }};\nexport const isFunction = (x: unknown): x is (...args: any[]) => any => {\n // eslint-disable-next-line posthog-js/no-direct-function-check\n return typeof x === 'function'\n}\n\nexport const isNativeFunction = (x: unknown): x is (...args: any[]) => any =>\n isFunction(x) && x.toString().indexOf('[native code]') !== -1\n\n// When angular patches functions they pass the above `isNativeFunction` check (at least the MutationObserver)\nexport const isAngularZonePresent = (): boolean => {\n return !!(window as any).Zone\n}\n\n// Underscore Addons\nexport const isObject = (x: unknown): x is Record<string, any> => {\n // eslint-disable-next-line posthog-js/no-direct-object-check\n return x === Object(x) && !isArray(x)\n}\nexport const isEmptyObject = (x: unknown) => {\n if (isObject(x)) {\n for (const key in x) {\n if (hasOwnProperty.call(x, key)) {\n return false\n }\n }\n return true\n }\n return false\n}\nexport const isUndefined = (x: unknown): x is undefined => x === void 0\n\nexport const isString = (x: unknown): x is string => {\n // eslint-disable-next-line posthog-js/no-direct-string-check\n return toString.call(x) == '[object String]'\n}\n\nexport const isEmptyString = (x: unknown): boolean => isString(x) && x.trim().length === 0\n\nexport const isNull = (x: unknown): x is null => {\n // eslint-disable-next-line posthog-js/no-direct-null-check\n return x === null\n}\n\n/*\n sometimes you want to check if something is null or undefined\n that's what this is for\n */\nexport const isNullish = (x: unknown): x is null | undefined => isUndefined(x) || isNull(x)\n\nexport const isNumber = (x: unknown): x is number => {\n // eslint-disable-next-line posthog-js/no-direct-number-check\n return toString.call(x) == '[object Number]'\n}\nexport const isBoolean = (x: unknown): x is boolean => {\n // eslint-disable-next-line posthog-js/no-direct-boolean-check\n return toString.call(x) === '[object Boolean]'\n}\n\nexport const isDocument = (x: unknown): x is Document => {\n // eslint-disable-next-line posthog-js/no-direct-document-check\n return x instanceof Document\n}\n\nexport const isFormData = (x: unknown): x is FormData => {\n // eslint-disable-next-line posthog-js/no-direct-form-data-check\n return x instanceof FormData\n}\n\nexport const isFile = (x: unknown): x is File => {\n // eslint-disable-next-line posthog-js/no-direct-file-check\n return x instanceof File\n}\n\nexport const isError = (x: unknown): x is Error => {\n return x instanceof Error\n}\n\nexport const isKnownUnsafeEditableEvent = (x: unknown): x is KnownUnsafeEditableEvent => {\n return includes(knownUnsafeEditableEvent as unknown as string[], x)\n}\n","import Config from '../config'\nimport { isUndefined } from './type-utils'\nimport { assignableWindow, window } from './globals'\n\nexport type Logger = {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => void\n info: (...args: any[]) => void\n warn: (...args: any[]) => void\n error: (...args: any[]) => void\n critical: (...args: any[]) => void\n uninitializedWarning: (methodName: string) => void\n createLogger: (prefix: string) => Logger\n}\n\nconst _createLogger = (prefix: string): Logger => {\n const logger: Logger = {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => {\n if (\n window &&\n (Config.DEBUG || assignableWindow.POSTHOG_DEBUG) &&\n !isUndefined(window.console) &&\n window.console\n ) {\n const consoleLog =\n '__rrweb_original__' in window.console[level]\n ? (window.console[level] as any)['__rrweb_original__']\n : window.console[level]\n\n // eslint-disable-next-line no-console\n consoleLog(prefix, ...args)\n }\n },\n\n info: (...args: any[]) => {\n logger._log('log', ...args)\n },\n\n warn: (...args: any[]) => {\n logger._log('warn', ...args)\n },\n\n error: (...args: any[]) => {\n logger._log('error', ...args)\n },\n\n critical: (...args: any[]) => {\n // Critical errors are always logged to the console\n // eslint-disable-next-line no-console\n console.error(prefix, ...args)\n },\n\n uninitializedWarning: (methodName: string) => {\n logger.error(`You must initialize PostHog before calling ${methodName}`)\n },\n\n createLogger: (additionalPrefix: string) => _createLogger(`${prefix} ${additionalPrefix}`),\n }\n return logger\n}\n\nexport const logger = _createLogger('[PostHog.js]')\n\nexport const createLogger = logger.createLogger\n","import { Breaker, Properties } from '../types'\nimport { hasOwnProperty, isArray, isFormData, isNull, isNullish, isString } from './type-utils'\nimport { logger } from './logger'\nimport { nativeForEach, nativeIndexOf } from './globals'\n\nconst breaker: Breaker = {}\n\nexport function eachArray<E = any>(\n obj: E[] | null | undefined,\n iterator: (value: E, key: number) => void | Breaker,\n thisArg?: any\n): void {\n if (isArray(obj)) {\n if (nativeForEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, thisArg)\n } else if ('length' in obj && obj.length === +obj.length) {\n for (let i = 0, l = obj.length; i < l; i++) {\n if (i in obj && iterator.call(thisArg, obj[i], i) === breaker) {\n return\n }\n }\n }\n }\n}\n\n/**\n * @param {*=} obj\n * @param {function(...*)=} iterator\n * @param {Object=} thisArg\n */\nexport function each(obj: any, iterator: (value: any, key: any) => void | Breaker, thisArg?: any): void {\n if (isNullish(obj)) {\n return\n }\n if (isArray(obj)) {\n return eachArray(obj, iterator, thisArg)\n }\n if (isFormData(obj)) {\n for (const pair of obj.entries()) {\n if (iterator.call(thisArg, pair[1], pair[0]) === breaker) {\n return\n }\n }\n return\n }\n for (const key in obj) {\n if (hasOwnProperty.call(obj, key)) {\n if (iterator.call(thisArg, obj[key], key) === breaker) {\n return\n }\n }\n }\n}\n\nexport const extend = function (obj: Record<string, any>, ...args: Record<string, any>[]): Record<string, any> {\n eachArray(args, function (source) {\n for (const prop in source) {\n if (source[prop] !== void 0) {\n obj[prop] = source[prop]\n }\n }\n })\n return obj\n}\n\nexport const extendArray = function <T>(obj: T[], ...args: T[][]): T[] {\n eachArray(args, function (source) {\n eachArray(source, function (item) {\n obj.push(item)\n })\n })\n return obj\n}\n\nexport const include = function (\n obj: null | string | Array<any> | Record<string, any>,\n target: any\n): boolean | Breaker {\n let found = false\n if (isNull(obj)) {\n return found\n }\n if (nativeIndexOf && obj.indexOf === nativeIndexOf) {\n return obj.indexOf(target) != -1\n }\n each(obj, function (value) {\n if (found || (found = value === target)) {\n return breaker\n }\n return\n })\n return found\n}\n\n/**\n * Object.entries() polyfill\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries\n */\nexport function entries<T = any>(obj: Record<string, T>): [string, T][] {\n const ownProps = Object.keys(obj)\n let i = ownProps.length\n const resArray = new Array(i) // preallocate the Array\n\n while (i--) {\n resArray[i] = [ownProps[i], obj[ownProps[i]]]\n }\n return resArray\n}\n\nexport const trySafe = function <T>(fn: () => T): T | undefined {\n try {\n return fn()\n } catch {\n return undefined\n }\n}\n\nexport const safewrap = function <F extends (...args: any[]) => any = (...args: any[]) => any>(f: F): F {\n return function (...args) {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return f.apply(this, args)\n } catch (e) {\n logger.critical(\n 'Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.'\n )\n logger.critical(e)\n }\n } as F\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport const safewrapClass = function (klass: Function, functions: string[]): void {\n for (let i = 0; i < functions.length; i++) {\n klass.prototype[functions[i]] = safewrap(klass.prototype[functions[i]])\n }\n}\n\nexport const stripEmptyProperties = function (p: Properties): Properties {\n const ret: Properties = {}\n each(p, function (v, k) {\n if (isString(v) && v.length > 0) {\n ret[k] = v\n }\n })\n return ret\n}\n\n/**\n * Deep copies an object.\n * It handles cycles by replacing all references to them with `undefined`\n * Also supports customizing native values\n *\n * @param value\n * @param customizer\n * @returns {{}|undefined|*}\n */\nfunction deepCircularCopy<T extends Record<string, any> = Record<string, any>>(\n value: T,\n customizer?: <K extends keyof T = keyof T>(value: T[K], key?: K) => T[K]\n): T | undefined {\n const COPY_IN_PROGRESS_SET = new Set()\n\n function internalDeepCircularCopy(value: T, key?: string): T | undefined {\n if (value !== Object(value)) return customizer ? customizer(value as any, key) : value // primitive value\n\n if (COPY_IN_PROGRESS_SET.has(value)) return undefined\n COPY_IN_PROGRESS_SET.add(value)\n let result: T\n\n if (isArray(value)) {\n result = [] as any as T\n eachArray(value, (it) => {\n result.push(internalDeepCircularCopy(it))\n })\n } else {\n result = {} as T\n each(value, (val, key) => {\n if (!COPY_IN_PROGRESS_SET.has(val)) {\n ;(result as any)[key] = internalDeepCircularCopy(val, key)\n }\n })\n }\n return result\n }\n return internalDeepCircularCopy(value)\n}\n\nexport function _copyAndTruncateStrings<T extends Record<string, any> = Record<string, any>>(\n object: T,\n maxStringLength: number | null\n): T {\n return deepCircularCopy(object, (value: any) => {\n if (isString(value) && !isNull(maxStringLength)) {\n return (value as string).slice(0, maxStringLength)\n }\n return value\n }) as T\n}\n\n// NOTE: Update PostHogConfig docs if you change this list\n// We will not try to catch all bullets here, but we should make an effort to catch the most common ones\n// You should be highly against adding more to this list, because ultimately customers can configure\n// their `cross_subdomain_cookie` setting to anything they want.\nconst EXCLUDED_FROM_CROSS_SUBDOMAIN_COOKIE = ['herokuapp.com', 'vercel.app', 'netlify.app']\nexport function isCrossDomainCookie(documentLocation: Location | undefined) {\n const hostname = documentLocation?.hostname\n\n if (!isString(hostname)) {\n return false\n }\n // split and slice isn't a great way to match arbitrary domains,\n // but it's good enough for ensuring we only match herokuapp.com when it is the TLD\n // for the hostname\n const lastTwoParts = hostname.split('.').slice(-2).join('.')\n\n for (const excluded of EXCLUDED_FROM_CROSS_SUBDOMAIN_COOKIE) {\n if (lastTwoParts === excluded) {\n return false\n }\n }\n\n return true\n}\n\nexport function find<T>(value: T[], predicate: (value: T) => boolean): T | undefined {\n for (let i = 0; i < value.length; i++) {\n if (predicate(value[i])) {\n return value[i]\n }\n }\n return undefined\n}\n\n// Use this instead of element.addEventListener to avoid eslint errors\n// this properly implements the default options for passive event listeners\nexport function addEventListener(\n element: Window | Document | Element | undefined,\n event: string,\n callback: EventListener,\n options?: AddEventListenerOptions\n): void {\n const { capture = false, passive = true } = options ?? {}\n\n // This is the only place where we are allowed to call this function\n // because the whole idea is that we should be calling this instead of the built-in one\n // eslint-disable-next-line posthog-js/no-add-event-listener\n element?.addEventListener(event, callback, { capture, passive })\n}\n","import { each } from './'\n\nimport { isArray, isFile, isUndefined } from './type-utils'\nimport { logger } from './logger'\nimport { document } from './globals'\n\nconst localDomains = ['localhost', '127.0.0.1']\n\n/**\n * IE11 doesn't support `new URL`\n * so we can create an anchor element and use that to parse the URL\n * there's a lot of overlap between HTMLHyperlinkElementUtils and URL\n * meaning useful properties like `pathname` are available on both\n */\nexport const convertToURL = (url: string): HTMLAnchorElement | null => {\n const location = document?.createElement('a')\n if (isUndefined(location)) {\n return null\n }\n\n location.href = url\n return location\n}\n\nexport const formDataToQuery = function (formdata: Record<string, any> | FormData, arg_separator = '&'): string {\n let use_val: string\n let use_key: string\n const tph_arr: string[] = []\n\n each(formdata, function (val: File | string | undefined, key: string | undefined) {\n // the key might be literally the string undefined for e.g. if {undefined: 'something'}\n if (isUndefined(val) || isUndefined(key) || key === 'undefined') {\n return\n }\n\n use_val = encodeURIComponent(isFile(val) ? val.name : val.toString())\n use_key = encodeURIComponent(key)\n tph_arr[tph_arr.length] = use_key + '=' + use_val\n })\n\n return tph_arr.join(arg_separator)\n}\n\n// NOTE: Once we get rid of IE11/op_mini we can start using URLSearchParams\nexport const getQueryParam = function (url: string, param: string): string {\n const withoutHash: string = url.split('#')[0] || ''\n\n // Split only on the first ? to sort problem out for those with multiple ?s\n // and then remove them\n const queryParams: string = withoutHash.split(/\\?(.*)/)[1] || ''\n const cleanedQueryParams = queryParams.replace(/^\\?+/g, '')\n\n const queryParts = cleanedQueryParams.split('&')\n let keyValuePair\n\n for (let i = 0; i < queryParts.length; i++) {\n const parts = queryParts[i].split('=')\n if (parts[0] === param) {\n keyValuePair = parts\n break\n }\n }\n\n if (!isArray(keyValuePair) || keyValuePair.length < 2) {\n return ''\n } else {\n let result = keyValuePair[1]\n try {\n result = decodeURIComponent(result)\n } catch {\n logger.error('Skipping decoding for malformed query param: ' + result)\n }\n return result.replace(/\\+/g, ' ')\n }\n}\n\n// replace any query params in the url with the provided mask value. Tries to keep the URL as instant as possible,\n// including preserving malformed text in most cases\nexport const maskQueryParams = function <T extends string | undefined>(\n url: T,\n maskedParams: string[] | undefined,\n mask: string\n): T extends string ? string : undefined {\n if (!url || !maskedParams || !maskedParams.length) {\n return url as any\n }\n\n const splitHash = url.split('#')\n const withoutHash: string = splitHash[0] || ''\n const hash = splitHash[1]\n\n const splitQuery: string[] = withoutHash.split('?')\n const queryString: string = splitQuery[1]\n const urlWithoutQueryAndHash: string = splitQuery[0]\n const queryParts = (queryString || '').split('&')\n\n // use an array of strings rather than an object to preserve ordering and duplicates\n const paramStrings: string[] = []\n\n for (let i = 0; i < queryParts.length; i++) {\n const keyValuePair = queryParts[i].split('=')\n if (!isArray(keyValuePair)) {\n continue\n } else if (maskedParams.includes(keyValuePair[0])) {\n paramStrings.push(keyValuePair[0] + '=' + mask)\n } else {\n paramStrings.push(queryParts[i])\n }\n }\n\n let result = urlWithoutQueryAndHash\n if (queryString != null) {\n result += '?' + paramStrings.join('&')\n }\n if (hash != null) {\n result += '#' + hash\n }\n\n return result as any\n}\n\nexport const _getHashParam = function (hash: string, param: string): string | null {\n const matches = hash.match(new RegExp(param + '=([^&]*)'))\n return matches ? matches[1] : null\n}\n\nexport const isLocalhost = (): boolean => {\n return localDomains.includes(location.hostname)\n}\n","// import { patch } from 'rrweb/typings/utils'\n// copied from https://github.com/rrweb-io/rrweb/blob/8aea5b00a4dfe5a6f59bd2ae72bb624f45e51e81/packages/rrweb/src/utils.ts#L129\n// which was copied from https://github.com/getsentry/sentry-javascript/blob/b2109071975af8bf0316d3b5b38f519bdaf5dc15/packages/utils/src/object.ts\nimport { isFunction } from '../../../utils/type-utils'\n\nexport function patch(\n source: { [key: string]: any },\n name: string,\n replacement: (...args: unknown[]) => unknown\n): () => void {\n try {\n if (!(name in source)) {\n return () => {\n //\n }\n }\n\n const original = source[name] as () => unknown\n const wrapped = replacement(original)\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n if (isFunction(wrapped)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n wrapped.prototype = wrapped.prototype || {}\n Object.defineProperties(wrapped, {\n __posthog_wrapped__: {\n enumerable: false,\n value: true,\n },\n })\n }\n\n source[name] = wrapped\n\n return () => {\n source[name] = original\n }\n } catch {\n return () => {\n //\n }\n // This can throw if multiple fill happens on a global object like XMLHttpRequest\n // Fixes https://github.com/getsentry/sentry-javascript/issues/2043\n }\n}\n","import { NetworkRecordOptions } from '../../../types'\n\nfunction hostnameFromURL(url: string | URL | RequestInfo): string | null {\n try {\n if (typeof url === 'string') {\n return new URL(url).hostname\n }\n if ('url' in url) {\n return new URL(url.url).hostname\n }\n return url.hostname\n } catch {\n return null\n }\n}\n\nexport function isHostOnDenyList(url: string | URL | Request, options: NetworkRecordOptions) {\n const hostname = hostnameFromURL(url)\n const defaultNotDenied = { hostname, isHostDenied: false }\n\n if (!options.payloadHostDenyList?.length || !hostname?.trim().length) {\n return defaultNotDenied\n }\n\n for (const deny of options.payloadHostDenyList) {\n if (hostname.endsWith(deny)) {\n return { hostname, isHostDenied: true }\n }\n }\n\n return defaultNotDenied\n}\n","/*\n * Constants\n */\n\n/* PROPERTY KEYS */\n\n// This key is deprecated, but we want to check for it to see whether aliasing is allowed.\nexport const PEOPLE_DISTINCT_ID_KEY = '$people_distinct_id'\nexport const DISTINCT_ID = 'distinct_id'\nexport const ALIAS_ID_KEY = '__alias'\nexport const CAMPAIGN_IDS_KEY = '__cmpns'\nexport const EVENT_TIMERS_KEY = '__timers'\nexport const AUTOCAPTURE_DISABLED_SERVER_SIDE = '$autocapture_disabled_server_side'\nexport const HEATMAPS_ENABLED_SERVER_SIDE = '$heatmaps_enabled_server_side'\nexport const EXCEPTION_CAPTURE_ENABLED_SERVER_SIDE = '$exception_capture_enabled_server_side'\nexport const WEB_VITALS_ENABLED_SERVER_SIDE = '$web_vitals_enabled_server_side'\nexport const DEAD_CLICKS_ENABLED_SERVER_SIDE = '$dead_clicks_enabled_server_side'\nexport const WEB_VITALS_ALLOWED_METRICS = '$web_vitals_allowed_metrics'\nexport const SESSION_RECORDING_ENABLED_SERVER_SIDE = '$session_recording_enabled_server_side'\nexport const CONSOLE_LOG_RECORDING_ENABLED_SERVER_SIDE = '$console_log_recording_enabled_server_side'\nexport const SESSION_RECORDING_NETWORK_PAYLOAD_CAPTURE = '$session_recording_network_payload_capture'\nexport const SESSION_RECORDING_MASKING = '$session_recording_masking'\nexport const SESSION_RECORDING_CANVAS_RECORDING = '$session_recording_canvas_recording'\nexport const SESSION_RECORDING_SAMPLE_RATE = '$replay_sample_rate'\nexport const SESSION_RECORDING_MINIMUM_DURATION = '$replay_minimum_duration'\nexport const SESSION_RECORDING_SCRIPT_CONFIG = '$replay_script_config'\nexport const SESSION_ID = '$sesid'\nexport const SESSION_RECORDING_IS_SAMPLED = '$session_is_sampled'\nexport const SESSION_RECORDING_URL_TRIGGER_ACTIVATED_SESSION = '$session_recording_url_trigger_activated_session'\nexport const SESSION_RECORDING_URL_TRIGGER_STATUS = '$session_recording_url_trigger_status'\nexport const SESSION_RECORDING_EVENT_TRIGGER_ACTIVATED_SESSION = '$session_recording_event_trigger_activated_session'\nexport const SESSION_RECORDING_EVENT_TRIGGER_STATUS = '$session_recording_event_trigger_status'\nexport const ENABLED_FEATURE_FLAGS = '$enabled_feature_flags'\nexport const PERSISTENCE_EARLY_ACCESS_FEATURES = '$early_access_features'\nexport const PERSISTENCE_FEATURE_FLAG_DETAILS = '$feature_flag_details'\nexport const STORED_PERSON_PROPERTIES_KEY = '$stored_person_properties'\nexport const STORED_GROUP_PROPERTIES_KEY = '$stored_group_properties'\nexport const SURVEYS = '$surveys'\nexport const SURVEYS_ACTIVATED = '$surveys_activated'\nexport const FLAG_CALL_REPORTED = '$flag_call_reported'\nexport const USER_STATE = '$user_state'\nexport const CLIENT_SESSION_PROPS = '$client_session_props'\nexport const CAPTURE_RATE_LIMIT = '$capture_rate_limit'\n\n/** @deprecated Delete this when INITIAL_PERSON_INFO has been around for long enough to ignore backwards compat */\nexport const INITIAL_CAMPAIGN_PARAMS = '$initial_campaign_params'\n/** @deprecated Delete this when INITIAL_PERSON_INFO has been around for long enough to ignore backwards compat */\nexport const INITIAL_REFERRER_INFO = '$initial_referrer_info'\nexport const INITIAL_PERSON_INFO = '$initial_person_info'\nexport const ENABLE_PERSON_PROCESSING = '$epp'\nexport const TOOLBAR_ID = '__POSTHOG_TOOLBAR__'\nexport const TOOLBAR_CONTAINER_CLASS = 'toolbar-global-fade-container'\n\n/**\n * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION\n * Sentinel value for distinct id, device id, session id. Signals that the server should generate the value\n * */\nexport const COOKIELESS_SENTINEL_VALUE = '$posthog_cookieless'\nexport const COOKIELESS_MODE_FLAG_PROPERTY = '$cookieless_mode'\n\nexport const WEB_EXPERIMENTS = '$web_experiments'\n\n// These are properties that are reserved and will not be automatically included in events\nexport const PERSISTENCE_RESERVED_PROPERTIES = [\n PEOPLE_DISTINCT_ID_KEY,\n ALIAS_ID_KEY,\n CAMPAIGN_IDS_KEY,\n EVENT_TIMERS_KEY,\n SESSION_RECORDING_ENABLED_SERVER_SIDE,\n HEATMAPS_ENABLED_SERVER_SIDE,\n SESSION_ID,\n ENABLED_FEATURE_FLAGS,\n USER_STATE,\n PERSISTENCE_EARLY_ACCESS_FEATURES,\n PERSISTENCE_FEATURE_FLAG_DETAILS,\n STORED_GROUP_PROPERTIES_KEY,\n STORED_PERSON_PROPERTIES_KEY,\n SURVEYS,\n FLAG_CALL_REPORTED,\n CLIENT_SESSION_PROPS,\n CAPTURE_RATE_LIMIT,\n INITIAL_CAMPAIGN_PARAMS,\n INITIAL_REFERRER_INFO,\n ENABLE_PERSON_PROCESSING,\n]\n\nexport const SURVEYS_REQUEST_TIMEOUT_MS = 10000\n","import { TOOLBAR_CONTAINER_CLASS, TOOLBAR_ID } from '../constants'\n\nexport function isElementInToolbar(el: EventTarget | null): boolean {\n if (el instanceof Element) {\n // closest isn't available in IE11, but we'll polyfill when bundling\n return el.id === TOOLBAR_ID || !!el.closest?.('.' + TOOLBAR_CONTAINER_CLASS)\n }\n return false\n}\n\n/*\n * Check whether an element has nodeType Node.ELEMENT_NODE\n * @param {Element} el - element to check\n * @returns {boolean} whether el is of the correct nodeType\n */\nexport function isElementNode(el: Node | Element | undefined | null): el is Element {\n return !!el && el.nodeType === 1 // Node.ELEMENT_NODE - use integer constant for browser portability\n}\n\n/*\n * Check whether an element is of a given tag type.\n * Due to potential reference discrepancies (such as the webcomponents.js polyfill),\n * we want to match tagNames instead of specific references because something like\n * element === document.body won't always work because element might not be a native\n * element.\n * @param {Element} el - element to check\n * @param {string} tag - tag name (e.g., \"div\")\n * @returns {boolean} whether el is of the given tag type\n */\nexport function isTag(el: Element | undefined | null, tag: string): el is HTMLElement {\n return !!el && !!el.tagName && el.tagName.toLowerCase() === tag.toLowerCase()\n}\n\n/*\n * Check whether an element has nodeType Node.TEXT_NODE\n * @param {Element} el - element to check\n * @returns {boolean} whether el is of the correct nodeType\n */\nexport function isTextNode(el: Element | undefined | null): el is HTMLElement {\n return !!el && el.nodeType === 3 // Node.TEXT_NODE - use integer constant for browser portability\n}\n\n/*\n * Check whether an element has nodeType Node.DOCUMENT_FRAGMENT_NODE\n * @param {Element} el - element to check\n * @returns {boolean} whether el is of the correct nodeType\n */\nexport function isDocumentFragment(el: Element | ParentNode | undefined | null): el is DocumentFragment {\n return !!el && el.nodeType === 11 // Node.DOCUMENT_FRAGMENT_NODE - use integer constant for browser portability\n}\n","import { AutocaptureConfig, Properties } from './types'\nimport { each, entries } from './utils'\n\nimport { isArray, isNullish, isString, isUndefined } from './utils/type-utils'\nimport { logger } from './utils/logger'\nimport { window } from './utils/globals'\nimport { isDocumentFragment, isElementNode, isTag, isTextNode } from './utils/element-utils'\nimport { includes, trim } from './utils/string-utils'\n\nexport function splitClassString(s: string): string[] {\n return s ? trim(s).split(/\\s+/) : []\n}\n\nfunction checkForURLMatches(urlsList: (string | RegExp)[]): boolean {\n const url = window?.location.href\n return !!(url && urlsList && urlsList.some((regex) => url.match(regex)))\n}\n\n/*\n * Get the className of an element, accounting for edge cases where element.className is an object\n *\n * Because this is a string it can contain unexpected characters\n * So, this method safely splits the className and returns that array.\n */\nexport function getClassNames(el: Element): string[] {\n let className = ''\n switch (typeof el.className) {\n case 'string':\n className = el.className\n break\n // TODO: when is this ever used?\n case 'object': // handle cases where className might be SVGAnimatedString or some other type\n className =\n (el.className && 'baseVal' in el.className ? (el.className as any).baseVal : null) ||\n el.getAttribute('class') ||\n ''\n break\n default:\n className = ''\n }\n\n return splitClassString(className)\n}\n\nexport function makeSafeText(s: string | null | undefined): string | null {\n if (isNullish(s)) {\n return null\n }\n\n return (\n trim(s)\n // scrub potentially sensitive values\n .split(/(\\s+)/)\n .filter((s) => shouldCaptureValue(s))\n .join('')\n // normalize whitespace\n .replace(/[\\r\\n]/g, ' ')\n .replace(/[ ]+/g, ' ')\n // truncate\n .substring(0, 255)\n )\n}\n\n/*\n * Get the direct text content of an element, protecting against sensitive data collection.\n * Concats textContent of each of the element's text node children; this avoids potential\n * collection of sensitive data that could happen if we used element.textContent and the\n * element had sensitive child elements, since element.textContent includes child content.\n * Scrubs values that look like they could be sensitive (i.e. cc or ssn number).\n * @param {Element} el - element to get the text of\n * @returns {string} the element's direct text content\n */\nexport function getSafeText(el: Element): string {\n let elText = ''\n\n if (shouldCaptureElement(el) && !isSensitiveElement(el) && el.childNodes && el.childNodes.length) {\n each(el.childNodes, function (child) {\n if (isTextNode(child) && child.textContent) {\n elText += makeSafeText(child.textContent) ?? ''\n }\n })\n }\n\n return trim(elText)\n}\n\nexport function getEventTarget(e: Event): Element | null {\n // https://developer.mozilla.org/en-US/docs/Web/API/Event/target#Compatibility_notes\n if (isUndefined(e.target)) {\n return (e.srcElement as Element) || null\n } else {\n if ((e.target as HTMLElement)?.shadowRoot) {\n return (e.composedPath()[0] as Element) || null\n }\n return (e.target as Element) || null\n }\n}\n\nexport const autocaptureCompatibleElements = ['a', 'button', 'form', 'input', 'select', 'textarea', 'label']\n\n/*\n if there is no config, then all elements are allowed\n if there is a config, and there is an allow list, then only elements in the allow list are allowed\n assumes that some other code is checking this element's parents\n */\nfunction checkIfElementTreePassesElementAllowList(\n elements: Element[],\n autocaptureConfig: AutocaptureConfig | undefined\n): boolean {\n const allowlist = autocaptureConfig?.element_allowlist\n if (isUndefined(allowlist)) {\n // everything is allowed, when there is no allow list\n return true\n }\n\n // check each element in the tree\n // if any of the elements are in the allow list, then the tree is allowed\n for (const el of elements) {\n if (allowlist.some((elementType) => el.tagName.toLowerCase() === elementType)) {\n return true\n }\n }\n\n // otherwise there is an allow list and this element tree didn't match it\n return false\n}\n\n/*\n if there is no config, then all elements are allowed\n if there is a config, and there is an allow list, then\n only elements that match the css selector in the allow list are allowed\n assumes that some other code is checking this element's parents\n */\nfunction checkIfElementTreePassesCSSSelectorAllowList(\n elements: Element[],\n autocaptureConfig: AutocaptureConfig | undefined\n): boolean {\n const allowlist = autocaptureConfig?.css_selector_allowlist\n if (isUndefined(allowlist)) {\n // everything is allowed, when there is no allow list\n return true\n }\n\n // check each element in the tree\n // if any of the elements are in the allow list, then the tree is allowed\n for (const el of elements) {\n if (allowlist.some((selector) => el.matches(selector))) {\n return true\n }\n }\n\n // otherwise there is an allow list and this element tree didn't match it\n return false\n}\n\nexport function getParentElement(curEl: Element): Element | false {\n const parentNode = curEl.parentNode\n if (!parentNode || !isElementNode(parentNode)) return false\n return parentNode\n}\n\n/*\n * Check whether a DOM event should be \"captured\" or if it may contain sentitive data\n * using a variety of heuristics.\n * @param {Element} el - element to check\n * @param {Event} event - event to check\n * @param {Object} autocaptureConfig - autocapture config\n * @param {boolean} captureOnAnyElement - whether to capture on any element, clipboard autocapture doesn't restrict to \"clickable\" elements\n * @param {string[]} allowedEventTypes - event types to capture, normally just 'click', but some autocapture types react to different events, some elements have fixed events (e.g., form has \"submit\")\n * @returns {boolean} whether the event should be captured\n */\nexport function shouldCaptureDomEvent(\n el: Element,\n event: Event,\n autocaptureConfig: AutocaptureConfig | undefined = undefined,\n captureOnAnyElement?: boolean,\n allowedEventTypes?: string[]\n): boolean {\n if (!window || !el || isTag(el, 'html') || !isElementNode(el)) {\n return false\n }\n\n if (autocaptureConfig?.url_allowlist) {\n // if the current URL is not in the allow list, don't capture\n if (!checkForURLMatches(autocaptureConfig.url_allowlist)) {\n return false\n }\n }\n\n if (autocaptureConfig?.url_ignorelist) {\n // if the current URL is in the ignore list, don't capture\n if (checkForURLMatches(autocaptureConfig.url_ignorelist)) {\n return false\n }\n }\n\n if (autocaptureConfig?.dom_event_allowlist) {\n const allowlist = autocaptureConfig.dom_event_allowlist\n if (allowlist && !allowlist.some((eventType) => event.type === eventType)) {\n return false\n }\n }\n\n let parentIsUsefulElement = false\n const targetElementList: Element[] = [el]\n let parentNode: Element | boolean = true\n let curEl: Element = el\n while (curEl.parentNode && !isTag(curEl, 'body')) {\n // If element is a shadow root, we skip it\n if (isDocumentFragment(curEl.parentNode)) {\n targetElementList.push((curEl.parentNode as any).host)\n curEl = (curEl.parentNode as any).host\n continue\n }\n parentNode = getParentElement(curEl)\n if (!parentNode) break\n if (captureOnAnyElement || autocaptureCompatibleElements.indexOf(parentNode.tagName.toLowerCase()) > -1) {\n parentIsUsefulElement = true\n } else {\n const compStyles = window.getComputedStyle(parentNode)\n if (compStyles && compStyles.getPropertyValue('cursor') === 'pointer') {\n parentIsUsefulElement = true\n }\n }\n\n targetElementList.push(parentNode)\n curEl = parentNode\n }\n\n if (!checkIfElementTreePassesElementAllowList(targetElementList, autocaptureConfig)) {\n return false\n }\n\n if (!checkIfElementTreePassesCSSSelectorAllowList(targetElementList, autocaptureConfig)) {\n return false\n }\n\n const compStyles = window.getComputedStyle(el)\n if (compStyles && compStyles.getPropertyValue('cursor') === 'pointer' && event.type === 'click') {\n return true\n }\n\n const tag = el.tagName.toLowerCase()\n switch (tag) {\n case 'html':\n return false\n case 'form':\n return (allowedEventTypes || ['submit']).indexOf(event.type) >= 0\n case 'input':\n case 'select':\n case 'textarea':\n return (allowedEventTypes || ['change', 'click']).indexOf(event.type) >= 0\n default:\n if (parentIsUsefulElement) return (allowedEventTypes || ['click']).indexOf(event.type) >= 0\n return (\n (allowedEventTypes || ['click']).indexOf(event.type) >= 0 &&\n (autocaptureCompatibleElements.indexOf(tag) > -1 || el.getAttribute('contenteditable') === 'true')\n )\n }\n}\n\n/*\n * Check whether a DOM element should be \"captured\" or if it may contain sentitive data\n * using a variety of heuristics.\n * @param {Element} el - element to check\n * @returns {boolean} whether the element should be captured\n */\nexport function shouldCaptureElement(el: Element): boolean {\n for (let curEl = el; curEl.parentNode && !isTag(curEl, 'body'); curEl = curEl.parentNode as Element) {\n const classes = getClassNames(curEl)\n if (includes(classes, 'ph-sensitive') || includes(classes, 'ph-no-capture')) {\n return false\n }\n }\n\n if (includes(getClassNames(el), 'ph-include')) {\n return true\n }\n\n // don't include hidden or password fields\n const type = (el as HTMLInputElement).type || ''\n if (isString(type)) {\n // it's possible for el.type to be a DOM element if el is a form with a child input[name=\"type\"]\n switch (type.toLowerCase()) {\n case 'hidden':\n return false\n case 'password':\n return false\n }\n }\n\n // filter out data from fields that look like sensitive fields\n const name = (el as HTMLInputElement).name || el.id || ''\n // See https://github.com/posthog/posthog-js/issues/165\n // Under specific circumstances a bug caused .replace to be called on a DOM element\n // instead of a string, removing the element from the page. Ensure this issue is mitigated.\n if (isString(name)) {\n // it's possible for el.name or el.id to be a DOM element if el is a form with a child input[name=\"name\"]\n const sensitiveNameRegex =\n /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i\n if (sensitiveNameRegex.test(name.replace(/[^a-zA-Z0-9]/g, ''))) {\n return false\n }\n }\n\n return true\n}\n\n/*\n * Check whether a DOM element is 'sensitive' and we should only capture limited data\n * @param {Element} el - element to check\n * @returns {boolean} whether the element should be captured\n */\nexport function isSensitiveElement(el: Element): boolean {\n // don't send data from inputs or similar elements since there will always be\n // a risk of clientside javascript placing sensitive data in attributes\n const allowedInputTypes = ['button', 'checkbox', 'submit', 'reset']\n if (\n (isTag(el, 'input') && !allowedInputTypes.includes((el as HTMLInputElement).type)) ||\n isTag(el, 'select') ||\n isTag(el, 'textarea') ||\n el.getAttribute('contenteditable') === 'true'\n ) {\n return true\n }\n return false\n}\n\n// Define the core pattern for matching credit card numbers\nconst coreCCPattern = `(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})`\n// Create the Anchored version of the regex by adding '^' at the start and '$' at the end\nconst anchoredCCRegex = new RegExp(`^(?:${coreCCPattern})$`)\n// The Unanchored version is essentially the core pattern, usable as is for partial matches\nconst unanchoredCCRegex = new RegExp(coreCCPattern)\n\n// Define the core pattern for matching SSNs with optional dashes\nconst coreSSNPattern = `\\\\d{3}-?\\\\d{2}-?\\\\d{4}`\n// Create the Anchored version of the regex by adding '^' at the start and '$' at the end\nconst anchoredSSNRegex = new RegExp(`^(${coreSSNPattern})$`)\n// The Unanchored version is essentially the core pattern itself, usable for partial matches\nconst unanchoredSSNRegex = new RegExp(`(${coreSSNPattern})`)\n\n/*\n * Check whether a string value should be \"captured\" or if it may contain sensitive data\n * using a variety of heuristics.\n * @param {string} value - string value to check\n * @param {boolean} anchorRegexes - whether to anchor the regexes to the start and end of the string\n * @returns {boolean} whether the element should be captured\n */\nexport function shouldCaptureValue(value: string, anchorRegexes = true): boolean {\n if (isNullish(value)) {\n return false\n }\n\n if (isString(value)) {\n value = trim(value)\n\n // check to see if input value looks like a credit card number\n // see: https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9781449327453/ch04s20.html\n const ccRegex = anchorRegexes ? anchoredCCRegex : unanchoredCCRegex\n if (ccRegex.test((value || '').replace(/[- ]/g, ''))) {\n return false\n }\n\n // check to see if input value looks like a social security number\n const ssnRegex = anchorRegexes ? anchoredSSNRegex : unanchoredSSNRegex\n if (ssnRegex.test(value)) {\n return false\n }\n }\n\n return true\n}\n\n/*\n * Check whether an attribute name is an Angular style attr (either _ngcontent or _nghost)\n * These update on each build and lead to noise in the element chain\n * More details on the attributes here: https://angular.io/guide/view-encapsulation\n * @param {string} attributeName - string value to check\n * @returns {boolean} whether the element is an angular tag\n */\nexport function isAngularStyleAttr(attributeName: string): boolean {\n if (isString(attributeName)) {\n return attributeName.substring(0, 10) === '_ngcontent' || attributeName.substring(0, 7) === '_nghost'\n }\n return false\n}\n\n/*\n * Iterate through children of a target element looking for span tags\n * and return the text content of the span tags, separated by spaces,\n * along with the direct text content of the target element\n * @param {Element} target - element to check\n * @returns {string} text content of the target element and its child span tags\n */\nexport function getDirectAndNestedSpanText(target: Element): string {\n let text = getSafeText(target)\n text = `${text} ${getNestedSpanText(target)}`.trim()\n return shouldCaptureValue(text) ? text : ''\n}\n\n/*\n * Iterate through children of a target element looking for span tags\n * and return the text content of the span tags, separated by spaces\n * @param {Element} target - element to check\n * @returns {string} text content of span tags\n */\nexport function getNestedSpanText(target: Element): string {\n let text = ''\n if (target && target.childNodes && target.childNodes.length) {\n each(target.childNodes, function (child) {\n if (child && child.tagName?.toLowerCase() === 'span') {\n try {\n const spanText = getSafeText(child)\n text = `${text} ${spanText}`.trim()\n\n if (child.childNodes && child.childNodes.length) {\n text = `${text} ${getNestedSpanText(child)}`.trim()\n }\n } catch (e) {\n logger.error('[AutoCapture]', e)\n }\n }\n })\n }\n return text\n}\n\n/*\nBack in the day storing events in Postgres we use Elements for autocapture events.\nNow we're using elements_chain. We used to do this parsing/processing during ingestion.\nThis code is just copied over from ingestion, but we should optimize it\nto create elements_chain string directly.\n*/\nexport function getElementsChainString(elements: Properties[]): string {\n return elementsToString(extractElements(elements))\n}\n\n// This interface is called 'Element' in plugin-scaffold https://github.com/PostHog/plugin-scaffold/blob/b07d3b879796ecc7e22deb71bf627694ba05386b/src/types.ts#L200\n// However 'Element' is a DOM Element when run in the browser, so we have to rename it\ninterface PHElement {\n text?: string\n tag_name?: string\n href?: string\n attr_id?: string\n attr_class?: string[]\n nth_child?: number\n nth_of_type?: number\n attributes?: Record<string, any>\n event_id?: number\n order?: number\n group_id?: number\n}\n\nfunction escapeQuotes(input: string): string {\n return input.replace(/\"|\\\\\"/g, '\\\\\"')\n}\n\nfunction elementsToString(elements: PHElement[]): string {\n const ret = elements.map((element) => {\n let el_string = ''\n if (element.tag_name) {\n el_string += element.tag_name\n }\n if (element.attr_class) {\n element.attr_class.sort()\n for (const single_class of element.attr_class) {\n el_string += `.${single_class.replace(/\"/g, '')}`\n }\n }\n const attributes: Record<string, any> = {\n ...(element.text ? { text: element.text } : {}),\n 'nth-child': element.nth_child ?? 0,\n 'nth-of-type': element.nth_of_type ?? 0,\n ...(element.href ? { href: element.href } : {}),\n ...(element.attr_id ? { attr_id: element.attr_id } : {}),\n ...element.attributes,\n }\n const sortedAttributes: Record<string, any> = {}\n entries(attributes)\n .sort(([a], [b]) => a.localeCompare(b))\n .forEach(\n ([key, value]) => (sortedAttributes[escapeQuotes(key.toString())] = escapeQuotes(value.toString()))\n )\n el_string += ':'\n el_string += entries(attributes)\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join('')\n return el_string\n })\n return ret.join(';')\n}\n\nfunction extractElements(elements: Properties[]): PHElement[] {\n return elements.map((el) => {\n const response = {\n text: el['$el_text']?.slice(0, 400),\n tag_name: el['tag_name'],\n href: el['attr__href']?.slice(0, 2048),\n attr_class: extractAttrClass(el),\n attr_id: el['attr__id'],\n nth_child: el['nth_child'],\n nth_of_type: el['nth_of_type'],\n attributes: {} as { [id: string]: any },\n }\n\n entries(el)\n .filter(([key]) => key.indexOf('attr__') === 0)\n .forEach(([key, value]) => (response.attributes[key] = value))\n return response\n })\n}\n\nfunction extractAttrClass(el: Properties): PHElement['attr_class'] {\n const attr_class = el['attr__class']\n if (!attr_class) {\n return undefined\n } else if (isArray(attr_class)) {\n return attr_class\n } else {\n return splitClassString(attr_class)\n }\n}\n","import { CapturedNetworkRequest, NetworkRecordOptions, PostHogConfig } from '../../types'\nimport { isFunction, isNullish, isString, isUndefined } from '../../utils/type-utils'\nimport { convertToURL } from '../../utils/request-utils'\nimport { logger } from '../../utils/logger'\nimport { shouldCaptureValue } from '../../autocapture-utils'\nimport { each } from '../../utils'\n\nconst LOGGER_PREFIX = '[SessionRecording]'\n\nconst REDACTED = 'redacted'\n\nexport const defaultNetworkOptions: Required<NetworkRecordOptions> = {\n initiatorTypes: [\n 'audio',\n 'beacon',\n 'body',\n 'css',\n 'early-hint',\n 'embed',\n 'fetch',\n 'frame',\n 'iframe',\n 'icon',\n 'image',\n 'img',\n 'input',\n 'link',\n 'navigation',\n 'object',\n 'ping',\n 'script',\n 'track',\n 'video',\n 'xmlhttprequest',\n ],\n maskRequestFn: (data: CapturedNetworkRequest) => data,\n recordHeaders: false,\n recordBody: false,\n recordInitialRequests: false,\n recordPerformance: false,\n performanceEntryTypeToObserve: [\n // 'event', // This is too noisy as it covers all browser events\n 'first-input',\n // 'mark', // Mark is used too liberally. We would need to filter for specific marks\n // 'measure', // Measure is used too liberally. We would need to filter for specific measures\n 'navigation',\n 'paint',\n 'resource',\n ],\n payloadSizeLimitBytes: 1000000,\n payloadHostDenyList: [\n '.lr-ingest.io',\n '.ingest.sentry.io',\n '.clarity.ms',\n // NB no leading dot here\n 'analytics.google.com',\n ],\n}\n\nconst HEADER_DENY_LIST = [\n 'authorization',\n 'x-forwarded-for',\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-real-ip',\n 'remote-addr',\n 'forwarded',\n 'proxy-authorization',\n 'x-csrf-token',\n 'x-csrftoken',\n 'x-xsrf-token',\n]\n\nconst PAYLOAD_CONTENT_DENY_LIST = [\n 'password',\n 'secret',\n 'passwd',\n 'api_key',\n 'apikey',\n 'auth',\n 'credentials',\n 'mysql_pwd',\n 'privatekey',\n 'private_key',\n 'token',\n]\n\n// we always remove headers on the deny list because we never want to capture this sensitive data\nconst removeAuthorizationHeader = (data: CapturedNetworkRequest): CapturedNetworkRequest => {\n const headers = data.requestHeaders\n if (!isNullish(headers)) {\n each(Object.keys(headers ?? {}), (header) => {\n if (HEADER_DENY_LIST.includes(header.toLowerCase())) {\n headers[header] = REDACTED\n }\n })\n }\n return data\n}\n\nconst POSTHOG_PATHS_TO_IGNORE = ['/s/', '/e/', '/i/']\n// want to ignore posthog paths when capturing requests, or we can get trapped in a loop\n// because calls to PostHog would be reported using a call to PostHog which would be reported....\nconst ignorePostHogPaths = (\n data: CapturedNetworkRequest,\n apiHostConfig: PostHogConfig['api_host']\n): CapturedNetworkRequest | undefined => {\n const url = convertToURL(data.name)\n\n // we need to account for api host config as e.g. pathname could be /ingest/s/ and we want to ignore that\n let replaceValue = apiHostConfig.indexOf('http') === 0 ? convertToURL(apiHostConfig)?.pathname : apiHostConfig\n if (replaceValue === '/') {\n replaceValue = ''\n }\n const pathname = url?.pathname.replace(replaceValue || '', '')\n\n if (url && pathname && POSTHOG_PATHS_TO_IGNORE.some((path) => pathname.indexOf(path) === 0)) {\n return undefined\n }\n return data\n}\n\nfunction estimateBytes(payload: string): number {\n return new Blob([payload]).size\n}\n\nfunction enforcePayloadSizeLimit(\n payload: string | null | undefined,\n headers: Record<string, any> | undefined,\n limit: number,\n description: string\n): string | null | undefined {\n if (isNullish(payload)) {\n return payload\n }\n\n let requestContentLength: string | number = headers?.['content-length'] || estimateBytes(payload)\n if (isString(requestContentLength)) {\n requestContentLength = parseInt(requestContentLength)\n }\n\n if (requestContentLength > limit) {\n return LOGGER_PREFIX + ` ${description} body too large to record (${requestContentLength} bytes)`\n }\n\n return payload\n}\n\n// people can have arbitrarily large payloads on their site, but we don't want to ingest them\nconst limitPayloadSize = (\n options: NetworkRecordOptions\n): ((data: CapturedNetworkRequest | undefined) => CapturedNetworkRequest | undefined) => {\n // the smallest of 1MB or the specified limit if there is one\n const limit = Math.min(1000000, options.payloadSizeLimitBytes ?? 1000000)\n\n return (data) => {\n if (data?.requestBody) {\n data.requestBody = enforcePayloadSizeLimit(data.requestBody, data.requestHeaders, limit, 'Request')\n }\n\n if (data?.responseBody) {\n data.responseBody = enforcePayloadSizeLimit(data.responseBody, data.responseHeaders, limit, 'Response')\n }\n\n return data\n }\n}\n\nfunction scrubPayload(payload: string | null | undefined, label: 'Request' | 'Response'): string | null | undefined {\n if (isNullish(payload)) {\n return payload\n }\n let scrubbed = payload\n\n if (!shouldCaptureValue(scrubbed, false)) {\n scrubbed = LOGGER_PREFIX + ' ' + label + ' body ' + REDACTED\n }\n each(PAYLOAD_CONTENT_DENY_LIST, (text) => {\n if (scrubbed?.length && scrubbed?.indexOf(text) !== -1) {\n scrubbed = LOGGER_PREFIX + ' ' + label + ' body ' + REDACTED + ' as might contain: ' + text\n }\n })\n\n return scrubbed\n}\n\nfunction scrubPayloads(capturedRequest: CapturedNetworkRequest | undefined): CapturedNetworkRequest | undefined {\n if (isUndefined(capturedRequest)) {\n return undefined\n }\n\n capturedRequest.requestBody = scrubPayload(capturedRequest.requestBody, 'Request')\n capturedRequest.responseBody = scrubPayload(capturedRequest.responseBody, 'Response')\n\n return capturedRequest\n}\n\n/**\n * whether a maskRequestFn is provided or not,\n * we ensure that we remove the denied header from requests\n * we _never_ want to record that header by accident\n * if someone complains then we'll add an opt-in to let them override it\n */\nexport const buildNetworkRequestOptions = (\n instanceConfig: PostHogConfig,\n remoteNetworkOptions: Pick<\n NetworkRecordOptions,\n 'recordHeaders' | 'recordBody' | 'recordPerformance' | 'payloadHostDenyList'\n >\n): NetworkRecordOptions => {\n const config: NetworkRecordOptions = {\n payloadSizeLimitBytes: defaultNetworkOptions.payloadSizeLimitBytes,\n performanceEntryTypeToObserve: [...defaultNetworkOptions.performanceEntryTypeToObserve],\n payloadHostDenyList: [\n ...(remoteNetworkOptions.payloadHostDenyList || []),\n ...defaultNetworkOptions.payloadHostDenyList,\n ],\n }\n // client can always disable despite remote options\n const canRecordHeaders =\n instanceConfig.session_recording.recordHeaders === false ? false : remoteNetworkOptions.recordHeaders\n const canRecordBody =\n instanceConfig.session_recording.recordBody === false ? false : remoteNetworkOptions.recordBody\n const canRecordPerformance =\n instanceConfig.capture_performance === false ? false : remoteNetworkOptions.recordPerformance\n\n const payloadLimiter = limitPayloadSize(config)\n\n const enforcedCleaningFn: NetworkRecordOptions['maskRequestFn'] = (d: CapturedNetworkRequest) =>\n payloadLimiter(ignorePostHogPaths(removeAuthorizationHeader(d), instanceConfig.api_host))\n\n const hasDeprecatedMaskFunction = isFunction(instanceConfig.session_recording.maskNetworkRequestFn)\n\n if (hasDeprecatedMaskFunction && isFunction(instanceConfig.session_recording.maskCapturedNetworkRequestFn)) {\n logger.warn(\n 'Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored.'\n )\n }\n\n if (hasDeprecatedMaskFunction) {\n instanceConfig.session_recording.maskCapturedNetworkRequestFn = (data: CapturedNetworkRequest) => {\n const cleanedURL = instanceConfig.session_recording.maskNetworkRequestFn!({ url: data.name })\n return {\n ...data,\n name: cleanedURL?.url,\n } as CapturedNetworkRequest\n }\n }\n\n config.maskRequestFn = isFunction(instanceConfig.session_recording.maskCapturedNetworkRequestFn)\n ? (data) => {\n const cleanedRequest = enforcedCleaningFn(data)\n return cleanedRequest\n ? (instanceConfig.session_recording.maskCapturedNetworkRequestFn?.(cleanedRequest) ?? undefined)\n : undefined\n }\n : (data) => scrubPayloads(enforcedCleaningFn(data))\n\n return {\n ...defaultNetworkOptions,\n ...config,\n recordHeaders: canRecordHeaders,\n recordBody: canRecordBody,\n recordPerformance: canRecordPerformance,\n recordInitialRequests: canRecordPerformance,\n }\n}\n","/// <reference lib=\"dom\" />\n\n// rrweb/network@1 code starts\n// most of what is below here will be removed when rrweb release their code for this\n// see https://github.com/rrweb-io/rrweb/pull/1105\n\n// NB adopted from https://github.com/rrweb-io/rrweb/pull/1105 which looks like it will be accepted into rrweb\n// however, in the PR, it throws when the performance observer data is not available\n// and assumes it is running in a browser with the Request API (i.e. not IE11)\n// copying here so that we can use it before rrweb adopt it\nimport type { IWindow, listenerHandler, RecordPlugin } from '@rrweb/types'\nimport { CapturedNetworkRequest, Headers, InitiatorType, NetworkRecordOptions } from '../../../types'\nimport {\n isArray,\n isBoolean,\n isDocument,\n isFormData,\n isNull,\n isNullish,\n isObject,\n isString,\n isUndefined,\n} from '../../../utils/type-utils'\nimport { createLogger } from '../../../utils/logger'\nimport { formDataToQuery } from '../../../utils/request-utils'\nimport { patch } from '../rrweb-plugins/patch'\nimport { isHostOnDenyList } from '../../../extensions/replay/external/denylist'\nimport { defaultNetworkOptions } from '../config'\n\nconst logger = createLogger('[Recorder]')\n\nexport type NetworkData = {\n requests: CapturedNetworkRequest[]\n isInitial?: boolean\n}\n\ntype networkCallback = (data: NetworkData) => void\n\nconst isNavigationTiming = (entry: PerformanceEntry): entry is PerformanceNavigationTiming =>\n entry.entryType === 'navigation'\nconst isResourceTiming = (entry: PerformanceEntry): entry is PerformanceResourceTiming => entry.entryType === 'resource'\n\ntype ObservedPerformanceEntry = (PerformanceNavigationTiming | PerformanceResourceTiming) & {\n responseStatus?: number\n}\n\nexport function findLast<T>(array: Array<T>, predicate: (value: T) => boolean): T | undefined {\n const length = array.length\n for (let i = length - 1; i >= 0; i -= 1) {\n if (predicate(array[i])) {\n return array[i]\n }\n }\n return undefined\n}\n\nfunction initPerformanceObserver(cb: networkCallback, win: IWindow, options: Required<NetworkRecordOptions>) {\n // if we are only observing timings then we could have a single observer for all types, with buffer true,\n // but we are going to filter by initiatorType _if we are wrapping fetch and xhr as the wrapped functions\n // will deal with those.\n // so we have a block which captures requests from before fetch/xhr is wrapped\n // these are marked `isInitial` so playback can display them differently if needed\n // they will never have method/status/headers/body because they are pre-wrapping that provides that\n if (options.recordInitialRequests) {\n const initialPerformanceEntries = win.performance\n .getEntries()\n .filter(\n (entry): entry is ObservedPerformanceEntry =>\n isNavigationTiming(entry) ||\n (isResourceTiming(entry) && options.initiatorTypes.includes(entry.initiatorType as InitiatorType))\n )\n cb({\n requests: initialPerformanceEntries.flatMap((entry) =>\n prepareRequest({ entry, method: undefined, status: undefined, networkRequest: {}, isInitial: true })\n ),\n isInitial: true,\n })\n }\n const observer = new win.PerformanceObserver((entries) => {\n // if recordBody or recordHeaders is true then we don't want to record fetch or xhr here\n // as the wrapped functions will do that. Otherwise, this filter becomes a noop\n // because we do want to record them here\n const wrappedInitiatorFilter = (entry: ObservedPerformanceEntry) =>\n options.recordBody || options.recordHeaders\n ? entry.initiatorType !== 'xmlhttprequest' && entry.initiatorType !== 'fetch'\n : true\n\n const performanceEntries = entries.getEntries().filter(\n (entry): entry is ObservedPerformanceEntry =>\n isNavigationTiming(entry) ||\n (isResourceTiming(entry) &&\n options.initiatorTypes.includes(entry.initiatorType as InitiatorType) &&\n // TODO if we are _only_ capturing timing we don't want to filter initiator here\n wrappedInitiatorFilter(entry))\n )\n\n cb({\n requests: performanceEntries.flatMap((entry) =>\n prepareRequest({ entry, method: undefined, status: undefined, networkRequest: {} })\n ),\n })\n })\n // compat checked earlier\n // eslint-disable-next-line compat/compat\n const entryTypes = PerformanceObserver.supportedEntryTypes.filter((x) =>\n options.performanceEntryTypeToObserve.includes(x)\n )\n // initial records are gathered above, so we don't need to observe and buffer each type separately\n observer.observe({ entryTypes })\n return () => {\n observer.disconnect()\n }\n}\n\nfunction shouldRecordHeaders(type: 'request' | 'response', recordHeaders: NetworkRecordOptions['recordHeaders']) {\n return !!recordHeaders && (isBoolean(recordHeaders) || recordHeaders[type])\n}\n\nexport function shouldRecordBody({\n type,\n recordBody,\n headers,\n url,\n}: {\n type: 'request' | 'response'\n headers: Headers\n url: string | URL | RequestInfo\n recordBody: NetworkRecordOptions['recordBody']\n}) {\n function matchesContentType(contentTypes: string[]) {\n const contentTypeHeader = Object.keys(headers).find((key) => key.toLowerCase() === 'content-type')\n const contentType = contentTypeHeader && headers[contentTypeHeader]\n return contentTypes.some((ct) => contentType?.includes(ct))\n }\n\n /**\n * particularly in canvas applications we see many requests to blob URLs\n * e.g. blob:https://video_url\n * these blob/object URLs are local to the browser, we can never capture that body\n * so we can just return false here\n */\n function isBlobURL(url: string | URL | RequestInfo) {\n try {\n if (typeof url === 'string') {\n return url.startsWith('blob:')\n }\n if (url instanceof URL) {\n return url.protocol === 'blob:'\n }\n if (url instanceof Request) {\n return isBlobURL(url.url)\n }\n return false\n } catch {\n return false\n }\n }\n if (!recordBody) return false\n if (isBlobURL(url)) return false\n if (isBoolean(recordBody)) return true\n if (isArray(recordBody)) return matchesContentType(recordBody)\n const recordBodyType = recordBody[type]\n if (isBoolean(recordBodyType)) return recordBodyType\n return matchesContentType(recordBodyType)\n}\n\nasync function getRequestPerformanceEntry(\n win: IWindow,\n initiatorType: string,\n url: string,\n start?: number,\n end?: number,\n attempt = 0\n): Promise<PerformanceResourceTiming | null> {\n if (attempt > 10) {\n logger.warn('Failed to get performance entry for request', { url, initiatorType })\n return null\n }\n const urlPerformanceEntries = win.performance.getEntriesByName(url) as PerformanceResourceTiming[]\n const performanceEntry = findLast(\n urlPerformanceEntries,\n (entry) =>\n isResourceTiming(entry) &&\n entry.initiatorType === initiatorType &&\n (isUndefined(start) || entry.startTime >= start) &&\n (isUndefined(end) || entry.startTime <= end)\n )\n if (!performanceEntry) {\n await new Promise((resolve) => setTimeout(resolve, 50 * attempt))\n return getRequestPerformanceEntry(win, initiatorType, url, start, end, attempt + 1)\n }\n return performanceEntry\n}\n\n/**\n * According to MDN https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/response\n * xhr response is typed as any but can be an ArrayBuffer, a Blob, a Document, a JavaScript object,\n * or a string, depending on the value of XMLHttpRequest.responseType, that contains the response entity body.\n *\n * XHR request body is Document | XMLHttpRequestBodyInit | null | undefined\n */\nfunction _tryReadXHRBody({\n body,\n options,\n url,\n}: {\n body: Document | XMLHttpRequestBodyInit | any | null | undefined\n options: NetworkRecordOptions\n url: string | URL | RequestInfo\n}): string | null {\n if (isNullish(body)) {\n return null\n }\n\n const { hostname, isHostDenied } = isHostOnDenyList(url, options)\n if (isHostDenied) {\n return hostname + ' is in deny list'\n }\n\n if (isString(body)) {\n return body\n }\n\n if (isDocument(body)) {\n return body.textContent\n }\n\n if (isFormData(body)) {\n return formDataToQuery(body)\n }\n\n if (isObject(body)) {\n try {\n return JSON.stringify(body)\n } catch {\n return '[SessionReplay] Failed to stringify response object'\n }\n }\n\n return '[SessionReplay] Cannot read body of type ' + toString.call(body)\n}\n\nfunction initXhrObserver(cb: networkCallback, win: IWindow, options: Required<NetworkRecordOptions>): listenerHandler {\n if (!options.initiatorTypes.includes('xmlhttprequest')) {\n return () => {\n //\n }\n }\n const recordRequestHeaders = shouldRecordHeaders('request', options.recordHeaders)\n const recordResponseHeaders = shouldRecordHeaders('response', options.recordHeaders)\n\n const restorePatch = patch(\n win.XMLHttpRequest.prototype,\n 'open',\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (originalOpen: typeof XMLHttpRequest.prototype.open) => {\n return function (\n method: string,\n url: string | URL,\n async = true,\n username?: string | null,\n password?: string | null\n ) {\n // because this function is returned in its actual context `this` _is_ an XMLHttpRequest\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const xhr = this as XMLHttpRequest\n\n // check IE earlier than this, we only initialize if Request is present\n // eslint-disable-next-line compat/compat\n const req = new Request(url)\n const networkRequest: Partial<CapturedNetworkRequest> = {}\n let start: number | undefined\n let end: number | undefined\n\n const requestHeaders: Headers = {}\n const originalSetRequestHeader = xhr.setRequestHeader.bind(xhr)\n xhr.setRequestHeader = (header: string, value: string) => {\n requestHeaders[header] = value\n return originalSetRequestHeader(header, value)\n }\n if (recordRequestHeaders) {\n networkRequest.requestHeaders = requestHeaders\n }\n\n const originalSend = xhr.send.bind(xhr)\n xhr.send = (body) => {\n if (\n shouldRecordBody({\n type: 'request',\n headers: requestHeaders,\n url,\n recordBody: options.recordBody,\n })\n ) {\n networkRequest.requestBody = _tryReadXHRBody({ body, options, url })\n }\n start = win.performance.now()\n return originalSend(body)\n }\n\n // This is very tricky code, and making it passive won't bring many performance benefits,\n // so let's ignore the rule here.\n // eslint-disable-next-line posthog-js/no-add-event-listener\n xhr.addEventListener('readystatechange', () => {\n if (xhr.readyState !== xhr.DONE) {\n return\n }\n end = win.performance.now()\n const responseHeaders: Headers = {}\n const rawHeaders = xhr.getAllResponseHeaders()\n const headers = rawHeaders.trim().split(/[\\r\\n]+/)\n headers.forEach((line) => {\n const parts = line.split(': ')\n const header = parts.shift()\n const value = parts.join(': ')\n if (header) {\n responseHeaders[header] = value\n }\n })\n if (recordResponseHeaders) {\n networkRequest.responseHeaders = responseHeaders\n }\n if (\n shouldRecordBody({\n type: 'response',\n headers: responseHeaders,\n url,\n recordBody: options.recordBody,\n })\n ) {\n networkRequest.responseBody = _tryReadXHRBody({ body: xhr.response, options, url })\n }\n getRequestPerformanceEntry(win, 'xmlhttprequest', req.url, start, end)\n .then((entry) => {\n const requests = prepareRequest({\n entry,\n method: method,\n status: xhr?.status,\n networkRequest,\n start,\n end,\n url: url.toString(),\n initiatorType: 'xmlhttprequest',\n })\n cb({ requests })\n })\n .catch(() => {\n //\n })\n })\n\n originalOpen.call(xhr, method, url, async, username, password)\n }\n }\n )\n return () => {\n restorePatch()\n }\n}\n\n/**\n * Check if this PerformanceEntry is either a PerformanceResourceTiming or a PerformanceNavigationTiming\n * NB PerformanceNavigationTiming extends PerformanceResourceTiming\n * Here we don't care which interface it implements as both expose `serverTimings`\n */\nconst exposesServerTiming = (event: PerformanceEntry | null): event is PerformanceResourceTiming =>\n !isNull(event) && (event.entryType === 'navigation' || event.entryType === 'resource')\n\nfunction prepareRequest({\n entry,\n method,\n status,\n networkRequest,\n isInitial,\n start,\n end,\n url,\n initiatorType,\n}: {\n entry: PerformanceResourceTiming | null\n method: string | undefined\n status: number | undefined\n networkRequest: Partial<CapturedNetworkRequest>\n isInitial?: boolean\n start?: number\n end?: number\n // if there is no performance observer entry, we still need to know the url\n url?: string\n // if there is no performance observer entry, we can provide the initiatorType\n initiatorType?: string\n}): CapturedNetworkRequest[] {\n start = entry ? entry.startTime : start\n end = entry ? entry.responseEnd : end\n\n // kudos to sentry javascript sdk for excellent background on why to use Date.now() here\n // https://github.com/getsentry/sentry-javascript/blob/e856e40b6e71a73252e788cd42b5260f81c9c88e/packages/utils/src/time.ts#L70\n // can't start observer if performance.now() is not available\n // eslint-disable-next-line compat/compat\n const timeOrigin = Math.floor(Date.now() - performance.now())\n // clickhouse can't ingest timestamps that are floats\n // (in this case representing fractions of a millisecond we don't care about anyway)\n // use timeOrigin if we really can't gather a start time\n const timestamp = Math.floor(timeOrigin + (start || 0))\n\n const entryJSON = entry ? entry.toJSON() : { name: url }\n\n const requests: CapturedNetworkRequest[] = [\n {\n ...entryJSON,\n startTime: isUndefined(start) ? undefined : Math.round(start),\n endTime: isUndefined(end) ? undefined : Math.round(end),\n timeOrigin,\n timestamp,\n method: method,\n initiatorType: initiatorType ? initiatorType : entry ? (entry.initiatorType as InitiatorType) : undefined,\n status,\n requestHeaders: networkRequest.requestHeaders,\n requestBody: networkRequest.requestBody,\n responseHeaders: networkRequest.responseHeaders,\n responseBody: networkRequest.responseBody,\n isInitial,\n },\n ]\n\n if (exposesServerTiming(entry)) {\n for (const timing of entry.serverTiming || []) {\n requests.push({\n timeOrigin,\n timestamp,\n startTime: Math.round(entry.startTime),\n name: timing.name,\n duration: timing.duration,\n // the spec has a closed list of possible types\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType\n // but, we need to know this was a server timing so that we know to\n // match it to the appropriate navigation or resource timing\n // that matching will have to be on timestamp and $current_url\n entryType: 'serverTiming',\n })\n }\n }\n\n return requests\n}\n\nconst contentTypePrefixDenyList = ['video/', 'audio/']\n\nfunction _checkForCannotReadResponseBody({\n r,\n options,\n url,\n}: {\n r: Response\n options: NetworkRecordOptions\n url: string | URL | RequestInfo\n}): string | null {\n if (r.headers.get('Transfer-Encoding') === 'chunked') {\n return 'Chunked Transfer-Encoding is not supported'\n }\n\n // `get` and `has` are case-insensitive\n // but return the header value with the casing that was supplied\n const contentType = r.headers.get('Content-Type')?.toLowerCase()\n const contentTypeIsDenied = contentTypePrefixDenyList.some((prefix) => contentType?.startsWith(prefix))\n if (contentType && contentTypeIsDenied) {\n return `Content-Type ${contentType} is not supported`\n }\n\n const { hostname, isHostDenied } = isHostOnDenyList(url, options)\n if (isHostDenied) {\n return hostname + ' is in deny list'\n }\n\n return null\n}\n\nfunction _tryReadBody(r: Request | Response): Promise<string> {\n // there are now already multiple places where we're using Promise...\n // eslint-disable-next-line compat/compat\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => resolve('[SessionReplay] Timeout while trying to read body'), 500)\n try {\n r.clone()\n .text()\n .then(\n (txt) => resolve(txt),\n (reason) => reject(reason)\n )\n .finally(() => clearTimeout(timeout))\n } catch {\n clearTimeout(timeout)\n resolve('[SessionReplay] Failed to read body')\n }\n })\n}\n\nasync function _tryReadRequestBody({\n r,\n options,\n url,\n}: {\n r: Request\n options: NetworkRecordOptions\n url: string | URL | RequestInfo\n}): Promise<string> {\n const { hostname, isHostDenied } = isHostOnDenyList(url, options)\n if (isHostDenied) {\n return Promise.resolve(hostname + ' is in deny list')\n }\n\n return _tryReadBody(r)\n}\n\nasync function _tryReadResponseBody({\n r,\n options,\n url,\n}: {\n r: Response\n options: NetworkRecordOptions\n url: string | URL | RequestInfo\n}): Promise<string> {\n const cannotReadBodyReason: string | null = _checkForCannotReadResponseBody({ r, options, url })\n if (!isNull(cannotReadBodyReason)) {\n return Promise.resolve(cannotReadBodyReason)\n }\n\n return _tryReadBody(r)\n}\n\nfunction initFetchObserver(\n cb: networkCallback,\n win: IWindow,\n options: Required<NetworkRecordOptions>\n): listenerHandler {\n if (!options.initiatorTypes.includes('fetch')) {\n return () => {\n //\n }\n }\n const recordRequestHeaders = shouldRecordHeaders('request', options.recordHeaders)\n const recordResponseHeaders = shouldRecordHeaders('response', options.recordHeaders)\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const restorePatch = patch(win, 'fetch', (originalFetch: typeof fetch) => {\n return async function (url: URL | RequestInfo, init?: RequestInit | undefined) {\n // check IE earlier than this, we only initialize if Request is present\n // eslint-disable-next-line compat/compat\n const req = new Request(url, init)\n let res: Response | undefined\n const networkRequest: Partial<CapturedNetworkRequest> = {}\n let start: number | undefined\n let end: number | undefined\n\n try {\n const requestHeaders: Headers = {}\n req.headers.forEach((value, header) => {\n requestHeaders[header] = value\n })\n if (recordRequestHeaders) {\n networkRequest.requestHeaders = requestHeaders\n }\n if (\n shouldRecordBody({\n type: 'request',\n headers: requestHeaders,\n url,\n recordBody: options.recordBody,\n })\n ) {\n networkRequest.requestBody = await _tryReadRequestBody({ r: req, options, url })\n }\n\n start = win.performance.now()\n res = await originalFetch(req)\n end = win.performance.now()\n\n const responseHeaders: Headers = {}\n res.headers.forEach((value, header) => {\n responseHeaders[header] = value\n })\n if (recordResponseHeaders) {\n networkRequest.responseHeaders = responseHeaders\n }\n if (\n shouldRecordBody({\n type: 'response',\n headers: responseHeaders,\n url,\n recordBody: options.recordBody,\n })\n ) {\n networkRequest.responseBody = await _tryReadResponseBody({ r: res, options, url })\n }\n\n return res\n } finally {\n getRequestPerformanceEntry(win, 'fetch', req.url, start, end)\n .then((entry) => {\n const requests = prepareRequest({\n entry,\n method: req.method,\n status: res?.status,\n networkRequest,\n start,\n end,\n url: req.url,\n initiatorType: 'fetch',\n })\n cb({ requests })\n })\n .catch(() => {\n //\n })\n }\n }\n })\n return () => {\n restorePatch()\n }\n}\n\nlet initialisedHandler: listenerHandler | null = null\n\nfunction initNetworkObserver(\n callback: networkCallback,\n win: IWindow, // top window or in an iframe\n options: NetworkRecordOptions\n): listenerHandler {\n if (!('performance' in win)) {\n return () => {\n //\n }\n }\n\n if (initialisedHandler) {\n logger.warn('Network observer already initialised, doing nothing')\n return () => {\n // the first caller should already have this handler and will be responsible for teardown\n }\n }\n\n const networkOptions = (\n options ? Object.assign({}, defaultNetworkOptions, options) : defaultNetworkOptions\n ) as Required<NetworkRecordOptions>\n\n const cb: networkCallback = (data) => {\n const requests: CapturedNetworkRequest[] = []\n data.requests.forEach((request) => {\n const maskedRequest = networkOptions.maskRequestFn(request)\n if (maskedRequest) {\n requests.push(maskedRequest)\n }\n })\n\n if (requests.length > 0) {\n callback({ ...data, requests })\n }\n }\n const performanceObserver = initPerformanceObserver(cb, win, networkOptions)\n\n // only wrap fetch and xhr if headers or body are being recorded\n let xhrObserver: listenerHandler = () => {}\n let fetchObserver: listenerHandler = () => {}\n if (networkOptions.recordHeaders || networkOptions.recordBody) {\n xhrObserver = initXhrObserver(cb, win, networkOptions)\n fetchObserver = initFetchObserver(cb, win, networkOptions)\n }\n\n initialisedHandler = () => {\n performanceObserver()\n xhrObserver()\n fetchObserver()\n }\n return initialisedHandler\n}\n\n// use the plugin name so that when this functionality is adopted into rrweb\n// we can remove this plugin and use the core functionality with the same data\nexport const NETWORK_PLUGIN_NAME = 'rrweb/network@1'\n\n// TODO how should this be typed?\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nexport const getRecordNetworkPlugin: (options?: NetworkRecordOptions) => RecordPlugin = (options) => {\n return {\n name: NETWORK_PLUGIN_NAME,\n observer: initNetworkObserver,\n options: options,\n }\n}\n\n// rrweb/networ@1 ends\n","import { record as rrwebRecord } from '@rrweb/record'\nimport { getRecordConsolePlugin } from '@rrweb/rrweb-plugin-console-record'\nimport { getRecordNetworkPlugin } from '../extensions/replay/external/network-plugin'\nimport { assignableWindow } from '../utils/globals'\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.rrwebPlugins = { getRecordConsolePlugin, getRecordNetworkPlugin }\nassignableWindow.__PosthogExtensions__.rrweb = { record: rrwebRecord, version: 'v2' }\n\n// we used to put all of these items directly on window, and now we put it on __PosthogExtensions__\n// but that means that old clients which lazily load this extension are looking in the wrong place\n// yuck,\n// so we also put them directly on the window\n// when 1.161.1 is the oldest version seen in production we can remove this\nassignableWindow.rrweb = { record: rrwebRecord, version: 'v2' }\nassignableWindow.rrwebConsoleRecord = { getRecordConsolePlugin }\nassignableWindow.getRecordNetworkPlugin = getRecordNetworkPlugin\n\nexport default rrwebRecord\n","/**\n * Having Survey types in types.ts was confusing tsc\n * and generating an invalid module.d.ts\n * See https://github.com/PostHog/posthog-js/issues/698\n */\n\nexport interface SurveyAppearance {\n // keep in sync with frontend/src/types.ts -> SurveyAppearance\n backgroundColor?: string\n submitButtonColor?: string\n // text color is deprecated, use auto contrast text color instead\n textColor?: string\n // deprecate submit button text eventually\n submitButtonText?: string\n submitButtonTextColor?: string\n descriptionTextColor?: string\n ratingButtonColor?: string\n ratingButtonActiveColor?: string\n ratingButtonHoverColor?: string\n whiteLabel?: boolean\n autoDisappear?: boolean\n displayThankYouMessage?: boolean\n thankYouMessageHeader?: string\n thankYouMessageDescription?: string\n thankYouMessageDescriptionContentType?: SurveyQuestionDescriptionContentType\n thankYouMessageCloseButtonText?: string\n borderColor?: string\n position?: 'left' | 'right' | 'center'\n placeholder?: string\n shuffleQuestions?: boolean\n surveyPopupDelaySeconds?: number\n // widget options\n widgetType?: 'button' | 'tab' | 'selector'\n widgetSelector?: string\n widgetLabel?: string\n widgetColor?: string\n fontFamily?: string\n // questionable: Not in frontend/src/types.ts -> SurveyAppearance, but used in site app\n maxWidth?: string\n zIndex?: string\n disabledButtonOpacity?: string\n}\n\nexport enum SurveyType {\n Popover = 'popover',\n API = 'api',\n Widget = 'widget',\n}\n\nexport type SurveyQuestion = BasicSurveyQuestion | LinkSurveyQuestion | RatingSurveyQuestion | MultipleSurveyQuestion\n\nexport type SurveyQuestionDescriptionContentType = 'html' | 'text'\n\ninterface SurveyQuestionBase {\n question: string\n id?: string\n description?: string | null\n descriptionContentType?: SurveyQuestionDescriptionContentType\n optional?: boolean\n buttonText?: string\n branching?: NextQuestionBranching | EndBranching | ResponseBasedBranching | SpecificQuestionBranching\n}\n\nexport interface BasicSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Open\n}\n\nexport interface LinkSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Link\n link?: string | null\n}\n\nexport interface RatingSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Rating\n display: 'number' | 'emoji'\n scale: 3 | 5 | 7 | 10\n lowerBoundLabel: string\n upperBoundLabel: string\n}\n\nexport interface MultipleSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.SingleChoice | SurveyQuestionType.MultipleChoice\n choices: string[]\n hasOpenChoice?: boolean\n shuffleOptions?: boolean\n}\n\nexport enum SurveyQuestionType {\n Open = 'open',\n MultipleChoice = 'multiple_choice',\n SingleChoice = 'single_choice',\n Rating = 'rating',\n Link = 'link',\n}\n\nexport enum SurveyQuestionBranchingType {\n NextQuestion = 'next_question',\n End = 'end',\n ResponseBased = 'response_based',\n SpecificQuestion = 'specific_question',\n}\n\ninterface NextQuestionBranching {\n type: SurveyQuestionBranchingType.NextQuestion\n}\n\ninterface EndBranching {\n type: SurveyQuestionBranchingType.End\n}\n\ninterface ResponseBasedBranching {\n type: SurveyQuestionBranchingType.ResponseBased\n responseValues: Record<string, any>\n}\n\ninterface SpecificQuestionBranching {\n type: SurveyQuestionBranchingType.SpecificQuestion\n index: number\n}\n\nexport interface SurveyResponse {\n surveys: Survey[]\n}\n\nexport type SurveyCallback = (surveys: Survey[]) => void\n\nexport type SurveyMatchType = 'regex' | 'not_regex' | 'exact' | 'is_not' | 'icontains' | 'not_icontains'\n\nexport interface SurveyElement {\n text?: string\n $el_text?: string\n tag_name?: string\n href?: string\n attr_id?: string\n attr_class?: string[]\n nth_child?: number\n nth_of_type?: number\n attributes?: Record<string, any>\n event_id?: number\n order?: number\n group_id?: number\n}\nexport interface SurveyRenderReason {\n visible: boolean\n disabledReason?: string\n}\n\nexport enum SurveySchedule {\n Once = 'once',\n Recurring = 'recurring',\n Always = 'always',\n}\n\nexport interface Survey {\n // Sync this with the backend's SurveyAPISerializer!\n id: string\n name: string\n description: string\n type: SurveyType\n feature_flag_keys:\n | {\n key: string\n value?: string\n }[]\n | null\n linked_flag_key: string | null\n targeting_flag_key: string | null\n internal_targeting_flag_key: string | null\n questions: SurveyQuestion[]\n appearance: SurveyAppearance | null\n conditions: {\n url?: string\n selector?: string\n seenSurveyWaitPeriodInDays?: number\n urlMatchType?: SurveyMatchType\n events: {\n repeatedActivation?: boolean\n values: {\n name: string\n }[]\n } | null\n actions: {\n values: SurveyActionType[]\n } | null\n deviceTypes?: string[]\n deviceTypesMatchType?: SurveyMatchType\n } | null\n start_date: string | null\n end_date: string | null\n current_iteration: number | null\n current_iteration_start_date: string | null\n schedule?: SurveySchedule | null\n}\n\nexport interface SurveyActionType {\n id: number\n name: string | null\n steps?: ActionStepType[]\n}\n\n/** Sync with plugin-server/src/types.ts */\nexport type ActionStepStringMatching = 'contains' | 'exact' | 'regex'\n\nexport interface ActionStepType {\n event?: string | null\n selector?: string | null\n /** @deprecated Only `selector` should be used now. */\n tag_name?: string\n text?: string | null\n /** @default StringMatching.Exact */\n text_matching?: ActionStepStringMatching | null\n href?: string | null\n /** @default ActionStepStringMatching.Exact */\n href_matching?: ActionStepStringMatching | null\n url?: string | null\n /** @default StringMatching.Contains */\n url_matching?: ActionStepStringMatching | null\n}\n","var n,l,u,t,i,o,r,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(n,l){for(var u in l)n[u]=l[u];return n}function p(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,t){var i,o,r,f={};for(r in u)\"key\"==r?i=u[r]:\"ref\"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),\"function\"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d(l,f,i,o,null)}function d(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function g(n){return n.children}function b(n,l){this.props=n,this.context=l}function m(n,l){if(null==l)return n.__?m(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return\"function\"==typeof n.type?m(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function w(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!x.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(x)}function x(){var n,u,t,o,r,e,c,s,a;for(i.sort(f);n=i.shift();)n.__d&&(u=i.length,o=void 0,e=(r=(t=n).__v).__e,s=[],a=[],(c=t.__P)&&((o=v({},r)).__v=r.__v+1,l.vnode&&l.vnode(o),L(c,o,r,t.__n,void 0!==c.ownerSVGElement,32&r.__u?[e]:null,s,null==e?m(r):e,!!(32&r.__u),a),o.__.__k[o.__i]=o,M(s,o,a),o.__e!=e&&k(o)),i.length>u&&i.sort(f));x.__r=0}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v<b;v++)null!=(y=u.__k[v])&&\"boolean\"!=typeof y&&\"function\"!=typeof y&&(p=-1===y.__i?c:g[y.__i]||c,y.__i=v,L(n,y,p,i,o,r,f,e,a,h),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&z(p.ref,null,y),h.push(y.ref,y.__c||d,y)),null==_&&null!=d&&(_=d),65536&y.__u||p.__k===y.__k?e=S(y,e,n):\"function\"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=_}function P(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)null!=(i=n.__k[t]=null==(i=l[t])||\"boolean\"==typeof i||\"function\"==typeof i?null:\"string\"==typeof i||\"number\"==typeof i||\"bigint\"==typeof i||i.constructor==String?d(null,i,null,null,i):h(i)?d(g,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?d(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r=t+a,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,\"function\"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:a=f<r&&f==r-1?f-r:0,f!==t+a&&(i.__u|=65536))):(o=u[t])&&null==o.key&&o.__e&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o,!1),u[t]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o))}function S(n,l,u){var t,i;if(\"function\"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=S(t[i],l,u));return l}return n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e),l&&l.nextSibling}function $(n,l){return l=l||[],null==n||\"boolean\"==typeof n||(h(n)?n.some(function(n){$(n,l)}):l.push(n)),l}function H(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type)return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++}}return-1}function I(n,l,u){\"-\"===l[0]?n.setProperty(l,null==u?\"\":u):n[l]=null==u?\"\":\"number\"!=typeof u||a.test(l)?u:u+\"px\"}function T(n,l,u,t,i){var o;n:if(\"style\"===l)if(\"string\"==typeof u)n.style.cssText=u;else{if(\"string\"==typeof t&&(n.style.cssText=t=\"\"),t)for(l in t)u&&l in u||I(n.style,l,\"\");if(u)for(l in u)t&&u[l]===t[l]||I(n.style,l,u[l])}else if(\"o\"===l[0]&&\"n\"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/,\"$1\")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?D:A,o)):n.removeEventListener(l,o?D:A,o);else{if(i)l=l.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(\"width\"!==l&&\"height\"!==l&&\"href\"!==l&&\"list\"!==l&&\"form\"!==l&&\"tabIndex\"!==l&&\"download\"!==l&&\"rowSpan\"!==l&&\"colSpan\"!==l&&\"role\"!==l&&l in n)try{n[l]=null==u?\"\":u;break n}catch(n){}\"function\"==typeof u||(null==u||!1===u&&\"-\"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u))}}function A(n){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l.event?l.event(n):n)}function D(n){return this.l[n.type+!0](l.event?l.event(n):n)}function L(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,m,k,w,x,P,S,$,H,I,T,A=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l.__b)&&a(u);n:if(\"function\"==typeof A)try{if(w=u.props,x=(a=A.contextType)&&i[a.__c],P=a?x?x.props.value:a.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:(\"prototype\"in A&&A.prototype.render?u.__c=p=new A(w,P):(u.__c=p=new b(w,P),p.constructor=A,p.render=O),x&&x.sub(p),p.props=w,p.state||(p.state={}),p.context=P,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(w,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==A.getDerivedStateFromProps&&w!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,P),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,P)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=w,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u)}),S=0;S<p._sb.length;S++)p.__h.push(p._sb[S]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,P),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,m)})}if(p.context=P,p.props=w,p.__P=n,p.__e=!1,$=l.__r,H=0,\"prototype\"in A&&A.prototype.render){for(p.state=p.__s,p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),I=0;I<p._sb.length;I++)p.__h.push(p._sb[I]);p._sb=[]}else do{p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=v(v({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,_)),C(n,h(T=null!=a&&a.type===g&&null==a.key?a.props.children:a)?T:[T],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__u&=-161,p.__h.length&&f.push(p),k&&(p.__E=p.__=null)}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function M(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)z(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function j(l,u,t,i,o,r,f,e,s){var a,v,y,d,_,g,b,k=t.props,w=u.props,x=u.type;if(\"svg\"===x&&(o=!0),null!=r)for(a=0;a<r.length;a++)if((_=r[a])&&\"setAttribute\"in _==!!x&&(x?_.localName===x:3===_.nodeType)){l=_,r[a]=null;break}if(null==l){if(null===x)return document.createTextNode(w);l=o?document.createElementNS(\"http://www.w3.org/2000/svg\",x):document.createElement(x,w.is&&w),r=null,e=!1}if(null===x)k===w||e&&l.data===w||(l.data=w);else{if(r=r&&n.call(l.childNodes),k=t.props||c,!e&&null!=r)for(k={},a=0;a<l.attributes.length;a++)k[(_=l.attributes[a]).name]=_.value;for(a in k)_=k[a],\"children\"==a||(\"dangerouslySetInnerHTML\"==a?y=_:\"key\"===a||a in w||T(l,a,null,_,o));for(a in w)_=w[a],\"children\"==a?d=_:\"dangerouslySetInnerHTML\"==a?v=_:\"value\"==a?g=_:\"checked\"==a?b=_:\"key\"===a||e&&\"function\"!=typeof _||k[a]===_||T(l,a,_,k[a],o);if(v)e||y&&(v.__html===y.__html||v.__html===l.innerHTML)||(l.innerHTML=v.__html),u.__k=[];else if(y&&(l.innerHTML=\"\"),C(l,h(d)?d:[d],u,t,i,o&&\"foreignObject\"!==x,r,f,r?r[0]:t.__k&&m(t,0),e,s),null!=r)for(a=r.length;a--;)null!=r[a]&&p(r[a]);e||(a=\"value\",void 0!==g&&(g!==l[a]||\"progress\"===x&&!g||\"option\"===x&&g!==k[a])&&T(l,a,g,k[a],!1),a=\"checked\",void 0!==b&&b!==l[a]&&T(l,a,b,k[a],!1))}return l}function z(n,u,t){try{\"function\"==typeof n?n(u):n.current=u}catch(n){l.__e(n,t)}}function N(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null,n.__c=void 0}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&N(i[o],u,t||\"function\"!=typeof n.type);t||null==n.__e||p(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function q(u,t,i){var o,r,f,e;l.__&&l.__(u,t),r=(o=\"function\"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],L(t,u=(!o&&i||t).__k=y(g,null,[u]),r||c,c,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),M(f,u,e)}function B(n,l){q(n,l,B)}function E(l,u,t){var i,o,r,f,e=v({},l.props);for(r in l.type&&l.type.defaultProps&&(f=l.type.defaultProps),u)\"key\"==r?i=u[r]:\"ref\"==r?o=u[r]:e[r]=void 0===u[r]&&void 0!==f?f[r]:u[r];return arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),d(l.type,e,i||l.key,o||l.ref,null)}function F(n,l){var u={__c:l=\"__cC\"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,w(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),\"function\"==typeof n&&(n=n(v({},u),this.props)),n&&v(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w(this))},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w(this))},b.prototype.render=g,i=[],r=\"function\"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e=0;export{b as Component,g as Fragment,E as cloneElement,F as createContext,y as createElement,_ as createRef,y as h,B as hydrate,t as isValidElement,l as options,q as render,$ as toChildArray};\n//# sourceMappingURL=preact.module.js.map\n","import { PostHog } from '../../posthog-core'\nimport { createLogger } from '../../utils/logger'\n\nconst logger = createLogger('[Stylesheet Loader]')\n\nexport const prepareStylesheet = (document: Document, innerText: string, posthog?: PostHog) => {\n // Forcing the existence of `document` requires this function to be called in a browser environment\n let stylesheet: HTMLStyleElement | null = document.createElement('style')\n stylesheet.innerText = innerText\n\n if (posthog?.config?.prepare_external_dependency_stylesheet) {\n stylesheet = posthog.config.prepare_external_dependency_stylesheet(stylesheet)\n }\n\n if (!stylesheet) {\n logger.error('prepare_external_dependency_stylesheet returned null')\n return null\n }\n\n return stylesheet\n}\n","import { VNode, cloneElement, createContext } from 'preact'\nimport { PostHog } from '../../posthog-core'\nimport {\n MultipleSurveyQuestion,\n Survey,\n SurveyAppearance,\n SurveyQuestion,\n SurveySchedule,\n SurveyType,\n} from '../../posthog-surveys-types'\nimport { document as _document, window as _window } from '../../utils/globals'\nimport { createLogger } from '../../utils/logger'\nimport { prepareStylesheet } from '../utils/stylesheet-loader'\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst window = _window as Window & typeof globalThis\nconst document = _document as Document\nconst SurveySeenPrefix = 'seenSurvey_'\n\nconst logger = createLogger('[Surveys]')\n\nexport const SURVEY_DEFAULT_Z_INDEX = 2147483647\n\nexport function getFontFamily(fontFamily?: string): string {\n if (fontFamily === 'inherit') {\n return 'inherit'\n }\n\n const defaultFontStack =\n 'BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"'\n return fontFamily ? `${fontFamily}, ${defaultFontStack}` : `-apple-system, ${defaultFontStack}`\n}\n\nexport function getSurveyResponseKey(questionId: string) {\n return `$survey_response_${questionId}`\n}\n\nexport const style = (appearance: SurveyAppearance | null) => {\n const positions = {\n left: 'left: 30px;',\n right: 'right: 30px;',\n center: `\n left: 50%;\n transform: translateX(-50%);\n `,\n }\n return `\n .survey-form, .thank-you-message {\n position: fixed;\n margin: 0px;\n bottom: 0px;\n color: black;\n font-weight: normal;\n font-family: ${getFontFamily(appearance?.fontFamily)};\n text-align: left;\n max-width: ${parseInt(appearance?.maxWidth || '300')}px;\n width: 100%;\n z-index: ${parseInt(appearance?.zIndex || SURVEY_DEFAULT_Z_INDEX.toString())};\n border: 1.5px solid ${appearance?.borderColor || '#c9c6c6'};\n border-bottom: 0px;\n ${positions[appearance?.position || 'right'] || 'right: 30px;'}\n flex-direction: column;\n background: ${appearance?.backgroundColor || '#eeeded'};\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);\n }\n\n .survey-box, .thank-you-message-container {\n padding: 20px 25px 10px;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n }\n\n .thank-you-message {\n text-align: center;\n }\n\n .form-submit[disabled] {\n opacity: ${appearance?.disabledButtonOpacity || '0.6'};\n filter: grayscale(50%);\n cursor: not-allowed;\n }\n .survey-form textarea {\n color: #2d2d2d;\n font-size: 14px;\n font-family: ${getFontFamily(appearance?.fontFamily)};\n background: white;\n color: black;\n outline: none;\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 10px;\n border-radius: 6px;\n border-color: ${appearance?.borderColor || '#c9c6c6'};\n margin-top: 14px;\n width: 100%;\n box-sizing: border-box;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) textarea {\n margin-top: 0;\n }\n .form-submit {\n box-sizing: border-box;\n margin: 0;\n font-family: inherit;\n overflow: visible;\n text-transform: none;\n position: relative;\n display: inline-block;\n font-weight: 700;\n white-space: nowrap;\n text-align: center;\n border: 1.5px solid transparent;\n cursor: pointer;\n user-select: none;\n touch-action: manipulation;\n padding: 12px;\n font-size: 14px;\n border-radius: 6px;\n outline: 0;\n background: ${appearance?.submitButtonColor || 'black'} !important;\n text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);\n width: 100%;\n }\n .form-cancel {\n display: flex;\n float: right;\n border: none;\n background: none;\n cursor: pointer;\n }\n .cancel-btn-wrapper {\n position: absolute;\n width: 35px;\n height: 35px;\n border-radius: 100%;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n background: white;\n border: 1.5px solid ${appearance?.borderColor || '#c9c6c6'};\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .bolded { font-weight: 600; }\n .buttons {\n display: flex;\n justify-content: center;\n }\n .footer-branding {\n font-size: 11px;\n margin-top: 10px;\n text-align: center;\n display: flex;\n justify-content: center;\n gap: 4px;\n align-items: center;\n font-weight: 500;\n background: ${appearance?.backgroundColor || '#eeeded'};\n text-decoration: none;\n backgroundColor: ${appearance?.backgroundColor || '#eeeded'};\n color: ${getContrastingTextColor(appearance?.backgroundColor || '#eeeded')};\n }\n .survey-question {\n font-weight: 500;\n font-size: 14px;\n background: ${appearance?.backgroundColor || '#eeeded'};\n }\n .question-textarea-wrapper {\n display: flex;\n flex-direction: column;\n }\n .survey-question-description {\n font-size: 13px;\n padding-top: 5px;\n background: ${appearance?.backgroundColor || '#eeeded'};\n }\n .ratings-number {\n font-size: 16px;\n font-weight: 600;\n padding: 8px 0px;\n border: none;\n }\n .ratings-number:hover {\n cursor: pointer;\n }\n .rating-options {\n margin-top: 14px;\n }\n .rating-options-number {\n display: grid;\n border-radius: 6px;\n overflow: hidden;\n border: 1.5px solid ${appearance?.borderColor || '#c9c6c6'};\n }\n .rating-options-number > .ratings-number {\n border-right: 1px solid ${appearance?.borderColor || '#c9c6c6'};\n }\n .rating-options-number > .ratings-number:last-of-type {\n border-right: 0px;\n }\n .rating-options-number .rating-active {\n background: ${appearance?.ratingButtonActiveColor || 'black'};\n }\n .rating-options-emoji {\n display: flex;\n justify-content: space-between;\n }\n .ratings-emoji {\n font-size: 16px;\n background-color: transparent;\n border: none;\n padding: 0px;\n }\n .ratings-emoji:hover {\n cursor: pointer;\n }\n .ratings-emoji.rating-active svg {\n fill: ${appearance?.ratingButtonActiveColor || 'black'};\n }\n .emoji-svg {\n fill: '#939393';\n }\n .rating-text {\n display: flex;\n flex-direction: row;\n font-size: 11px;\n justify-content: space-between;\n margin-top: 6px;\n background: ${appearance?.backgroundColor || '#eeeded'};\n opacity: .60;\n }\n .limit-height {\n max-height: 300px;\n overflow: auto;\n scrollbar-width: thin;\n scrollbar-color: ${appearance?.borderColor || '#c9c6c6'} ${appearance?.backgroundColor || '#eeeded'};\n }\n .multiple-choice-options {\n margin-top: 13px;\n font-size: 14px;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) .multiple-choice-options {\n margin-top: 0;\n }\n .multiple-choice-options .choice-option {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 13px;\n cursor: pointer;\n margin-bottom: 5px;\n position: relative;\n }\n .multiple-choice-options > .choice-option:last-of-type {\n margin-bottom: 0px;\n }\n .multiple-choice-options input {\n cursor: pointer;\n position: absolute;\n opacity: 0;\n }\n .choice-check {\n position: absolute;\n right: 10px;\n background: white;\n }\n .choice-check svg {\n display: none;\n }\n .multiple-choice-options .choice-option:hover .choice-check svg {\n display: inline-block;\n opacity: .25;\n }\n .multiple-choice-options input:checked + label + .choice-check svg {\n display: inline-block;\n opacity: 100% !important;\n }\n .multiple-choice-options input:checked + label {\n font-weight: bold;\n border: 1.5px solid rgba(0,0,0);\n }\n .multiple-choice-options input:checked + label input {\n font-weight: bold;\n }\n .multiple-choice-options label {\n width: 100%;\n cursor: pointer;\n padding: 10px;\n border: 1.5px solid rgba(0,0,0,.25);\n border-radius: 4px;\n background: white;\n }\n .multiple-choice-options .choice-option-open label {\n padding-right: 30px;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n max-width: 100%;\n }\n .multiple-choice-options .choice-option-open label span {\n width: 100%;\n }\n .multiple-choice-options .choice-option-open input:disabled + label {\n opacity: 0.6;\n }\n .multiple-choice-options .choice-option-open label input {\n position: relative;\n opacity: 1;\n flex-grow: 1;\n border: 0;\n outline: 0;\n }\n .thank-you-message-body {\n margin-top: 6px;\n font-size: 14px;\n background: ${appearance?.backgroundColor || '#eeeded'};\n }\n .thank-you-message-header {\n margin: 10px 0px 0px;\n background: ${appearance?.backgroundColor || '#eeeded'};\n }\n .thank-you-message-container .form-submit {\n margin-top: 20px;\n margin-bottom: 10px;\n }\n .thank-you-message-countdown {\n margin-left: 6px;\n }\n .bottom-section {\n margin-top: 14px;\n }\n `\n}\n\nfunction nameToHex(name: string) {\n return {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n 'indianred ': '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgrey: '#d3d3d3',\n lightgreen: '#90ee90',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370d8',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#d87093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n }[name.toLowerCase()]\n}\n\nfunction hex2rgb(c: string) {\n if (c[0] === '#') {\n const hexColor = c.replace(/^#/, '')\n const r = parseInt(hexColor.slice(0, 2), 16)\n const g = parseInt(hexColor.slice(2, 4), 16)\n const b = parseInt(hexColor.slice(4, 6), 16)\n return 'rgb(' + r + ',' + g + ',' + b + ')'\n }\n return 'rgb(255, 255, 255)'\n}\n\nexport function getContrastingTextColor(color: string = defaultBackgroundColor) {\n let rgb\n if (color[0] === '#') {\n rgb = hex2rgb(color)\n }\n if (color.startsWith('rgb')) {\n rgb = color\n }\n // otherwise it's a color name\n const nameColorToHex = nameToHex(color)\n if (nameColorToHex) {\n rgb = hex2rgb(nameColorToHex)\n }\n if (!rgb) {\n return 'black'\n }\n const colorMatch = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (colorMatch) {\n const r = parseInt(colorMatch[1])\n const g = parseInt(colorMatch[2])\n const b = parseInt(colorMatch[3])\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? 'black' : 'white'\n }\n return 'black'\n}\nexport function getTextColor(el: HTMLElement) {\n const backgroundColor = window.getComputedStyle(el).backgroundColor\n if (backgroundColor === 'rgba(0, 0, 0, 0)') {\n return 'black'\n }\n const colorMatch = backgroundColor.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (!colorMatch) return 'black'\n\n const r = parseInt(colorMatch[1])\n const g = parseInt(colorMatch[2])\n const b = parseInt(colorMatch[3])\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? 'black' : 'white'\n}\n\nexport const defaultSurveyAppearance: SurveyAppearance = {\n backgroundColor: '#eeeded',\n submitButtonColor: 'black',\n submitButtonTextColor: 'white',\n ratingButtonColor: 'white',\n ratingButtonActiveColor: 'black',\n borderColor: '#c9c6c6',\n placeholder: 'Start typing...',\n whiteLabel: false,\n displayThankYouMessage: true,\n thankYouMessageHeader: 'Thank you for your feedback!',\n position: 'right',\n}\n\nexport const defaultBackgroundColor = '#eeeded'\n\nexport const createShadow = (styleSheet: string, surveyId: string, element?: Element, posthog?: PostHog) => {\n const div = document.createElement('div')\n div.className = `PostHogSurvey${surveyId}`\n const shadow = div.attachShadow({ mode: 'open' })\n if (styleSheet) {\n const styleElement = prepareStylesheet(document, styleSheet, posthog)\n if (styleElement) {\n shadow.appendChild(styleElement)\n }\n }\n ;(element ? element : document.body).appendChild(div)\n return shadow\n}\n\nexport const sendSurveyEvent = (\n responses: Record<string, string | number | string[] | null> = {},\n survey: Survey,\n posthog?: PostHog\n) => {\n if (!posthog) {\n logger.error('[survey sent] event not captured, PostHog instance not found.')\n return\n }\n localStorage.setItem(getSurveySeenKey(survey), 'true')\n\n posthog.capture('survey sent', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n $survey_iteration: survey.current_iteration,\n $survey_iteration_start_date: survey.current_iteration_start_date,\n $survey_questions: survey.questions.map((question, index) => ({\n id: question.id,\n question: question.question,\n index,\n })),\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...responses,\n $set: {\n [getSurveyInteractionProperty(survey, 'responded')]: true,\n },\n })\n window.dispatchEvent(new Event('PHSurveySent'))\n}\n\nexport const dismissedSurveyEvent = (survey: Survey, posthog?: PostHog, readOnly?: boolean) => {\n // TODO: state management and unit tests for this would be nice\n if (!posthog) {\n logger.error('[survey dismissed] event not captured, PostHog instance not found.')\n return\n }\n if (readOnly) {\n return\n }\n posthog.capture('survey dismissed', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n $survey_iteration: survey.current_iteration,\n $survey_iteration_start_date: survey.current_iteration_start_date,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n $set: {\n [getSurveyInteractionProperty(survey, 'dismissed')]: true,\n },\n })\n localStorage.setItem(getSurveySeenKey(survey), 'true')\n window.dispatchEvent(new Event('PHSurveyClosed'))\n}\n\n// Use the Fisher-yates algorithm to shuffle this array\n// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\nexport const shuffle = (array: any[]) => {\n return array\n .map((a) => ({ sort: Math.floor(Math.random() * 10), value: a }))\n .sort((a, b) => a.sort - b.sort)\n .map((a) => a.value)\n}\n\nconst reverseIfUnshuffled = (unshuffled: any[], shuffled: any[]): any[] => {\n if (unshuffled.length === shuffled.length && unshuffled.every((val, index) => val === shuffled[index])) {\n return shuffled.reverse()\n }\n\n return shuffled\n}\n\nexport const getDisplayOrderChoices = (question: MultipleSurveyQuestion): string[] => {\n if (!question.shuffleOptions) {\n return question.choices\n }\n\n const displayOrderChoices = question.choices\n let openEndedChoice = ''\n if (question.hasOpenChoice) {\n // if the question has an open-ended choice, its always the last element in the choices array.\n openEndedChoice = displayOrderChoices.pop()!\n }\n\n const shuffledOptions = reverseIfUnshuffled(displayOrderChoices, shuffle(displayOrderChoices))\n\n if (question.hasOpenChoice) {\n question.choices.push(openEndedChoice)\n shuffledOptions.push(openEndedChoice)\n }\n\n return shuffledOptions\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n if (!survey.appearance || !survey.appearance.shuffleQuestions) {\n return survey.questions\n }\n\n return reverseIfUnshuffled(survey.questions, shuffle(survey.questions))\n}\n\nexport const hasEvents = (survey: Pick<Survey, 'conditions'>): boolean => {\n return survey.conditions?.events?.values?.length != undefined && survey.conditions?.events?.values?.length > 0\n}\n\nexport const canActivateRepeatedly = (survey: Pick<Survey, 'schedule' | 'type' | 'conditions'>): boolean => {\n if (survey.schedule === SurveySchedule.Always && survey.type === SurveyType.Widget) {\n return true\n }\n\n return !!(survey.conditions?.events?.repeatedActivation && hasEvents(survey))\n}\n\n/**\n * getSurveySeen checks local storage for the surveySeen Key a\n * and overrides this value if the survey can be repeatedly activated by its events.\n * @param survey\n */\nexport const getSurveySeen = (survey: Survey): boolean => {\n const surveySeen = localStorage.getItem(getSurveySeenKey(survey))\n if (surveySeen) {\n // if a survey has already been seen,\n // we will override it with the event repeated activation value.\n return !canActivateRepeatedly(survey)\n }\n\n return false\n}\n\nexport const getSurveySeenKey = (survey: Survey): string => {\n let surveySeenKey = `${SurveySeenPrefix}${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n surveySeenKey = `${SurveySeenPrefix}${survey.id}_${survey.current_iteration}`\n }\n\n return surveySeenKey\n}\n\nexport const getSurveySeenStorageKeys = (): string[] => {\n const surveyKeys = []\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i)\n if (key?.startsWith(SurveySeenPrefix)) {\n surveyKeys.push(key)\n }\n }\n\n return surveyKeys\n}\n\nconst getSurveyInteractionProperty = (survey: Survey, action: string): string => {\n let surveyProperty = `$survey_${action}/${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n surveyProperty = `$survey_${action}/${survey.id}/${survey.current_iteration}`\n }\n\n return surveyProperty\n}\n\nexport const hasWaitPeriodPassed = (\n lastSeenSurveyDate: string | null,\n waitPeriodInDays: number | undefined\n): boolean => {\n if (!waitPeriodInDays || !lastSeenSurveyDate) {\n return true\n }\n\n const today = new Date()\n const diff = Math.abs(today.getTime() - new Date(lastSeenSurveyDate).getTime())\n const diffDaysFromToday = Math.ceil(diff / (1000 * 3600 * 24))\n return diffDaysFromToday > waitPeriodInDays\n}\n\ninterface SurveyContextProps {\n isPreviewMode: boolean\n previewPageIndex: number | undefined\n onPopupSurveyDismissed: () => void\n isPopup: boolean\n onPreviewSubmit: (res: string | string[] | number | null) => void\n}\n\nexport const SurveyContext = createContext<SurveyContextProps>({\n isPreviewMode: false,\n previewPageIndex: 0,\n onPopupSurveyDismissed: () => {},\n isPopup: true,\n onPreviewSubmit: () => {},\n})\n\ninterface RenderProps {\n component: VNode<{ className: string }>\n children: string\n renderAsHtml?: boolean\n style?: React.CSSProperties\n}\n\nexport const renderChildrenAsTextOrHtml = ({ component, children, renderAsHtml, style }: RenderProps) => {\n return renderAsHtml\n ? cloneElement(component, {\n dangerouslySetInnerHTML: { __html: children },\n style,\n })\n : cloneElement(component, {\n children,\n style,\n })\n}\n","import { getQueryParam, convertToURL, maskQueryParams } from './request-utils'\nimport { isNull } from './type-utils'\nimport { Properties } from '../types'\nimport Config from '../config'\nimport { each, extend, extendArray, stripEmptyProperties } from './index'\nimport { document, location, userAgent, window } from './globals'\nimport { detectBrowser, detectBrowserVersion, detectDevice, detectDeviceType, detectOS } from './user-agent-utils'\nimport { stripLeadingDollar } from './string-utils'\n\nconst URL_REGEX_PREFIX = 'https?://(.*)'\n\n// CAMPAIGN_PARAMS and EVENT_TO_PERSON_PROPERTIES should be kept in sync with\n// https://github.com/PostHog/posthog/blob/master/plugin-server/src/utils/db/utils.ts#L60\n\n// The list of campaign parameters that could be considered personal data under e.g. GDPR.\n// These can be masked in URLs and properties before being sent to posthog.\nexport const PERSONAL_DATA_CAMPAIGN_PARAMS = [\n 'gclid', // google ads\n 'gclsrc', // google ads 360\n 'dclid', // google display ads\n 'gbraid', // google ads, web to app\n 'wbraid', // google ads, app to web\n 'fbclid', // facebook\n 'msclkid', // microsoft\n 'twclid', // twitter\n 'li_fat_id', // linkedin\n 'igshid', // instagram\n 'ttclid', // tiktok\n 'rdt_cid', // reddit\n 'irclid', // impact\n '_kx', // klaviyo\n]\n\nexport const CAMPAIGN_PARAMS = extendArray(\n [\n 'utm_source',\n 'utm_medium',\n 'utm_campaign',\n 'utm_content',\n 'utm_term',\n 'gad_source', // google ads source\n 'mc_cid', // mailchimp campaign id\n ],\n PERSONAL_DATA_CAMPAIGN_PARAMS\n)\n\nexport const EVENT_TO_PERSON_PROPERTIES = [\n // mobile params\n '$app_build',\n '$app_name',\n '$app_namespace',\n '$app_version',\n // web params\n '$browser',\n '$browser_version',\n '$device_type',\n '$current_url',\n '$pathname',\n '$os',\n '$os_name', // $os_name is a special case, it's treated as an alias of $os!\n '$os_version',\n '$referring_domain',\n '$referrer',\n '$screen_height',\n '$screen_width',\n '$viewport_height',\n '$viewport_width',\n '$raw_user_agent',\n]\n\nexport const MASKED = '<masked>'\n\nexport const Info = {\n campaignParams: function ({\n customTrackedParams,\n maskPersonalDataProperties,\n customPersonalDataProperties,\n }: {\n customTrackedParams?: string[]\n maskPersonalDataProperties?: boolean\n customPersonalDataProperties?: string[] | undefined\n } = {}): Record<string, string> {\n if (!document) {\n return {}\n }\n\n const paramsToMask = maskPersonalDataProperties\n ? extendArray([], PERSONAL_DATA_CAMPAIGN_PARAMS, customPersonalDataProperties || [])\n : []\n\n return this._campaignParamsFromUrl(maskQueryParams(document.URL, paramsToMask, MASKED), customTrackedParams)\n },\n\n _campaignParamsFromUrl: function (url: string, customParams?: string[]): Record<string, string> {\n const campaign_keywords = CAMPAIGN_PARAMS.concat(customParams || [])\n\n const params: Record<string, any> = {}\n each(campaign_keywords, function (kwkey) {\n const kw = getQueryParam(url, kwkey)\n params[kwkey] = kw ? kw : null\n })\n\n return params\n },\n\n _searchEngine: function (referrer: string): string | null {\n if (!referrer) {\n return null\n } else {\n if (referrer.search(URL_REGEX_PREFIX + 'google.([^/?]*)') === 0) {\n return 'google'\n } else if (referrer.search(URL_REGEX_PREFIX + 'bing.com') === 0) {\n return 'bing'\n } else if (referrer.search(URL_REGEX_PREFIX + 'yahoo.com') === 0) {\n return 'yahoo'\n } else if (referrer.search(URL_REGEX_PREFIX + 'duckduckgo.com') === 0) {\n return 'duckduckgo'\n } else {\n return null\n }\n }\n },\n\n _searchInfoFromReferrer: function (referrer: string): Record<string, any> {\n const search = Info._searchEngine(referrer)\n const param = search != 'yahoo' ? 'q' : 'p'\n const ret: Record<string, any> = {}\n\n if (!isNull(search)) {\n ret['$search_engine'] = search\n\n const keyword = document ? getQueryParam(document.referrer, param) : ''\n if (keyword.length) {\n ret['ph_keyword'] = keyword\n }\n }\n\n return ret\n },\n\n searchInfo: function (): Record<string, any> {\n const referrer = document?.referrer\n if (!referrer) {\n return {}\n }\n return this._searchInfoFromReferrer(referrer)\n },\n\n /**\n * This function detects which browser is running this script.\n * The order of the checks are important since many user agents\n * include keywords used in later checks.\n */\n browser: detectBrowser,\n\n /**\n * This function detects which browser version is running this script,\n * parsing major and minor version (e.g., 42.1). User agent strings from:\n * http://www.useragentstring.com/pages/useragentstring.php\n *\n * `navigator.vendor` is passed in and used to help with detecting certain browsers\n * NB `navigator.vendor` is deprecated and not present in every browser\n */\n browserVersion: detectBrowserVersion,\n\n browserLanguage: function (): string | undefined {\n return (\n navigator.language || // Any modern browser\n (navigator as Record<string, any>).userLanguage // IE11\n )\n },\n\n browserLanguagePrefix: function (): string | undefined {\n const browserLanguage = this.browserLanguage()\n return typeof browserLanguage === 'string' ? browserLanguage.split('-')[0] : undefined\n },\n\n os: detectOS,\n\n device: detectDevice,\n\n deviceType: detectDeviceType,\n\n referrer: function (): string {\n return document?.referrer || '$direct'\n },\n\n referringDomain: function (): string {\n if (!document?.referrer) {\n return '$direct'\n }\n return convertToURL(document.referrer)?.host || '$direct'\n },\n\n referrerInfo: function (): Record<string, any> {\n return {\n $referrer: this.referrer(),\n $referring_domain: this.referringDomain(),\n }\n },\n\n personInfo: function ({\n maskPersonalDataProperties,\n customPersonalDataProperties,\n }: {\n maskPersonalDataProperties?: boolean\n customPersonalDataProperties?: string[]\n } = {}) {\n const paramsToMask = maskPersonalDataProperties\n ? extendArray([], PERSONAL_DATA_CAMPAIGN_PARAMS, customPersonalDataProperties || [])\n : []\n const url = location?.href.substring(0, 1000)\n // we're being a bit more economical with bytes here because this is stored in the cookie\n return {\n r: this.referrer().substring(0, 1000),\n u: url ? maskQueryParams(url, paramsToMask, MASKED) : undefined,\n }\n },\n\n personPropsFromInfo: function (info: Record<string, any>): Record<string, any> {\n const { r: referrer, u: url } = info\n const referring_domain =\n referrer == null ? undefined : referrer == '$direct' ? '$direct' : convertToURL(referrer)?.host\n\n const props: Record<string, string | undefined> = {\n $referrer: referrer,\n $referring_domain: referring_domain,\n }\n if (url) {\n props['$current_url'] = url\n const location = convertToURL(url)\n props['$host'] = location?.host\n props['$pathname'] = location?.pathname\n const campaignParams = this._campaignParamsFromUrl(url)\n extend(props, campaignParams)\n }\n if (referrer) {\n const searchInfo = this._searchInfoFromReferrer(referrer)\n extend(props, searchInfo)\n }\n return props\n },\n\n initialPersonPropsFromInfo: function (info: Record<string, any>): Record<string, any> {\n const personProps = this.personPropsFromInfo(info)\n const props: Record<string, any> = {}\n each(personProps, function (val: any, key: string) {\n props[`$initial_${stripLeadingDollar(key)}`] = val\n })\n return props\n },\n\n timezone: function (): string | undefined {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone\n } catch {\n return undefined\n }\n },\n\n timezoneOffset: function (): number | undefined {\n try {\n return new Date().getTimezoneOffset()\n } catch {\n return undefined\n }\n },\n\n properties: function ({\n maskPersonalDataProperties,\n customPersonalDataProperties,\n }: {\n maskPersonalDataProperties?: boolean\n customPersonalDataProperties?: string[]\n } = {}): Properties {\n if (!userAgent) {\n return {}\n }\n const paramsToMask = maskPersonalDataProperties\n ? extendArray([], PERSONAL_DATA_CAMPAIGN_PARAMS, customPersonalDataProperties || [])\n : []\n const [os_name, os_version] = Info.os(userAgent)\n return extend(\n stripEmptyProperties({\n $os: os_name,\n $os_version: os_version,\n $browser: Info.browser(userAgent, navigator.vendor),\n $device: Info.device(userAgent),\n $device_type: Info.deviceType(userAgent),\n $timezone: Info.timezone(),\n $timezone_offset: Info.timezoneOffset(),\n }),\n {\n $current_url: maskQueryParams(location?.href, paramsToMask, MASKED),\n $host: location?.host,\n $pathname: location?.pathname,\n $raw_user_agent: userAgent.length > 1000 ? userAgent.substring(0, 997) + '...' : userAgent,\n $browser_version: Info.browserVersion(userAgent, navigator.vendor),\n $browser_language: Info.browserLanguage(),\n $browser_language_prefix: Info.browserLanguagePrefix(),\n $screen_height: window?.screen.height,\n $screen_width: window?.screen.width,\n $viewport_height: window?.innerHeight,\n $viewport_width: window?.innerWidth,\n $lib: 'web',\n $lib_version: Config.LIB_VERSION,\n $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),\n $time: Date.now() / 1000, // epoch time in seconds\n }\n )\n },\n\n people_properties: function (): Properties {\n if (!userAgent) {\n return {}\n }\n\n const [os_name, os_version] = Info.os(userAgent)\n return extend(\n stripEmptyProperties({\n $os: os_name,\n $os_version: os_version,\n $browser: Info.browser(userAgent, navigator.vendor),\n }),\n {\n $browser_version: Info.browserVersion(userAgent, navigator.vendor),\n }\n )\n },\n}\n","export const isValidRegex = function (str: string): boolean {\n try {\n new RegExp(str)\n } catch {\n return false\n }\n return true\n}\n\nexport const isMatchingRegex = function (value: string, pattern: string): boolean {\n if (!isValidRegex(pattern)) return false\n\n try {\n return new RegExp(pattern).test(value)\n } catch {\n return false\n }\n}\n","export class SimpleEventEmitter {\n private events: { [key: string]: ((...args: any[]) => void)[] } = {}\n\n constructor() {\n this.events = {}\n }\n\n on(event: string, listener: (...args: any[]) => void): () => void {\n if (!this.events[event]) {\n this.events[event] = []\n }\n this.events[event].push(listener)\n\n return () => {\n this.events[event] = this.events[event].filter((x) => x !== listener)\n }\n }\n\n emit(event: string, payload: any): void {\n for (const listener of this.events[event] || []) {\n listener(payload)\n }\n for (const listener of this.events['*'] || []) {\n listener(event, payload)\n }\n }\n}\n","import { PostHog } from '../../posthog-core'\nimport { ActionStepStringMatching, ActionStepType, SurveyActionType, SurveyElement } from '../../posthog-surveys-types'\nimport { SimpleEventEmitter } from '../../utils/simple-event-emitter'\nimport { CaptureResult } from '../../types'\nimport { isUndefined } from '../../utils/type-utils'\nimport { window } from '../../utils/globals'\nimport { isMatchingRegex } from '../../utils/regex-utils'\n\nexport class ActionMatcher {\n private readonly actionRegistry?: Set<SurveyActionType>\n private readonly instance?: PostHog\n private readonly actionEvents: Set<string>\n private _debugEventEmitter = new SimpleEventEmitter()\n\n constructor(instance?: PostHog) {\n this.instance = instance\n this.actionEvents = new Set<string>()\n this.actionRegistry = new Set<SurveyActionType>()\n }\n\n init() {\n if (!isUndefined(this.instance?._addCaptureHook)) {\n const matchEventToAction = (eventName: string, eventPayload: any) => {\n this.on(eventName, eventPayload)\n }\n this.instance?._addCaptureHook(matchEventToAction)\n }\n }\n\n register(actions: SurveyActionType[]): void {\n if (isUndefined(this.instance?._addCaptureHook)) {\n return\n }\n\n actions.forEach((action) => {\n this.actionRegistry?.add(action)\n action.steps?.forEach((step) => {\n this.actionEvents?.add(step?.event || '')\n })\n })\n\n if (this.instance?.autocapture) {\n const selectorsToWatch: Set<string> = new Set<string>()\n actions.forEach((action) => {\n action.steps?.forEach((step) => {\n if (step?.selector) {\n selectorsToWatch.add(step?.selector)\n }\n })\n })\n this.instance?.autocapture.setElementSelectors(selectorsToWatch)\n }\n }\n\n on(eventName: string, eventPayload?: CaptureResult) {\n if (eventPayload == null || eventName.length == 0) {\n return\n }\n\n if (!this.actionEvents.has(eventName) && !this.actionEvents.has(<string>eventPayload?.event)) {\n return\n }\n\n if (this.actionRegistry && this.actionRegistry?.size > 0) {\n this.actionRegistry.forEach((action) => {\n if (this.checkAction(eventPayload, action)) {\n this._debugEventEmitter.emit('actionCaptured', action.name)\n }\n })\n }\n }\n\n _addActionHook(callback: (actionName: string, eventPayload?: any) => void): void {\n this.onAction('actionCaptured', (data) => callback(data))\n }\n\n private checkAction(event?: CaptureResult, action?: SurveyActionType): boolean {\n if (action?.steps == null) {\n return false\n }\n\n for (const step of action.steps) {\n if (this.checkStep(event, step)) {\n return true\n }\n }\n\n return false\n }\n\n onAction(event: 'actionCaptured', cb: (...args: any[]) => void): () => void {\n return this._debugEventEmitter.on(event, cb)\n }\n\n private checkStep = (event?: CaptureResult, step?: ActionStepType): boolean => {\n return this.checkStepEvent(event, step) && this.checkStepUrl(event, step) && this.checkStepElement(event, step)\n }\n\n private checkStepEvent = (event?: CaptureResult, step?: ActionStepType): boolean => {\n // CHECK CONDITIONS, OTHERWISE SKIPPED\n if (step?.event && event?.event !== step?.event) {\n return false // EVENT NAME IS A MISMATCH\n }\n return true\n }\n\n private checkStepUrl(event?: CaptureResult, step?: ActionStepType): boolean {\n // CHECK CONDITIONS, OTHERWISE SKIPPED\n if (step?.url) {\n const eventUrl = event?.properties?.$current_url\n if (!eventUrl || typeof eventUrl !== 'string') {\n return false // URL IS UNKNOWN\n }\n if (!ActionMatcher.matchString(eventUrl, step?.url, step?.url_matching || 'contains')) {\n return false // URL IS A MISMATCH\n }\n }\n return true\n }\n\n private static matchString(url: string, pattern: string, matching: ActionStepStringMatching): boolean {\n switch (matching) {\n case 'regex':\n return !!window && isMatchingRegex(url, pattern)\n case 'exact':\n return pattern === url\n case 'contains':\n // Simulating SQL LIKE behavior (_ = any single character, % = any zero or more characters)\n // eslint-disable-next-line no-case-declarations\n const adjustedRegExpStringPattern = ActionMatcher.escapeStringRegexp(pattern)\n .replace(/_/g, '.')\n .replace(/%/g, '.*')\n return isMatchingRegex(url, adjustedRegExpStringPattern)\n\n default:\n return false\n }\n }\n\n private static escapeStringRegexp(pattern: string): string {\n // Escape characters with special meaning either inside or outside character sets.\n // Use a simple backslash escape when it’s always valid, and a `\\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.\n return pattern.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d')\n }\n\n private checkStepElement(event?: CaptureResult, step?: ActionStepType): boolean {\n // CHECK CONDITIONS, OTHERWISE SKIPPED\n if (step?.href || step?.tag_name || step?.text) {\n const elements = this.getElementsList(event)\n if (\n !elements.some((element) => {\n if (\n step?.href &&\n !ActionMatcher.matchString(element.href || '', step?.href, step?.href_matching || 'exact')\n ) {\n return false // ELEMENT HREF IS A MISMATCH\n }\n if (step?.tag_name && element.tag_name !== step?.tag_name) {\n return false // ELEMENT TAG NAME IS A MISMATCH\n }\n if (\n step?.text &&\n !(\n ActionMatcher.matchString(element.text || '', step?.text, step?.text_matching || 'exact') ||\n ActionMatcher.matchString(\n element.$el_text || '',\n step?.text,\n step?.text_matching || 'exact'\n )\n )\n ) {\n return false // ELEMENT TEXT IS A MISMATCH\n }\n return true\n })\n ) {\n // AT LEAST ONE ELEMENT MUST BE A SUBMATCH\n return false\n }\n }\n\n if (step?.selector) {\n const elementSelectors = event?.properties?.$element_selectors as unknown as string[]\n if (!elementSelectors) {\n return false // SELECTOR IS A MISMATCH\n }\n if (!elementSelectors.includes(step?.selector)) {\n return false // SELECTOR IS A MISMATCH\n }\n }\n\n return true\n }\n\n private getElementsList(event?: CaptureResult): SurveyElement[] {\n if (event?.properties.$elements == null) {\n return []\n }\n\n return event?.properties.$elements as unknown as SurveyElement[]\n }\n}\n","import { Survey } from '../posthog-surveys-types'\nimport { SURVEYS_ACTIVATED } from '../constants'\n\nimport { CaptureResult } from '../types'\nimport { ActionMatcher } from '../extensions/surveys/action-matcher'\nimport { PostHog } from '../posthog-core'\nimport { isUndefined } from './type-utils'\n\nexport class SurveyEventReceiver {\n // eventToSurveys is a mapping of event name to all the surveys that are activated by it\n private readonly eventToSurveys: Map<string, string[]>\n // actionToSurveys is a mapping of action name to all the surveys that are activated by it\n private readonly actionToSurveys: Map<string, string[]>\n // actionMatcher can look at CaptureResult payloads and match an event to its corresponding action.\n private actionMatcher?: ActionMatcher | null\n private readonly instance?: PostHog\n private static SURVEY_SHOWN_EVENT_NAME = 'survey shown'\n\n constructor(instance: PostHog) {\n this.instance = instance\n this.eventToSurveys = new Map<string, string[]>()\n this.actionToSurveys = new Map<string, string[]>()\n }\n\n register(surveys: Survey[]): void {\n if (isUndefined(this.instance?._addCaptureHook)) {\n return\n }\n\n this.setupEventBasedSurveys(surveys)\n this.setupActionBasedSurveys(surveys)\n }\n\n private setupActionBasedSurveys(surveys: Survey[]) {\n const actionBasedSurveys = surveys.filter(\n (survey: Survey) => survey.conditions?.actions && survey.conditions?.actions?.values?.length > 0\n )\n\n if (actionBasedSurveys.length === 0) {\n return\n }\n\n if (this.actionMatcher == null) {\n this.actionMatcher = new ActionMatcher(this.instance)\n this.actionMatcher.init()\n // match any actions to its corresponding survey.\n const matchActionToSurvey = (actionName: string) => {\n this.onAction(actionName)\n }\n\n this.actionMatcher._addActionHook(matchActionToSurvey)\n }\n\n actionBasedSurveys.forEach((survey) => {\n if (\n survey.conditions &&\n survey.conditions?.actions &&\n survey.conditions?.actions?.values &&\n survey.conditions?.actions?.values?.length > 0\n ) {\n // register the known set of actions with\n // the action-matcher so it can match\n // events to actions\n this.actionMatcher?.register(survey.conditions.actions.values)\n\n // maintain a mapping of (Action1) => [Survey1, Survey2, Survey3]\n // where Surveys 1-3 are all activated by Action1\n survey.conditions?.actions?.values?.forEach((action) => {\n if (action && action.name) {\n const knownSurveys: string[] | undefined = this.actionToSurveys.get(action.name)\n if (knownSurveys) {\n knownSurveys.push(survey.id)\n }\n this.actionToSurveys.set(action.name, knownSurveys || [survey.id])\n }\n })\n }\n })\n }\n\n private setupEventBasedSurveys(surveys: Survey[]) {\n const eventBasedSurveys = surveys.filter(\n (survey: Survey) => survey.conditions?.events && survey.conditions?.events?.values?.length > 0\n )\n\n if (eventBasedSurveys.length === 0) {\n return\n }\n\n // match any events to its corresponding survey.\n const matchEventToSurvey = (eventName: string, eventPayload?: CaptureResult) => {\n this.onEvent(eventName, eventPayload)\n }\n this.instance?._addCaptureHook(matchEventToSurvey)\n\n surveys.forEach((survey) => {\n // maintain a mapping of (Event1) => [Survey1, Survey2, Survey3]\n // where Surveys 1-3 are all activated by Event1\n survey.conditions?.events?.values?.forEach((event) => {\n if (event && event.name) {\n const knownSurveys: string[] | undefined = this.eventToSurveys.get(event.name)\n if (knownSurveys) {\n knownSurveys.push(survey.id)\n }\n this.eventToSurveys.set(event.name, knownSurveys || [survey.id])\n }\n })\n })\n }\n\n onEvent(event: string, eventPayload?: CaptureResult): void {\n const existingActivatedSurveys: string[] = this.instance?.persistence?.props[SURVEYS_ACTIVATED] || []\n if (\n SurveyEventReceiver.SURVEY_SHOWN_EVENT_NAME == event &&\n eventPayload &&\n existingActivatedSurveys.length > 0\n ) {\n // remove survey that from activatedSurveys here.\n const surveyId = eventPayload?.properties?.$survey_id\n if (surveyId) {\n const index = existingActivatedSurveys.indexOf(surveyId)\n if (index >= 0) {\n existingActivatedSurveys.splice(index, 1)\n this._updateActivatedSurveys(existingActivatedSurveys)\n }\n }\n } else {\n if (this.eventToSurveys.has(event)) {\n this._updateActivatedSurveys(existingActivatedSurveys.concat(this.eventToSurveys.get(event) || []))\n }\n }\n }\n\n onAction(actionName: string): void {\n const existingActivatedSurveys: string[] = this.instance?.persistence?.props[SURVEYS_ACTIVATED] || []\n if (this.actionToSurveys.has(actionName)) {\n this._updateActivatedSurveys(existingActivatedSurveys.concat(this.actionToSurveys.get(actionName) || []))\n }\n }\n\n private _updateActivatedSurveys(activatedSurveys: string[]) {\n // we use a new Set here to remove duplicates.\n this.instance?.persistence?.register({\n [SURVEYS_ACTIVATED]: [...new Set(activatedSurveys)],\n })\n }\n\n getSurveys(): string[] {\n const existingActivatedSurveys = this.instance?.persistence?.props[SURVEYS_ACTIVATED]\n return existingActivatedSurveys ? existingActivatedSurveys : []\n }\n\n getEventToSurveys(): Map<string, string[]> {\n return this.eventToSurveys\n }\n\n _getActionMatcher(): ActionMatcher | null | undefined {\n return this.actionMatcher\n }\n}\n","import { SURVEYS } from './constants'\nimport { getSurveySeenStorageKeys } from './extensions/surveys/surveys-utils'\nimport { PostHog } from './posthog-core'\nimport { Survey, SurveyCallback, SurveyMatchType } from './posthog-surveys-types'\nimport { RemoteConfig } from './types'\nimport { Info } from './utils/event-utils'\nimport { assignableWindow, document, userAgent, window } from './utils/globals'\nimport { createLogger } from './utils/logger'\nimport { isMatchingRegex } from './utils/regex-utils'\nimport { SurveyEventReceiver } from './utils/survey-event-receiver'\nimport { isNullish } from './utils/type-utils'\n\nconst logger = createLogger('[Surveys]')\n\nexport const surveyValidationMap: Record<SurveyMatchType, (targets: string[], value: string) => boolean> = {\n icontains: (targets, value) => targets.some((target) => value.toLowerCase().includes(target.toLowerCase())),\n\n not_icontains: (targets, value) => targets.every((target) => !value.toLowerCase().includes(target.toLowerCase())),\n\n regex: (targets, value) => targets.some((target) => isMatchingRegex(value, target)),\n\n not_regex: (targets, value) => targets.every((target) => !isMatchingRegex(value, target)),\n\n exact: (targets, value) => targets.some((target) => value === target),\n\n is_not: (targets, value) => targets.every((target) => value !== target),\n}\n\nfunction defaultMatchType(matchType?: SurveyMatchType): SurveyMatchType {\n return matchType ?? 'icontains'\n}\n\n// use urlMatchType to validate url condition, fallback to contains for backwards compatibility\nexport function doesSurveyUrlMatch(survey: Pick<Survey, 'conditions'>): boolean {\n if (!survey.conditions?.url) {\n return true\n }\n // if we dont know the url, assume it is not a match\n const href = window?.location?.href\n if (!href) {\n return false\n }\n\n const targets = [survey.conditions.url]\n return surveyValidationMap[defaultMatchType(survey.conditions?.urlMatchType)](targets, href)\n}\n\nexport function doesSurveyDeviceTypesMatch(survey: Survey): boolean {\n if (!survey.conditions?.deviceTypes || survey.conditions?.deviceTypes.length === 0) {\n return true\n }\n // if we dont know the device type, assume it is not a match\n if (!userAgent) {\n return false\n }\n\n const deviceType = Info.deviceType(userAgent)\n return surveyValidationMap[defaultMatchType(survey.conditions?.deviceTypesMatchType)](\n survey.conditions.deviceTypes,\n deviceType\n )\n}\n\nexport class PostHogSurveys {\n private _decideServerResponse?: boolean\n public _surveyEventReceiver: SurveyEventReceiver | null\n private _surveyManager: any\n private _isFetchingSurveys: boolean = false\n private _isInitializingSurveys: boolean = false\n\n constructor(private readonly instance: PostHog) {\n // we set this to undefined here because we need the persistence storage for this type\n // but that's not initialized until loadIfEnabled is called.\n this._surveyEventReceiver = null\n }\n\n onRemoteConfig(response: RemoteConfig) {\n this._decideServerResponse = !!response['surveys']\n logger.info(`decideServerResponse set to ${this._decideServerResponse}`)\n\n this.loadIfEnabled()\n }\n\n reset(): void {\n localStorage.removeItem('lastSeenSurveyDate')\n const surveyKeys = getSurveySeenStorageKeys()\n surveyKeys.forEach((key) => localStorage.removeItem(key))\n }\n\n loadIfEnabled() {\n if (this._surveyManager) {\n // Surveys already loaded.\n return\n }\n\n if (this._isInitializingSurveys) {\n logger.info('Already initializing surveys, skipping...')\n return\n }\n\n const disableSurveys = this.instance.config.disable_surveys\n\n if (disableSurveys) {\n logger.info('Disabled. Not loading surveys.')\n return\n }\n\n const phExtensions = assignableWindow?.__PosthogExtensions__\n\n if (!phExtensions) {\n logger.error('PostHog Extensions not found.')\n return\n }\n\n if (!this._decideServerResponse) {\n logger.warn('Decide not loaded yet. Not loading surveys.')\n return\n }\n\n this._isInitializingSurveys = true\n\n try {\n const generateSurveys = phExtensions.generateSurveys\n\n if (!generateSurveys) {\n const loadExternalDependency = phExtensions.loadExternalDependency\n\n if (loadExternalDependency) {\n loadExternalDependency(this.instance, 'surveys', (err) => {\n if (err || !phExtensions.generateSurveys) {\n logger.error('Could not load surveys script', err)\n this._isInitializingSurveys = false\n return\n }\n\n this._surveyManager = phExtensions.generateSurveys(this.instance)\n this._isInitializingSurveys = false\n this._surveyEventReceiver = new SurveyEventReceiver(this.instance)\n logger.info('Surveys loaded successfully')\n })\n } else {\n logger.error('PostHog loadExternalDependency extension not found. Cannot load remote config.')\n this._isInitializingSurveys = false\n }\n } else {\n this._surveyManager = generateSurveys(this.instance)\n this._isInitializingSurveys = false\n this._surveyEventReceiver = new SurveyEventReceiver(this.instance)\n logger.info('Surveys loaded successfully')\n }\n } catch (e) {\n logger.error('Error initializing surveys', e)\n this._isInitializingSurveys = false\n throw e\n }\n }\n\n getSurveys(callback: SurveyCallback, forceReload = false) {\n // In case we manage to load the surveys script, but config says not to load surveys\n // then we shouldn't return survey data\n if (this.instance.config.disable_surveys) {\n logger.info('Disabled. Not loading surveys.')\n return callback([])\n }\n\n const existingSurveys = this.instance.get_property(SURVEYS)\n\n if (!existingSurveys || forceReload) {\n // Prevent concurrent API calls\n if (this._isFetchingSurveys) {\n return callback([])\n }\n\n try {\n this._isFetchingSurveys = true\n this.instance._send_request({\n url: this.instance.requestRouter.endpointFor(\n 'api',\n `/api/surveys/?token=${this.instance.config.token}`\n ),\n method: 'GET',\n timeout: this.instance.config.surveys_request_timeout_ms,\n callback: (response) => {\n this._isFetchingSurveys = false\n const statusCode = response.statusCode\n if (statusCode !== 200 || !response.json) {\n logger.error(`Surveys API could not be loaded, status: ${statusCode}`)\n return callback([])\n }\n const surveys = response.json.surveys || []\n\n const eventOrActionBasedSurveys = surveys.filter(\n (survey: Survey) =>\n (survey.conditions?.events &&\n survey.conditions?.events?.values &&\n survey.conditions?.events?.values?.length > 0) ||\n (survey.conditions?.actions &&\n survey.conditions?.actions?.values &&\n survey.conditions?.actions?.values?.length > 0)\n )\n\n if (eventOrActionBasedSurveys.length > 0) {\n this._surveyEventReceiver?.register(eventOrActionBasedSurveys)\n }\n\n this.instance.persistence?.register({ [SURVEYS]: surveys })\n return callback(surveys)\n },\n })\n } catch (e) {\n this._isFetchingSurveys = false\n throw e\n }\n } else {\n return callback(existingSurveys)\n }\n }\n\n private isSurveyFeatureFlagEnabled(flagKey: string | null) {\n if (!flagKey) {\n return true\n }\n return this.instance.featureFlags.isFeatureEnabled(flagKey)\n }\n\n getActiveMatchingSurveys(callback: SurveyCallback, forceReload = false) {\n this.getSurveys((surveys) => {\n const activeSurveys = surveys.filter((survey) => {\n return !!(survey.start_date && !survey.end_date)\n })\n\n const conditionMatchedSurveys = activeSurveys.filter((survey) => {\n if (!survey.conditions) {\n return true\n }\n\n const urlCheck = doesSurveyUrlMatch(survey)\n const selectorCheck = survey.conditions?.selector\n ? document?.querySelector(survey.conditions.selector)\n : true\n const deviceTypeCheck = doesSurveyDeviceTypesMatch(survey)\n return urlCheck && selectorCheck && deviceTypeCheck\n })\n\n // get all the surveys that have been activated so far with user actions.\n const activatedSurveys: string[] | undefined = this._surveyEventReceiver?.getSurveys()\n const targetingMatchedSurveys = conditionMatchedSurveys.filter((survey) => {\n if (\n !survey.linked_flag_key &&\n !survey.targeting_flag_key &&\n !survey.internal_targeting_flag_key &&\n !survey.feature_flag_keys?.length\n ) {\n return true\n }\n const linkedFlagCheck = this.isSurveyFeatureFlagEnabled(survey.linked_flag_key)\n const targetingFlagCheck = this.isSurveyFeatureFlagEnabled(survey.targeting_flag_key)\n\n const hasEvents = (survey.conditions?.events?.values?.length ?? 0) > 0\n const hasActions = (survey.conditions?.actions?.values?.length ?? 0) > 0\n\n const eventBasedTargetingFlagCheck =\n hasEvents || hasActions ? activatedSurveys?.includes(survey.id) : true\n\n const overrideInternalTargetingFlagCheck = this._canActivateRepeatedly(survey)\n const internalTargetingFlagCheck =\n overrideInternalTargetingFlagCheck ||\n this.isSurveyFeatureFlagEnabled(survey.internal_targeting_flag_key)\n\n const flagsCheck = this.checkFlags(survey)\n return (\n linkedFlagCheck &&\n targetingFlagCheck &&\n internalTargetingFlagCheck &&\n eventBasedTargetingFlagCheck &&\n flagsCheck\n )\n })\n\n return callback(targetingMatchedSurveys)\n }, forceReload)\n }\n\n checkFlags(survey: Survey): boolean {\n if (!survey.feature_flag_keys?.length) {\n return true\n }\n\n return survey.feature_flag_keys.every(({ key, value }) => {\n if (!key || !value) {\n return true\n }\n return this.instance.featureFlags.isFeatureEnabled(value)\n })\n }\n\n // this method is lazily loaded onto the window to avoid loading preact and other dependencies if surveys is not enabled\n private _canActivateRepeatedly(survey: Survey) {\n if (isNullish(assignableWindow.__PosthogExtensions__?.canActivateRepeatedly)) {\n logger.warn('init was not called')\n return false // TODO does it make sense to have a default here?\n }\n return assignableWindow.__PosthogExtensions__.canActivateRepeatedly(survey)\n }\n\n canRenderSurvey(surveyId: string) {\n if (isNullish(this._surveyManager)) {\n logger.warn('init was not called')\n return\n }\n this.getSurveys((surveys) => {\n const survey = surveys.filter((x) => x.id === surveyId)[0]\n this._surveyManager.canRenderSurvey(survey)\n })\n }\n\n renderSurvey(surveyId: string, selector: string) {\n if (isNullish(this._surveyManager)) {\n logger.warn('init was not called')\n return\n }\n this.getSurveys((surveys) => {\n const survey = surveys.filter((x) => x.id === surveyId)[0]\n this._surveyManager.renderSurvey(survey, document?.querySelector(selector))\n })\n }\n}\n","import{options as n}from\"preact\";var t,r,u,i,o=0,f=[],c=[],e=n.__b,a=n.__r,v=n.diffed,l=n.__c,m=n.unmount;function d(t,u){n.__h&&n.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function h(n){return o=1,s(B,n)}function s(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function p(u,i){var o=d(t++,3);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o))}function y(u,i){var o=d(t++,4);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o))}function _(n){return o=5,F(function(){return{current:n}},[])}function A(n,t,r){o=6,y(function(){return\"function\"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function q(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function x(t,r){n.useDebugValue&&n.useDebugValue(r?r(t):t)}function P(n){var u=d(t++,10),i=h();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function V(){var n=d(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__=\"P\"+i[0]+\"-\"+i[1]++}return n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[]}catch(r){t.__H.__h=[],n.__e(r,t.__v)}}n.__b=function(n){r=null,e&&e(n)},n.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[],t=0)),u=r},n.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===n.requestAnimationFrame||((i=n.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c})),u=r=null},n.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return!n.__||w(n)})}catch(u){r.some(function(n){n.__h&&(n.__h=[])}),r=[],n.__e(u,t.__v)}}),l&&l(t,r)},n.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n)}catch(n){r=n}}),u.__H=void 0,r&&n.__e(r,u.__v))};var g=\"function\"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r))}function k(n){var t=r,u=n.__c;\"function\"==typeof u&&(n.__c=void 0,u()),r=t}function w(n){var t=r;n.__c=n.__(),r=t}function z(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return\"function\"==typeof t?t(n):t}export{T as useCallback,q as useContext,x as useDebugValue,p as useEffect,P as useErrorBoundary,V as useId,A as useImperativeHandle,y as useLayoutEffect,F as useMemo,s as useReducer,_ as useRef,h as useState};\n//# sourceMappingURL=hooks.module.js.map\n","import { PostHog } from '../posthog-core'\nimport { Survey } from '../posthog-surveys-types'\nimport { document as _document } from '../utils/globals'\nimport { SURVEY_DEFAULT_Z_INDEX } from './surveys/surveys-utils'\nimport { prepareStylesheet } from './utils/stylesheet-loader'\n\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst document = _document as Document\n\nexport function createWidgetShadow(survey: Survey, posthog?: PostHog) {\n const div = document.createElement('div')\n div.className = `PostHogWidget${survey.id}`\n const shadow = div.attachShadow({ mode: 'open' })\n const widgetStyleSheet = createWidgetStyle(survey.appearance?.widgetColor)\n\n const stylesheet = prepareStylesheet(document, widgetStyleSheet, posthog)\n if (stylesheet) {\n shadow.append(stylesheet)\n }\n\n document.body.appendChild(div)\n return shadow\n}\n\nexport function createWidgetStyle(widgetColor?: string) {\n return `\n .ph-survey-widget-tab {\n position: fixed;\n top: 50%;\n right: 0;\n background: ${widgetColor || '#e0a045'};\n color: white;\n transform: rotate(-90deg) translate(0, -100%);\n transform-origin: right top;\n min-width: 40px;\n padding: 8px 12px;\n font-weight: 500;\n border-radius: 3px 3px 0 0;\n text-align: center;\n cursor: pointer;\n z-index: ${SURVEY_DEFAULT_Z_INDEX};\n }\n .ph-survey-widget-tab:hover {\n padding-bottom: 13px;\n }\n .ph-survey-widget-button {\n position: fixed;\n }\n `\n}\n","export const satisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <path d=\"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z\" />\n </svg>\n)\nexport const neutralEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <path d=\"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z\" />\n </svg>\n)\nexport const dissatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <path d=\"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z\" />\n </svg>\n)\nexport const veryDissatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <path d=\"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z\" />\n </svg>\n)\nexport const verySatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <path d=\"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z\" />\n </svg>\n)\nexport const cancelSVG = (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z\"\n fill=\"black\"\n />\n </svg>\n)\nexport const IconPosthogLogo = (\n <svg width=\"77\" height=\"14\" viewBox=\"0 0 77 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0_2415_6911)\">\n <mask\n id=\"mask0_2415_6911\"\n style={{ maskType: 'luminance' }}\n maskUnits=\"userSpaceOnUse\"\n x=\"0\"\n y=\"0\"\n width=\"77\"\n height=\"14\"\n >\n <path d=\"M0.5 0H76.5V14H0.5V0Z\" fill=\"white\" />\n </mask>\n <g mask=\"url(#mask0_2415_6911)\">\n <path\n d=\"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z\"\n fill=\"#1D4AFF\"\n />\n <path\n d=\"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z\"\n fill=\"#F9BD2B\"\n />\n <path\n d=\"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z\"\n fill=\"currentColor\"\n />\n <path\n d=\"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z\"\n fill=\"#1D4AFF\"\n />\n <path\n d=\"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z\"\n fill=\"#F54E00\"\n />\n <path\n d=\"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z\"\n fill=\"currentColor\"\n />\n </g>\n </g>\n <defs>\n <clipPath id=\"clip0_2415_6911\">\n <rect width=\"76\" height=\"14\" fill=\"white\" transform=\"translate(0.5)\" />\n </clipPath>\n </defs>\n </svg>\n)\nexport const checkSVG = (\n <svg width=\"16\" height=\"12\" viewBox=\"0 0 16 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n","import { IconPosthogLogo } from '../icons'\n// import { getContrastingTextColor } from '../surveys-utils'\n\nexport function PostHogLogo() {\n // const textColor = getContrastingTextColor(backgroundColor)\n\n return (\n <a\n href=\"https://posthog.com\"\n target=\"_blank\"\n rel=\"noopener\"\n // style={{ backgroundColor: backgroundColor, color: textColor }}\n className=\"footer-branding\"\n >\n Survey by {IconPosthogLogo}\n </a>\n )\n}\n","import { window } from '../../../utils/globals'\n\nimport { SurveyAppearance } from '../../../posthog-surveys-types'\n\nimport { useContext } from 'preact/hooks'\nimport { SurveyContext, defaultSurveyAppearance, getContrastingTextColor } from '../surveys-utils'\nimport { PostHogLogo } from './PostHogLogo'\n\nexport function BottomSection({\n text,\n submitDisabled,\n appearance,\n onSubmit,\n link,\n onPreviewSubmit,\n}: {\n text: string\n submitDisabled: boolean\n appearance: SurveyAppearance\n onSubmit: () => void\n link?: string | null\n onPreviewSubmit?: () => void\n}) {\n const { isPreviewMode, isPopup } = useContext(SurveyContext)\n const textColor =\n appearance.submitButtonTextColor ||\n getContrastingTextColor(appearance.submitButtonColor || defaultSurveyAppearance.submitButtonColor)\n return (\n <div className=\"bottom-section\">\n <div className=\"buttons\">\n <button\n className=\"form-submit\"\n disabled={submitDisabled}\n aria-label=\"Submit survey\"\n type=\"button\"\n style={isPopup ? { color: textColor } : {}}\n onClick={() => {\n if (link) {\n window?.open(link)\n }\n if (isPreviewMode) {\n onPreviewSubmit?.()\n } else {\n onSubmit()\n }\n }}\n >\n {text}\n </button>\n </div>\n {!appearance.whiteLabel && <PostHogLogo />}\n </div>\n )\n}\n","import { h } from 'preact'\nimport { useContext } from 'preact/hooks'\nimport { SurveyQuestionDescriptionContentType } from '../../../posthog-surveys-types'\nimport { cancelSVG } from '../icons'\nimport { SurveyContext, defaultSurveyAppearance, renderChildrenAsTextOrHtml } from '../surveys-utils'\n\nexport function QuestionHeader({\n question,\n description,\n descriptionContentType,\n backgroundColor,\n forceDisableHtml,\n}: {\n question: string\n description?: string | null\n descriptionContentType?: SurveyQuestionDescriptionContentType\n forceDisableHtml: boolean\n backgroundColor?: string\n}) {\n const { isPopup } = useContext(SurveyContext)\n return (\n <div style={isPopup ? { backgroundColor: backgroundColor || defaultSurveyAppearance.backgroundColor } : {}}>\n <div className=\"survey-question\">{question}</div>\n {description &&\n renderChildrenAsTextOrHtml({\n component: h('div', { className: 'survey-question-description' }),\n children: description,\n renderAsHtml: !forceDisableHtml && descriptionContentType !== 'text',\n })}\n </div>\n )\n}\n\nexport function Cancel({ onClick }: { onClick: () => void }) {\n const { isPreviewMode } = useContext(SurveyContext)\n\n return (\n <div className=\"cancel-btn-wrapper\">\n <button\n className=\"form-cancel\"\n onClick={onClick}\n disabled={isPreviewMode}\n aria-label=\"Close survey\"\n role=\"button\"\n >\n {cancelSVG}\n </button>\n </div>\n )\n}\n","import { h } from 'preact'\nimport { SurveyAppearance, SurveyQuestionDescriptionContentType } from '../../../posthog-surveys-types'\nimport { defaultSurveyAppearance, getContrastingTextColor, renderChildrenAsTextOrHtml } from '../surveys-utils'\nimport { BottomSection } from './BottomSection'\nimport { Cancel } from './QuestionHeader'\n\nimport { useContext } from 'preact/hooks'\nimport { SurveyContext } from '../../surveys/surveys-utils'\n\nexport function ConfirmationMessage({\n header,\n description,\n contentType,\n forceDisableHtml,\n appearance,\n onClose,\n styleOverrides,\n}: {\n header: string\n description: string\n forceDisableHtml: boolean\n contentType?: SurveyQuestionDescriptionContentType\n appearance: SurveyAppearance\n onClose: () => void\n styleOverrides?: React.CSSProperties\n}) {\n const textColor = getContrastingTextColor(appearance.backgroundColor || defaultSurveyAppearance.backgroundColor)\n\n const { isPopup } = useContext(SurveyContext)\n\n return (\n <div className=\"thank-you-message\" style={{ ...styleOverrides }}>\n <div className=\"thank-you-message-container\">\n {isPopup && <Cancel onClick={() => onClose()} />}\n <h3 className=\"thank-you-message-header\" style={{ color: textColor }}>\n {header}\n </h3>\n {description &&\n renderChildrenAsTextOrHtml({\n component: h('div', { className: 'thank-you-message-body' }),\n children: description,\n renderAsHtml: !forceDisableHtml && contentType !== 'text',\n style: { color: textColor },\n })}\n {isPopup && (\n <BottomSection\n text={appearance.thankYouMessageCloseButtonText || 'Close'}\n submitDisabled={false}\n appearance={appearance}\n onSubmit={() => onClose()}\n />\n )}\n </div>\n </div>\n )\n}\n","import { useEffect, useRef, useState } from 'preact/hooks'\nimport { SurveyAppearance } from '../../../posthog-surveys-types'\nimport * as Preact from 'preact'\nimport { getTextColor } from '../surveys-utils'\n\nexport function useContrastingTextColor(options: {\n appearance: SurveyAppearance\n defaultTextColor?: string\n forceUpdate?: boolean\n}): {\n ref: Preact.RefObject<HTMLElement>\n textColor: string\n} {\n const ref = useRef<HTMLElement>(null)\n const [textColor, setTextColor] = useState(options.defaultTextColor ?? 'black')\n\n // TODO: useContext to get the background colors instead of querying the DOM\n useEffect(() => {\n if (ref.current) {\n const color = getTextColor(ref.current)\n setTextColor(color)\n }\n }, [options.appearance, options.forceUpdate])\n\n return {\n ref,\n textColor,\n }\n}\n","import { RefObject } from 'preact'\nimport { useMemo, useRef, useState } from 'preact/hooks'\nimport {\n BasicSurveyQuestion,\n LinkSurveyQuestion,\n MultipleSurveyQuestion,\n RatingSurveyQuestion,\n SurveyAppearance,\n SurveyQuestionType,\n} from '../../../posthog-surveys-types'\nimport { isArray, isNull } from '../../../utils/type-utils'\nimport { useContrastingTextColor } from '../hooks/useContrastingTextColor'\nimport {\n checkSVG,\n dissatisfiedEmoji,\n neutralEmoji,\n satisfiedEmoji,\n veryDissatisfiedEmoji,\n verySatisfiedEmoji,\n} from '../icons'\nimport { getDisplayOrderChoices } from '../surveys-utils'\nimport { BottomSection } from './BottomSection'\nimport { QuestionHeader } from './QuestionHeader'\n\ninterface CommonProps {\n forceDisableHtml: boolean\n appearance: SurveyAppearance\n onSubmit: (res: string | string[] | number | null) => void\n onPreviewSubmit: (res: string | string[] | number | null) => void\n}\n\nexport function OpenTextQuestion({\n question,\n forceDisableHtml,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: CommonProps & {\n question: BasicSurveyQuestion\n}) {\n const textRef = useRef(null)\n const [text, setText] = useState('')\n\n return (\n <div ref={textRef}>\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n backgroundColor={appearance.backgroundColor}\n forceDisableHtml={forceDisableHtml}\n />\n <textarea rows={4} placeholder={appearance?.placeholder} onInput={(e) => setText(e.currentTarget.value)} />\n <BottomSection\n text={question.buttonText || 'Submit'}\n submitDisabled={!text && !question.optional}\n appearance={appearance}\n onSubmit={() => onSubmit(text)}\n onPreviewSubmit={() => onPreviewSubmit(text)}\n />\n </div>\n )\n}\n\nexport function LinkQuestion({\n question,\n forceDisableHtml,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: CommonProps & {\n question: LinkSurveyQuestion\n}) {\n return (\n <>\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n forceDisableHtml={forceDisableHtml}\n />\n <BottomSection\n text={question.buttonText || 'Submit'}\n submitDisabled={false}\n link={question.link}\n appearance={appearance}\n onSubmit={() => onSubmit('link clicked')}\n onPreviewSubmit={() => onPreviewSubmit('link clicked')}\n />\n </>\n )\n}\n\nexport function RatingQuestion({\n question,\n forceDisableHtml,\n displayQuestionIndex,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: CommonProps & {\n question: RatingSurveyQuestion\n displayQuestionIndex: number\n}) {\n const scale = question.scale\n const starting = question.scale === 10 ? 0 : 1\n const [rating, setRating] = useState<number | null>(null)\n\n return (\n <>\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n forceDisableHtml={forceDisableHtml}\n backgroundColor={appearance.backgroundColor}\n />\n <div className=\"rating-section\">\n <div className=\"rating-options\">\n {question.display === 'emoji' && (\n <div className=\"rating-options-emoji\">\n {(question.scale === 3 ? threeScaleEmojis : fiveScaleEmojis).map((emoji, idx) => {\n const active = idx + 1 === rating\n return (\n <button\n className={`ratings-emoji question-${displayQuestionIndex}-rating-${idx} ${\n active ? 'rating-active' : null\n }`}\n value={idx + 1}\n key={idx}\n type=\"button\"\n onClick={() => {\n setRating(idx + 1)\n }}\n style={{\n fill: active\n ? appearance.ratingButtonActiveColor\n : appearance.ratingButtonColor,\n borderColor: appearance.borderColor,\n }}\n >\n {emoji}\n </button>\n )\n })}\n </div>\n )}\n {question.display === 'number' && (\n <div\n className=\"rating-options-number\"\n style={{ gridTemplateColumns: `repeat(${scale - starting + 1}, minmax(0, 1fr))` }}\n >\n {getScaleNumbers(question.scale).map((number, idx) => {\n const active = rating === number\n return (\n <RatingButton\n key={idx}\n displayQuestionIndex={displayQuestionIndex}\n active={active}\n appearance={appearance}\n num={number}\n setActiveNumber={(num) => {\n setRating(num)\n }}\n />\n )\n })}\n </div>\n )}\n </div>\n <div className=\"rating-text\">\n <div>{question.lowerBoundLabel}</div>\n <div>{question.upperBoundLabel}</div>\n </div>\n </div>\n <BottomSection\n text={question.buttonText || appearance?.submitButtonText || 'Submit'}\n submitDisabled={isNull(rating) && !question.optional}\n appearance={appearance}\n onSubmit={() => onSubmit(rating)}\n onPreviewSubmit={() => onPreviewSubmit(rating)}\n />\n </>\n )\n}\n\nexport function RatingButton({\n num,\n active,\n displayQuestionIndex,\n appearance,\n setActiveNumber,\n}: {\n num: number\n active: boolean\n displayQuestionIndex: number\n appearance: SurveyAppearance\n setActiveNumber: (num: number) => void\n}) {\n const { textColor, ref } = useContrastingTextColor({ appearance, defaultTextColor: 'black', forceUpdate: active })\n return (\n <button\n ref={ref as RefObject<HTMLButtonElement>}\n className={`ratings-number question-${displayQuestionIndex}-rating-${num} ${\n active ? 'rating-active' : null\n }`}\n type=\"button\"\n onClick={() => {\n setActiveNumber(num)\n }}\n style={{\n color: textColor,\n backgroundColor: active ? appearance.ratingButtonActiveColor : appearance.ratingButtonColor,\n borderColor: appearance.borderColor,\n }}\n >\n {num}\n </button>\n )\n}\n\nexport function MultipleChoiceQuestion({\n question,\n forceDisableHtml,\n displayQuestionIndex,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: CommonProps & {\n question: MultipleSurveyQuestion\n displayQuestionIndex: number\n}) {\n const textRef = useRef(null)\n const choices = useMemo(() => getDisplayOrderChoices(question), [question])\n const [selectedChoices, setSelectedChoices] = useState<string | string[] | null>(\n question.type === SurveyQuestionType.MultipleChoice ? [] : null\n )\n const [openChoiceSelected, setOpenChoiceSelected] = useState(false)\n const [openEndedInput, setOpenEndedInput] = useState('')\n\n const inputType = question.type === SurveyQuestionType.SingleChoice ? 'radio' : 'checkbox'\n return (\n <div ref={textRef}>\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n forceDisableHtml={forceDisableHtml}\n backgroundColor={appearance.backgroundColor}\n />\n <div className=\"multiple-choice-options limit-height\">\n {/* Remove the last element from the choices, if hasOpenChoice is set */}\n {/* shuffle all other options here if question.shuffleOptions is set */}\n {/* Always ensure that the open ended choice is the last option */}\n {choices.map((choice: string, idx: number) => {\n let choiceClass = 'choice-option'\n const val = choice\n const option = choice\n if (!!question.hasOpenChoice && idx === question.choices.length - 1) {\n choiceClass += ' choice-option-open'\n }\n return (\n <div className={choiceClass}>\n <input\n type={inputType}\n id={`surveyQuestion${displayQuestionIndex}Choice${idx}`}\n name={`question${displayQuestionIndex}`}\n value={val}\n disabled={!val}\n onInput={() => {\n if (question.hasOpenChoice && idx === question.choices.length - 1) {\n return setOpenChoiceSelected(!openChoiceSelected)\n }\n if (question.type === SurveyQuestionType.SingleChoice) {\n return setSelectedChoices(val)\n }\n if (\n question.type === SurveyQuestionType.MultipleChoice &&\n isArray(selectedChoices)\n ) {\n if (selectedChoices.includes(val)) {\n // filter out values because clicking on a selected choice should deselect it\n return setSelectedChoices(\n selectedChoices.filter((choice) => choice !== val)\n )\n }\n return setSelectedChoices([...selectedChoices, val])\n }\n }}\n />\n <label\n htmlFor={`surveyQuestion${displayQuestionIndex}Choice${idx}`}\n style={{ color: 'black' }}\n >\n {question.hasOpenChoice && idx === question.choices.length - 1 ? (\n <>\n <span>{option}:</span>\n <input\n type=\"text\"\n id={`surveyQuestion${displayQuestionIndex}Choice${idx}Open`}\n name={`question${displayQuestionIndex}`}\n onInput={(e) => {\n const userValue = e.currentTarget.value\n if (question.type === SurveyQuestionType.SingleChoice) {\n return setSelectedChoices(userValue)\n }\n if (\n question.type === SurveyQuestionType.MultipleChoice &&\n isArray(selectedChoices)\n ) {\n return setOpenEndedInput(userValue)\n }\n }}\n />\n </>\n ) : (\n option\n )}\n </label>\n <span className=\"choice-check\" style={{ color: 'black' }}>\n {checkSVG}\n </span>\n </div>\n )\n })}\n </div>\n <BottomSection\n text={question.buttonText || 'Submit'}\n submitDisabled={\n (isNull(selectedChoices) ||\n (isArray(selectedChoices) && !openChoiceSelected && selectedChoices.length === 0) ||\n (isArray(selectedChoices) &&\n openChoiceSelected &&\n !openEndedInput &&\n selectedChoices.length === 0 &&\n !question.optional)) &&\n !question.optional\n }\n appearance={appearance}\n onSubmit={() => {\n if (openChoiceSelected && question.type === SurveyQuestionType.MultipleChoice) {\n if (isArray(selectedChoices)) {\n onSubmit([...selectedChoices, openEndedInput])\n }\n } else {\n onSubmit(selectedChoices)\n }\n }}\n onPreviewSubmit={() => {\n if (openChoiceSelected && question.type === SurveyQuestionType.MultipleChoice) {\n if (isArray(selectedChoices)) {\n onPreviewSubmit([...selectedChoices, openEndedInput])\n }\n } else {\n onPreviewSubmit(selectedChoices)\n }\n }}\n />\n </div>\n )\n}\n\nconst threeScaleEmojis = [dissatisfiedEmoji, neutralEmoji, satisfiedEmoji]\nconst fiveScaleEmojis = [veryDissatisfiedEmoji, dissatisfiedEmoji, neutralEmoji, satisfiedEmoji, verySatisfiedEmoji]\nconst fiveScaleNumbers = [1, 2, 3, 4, 5]\nconst sevenScaleNumbers = [1, 2, 3, 4, 5, 6, 7]\nconst tenScaleNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\nfunction getScaleNumbers(scale: number): number[] {\n switch (scale) {\n case 5:\n return fiveScaleNumbers\n case 7:\n return sevenScaleNumbers\n case 10:\n return tenScaleNumbers\n default:\n return fiveScaleNumbers\n }\n}\n","import { PostHog } from '../posthog-core'\nimport { doesSurveyUrlMatch } from '../posthog-surveys'\nimport {\n Survey,\n SurveyAppearance,\n SurveyQuestion,\n SurveyQuestionBranchingType,\n SurveyQuestionType,\n SurveyRenderReason,\n SurveyType,\n} from '../posthog-surveys-types'\n\nimport * as Preact from 'preact'\nimport { useContext, useEffect, useMemo, useRef, useState } from 'preact/hooks'\nimport { addEventListener } from '../utils'\nimport { document as _document, window as _window } from '../utils/globals'\nimport { createLogger } from '../utils/logger'\nimport { isNull, isNumber } from '../utils/type-utils'\nimport { createWidgetShadow, createWidgetStyle } from './surveys-widget'\nimport { ConfirmationMessage } from './surveys/components/ConfirmationMessage'\nimport { Cancel } from './surveys/components/QuestionHeader'\nimport {\n LinkQuestion,\n MultipleChoiceQuestion,\n OpenTextQuestion,\n RatingQuestion,\n} from './surveys/components/QuestionTypes'\nimport {\n createShadow,\n defaultSurveyAppearance,\n dismissedSurveyEvent,\n getContrastingTextColor,\n getDisplayOrderQuestions,\n getSurveyResponseKey,\n getSurveySeen,\n hasWaitPeriodPassed,\n sendSurveyEvent,\n style,\n SURVEY_DEFAULT_Z_INDEX,\n SurveyContext,\n} from './surveys/surveys-utils'\nimport { prepareStylesheet } from './utils/stylesheet-loader'\nconst logger = createLogger('[Surveys]')\n\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst window = _window as Window & typeof globalThis\nconst document = _document as Document\n\nfunction getPosthogWidgetClass(surveyId: string) {\n return `.PostHogWidget${surveyId}`\n}\n\nfunction getRatingBucketForResponseValue(responseValue: number, scale: number) {\n if (scale === 3) {\n if (responseValue < 1 || responseValue > 3) {\n throw new Error('The response must be in range 1-3')\n }\n\n return responseValue === 1 ? 'negative' : responseValue === 2 ? 'neutral' : 'positive'\n } else if (scale === 5) {\n if (responseValue < 1 || responseValue > 5) {\n throw new Error('The response must be in range 1-5')\n }\n\n return responseValue <= 2 ? 'negative' : responseValue === 3 ? 'neutral' : 'positive'\n } else if (scale === 7) {\n if (responseValue < 1 || responseValue > 7) {\n throw new Error('The response must be in range 1-7')\n }\n\n return responseValue <= 3 ? 'negative' : responseValue === 4 ? 'neutral' : 'positive'\n } else if (scale === 10) {\n if (responseValue < 0 || responseValue > 10) {\n throw new Error('The response must be in range 0-10')\n }\n\n return responseValue <= 6 ? 'detractors' : responseValue <= 8 ? 'passives' : 'promoters'\n }\n\n throw new Error('The scale must be one of: 3, 5, 7, 10')\n}\n\nexport function getNextSurveyStep(\n survey: Survey,\n currentQuestionIndex: number,\n response: string | string[] | number | null\n) {\n const question = survey.questions[currentQuestionIndex]\n const nextQuestionIndex = currentQuestionIndex + 1\n\n if (!question.branching?.type) {\n if (currentQuestionIndex === survey.questions.length - 1) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n\n if (question.branching.type === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n } else if (question.branching.type === SurveyQuestionBranchingType.SpecificQuestion) {\n if (Number.isInteger(question.branching.index)) {\n return question.branching.index\n }\n } else if (question.branching.type === SurveyQuestionBranchingType.ResponseBased) {\n // Single choice\n if (question.type === SurveyQuestionType.SingleChoice) {\n // :KLUDGE: for now, look up the choiceIndex based on the response\n // TODO: once QuestionTypes.MultipleChoiceQuestion is refactored, pass the selected choiceIndex into this method\n const selectedChoiceIndex = question.choices.indexOf(`${response}`)\n\n if (question.branching?.responseValues?.hasOwnProperty(selectedChoiceIndex)) {\n const nextStep = question.branching.responseValues[selectedChoiceIndex]\n\n // Specific question\n if (Number.isInteger(nextStep)) {\n return nextStep\n }\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n } else if (question.type === SurveyQuestionType.Rating) {\n if (typeof response !== 'number' || !Number.isInteger(response)) {\n throw new Error('The response type must be an integer')\n }\n\n const ratingBucket = getRatingBucketForResponseValue(response, question.scale)\n\n if (question.branching?.responseValues?.hasOwnProperty(ratingBucket)) {\n const nextStep = question.branching.responseValues[ratingBucket]\n\n // Specific question\n if (Number.isInteger(nextStep)) {\n return nextStep\n }\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n }\n\n return nextQuestionIndex\n }\n\n logger.warn('Falling back to next question index due to unexpected branching type')\n return nextQuestionIndex\n}\n\nexport class SurveyManager {\n private posthog: PostHog\n private surveyInFocus: string | null\n private surveyTimeouts: Map<string, NodeJS.Timeout> = new Map()\n\n constructor(posthog: PostHog) {\n this.posthog = posthog\n // This is used to track the survey that is currently in focus. We only show one survey at a time.\n this.surveyInFocus = null\n }\n\n private canShowNextEventBasedSurvey = (): boolean => {\n // with event based surveys, we need to show the next survey without reloading the page.\n // A simple check for div elements with the class name pattern of PostHogSurvey_xyz doesn't work here\n // because preact leaves behind the div element for any surveys responded/dismissed with a <style> node.\n // To alleviate this, we check the last div in the dom and see if it has any elements other than a Style node.\n // if the last PostHogSurvey_xyz div has only one style node, we can show the next survey in the queue\n // without reloading the page.\n const surveyPopups = document.querySelectorAll(`div[class^=PostHogSurvey]`)\n if (surveyPopups.length > 0) {\n return surveyPopups[surveyPopups.length - 1].shadowRoot?.childElementCount === 1\n }\n return true\n }\n\n private clearSurveyTimeout(surveyId: string) {\n const timeout = this.surveyTimeouts.get(surveyId)\n if (timeout) {\n clearTimeout(timeout)\n this.surveyTimeouts.delete(surveyId)\n }\n }\n\n private handlePopoverSurvey = (survey: Survey): void => {\n const surveyWaitPeriodInDays = survey.conditions?.seenSurveyWaitPeriodInDays\n const lastSeenSurveyDate = localStorage.getItem(`lastSeenSurveyDate`)\n\n if (!hasWaitPeriodPassed(lastSeenSurveyDate, surveyWaitPeriodInDays)) {\n return\n }\n\n const surveySeen = getSurveySeen(survey)\n if (!surveySeen) {\n this.clearSurveyTimeout(survey.id)\n this.addSurveyToFocus(survey.id)\n const delaySeconds = survey.appearance?.surveyPopupDelaySeconds || 0\n const shadow = createShadow(style(survey?.appearance), survey.id, undefined, this.posthog)\n if (delaySeconds <= 0) {\n return Preact.render(\n <SurveyPopup\n key={'popover-survey'}\n posthog={this.posthog}\n survey={survey}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n isPopup={true}\n />,\n shadow\n )\n }\n const timeoutId = setTimeout(() => {\n if (!doesSurveyUrlMatch(survey)) {\n return this.removeSurveyFromFocus(survey.id)\n }\n // rendering with surveyPopupDelaySeconds = 0 because we're already handling the timeout here\n Preact.render(\n <SurveyPopup\n key={'popover-survey'}\n posthog={this.posthog}\n survey={{ ...survey, appearance: { ...survey.appearance, surveyPopupDelaySeconds: 0 } }}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n isPopup={true}\n />,\n shadow\n )\n }, delaySeconds * 1000)\n this.surveyTimeouts.set(survey.id, timeoutId)\n }\n }\n\n private handleWidget = (survey: Survey): void => {\n const shadow = createWidgetShadow(survey, this.posthog)\n\n const stylesheetContent = style(survey.appearance)\n const stylesheet = prepareStylesheet(document, stylesheetContent, this.posthog)\n\n if (stylesheet) {\n shadow.appendChild(stylesheet)\n }\n\n Preact.render(\n <FeedbackWidget\n key={'feedback-survey'}\n posthog={this.posthog}\n survey={survey}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n />,\n shadow\n )\n }\n\n private handleWidgetSelector = (survey: Survey): void => {\n const selectorOnPage =\n survey.appearance?.widgetSelector && document.querySelector(survey.appearance.widgetSelector)\n if (selectorOnPage) {\n if (document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 0) {\n this.handleWidget(survey)\n } else if (document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 1) {\n // we have to check if user selector already has a survey listener attached to it because we always have to check if it's on the page or not\n if (!selectorOnPage.getAttribute('PHWidgetSurveyClickListener')) {\n const surveyPopup = document\n .querySelector(getPosthogWidgetClass(survey.id))\n ?.shadowRoot?.querySelector(`.survey-form`) as HTMLFormElement\n\n addEventListener(selectorOnPage, 'click', () => {\n if (surveyPopup) {\n surveyPopup.style.display = surveyPopup.style.display === 'none' ? 'block' : 'none'\n addEventListener(surveyPopup, 'PHSurveyClosed', () => {\n this.removeSurveyFromFocus(survey.id)\n surveyPopup.style.display = 'none'\n })\n }\n })\n\n selectorOnPage.setAttribute('PHWidgetSurveyClickListener', 'true')\n }\n }\n }\n }\n\n /**\n * Sorts surveys by their appearance delay in ascending order. If a survey does not have an appearance delay,\n * it is considered to have a delay of 0.\n * @param surveys\n * @returns The surveys sorted by their appearance delay\n */\n private sortSurveysByAppearanceDelay(surveys: Survey[]): Survey[] {\n return surveys.sort(\n (a, b) => (a.appearance?.surveyPopupDelaySeconds || 0) - (b.appearance?.surveyPopupDelaySeconds || 0)\n )\n }\n\n /**\n * Checks the feature flags associated with this Survey to see if the survey can be rendered.\n * @param survey\n * @param instance\n */\n public canRenderSurvey = (survey: Survey): SurveyRenderReason => {\n const renderReason: SurveyRenderReason = {\n visible: false,\n }\n\n if (survey.end_date) {\n renderReason.disabledReason = `survey was completed on ${survey.end_date}`\n return renderReason\n }\n\n if (survey.type != SurveyType.Popover) {\n renderReason.disabledReason = `Only Popover survey types can be rendered`\n return renderReason\n }\n\n const linkedFlagCheck = survey.linked_flag_key\n ? this.posthog.featureFlags.isFeatureEnabled(survey.linked_flag_key)\n : true\n\n if (!linkedFlagCheck) {\n renderReason.disabledReason = `linked feature flag ${survey.linked_flag_key} is false`\n return renderReason\n }\n\n const targetingFlagCheck = survey.targeting_flag_key\n ? this.posthog.featureFlags.isFeatureEnabled(survey.targeting_flag_key)\n : true\n\n if (!targetingFlagCheck) {\n renderReason.disabledReason = `targeting feature flag ${survey.targeting_flag_key} is false`\n return renderReason\n }\n\n const internalTargetingFlagCheck = survey.internal_targeting_flag_key\n ? this.posthog.featureFlags.isFeatureEnabled(survey.internal_targeting_flag_key)\n : true\n\n if (!internalTargetingFlagCheck) {\n renderReason.disabledReason = `internal targeting feature flag ${survey.internal_targeting_flag_key} is false`\n return renderReason\n }\n\n renderReason.visible = true\n return renderReason\n }\n\n public renderSurvey = (survey: Survey, selector: Element): void => {\n Preact.render(\n <SurveyPopup\n key={'popover-survey'}\n posthog={this.posthog}\n survey={survey}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n isPopup={false}\n />,\n selector\n )\n }\n\n public callSurveysAndEvaluateDisplayLogic = (forceReload: boolean = false): void => {\n this.posthog?.getActiveMatchingSurveys((surveys) => {\n const nonAPISurveys = surveys.filter((survey) => survey.type !== 'api')\n\n // Create a queue of surveys sorted by their appearance delay. We will evaluate the display logic\n // for each survey in the queue in order, and only display one survey at a time.\n const nonAPISurveyQueue = this.sortSurveysByAppearanceDelay(nonAPISurveys)\n\n nonAPISurveyQueue.forEach((survey) => {\n // We only evaluate the display logic for one survey at a time\n if (!isNull(this.surveyInFocus)) {\n return\n }\n if (survey.type === SurveyType.Widget) {\n if (\n survey.appearance?.widgetType === 'tab' &&\n document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 0\n ) {\n this.handleWidget(survey)\n }\n if (survey.appearance?.widgetType === 'selector' && survey.appearance?.widgetSelector) {\n this.handleWidgetSelector(survey)\n }\n }\n\n if (survey.type === SurveyType.Popover && this.canShowNextEventBasedSurvey()) {\n this.handlePopoverSurvey(survey)\n }\n })\n }, forceReload)\n }\n\n private addSurveyToFocus = (id: string): void => {\n if (!isNull(this.surveyInFocus)) {\n logger.error(`Survey ${[...this.surveyInFocus]} already in focus. Cannot add survey ${id}.`)\n }\n this.surveyInFocus = id\n }\n\n private removeSurveyFromFocus = (id: string): void => {\n if (this.surveyInFocus !== id) {\n logger.error(`Survey ${id} is not in focus. Cannot remove survey ${id}.`)\n }\n this.clearSurveyTimeout(id)\n this.surveyInFocus = null\n }\n\n // Expose internal state and methods for testing\n public getTestAPI() {\n return {\n addSurveyToFocus: this.addSurveyToFocus,\n removeSurveyFromFocus: this.removeSurveyFromFocus,\n surveyInFocus: this.surveyInFocus,\n surveyTimeouts: this.surveyTimeouts,\n canShowNextEventBasedSurvey: this.canShowNextEventBasedSurvey,\n handleWidget: this.handleWidget,\n handlePopoverSurvey: this.handlePopoverSurvey,\n handleWidgetSelector: this.handleWidgetSelector,\n sortSurveysByAppearanceDelay: this.sortSurveysByAppearanceDelay,\n }\n }\n}\n\nexport const renderSurveysPreview = ({\n survey,\n parentElement,\n previewPageIndex,\n forceDisableHtml,\n onPreviewSubmit,\n posthog,\n}: {\n survey: Survey\n parentElement: HTMLElement\n previewPageIndex: number\n forceDisableHtml?: boolean\n onPreviewSubmit?: (res: string | string[] | number | null) => void\n posthog?: PostHog\n}) => {\n const stylesheetContent = style(survey.appearance)\n const stylesheet = prepareStylesheet(document, stylesheetContent, posthog)\n\n // Remove previously attached <style>\n Array.from(parentElement.children).forEach((child) => {\n if (child instanceof HTMLStyleElement) {\n parentElement.removeChild(child)\n }\n })\n\n if (stylesheet) {\n parentElement.appendChild(stylesheet)\n }\n\n const textColor = getContrastingTextColor(\n survey.appearance?.backgroundColor || defaultSurveyAppearance.backgroundColor || 'white'\n )\n\n Preact.render(\n <SurveyPopup\n key=\"surveys-render-preview\"\n survey={survey}\n forceDisableHtml={forceDisableHtml}\n style={{\n position: 'relative',\n right: 0,\n borderBottom: `1px solid ${survey.appearance?.borderColor}`,\n borderRadius: 10,\n color: textColor,\n }}\n onPreviewSubmit={onPreviewSubmit}\n previewPageIndex={previewPageIndex}\n removeSurveyFromFocus={() => {}}\n isPopup={true}\n />,\n parentElement\n )\n}\n\nexport const renderFeedbackWidgetPreview = ({\n survey,\n root,\n forceDisableHtml,\n posthog,\n}: {\n survey: Survey\n root: HTMLElement\n forceDisableHtml?: boolean\n posthog?: PostHog\n}) => {\n const stylesheetContent = createWidgetStyle(survey.appearance?.widgetColor)\n const stylesheet = prepareStylesheet(document, stylesheetContent, posthog)\n if (stylesheet) {\n root.appendChild(stylesheet)\n }\n\n Preact.render(\n <FeedbackWidget\n key={'feedback-render-preview'}\n forceDisableHtml={forceDisableHtml}\n survey={survey}\n readOnly={true}\n removeSurveyFromFocus={() => {}}\n />,\n root\n )\n}\n\n// This is the main exported function\nexport function generateSurveys(posthog: PostHog) {\n // NOTE: Important to ensure we never try and run surveys without a window environment\n if (!document || !window) {\n return\n }\n\n const surveyManager = new SurveyManager(posthog)\n surveyManager.callSurveysAndEvaluateDisplayLogic(true)\n\n // recalculate surveys every second to check if URL or selectors have changed\n setInterval(() => {\n surveyManager.callSurveysAndEvaluateDisplayLogic(false)\n }, 1000)\n return surveyManager\n}\n\ntype UseHideSurveyOnURLChangeProps = {\n survey: Pick<Survey, 'id' | 'conditions'>\n removeSurveyFromFocus: (id: string) => void\n setSurveyVisible: (visible: boolean) => void\n isPreviewMode?: boolean\n}\n\n/**\n * This hook handles URL-based survey visibility after the initial mount.\n * The initial URL check is handled by the `getActiveMatchingSurveys` method in the `PostHogSurveys` class,\n * which ensures the URL matches before displaying a survey for the first time.\n * That is the method that is called every second to see if there's a matching survey.\n *\n * This separation of concerns means:\n * 1. Initial URL matching is done by `getActiveMatchingSurveys` before displaying the survey\n * 2. Subsequent URL changes are handled here to hide the survey as the user navigates\n */\nexport function useHideSurveyOnURLChange({\n survey,\n removeSurveyFromFocus,\n setSurveyVisible,\n isPreviewMode = false,\n}: UseHideSurveyOnURLChangeProps) {\n useEffect(() => {\n if (isPreviewMode || !survey.conditions?.url) {\n return\n }\n\n const checkUrlMatch = () => {\n const urlCheck = doesSurveyUrlMatch(survey)\n if (!urlCheck) {\n setSurveyVisible(false)\n return removeSurveyFromFocus(survey.id)\n }\n }\n\n // Listen for browser back/forward browser history changes\n addEventListener(window, 'popstate', checkUrlMatch)\n // Listen for hash changes, for SPA frameworks that use hash-based routing\n // The hashchange event is fired when the fragment identifier of the URL has changed (the part of the URL beginning with and following the # symbol).\n addEventListener(window, 'hashchange', checkUrlMatch)\n\n // Listen for SPA navigation\n const originalPushState = window.history.pushState\n const originalReplaceState = window.history.replaceState\n\n window.history.pushState = function (...args) {\n originalPushState.apply(this, args)\n checkUrlMatch()\n }\n\n window.history.replaceState = function (...args) {\n originalReplaceState.apply(this, args)\n checkUrlMatch()\n }\n\n return () => {\n window.removeEventListener('popstate', checkUrlMatch)\n window.removeEventListener('hashchange', checkUrlMatch)\n window.history.pushState = originalPushState\n window.history.replaceState = originalReplaceState\n }\n }, [isPreviewMode, survey, removeSurveyFromFocus, setSurveyVisible])\n}\n\nexport function usePopupVisibility(\n survey: Survey,\n posthog: PostHog | undefined,\n millisecondDelay: number,\n isPreviewMode: boolean,\n removeSurveyFromFocus: (id: string) => void\n) {\n const [isPopupVisible, setIsPopupVisible] = useState(isPreviewMode || millisecondDelay === 0)\n const [isSurveySent, setIsSurveySent] = useState(false)\n\n useEffect(() => {\n if (!posthog) {\n logger.error('usePopupVisibility hook called without a PostHog instance.')\n return\n }\n if (isPreviewMode) {\n return\n }\n\n const handleSurveyClosed = () => {\n removeSurveyFromFocus(survey.id)\n setIsPopupVisible(false)\n }\n\n const handleSurveySent = () => {\n if (!survey.appearance?.displayThankYouMessage) {\n removeSurveyFromFocus(survey.id)\n setIsPopupVisible(false)\n } else {\n setIsSurveySent(true)\n removeSurveyFromFocus(survey.id)\n if (survey.appearance?.autoDisappear) {\n setTimeout(() => {\n setIsPopupVisible(false)\n }, 5000)\n }\n }\n }\n\n const showSurvey = () => {\n // check if the url is still matching, necessary for delayed surveys, as the URL may have changed\n if (!doesSurveyUrlMatch(survey)) {\n return\n }\n\n setIsPopupVisible(true)\n window.dispatchEvent(new Event('PHSurveyShown'))\n posthog.capture('survey shown', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n $survey_iteration: survey.current_iteration,\n $survey_iteration_start_date: survey.current_iteration_start_date,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n })\n localStorage.setItem('lastSeenSurveyDate', new Date().toISOString())\n setTimeout(() => {\n const inputField = document\n .querySelector(getPosthogWidgetClass(survey.id))\n ?.shadowRoot?.querySelector('textarea, input[type=\"text\"]') as HTMLElement\n if (inputField) {\n inputField.focus()\n }\n }, 100)\n }\n\n addEventListener(window, 'PHSurveyClosed', handleSurveyClosed)\n addEventListener(window, 'PHSurveySent', handleSurveySent)\n\n if (millisecondDelay > 0) {\n // This path is only used for direct usage of SurveyPopup,\n // not for surveys managed by SurveyManager\n const timeoutId = setTimeout(showSurvey, millisecondDelay)\n return () => {\n clearTimeout(timeoutId)\n window.removeEventListener('PHSurveyClosed', handleSurveyClosed)\n window.removeEventListener('PHSurveySent', handleSurveySent)\n }\n } else {\n // This is the path used for surveys managed by SurveyManager\n showSurvey()\n return () => {\n window.removeEventListener('PHSurveyClosed', handleSurveyClosed)\n window.removeEventListener('PHSurveySent', handleSurveySent)\n }\n }\n }, [])\n\n useHideSurveyOnURLChange({\n survey,\n removeSurveyFromFocus,\n setSurveyVisible: setIsPopupVisible,\n isPreviewMode,\n })\n\n return { isPopupVisible, isSurveySent, setIsPopupVisible }\n}\n\ninterface SurveyPopupProps {\n survey: Survey\n forceDisableHtml?: boolean\n posthog?: PostHog\n style?: React.CSSProperties\n previewPageIndex?: number | undefined\n removeSurveyFromFocus: (id: string) => void\n isPopup?: boolean\n onPreviewSubmit?: (res: string | string[] | number | null) => void\n onPopupSurveyDismissed?: () => void\n onCloseConfirmationMessage?: () => void\n}\n\nexport function SurveyPopup({\n survey,\n forceDisableHtml,\n posthog,\n style,\n previewPageIndex,\n removeSurveyFromFocus,\n isPopup,\n onPreviewSubmit = () => {},\n onPopupSurveyDismissed = () => {},\n onCloseConfirmationMessage = () => {},\n}: SurveyPopupProps) {\n const isPreviewMode = Number.isInteger(previewPageIndex)\n // NB: The client-side code passes the millisecondDelay in seconds, but setTimeout expects milliseconds, so we multiply by 1000\n const surveyPopupDelayMilliseconds = survey.appearance?.surveyPopupDelaySeconds\n ? survey.appearance.surveyPopupDelaySeconds * 1000\n : 0\n const { isPopupVisible, isSurveySent, setIsPopupVisible } = usePopupVisibility(\n survey,\n posthog,\n surveyPopupDelayMilliseconds,\n isPreviewMode,\n removeSurveyFromFocus\n )\n const shouldShowConfirmation = isSurveySent || previewPageIndex === survey.questions.length\n const confirmationBoxLeftStyle = style?.left && isNumber(style?.left) ? { left: style.left - 40 } : {}\n\n if (isPreviewMode) {\n style = style || {}\n style.left = 'unset'\n style.right = 'unset'\n style.transform = 'unset'\n }\n\n return isPopupVisible ? (\n <SurveyContext.Provider\n value={{\n isPreviewMode,\n previewPageIndex: previewPageIndex,\n onPopupSurveyDismissed: () => {\n dismissedSurveyEvent(survey, posthog, isPreviewMode)\n onPopupSurveyDismissed()\n },\n isPopup: isPopup || false,\n onPreviewSubmit,\n }}\n >\n {!shouldShowConfirmation ? (\n <Questions\n survey={survey}\n forceDisableHtml={!!forceDisableHtml}\n posthog={posthog}\n styleOverrides={style}\n />\n ) : (\n <ConfirmationMessage\n header={survey.appearance?.thankYouMessageHeader || 'Thank you!'}\n description={survey.appearance?.thankYouMessageDescription || ''}\n forceDisableHtml={!!forceDisableHtml}\n contentType={survey.appearance?.thankYouMessageDescriptionContentType}\n appearance={survey.appearance || defaultSurveyAppearance}\n styleOverrides={{ ...style, ...confirmationBoxLeftStyle }}\n onClose={() => {\n setIsPopupVisible(false)\n onCloseConfirmationMessage()\n }}\n />\n )}\n </SurveyContext.Provider>\n ) : null\n}\n\nexport function Questions({\n survey,\n forceDisableHtml,\n posthog,\n styleOverrides,\n}: {\n survey: Survey\n forceDisableHtml: boolean\n posthog?: PostHog\n styleOverrides?: React.CSSProperties\n}) {\n const textColor = getContrastingTextColor(\n survey.appearance?.backgroundColor || defaultSurveyAppearance.backgroundColor\n )\n const [questionsResponses, setQuestionsResponses] = useState({})\n const { previewPageIndex, onPopupSurveyDismissed, isPopup, onPreviewSubmit } = useContext(SurveyContext)\n const [currentQuestionIndex, setCurrentQuestionIndex] = useState(previewPageIndex || 0)\n const surveyQuestions = useMemo(() => getDisplayOrderQuestions(survey), [survey])\n\n // Sync preview state\n useEffect(() => {\n setCurrentQuestionIndex(previewPageIndex ?? 0)\n }, [previewPageIndex])\n\n const onNextButtonClick = ({\n res,\n displayQuestionIndex,\n questionId,\n }: {\n res: string | string[] | number | null\n displayQuestionIndex: number\n questionId?: string\n }) => {\n if (!posthog) {\n logger.error('onNextButtonClick called without a PostHog instance.')\n return\n }\n\n if (!questionId) {\n logger.error('onNextButtonClick called without a questionId.')\n return\n }\n\n const responseKey = getSurveyResponseKey(questionId)\n\n setQuestionsResponses({ ...questionsResponses, [responseKey]: res })\n\n const nextStep = getNextSurveyStep(survey, displayQuestionIndex, res)\n if (nextStep === SurveyQuestionBranchingType.End) {\n sendSurveyEvent({ ...questionsResponses, [responseKey]: res }, survey, posthog)\n } else {\n setCurrentQuestionIndex(nextStep)\n }\n }\n\n return (\n <form\n className=\"survey-form\"\n style={\n isPopup\n ? {\n color: textColor,\n borderColor: survey.appearance?.borderColor,\n ...styleOverrides,\n }\n : {}\n }\n >\n {surveyQuestions.map((question, displayQuestionIndex) => {\n const isVisible = currentQuestionIndex === displayQuestionIndex\n return (\n isVisible && (\n <div\n className=\"survey-box\"\n style={\n isPopup\n ? {\n backgroundColor:\n survey.appearance?.backgroundColor ||\n defaultSurveyAppearance.backgroundColor,\n }\n : {}\n }\n >\n {isPopup && (\n <Cancel\n onClick={() => {\n onPopupSurveyDismissed()\n }}\n />\n )}\n {getQuestionComponent({\n question,\n forceDisableHtml,\n displayQuestionIndex,\n appearance: survey.appearance || defaultSurveyAppearance,\n onSubmit: (res) =>\n onNextButtonClick({\n res,\n displayQuestionIndex,\n questionId: question.id,\n }),\n onPreviewSubmit,\n })}\n </div>\n )\n )\n })}\n </form>\n )\n}\n\nexport function FeedbackWidget({\n survey,\n forceDisableHtml,\n posthog,\n readOnly,\n removeSurveyFromFocus,\n}: {\n survey: Survey\n forceDisableHtml?: boolean\n posthog?: PostHog\n readOnly?: boolean\n removeSurveyFromFocus: (id: string) => void\n}): JSX.Element | null {\n const [isFeedbackButtonVisible, setIsFeedbackButtonVisible] = useState(true)\n const [showSurvey, setShowSurvey] = useState(false)\n const [styleOverrides, setStyle] = useState({})\n const widgetRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!posthog) {\n logger.error('FeedbackWidget called without a PostHog instance.')\n return\n }\n if (readOnly) {\n return\n }\n\n if (survey.appearance?.widgetType === 'tab') {\n if (widgetRef.current) {\n const widgetPos = widgetRef.current.getBoundingClientRect()\n const style = {\n top: '50%',\n left: parseInt(`${widgetPos.right - 360}`),\n bottom: 'auto',\n borderRadius: 10,\n borderBottom: `1.5px solid ${survey.appearance?.borderColor || '#c9c6c6'}`,\n }\n setStyle(style)\n }\n }\n if (survey.appearance?.widgetType === 'selector') {\n const widget = document.querySelector(survey.appearance.widgetSelector || '') ?? undefined\n\n addEventListener(widget, 'click', (event) => {\n // Calculate position based on the selector button\n const buttonRect = (event.currentTarget as HTMLElement).getBoundingClientRect()\n const viewportHeight = window.innerHeight\n\n // Get survey width from maxWidth or default to 300px\n const surveyWidth = parseInt(survey.appearance?.maxWidth || '300')\n\n // Calculate horizontal center position of the button\n const buttonCenterX = buttonRect.left + buttonRect.width / 2\n\n // Calculate horizontal center position\n let left = buttonCenterX - surveyWidth / 2\n\n // Ensure the survey doesn't go off-screen horizontally\n const rightEdge = left + surveyWidth\n if (rightEdge > window.innerWidth) {\n left = window.innerWidth - surveyWidth - 20 // 20px padding from right edge\n }\n if (left < 20) {\n left = 20 // 20px padding from left edge\n }\n\n // Determine if we should show above or below\n let showAbove = false\n\n // Check if there's enough space below (need at least 300px)\n // If not enough space below, show above\n if (buttonRect.bottom + 300 > viewportHeight) {\n showAbove = true\n }\n\n // Simple spacing between button and survey\n const spacing = 12\n\n // Calculate positions\n let topPosition\n\n if (showAbove) {\n // Problem: When showing above, we're trying to position based on an estimated height,\n // but we don't know the actual height of the survey yet.\n // Solution: Instead of using top positioning for above, use bottom positioning\n // This will anchor the survey to the bottom edge at the button's top position\n topPosition = null // We'll use bottom positioning instead\n } else {\n // When showing below, position the top of the survey below the button plus spacing\n topPosition = buttonRect.bottom + window.scrollY + spacing\n }\n\n // Set style overrides for positioning\n setStyle({\n position: 'fixed',\n top: showAbove ? 'auto' : topPosition + 'px',\n left: left + 'px',\n right: 'auto',\n bottom: showAbove ? window.innerHeight - buttonRect.top + spacing + 'px' : 'auto',\n transform: 'none',\n border: `1.5px solid ${survey.appearance?.borderColor || '#c9c6c6'}`,\n borderRadius: '10px',\n width: `${surveyWidth}px`,\n zIndex: SURVEY_DEFAULT_Z_INDEX,\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n maxHeight: showAbove\n ? `calc(100vh - 40px - ${spacing * 2}px)`\n : `calc(100vh - ${topPosition}px - 20px)`,\n })\n\n setShowSurvey(!showSurvey)\n })\n\n widget?.setAttribute('PHWidgetSurveyClickListener', 'true')\n }\n }, [])\n\n useHideSurveyOnURLChange({\n survey,\n removeSurveyFromFocus,\n setSurveyVisible: setIsFeedbackButtonVisible,\n })\n\n if (!isFeedbackButtonVisible) {\n return null\n }\n\n const resetShowSurvey = () => {\n setShowSurvey(false)\n }\n\n return (\n <Preact.Fragment>\n {survey.appearance?.widgetType === 'tab' && (\n <div\n className=\"ph-survey-widget-tab\"\n ref={widgetRef}\n onClick={() => !readOnly && setShowSurvey(!showSurvey)}\n style={{ color: getContrastingTextColor(survey.appearance.widgetColor) }}\n >\n <div className=\"ph-survey-widget-tab-icon\"></div>\n {survey.appearance?.widgetLabel || ''}\n </div>\n )}\n {showSurvey && (\n <SurveyPopup\n key={'feedback-widget-survey'}\n posthog={posthog}\n survey={survey}\n forceDisableHtml={forceDisableHtml}\n style={styleOverrides}\n removeSurveyFromFocus={removeSurveyFromFocus}\n isPopup={true}\n onPopupSurveyDismissed={resetShowSurvey}\n onCloseConfirmationMessage={resetShowSurvey}\n />\n )}\n </Preact.Fragment>\n )\n}\n\ninterface GetQuestionComponentProps {\n question: SurveyQuestion\n forceDisableHtml: boolean\n displayQuestionIndex: number\n appearance: SurveyAppearance\n onSubmit: (res: string | string[] | number | null) => void\n onPreviewSubmit: (res: string | string[] | number | null) => void\n}\n\nconst getQuestionComponent = ({\n question,\n forceDisableHtml,\n displayQuestionIndex,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: GetQuestionComponentProps): JSX.Element => {\n const questionComponents = {\n [SurveyQuestionType.Open]: OpenTextQuestion,\n [SurveyQuestionType.Link]: LinkQuestion,\n [SurveyQuestionType.Rating]: RatingQuestion,\n [SurveyQuestionType.SingleChoice]: MultipleChoiceQuestion,\n [SurveyQuestionType.MultipleChoice]: MultipleChoiceQuestion,\n }\n\n const commonProps = {\n question,\n forceDisableHtml,\n appearance,\n onPreviewSubmit: (res: string | string[] | number | null) => {\n onPreviewSubmit(res)\n },\n onSubmit: (res: string | string[] | number | null) => {\n onSubmit(res)\n },\n }\n\n const additionalProps: Record<SurveyQuestionType, any> = {\n [SurveyQuestionType.Open]: {},\n [SurveyQuestionType.Link]: {},\n [SurveyQuestionType.Rating]: { displayQuestionIndex },\n [SurveyQuestionType.SingleChoice]: { displayQuestionIndex },\n [SurveyQuestionType.MultipleChoice]: { displayQuestionIndex },\n }\n\n const Component = questionComponents[question.type]\n const componentProps = { ...commonProps, ...additionalProps[question.type] }\n\n return <Component {...componentProps} />\n}\n","import { isFunction, isNull, isObject, isUndefined } from '../../utils/type-utils'\n\nexport function isEvent(candidate: unknown): candidate is Event {\n return !isUndefined(Event) && isInstanceOf(candidate, Event)\n}\n\nexport function isPlainObject(candidate: unknown): candidate is Record<string, unknown> {\n return isBuiltin(candidate, 'Object')\n}\n\nexport function isInstanceOf(candidate: unknown, base: any): boolean {\n try {\n return candidate instanceof base\n } catch {\n return false\n }\n}\n\nexport function isPrimitive(\n candidate: unknown\n): candidate is number | string | boolean | bigint | symbol | null | undefined {\n return isNull(candidate) || (!isObject(candidate) && !isFunction(candidate))\n}\n\nexport function isError(candidate: unknown): candidate is Error {\n switch (Object.prototype.toString.call(candidate)) {\n case '[object Error]':\n case '[object Exception]':\n case '[object DOMException]':\n case '[object DOMError]':\n return true\n default:\n return isInstanceOf(candidate, Error)\n }\n}\n\nexport function isErrorEvent(event: string | Error | Event): event is ErrorEvent {\n return isBuiltin(event, 'ErrorEvent')\n}\n\nexport function isErrorWithStack(candidate: unknown): candidate is Error {\n return 'stack' in (candidate as Error)\n}\n\nexport function isBuiltin(candidate: unknown, className: string): boolean {\n return Object.prototype.toString.call(candidate) === `[object ${className}]`\n}\n\nexport function isDOMException(candidate: unknown): boolean {\n return isBuiltin(candidate, 'DOMException')\n}\n\nexport function isDOMError(candidate: unknown): boolean {\n return isBuiltin(candidate, 'DOMError')\n}\n","import { generateSurveys } from '../extensions/surveys'\n\nimport { assignableWindow } from '../utils/globals'\nimport { canActivateRepeatedly } from '../extensions/surveys/surveys-utils'\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.canActivateRepeatedly = canActivateRepeatedly\nassignableWindow.__PosthogExtensions__.generateSurveys = generateSurveys\n\n// this used to be directly on window, but we moved it to __PosthogExtensions__\n// it is still on window for backwards compatibility\nassignableWindow.extendPostHogWithSurveys = generateSurveys\n\nexport default generateSurveys\n","// copied and adapted from https://github.com/getsentry/sentry-javascript/blob/41fef4b10f3a644179b77985f00f8696c908539f/packages/browser/src/stack-parsers.ts\n// 💖open source\n\n// This was originally forked from https://github.com/csnover/TraceKit, and was largely\n// re-written as part of raven - js.\n//\n// This code was later copied to the JavaScript mono - repo and further modified and\n// refactored over the years.\n\n// Copyright (c) 2013 Onur Can Cakmak onur.cakmak@gmail.com and all TraceKit contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this\n// software and associated documentation files(the 'Software'), to deal in the Software\n// without restriction, including without limitation the rights to use, copy, modify,\n// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to the following\n// conditions:\n//\n// The above copyright notice and this permission notice shall be included in all copies\n// or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE\n// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nimport { isUndefined } from '../../utils/type-utils'\n\nexport type StackParser = (stack: string, skipFirstLines?: number) => StackFrame[]\nexport type StackLineParserFn = (line: string) => StackFrame | undefined\nexport type StackLineParser = [number, StackLineParserFn]\n\nexport interface StackFrame {\n platform: string\n filename?: string\n function?: string\n module?: string\n lineno?: number\n colno?: number\n abs_path?: string\n context_line?: string\n pre_context?: string[]\n post_context?: string[]\n in_app?: boolean\n instruction_addr?: string\n addr_mode?: string\n vars?: { [key: string]: any }\n chunk_id?: string\n}\n\nconst WEBPACK_ERROR_REGEXP = /\\(error: (.*)\\)/\nconst STACKTRACE_FRAME_LIMIT = 50\n\nconst UNKNOWN_FUNCTION = '?'\n\nconst OPERA10_PRIORITY = 10\nconst OPERA11_PRIORITY = 20\nconst CHROME_PRIORITY = 30\nconst WINJS_PRIORITY = 40\nconst GECKO_PRIORITY = 50\n\nfunction createFrame(filename: string, func: string, lineno?: number, colno?: number): StackFrame {\n const frame: StackFrame = {\n platform: 'web:javascript',\n filename,\n function: func === '<anonymous>' ? UNKNOWN_FUNCTION : func,\n in_app: true, // All browser frames are considered in_app\n }\n\n if (!isUndefined(lineno)) {\n frame.lineno = lineno\n }\n\n if (!isUndefined(colno)) {\n frame.colno = colno\n }\n\n return frame\n}\n\n// This regex matches frames that have no function name (ie. are at the top level of a module).\n// For example \"at http://localhost:5000//script.js:1:126\"\n// Frames _with_ function names usually look as follows: \"at commitLayoutEffects (react-dom.development.js:23426:1)\"\nconst chromeRegexNoFnName = /^\\s*at (\\S+?)(?::(\\d+))(?::(\\d+))\\s*$/i\n\n// This regex matches all the frames that have a function name.\nconst chromeRegex =\n /^\\s*at (?:(.+?\\)(?: \\[.+\\])?|.*?) ?\\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\\/)?.*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i\n\nconst chromeEvalRegex = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/\n\n// Chromium based browsers: Chrome, Brave, new Opera, new Edge\n// We cannot call this variable `chrome` because it can conflict with global `chrome` variable in certain environments\n// See: https://github.com/getsentry/sentry-javascript/issues/6880\nconst chromeStackParserFn: StackLineParserFn = (line) => {\n // If the stack line has no function name, we need to parse it differently\n const noFnParts = chromeRegexNoFnName.exec(line) as null | [string, string, string, string]\n\n if (noFnParts) {\n const [, filename, line, col] = noFnParts\n return createFrame(filename, UNKNOWN_FUNCTION, +line, +col)\n }\n\n const parts = chromeRegex.exec(line) as null | [string, string, string, string, string]\n\n if (parts) {\n const isEval = parts[2] && parts[2].indexOf('eval') === 0 // start of line\n\n if (isEval) {\n const subMatch = chromeEvalRegex.exec(parts[2]) as null | [string, string, string, string]\n\n if (subMatch) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = subMatch[1] // url\n parts[3] = subMatch[2] // line\n parts[4] = subMatch[3] // column\n }\n }\n\n // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now\n // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)\n const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2])\n\n return createFrame(filename, func, parts[3] ? +parts[3] : undefined, parts[4] ? +parts[4] : undefined)\n }\n\n return\n}\n\nexport const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chromeStackParserFn]\n\n// gecko regex: `(?:bundle|\\d+\\.js)`: `bundle` is for react native, `\\d+\\.js` also but specifically for ram bundles because it\n// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js\n// We need this specific case for now because we want no other regex to match.\nconst geckoREgex =\n /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)?((?:[-a-z]+)?:\\/.*?|\\[native code\\]|[^@]*(?:bundle|\\d+\\.js)|\\/[\\w\\-. /=]+)(?::(\\d+))?(?::(\\d+))?\\s*$/i\nconst geckoEvalRegex = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i\n\nconst gecko: StackLineParserFn = (line) => {\n const parts = geckoREgex.exec(line) as null | [string, string, string, string, string, string]\n\n if (parts) {\n const isEval = parts[3] && parts[3].indexOf(' > eval') > -1\n if (isEval) {\n const subMatch = geckoEvalRegex.exec(parts[3]) as null | [string, string, string]\n\n if (subMatch) {\n // throw out eval line/column and use top-most line number\n parts[1] = parts[1] || 'eval'\n parts[3] = subMatch[1]\n parts[4] = subMatch[2]\n parts[5] = '' // no column when eval\n }\n }\n\n let filename = parts[3]\n let func = parts[1] || UNKNOWN_FUNCTION\n ;[func, filename] = extractSafariExtensionDetails(func, filename)\n\n return createFrame(filename, func, parts[4] ? +parts[4] : undefined, parts[5] ? +parts[5] : undefined)\n }\n\n return\n}\n\nexport const geckoStackLineParser: StackLineParser = [GECKO_PRIORITY, gecko]\n\nconst winjsRegex = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:[-a-z]+):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i\n\nconst winjs: StackLineParserFn = (line) => {\n const parts = winjsRegex.exec(line) as null | [string, string, string, string, string]\n\n return parts\n ? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)\n : undefined\n}\n\nexport const winjsStackLineParser: StackLineParser = [WINJS_PRIORITY, winjs]\n\nconst opera10Regex = / line (\\d+).*script (?:in )?(\\S+)(?:: in function (\\S+))?$/i\n\nconst opera10: StackLineParserFn = (line) => {\n const parts = opera10Regex.exec(line) as null | [string, string, string, string]\n return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined\n}\n\nexport const opera10StackLineParser: StackLineParser = [OPERA10_PRIORITY, opera10]\n\nconst opera11Regex = / line (\\d+), column (\\d+)\\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\\(.*\\))? in (.*):\\s*$/i\n\nconst opera11: StackLineParserFn = (line) => {\n const parts = opera11Regex.exec(line) as null | [string, string, string, string, string, string]\n return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined\n}\n\nexport const opera11StackLineParser: StackLineParser = [OPERA11_PRIORITY, opera11]\n\nexport const defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser]\n\nexport const defaultStackParser = createStackParser(...defaultStackLineParsers)\n\nexport function reverseAndStripFrames(stack: ReadonlyArray<StackFrame>): StackFrame[] {\n if (!stack.length) {\n return []\n }\n\n const localStack = Array.from(stack)\n\n localStack.reverse()\n\n return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map((frame) => ({\n ...frame,\n filename: frame.filename || getLastStackFrame(localStack).filename,\n function: frame.function || UNKNOWN_FUNCTION,\n }))\n}\n\nfunction getLastStackFrame(arr: StackFrame[]): StackFrame {\n return arr[arr.length - 1] || {}\n}\n\nexport function createStackParser(...parsers: StackLineParser[]): StackParser {\n const sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map((p) => p[1])\n\n return (stack: string, skipFirstLines: number = 0): StackFrame[] => {\n const frames: StackFrame[] = []\n const lines = stack.split('\\n')\n\n for (let i = skipFirstLines; i < lines.length; i++) {\n const line = lines[i] as string\n // Ignore lines over 1kb as they are unlikely to be stack frames.\n // Many of the regular expressions use backtracking which results in run time that increases exponentially with\n // input size. Huge strings can result in hangs/Denial of Service:\n // https://github.com/getsentry/sentry-javascript/issues/2286\n if (line.length > 1024) {\n continue\n }\n\n // https://github.com/getsentry/sentry-javascript/issues/5459\n // Remove webpack (error: *) wrappers\n const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, '$1') : line\n\n // https://github.com/getsentry/sentry-javascript/issues/7813\n // Skip Error: lines\n if (cleanedLine.match(/\\S*Error: /)) {\n continue\n }\n\n for (const parser of sortedParsers) {\n const frame = parser(cleanedLine)\n if (frame) {\n frames.push(frame)\n break\n }\n }\n\n if (frames.length >= STACKTRACE_FRAME_LIMIT) {\n break\n }\n }\n\n return reverseAndStripFrames(frames)\n }\n}\n\n/**\n * Safari web extensions, starting version unknown, can produce \"frames-only\" stacktraces.\n * What it means, is that instead of format like:\n *\n * Error: wat\n * at function@url:row:col\n * at function@url:row:col\n * at function@url:row:col\n *\n * it produces something like:\n *\n * function@url:row:col\n * function@url:row:col\n * function@url:row:col\n *\n * Because of that, it won't be captured by `chrome` RegExp and will fall into `Gecko` branch.\n * This function is extracted so that we can use it in both places without duplicating the logic.\n * Unfortunately \"just\" changing RegExp is too complicated now and making it pass all tests\n * and fix this case seems like an impossible, or at least way too time-consuming task.\n */\nconst extractSafariExtensionDetails = (func: string, filename: string): [string, string] => {\n const isSafariExtension = func.indexOf('safari-extension') !== -1\n const isSafariWebExtension = func.indexOf('safari-web-extension') !== -1\n\n return isSafariExtension || isSafariWebExtension\n ? [\n func.indexOf('@') !== -1 ? (func.split('@')[0] as string) : UNKNOWN_FUNCTION,\n isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`,\n ]\n : [func, filename]\n}\n","import type { StackParser } from './stack-trace'\n\ntype StackString = string\ntype CachedResult = [string, string]\n\ntype ChunkIdMapType = Record<string, string>\n\nlet parsedStackResults: Record<StackString, CachedResult> | undefined\nlet lastKeysCount: number | undefined\nlet cachedFilenameChunkIds: ChunkIdMapType | undefined\n\nexport function getFilenameToChunkIdMap(stackParser: StackParser): ChunkIdMapType {\n const chunkIdMap = (globalThis as any)._posthogChunkIds as ChunkIdMapType | undefined\n if (!chunkIdMap) {\n return {}\n }\n\n const chunkIdKeys = Object.keys(chunkIdMap)\n\n if (cachedFilenameChunkIds && chunkIdKeys.length === lastKeysCount) {\n return cachedFilenameChunkIds\n }\n\n lastKeysCount = chunkIdKeys.length\n\n cachedFilenameChunkIds = chunkIdKeys.reduce<Record<string, string>>((acc, stackKey) => {\n if (!parsedStackResults) {\n parsedStackResults = {}\n }\n\n const result = parsedStackResults[stackKey]\n\n if (result) {\n acc[result[0]] = result[1]\n } else {\n const parsedStack = stackParser(stackKey)\n\n for (let i = parsedStack.length - 1; i >= 0; i--) {\n const stackFrame = parsedStack[i]\n const filename = stackFrame?.filename\n const chunkId = chunkIdMap[stackKey]\n\n if (filename && chunkId) {\n acc[filename] = chunkId\n parsedStackResults[stackKey] = [filename, chunkId]\n break\n }\n }\n }\n\n return acc\n }, {})\n\n return cachedFilenameChunkIds\n}\n","import {\n isDOMError,\n isDOMException,\n isError,\n isErrorEvent,\n isErrorWithStack,\n isEvent,\n isPlainObject,\n isPrimitive,\n} from './type-checking'\nimport { defaultStackParser, StackFrame, StackParser } from './stack-trace'\n\nimport { isEmptyString, isString, isUndefined } from '../../utils/type-utils'\nimport { ErrorConversionArgs, ErrorEventArgs, ErrorMetadata, SeverityLevel, severityLevels } from '../../types'\nimport { getFilenameToChunkIdMap } from './chunk-ids'\n\nexport interface ErrorProperties {\n $exception_list: Exception[]\n $exception_level?: SeverityLevel\n $exception_DOMException_code?: string\n $exception_personURL?: string\n}\n\nexport interface Exception {\n type?: string\n value?: string\n mechanism?: {\n /**\n * In theory, whether or not the exception has been handled by the user. In practice, whether or not we see it before\n * it hits the global error/rejection handlers, whether through explicit handling by the user or auto instrumentation.\n */\n handled?: boolean\n type?: string\n source?: string\n /**\n * True when `captureException` is called with anything other than an instance of `Error` (or, in the case of browser,\n * an instance of `ErrorEvent`, `DOMError`, or `DOMException`). causing us to create a synthetic error in an attempt\n * to recreate the stacktrace.\n */\n synthetic?: boolean\n }\n module?: string\n thread_id?: number\n stacktrace?: {\n frames?: StackFrame[]\n type: 'raw'\n }\n}\n\nexport interface ErrorConversions {\n errorToProperties: (args: ErrorEventArgs, metadata?: ErrorMetadata) => ErrorProperties\n unhandledRejectionToProperties: (args: [ev: PromiseRejectionEvent]) => ErrorProperties\n}\n/**\n * based on the very wonderful MIT licensed Sentry SDK\n */\n\nconst ERROR_TYPES_PATTERN =\n /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i\n\nexport function parseStackFrames(ex: Error & { stacktrace?: string }, framesToPop: number = 0): StackFrame[] {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace || ex.stack || ''\n\n const skipLines = getSkipFirstStackStringLines(ex)\n\n try {\n const parser = defaultStackParser\n const frames = applyChunkIds(parser(stacktrace, skipLines), parser)\n // frames are reversed so we remove the from the back of the array\n return frames.slice(0, frames.length - framesToPop)\n } catch {\n // no-empty\n }\n\n return []\n}\n\nexport function applyChunkIds(frames: StackFrame[], parser: StackParser): StackFrame[] {\n const filenameDebugIdMap = getFilenameToChunkIdMap(parser)\n\n frames.forEach((frame) => {\n if (frame.filename) {\n frame.chunk_id = filenameDebugIdMap[frame.filename]\n }\n })\n\n return frames\n}\n\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i\n\n/**\n * Certain known React errors contain links that would be falsely\n * parsed as frames. This function check for these errors and\n * returns number of the stack string lines to skip.\n */\nfunction getSkipFirstStackStringLines(ex: Error): number {\n if (ex && reactMinifiedRegexp.test(ex.message)) {\n return 1\n }\n\n return 0\n}\n\nfunction errorPropertiesFromError(error: Error, metadata?: ErrorMetadata): ErrorProperties {\n const frames = parseStackFrames(error)\n\n const handled = metadata?.handled ?? true\n const synthetic = metadata?.synthetic ?? false\n\n const exceptionType = metadata?.overrideExceptionType ? metadata.overrideExceptionType : error.name\n const exceptionMessage = metadata?.overrideExceptionMessage\n ? metadata.overrideExceptionMessage\n : extractMessage(error)\n\n return {\n $exception_list: [\n {\n type: exceptionType,\n value: exceptionMessage,\n stacktrace: {\n frames,\n type: 'raw',\n },\n mechanism: {\n handled,\n synthetic,\n },\n },\n ],\n $exception_level: 'error',\n }\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\nexport function extractMessage(err: Error & { message: { error?: Error } }): string {\n const message = err.message\n\n if (message.error && typeof message.error.message === 'string') {\n return message.error.message\n }\n\n return message\n}\n\nfunction errorPropertiesFromString(candidate: string, metadata?: ErrorMetadata): ErrorProperties {\n // Defaults for metadata are based on what the error candidate is.\n const handled = metadata?.handled ?? true\n const synthetic = metadata?.synthetic ?? true\n\n const exceptionType = metadata?.overrideExceptionType\n ? metadata.overrideExceptionType\n : (metadata?.defaultExceptionType ?? 'Error')\n const exceptionMessage = metadata?.overrideExceptionMessage\n ? metadata.overrideExceptionMessage\n : candidate\n ? candidate\n : metadata?.defaultExceptionMessage\n\n const exception: Exception = {\n type: exceptionType,\n value: exceptionMessage,\n mechanism: {\n handled,\n synthetic,\n },\n }\n\n if (metadata?.syntheticException) {\n // Kludge: strip the last frame from a synthetically created error\n // so that it does not appear in a users stack trace\n const frames = parseStackFrames(metadata.syntheticException, 1)\n if (frames.length) {\n exception.stacktrace = { frames, type: 'raw' }\n }\n }\n\n return {\n $exception_list: [exception],\n $exception_level: 'error',\n }\n}\n\n/**\n * Given any captured exception, extract its keys and create a sorted\n * and truncated list that will be used inside the event message.\n * eg. `Non-error exception captured with keys: foo, bar, baz`\n */\nfunction extractExceptionKeysForMessage(exception: Record<string, unknown>, maxLength = 40): string {\n const keys = Object.keys(exception)\n keys.sort()\n\n if (!keys.length) {\n return '[object has no keys]'\n }\n\n for (let i = keys.length; i > 0; i--) {\n const serialized = keys.slice(0, i).join(', ')\n if (serialized.length > maxLength) {\n continue\n }\n if (i === keys.length) {\n return serialized\n }\n return serialized.length <= maxLength ? serialized : `${serialized.slice(0, maxLength)}...`\n }\n\n return ''\n}\n\nfunction isSeverityLevel(x: unknown): x is SeverityLevel {\n return isString(x) && !isEmptyString(x) && severityLevels.indexOf(x as SeverityLevel) >= 0\n}\n\nfunction errorPropertiesFromObject(candidate: Record<string, unknown>, metadata?: ErrorMetadata): ErrorProperties {\n // Defaults for metadata are based on what the error candidate is.\n const handled = metadata?.handled ?? true\n const synthetic = metadata?.synthetic ?? true\n\n const exceptionType = metadata?.overrideExceptionType\n ? metadata.overrideExceptionType\n : isEvent(candidate)\n ? candidate.constructor.name\n : 'Error'\n const exceptionMessage = metadata?.overrideExceptionMessage\n ? metadata.overrideExceptionMessage\n : `Non-Error ${'exception'} captured with keys: ${extractExceptionKeysForMessage(candidate)}`\n\n const exception: Exception = {\n type: exceptionType,\n value: exceptionMessage,\n mechanism: {\n handled,\n synthetic,\n },\n }\n\n if (metadata?.syntheticException) {\n // Kludge: strip the last frame from a synthetically created error\n // so that it does not appear in a users stack trace\n const frames = parseStackFrames(metadata?.syntheticException, 1)\n if (frames.length) {\n exception.stacktrace = { frames, type: 'raw' }\n }\n }\n\n return {\n $exception_list: [exception],\n $exception_level: isSeverityLevel(candidate.level) ? candidate.level : 'error',\n }\n}\n\nexport function errorToProperties({ error, event }: ErrorConversionArgs, metadata?: ErrorMetadata): ErrorProperties {\n let errorProperties: ErrorProperties = { $exception_list: [] }\n\n const candidate = error || event\n\n if (isDOMError(candidate) || isDOMException(candidate)) {\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n\n const domException = candidate as unknown as DOMException\n\n if (isErrorWithStack(candidate)) {\n errorProperties = errorPropertiesFromError(candidate as Error, metadata)\n } else {\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException')\n const message = domException.message ? `${name}: ${domException.message}` : name\n const exceptionType = isDOMError(domException) ? 'DOMError' : 'DOMException'\n errorProperties = errorPropertiesFromString(message, {\n ...metadata,\n overrideExceptionType: exceptionType,\n defaultExceptionMessage: message,\n })\n }\n if ('code' in domException) {\n errorProperties['$exception_DOMException_code'] = `${domException.code}`\n }\n return errorProperties\n } else if (isErrorEvent(candidate as ErrorEvent) && (candidate as ErrorEvent).error) {\n return errorPropertiesFromError((candidate as ErrorEvent).error as Error, metadata)\n } else if (isError(candidate)) {\n return errorPropertiesFromError(candidate, metadata)\n } else if (isPlainObject(candidate) || isEvent(candidate)) {\n // group these by using the keys available on the object\n const objectException = candidate as Record<string, unknown>\n return errorPropertiesFromObject(objectException, metadata)\n } else if (isUndefined(error) && isString(event)) {\n let name = 'Error'\n let message = event\n const groups = event.match(ERROR_TYPES_PATTERN)\n if (groups) {\n name = groups[1]\n message = groups[2]\n }\n\n return errorPropertiesFromString(message, {\n ...metadata,\n overrideExceptionType: name,\n defaultExceptionMessage: message,\n })\n } else {\n return errorPropertiesFromString(candidate as string, metadata)\n }\n}\n\nexport function unhandledRejectionToProperties([ev]: [ev: PromiseRejectionEvent]): ErrorProperties {\n const error = getUnhandledRejectionError(ev)\n\n if (isPrimitive(error)) {\n return errorPropertiesFromString(`Non-Error promise rejection captured with value: ${String(error)}`, {\n handled: false,\n synthetic: false,\n overrideExceptionType: 'UnhandledRejection',\n })\n }\n\n return errorToProperties(\n { event: error as string | Event },\n {\n handled: false,\n overrideExceptionType: 'UnhandledRejection',\n defaultExceptionMessage: String(error),\n }\n )\n}\n\nfunction getUnhandledRejectionError(error: unknown): unknown {\n if (isPrimitive(error)) {\n return error\n }\n\n // dig the object of the rejection out of known event types\n try {\n type ErrorWithReason = { reason: unknown }\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in (error as ErrorWithReason)) {\n return (error as ErrorWithReason).reason\n }\n\n type CustomEventWithDetail = { detail: { reason: unknown } }\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n if ('detail' in (error as CustomEventWithDetail) && 'reason' in (error as CustomEventWithDetail).detail) {\n return (error as CustomEventWithDetail).detail.reason\n }\n } catch {\n // no-empty\n }\n\n return error\n}\n","import { errorToProperties, unhandledRejectionToProperties } from '../extensions/exception-autocapture/error-conversion'\nimport { assignableWindow, window } from '../utils/globals'\nimport { ErrorEventArgs, Properties } from '../types'\nimport { createLogger } from '../utils/logger'\n\nconst logger = createLogger('[ExceptionAutocapture]')\n\nconst wrapOnError = (captureFn: (props: Properties) => void) => {\n const win = window as any\n if (!win) {\n logger.info('window not available, cannot wrap onerror')\n }\n const originalOnError = win.onerror\n\n win.onerror = function (...args: ErrorEventArgs): boolean {\n const errorProperties = errorToProperties({ event: args[0], error: args[4] })\n captureFn(errorProperties)\n return originalOnError?.(...args) ?? false\n }\n win.onerror.__POSTHOG_INSTRUMENTED__ = true\n\n return () => {\n delete win.onerror?.__POSTHOG_INSTRUMENTED__\n win.onerror = originalOnError\n }\n}\n\nconst wrapUnhandledRejection = (captureFn: (props: Properties) => void) => {\n const win = window as any\n if (!win) {\n logger.info('window not available, cannot wrap onUnhandledRejection')\n }\n\n const originalOnUnhandledRejection = win.onunhandledrejection\n\n win.onunhandledrejection = function (...args: [ev: PromiseRejectionEvent]): boolean {\n const errorProperties = unhandledRejectionToProperties(args)\n captureFn(errorProperties)\n return originalOnUnhandledRejection?.apply(win, args) ?? false\n }\n win.onunhandledrejection.__POSTHOG_INSTRUMENTED__ = true\n\n return () => {\n delete win.onunhandledrejection?.__POSTHOG_INSTRUMENTED__\n win.onunhandledrejection = originalOnUnhandledRejection\n }\n}\n\nconst posthogErrorWrappingFunctions = {\n wrapOnError,\n wrapUnhandledRejection,\n}\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.errorWrappingFunctions = posthogErrorWrappingFunctions\nassignableWindow.__PosthogExtensions__.parseErrorAsProperties = errorToProperties\n\n// we used to put these on window, and now we put them on __PosthogExtensions__\n// but that means that old clients which lazily load this extension are looking in the wrong place\n// yuck,\n// so we also put them directly on the window\n// when 1.161.1 is the oldest version seen in production we can remove this\nassignableWindow.posthogErrorWrappingFunctions = posthogErrorWrappingFunctions\nassignableWindow.parseErrorAsProperties = errorToProperties\n\nexport default posthogErrorWrappingFunctions\n","import { SessionIdManager } from '../sessionid'\nimport { patch } from '../extensions/replay/rrweb-plugins/patch'\nimport { assignableWindow, window } from '../utils/globals'\n\nconst addTracingHeaders = (sessionManager: SessionIdManager | undefined, req: Request) => {\n if (sessionManager) {\n const { sessionId, windowId } = sessionManager.checkAndGetSessionAndWindowId(true)\n req.headers.set('X-POSTHOG-SESSION-ID', sessionId)\n req.headers.set('X-POSTHOG-WINDOW-ID', windowId)\n }\n}\n\nconst patchFetch = (sessionManager?: SessionIdManager): (() => void) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return patch(window, 'fetch', (originalFetch: typeof fetch) => {\n return async function (url: URL | RequestInfo, init?: RequestInit | undefined) {\n // check IE earlier than this, we only initialize if Request is present\n // eslint-disable-next-line compat/compat\n const req = new Request(url, init)\n\n addTracingHeaders(sessionManager, req)\n\n return originalFetch(req)\n }\n })\n}\n\nconst patchXHR = (sessionManager?: SessionIdManager): (() => void) => {\n return patch(\n // we can assert this is present because we've checked previously\n window!.XMLHttpRequest.prototype,\n 'open',\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (originalOpen: typeof XMLHttpRequest.prototype.open) => {\n return function (\n method: string,\n url: string | URL,\n async = true,\n username?: string | null,\n password?: string | null\n ) {\n // because this function is returned in its actual context `this` _is_ an XMLHttpRequest\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const xhr = this as XMLHttpRequest\n\n // check IE earlier than this, we only initialize if Request is present\n // eslint-disable-next-line compat/compat\n const req = new Request(url)\n\n addTracingHeaders(sessionManager, req)\n\n return originalOpen.call(xhr, method, req.url, async, username, password)\n }\n }\n )\n}\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nconst patchFns = {\n _patchFetch: patchFetch,\n _patchXHR: patchXHR,\n}\nassignableWindow.__PosthogExtensions__.tracingHeadersPatchFns = patchFns\n\n// we used to put tracingHeadersPatchFns on window, and now we put it on __PosthogExtensions__\n// but that means that old clients which lazily load this extension are looking in the wrong place\n// yuck,\n// so we also put it directly on the window\n// when 1.161.1 is the oldest version seen in production we can remove this\nassignableWindow.postHogTracingHeadersPatchFns = patchFns\n\nexport default patchFns\n","var t,e,n=function(){var t=self.performance&&performance.getEntriesByType&&performance.getEntriesByType(\"navigation\")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},r=function(t){if(\"loading\"===document.readyState)return\"loading\";var e=n();if(e){if(t<e.domInteractive)return\"loading\";if(0===e.domContentLoadedEventStart||t<e.domContentLoadedEventStart)return\"dom-interactive\";if(0===e.domComplete||t<e.domComplete)return\"dom-content-loaded\"}return\"complete\"},i=function(t){var e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,\"\")},a=function(t,e){var n=\"\";try{for(;t&&9!==t.nodeType;){var r=t,a=r.id?\"#\"+r.id:i(r)+(r.classList&&r.classList.value&&r.classList.value.trim()&&r.classList.value.trim().length?\".\"+r.classList.value.trim().replace(/\\s+/g,\".\"):\"\");if(n.length+a.length>(e||100)-1)return n||a;if(n=n?a+\">\"+n:a,r.id)break;t=r.parentNode}}catch(t){}return n},o=-1,c=function(){return o},u=function(t){addEventListener(\"pageshow\",(function(e){e.persisted&&(o=e.timeStamp,t(e))}),!0)},s=function(){var t=n();return t&&t.activationStart||0},f=function(t,e){var r=n(),i=\"navigate\";c()>=0?i=\"back-forward-cache\":r&&(document.prerendering||s()>0?i=\"prerender\":document.wasDiscarded?i=\"restore\":r.type&&(i=r.type.replace(/_/g,\"-\")));return{name:t,value:void 0===e?-1:e,rating:\"good\",delta:0,entries:[],id:\"v4-\".concat(Date.now(),\"-\").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},d=function(t,e,n){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var r=new PerformanceObserver((function(t){Promise.resolve().then((function(){e(t.getEntries())}))}));return r.observe(Object.assign({type:t,buffered:!0},n||{})),r}}catch(t){}},l=function(t,e,n,r){var i,a;return function(o){e.value>=0&&(o||r)&&((a=e.value-(i||0))||void 0===i)&&(i=e.value,e.delta=a,e.rating=function(t,e){return t>e[1]?\"poor\":t>e[0]?\"needs-improvement\":\"good\"}(e.value,n),t(e))}},m=function(t){requestAnimationFrame((function(){return requestAnimationFrame((function(){return t()}))}))},p=function(t){document.addEventListener(\"visibilitychange\",(function(){\"hidden\"===document.visibilityState&&t()}))},v=function(t){var e=!1;return function(){e||(t(),e=!0)}},g=-1,h=function(){return\"hidden\"!==document.visibilityState||document.prerendering?1/0:0},T=function(t){\"hidden\"===document.visibilityState&&g>-1&&(g=\"visibilitychange\"===t.type?t.timeStamp:0,E())},y=function(){addEventListener(\"visibilitychange\",T,!0),addEventListener(\"prerenderingchange\",T,!0)},E=function(){removeEventListener(\"visibilitychange\",T,!0),removeEventListener(\"prerenderingchange\",T,!0)},S=function(){return g<0&&(g=h(),y(),u((function(){setTimeout((function(){g=h(),y()}),0)}))),{get firstHiddenTime(){return g}}},b=function(t){document.prerendering?addEventListener(\"prerenderingchange\",(function(){return t()}),!0):t()},L=[1800,3e3],C=function(t,e){e=e||{},b((function(){var n,r=S(),i=f(\"FCP\"),a=d(\"paint\",(function(t){t.forEach((function(t){\"first-contentful-paint\"===t.name&&(a.disconnect(),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-s(),0),i.entries.push(t),n(!0)))}))}));a&&(n=l(t,i,L,e.reportAllChanges),u((function(r){i=f(\"FCP\"),n=l(t,i,L,e.reportAllChanges),m((function(){i.value=performance.now()-r.timeStamp,n(!0)}))})))}))},M=[.1,.25],D=function(t,e){!function(t,e){e=e||{},C(v((function(){var n,r=f(\"CLS\",0),i=0,a=[],o=function(t){t.forEach((function(t){if(!t.hadRecentInput){var e=a[0],n=a[a.length-1];i&&t.startTime-n.startTime<1e3&&t.startTime-e.startTime<5e3?(i+=t.value,a.push(t)):(i=t.value,a=[t])}})),i>r.value&&(r.value=i,r.entries=a,n())},c=d(\"layout-shift\",o);c&&(n=l(t,r,M,e.reportAllChanges),p((function(){o(c.takeRecords()),n(!0)})),u((function(){i=0,r=f(\"CLS\",0),n=l(t,r,M,e.reportAllChanges),m((function(){return n()}))})),setTimeout(n,0))})))}((function(e){var n=function(t){var e,n={};if(t.entries.length){var i=t.entries.reduce((function(t,e){return t&&t.value>e.value?t:e}));if(i&&i.sources&&i.sources.length){var o=(e=i.sources).find((function(t){return t.node&&1===t.node.nodeType}))||e[0];o&&(n={largestShiftTarget:a(o.node),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:o,largestShiftEntry:i,loadState:r(i.startTime)})}}return Object.assign(t,{attribution:n})}(e);t(n)}),e)},w=function(t,e){C((function(e){var i=function(t){var e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:r(c())};if(t.entries.length){var i=n(),a=t.entries[t.entries.length-1];if(i){var o=i.activationStart||0,u=Math.max(0,i.responseStart-o);e={timeToFirstByte:u,firstByteToFCP:t.value-u,loadState:r(t.entries[0].startTime),navigationEntry:i,fcpEntry:a}}}return Object.assign(t,{attribution:e})}(e);t(i)}),e)},x=0,I=1/0,k=0,A=function(t){t.forEach((function(t){t.interactionId&&(I=Math.min(I,t.interactionId),k=Math.max(k,t.interactionId),x=k?(k-I)/7+1:0)}))},F=function(){return t?x:performance.interactionCount||0},P=function(){\"interactionCount\"in performance||t||(t=d(\"event\",A,{type:\"event\",buffered:!0,durationThreshold:0}))},B=[],O=new Map,R=0,j=function(){var t=Math.min(B.length-1,Math.floor((F()-R)/50));return B[t]},q=[],H=function(t){if(q.forEach((function(e){return e(t)})),t.interactionId||\"first-input\"===t.entryType){var e=B[B.length-1],n=O.get(t.interactionId);if(n||B.length<10||t.duration>e.latency){if(n)t.duration>n.latency?(n.entries=[t],n.latency=t.duration):t.duration===n.latency&&t.startTime===n.entries[0].startTime&&n.entries.push(t);else{var r={id:t.interactionId,latency:t.duration,entries:[t]};O.set(r.id,r),B.push(r)}B.sort((function(t,e){return e.latency-t.latency})),B.length>10&&B.splice(10).forEach((function(t){return O.delete(t.id)}))}}},N=function(t){var e=self.requestIdleCallback||self.setTimeout,n=-1;return t=v(t),\"hidden\"===document.visibilityState?t():(n=e(t),p(t)),n},W=[200,500],z=function(t,e){\"PerformanceEventTiming\"in self&&\"interactionId\"in PerformanceEventTiming.prototype&&(e=e||{},b((function(){var n;P();var r,i=f(\"INP\"),a=function(t){N((function(){t.forEach(H);var e=j();e&&e.latency!==i.value&&(i.value=e.latency,i.entries=e.entries,r())}))},o=d(\"event\",a,{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40});r=l(t,i,W,e.reportAllChanges),o&&(o.observe({type:\"first-input\",buffered:!0}),p((function(){a(o.takeRecords()),r(!0)})),u((function(){R=F(),B.length=0,O.clear(),i=f(\"INP\"),r=l(t,i,W,e.reportAllChanges)})))})))},U=[],V=[],_=0,G=new WeakMap,J=new Map,K=-1,Q=function(t){U=U.concat(t),X()},X=function(){K<0&&(K=N(Y))},Y=function(){J.size>10&&J.forEach((function(t,e){O.has(e)||J.delete(e)}));var t=B.map((function(t){return G.get(t.entries[0])})),e=V.length-50;V=V.filter((function(n,r){return r>=e||t.includes(n)}));for(var n=new Set,r=0;r<V.length;r++){var i=V[r];nt(i.startTime,i.processingEnd).forEach((function(t){n.add(t)}))}var a=U.length-1-50;U=U.filter((function(t,e){return t.startTime>_&&e>a||n.has(t)})),K=-1};q.push((function(t){t.interactionId&&t.target&&!J.has(t.interactionId)&&J.set(t.interactionId,t.target)}),(function(t){var e,n=t.startTime+t.duration;_=Math.max(_,t.processingEnd);for(var r=V.length-1;r>=0;r--){var i=V[r];if(Math.abs(n-i.renderTime)<=8){(e=i).startTime=Math.min(t.startTime,e.startTime),e.processingStart=Math.min(t.processingStart,e.processingStart),e.processingEnd=Math.max(t.processingEnd,e.processingEnd),e.entries.push(t);break}}e||(e={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:n,entries:[t]},V.push(e)),(t.interactionId||\"first-input\"===t.entryType)&&G.set(t,e),X()}));var Z,$,tt,et,nt=function(t,e){for(var n,r=[],i=0;n=U[i];i++)if(!(n.startTime+n.duration<t)){if(n.startTime>e)break;r.push(n)}return r},rt=function(t,n){e||(e=d(\"long-animation-frame\",Q)),z((function(e){var n=function(t){var e=t.entries[0],n=G.get(e),i=e.processingStart,o=n.processingEnd,c=n.entries.sort((function(t,e){return t.processingStart-e.processingStart})),u=nt(e.startTime,o),s=t.entries.find((function(t){return t.target})),f=s&&s.target||J.get(e.interactionId),d=[e.startTime+e.duration,o].concat(u.map((function(t){return t.startTime+t.duration}))),l=Math.max.apply(Math,d),m={interactionTarget:a(f),interactionTargetElement:f,interactionType:e.name.startsWith(\"key\")?\"keyboard\":\"pointer\",interactionTime:e.startTime,nextPaintTime:l,processedEventEntries:c,longAnimationFrameEntries:u,inputDelay:i-e.startTime,processingDuration:o-i,presentationDelay:Math.max(l-o,0),loadState:r(e.startTime)};return Object.assign(t,{attribution:m})}(e);t(n)}),n)},it=[2500,4e3],at={},ot=function(t,e){!function(t,e){e=e||{},b((function(){var n,r=S(),i=f(\"LCP\"),a=function(t){e.reportAllChanges||(t=t.slice(-1)),t.forEach((function(t){t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-s(),0),i.entries=[t],n())}))},o=d(\"largest-contentful-paint\",a);if(o){n=l(t,i,it,e.reportAllChanges);var c=v((function(){at[i.id]||(a(o.takeRecords()),o.disconnect(),at[i.id]=!0,n(!0))}));[\"keydown\",\"click\"].forEach((function(t){addEventListener(t,(function(){return N(c)}),{once:!0,capture:!0})})),p(c),u((function(r){i=f(\"LCP\"),n=l(t,i,it,e.reportAllChanges),m((function(){i.value=performance.now()-r.timeStamp,at[i.id]=!0,n(!0)}))}))}}))}((function(e){var r=function(t){var e={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:t.value};if(t.entries.length){var r=n();if(r){var i=r.activationStart||0,o=t.entries[t.entries.length-1],c=o.url&&performance.getEntriesByType(\"resource\").filter((function(t){return t.name===o.url}))[0],u=Math.max(0,r.responseStart-i),s=Math.max(u,c?(c.requestStart||c.startTime)-i:0),f=Math.max(s,c?c.responseEnd-i:0),d=Math.max(f,o.startTime-i);e={element:a(o.element),timeToFirstByte:u,resourceLoadDelay:s-u,resourceLoadDuration:f-s,elementRenderDelay:d-f,navigationEntry:r,lcpEntry:o},o.url&&(e.url=o.url),c&&(e.lcpResourceEntry=c)}}return Object.assign(t,{attribution:e})}(e);t(r)}),e)},ct=[800,1800],ut=function t(e){document.prerendering?b((function(){return t(e)})):\"complete\"!==document.readyState?addEventListener(\"load\",(function(){return t(e)}),!0):setTimeout(e,0)},st=function(t,e){e=e||{};var r=f(\"TTFB\"),i=l(t,r,ct,e.reportAllChanges);ut((function(){var a=n();a&&(r.value=Math.max(a.responseStart-s(),0),r.entries=[a],i(!0),u((function(){r=f(\"TTFB\",0),(i=l(t,r,ct,e.reportAllChanges))(!0)})))}))},ft=function(t,e){st((function(e){var n=function(t){var e={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(t.entries.length){var n=t.entries[0],r=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart)-r,0),a=Math.max(n.domainLookupStart-r,0),o=Math.max(n.connectStart-r,0),c=Math.max(n.connectEnd-r,0);e={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:c-o,requestDuration:t.value-c,navigationEntry:n}}return Object.assign(t,{attribution:e})}(e);t(n)}),e)},dt={passive:!0,capture:!0},lt=new Date,mt=function(t,e){Z||(Z=e,$=t,tt=new Date,gt(removeEventListener),pt())},pt=function(){if($>=0&&$<tt-lt){var t={entryType:\"first-input\",name:Z.type,target:Z.target,cancelable:Z.cancelable,startTime:Z.timeStamp,processingStart:Z.timeStamp+$};et.forEach((function(e){e(t)})),et=[]}},vt=function(t){if(t.cancelable){var e=(t.timeStamp>1e12?new Date:performance.now())-t.timeStamp;\"pointerdown\"==t.type?function(t,e){var n=function(){mt(t,e),i()},r=function(){i()},i=function(){removeEventListener(\"pointerup\",n,dt),removeEventListener(\"pointercancel\",r,dt)};addEventListener(\"pointerup\",n,dt),addEventListener(\"pointercancel\",r,dt)}(e,t):mt(e,t)}},gt=function(t){[\"mousedown\",\"keydown\",\"touchstart\",\"pointerdown\"].forEach((function(e){return t(e,vt,dt)}))},ht=[100,300],Tt=function(t,e){e=e||{},b((function(){var n,r=S(),i=f(\"FID\"),a=function(t){t.startTime<r.firstHiddenTime&&(i.value=t.processingStart-t.startTime,i.entries.push(t),n(!0))},o=function(t){t.forEach(a)},c=d(\"first-input\",o);n=l(t,i,ht,e.reportAllChanges),c&&(p(v((function(){o(c.takeRecords()),c.disconnect()}))),u((function(){var r;i=f(\"FID\"),n=l(t,i,ht,e.reportAllChanges),et=[],$=-1,Z=null,gt(addEventListener),r=a,et.push(r),pt()})))}))},yt=function(t,e){Tt((function(e){var n=function(t){var e=t.entries[0],n={eventTarget:a(e.target),eventType:e.name,eventTime:e.startTime,eventEntry:e,loadState:r(e.startTime)};return Object.assign(t,{attribution:n})}(e);t(n)}),e)};export{M as CLSThresholds,L as FCPThresholds,ht as FIDThresholds,W as INPThresholds,it as LCPThresholds,ct as TTFBThresholds,D as onCLS,w as onFCP,yt as onFID,rt as onINP,ot as onLCP,ft as onTTFB};\n","import { onINP, onLCP, onCLS, onFCP } from 'web-vitals/attribution'\nimport { assignableWindow } from '../utils/globals'\n\nconst postHogWebVitalsCallbacks = {\n onLCP,\n onCLS,\n onFCP,\n onINP,\n}\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.postHogWebVitalsCallbacks = postHogWebVitalsCallbacks\n\n// we used to put posthogWebVitalsCallbacks on window, and now we put it on __PosthogExtensions__\n// but that means that old clients which lazily load this extension are looking in the wrong place\n// yuck,\n// so we also put it directly on the window\n// when 1.161.1 is the oldest version seen in production we can remove this\nassignableWindow.postHogWebVitalsCallbacks = postHogWebVitalsCallbacks\n\nexport default postHogWebVitalsCallbacks\n","import { addEventListener, each, extend } from './utils'\nimport {\n autocaptureCompatibleElements,\n getClassNames,\n getDirectAndNestedSpanText,\n getElementsChainString,\n getEventTarget,\n getSafeText,\n isAngularStyleAttr,\n isSensitiveElement,\n makeSafeText,\n shouldCaptureDomEvent,\n shouldCaptureElement,\n shouldCaptureValue,\n splitClassString,\n} from './autocapture-utils'\nimport RageClick from './extensions/rageclick'\nimport { AutocaptureConfig, COPY_AUTOCAPTURE_EVENT, EventName, Properties, RemoteConfig } from './types'\nimport { PostHog } from './posthog-core'\nimport { AUTOCAPTURE_DISABLED_SERVER_SIDE } from './constants'\n\nimport { isBoolean, isFunction, isNull, isObject } from './utils/type-utils'\nimport { createLogger } from './utils/logger'\nimport { document, window } from './utils/globals'\nimport { convertToURL } from './utils/request-utils'\nimport { isDocumentFragment, isElementNode, isTag, isTextNode } from './utils/element-utils'\nimport { includes } from './utils/string-utils'\n\nconst logger = createLogger('[AutoCapture]')\n\nfunction limitText(length: number, text: string): string {\n if (text.length > length) {\n return text.slice(0, length) + '...'\n }\n return text\n}\n\nexport function getAugmentPropertiesFromElement(elem: Element): Properties {\n const shouldCaptureEl = shouldCaptureElement(elem)\n if (!shouldCaptureEl) {\n return {}\n }\n\n const props: Properties = {}\n\n each(elem.attributes, function (attr: Attr) {\n if (attr.name && attr.name.indexOf('data-ph-capture-attribute') === 0) {\n const propertyKey = attr.name.replace('data-ph-capture-attribute-', '')\n const propertyValue = attr.value\n if (propertyKey && propertyValue && shouldCaptureValue(propertyValue)) {\n props[propertyKey] = propertyValue\n }\n }\n })\n\n return props\n}\n\nexport function previousElementSibling(el: Element): Element | null {\n if (el.previousElementSibling) {\n return el.previousElementSibling\n }\n let _el: Element | null = el\n do {\n _el = _el.previousSibling as Element | null // resolves to ChildNode->Node, which is Element's parent class\n } while (_el && !isElementNode(_el))\n return _el\n}\n\nexport function getDefaultProperties(eventType: string): Properties {\n return {\n $event_type: eventType,\n $ce_version: 1,\n }\n}\n\nexport function getPropertiesFromElement(\n elem: Element,\n maskAllAttributes: boolean,\n maskText: boolean,\n elementAttributeIgnorelist: string[] | undefined\n): Properties {\n const tag_name = elem.tagName.toLowerCase()\n const props: Properties = {\n tag_name: tag_name,\n }\n if (autocaptureCompatibleElements.indexOf(tag_name) > -1 && !maskText) {\n if (tag_name.toLowerCase() === 'a' || tag_name.toLowerCase() === 'button') {\n props['$el_text'] = limitText(1024, getDirectAndNestedSpanText(elem))\n } else {\n props['$el_text'] = limitText(1024, getSafeText(elem))\n }\n }\n\n const classes = getClassNames(elem)\n if (classes.length > 0)\n props['classes'] = classes.filter(function (c) {\n return c !== ''\n })\n\n // capture the deny list here because this not-a-class class makes it tricky to use this.config in the function below\n each(elem.attributes, function (attr: Attr) {\n // Only capture attributes we know are safe\n if (isSensitiveElement(elem) && ['name', 'id', 'class', 'aria-label'].indexOf(attr.name) === -1) return\n\n if (elementAttributeIgnorelist?.includes(attr.name)) return\n\n if (!maskAllAttributes && shouldCaptureValue(attr.value) && !isAngularStyleAttr(attr.name)) {\n let value = attr.value\n if (attr.name === 'class') {\n // html attributes can _technically_ contain linebreaks,\n // but we're very intolerant of them in the class string,\n // so we strip them.\n value = splitClassString(value).join(' ')\n }\n props['attr__' + attr.name] = limitText(1024, value)\n }\n })\n\n let nthChild = 1\n let nthOfType = 1\n let currentElem: Element | null = elem\n while ((currentElem = previousElementSibling(currentElem))) {\n // eslint-disable-line no-cond-assign\n nthChild++\n if (currentElem.tagName === elem.tagName) {\n nthOfType++\n }\n }\n props['nth_child'] = nthChild\n props['nth_of_type'] = nthOfType\n\n return props\n}\n\nexport function autocapturePropertiesForElement(\n target: Element,\n {\n e,\n maskAllElementAttributes,\n maskAllText,\n elementAttributeIgnoreList,\n elementsChainAsString,\n }: {\n e: Event\n maskAllElementAttributes: boolean\n maskAllText: boolean\n elementAttributeIgnoreList?: string[] | undefined\n elementsChainAsString: boolean\n }\n): { props: Properties; explicitNoCapture?: boolean } {\n const targetElementList = [target]\n let curEl = target\n while (curEl.parentNode && !isTag(curEl, 'body')) {\n if (isDocumentFragment(curEl.parentNode)) {\n targetElementList.push((curEl.parentNode as any).host)\n curEl = (curEl.parentNode as any).host\n continue\n }\n targetElementList.push(curEl.parentNode as Element)\n curEl = curEl.parentNode as Element\n }\n\n const elementsJson: Properties[] = []\n const autocaptureAugmentProperties: Properties = {}\n let href: string | false = false\n let explicitNoCapture = false\n\n each(targetElementList, (el) => {\n const shouldCaptureEl = shouldCaptureElement(el)\n\n // if the element or a parent element is an anchor tag\n // include the href as a property\n if (el.tagName.toLowerCase() === 'a') {\n href = el.getAttribute('href')\n href = shouldCaptureEl && href && shouldCaptureValue(href) && href\n }\n\n // allow users to programmatically prevent capturing of elements by adding class 'ph-no-capture'\n const classes = getClassNames(el)\n if (includes(classes, 'ph-no-capture')) {\n explicitNoCapture = true\n }\n\n elementsJson.push(\n getPropertiesFromElement(el, maskAllElementAttributes, maskAllText, elementAttributeIgnoreList)\n )\n\n const augmentProperties = getAugmentPropertiesFromElement(el)\n extend(autocaptureAugmentProperties, augmentProperties)\n })\n\n if (explicitNoCapture) {\n return { props: {}, explicitNoCapture }\n }\n\n if (!maskAllText) {\n // if the element is a button or anchor tag get the span text from any\n // children and include it as/with the text property on the parent element\n if (target.tagName.toLowerCase() === 'a' || target.tagName.toLowerCase() === 'button') {\n elementsJson[0]['$el_text'] = getDirectAndNestedSpanText(target)\n } else {\n elementsJson[0]['$el_text'] = getSafeText(target)\n }\n }\n\n let externalHref: string | undefined\n if (href) {\n elementsJson[0]['attr__href'] = href\n const hrefHost = convertToURL(href)?.host\n const locationHost = window?.location?.host\n if (hrefHost && locationHost && hrefHost !== locationHost) {\n externalHref = href\n }\n }\n\n const props = extend(\n getDefaultProperties(e.type),\n // Sending \"$elements\" is deprecated. Only one client on US cloud uses this.\n !elementsChainAsString ? { $elements: elementsJson } : {},\n // Always send $elements_chain, as it's needed downstream in site app filtering\n { $elements_chain: getElementsChainString(elementsJson) },\n elementsJson[0]?.['$el_text'] ? { $el_text: elementsJson[0]?.['$el_text'] } : {},\n externalHref && e.type === 'click' ? { $external_click_url: externalHref } : {},\n autocaptureAugmentProperties\n )\n\n return { props }\n}\n\nexport class Autocapture {\n instance: PostHog\n _initialized: boolean = false\n _isDisabledServerSide: boolean | null = null\n _elementSelectors: Set<string> | null\n rageclicks = new RageClick()\n _elementsChainAsString = false\n\n constructor(instance: PostHog) {\n this.instance = instance\n this._elementSelectors = null\n }\n\n private get config(): AutocaptureConfig {\n const config = isObject(this.instance.config.autocapture) ? this.instance.config.autocapture : {}\n // precompile the regex\n config.url_allowlist = config.url_allowlist?.map((url) => new RegExp(url))\n config.url_ignorelist = config.url_ignorelist?.map((url) => new RegExp(url))\n return config\n }\n\n _addDomEventHandlers(): void {\n if (!this.isBrowserSupported()) {\n logger.info('Disabling Automatic Event Collection because this browser is not supported')\n return\n }\n\n if (!window || !document) {\n return\n }\n\n const handler = (e: Event) => {\n e = e || window?.event\n try {\n this._captureEvent(e)\n } catch (error) {\n logger.error('Failed to capture event', error)\n }\n }\n\n addEventListener(document, 'submit', handler, { capture: true })\n addEventListener(document, 'change', handler, { capture: true })\n addEventListener(document, 'click', handler, { capture: true })\n\n if (this.config.capture_copied_text) {\n const copiedTextHandler = (e: Event) => {\n e = e || window?.event\n this._captureEvent(e, COPY_AUTOCAPTURE_EVENT)\n }\n\n addEventListener(document, 'copy', copiedTextHandler, { capture: true })\n addEventListener(document, 'cut', copiedTextHandler, { capture: true })\n }\n }\n\n public startIfEnabled() {\n if (this.isEnabled && !this._initialized) {\n this._addDomEventHandlers()\n this._initialized = true\n }\n }\n\n public onRemoteConfig(response: RemoteConfig) {\n if (response.elementsChainAsString) {\n this._elementsChainAsString = response.elementsChainAsString\n }\n\n if (this.instance.persistence) {\n this.instance.persistence.register({\n [AUTOCAPTURE_DISABLED_SERVER_SIDE]: !!response['autocapture_opt_out'],\n })\n }\n // store this in-memory in case persistence is disabled\n this._isDisabledServerSide = !!response['autocapture_opt_out']\n this.startIfEnabled()\n }\n\n public setElementSelectors(selectors: Set<string>): void {\n this._elementSelectors = selectors\n }\n\n public getElementSelectors(element: Element | null): string[] | null {\n const elementSelectors: string[] = []\n\n this._elementSelectors?.forEach((selector) => {\n const matchedElements = document?.querySelectorAll(selector)\n matchedElements?.forEach((matchedElement: Element) => {\n if (element === matchedElement) {\n elementSelectors.push(selector)\n }\n })\n })\n\n return elementSelectors\n }\n\n public get isEnabled(): boolean {\n const persistedServerDisabled = this.instance.persistence?.props[AUTOCAPTURE_DISABLED_SERVER_SIDE]\n const memoryDisabled = this._isDisabledServerSide\n\n if (\n isNull(memoryDisabled) &&\n !isBoolean(persistedServerDisabled) &&\n !this.instance.config.advanced_disable_decide\n ) {\n // We only enable if we know that the server has not disabled it (unless decide is disabled)\n return false\n }\n\n const disabledServer = this._isDisabledServerSide ?? !!persistedServerDisabled\n const disabledClient = !this.instance.config.autocapture\n return !disabledClient && !disabledServer\n }\n\n private _captureEvent(e: Event, eventName: EventName = '$autocapture'): boolean | void {\n if (!this.isEnabled) {\n return\n }\n\n /*** Don't mess with this code without running IE8 tests on it ***/\n let target = getEventTarget(e)\n if (isTextNode(target)) {\n // defeat Safari bug (see: http://www.quirksmode.org/js/events_properties.html)\n target = (target.parentNode || null) as Element | null\n }\n\n if (eventName === '$autocapture' && e.type === 'click' && e instanceof MouseEvent) {\n if (\n this.instance.config.rageclick &&\n this.rageclicks?.isRageClick(e.clientX, e.clientY, new Date().getTime())\n ) {\n this._captureEvent(e, '$rageclick')\n }\n }\n\n const isCopyAutocapture = eventName === COPY_AUTOCAPTURE_EVENT\n if (\n target &&\n shouldCaptureDomEvent(\n target,\n e,\n this.config,\n // mostly this method cares about the target element, but in the case of copy events,\n // we want some of the work this check does without insisting on the target element's type\n isCopyAutocapture,\n // we also don't want to restrict copy checks to clicks,\n // so we pass that knowledge in here, rather than add the logic inside the check\n isCopyAutocapture ? ['copy', 'cut'] : undefined\n )\n ) {\n const { props, explicitNoCapture } = autocapturePropertiesForElement(target, {\n e,\n maskAllElementAttributes: this.instance.config.mask_all_element_attributes,\n maskAllText: this.instance.config.mask_all_text,\n elementAttributeIgnoreList: this.config.element_attribute_ignorelist,\n elementsChainAsString: this._elementsChainAsString,\n })\n\n if (explicitNoCapture) {\n return false\n }\n\n const elementSelectors = this.getElementSelectors(target)\n if (elementSelectors && elementSelectors.length > 0) {\n props['$element_selectors'] = elementSelectors\n }\n\n if (eventName === COPY_AUTOCAPTURE_EVENT) {\n // you can't read the data from the clipboard event,\n // but you can guess that you can read it from the window's current selection\n const selectedContent = makeSafeText(window?.getSelection()?.toString())\n const clipType = (e as ClipboardEvent).type || 'clipboard'\n if (!selectedContent) {\n return false\n }\n props['$selected_content'] = selectedContent\n props['$copy_type'] = clipType\n }\n\n this.instance.capture(eventName, props)\n return true\n }\n }\n\n isBrowserSupported(): boolean {\n return isFunction(document?.querySelectorAll)\n }\n}\n","/**\n * adapted from https://github.com/getsentry/sentry-javascript/blob/72751dacb88c5b970d8bac15052ee8e09b28fd5d/packages/browser-utils/src/getNativeImplementation.ts#L27\n * and https://github.com/PostHog/rrweb/blob/804380afbb1b9bed70b8792cb5a25d827f5c0cb5/packages/utils/src/index.ts#L31\n * after a number of performance reports from Angular users\n */\n\nimport { AssignableWindow } from './globals'\nimport { isAngularZonePresent, isFunction, isNativeFunction } from './type-utils'\nimport { logger } from './logger'\n\ninterface NativeImplementationsCache {\n MutationObserver: typeof MutationObserver\n}\n\nconst cachedImplementations: Partial<NativeImplementationsCache> = {}\n\nexport function getNativeImplementation<T extends keyof NativeImplementationsCache>(\n name: T,\n assignableWindow: AssignableWindow\n): NativeImplementationsCache[T] {\n const cached = cachedImplementations[name]\n if (cached) {\n return cached\n }\n\n let impl = assignableWindow[name] as NativeImplementationsCache[T]\n\n if (isNativeFunction(impl) && !isAngularZonePresent()) {\n return (cachedImplementations[name] = impl.bind(assignableWindow) as NativeImplementationsCache[T])\n }\n\n const document = assignableWindow.document\n if (document && isFunction(document.createElement)) {\n try {\n const sandbox = document.createElement('iframe')\n sandbox.hidden = true\n document.head.appendChild(sandbox)\n const contentWindow = sandbox.contentWindow\n if (contentWindow && (contentWindow as any)[name]) {\n impl = (contentWindow as any)[name] as NativeImplementationsCache[T]\n }\n document.head.removeChild(sandbox)\n } catch (e) {\n // Could not create sandbox iframe, just use assignableWindow.xxx\n logger.warn(`Could not create sandbox iframe for ${name} check, bailing to assignableWindow.${name}: `, e)\n }\n }\n\n // Sanity check: This _should_ not happen, but if it does, we just skip caching...\n // This can happen e.g. in tests where fetch may not be available in the env, or similar.\n if (!impl || !isFunction(impl)) {\n return impl\n }\n\n return (cachedImplementations[name] = impl.bind(assignableWindow) as NativeImplementationsCache[T])\n}\n\nexport function getNativeMutationObserverImplementation(assignableWindow: AssignableWindow): typeof MutationObserver {\n return getNativeImplementation('MutationObserver', assignableWindow)\n}\n","import { assignableWindow, LazyLoadedDeadClicksAutocaptureInterface } from '../utils/globals'\nimport { PostHog } from '../posthog-core'\nimport { isNull, isNumber, isUndefined } from '../utils/type-utils'\nimport { autocaptureCompatibleElements, getEventTarget } from '../autocapture-utils'\nimport { DeadClickCandidate, DeadClicksAutoCaptureConfig, Properties } from '../types'\nimport { autocapturePropertiesForElement } from '../autocapture'\nimport { isElementInToolbar, isElementNode, isTag } from '../utils/element-utils'\nimport { getNativeMutationObserverImplementation } from '../utils/prototype-utils'\nimport { addEventListener } from '../utils'\n\nfunction asClick(event: MouseEvent): DeadClickCandidate | null {\n const eventTarget = getEventTarget(event)\n if (eventTarget) {\n return {\n node: eventTarget,\n originalEvent: event,\n timestamp: Date.now(),\n }\n }\n return null\n}\n\nfunction checkTimeout(value: number | undefined, thresholdMs: number) {\n return isNumber(value) && value >= thresholdMs\n}\n\nclass LazyLoadedDeadClicksAutocapture implements LazyLoadedDeadClicksAutocaptureInterface {\n private _mutationObserver: MutationObserver | undefined\n private _lastMutation: number | undefined\n private _lastSelectionChanged: number | undefined\n private _clicks: DeadClickCandidate[] = []\n private _checkClickTimer: number | undefined\n private _config: Required<DeadClicksAutoCaptureConfig>\n private _onCapture: (click: DeadClickCandidate, properties: Properties) => void\n\n private _defaultConfig = (defaultOnCapture: (click: DeadClickCandidate, properties: Properties) => void) => ({\n element_attribute_ignorelist: [],\n scroll_threshold_ms: 100,\n selection_change_threshold_ms: 100,\n mutation_threshold_ms: 2500,\n __onCapture: defaultOnCapture,\n })\n\n private asRequiredConfig(providedConfig?: DeadClicksAutoCaptureConfig): Required<DeadClicksAutoCaptureConfig> {\n const defaultConfig = this._defaultConfig(providedConfig?.__onCapture || this._captureDeadClick.bind(this))\n return {\n element_attribute_ignorelist:\n providedConfig?.element_attribute_ignorelist ?? defaultConfig.element_attribute_ignorelist,\n scroll_threshold_ms: providedConfig?.scroll_threshold_ms ?? defaultConfig.scroll_threshold_ms,\n selection_change_threshold_ms:\n providedConfig?.selection_change_threshold_ms ?? defaultConfig.selection_change_threshold_ms,\n mutation_threshold_ms: providedConfig?.mutation_threshold_ms ?? defaultConfig.mutation_threshold_ms,\n __onCapture: defaultConfig.__onCapture,\n }\n }\n\n constructor(\n readonly instance: PostHog,\n config?: DeadClicksAutoCaptureConfig\n ) {\n this._config = this.asRequiredConfig(config)\n this._onCapture = this._config.__onCapture\n }\n\n start(observerTarget: Node) {\n this._startClickObserver()\n this._startScrollObserver()\n this._startSelectionChangedObserver()\n this._startMutationObserver(observerTarget)\n }\n\n private _startMutationObserver(observerTarget: Node) {\n if (!this._mutationObserver) {\n const NativeMutationObserver = getNativeMutationObserverImplementation(assignableWindow)\n this._mutationObserver = new NativeMutationObserver((mutations) => {\n this.onMutation(mutations)\n })\n this._mutationObserver.observe(observerTarget, {\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n })\n }\n }\n\n stop() {\n this._mutationObserver?.disconnect()\n this._mutationObserver = undefined\n assignableWindow.removeEventListener('click', this._onClick)\n assignableWindow.removeEventListener('scroll', this._onScroll, { capture: true })\n assignableWindow.removeEventListener('selectionchange', this._onSelectionChange)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n private onMutation(_mutations: MutationRecord[]): void {\n // we don't actually care about the content of the mutations, right now\n this._lastMutation = Date.now()\n }\n\n private _startClickObserver() {\n addEventListener(assignableWindow, 'click', this._onClick)\n }\n\n private _onClick = (event: Event): void => {\n const click = asClick(event as MouseEvent)\n if (!isNull(click) && !this._ignoreClick(click)) {\n this._clicks.push(click)\n }\n\n if (this._clicks.length && isUndefined(this._checkClickTimer)) {\n this._checkClickTimer = assignableWindow.setTimeout(() => {\n this._checkClicks()\n }, 1000)\n }\n }\n\n // `capture: true` is required to get scroll events for other scrollable elements\n // on the page, not just the window\n // see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#usecapture\n //\n // `passive: true` is used to tell the browser that the scroll event handler will not call `preventDefault()`\n // This allows the browser to optimize scrolling performance by not waiting for our handling of the scroll event\n // see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#passive\n private _startScrollObserver() {\n addEventListener(assignableWindow, 'scroll', this._onScroll, { capture: true })\n }\n\n private _onScroll = (): void => {\n const candidateNow = Date.now()\n // very naive throttle\n if (candidateNow % 50 === 0) {\n // we can see many scrolls between scheduled checks,\n // so we update scroll delay as we see them\n // to avoid false positives\n this._clicks.forEach((click) => {\n if (isUndefined(click.scrollDelayMs)) {\n click.scrollDelayMs = candidateNow - click.timestamp\n }\n })\n }\n }\n\n private _startSelectionChangedObserver() {\n addEventListener(assignableWindow, 'selectionchange', this._onSelectionChange)\n }\n\n private _onSelectionChange = (): void => {\n this._lastSelectionChanged = Date.now()\n }\n\n private _ignoreClick(click: DeadClickCandidate | null): boolean {\n if (!click) {\n return true\n }\n\n if (isElementInToolbar(click.node)) {\n return true\n }\n\n const alreadyClickedInLastSecond = this._clicks.some((c) => {\n return c.node === click.node && Math.abs(c.timestamp - click.timestamp) < 1000\n })\n\n if (alreadyClickedInLastSecond) {\n return true\n }\n\n if (\n isTag(click.node, 'html') ||\n !isElementNode(click.node) ||\n autocaptureCompatibleElements.includes(click.node.tagName.toLowerCase())\n ) {\n return true\n }\n\n return false\n }\n\n private _checkClicks() {\n if (!this._clicks.length) {\n return\n }\n\n clearTimeout(this._checkClickTimer)\n this._checkClickTimer = undefined\n\n const clicksToCheck = this._clicks\n this._clicks = []\n\n for (const click of clicksToCheck) {\n click.mutationDelayMs =\n click.mutationDelayMs ??\n (this._lastMutation && click.timestamp <= this._lastMutation\n ? this._lastMutation - click.timestamp\n : undefined)\n click.absoluteDelayMs = Date.now() - click.timestamp\n click.selectionChangedDelayMs =\n this._lastSelectionChanged && click.timestamp <= this._lastSelectionChanged\n ? this._lastSelectionChanged - click.timestamp\n : undefined\n\n const scrollTimeout = checkTimeout(click.scrollDelayMs, this._config.scroll_threshold_ms)\n const selectionChangedTimeout = checkTimeout(\n click.selectionChangedDelayMs,\n this._config.selection_change_threshold_ms\n )\n const mutationTimeout = checkTimeout(click.mutationDelayMs, this._config.mutation_threshold_ms)\n // we want to timeout eventually even if nothing else catches it...\n // we leave a little longer than the maximum threshold to give the other checks a chance to catch it\n const absoluteTimeout = checkTimeout(click.absoluteDelayMs, this._config.mutation_threshold_ms * 1.1)\n\n const hadScroll = isNumber(click.scrollDelayMs) && click.scrollDelayMs < this._config.scroll_threshold_ms\n const hadMutation =\n isNumber(click.mutationDelayMs) && click.mutationDelayMs < this._config.mutation_threshold_ms\n const hadSelectionChange =\n isNumber(click.selectionChangedDelayMs) &&\n click.selectionChangedDelayMs < this._config.selection_change_threshold_ms\n\n if (hadScroll || hadMutation || hadSelectionChange) {\n // ignore clicks that had a scroll or mutation\n continue\n }\n\n if (scrollTimeout || mutationTimeout || absoluteTimeout || selectionChangedTimeout) {\n this._onCapture(click, {\n $dead_click_last_mutation_timestamp: this._lastMutation,\n $dead_click_event_timestamp: click.timestamp,\n $dead_click_scroll_timeout: scrollTimeout,\n $dead_click_mutation_timeout: mutationTimeout,\n $dead_click_absolute_timeout: absoluteTimeout,\n $dead_click_selection_changed_timeout: selectionChangedTimeout,\n })\n } else if (click.absoluteDelayMs < this._config.mutation_threshold_ms) {\n // keep waiting until next check\n this._clicks.push(click)\n }\n }\n\n if (this._clicks.length && isUndefined(this._checkClickTimer)) {\n this._checkClickTimer = assignableWindow.setTimeout(() => {\n this._checkClicks()\n }, 1000)\n }\n }\n\n private _captureDeadClick(click: DeadClickCandidate, properties: Properties) {\n // TODO need to check safe and captur-able as with autocapture\n // TODO autocaputure config\n this.instance.capture(\n '$dead_click',\n {\n ...properties,\n ...autocapturePropertiesForElement(click.node, {\n e: click.originalEvent,\n maskAllElementAttributes: this.instance.config.mask_all_element_attributes,\n maskAllText: this.instance.config.mask_all_text,\n elementAttributeIgnoreList: this._config.element_attribute_ignorelist,\n // TRICKY: it appears that we were moving to elementsChainAsString, but the UI still depends on elements, so :shrug:\n elementsChainAsString: false,\n }).props,\n $dead_click_scroll_delay_ms: click.scrollDelayMs,\n $dead_click_mutation_delay_ms: click.mutationDelayMs,\n $dead_click_absolute_delay_ms: click.absoluteDelayMs,\n $dead_click_selection_changed_delay_ms: click.selectionChangedDelayMs,\n },\n {\n timestamp: new Date(click.timestamp),\n }\n )\n }\n}\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.initDeadClicksAutocapture = (ph, config) =>\n new LazyLoadedDeadClicksAutocapture(ph, config)\n\nexport default LazyLoadedDeadClicksAutocapture\n"],"names":["_a","__defProp","Object","defineProperty","__publicField","obj","key","value","__defNormalProp","enumerable","configurable","writable","__defProp$1","__publicField$1","__defNormalProp$1","NodeType$2","NodeType2","testableAccessors$1","Node","ShadowRoot","Element","MutationObserver","testableMethods$1","untaintedBasePrototype$1","getUntaintedPrototype$1","defaultObj","angularZoneUnpatchedAlternative","_globalThis$Zone","_globalThis$Zone$__sy","angularUnpatchedVersionSymbol","globalThis","Zone","__symbol__","defaultPrototype","prototype","accessorNames","isUntaintedAccessors","Boolean","every","accessor","_a2","_b","getOwnPropertyDescriptor","get","toString","includes","methodNames","method","iframeEl","document","createElement","win","contentWindow","untaintedObject","body","removeChild","_unused","untaintedAccessorCache$1","getUntaintedAccessor$1","cacheKey","concat","call","instance","untaintedPrototype","untaintedAccessor","untaintedMethodCache$1","getUntaintedMethod$1","bind","untaintedMethod","index$1","childNodes","n2","parentNode","parentNode$1","parentElement","parentElement$1","textContent","textContent$1","contains","contains$1","other","getRootNode","getRootNode$1","host","host$1","styleSheets","styleSheets$1","shadowRoot","shadowRoot$1","querySelector","selectors","querySelectorAll","querySelectorAll$1","mutationObserver","constructor","isElement","nodeType","ELEMENT_NODE","isShadowRoot","hostEl","isNativeShadowDom","shadowRoot2","stringifyStylesheet","s2","rules2","stringifiedRules","rule2","stringifyRule","href","join","fixBrowserCompatibilityIssuesInCSS","cssText","replace","error","isCSSImportRule","importStringified","styleSheet","escapeImportStatement","split","length","statement","layerName","push","supportsText","media","absolutifyURLs","regex","ruleStringified","isCSSStyleRule","selectorText","sheetHref","findStylesheet","Array","from","doc","find","s","Mirror$1","getId","id","getNode","this","getIds","idNodeMap","keys","getMeta","nodeMetaMap","removeNodeFromMap","delete","childNode","has","hasNode","node2","add","meta","set","oldNode","reset","Map","WeakMap","maskInputValue","_ref","element","maskInputOptions","tagName","type","maskInputFn","text","actualType","toLowerCase","str","ORIGINAL_ATTRIBUTE_NAME","getInputType","hasAttribute","extractFileExtension","_ref2","url","URL","baseURL","window","location","err","match","URL_IN_CSS_REF","URL_PROTOCOL_MATCH","URL_WWW_MATCH","DATA_URI","origin","quote1","path1","quote2","path2","extractOrigin","filePath","path3","maybeQuote","test","indexOf","slice","stack","parts","part","canvasService","canvasCtx","_id","tagNameRegex","RegExp","IGNORED_NODE","genId","SRCSET_NOT_SPACES","SRCSET_COMMAS_OR_SPACES","cachedDocument","absoluteToDoc","attributeValue","trim","getHref","isSVGElement","el","ownerSVGElement","a2","customHref","startsWith","transformAttribute","name","pos","collectCharacters","regEx","chars2","exec","substring","output","descriptorsStr","inParens","c2","getAbsoluteSrcsetString","ignoreAttribute","_value","classMatchesRegex","checkAncestors","eIndex","classList","className","needMaskingText","maskTextClass","closest","maskTextSelector","matches","e2","serializeNode","mirror","mirror2","blockClass","blockSelector","needsMask","inlineStylesheet","maskTextFn","dataURLOptions","inlineImages","recordCanvas","keepIframeSrcFn","newlyAddedElement","options","rootId","getRootId","docId","compatMode","Document","publicId","systemId","serializeElementNode","isCustomElement","needBlock","_isBlockedElement","getValidTagName$1","HTMLFormElement","processedTagName","attributes","len","i2","attr","hrefFrom","n","stylesheet","rel","_cssText","innerText","sheet","checked","selected","open","rr_open_mode","_unused2","ph_rr_could_not_detect_modal","__context","is2DCanvasBlank","ctx","x2","canvas","width","y","height","getImageData","originalGetImageData","pixelBuffer","Math","min","data","buffer","quality","canvasDataURL","blankCanvas","toDataURL","rr_dataURL","getContext","image","imageSrc","currentSrc","getAttribute","priorCrossOrigin","crossOrigin","recordInlineImage","removeEventListener","complete","naturalWidth","addEventListener","console","removeAttribute","mediaAttributes","rr_mediaState","paused","rr_mediaCurrentTime","currentTime","rr_mediaPlaybackRate","muted","rr_mediaLoop","loop","rr_mediaVolume","volume","scrollLeft","rr_scrollLeft","scrollTop","rr_scrollTop","getBoundingClientRect","class","rr_width","rr_height","src","contentDocument","customElements","isSVG","isCustom","TEXT_NODE","serializeTextNode","parent","parentTagName","isStyle","isScript","nextSibling","previousSibling","cssRules","Text","CDATA_SECTION_NODE","CDATA","COMMENT_NODE","Comment","lowerIfExists","maybeAttr","serializeNodeWithId","skipChild","slimDOMOptions","onSerialize","onIframeLoad","iframeLoadTimeout","onStylesheetLoad","stylesheetLoadTimeout","preserveWhiteSpace","_serializedNode","slimDOMExcluded","script","sn","as","headMetaDescKeywords","headMetaSocial","property","headMetaRobots","headMetaHttpEquiv","headMetaAuthorship","headMetaVerification","serializedNode","assign","recordChild","shadowRootEl","isShadowHost","headWhitespace","bypassOptions","childN","serializedChildNode","_shadowRootEl","_childN","_serializedChildNode","isShadow","listener","readyState","fired","blankUrl","setTimeout","timer","clearTimeout","onceIframeLoaded","iframeDoc","serializedIframeNode","onceStylesheetLoaded","styleSheetLoaded","styleSheetLoadTimeout","link","serializedLinkNode","BaseRRNode$1","BaseRRNode","__publicField2","childNodes2","childIterator","firstChild","ownerDocument","appendChild","_newChild","Error","insertBefore","_node","testableAccessors","testableMethods","untaintedBasePrototype","getUntaintedPrototype","angularZoneUnpatchedAlternative$1","_globalThis$Zone2","_globalThis$Zone2$__s","isUntaintedMethods","_unused3","untaintedAccessorCache","getUntaintedAccessor","String","untaintedMethodCache","getUntaintedMethod","mutationObserverCtor","index","on","target","arguments","undefined","capture","passive","fn","DEPARTED_MIRROR_ACCESS_WARNING","_mirror","map","throttle","timeout","previous","_len","args","_key","now","Date","leading","remaining","wait","context","func","trailing","hookSetter","original","isRevoked","d","patch","source","wrapped","replacement","defineProperties","__rrweb_original__","_unused4","Proxy","Reflect","prop","receiver","nowTimestamp","getWindowScroll","left","top","scrollingElement","pageYOffset","documentElement","_c","_d","getWindowHeight","innerHeight","clientHeight","getWindowWidth","innerWidth","clientWidth","closestElementOfNode","isBlocked","isIgnored","headTitleMutations","isAncestorRemoved","DOCUMENT_NODE","legacy_isTouchEvent","event","changedTouches","isSerializedIframe","isSerializedStylesheet","hasShadowRoot","StyleSheetMirror$1","_this$styleIDMap$get","styleIDMap","newId","idStyleMap","getStyle","generateId","getShadowHost","shadowHost","shadowHostInDom","getRootShadowHost","rootShadowHost","inDom","EventType","EventType2","IncrementalSource","IncrementalSource2","MouseInteractions","MouseInteractions2","PointerTypes","PointerTypes2","CanvasContext","CanvasContext2","MediaInteractions","MediaInteractions2","isNodeInLinkedList","DoubleLinkedList","position","current","head","index2","next","addNode","__ln","_current","tail","removeNode","errorHandler","moveKey","MutationBuffer","Set","mutations","emit","frozen","locked","adds","addedIds","addList","getNextId","ns","nextId","pushAdd","parentId","currentN","iframeManager","addIframe","stylesheetManager","shadowDomManager","addShadowRoot","iframe","childSn","attachIframe","observeAttachShadow","attachLinkElement","node","mapRemoves","shift","movedSet","isParentRemoved","removes","addedSet","droppedSet","_n","isAncestorInSet","candidate","tailNode","_parentId","unhandledNode","payload","texts","genTextAreaValueMutation","filter","attribute","style","diffAsStr","JSON","stringify","styleDiff","unchangedAsStr","_unchangedStyles","attributeMap","movedMap","textarea","item","cn","m","oldValue","attributeName","_value2","unattachedDoc","old","pname","newValue","getPropertyValue","newPriority","getPropertyPriority","_pname","addedNodes","forEach","genAdds","nodeId","isSerialized","deepDelete","processedNodeManager","inOtherBuffer","targetId","init","freeze","canvasManager","unfreeze","isFrozen","lock","unlock","addsSet","_loop","some","r2","v","_ret","_isParentRemoved","_isAncestorInSet","callbackWrapper","cb","mutationBuffers","getEventTarget","path","composedPath","_unused5","initMutationObserver","rootEl","mutationBuffer","observer","observe","attributeOldValue","characterData","characterDataOldValue","childList","subtree","initMouseInteractionObserver","_ref4","mouseInteractionCb","sampling","mouseInteraction","disableMap","handlers","currentPointerType","Number","isNaN","endsWith","eventKey","eventName","handler","pointerType","thisEventKey","Touch","MouseDown","MouseUp","Pen","Mouse","clientX","clientY","x","getHandler","PointerEvent","TouchStart","TouchEnd","h","initScrollObserver","_ref5","scrollCb","evt","scrollLeftTop","defaultView","scroll","INPUT_TAGS","lastInputValueMap","getNestedCSSRulePositions","hasNestedCSSRule","childRule","parentRule","CSSGroupingRule","CSSMediaRule","CSSSupportsRule","CSSConditionRule","parentStyleSheet","_index","unshift","recurse","getIdAndStyleId","styleMirror","styleId","initAdoptedStyleSheetObserver","host2","_ref13","hostId","nodeName","patchTarget","originalPropertyDescriptor","_a3","sheets","result2","adoptStyleSheets","initObservers","hooks","currentWindow","mergeHooks","mutationCb","mousemoveCb","viewportResizeCb","inputCb","mediaInteractionCb","styleSheetRuleCb","styleDeclarationCb","canvasMutationCb","fontCb","selectionCb","customElementCb","o2","mutation","mousemove","viewportResize","input","mediaInteaction","styleSheetRule","styleDeclaration","canvasMutation","font","selection","customElement","recordDOM","mousemoveHandler","_ref3","timeBaseline","threshold","callbackThreshold","mousemoveCallback","positions","wrappedCb","totalOffset","p","updatePosition","timeOffset","DragEvent","Drag","MouseEvent","MouseMove","TouchMove","initMoveObserver","mouseInteractionHandler","scrollHandler","viewportResizeHandler","initViewportResizeObserver","_ref6","_ref7","lastH","lastW","inputHandler","_ref8","ignoreClass","ignoreSelector","userTriggeredOnInput","eventHandler","userTriggered","isTrusted","isChecked","cbWithDedup","text2","v2","lastInputValue","propertyDescriptor","HTMLInputElement","hookProperties","HTMLSelectElement","HTMLTextAreaElement","initInputObserver","mediaInteractionHandler","_ref16","playbackRate","Play","VolumeChange","RateChange","initMediaInteractionObserver","styleSheetObserver","adoptedStyleSheetObserver","styleDeclarationObserver","fontObserver","_ref9","_ref10","CSSStyleSheet","insertRule","apply","thisArg","argumentsList","rule","addRule","selector","styleBlock","replaceSync","deleteRule","removeRule","supportedNestedCSSRuleTypes","canMonkeyPatchNestedCSSRule","unmodifiedFunctions","entries","_ref11","typeKey","_ref12","initStyleSheetObserver","_ref14","_ref15","ignoreCSSAttributes","setProperty","CSSStyleDeclaration","priority","removeProperty","remove","initStyleDeclarationObserver","initFontObserver","_ref17","fontMap","originalFontFace","FontFace","family","fontFace","descriptors","fontSource","Uint8Array","restoreHandler","fonts","selectionObserver","initSelectionObserver","param","collapsed","updateSelection","isCollapsed","ranges","count","range","startContainer","startOffset","endContainer","endOffset","blocked","start","end","customElementObserver","_ref18","define","warn","initCustomElementObserver","pluginHandlers","plugin3","plugins","callback","b","disconnect","CrossOriginIframeMirror","generateIdFn","remoteId","idToRemoteIdMap","idToRemoteMap","getIdToRemoteIdMap","remoteIdToIdMap","remoteToIdMap","getRemoteIdToIdMap","getRemoteId","getRemoteIds","ids","iframeIdToRemoteIdMap","iframeRemoteIdToIdMap","IframeManager","wrappedEmit","recordCrossOriginIframes","iframes","crossOriginIframeMap","addLoadListener","loadListener","isAttachIframe","handleMessage","adoptedStyleSheets","message","crossOriginMessageEvent","transformedEvent","isCheckout","transformCrossOriginEvent","FullSnapshot","crossOriginIframeMirror","crossOriginIframeStyleMirror","crossOriginIframeRootIdMap","patchRootIdOnNode","timestamp","IncrementalSnapshot","Mutation","Load","DomContentLoaded","Plugin","Custom","replaceIds","replaceIdOnNode","ViewportResize","MediaInteraction","MouseInteraction","Scroll","CanvasMutation","Input","StyleSheetRule","StyleDeclaration","replaceStyleIds","Font","AdoptedStyleSheet","styles","isArray","iframeMirror","child","ShadowDomManager","WeakSet","patchAttachShadow","shadowDoms","_objectSpread","restoreHandlers","iframeElement","manager","option","sRoot","chars","lookup","i$1","charCodeAt","canvasVarMap","saveWebGLVar","isInstanceOfWebGLObject","list2","ctor","contextMap","serializeArg","Float32Array","Float64Array","Int32Array","Uint32Array","Uint16Array","Int16Array","Int8Array","Uint8ClampedArray","rr_type","values","ArrayBuffer","base64","arraybuffer","bytes","encode","DataView","byteLength","HTMLImageElement","HTMLCanvasElement","ImageData","serializeArgs","arg","supportedWebGLConstructorNames","initCanvasContextObserver","contextType","_len3","_key3","ctxName","getNormalizedContextName","setPreserveDrawingBufferToTrue","contextAttributes","preserveDrawingBuffer","_unused7","patchGLPrototype","props","_loop3","_len4","_key4","recordArgs","_unused8","hookHandler","setter","takeFullSnapshot$1","encodedJs","blob","Blob","atob","WorkerWrapper","objURL","webkitURL","createObjectURL","worker","Worker","revokeObjectURL","CanvasManager","latestId","invokeId","newFrame","rafStamps","pendingCanvasMutations","initCanvasMutationObserver","initCanvasFPSObserver","clear","resetObservers","_this","canvasContextReset","snapshotInProgressMap","commands","rafId","timeBetweenSnapshots","fps","lastSnapshotTime","takeCanvasSnapshots","getCanvas","matchedCanvas","searchCanvas","root","elem","getContextAttributes","bitmap","resizeWidth","resizeHeight","_x","_ref19","cancelAnimationFrame","startRAFTimestamping","startPendingCanvasMutationFlusher","canvas2DReset","initCanvas2DMutationObserver","props2D","CanvasRenderingContext2D","_len2","_key2","_unused6","_loop2","processMutation","canvasWebGL1and2Reset","WebGL","WebGL2RenderingContext","initCanvasWebGLMutationObserver","requestAnimationFrame","flushPendingCanvasMutations","setLatestRAFTimestamp","_values","flushPendingCanvasMutationFor","valuesWithType","rest","StylesheetManager","adoptedStyleSheetCb","trackLinkElement","linkEl","trackedLinkElements","trackStylesheetInLinkElement","_this2","adoptedStyleSheetData","styleIds","_loop4","rules","CSSRule","ProcessedNodeManager","buffers","nodeMap","thisBuffer","active","destroy","recording","cleanFrame","t2","Mirror","record","checkoutEveryNms","checkoutEveryNth","maskAllInputs","_maskInputOptions","_slimDOMOptions","packFn","mousemoveWait","recordAfter","collectFonts","errorHandler2","inEmittingFrame","passEmitsToParent","lastFullSnapshotEvent","color","date","email","month","number","search","tel","time","week","select","password","comment","headFavicon","NodeList","DOMTokenList","polyfill$1","incrementalSnapshotCount","eventProcessor","buf","exceedCount","exceedTime","wrappedMutationEmit","wrappedScrollEmit","wrappedCanvasMutationEmit","getMirror","nodeMirror","Meta","slimDOM","snapshot","initialOffset","CustomElement","plugin","addCustomEvent","tag","Running","__defNormalProp2","__publicField22","getTime","DOCUMENT_FRAGMENT_NODE","__proto__","StyleSheetMirror","getBaseDimension","frameElement","rootIframe","relativeScale","absoluteScale","frameDimension","frameBaseDimension","getNestedRule","getPositionsAndIndex","nestedIndex","pop","pageXOffset","iterateResolveTree","tree","children","polyfill","queueToResolveTrees","queueNodeMap","putIntoMap","nodeInTree","queueNodeTrees","queue","nextInTree","idx","splice","_idx","parentInTree","uniqueTextMutations","idSet","uniqueMutations","Symbol","toStringTag","decodeBase64","debug","NotStarted","Stopped","StackFrame","fileName","functionName","columnNumber","lineNumber","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","ErrorStackParser","parse","stacktrace","parseOpera","parseV8OrIE","extractLocation","urlLike","line","filtered","sanitizedLine","tokens","locationParts","parseFFOrSafari","functionNameRegex","e","parseOpera9","parseOpera11","lineRE","lines","i","parseFloat","parseOpera10","pathToSelector","outerHTML","localName","domSiblings","sibling","isObject","isObjTooDeep","limit","numOfKeysLimit","depthOfLimit","stringifyOptions","thisPos","Infinity","shouldIgnore","_obj","stringLengthLimit","Event","eventResult","eventValue","HTMLElement","defaultLogOptions","level","lengthThreshold","logger","initLogObserver","logOptions","loggerType","logCount","inStack","cancelHandlers","trace","stackFrame","unhandledrejectionHandler","reason","levelType","_logger","getRecordConsolePlugin","global","nativeForEach","navigator","fetch","XMLHttpRequest","AbortController","userAgent","Compression","assignableWindow","severityLevels","needle","nativeIsArray","ObjProto","hasOwnProperty","isFunction","isNativeFunction","isAngularZonePresent","isUndefined","isString","isEmptyString","isNull","isNullish","isNumber","isBoolean","isDocument","isFormData","FormData","_createLogger","prefix","_log","consoleLog","info","critical","_len5","_key5","uninitializedWarning","methodName","createLogger","additionalPrefix","breaker","eachArray","iterator","l","each","pair","extend","ownProps","resArray","formDataToQuery","formdata","use_val","use_key","arg_separator","tph_arr","val","encodeURIComponent","File","isFile","__posthog_wrapped__","isHostOnDenyList","_options$payloadHostD","hostname","hostnameFromURL","defaultNotDenied","isHostDenied","payloadHostDenyList","deny","SURVEYS_ACTIVATED","isElementNode","isTag","splitClassString","getClassNames","baseVal","getSafeText","elText","shouldCaptureElement","isSensitiveElement","_makeSafeText","isTextNode","shouldCaptureValue","makeSafeText","autocaptureCompatibleElements","curEl","classes","coreCCPattern","anchoredCCRegex","unanchoredCCRegex","coreSSNPattern","anchoredSSNRegex","unanchoredSSNRegex","anchorRegexes","getDirectAndNestedSpanText","getNestedSpanText","_child$tagName","spanText","getElementsChainString","elements","ret","_element$nth_child","_element$nth_of_type","el_string","tag_name","attr_class","single_class","sort","nth_child","nth_of_type","attr_id","sortedAttributes","a","localeCompare","escapeQuotes","elementsToString","_el$$el_text","_el$attr__href","response","extractAttrClass","extractElements","defaultNetworkOptions","initiatorTypes","maskRequestFn","recordHeaders","recordBody","recordInitialRequests","recordPerformance","performanceEntryTypeToObserve","payloadSizeLimitBytes","isNavigationTiming","entry","entryType","isResourceTiming","initPerformanceObserver","initialPerformanceEntries","performance","getEntries","initiatorType","requests","flatMap","prepareRequest","status","networkRequest","isInitial","PerformanceObserver","performanceEntries","wrappedInitiatorFilter","entryTypes","supportedEntryTypes","shouldRecordHeaders","shouldRecordBody","headers","matchesContentType","contentTypes","contentTypeHeader","contentType","ct","isBlobURL","protocol","Request","recordBodyType","getRequestPerformanceEntry","_x2","_x3","_x4","_x5","_getRequestPerformanceEntry","_asyncToGenerator","attempt","performanceEntry","array","predicate","findLast","getEntriesByName","startTime","Promise","resolve","_tryReadXHRBody","exposesServerTiming","responseEnd","timeOrigin","floor","toJSON","round","endTime","requestHeaders","requestBody","responseHeaders","responseBody","timing","serverTiming","duration","contentTypePrefixDenyList","_tryReadBody","r","reject","clone","then","txt","finally","_tryReadRequestBody2","_tryReadResponseBody2","cannotReadBodyReason","_r$headers$get","contentTypeIsDenied","_checkForCannotReadResponseBody","initFetchObserver","recordRequestHeaders","recordResponseHeaders","restorePatch","originalFetch","res","req","header","_x6","_tryReadRequestBody","_x7","_tryReadResponseBody","_res","catch","_x8","_x9","initialisedHandler","initNetworkObserver","networkOptions","request","maskedRequest","performanceObserver","xhrObserver","fetchObserver","originalOpen","async","username","xhr","originalSetRequestHeader","setRequestHeader","originalSend","send","DONE","getAllResponseHeaders","initXhrObserver","getRecordNetworkPlugin","__PosthogExtensions__","rrwebPlugins","rrweb","rrwebRecord","version","rrwebConsoleRecord","SurveyType","SurveyQuestionType","SurveyQuestionBranchingType","SurveySchedule","EMPTY_OBJ","EMPTY_ARR","IS_NON_DIMENSIONAL","__u","prepareStylesheet","posthog","_posthog$config","config","prepare_external_dependency_stylesheet","_window","_document","SurveySeenPrefix","SURVEY_DEFAULT_Z_INDEX","getFontFamily","fontFamily","defaultFontStack","appearance","parseInt","maxWidth","zIndex","borderColor","right","center","backgroundColor","disabledButtonOpacity","submitButtonColor","getContrastingTextColor","ratingButtonActiveColor","hex2rgb","c","hexColor","rgb","defaultBackgroundColor","nameColorToHex","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","colorMatch","g","sqrt","defaultSurveyAppearance","submitButtonTextColor","ratingButtonColor","placeholder","whiteLabel","displayThankYouMessage","thankYouMessageHeader","sendSurveyEvent","_posthog$get_session_","responses","survey","localStorage","setItem","getSurveySeenKey","$survey_name","$survey_id","$survey_iteration","current_iteration","$survey_iteration_start_date","current_iteration_start_date","$survey_questions","questions","question","sessionRecordingUrl","get_session_replay_url","$set","getSurveyInteractionProperty","dispatchEvent","dismissedSurveyEvent","readOnly","_posthog$get_session_2","shuffle","random","reverseIfUnshuffled","unshuffled","shuffled","reverse","getDisplayOrderQuestions","shuffleQuestions","canActivateRepeatedly","_survey$conditions3","_survey$conditions3$e","schedule","Always","Widget","conditions","events","repeatedActivation","_survey$conditions","_survey$conditions$ev","_survey$conditions$ev2","_survey$conditions2","_survey$conditions2$e","_survey$conditions2$e2","hasEvents","surveySeenKey","action","surveyProperty","SurveyContext","createContext","isPreviewMode","previewPageIndex","onPopupSurveyDismissed","isPopup","onPreviewSubmit","renderChildrenAsTextOrHtml","component","renderAsHtml","cloneElement","dangerouslySetInnerHTML","__html","extendArray","isMatchingRegex","pattern","isValidRegex","SimpleEventEmitter","_defineProperty","ActionMatcher","step","checkStepEvent","checkStepUrl","checkStepElement","actionEvents","actionRegistry","_this$instance","_addCaptureHook","_this$instance2","matchEventToAction","eventPayload","register","actions","_this$instance3","_this$instance4","_this$actionRegistry","_action$steps","steps","_this$actionEvents","autocapture","_this$instance5","selectorsToWatch","_action$steps2","setElementSelectors","_this$actionRegistry2","size","checkAction","_debugEventEmitter","_addActionHook","onAction","checkStep","_event$properties","eventUrl","properties","$current_url","matchString","url_matching","matching","adjustedRegExpStringPattern","escapeStringRegexp","getElementsList","href_matching","text_matching","$el_text","_event$properties2","elementSelectors","$element_selectors","$elements","SurveyEventReceiver","eventToSurveys","actionToSurveys","surveys","setupEventBasedSurveys","setupActionBasedSurveys","actionBasedSurveys","_survey$conditions2$a","_survey$conditions2$a2","actionMatcher","actionName","_survey$conditions4","_survey$conditions4$a","_survey$conditions5","_survey$conditions5$a","_survey$conditions5$a2","_this$actionMatcher","_survey$conditions6","_survey$conditions6$a","_survey$conditions6$a2","knownSurveys","_survey$conditions7","_survey$conditions8","_survey$conditions8$e","_survey$conditions8$e2","matchEventToSurvey","onEvent","_survey$conditions9","_survey$conditions9$e","_survey$conditions9$e2","_this$instance3$persi","existingActivatedSurveys","persistence","SURVEY_SHOWN_EVENT_NAME","_eventPayload$propert","surveyId","_updateActivatedSurveys","_this$instance4$persi","activatedSurveys","_this$instance5$persi","getSurveys","_this$instance6","_this$instance6$persi","getEventToSurveys","_getActionMatcher","surveyValidationMap","icontains","targets","not_icontains","not_regex","exact","is_not","doesSurveyUrlMatch","_window$location","matchType","urlMatchType","currentIndex","currentComponent","previousComponent","prevRaf","currentHook","afterPaintEffects","EMPTY","oldBeforeDiff","__b","oldBeforeRender","__r","oldAfterDiff","diffed","oldCommit","__c","oldBeforeUnmount","unmount","getHookState","__h","__H","__","__V","useState","initialState","useReducer","reducer","hookState","_reducer","invokeOrReturn","currentValue","__N","nextValue","setState","_hasScuFromHooks","updateHookState","f","stateHooks","prevScu","shouldUpdate","hookItem","shouldComponentUpdate","prevCWU","componentWillUpdate","__e","tmp","useEffect","state","__s","argsChanged","_pendingArgs","useRef","initialValue","useMemo","factory","useContext","provider","sub","flushAfterPaintEffects","__P","invokeCleanup","invokeEffect","__v","vnode","t","afterNextFrame","commitQueue","hasErrored","HAS_RAF","raf","done","hook","comp","cleanup","oldArgs","newArgs","createWidgetShadow","_survey$appearance","div","widgetColor","shadow","attachShadow","mode","widgetStyleSheet","append","satisfiedEmoji","_jsx","xmlns","viewBox","neutralEmoji","dissatisfiedEmoji","veryDissatisfiedEmoji","verySatisfiedEmoji","cancelSVG","fill","IconPosthogLogo","_jsxs","maskType","maskUnits","mask","transform","checkSVG","PostHogLogo","BottomSection","submitDisabled","onSubmit","textColor","disabled","onClick","QuestionHeader","description","descriptionContentType","forceDisableHtml","Cancel","role","ConfirmationMessage","onClose","styleOverrides","thankYouMessageCloseButtonText","useContrastingTextColor","_options$defaultTextC","ref","setTextColor","defaultTextColor","getComputedStyle","getTextColor","forceUpdate","OpenTextQuestion","textRef","setText","rows","onInput","currentTarget","buttonText","optional","LinkQuestion","_Fragment","RatingQuestion","displayQuestionIndex","scale","starting","rating","setRating","display","threeScaleEmojis","fiveScaleEmojis","emoji","gridTemplateColumns","getScaleNumbers","RatingButton","num","setActiveNumber","lowerBoundLabel","upperBoundLabel","submitButtonText","MultipleChoiceQuestion","choices","shuffleOptions","displayOrderChoices","openEndedChoice","hasOpenChoice","shuffledOptions","getDisplayOrderChoices","selectedChoices","setSelectedChoices","MultipleChoice","openChoiceSelected","setOpenChoiceSelected","openEndedInput","setOpenEndedInput","inputType","SingleChoice","choice","choiceClass","htmlFor","userValue","fiveScaleNumbers","sevenScaleNumbers","tenScaleNumbers","getPosthogWidgetClass","getNextSurveyStep","currentQuestionIndex","_question$branching","nextQuestionIndex","branching","End","SpecificQuestion","isInteger","ResponseBased","_question$branching2","_question$branching2$","selectedChoiceIndex","responseValues","nextStep","Rating","_question$branching3","_question$branching3$","ratingBucket","responseValue","getRatingBucketForResponseValue","SurveyManager","_surveyPopups$shadowR","surveyPopups","childElementCount","surveyWaitPeriodInDays","seenSurveyWaitPeriodInDays","hasWaitPeriodPassed","lastSeenSurveyDate","waitPeriodInDays","today","diff","abs","ceil","getItem","surveySeen","getSurveySeen","clearSurveyTimeout","addSurveyToFocus","delaySeconds","surveyPopupDelaySeconds","createShadow","styleElement","Preact","SurveyPopup","removeSurveyFromFocus","timeoutId","surveyTimeouts","stylesheetContent","FeedbackWidget","_survey$appearance2","selectorOnPage","widgetSelector","handleWidget","_document$querySelect","_document$querySelect2","surveyPopup","setAttribute","renderReason","visible","end_date","disabledReason","Popover","linked_flag_key","featureFlags","isFeatureEnabled","targeting_flag_key","internal_targeting_flag_key","_this$posthog","forceReload","getActiveMatchingSurveys","nonAPISurveys","sortSurveysByAppearanceDelay","surveyInFocus","_survey$appearance3","_survey$appearance4","_survey$appearance5","widgetType","handleWidgetSelector","canShowNextEventBasedSurvey","handlePopoverSurvey","_a$appearance","_b$appearance","getTestAPI","generateSurveys","surveyManager","callSurveysAndEvaluateDisplayLogic","setInterval","useHideSurveyOnURLChange","setSurveyVisible","checkUrlMatch","originalPushState","history","pushState","originalReplaceState","replaceState","_survey$appearance11","_style","_style2","_survey$appearance12","_survey$appearance13","_survey$appearance14","onCloseConfirmationMessage","surveyPopupDelayMilliseconds","isPopupVisible","isSurveySent","setIsPopupVisible","millisecondDelay","setIsSurveySent","handleSurveyClosed","handleSurveySent","_survey$appearance9","_survey$appearance10","autoDisappear","showSurvey","toISOString","_document$querySelect3","_document$querySelect4","inputField","focus","usePopupVisibility","shouldShowConfirmation","confirmationBoxLeftStyle","Provider","thankYouMessageDescription","thankYouMessageDescriptionContentType","Questions","_survey$appearance15","_survey$appearance16","questionsResponses","setQuestionsResponses","setCurrentQuestionIndex","surveyQuestions","_survey$appearance17","getQuestionComponent","questionId","responseKey","getSurveyResponseKey","onNextButtonClick","_survey$appearance23","_survey$appearance24","isFeedbackButtonVisible","setIsFeedbackButtonVisible","setShowSurvey","setStyle","widgetRef","_survey$appearance18","_survey$appearance20","_survey$appearance19","widgetPos","bottom","borderRadius","borderBottom","_document$querySelect5","widget","_survey$appearance21","_survey$appearance22","buttonRect","viewportHeight","surveyWidth","showAbove","topPosition","scrollY","border","boxShadow","maxHeight","spacing","resetShowSurvey","widgetLabel","questionComponents","Open","Link","commonProps","additionalProps","Component","componentProps","isEvent","isInstanceOf","base","isPrimitive","isBuiltin","isDOMError","extendPostHogWithSurveys","WEBPACK_ERROR_REGEXP","STACKTRACE_FRAME_LIMIT","UNKNOWN_FUNCTION","createFrame","filename","lineno","colno","frame","platform","function","in_app","chromeRegexNoFnName","chromeRegex","chromeEvalRegex","geckoREgex","geckoEvalRegex","defaultStackParser","parsers","sortedParsers","skipFirstLines","frames","cleanedLine","parser","localStack","getLastStackFrame","reverseAndStripFrames","createStackParser","noFnParts","col","subMatch","extractSafariExtensionDetails","arr","parsedStackResults","lastKeysCount","cachedFilenameChunkIds","isSafariExtension","isSafariWebExtension","ERROR_TYPES_PATTERN","parseStackFrames","ex","framesToPop","skipLines","reactMinifiedRegexp","getSkipFirstStackStringLines","filenameDebugIdMap","stackParser","chunkIdMap","_posthogChunkIds","chunkIdKeys","reduce","acc","stackKey","result","parsedStack","chunkId","getFilenameToChunkIdMap","chunk_id","applyChunkIds","errorPropertiesFromError","metadata","_metadata$handled","_metadata$synthetic","handled","synthetic","$exception_list","overrideExceptionType","overrideExceptionMessage","extractMessage","mechanism","$exception_level","errorPropertiesFromString","_metadata$handled2","_metadata$synthetic2","_metadata$defaultExce","exception","defaultExceptionType","defaultExceptionMessage","syntheticException","isSeverityLevel","errorPropertiesFromObject","_metadata$handled3","_metadata$synthetic3","exceptionType","exceptionMessage","maxLength","serialized","extractExceptionKeysForMessage","errorToProperties","errorProperties","isDOMException","domException","isErrorWithStack","code","isErrorEvent","isError","isPlainObject","groups","unhandledRejectionToProperties","ev","detail","getUnhandledRejectionError","posthogErrorWrappingFunctions","wrapOnError","captureFn","originalOnError","onerror","_originalOnError","__POSTHOG_INSTRUMENTED__","_win$onerror","wrapUnhandledRejection","originalOnUnhandledRejection","onunhandledrejection","_originalOnUnhandledR","_win$onunhandledrejec","errorWrappingFunctions","parseErrorAsProperties","addTracingHeaders","sessionManager","sessionId","windowId","checkAndGetSessionAndWindowId","patchFns","_patchFetch","_patchXHR","tracingHeadersPatchFns","postHogTracingHeadersPatchFns","self","getEntriesByType","responseStart","domInteractive","domContentLoadedEventStart","domComplete","toUpperCase","o","u","persisted","timeStamp","activationStart","prerendering","wasDiscarded","delta","navigationType","buffered","visibilityState","T","E","S","firstHiddenTime","L","C","max","reportAllChanges","M","I","k","A","interactionId","F","interactionCount","P","durationThreshold","B","O","R","q","H","latency","N","requestIdleCallback","W","z","PerformanceEventTiming","j","takeRecords","U","V","_","G","J","K","Q","X","Y","nt","processingEnd","renderTime","processingStart","it","at","postHogWebVitalsCallbacks","once","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","requestStart","navigationEntry","lcpEntry","lcpResourceEntry","attribution","hadRecentInput","sources","largestShiftTarget","largestShiftTime","largestShiftValue","largestShiftSource","largestShiftEntry","loadState","firstByteToFCP","fcpEntry","onINP","interactionTarget","interactionTargetElement","interactionType","interactionTime","nextPaintTime","processedEventEntries","longAnimationFrameEntries","inputDelay","processingDuration","presentationDelay","limitText","previousElementSibling","_el","getPropertiesFromElement","maskAllAttributes","maskText","elementAttributeIgnorelist","nthChild","nthOfType","currentElem","autocapturePropertiesForElement","_elementsJson$","_elementsJson$2","maskAllElementAttributes","maskAllText","elementAttributeIgnoreList","elementsChainAsString","targetElementList","externalHref","elementsJson","autocaptureAugmentProperties","explicitNoCapture","shouldCaptureEl","augmentProperties","propertyKey","propertyValue","getAugmentPropertiesFromElement","_convertToURL","hrefHost","locationHost","$event_type","$ce_version","$elements_chain","$external_click_url","cachedImplementations","getNativeMutationObserverImplementation","cached","impl","sandbox","hidden","getNativeImplementation","asClick","eventTarget","srcElement","_e$target","originalEvent","checkTimeout","thresholdMs","LazyLoadedDeadClicksAutocapture","asRequiredConfig","providedConfig","_providedConfig$eleme","_providedConfig$scrol","_providedConfig$selec","_providedConfig$mutat","defaultConfig","_defaultConfig","__onCapture","_captureDeadClick","element_attribute_ignorelist","scroll_threshold_ms","selection_change_threshold_ms","mutation_threshold_ms","defaultOnCapture","click","_ignoreClick","_clicks","_checkClickTimer","_checkClicks","candidateNow","scrollDelayMs","_lastSelectionChanged","_config","_onCapture","observerTarget","_startClickObserver","_startScrollObserver","_startSelectionChangedObserver","_startMutationObserver","_mutationObserver","NativeMutationObserver","onMutation","stop","_this$_mutationObserv","_onClick","_onScroll","_onSelectionChange","_mutations","_lastMutation","_el$closest","alreadyClickedInLastSecond","clicksToCheck","_click$mutationDelayM","mutationDelayMs","absoluteDelayMs","selectionChangedDelayMs","scrollTimeout","selectionChangedTimeout","mutationTimeout","absoluteTimeout","hadScroll","hadMutation","hadSelectionChange","$dead_click_last_mutation_timestamp","$dead_click_event_timestamp","$dead_click_scroll_timeout","$dead_click_mutation_timeout","$dead_click_absolute_timeout","$dead_click_selection_changed_timeout","mask_all_element_attributes","mask_all_text","$dead_click_scroll_delay_ms","$dead_click_mutation_delay_ms","$dead_click_absolute_delay_ms","$dead_click_selection_changed_delay_ms","initDeadClicksAutocapture","ph"],"mappings":"o4CAGIA,aAHAC,EAAYC,OAAOC,eAEnBC,EAAgBA,CAACC,EAAKC,EAAKC,IADTC,EAACH,EAAKC,EAAKC,IAAUD,KAAOD,EAAMJ,EAAUI,EAAKC,EAAK,CAAEG,YAAY,EAAMC,cAAc,EAAMC,UAAU,E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ClD,EAAM+B,0BAElD,CACIjlD,UAAW,IAAIjc,KAAKm/D,EAAMljD,YAGtC,EAGJoV,GAAiBwO,sBAAwBxO,GAAiBwO,uBAAyB,CAAE,EACrFxO,GAAiBwO,sBAAsByiC,0BAA4B,CAACC,EAAIzhC,IACpE,IAAIq9B,GAAgCoE,EAAIzhC","x_google_ignoreList":[0,1,18,27,44]}
1
+ {"version":3,"file":"all-external-dependencies.js","sources":["../node_modules/.pnpm/@rrweb+record@2.0.0-alpha.17_patch_hash=46frarym7rupyfspsu67b3afhe/node_modules/@rrweb/record/dist/record.js","../node_modules/.pnpm/@rrweb+rrweb-plugin-console-record@2.0.0-alpha.17_patch_hash=ytsspyi7p3hvqcq64vqb7wb6bu_rrweb@2.0.0-alpha.17/node_modules/@rrweb/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.js","../src/utils/globals.ts","../src/types.ts","../src/utils/string-utils.ts","../src/utils/type-utils.ts","../src/utils/logger.ts","../src/utils/index.ts","../src/utils/request-utils.ts","../src/extensions/replay/rrweb-plugins/patch.ts","../src/extensions/replay/external/denylist.ts","../src/constants.ts","../src/utils/element-utils.ts","../src/autocapture-utils.ts","../src/extensions/replay/config.ts","../src/extensions/replay/external/network-plugin.ts","../src/entrypoints/recorder.ts","../src/posthog-surveys-types.ts","../node_modules/.pnpm/preact@10.19.3/node_modules/preact/dist/preact.module.js","../src/extensions/utils/stylesheet-loader.ts","../src/extensions/surveys/surveys-utils.tsx","../src/utils/event-utils.ts","../src/utils/regex-utils.ts","../src/utils/simple-event-emitter.ts","../src/extensions/surveys/action-matcher.ts","../src/utils/survey-event-receiver.ts","../src/posthog-surveys.ts","../node_modules/.pnpm/preact@10.19.3/node_modules/preact/hooks/dist/hooks.module.js","../src/extensions/surveys-widget.ts","../src/extensions/surveys/icons.tsx","../src/extensions/surveys/components/PostHogLogo.tsx","../src/extensions/surveys/components/BottomSection.tsx","../src/extensions/surveys/components/QuestionHeader.tsx","../src/extensions/surveys/components/ConfirmationMessage.tsx","../src/extensions/surveys/hooks/useContrastingTextColor.ts","../src/extensions/surveys/components/QuestionTypes.tsx","../src/extensions/surveys.tsx","../src/extensions/exception-autocapture/type-checking.ts","../src/entrypoints/surveys.ts","../src/extensions/exception-autocapture/stack-trace.ts","../src/extensions/exception-autocapture/chunk-ids.ts","../src/extensions/exception-autocapture/error-conversion.ts","../src/entrypoints/exception-autocapture.ts","../src/entrypoints/tracing-headers.ts","../node_modules/.pnpm/web-vitals@4.2.4/node_modules/web-vitals/dist/web-vitals.attribution.js","../src/entrypoints/web-vitals.ts","../src/autocapture.ts","../src/utils/prototype-utils.ts","../src/entrypoints/dead-clicks-autocapture.ts"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar _a;\nvar __defProp$1 = Object.defineProperty;\nvar __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar NodeType$2 = /* @__PURE__ */ ((NodeType2) => {\n NodeType2[NodeType2[\"Document\"] = 0] = \"Document\";\n NodeType2[NodeType2[\"DocumentType\"] = 1] = \"DocumentType\";\n NodeType2[NodeType2[\"Element\"] = 2] = \"Element\";\n NodeType2[NodeType2[\"Text\"] = 3] = \"Text\";\n NodeType2[NodeType2[\"CDATA\"] = 4] = \"CDATA\";\n NodeType2[NodeType2[\"Comment\"] = 5] = \"Comment\";\n return NodeType2;\n})(NodeType$2 || {});\nconst testableAccessors$1 = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods$1 = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\n\n/*\nAngular zone patches many things and can pass the untainted checks below, causing performance issues\nAngular zone, puts the unpatched originals on the window, and the names for hose on the zone object.\nSo, we get the unpatched versions from the window object if they exist.\nYou can rename Zone, but this is a good enough proxy to avoid going to an iframe to get the untainted versions.\nsee: https://github.com/angular/angular/issues/26948\n*/\nfunction angularZoneUnpatchedAlternative(key) {\n const angularUnpatchedVersionSymbol = (\n globalThis\n )?.Zone?.__symbol__?.(key);\n if (\n angularUnpatchedVersionSymbol &&\n (globalThis)[angularUnpatchedVersionSymbol]\n ) {\n return (globalThis)[\n angularUnpatchedVersionSymbol\n ];\n } else {\n return undefined;\n }\n}\n\nconst untaintedBasePrototype$1 = {};\nfunction getUntaintedPrototype$1(key) {\n if (untaintedBasePrototype$1[key])\n return untaintedBasePrototype$1[key];\n const defaultObj = angularZoneUnpatchedAlternative(key) || globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a2, _b;\n return Boolean(\n (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a2;\n return typeof defaultPrototype[method] === \"function\" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods) {\n untaintedBasePrototype$1[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultObj.prototype;\n return untaintedBasePrototype$1[key] = untaintedObject;\n } catch {\n return defaultObj.prototype;\n }\n}\nconst untaintedAccessorCache$1 = {};\nfunction getUntaintedAccessor$1(key, instance, accessor) {\n var _a2;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache$1[cacheKey])\n return untaintedAccessorCache$1[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype$1(key);\n const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a2.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache$1[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache$1 = {};\nfunction getUntaintedMethod$1(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache$1[cacheKey])\n return untaintedMethodCache$1[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype$1(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache$1[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"childNodes\");\n}\nfunction parentNode$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"parentNode\");\n}\nfunction parentElement$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"parentElement\");\n}\nfunction textContent$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"textContent\");\n}\nfunction contains$1(n2, other) {\n return getUntaintedMethod$1(\"Node\", n2, \"contains\")(other);\n}\nfunction getRootNode$1(n2) {\n return getUntaintedMethod$1(\"Node\", n2, \"getRootNode\")();\n}\nfunction host$1(n2) {\n if (!n2 || !(\"host\" in n2)) return null;\n return getUntaintedAccessor$1(\"ShadowRoot\", n2, \"host\");\n}\nfunction styleSheets$1(n2) {\n return n2.styleSheets;\n}\nfunction shadowRoot$1(n2) {\n if (!n2 || !(\"shadowRoot\" in n2)) return null;\n return getUntaintedAccessor$1(\"Element\", n2, \"shadowRoot\");\n}\nfunction querySelector$1(n2, selectors) {\n return getUntaintedAccessor$1(\"Element\", n2, \"querySelector\")(selectors);\n}\nfunction querySelectorAll$1(n2, selectors) {\n return getUntaintedAccessor$1(\"Element\", n2, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor$1() {\n return getUntaintedPrototype$1(\"MutationObserver\").constructor;\n}\nconst index$1 = {\n childNodes: childNodes$1,\n parentNode: parentNode$1,\n parentElement: parentElement$1,\n textContent: textContent$1,\n contains: contains$1,\n getRootNode: getRootNode$1,\n host: host$1,\n styleSheets: styleSheets$1,\n shadowRoot: shadowRoot$1,\n querySelector: querySelector$1,\n querySelectorAll: querySelectorAll$1,\n mutationObserver: mutationObserverCtor$1\n};\nfunction isElement(n2) {\n return n2.nodeType === n2.ELEMENT_NODE;\n}\nfunction isShadowRoot(n2) {\n const hostEl = (\n // anchor and textarea elements also have a `host` property\n // but only shadow roots have a `mode` property\n n2 && \"host\" in n2 && \"mode\" in n2 && index$1.host(n2) || null\n );\n return Boolean(\n hostEl && \"shadowRoot\" in hostEl && index$1.shadowRoot(hostEl) === n2\n );\n}\nfunction isNativeShadowDom(shadowRoot2) {\n return Object.prototype.toString.call(shadowRoot2) === \"[object ShadowRoot]\";\n}\nfunction fixBrowserCompatibilityIssuesInCSS(cssText) {\n if (cssText.includes(\" background-clip: text;\") && !cssText.includes(\" -webkit-background-clip: text;\")) {\n cssText = cssText.replace(\n /\\sbackground-clip:\\s*text;/g,\n \" -webkit-background-clip: text; background-clip: text;\"\n );\n }\n return cssText;\n}\nfunction escapeImportStatement(rule2) {\n const { cssText } = rule2;\n if (cssText.split('\"').length < 3) return cssText;\n const statement = [\"@import\", `url(${JSON.stringify(rule2.href)})`];\n if (rule2.layerName === \"\") {\n statement.push(`layer`);\n } else if (rule2.layerName) {\n statement.push(`layer(${rule2.layerName})`);\n }\n if (rule2.supportsText) {\n statement.push(`supports(${rule2.supportsText})`);\n }\n if (rule2.media.length) {\n statement.push(rule2.media.mediaText);\n }\n return statement.join(\" \") + \";\";\n}\nfunction stringifyStylesheet(s2) {\n try {\n const rules2 = s2.rules || s2.cssRules;\n if (!rules2) {\n return null;\n }\n const stringifiedRules = Array.from(\n rules2,\n (rule2) => stringifyRule(rule2, s2.href)\n ).join(\"\");\n return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);\n } catch (error) {\n return null;\n }\n}\nfunction stringifyRule(rule2, sheetHref) {\n if (isCSSImportRule(rule2)) {\n let importStringified;\n try {\n importStringified = // for same-origin stylesheets,\n // we can access the imported stylesheet rules directly\n stringifyStylesheet(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement\n escapeImportStatement(rule2);\n } catch (error) {\n importStringified = rule2.cssText;\n }\n if (rule2.styleSheet.href) {\n return absolutifyURLs(importStringified, rule2.styleSheet.href);\n }\n return importStringified;\n } else {\n let ruleStringified = rule2.cssText;\n if (isCSSStyleRule(rule2) && rule2.selectorText.includes(\":\")) {\n ruleStringified = fixSafariColons(ruleStringified);\n }\n if (sheetHref) {\n return absolutifyURLs(ruleStringified, sheetHref);\n }\n return ruleStringified;\n }\n}\nfunction fixSafariColons(cssStringified) {\n const regex = /(\\[(?:[\\w-]+)[^\\\\])(:(?:[\\w-]+)\\])/gm;\n return cssStringified.replace(regex, \"$1\\\\$2\");\n}\nfunction isCSSImportRule(rule2) {\n return \"styleSheet\" in rule2;\n}\nfunction isCSSStyleRule(rule2) {\n return \"selectorText\" in rule2;\n}\nfunction findStylesheet(doc, href) {\n return Array.from(doc.styleSheets).find((s) => s.href === href);\n}\nclass Mirror {\n constructor() {\n __publicField$1(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField$1(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n2) {\n var _a2;\n if (!n2) return -1;\n const id = (_a2 = this.getMeta(n2)) == null ? void 0 : _a2.id;\n return id ?? -1;\n }\n getNode(id) {\n return this.idNodeMap.get(id) || null;\n }\n getIds() {\n return Array.from(this.idNodeMap.keys());\n }\n getMeta(n2) {\n return this.nodeMetaMap.get(n2) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n2) {\n const id = this.getId(n2);\n this.idNodeMap.delete(id);\n if (n2.childNodes) {\n n2.childNodes.forEach(\n (childNode) => this.removeNodeFromMap(childNode)\n );\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node2) {\n return this.nodeMetaMap.has(node2);\n }\n add(n2, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n2);\n this.nodeMetaMap.set(n2, meta);\n }\n replace(id, n2) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n2, meta);\n }\n this.idNodeMap.set(id, n2);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction createMirror$2() {\n return new Mirror();\n}\nfunction maskInputValue({\n element,\n maskInputOptions,\n tagName,\n type,\n value,\n maskInputFn\n}) {\n let text = value || \"\";\n const actualType = type && toLowerCase(type);\n if (maskInputOptions[tagName.toLowerCase()] || actualType && maskInputOptions[actualType]) {\n if (maskInputFn) {\n text = maskInputFn(text, element);\n } else {\n text = \"*\".repeat(text.length);\n }\n }\n return text;\n}\nfunction toLowerCase(str) {\n return str.toLowerCase();\n}\nconst ORIGINAL_ATTRIBUTE_NAME = \"__rrweb_original__\";\nfunction is2DCanvasBlank(canvas) {\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return true;\n const chunkSize = 50;\n for (let x2 = 0; x2 < canvas.width; x2 += chunkSize) {\n for (let y = 0; y < canvas.height; y += chunkSize) {\n const getImageData = ctx.getImageData;\n const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;\n const pixelBuffer = new Uint32Array(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n originalGetImageData.call(\n ctx,\n x2,\n y,\n Math.min(chunkSize, canvas.width - x2),\n Math.min(chunkSize, canvas.height - y)\n ).data.buffer\n );\n if (pixelBuffer.some((pixel) => pixel !== 0)) return false;\n }\n }\n return true;\n}\nfunction getInputType(element) {\n const type = element.type;\n return element.hasAttribute(\"data-rr-is-password\") ? \"password\" : type ? (\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n toLowerCase(type)\n ) : null;\n}\nfunction extractFileExtension(path, baseURL) {\n let url;\n try {\n url = new URL(path, baseURL ?? window.location.href);\n } catch (err) {\n return null;\n }\n const regex = /\\.([0-9a-z]+)(?:$)/i;\n const match = url.pathname.match(regex);\n return (match == null ? void 0 : match[1]) ?? null;\n}\nfunction extractOrigin(url) {\n let origin = \"\";\n if (url.indexOf(\"//\") > -1) {\n origin = url.split(\"/\").slice(0, 3).join(\"/\");\n } else {\n origin = url.split(\"/\")[0];\n }\n origin = origin.split(\"?\")[0];\n return origin;\n}\nconst URL_IN_CSS_REF = /url\\((?:(')([^']*)'|(\")(.*?)\"|([^)]*))\\)/gm;\nconst URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\\/\\//i;\nconst URL_WWW_MATCH = /^www\\..*/i;\nconst DATA_URI = /^(data:)([^,]*),(.*)/i;\nfunction absolutifyURLs(cssText, href) {\n return (cssText || \"\").replace(\n URL_IN_CSS_REF,\n (origin, quote1, path1, quote2, path2, path3) => {\n const filePath = path1 || path2 || path3;\n const maybeQuote = quote1 || quote2 || \"\";\n if (!filePath) {\n return origin;\n }\n if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {\n return `url(${maybeQuote}${filePath}${maybeQuote})`;\n }\n if (DATA_URI.test(filePath)) {\n return `url(${maybeQuote}${filePath}${maybeQuote})`;\n }\n if (filePath[0] === \"/\") {\n return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;\n }\n const stack = href.split(\"/\");\n const parts = filePath.split(\"/\");\n stack.pop();\n for (const part of parts) {\n if (part === \".\") {\n continue;\n } else if (part === \"..\") {\n stack.pop();\n } else {\n stack.push(part);\n }\n }\n return `url(${maybeQuote}${stack.join(\"/\")}${maybeQuote})`;\n }\n );\n}\nlet _id = 1;\nconst tagNameRegex = new RegExp(\"[^a-z0-9-_:]\");\nconst IGNORED_NODE = -2;\nfunction genId() {\n return _id++;\n}\nfunction getValidTagName$1(element) {\n if (element instanceof HTMLFormElement) {\n return \"form\";\n }\n const processedTagName = toLowerCase(element.tagName);\n if (tagNameRegex.test(processedTagName)) {\n return \"div\";\n }\n return processedTagName;\n}\nlet canvasService;\nlet canvasCtx;\nconst SRCSET_NOT_SPACES = /^[^ \\t\\n\\r\\u000c]+/;\nconst SRCSET_COMMAS_OR_SPACES = /^[, \\t\\n\\r\\u000c]+/;\nfunction getAbsoluteSrcsetString(doc, attributeValue) {\n if (attributeValue.trim() === \"\") {\n return attributeValue;\n }\n let pos = 0;\n function collectCharacters(regEx) {\n let chars2;\n const match = regEx.exec(attributeValue.substring(pos));\n if (match) {\n chars2 = match[0];\n pos += chars2.length;\n return chars2;\n }\n return \"\";\n }\n const output = [];\n while (true) {\n collectCharacters(SRCSET_COMMAS_OR_SPACES);\n if (pos >= attributeValue.length) {\n break;\n }\n let url = collectCharacters(SRCSET_NOT_SPACES);\n if (url.slice(-1) === \",\") {\n url = absoluteToDoc(doc, url.substring(0, url.length - 1));\n output.push(url);\n } else {\n let descriptorsStr = \"\";\n url = absoluteToDoc(doc, url);\n let inParens = false;\n while (true) {\n const c2 = attributeValue.charAt(pos);\n if (c2 === \"\") {\n output.push((url + descriptorsStr).trim());\n break;\n } else if (!inParens) {\n if (c2 === \",\") {\n pos += 1;\n output.push((url + descriptorsStr).trim());\n break;\n } else if (c2 === \"(\") {\n inParens = true;\n }\n } else {\n if (c2 === \")\") {\n inParens = false;\n }\n }\n descriptorsStr += c2;\n pos += 1;\n }\n }\n }\n return output.join(\", \");\n}\nconst cachedDocument = /* @__PURE__ */ new WeakMap();\nfunction absoluteToDoc(doc, attributeValue) {\n if (!attributeValue || attributeValue.trim() === \"\") {\n return attributeValue;\n }\n return getHref(doc, attributeValue);\n}\nfunction isSVGElement(el) {\n return Boolean(el.tagName === \"svg\" || el.ownerSVGElement);\n}\nfunction getHref(doc, customHref) {\n let a2 = cachedDocument.get(doc);\n if (!a2) {\n a2 = doc.createElement(\"a\");\n cachedDocument.set(doc, a2);\n }\n if (!customHref) {\n customHref = \"\";\n } else if (customHref.startsWith(\"blob:\") || customHref.startsWith(\"data:\")) {\n return customHref;\n }\n a2.setAttribute(\"href\", customHref);\n return a2.href;\n}\nfunction transformAttribute(doc, tagName, name, value) {\n if (!value) {\n return value;\n }\n if (name === \"src\" || name === \"href\" && !(tagName === \"use\" && value[0] === \"#\")) {\n return absoluteToDoc(doc, value);\n } else if (name === \"xlink:href\" && value[0] !== \"#\") {\n return absoluteToDoc(doc, value);\n } else if (name === \"background\" && (tagName === \"table\" || tagName === \"td\" || tagName === \"th\")) {\n return absoluteToDoc(doc, value);\n } else if (name === \"srcset\") {\n return getAbsoluteSrcsetString(doc, value);\n } else if (name === \"style\") {\n return absolutifyURLs(value, getHref(doc));\n } else if (tagName === \"object\" && name === \"data\") {\n return absoluteToDoc(doc, value);\n }\n return value;\n}\nfunction ignoreAttribute(tagName, name, _value) {\n return (tagName === \"video\" || tagName === \"audio\") && name === \"autoplay\";\n}\nfunction _isBlockedElement(element, blockClass, blockSelector) {\n try {\n if (typeof blockClass === \"string\") {\n if (element.classList.contains(blockClass)) {\n return true;\n }\n } else {\n for (let eIndex = element.classList.length; eIndex--; ) {\n const className = element.classList[eIndex];\n if (blockClass.test(className)) {\n return true;\n }\n }\n }\n if (blockSelector) {\n return element.matches(blockSelector);\n }\n } catch (e2) {\n }\n return false;\n}\nfunction classMatchesRegex(node2, regex, checkAncestors) {\n if (!node2) return false;\n if (node2.nodeType !== node2.ELEMENT_NODE) {\n if (!checkAncestors) return false;\n return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);\n }\n for (let eIndex = node2.classList.length; eIndex--; ) {\n const className = node2.classList[eIndex];\n if (regex.test(className)) {\n return true;\n }\n }\n if (!checkAncestors) return false;\n return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);\n}\nfunction needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors) {\n let el;\n if (isElement(node2)) {\n el = node2;\n if (!index$1.childNodes(el).length) {\n return false;\n }\n } else if (index$1.parentElement(node2) === null) {\n return false;\n } else {\n el = index$1.parentElement(node2);\n }\n try {\n if (typeof maskTextClass === \"string\") {\n if (checkAncestors) {\n if (el.closest(`.${maskTextClass}`)) return true;\n } else {\n if (el.classList.contains(maskTextClass)) return true;\n }\n } else {\n if (classMatchesRegex(el, maskTextClass, checkAncestors)) return true;\n }\n if (maskTextSelector) {\n if (checkAncestors) {\n if (el.closest(maskTextSelector)) return true;\n } else {\n if (el.matches(maskTextSelector)) return true;\n }\n }\n } catch (e2) {\n }\n return false;\n}\nfunction onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {\n const win = iframeEl.contentWindow;\n if (!win) {\n return;\n }\n let fired = false;\n let readyState;\n try {\n readyState = win.document.readyState;\n } catch (error) {\n return;\n }\n if (readyState !== \"complete\") {\n const timer = setTimeout(() => {\n if (!fired) {\n listener();\n fired = true;\n }\n }, iframeLoadTimeout);\n iframeEl.addEventListener(\"load\", () => {\n clearTimeout(timer);\n fired = true;\n listener();\n });\n return;\n }\n const blankUrl = \"about:blank\";\n if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === \"\") {\n setTimeout(listener, 0);\n return iframeEl.addEventListener(\"load\", listener);\n }\n iframeEl.addEventListener(\"load\", listener);\n}\nfunction onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {\n let fired = false;\n let styleSheetLoaded;\n try {\n styleSheetLoaded = link.sheet;\n } catch (error) {\n return;\n }\n if (styleSheetLoaded) return;\n const timer = setTimeout(() => {\n if (!fired) {\n listener();\n fired = true;\n }\n }, styleSheetLoadTimeout);\n link.addEventListener(\"load\", () => {\n clearTimeout(timer);\n fired = true;\n listener();\n });\n}\nfunction serializeNode(n2, options) {\n const {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n inlineStylesheet,\n maskInputOptions = {},\n maskTextFn,\n maskInputFn,\n dataURLOptions = {},\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement = false\n } = options;\n const rootId = getRootId(doc, mirror2);\n switch (n2.nodeType) {\n case n2.DOCUMENT_NODE:\n if (n2.compatMode !== \"CSS1Compat\") {\n return {\n type: NodeType$2.Document,\n childNodes: [],\n compatMode: n2.compatMode\n // probably \"BackCompat\"\n };\n } else {\n return {\n type: NodeType$2.Document,\n childNodes: []\n };\n }\n case n2.DOCUMENT_TYPE_NODE:\n return {\n type: NodeType$2.DocumentType,\n name: n2.name,\n publicId: n2.publicId,\n systemId: n2.systemId,\n rootId\n };\n case n2.ELEMENT_NODE:\n return serializeElementNode(n2, {\n doc,\n blockClass,\n blockSelector,\n inlineStylesheet,\n maskInputOptions,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement,\n rootId\n });\n case n2.TEXT_NODE:\n return serializeTextNode(n2, {\n doc,\n needsMask,\n maskTextFn,\n rootId\n });\n case n2.CDATA_SECTION_NODE:\n return {\n type: NodeType$2.CDATA,\n textContent: \"\",\n rootId\n };\n case n2.COMMENT_NODE:\n return {\n type: NodeType$2.Comment,\n textContent: index$1.textContent(n2) || \"\",\n rootId\n };\n default:\n return false;\n }\n}\nfunction getRootId(doc, mirror2) {\n if (!mirror2.hasNode(doc)) return void 0;\n const docId = mirror2.getId(doc);\n return docId === 1 ? void 0 : docId;\n}\nfunction serializeTextNode(n2, options) {\n var _a2;\n const { needsMask, maskTextFn, rootId } = options;\n const parent = index$1.parentNode(n2);\n const parentTagName = parent && parent.tagName;\n let text = index$1.textContent(n2);\n const isStyle = parentTagName === \"STYLE\" ? true : void 0;\n const isScript = parentTagName === \"SCRIPT\" ? true : void 0;\n if (isStyle && text) {\n try {\n if (n2.nextSibling || n2.previousSibling) {\n } else if ((_a2 = parent.sheet) == null ? void 0 : _a2.cssRules) {\n text = stringifyStylesheet(parent.sheet);\n }\n } catch (err) {\n console.warn(\n `Cannot get CSS styles from text's parentNode. Error: ${err}`,\n n2\n );\n }\n text = absolutifyURLs(text, getHref(options.doc));\n }\n if (isScript) {\n text = \"SCRIPT_PLACEHOLDER\";\n }\n if (!isStyle && !isScript && text && needsMask) {\n text = maskTextFn ? maskTextFn(text, index$1.parentElement(n2)) : text.replace(/[\\S]/g, \"*\");\n }\n return {\n type: NodeType$2.Text,\n textContent: text || \"\",\n isStyle,\n rootId\n };\n}\n\n/**\n * in production, we've seen elements like\n * `<link type=\"text/css\" rel=\"stylesheet\" id=\"dark-mode-custom-link\"></link>`\n * while HTMLLinkElement suggests an href is always present\n * the w3c spec is less specific\n * and regardless we've seen at least one instance of this in the wild\n * let's be defensive and make sure this is typed as possibly undefined\n */\nfunction hrefFrom(n) {\n return n?.href;\n}\n\nfunction serializeElementNode(n2, options) {\n const {\n doc,\n blockClass,\n blockSelector,\n inlineStylesheet,\n maskInputOptions = {},\n maskInputFn,\n dataURLOptions = {},\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement = false,\n rootId\n } = options;\n const needBlock = _isBlockedElement(n2, blockClass, blockSelector);\n const tagName = getValidTagName$1(n2);\n let attributes = {};\n const len = n2.attributes.length;\n for (let i2 = 0; i2 < len; i2++) {\n const attr = n2.attributes[i2];\n if (!ignoreAttribute(tagName, attr.name, attr.value)) {\n attributes[attr.name] = transformAttribute(\n doc,\n tagName,\n toLowerCase(attr.name),\n attr.value\n );\n }\n }\n if (tagName === \"link\" && inlineStylesheet) {\n const href = hrefFrom(n2);\n if (href) {\n let stylesheet = findStylesheet(doc, href);\n if (!stylesheet && href.includes('.css')) {\n const rootDomain = window.location.origin;\n const stylesheetPath = href.replace(window.location.href, '');\n const potentialStylesheetHref = rootDomain + '/' + stylesheetPath;\n stylesheet = findStylesheet(doc, potentialStylesheetHref);\n }\n let cssText = null;\n if (stylesheet) {\n cssText = stringifyStylesheet(stylesheet);\n }\n if (cssText) {\n delete attributes.rel;\n delete attributes.href;\n attributes._cssText = cssText;\n }\n }\n }\n if (tagName === \"style\" && n2.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element\n !(n2.innerText || index$1.textContent(n2) || \"\").trim().length) {\n const cssText = stringifyStylesheet(\n n2.sheet\n );\n if (cssText) {\n attributes._cssText = cssText;\n }\n }\n if (tagName === \"input\" || tagName === \"textarea\" || tagName === \"select\") {\n const value = n2.value;\n const checked = n2.checked;\n if (attributes.type !== \"radio\" && attributes.type !== \"checkbox\" && attributes.type !== \"submit\" && attributes.type !== \"button\" && value) {\n attributes.value = maskInputValue({\n element: n2,\n type: getInputType(n2),\n tagName,\n value,\n maskInputOptions,\n maskInputFn\n });\n } else if (checked) {\n attributes.checked = checked;\n }\n }\n if (tagName === \"option\") {\n if (n2.selected && !maskInputOptions[\"select\"]) {\n attributes.selected = true;\n } else {\n delete attributes.selected;\n }\n }\n if (tagName === \"dialog\" && n2.open) {\n try {\n attributes.rr_open_mode = n2.matches(\"dialog:modal\") ? \"modal\" : \"non-modal\";\n } catch {\n // likely this is safari not able to deal with the `:modal` selector\n // we can't detect whether the dialog is modal or non-modal open, so have to guess\n // hopefully this is only safari 15.4 and 15.5\n attributes.rr_open_mode = \"modal\"\n attributes.ph_rr_could_not_detect_modal = true\n }\n }\n if (tagName === \"canvas\" && recordCanvas) {\n if (n2.__context === \"2d\") {\n if (!is2DCanvasBlank(n2)) {\n attributes.rr_dataURL = n2.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n }\n } else if (!(\"__context\" in n2)) {\n const canvasDataURL = n2.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n const blankCanvas = doc.createElement(\"canvas\");\n blankCanvas.width = n2.width;\n blankCanvas.height = n2.height;\n const blankCanvasDataURL = blankCanvas.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n if (canvasDataURL !== blankCanvasDataURL) {\n attributes.rr_dataURL = canvasDataURL;\n }\n }\n }\n if (tagName === \"img\" && inlineImages) {\n if (!canvasService) {\n canvasService = doc.createElement(\"canvas\");\n canvasCtx = canvasService.getContext(\"2d\");\n }\n const image = n2;\n const imageSrc = image.currentSrc || image.getAttribute(\"src\") || \"<unknown-src>\";\n const priorCrossOrigin = image.crossOrigin;\n const recordInlineImage = () => {\n image.removeEventListener(\"load\", recordInlineImage);\n try {\n canvasService.width = image.naturalWidth;\n canvasService.height = image.naturalHeight;\n canvasCtx.drawImage(image, 0, 0);\n attributes.rr_dataURL = canvasService.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n } catch (err) {\n if (image.crossOrigin !== \"anonymous\") {\n image.crossOrigin = \"anonymous\";\n if (image.complete && image.naturalWidth !== 0)\n recordInlineImage();\n else image.addEventListener(\"load\", recordInlineImage);\n return;\n } else {\n console.warn(\n `Cannot inline img src=${imageSrc}! Error: ${err}`\n );\n }\n }\n if (image.crossOrigin === \"anonymous\") {\n priorCrossOrigin ? attributes.crossOrigin = priorCrossOrigin : image.removeAttribute(\"crossorigin\");\n }\n };\n if (image.complete && image.naturalWidth !== 0) recordInlineImage();\n else image.addEventListener(\"load\", recordInlineImage);\n }\n if (tagName === \"audio\" || tagName === \"video\") {\n const mediaAttributes = attributes;\n mediaAttributes.rr_mediaState = n2.paused ? \"paused\" : \"played\";\n mediaAttributes.rr_mediaCurrentTime = n2.currentTime;\n mediaAttributes.rr_mediaPlaybackRate = n2.playbackRate;\n mediaAttributes.rr_mediaMuted = n2.muted;\n mediaAttributes.rr_mediaLoop = n2.loop;\n mediaAttributes.rr_mediaVolume = n2.volume;\n }\n if (!newlyAddedElement) {\n if (n2.scrollLeft) {\n attributes.rr_scrollLeft = n2.scrollLeft;\n }\n if (n2.scrollTop) {\n attributes.rr_scrollTop = n2.scrollTop;\n }\n }\n if (needBlock) {\n const { width, height } = n2.getBoundingClientRect();\n attributes = {\n class: attributes.class,\n rr_width: `${width}px`,\n rr_height: `${height}px`\n };\n }\n if (tagName === \"iframe\" && !keepIframeSrcFn(attributes.src)) {\n if (!n2.contentDocument) {\n attributes.rr_src = attributes.src;\n }\n delete attributes.src;\n }\n let isCustomElement;\n try {\n if (customElements.get(tagName)) isCustomElement = true;\n } catch (e2) {\n }\n return {\n type: NodeType$2.Element,\n tagName,\n attributes,\n childNodes: [],\n isSVG: isSVGElement(n2) || void 0,\n needBlock,\n rootId,\n isCustom: isCustomElement\n };\n}\nfunction lowerIfExists(maybeAttr) {\n if (maybeAttr === void 0 || maybeAttr === null) {\n return \"\";\n } else {\n return maybeAttr.toLowerCase();\n }\n}\nfunction slimDOMExcluded(sn, slimDOMOptions) {\n if (slimDOMOptions.comment && sn.type === NodeType$2.Comment) {\n return true;\n } else if (sn.type === NodeType$2.Element) {\n if (slimDOMOptions.script && // script tag\n (sn.tagName === \"script\" || // (module)preload link\n sn.tagName === \"link\" && (sn.attributes.rel === \"preload\" || sn.attributes.rel === \"modulepreload\") && sn.attributes.as === \"script\" || // prefetch link\n sn.tagName === \"link\" && sn.attributes.rel === \"prefetch\" && typeof sn.attributes.href === \"string\" && extractFileExtension(sn.attributes.href) === \"js\")) {\n return true;\n } else if (slimDOMOptions.headFavicon && (sn.tagName === \"link\" && sn.attributes.rel === \"shortcut icon\" || sn.tagName === \"meta\" && (lowerIfExists(sn.attributes.name).match(\n /^msapplication-tile(image|color)$/\n ) || lowerIfExists(sn.attributes.name) === \"application-name\" || lowerIfExists(sn.attributes.rel) === \"icon\" || lowerIfExists(sn.attributes.rel) === \"apple-touch-icon\" || lowerIfExists(sn.attributes.rel) === \"shortcut icon\"))) {\n return true;\n } else if (sn.tagName === \"meta\") {\n if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {\n return true;\n } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)\n lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === \"pinterest\")) {\n return true;\n } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === \"robots\" || lowerIfExists(sn.attributes.name) === \"googlebot\" || lowerIfExists(sn.attributes.name) === \"bingbot\")) {\n return true;\n } else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes[\"http-equiv\"] !== void 0) {\n return true;\n } else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === \"author\" || lowerIfExists(sn.attributes.name) === \"generator\" || lowerIfExists(sn.attributes.name) === \"framework\" || lowerIfExists(sn.attributes.name) === \"publisher\" || lowerIfExists(sn.attributes.name) === \"progid\" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {\n return true;\n } else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === \"google-site-verification\" || lowerIfExists(sn.attributes.name) === \"yandex-verification\" || lowerIfExists(sn.attributes.name) === \"csrf-token\" || lowerIfExists(sn.attributes.name) === \"p:domain_verify\" || lowerIfExists(sn.attributes.name) === \"verify-v1\" || lowerIfExists(sn.attributes.name) === \"verification\" || lowerIfExists(sn.attributes.name) === \"shopify-checkout-api-token\")) {\n return true;\n }\n }\n }\n return false;\n}\nfunction serializeNodeWithId(n2, options) {\n const {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n skipChild = false,\n inlineStylesheet = true,\n maskInputOptions = {},\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions = {},\n inlineImages = false,\n recordCanvas = false,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout = 5e3,\n onStylesheetLoad,\n stylesheetLoadTimeout = 5e3,\n keepIframeSrcFn = () => false,\n newlyAddedElement = false\n } = options;\n let { needsMask } = options;\n let { preserveWhiteSpace = true } = options;\n if (!needsMask) {\n const checkAncestors = needsMask === void 0;\n needsMask = needMaskingText(\n n2,\n maskTextClass,\n maskTextSelector,\n checkAncestors\n );\n }\n const _serializedNode = serializeNode(n2, {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement\n });\n if (!_serializedNode) {\n console.warn(n2, \"not serialized\");\n return null;\n }\n let id;\n if (mirror2.hasNode(n2)) {\n id = mirror2.getId(n2);\n } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$2.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\\s+|\\s+$/gm, \"\").length) {\n id = IGNORED_NODE;\n } else {\n id = genId();\n }\n const serializedNode = Object.assign(_serializedNode, { id });\n mirror2.add(n2, serializedNode);\n if (id === IGNORED_NODE) {\n return null;\n }\n if (onSerialize) {\n onSerialize(n2);\n }\n let recordChild = !skipChild;\n if (serializedNode.type === NodeType$2.Element) {\n recordChild = recordChild && !serializedNode.needBlock;\n delete serializedNode.needBlock;\n const shadowRootEl = index$1.shadowRoot(n2);\n if (shadowRootEl && isNativeShadowDom(shadowRootEl))\n serializedNode.isShadowHost = true;\n }\n if ((serializedNode.type === NodeType$2.Document || serializedNode.type === NodeType$2.Element) && recordChild) {\n if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$2.Element && serializedNode.tagName === \"head\") {\n preserveWhiteSpace = false;\n }\n const bypassOptions = {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n skipChild,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn\n };\n if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === \"textarea\" && serializedNode.attributes.value !== void 0) ;\n else {\n for (const childN of Array.from(index$1.childNodes(n2))) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n }\n let shadowRootEl = null;\n if (isElement(n2) && (shadowRootEl = index$1.shadowRoot(n2))) {\n for (const childN of Array.from(index$1.childNodes(shadowRootEl))) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n }\n }\n const parent = index$1.parentNode(n2);\n if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {\n serializedNode.isShadow = true;\n }\n if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === \"iframe\") {\n onceIframeLoaded(\n n2,\n () => {\n const iframeDoc = n2.contentDocument;\n if (iframeDoc && onIframeLoad) {\n const serializedIframeNode = serializeNodeWithId(iframeDoc, {\n doc: iframeDoc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn\n });\n if (serializedIframeNode) {\n onIframeLoad(\n n2,\n serializedIframeNode\n );\n }\n }\n },\n iframeLoadTimeout\n );\n }\n if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === \"link\" && typeof serializedNode.attributes.rel === \"string\" && (serializedNode.attributes.rel === \"stylesheet\" || serializedNode.attributes.rel === \"preload\" && typeof serializedNode.attributes.href === \"string\" && extractFileExtension(serializedNode.attributes.href) === \"css\")) {\n onceStylesheetLoaded(\n n2,\n () => {\n if (onStylesheetLoad) {\n const serializedLinkNode = serializeNodeWithId(n2, {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn\n });\n if (serializedLinkNode) {\n onStylesheetLoad(\n n2,\n serializedLinkNode\n );\n }\n }\n },\n stylesheetLoadTimeout\n );\n }\n return serializedNode;\n}\nfunction snapshot(n2, options) {\n const {\n mirror: mirror2 = new Mirror(),\n blockClass = \"rr-block\",\n blockSelector = null,\n maskTextClass = \"rr-mask\",\n maskTextSelector = null,\n inlineStylesheet = true,\n inlineImages = false,\n recordCanvas = false,\n maskAllInputs = false,\n maskTextFn,\n maskInputFn,\n slimDOM = false,\n dataURLOptions,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn = () => false\n } = options || {};\n const maskInputOptions = maskAllInputs === true ? {\n color: true,\n date: true,\n \"datetime-local\": true,\n email: true,\n month: true,\n number: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n time: true,\n url: true,\n week: true,\n textarea: true,\n select: true,\n password: true\n } : maskAllInputs === false ? {\n password: true\n } : maskAllInputs;\n const slimDOMOptions = slimDOM === true || slimDOM === \"all\" ? (\n // if true: set of sensible options that should not throw away any information\n {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaDescKeywords: slimDOM === \"all\",\n // destructive\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaAuthorship: true,\n headMetaVerification: true\n }\n ) : slimDOM === false ? {} : slimDOM;\n return serializeNodeWithId(n2, {\n doc: n2,\n mirror: mirror2,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn,\n newlyAddedElement: false\n });\n}\nfunction getDefaultExportFromCjs$1(x2) {\n return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, \"default\") ? x2[\"default\"] : x2;\n}\nfunction getAugmentedNamespace$1(n2) {\n if (n2.__esModule) return n2;\n var f2 = n2.default;\n if (typeof f2 == \"function\") {\n var a2 = function a22() {\n if (this instanceof a22) {\n return Reflect.construct(f2, arguments, this.constructor);\n }\n return f2.apply(this, arguments);\n };\n a2.prototype = f2.prototype;\n } else a2 = {};\n Object.defineProperty(a2, \"__esModule\", { value: true });\n Object.keys(n2).forEach(function(k) {\n var d = Object.getOwnPropertyDescriptor(n2, k);\n Object.defineProperty(a2, k, d.get ? d : {\n enumerable: true,\n get: function() {\n return n2[k];\n }\n });\n });\n return a2;\n}\n// Removed postcss\nclass BaseRRNode {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n constructor(..._args) {\n __publicField2(this, \"parentElement\", null);\n __publicField2(this, \"parentNode\", null);\n __publicField2(this, \"ownerDocument\");\n __publicField2(this, \"firstChild\", null);\n __publicField2(this, \"lastChild\", null);\n __publicField2(this, \"previousSibling\", null);\n __publicField2(this, \"nextSibling\", null);\n __publicField2(this, \"ELEMENT_NODE\", 1);\n __publicField2(this, \"TEXT_NODE\", 3);\n __publicField2(this, \"nodeType\");\n __publicField2(this, \"nodeName\");\n __publicField2(this, \"RRNodeType\");\n }\n get childNodes() {\n const childNodes2 = [];\n let childIterator = this.firstChild;\n while (childIterator) {\n childNodes2.push(childIterator);\n childIterator = childIterator.nextSibling;\n }\n return childNodes2;\n }\n contains(node2) {\n if (!(node2 instanceof BaseRRNode)) return false;\n else if (node2.ownerDocument !== this.ownerDocument) return false;\n else if (node2 === this) return true;\n while (node2.parentNode) {\n if (node2.parentNode === this) return true;\n node2 = node2.parentNode;\n }\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n appendChild(_newChild) {\n throw new Error(\n `RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n insertBefore(_newChild, _refChild) {\n throw new Error(\n `RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n removeChild(_node) {\n throw new Error(\n `RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n toString() {\n return \"RRNode\";\n }\n}\nconst testableAccessors = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\n/*\nAngular zone patches many things and can pass the untainted checks below, causing performance issues\nAngular zone, puts the unpatched originals on the window, and the names for hose on the zone object.\nSo, we get the unpatched versions from the window object if they exist.\nYou can rename Zone, but this is a good enough proxy to avoid going to an iframe to get the untainted versions.\nsee: https://github.com/angular/angular/issues/26948\n*/\nfunction angularZoneUnpatchedAlternative$1(key) {\n const angularUnpatchedVersionSymbol = (\n globalThis\n )?.Zone?.__symbol__?.(key);\n if (\n angularUnpatchedVersionSymbol &&\n (globalThis)[angularUnpatchedVersionSymbol]\n ) {\n return (globalThis)[\n angularUnpatchedVersionSymbol\n ];\n } else {\n return undefined;\n }\n}\n\nconst untaintedBasePrototype = {};\nfunction getUntaintedPrototype(key) {\n if (untaintedBasePrototype[key])\n return untaintedBasePrototype[key];\n const defaultObj = angularZoneUnpatchedAlternative$1(key) ||globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a2, _b;\n return Boolean(\n (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods ? testableMethods[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a2;\n return typeof defaultPrototype[method] === \"function\" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods) {\n untaintedBasePrototype[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache = {};\nfunction getUntaintedAccessor(key, instance, accessor) {\n var _a2;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache[cacheKey])\n return untaintedAccessorCache[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a2.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache = {};\nfunction getUntaintedMethod(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache[cacheKey])\n return untaintedMethodCache[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"childNodes\");\n}\nfunction parentNode(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"parentNode\");\n}\nfunction parentElement(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"parentElement\");\n}\nfunction textContent(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"textContent\");\n}\nfunction contains(n2, other) {\n return getUntaintedMethod(\"Node\", n2, \"contains\")(other);\n}\nfunction getRootNode(n2) {\n return getUntaintedMethod(\"Node\", n2, \"getRootNode\")();\n}\nfunction host(n2) {\n if (!n2 || !(\"host\" in n2)) return null;\n return getUntaintedAccessor(\"ShadowRoot\", n2, \"host\");\n}\nfunction styleSheets(n2) {\n return n2.styleSheets;\n}\nfunction shadowRoot(n2) {\n if (!n2 || !(\"shadowRoot\" in n2)) return null;\n return getUntaintedAccessor(\"Element\", n2, \"shadowRoot\");\n}\nfunction querySelector(n2, selectors) {\n return getUntaintedAccessor(\"Element\", n2, \"querySelector\")(selectors);\n}\nfunction querySelectorAll(n2, selectors) {\n return getUntaintedAccessor(\"Element\", n2, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor() {\n return getUntaintedPrototype(\"MutationObserver\").constructor;\n}\nconst index = {\n childNodes,\n parentNode,\n parentElement,\n textContent,\n contains,\n getRootNode,\n host,\n styleSheets,\n shadowRoot,\n querySelector,\n querySelectorAll,\n mutationObserver: mutationObserverCtor\n};\nfunction on(type, fn, target = document) {\n const options = { capture: true, passive: true };\n target.addEventListener(type, fn, options);\n return () => target.removeEventListener(type, fn, options);\n}\nconst DEPARTED_MIRROR_ACCESS_WARNING = \"Please stop import mirror directly. Instead of that,\\r\\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\\r\\nor you can use record.mirror to access the mirror instance during recording.\";\nlet _mirror = {\n map: {},\n getId() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return -1;\n },\n getNode() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return null;\n },\n removeNodeFromMap() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n },\n has() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return false;\n },\n reset() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n};\nif (typeof window !== \"undefined\" && window.Proxy && window.Reflect) {\n _mirror = new Proxy(_mirror, {\n get(target, prop, receiver) {\n if (prop === \"map\") {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n return Reflect.get(target, prop, receiver);\n }\n });\n}\nfunction throttle(func, wait, options = {}) {\n let timeout = null;\n let previous = 0;\n return function(...args) {\n const now = Date.now();\n if (!previous && options.leading === false) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n const context = this;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n func.apply(context, args);\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(() => {\n previous = options.leading === false ? 0 : Date.now();\n timeout = null;\n func.apply(context, args);\n }, remaining);\n }\n };\n}\nfunction hookSetter(target, key, d, isRevoked, win = window) {\n const original = win.Object.getOwnPropertyDescriptor(target, key);\n win.Object.defineProperty(\n target,\n key,\n isRevoked ? d : {\n set(value) {\n setTimeout(() => {\n d.set.call(this, value);\n }, 0);\n if (original && original.set) {\n original.set.call(this, value);\n }\n }\n }\n );\n return () => hookSetter(target, key, original || {}, true);\n}\nfunction patch(source, name, replacement) {\n try {\n if (!(name in source)) {\n return () => {\n };\n }\n const original = source[name];\n const wrapped = replacement(original);\n if (typeof wrapped === \"function\") {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original\n }\n });\n }\n source[name] = wrapped;\n return () => {\n source[name] = original;\n };\n } catch {\n return () => {\n };\n }\n}\nlet nowTimestamp = Date.now;\nif (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {\n nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();\n}\nfunction getWindowScroll(win) {\n var _a2, _b, _c, _d;\n const doc = win.document;\n return {\n left: doc.scrollingElement ? doc.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : doc.documentElement.scrollLeft || (doc == null ? void 0 : doc.body) && ((_a2 = index.parentElement(doc.body)) == null ? void 0 : _a2.scrollLeft) || ((_b = doc == null ? void 0 : doc.body) == null ? void 0 : _b.scrollLeft) || 0,\n top: doc.scrollingElement ? doc.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : (doc == null ? void 0 : doc.documentElement.scrollTop) || (doc == null ? void 0 : doc.body) && ((_c = index.parentElement(doc.body)) == null ? void 0 : _c.scrollTop) || ((_d = doc == null ? void 0 : doc.body) == null ? void 0 : _d.scrollTop) || 0\n };\n}\nfunction getWindowHeight() {\n return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;\n}\nfunction getWindowWidth() {\n return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;\n}\nfunction closestElementOfNode(node2) {\n if (!node2) {\n return null;\n }\n const el = node2.nodeType === node2.ELEMENT_NODE ? node2 : index.parentElement(node2);\n return el;\n}\nfunction isBlocked(node2, blockClass, blockSelector, checkAncestors) {\n if (!node2) {\n return false;\n }\n const el = closestElementOfNode(node2);\n if (!el) {\n return false;\n }\n try {\n if (typeof blockClass === \"string\") {\n if (el.classList.contains(blockClass)) return true;\n if (checkAncestors && el.closest(\".\" + blockClass) !== null) return true;\n } else {\n if (classMatchesRegex(el, blockClass, checkAncestors)) return true;\n }\n } catch (e2) {\n }\n if (blockSelector) {\n if (el.matches(blockSelector)) return true;\n if (checkAncestors && el.closest(blockSelector) !== null) return true;\n }\n return false;\n}\nfunction isSerialized(n2, mirror2) {\n return mirror2.getId(n2) !== -1;\n}\nfunction isIgnored(n2, mirror2, slimDOMOptions) {\n if (n2.tagName === \"TITLE\" && slimDOMOptions.headTitleMutations) {\n return true;\n }\n return mirror2.getId(n2) === IGNORED_NODE;\n}\nfunction isAncestorRemoved(target, mirror2) {\n if (isShadowRoot(target)) {\n return false;\n }\n const id = mirror2.getId(target);\n if (!mirror2.has(id)) {\n return true;\n }\n const parent = index.parentNode(target);\n if (parent && parent.nodeType === target.DOCUMENT_NODE) {\n return false;\n }\n if (!parent) {\n return true;\n }\n return isAncestorRemoved(parent, mirror2);\n}\nfunction legacy_isTouchEvent(event) {\n return Boolean(event.changedTouches);\n}\nfunction polyfill$1(win = window) {\n if (\"NodeList\" in win && !win.NodeList.prototype.forEach) {\n win.NodeList.prototype.forEach = Array.prototype.forEach;\n }\n if (\"DOMTokenList\" in win && !win.DOMTokenList.prototype.forEach) {\n win.DOMTokenList.prototype.forEach = Array.prototype.forEach;\n }\n}\nfunction isSerializedIframe(n2, mirror2) {\n return Boolean(n2.nodeName === \"IFRAME\" && mirror2.getMeta(n2));\n}\nfunction isSerializedStylesheet(n2, mirror2) {\n return Boolean(\n n2.nodeName === \"LINK\" && n2.nodeType === n2.ELEMENT_NODE && n2.getAttribute && n2.getAttribute(\"rel\") === \"stylesheet\" && mirror2.getMeta(n2)\n );\n}\nfunction hasShadowRoot(n2) {\n if (!n2) return false;\n if (n2 instanceof BaseRRNode && \"shadowRoot\" in n2) {\n return Boolean(n2.shadowRoot);\n }\n return Boolean(index.shadowRoot(n2));\n}\nclass StyleSheetMirror {\n constructor() {\n __publicField(this, \"id\", 1);\n __publicField(this, \"styleIDMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"idStyleMap\", /* @__PURE__ */ new Map());\n }\n getId(stylesheet) {\n return this.styleIDMap.get(stylesheet) ?? -1;\n }\n has(stylesheet) {\n return this.styleIDMap.has(stylesheet);\n }\n /**\n * @returns If the stylesheet is in the mirror, returns the id of the stylesheet. If not, return the new assigned id.\n */\n add(stylesheet, id) {\n if (this.has(stylesheet)) return this.getId(stylesheet);\n let newId;\n if (id === void 0) {\n newId = this.id++;\n } else newId = id;\n this.styleIDMap.set(stylesheet, newId);\n this.idStyleMap.set(newId, stylesheet);\n return newId;\n }\n getStyle(id) {\n return this.idStyleMap.get(id) || null;\n }\n reset() {\n this.styleIDMap = /* @__PURE__ */ new WeakMap();\n this.idStyleMap = /* @__PURE__ */ new Map();\n this.id = 1;\n }\n generateId() {\n return this.id++;\n }\n}\nfunction getShadowHost(n2) {\n var _a2;\n let shadowHost = null;\n if (\"getRootNode\" in n2 && ((_a2 = index.getRootNode(n2)) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && index.host(index.getRootNode(n2)))\n shadowHost = index.host(index.getRootNode(n2));\n return shadowHost;\n}\nfunction getRootShadowHost(n2) {\n let rootShadowHost = n2;\n let shadowHost;\n while (shadowHost = getShadowHost(rootShadowHost))\n rootShadowHost = shadowHost;\n return rootShadowHost;\n}\nfunction shadowHostInDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n const shadowHost = getRootShadowHost(n2);\n return index.contains(doc, shadowHost);\n}\nfunction inDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n return index.contains(doc, n2) || shadowHostInDom(n2);\n}\nvar EventType = /* @__PURE__ */ ((EventType2) => {\n EventType2[EventType2[\"DomContentLoaded\"] = 0] = \"DomContentLoaded\";\n EventType2[EventType2[\"Load\"] = 1] = \"Load\";\n EventType2[EventType2[\"FullSnapshot\"] = 2] = \"FullSnapshot\";\n EventType2[EventType2[\"IncrementalSnapshot\"] = 3] = \"IncrementalSnapshot\";\n EventType2[EventType2[\"Meta\"] = 4] = \"Meta\";\n EventType2[EventType2[\"Custom\"] = 5] = \"Custom\";\n EventType2[EventType2[\"Plugin\"] = 6] = \"Plugin\";\n return EventType2;\n})(EventType || {});\nvar IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {\n IncrementalSource2[IncrementalSource2[\"Mutation\"] = 0] = \"Mutation\";\n IncrementalSource2[IncrementalSource2[\"MouseMove\"] = 1] = \"MouseMove\";\n IncrementalSource2[IncrementalSource2[\"MouseInteraction\"] = 2] = \"MouseInteraction\";\n IncrementalSource2[IncrementalSource2[\"Scroll\"] = 3] = \"Scroll\";\n IncrementalSource2[IncrementalSource2[\"ViewportResize\"] = 4] = \"ViewportResize\";\n IncrementalSource2[IncrementalSource2[\"Input\"] = 5] = \"Input\";\n IncrementalSource2[IncrementalSource2[\"TouchMove\"] = 6] = \"TouchMove\";\n IncrementalSource2[IncrementalSource2[\"MediaInteraction\"] = 7] = \"MediaInteraction\";\n IncrementalSource2[IncrementalSource2[\"StyleSheetRule\"] = 8] = \"StyleSheetRule\";\n IncrementalSource2[IncrementalSource2[\"CanvasMutation\"] = 9] = \"CanvasMutation\";\n IncrementalSource2[IncrementalSource2[\"Font\"] = 10] = \"Font\";\n IncrementalSource2[IncrementalSource2[\"Log\"] = 11] = \"Log\";\n IncrementalSource2[IncrementalSource2[\"Drag\"] = 12] = \"Drag\";\n IncrementalSource2[IncrementalSource2[\"StyleDeclaration\"] = 13] = \"StyleDeclaration\";\n IncrementalSource2[IncrementalSource2[\"Selection\"] = 14] = \"Selection\";\n IncrementalSource2[IncrementalSource2[\"AdoptedStyleSheet\"] = 15] = \"AdoptedStyleSheet\";\n IncrementalSource2[IncrementalSource2[\"CustomElement\"] = 16] = \"CustomElement\";\n return IncrementalSource2;\n})(IncrementalSource || {});\nvar MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {\n MouseInteractions2[MouseInteractions2[\"MouseUp\"] = 0] = \"MouseUp\";\n MouseInteractions2[MouseInteractions2[\"MouseDown\"] = 1] = \"MouseDown\";\n MouseInteractions2[MouseInteractions2[\"Click\"] = 2] = \"Click\";\n MouseInteractions2[MouseInteractions2[\"ContextMenu\"] = 3] = \"ContextMenu\";\n MouseInteractions2[MouseInteractions2[\"DblClick\"] = 4] = \"DblClick\";\n MouseInteractions2[MouseInteractions2[\"Focus\"] = 5] = \"Focus\";\n MouseInteractions2[MouseInteractions2[\"Blur\"] = 6] = \"Blur\";\n MouseInteractions2[MouseInteractions2[\"TouchStart\"] = 7] = \"TouchStart\";\n MouseInteractions2[MouseInteractions2[\"TouchMove_Departed\"] = 8] = \"TouchMove_Departed\";\n MouseInteractions2[MouseInteractions2[\"TouchEnd\"] = 9] = \"TouchEnd\";\n MouseInteractions2[MouseInteractions2[\"TouchCancel\"] = 10] = \"TouchCancel\";\n return MouseInteractions2;\n})(MouseInteractions || {});\nvar PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {\n PointerTypes2[PointerTypes2[\"Mouse\"] = 0] = \"Mouse\";\n PointerTypes2[PointerTypes2[\"Pen\"] = 1] = \"Pen\";\n PointerTypes2[PointerTypes2[\"Touch\"] = 2] = \"Touch\";\n return PointerTypes2;\n})(PointerTypes || {});\nvar CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {\n CanvasContext2[CanvasContext2[\"2D\"] = 0] = \"2D\";\n CanvasContext2[CanvasContext2[\"WebGL\"] = 1] = \"WebGL\";\n CanvasContext2[CanvasContext2[\"WebGL2\"] = 2] = \"WebGL2\";\n return CanvasContext2;\n})(CanvasContext || {});\nvar MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {\n MediaInteractions2[MediaInteractions2[\"Play\"] = 0] = \"Play\";\n MediaInteractions2[MediaInteractions2[\"Pause\"] = 1] = \"Pause\";\n MediaInteractions2[MediaInteractions2[\"Seeked\"] = 2] = \"Seeked\";\n MediaInteractions2[MediaInteractions2[\"VolumeChange\"] = 3] = \"VolumeChange\";\n MediaInteractions2[MediaInteractions2[\"RateChange\"] = 4] = \"RateChange\";\n return MediaInteractions2;\n})(MediaInteractions || {});\nfunction isNodeInLinkedList(n2) {\n return \"__ln\" in n2;\n}\nclass DoubleLinkedList {\n constructor() {\n __publicField(this, \"length\", 0);\n __publicField(this, \"head\", null);\n __publicField(this, \"tail\", null);\n }\n get(position) {\n if (position >= this.length) {\n throw new Error(\"Position outside of list range\");\n }\n let current = this.head;\n for (let index2 = 0; index2 < position; index2++) {\n current = (current == null ? void 0 : current.next) || null;\n }\n return current;\n }\n addNode(n2) {\n const node2 = {\n value: n2,\n previous: null,\n next: null\n };\n n2.__ln = node2;\n if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) {\n const current = n2.previousSibling.__ln.next;\n node2.next = current;\n node2.previous = n2.previousSibling.__ln;\n n2.previousSibling.__ln.next = node2;\n if (current) {\n current.previous = node2;\n }\n } else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) {\n const current = n2.nextSibling.__ln.previous;\n node2.previous = current;\n node2.next = n2.nextSibling.__ln;\n n2.nextSibling.__ln.previous = node2;\n if (current) {\n current.next = node2;\n }\n } else {\n if (this.head) {\n this.head.previous = node2;\n }\n node2.next = this.head;\n this.head = node2;\n }\n if (node2.next === null) {\n this.tail = node2;\n }\n this.length++;\n }\n removeNode(n2) {\n const current = n2.__ln;\n if (!this.head) {\n return;\n }\n if (!current.previous) {\n this.head = current.next;\n if (this.head) {\n this.head.previous = null;\n } else {\n this.tail = null;\n }\n } else {\n current.previous.next = current.next;\n if (current.next) {\n current.next.previous = current.previous;\n } else {\n this.tail = current.previous;\n }\n }\n if (n2.__ln) {\n delete n2.__ln;\n }\n this.length--;\n }\n}\nconst moveKey = (id, parentId) => `${id}@${parentId}`;\nclass MutationBuffer {\n constructor() {\n __publicField(this, \"frozen\", false);\n __publicField(this, \"locked\", false);\n __publicField(this, \"texts\", []);\n __publicField(this, \"attributes\", []);\n __publicField(this, \"attributeMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"removes\", []);\n __publicField(this, \"mapRemoves\", []);\n __publicField(this, \"movedMap\", {});\n __publicField(this, \"addedSet\", /* @__PURE__ */ new Set());\n __publicField(this, \"movedSet\", /* @__PURE__ */ new Set());\n __publicField(this, \"droppedSet\", /* @__PURE__ */ new Set());\n __publicField(this, \"mutationCb\");\n __publicField(this, \"blockClass\");\n __publicField(this, \"blockSelector\");\n __publicField(this, \"maskTextClass\");\n __publicField(this, \"maskTextSelector\");\n __publicField(this, \"inlineStylesheet\");\n __publicField(this, \"maskInputOptions\");\n __publicField(this, \"maskTextFn\");\n __publicField(this, \"maskInputFn\");\n __publicField(this, \"keepIframeSrcFn\");\n __publicField(this, \"recordCanvas\");\n __publicField(this, \"inlineImages\");\n __publicField(this, \"slimDOMOptions\");\n __publicField(this, \"dataURLOptions\");\n __publicField(this, \"doc\");\n __publicField(this, \"mirror\");\n __publicField(this, \"iframeManager\");\n __publicField(this, \"stylesheetManager\");\n __publicField(this, \"shadowDomManager\");\n __publicField(this, \"canvasManager\");\n __publicField(this, \"processedNodeManager\");\n __publicField(this, \"unattachedDoc\");\n __publicField(this, \"processMutations\", (mutations) => {\n mutations.forEach(this.processMutation);\n this.emit();\n });\n __publicField(this, \"emit\", () => {\n if (this.frozen || this.locked) {\n return;\n }\n const adds = [];\n const addedIds = /* @__PURE__ */ new Set();\n const addList = new DoubleLinkedList();\n const getNextId = (n2) => {\n let ns = n2;\n let nextId = IGNORED_NODE;\n while (nextId === IGNORED_NODE) {\n ns = ns && ns.nextSibling;\n nextId = ns && this.mirror.getId(ns);\n }\n return nextId;\n };\n const pushAdd = (n2) => {\n const parent = index.parentNode(n2);\n if (!parent || !inDom(n2) || parent.tagName === \"TEXTAREA\") {\n return;\n }\n const parentId = isShadowRoot(parent) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(parent);\n const nextId = getNextId(n2);\n if (parentId === -1 || nextId === -1) {\n return addList.addNode(n2);\n }\n const sn = serializeNodeWithId(n2, {\n doc: this.doc,\n mirror: this.mirror,\n blockClass: this.blockClass,\n blockSelector: this.blockSelector,\n maskTextClass: this.maskTextClass,\n maskTextSelector: this.maskTextSelector,\n skipChild: true,\n newlyAddedElement: true,\n inlineStylesheet: this.inlineStylesheet,\n maskInputOptions: this.maskInputOptions,\n maskTextFn: this.maskTextFn,\n maskInputFn: this.maskInputFn,\n slimDOMOptions: this.slimDOMOptions,\n dataURLOptions: this.dataURLOptions,\n recordCanvas: this.recordCanvas,\n inlineImages: this.inlineImages,\n onSerialize: (currentN) => {\n if (isSerializedIframe(currentN, this.mirror)) {\n this.iframeManager.addIframe(currentN);\n }\n if (isSerializedStylesheet(currentN, this.mirror)) {\n this.stylesheetManager.trackLinkElement(\n currentN\n );\n }\n if (hasShadowRoot(n2)) {\n this.shadowDomManager.addShadowRoot(index.shadowRoot(n2), this.doc);\n }\n },\n onIframeLoad: (iframe, childSn) => {\n this.iframeManager.attachIframe(iframe, childSn);\n this.shadowDomManager.observeAttachShadow(iframe);\n },\n onStylesheetLoad: (link, childSn) => {\n this.stylesheetManager.attachLinkElement(link, childSn);\n }\n });\n if (sn) {\n adds.push({\n parentId,\n nextId,\n node: sn\n });\n addedIds.add(sn.id);\n }\n };\n while (this.mapRemoves.length) {\n this.mirror.removeNodeFromMap(this.mapRemoves.shift());\n }\n for (const n2 of this.movedSet) {\n if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {\n continue;\n }\n pushAdd(n2);\n }\n for (const n2 of this.addedSet) {\n if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) {\n pushAdd(n2);\n } else if (isAncestorInSet(this.movedSet, n2)) {\n pushAdd(n2);\n } else {\n this.droppedSet.add(n2);\n }\n }\n let candidate = null;\n while (addList.length) {\n let node2 = null;\n if (candidate) {\n const parentId = this.mirror.getId(index.parentNode(candidate.value));\n const nextId = getNextId(candidate.value);\n if (parentId !== -1 && nextId !== -1) {\n node2 = candidate;\n }\n }\n if (!node2) {\n let tailNode = addList.tail;\n while (tailNode) {\n const _node = tailNode;\n tailNode = tailNode.previous;\n if (_node) {\n const parentId = this.mirror.getId(index.parentNode(_node.value));\n const nextId = getNextId(_node.value);\n if (nextId === -1) continue;\n else if (parentId !== -1) {\n node2 = _node;\n break;\n } else {\n const unhandledNode = _node.value;\n const parent = index.parentNode(unhandledNode);\n if (parent && parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowHost = index.host(parent);\n const parentId2 = this.mirror.getId(shadowHost);\n if (parentId2 !== -1) {\n node2 = _node;\n break;\n }\n }\n }\n }\n }\n }\n if (!node2) {\n while (addList.head) {\n addList.removeNode(addList.head.value);\n }\n break;\n }\n candidate = node2.previous;\n addList.removeNode(node2.value);\n pushAdd(node2.value);\n }\n const payload = {\n texts: this.texts.map((text) => {\n const n2 = text.node;\n const parent = index.parentNode(n2);\n if (parent && parent.tagName === \"TEXTAREA\") {\n this.genTextAreaValueMutation(parent);\n }\n return {\n id: this.mirror.getId(n2),\n value: text.value\n };\n }).filter((text) => !addedIds.has(text.id)).filter((text) => this.mirror.has(text.id)),\n attributes: this.attributes.map((attribute) => {\n const { attributes } = attribute;\n if (typeof attributes.style === \"string\") {\n const diffAsStr = JSON.stringify(attribute.styleDiff);\n const unchangedAsStr = JSON.stringify(attribute._unchangedStyles);\n if (diffAsStr.length < attributes.style.length) {\n if ((diffAsStr + unchangedAsStr).split(\"var(\").length === attributes.style.split(\"var(\").length) {\n attributes.style = attribute.styleDiff;\n }\n }\n }\n return {\n id: this.mirror.getId(attribute.node),\n attributes\n };\n }).filter((attribute) => !addedIds.has(attribute.id)).filter((attribute) => this.mirror.has(attribute.id)),\n removes: this.removes,\n adds\n };\n if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) {\n return;\n }\n this.texts = [];\n this.attributes = [];\n this.attributeMap = /* @__PURE__ */ new WeakMap();\n this.removes = [];\n this.addedSet = /* @__PURE__ */ new Set();\n this.movedSet = /* @__PURE__ */ new Set();\n this.droppedSet = /* @__PURE__ */ new Set();\n this.movedMap = {};\n this.mutationCb(payload);\n });\n __publicField(this, \"genTextAreaValueMutation\", (textarea) => {\n let item = this.attributeMap.get(textarea);\n if (!item) {\n item = {\n node: textarea,\n attributes: {},\n styleDiff: {},\n _unchangedStyles: {}\n };\n this.attributes.push(item);\n this.attributeMap.set(textarea, item);\n }\n item.attributes.value = Array.from(\n index.childNodes(textarea),\n (cn) => index.textContent(cn) || \"\"\n ).join(\"\");\n });\n __publicField(this, \"processMutation\", (m) => {\n if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {\n return;\n }\n switch (m.type) {\n case \"characterData\": {\n const value = index.textContent(m.target);\n if (!isBlocked(m.target, this.blockClass, this.blockSelector, false) && value !== m.oldValue) {\n this.texts.push({\n value: needMaskingText(\n m.target,\n this.maskTextClass,\n this.maskTextSelector,\n true\n // checkAncestors\n ) && value ? this.maskTextFn ? this.maskTextFn(value, closestElementOfNode(m.target)) : value.replace(/[\\S]/g, \"*\") : value,\n node: m.target\n });\n }\n break;\n }\n case \"attributes\": {\n const target = m.target;\n let attributeName = m.attributeName;\n let value = m.target.getAttribute(attributeName);\n if (attributeName === \"value\") {\n const type = getInputType(target);\n value = maskInputValue({\n element: target,\n maskInputOptions: this.maskInputOptions,\n tagName: target.tagName,\n type,\n value,\n maskInputFn: this.maskInputFn\n });\n }\n if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || value === m.oldValue) {\n return;\n }\n let item = this.attributeMap.get(m.target);\n if (target.tagName === \"IFRAME\" && attributeName === \"src\" && !this.keepIframeSrcFn(value)) {\n if (!target.contentDocument) {\n attributeName = \"rr_src\";\n } else {\n return;\n }\n }\n if (!item) {\n item = {\n node: m.target,\n attributes: {},\n styleDiff: {},\n _unchangedStyles: {}\n };\n this.attributes.push(item);\n this.attributeMap.set(m.target, item);\n }\n if (attributeName === \"type\" && target.tagName === \"INPUT\" && (m.oldValue || \"\").toLowerCase() === \"password\") {\n target.setAttribute(\"data-rr-is-password\", \"true\");\n }\n if (!ignoreAttribute(target.tagName, attributeName)) {\n item.attributes[attributeName] = transformAttribute(\n this.doc,\n toLowerCase(target.tagName),\n toLowerCase(attributeName),\n value\n );\n if (attributeName === \"style\") {\n if (!this.unattachedDoc) {\n try {\n this.unattachedDoc = document.implementation.createHTMLDocument();\n } catch (e2) {\n this.unattachedDoc = this.doc;\n }\n }\n const old = this.unattachedDoc.createElement(\"span\");\n if (m.oldValue) {\n old.setAttribute(\"style\", m.oldValue);\n }\n for (const pname of Array.from(target.style)) {\n const newValue = target.style.getPropertyValue(pname);\n const newPriority = target.style.getPropertyPriority(pname);\n if (newValue !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) {\n if (newPriority === \"\") {\n item.styleDiff[pname] = newValue;\n } else {\n item.styleDiff[pname] = [newValue, newPriority];\n }\n } else {\n item._unchangedStyles[pname] = [newValue, newPriority];\n }\n }\n for (const pname of Array.from(old.style)) {\n if (target.style.getPropertyValue(pname) === \"\") {\n item.styleDiff[pname] = false;\n }\n }\n } else if (attributeName === \"open\" && target.tagName === \"DIALOG\") {\n if (target.matches(\"dialog:modal\")) {\n item.attributes[\"rr_open_mode\"] = \"modal\";\n } else {\n item.attributes[\"rr_open_mode\"] = \"non-modal\";\n }\n }\n }\n break;\n }\n case \"childList\": {\n if (isBlocked(m.target, this.blockClass, this.blockSelector, true))\n return;\n if (m.target.tagName === \"TEXTAREA\") {\n this.genTextAreaValueMutation(m.target);\n return;\n }\n m.addedNodes.forEach((n2) => this.genAdds(n2, m.target));\n m.removedNodes.forEach((n2) => {\n const nodeId = this.mirror.getId(n2);\n const parentId = isShadowRoot(m.target) ? this.mirror.getId(index.host(m.target)) : this.mirror.getId(m.target);\n if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || isIgnored(n2, this.mirror, this.slimDOMOptions) || !isSerialized(n2, this.mirror)) {\n return;\n }\n if (this.addedSet.has(n2)) {\n deepDelete(this.addedSet, n2);\n this.droppedSet.add(n2);\n } else if (this.addedSet.has(m.target) && nodeId === -1) ;\n else if (isAncestorRemoved(m.target, this.mirror)) ;\n else if (this.movedSet.has(n2) && this.movedMap[moveKey(nodeId, parentId)]) {\n deepDelete(this.movedSet, n2);\n } else {\n this.removes.push({\n parentId,\n id: nodeId,\n isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0\n });\n }\n this.mapRemoves.push(n2);\n });\n break;\n }\n }\n });\n __publicField(this, \"genAdds\", (n2, target) => {\n if (this.processedNodeManager.inOtherBuffer(n2, this)) return;\n if (this.addedSet.has(n2) || this.movedSet.has(n2)) return;\n if (this.mirror.hasNode(n2)) {\n if (isIgnored(n2, this.mirror, this.slimDOMOptions)) {\n return;\n }\n this.movedSet.add(n2);\n let targetId = null;\n if (target && this.mirror.hasNode(target)) {\n targetId = this.mirror.getId(target);\n }\n if (targetId && targetId !== -1) {\n this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true;\n }\n } else {\n this.addedSet.add(n2);\n this.droppedSet.delete(n2);\n }\n if (!isBlocked(n2, this.blockClass, this.blockSelector, false)) {\n index.childNodes(n2).forEach((childN) => this.genAdds(childN));\n if (hasShadowRoot(n2)) {\n index.childNodes(index.shadowRoot(n2)).forEach((childN) => {\n this.processedNodeManager.add(childN, this);\n this.genAdds(childN, n2);\n });\n }\n }\n });\n }\n init(options) {\n [\n \"mutationCb\",\n \"blockClass\",\n \"blockSelector\",\n \"maskTextClass\",\n \"maskTextSelector\",\n \"inlineStylesheet\",\n \"maskInputOptions\",\n \"maskTextFn\",\n \"maskInputFn\",\n \"keepIframeSrcFn\",\n \"recordCanvas\",\n \"inlineImages\",\n \"slimDOMOptions\",\n \"dataURLOptions\",\n \"doc\",\n \"mirror\",\n \"iframeManager\",\n \"stylesheetManager\",\n \"shadowDomManager\",\n \"canvasManager\",\n \"processedNodeManager\"\n ].forEach((key) => {\n this[key] = options[key];\n });\n }\n freeze() {\n this.frozen = true;\n this.canvasManager.freeze();\n }\n unfreeze() {\n this.frozen = false;\n this.canvasManager.unfreeze();\n this.emit();\n }\n isFrozen() {\n return this.frozen;\n }\n lock() {\n this.locked = true;\n this.canvasManager.lock();\n }\n unlock() {\n this.locked = false;\n this.canvasManager.unlock();\n this.emit();\n }\n reset() {\n this.shadowDomManager.reset();\n this.canvasManager.reset();\n }\n}\nfunction deepDelete(addsSet, n2) {\n addsSet.delete(n2);\n index.childNodes(n2).forEach((childN) => deepDelete(addsSet, childN));\n}\nfunction isParentRemoved(removes, n2, mirror2) {\n if (removes.length === 0) return false;\n return _isParentRemoved(removes, n2, mirror2);\n}\nfunction _isParentRemoved(removes, n2, mirror2) {\n let node2 = index.parentNode(n2);\n while (node2) {\n const parentId = mirror2.getId(node2);\n if (removes.some((r2) => r2.id === parentId)) {\n return true;\n }\n node2 = index.parentNode(node2);\n }\n return false;\n}\nfunction isAncestorInSet(set, n2) {\n if (set.size === 0) return false;\n return _isAncestorInSet(set, n2);\n}\nfunction _isAncestorInSet(set, n2) {\n const parent = index.parentNode(n2);\n if (!parent) {\n return false;\n }\n if (set.has(parent)) {\n return true;\n }\n return _isAncestorInSet(set, parent);\n}\nlet errorHandler;\nfunction registerErrorHandler(handler) {\n errorHandler = handler;\n}\nfunction unregisterErrorHandler() {\n errorHandler = void 0;\n}\nconst callbackWrapper = (cb) => {\n if (!errorHandler) {\n return cb;\n }\n const rrwebWrapped = (...rest) => {\n try {\n return cb(...rest);\n } catch (error) {\n if (errorHandler && errorHandler(error) === true) {\n return;\n }\n throw error;\n }\n };\n return rrwebWrapped;\n};\nconst mutationBuffers = [];\nfunction getEventTarget(event) {\n try {\n if (\"composedPath\" in event) {\n const path = event.composedPath();\n if (path.length) {\n return path[0];\n }\n } else if (\"path\" in event && event.path.length) {\n return event.path[0];\n }\n } catch {\n }\n return event && event.target;\n}\nfunction initMutationObserver(options, rootEl) {\n const mutationBuffer = new MutationBuffer();\n mutationBuffers.push(mutationBuffer);\n mutationBuffer.init(options);\n const observer = new (mutationObserverCtor())(\n callbackWrapper(mutationBuffer.processMutations.bind(mutationBuffer))\n );\n observer.observe(rootEl, {\n attributes: true,\n attributeOldValue: true,\n characterData: true,\n characterDataOldValue: true,\n childList: true,\n subtree: true\n });\n return observer;\n}\nfunction initMoveObserver({\n mousemoveCb,\n sampling,\n doc,\n mirror: mirror2\n}) {\n if (sampling.mousemove === false) {\n return () => {\n };\n }\n const threshold = typeof sampling.mousemove === \"number\" ? sampling.mousemove : 50;\n const callbackThreshold = typeof sampling.mousemoveCallback === \"number\" ? sampling.mousemoveCallback : 500;\n let positions = [];\n let timeBaseline;\n const wrappedCb = throttle(\n callbackWrapper(\n (source) => {\n const totalOffset = Date.now() - timeBaseline;\n mousemoveCb(\n positions.map((p) => {\n p.timeOffset -= totalOffset;\n return p;\n }),\n source\n );\n positions = [];\n timeBaseline = null;\n }\n ),\n callbackThreshold\n );\n const updatePosition = callbackWrapper(\n throttle(\n callbackWrapper((evt) => {\n const target = getEventTarget(evt);\n const { clientX, clientY } = legacy_isTouchEvent(evt) ? evt.changedTouches[0] : evt;\n if (!timeBaseline) {\n timeBaseline = nowTimestamp();\n }\n positions.push({\n x: clientX,\n y: clientY,\n id: mirror2.getId(target),\n timeOffset: nowTimestamp() - timeBaseline\n });\n wrappedCb(\n typeof DragEvent !== \"undefined\" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove\n );\n }),\n threshold,\n {\n trailing: false\n }\n )\n );\n const handlers = [\n on(\"mousemove\", updatePosition, doc),\n on(\"touchmove\", updatePosition, doc),\n on(\"drag\", updatePosition, doc)\n ];\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initMouseInteractionObserver({\n mouseInteractionCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n sampling\n}) {\n if (sampling.mouseInteraction === false) {\n return () => {\n };\n }\n const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;\n const handlers = [];\n let currentPointerType = null;\n const getHandler = (eventKey) => {\n return (event) => {\n const target = getEventTarget(event);\n if (isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n let pointerType = null;\n let thisEventKey = eventKey;\n if (\"pointerType\" in event) {\n switch (event.pointerType) {\n case \"mouse\":\n pointerType = PointerTypes.Mouse;\n break;\n case \"touch\":\n pointerType = PointerTypes.Touch;\n break;\n case \"pen\":\n pointerType = PointerTypes.Pen;\n break;\n }\n if (pointerType === PointerTypes.Touch) {\n if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) {\n thisEventKey = \"TouchStart\";\n } else if (MouseInteractions[eventKey] === MouseInteractions.MouseUp) {\n thisEventKey = \"TouchEnd\";\n }\n } else if (pointerType === PointerTypes.Pen) ;\n } else if (legacy_isTouchEvent(event)) {\n pointerType = PointerTypes.Touch;\n }\n if (pointerType !== null) {\n currentPointerType = pointerType;\n if (thisEventKey.startsWith(\"Touch\") && pointerType === PointerTypes.Touch || thisEventKey.startsWith(\"Mouse\") && pointerType === PointerTypes.Mouse) {\n pointerType = null;\n }\n } else if (MouseInteractions[eventKey] === MouseInteractions.Click) {\n pointerType = currentPointerType;\n currentPointerType = null;\n }\n const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;\n if (!e2) {\n return;\n }\n const id = mirror2.getId(target);\n const { clientX, clientY } = e2;\n callbackWrapper(mouseInteractionCb)({\n type: MouseInteractions[thisEventKey],\n id,\n x: clientX,\n y: clientY,\n ...pointerType !== null && { pointerType }\n });\n };\n };\n Object.keys(MouseInteractions).filter(\n (key) => Number.isNaN(Number(key)) && !key.endsWith(\"_Departed\") && disableMap[key] !== false\n ).forEach((eventKey) => {\n let eventName = toLowerCase(eventKey);\n const handler = getHandler(eventKey);\n if (window.PointerEvent) {\n switch (MouseInteractions[eventKey]) {\n case MouseInteractions.MouseDown:\n case MouseInteractions.MouseUp:\n eventName = eventName.replace(\n \"mouse\",\n \"pointer\"\n );\n break;\n case MouseInteractions.TouchStart:\n case MouseInteractions.TouchEnd:\n return;\n }\n }\n handlers.push(on(eventName, handler, doc));\n });\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initScrollObserver({\n scrollCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n sampling\n}) {\n const updatePosition = callbackWrapper(\n throttle(\n callbackWrapper((evt) => {\n const target = getEventTarget(evt);\n if (!target || isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n const id = mirror2.getId(target);\n if (target === doc && doc.defaultView) {\n const scrollLeftTop = getWindowScroll(doc.defaultView);\n scrollCb({\n id,\n x: scrollLeftTop.left,\n y: scrollLeftTop.top\n });\n } else {\n scrollCb({\n id,\n x: target.scrollLeft,\n y: target.scrollTop\n });\n }\n }),\n sampling.scroll || 100\n )\n );\n return on(\"scroll\", updatePosition, doc);\n}\nfunction initViewportResizeObserver({ viewportResizeCb }, { win }) {\n let lastH = -1;\n let lastW = -1;\n const updateDimension = callbackWrapper(\n throttle(\n callbackWrapper(() => {\n const height = getWindowHeight();\n const width = getWindowWidth();\n if (lastH !== height || lastW !== width) {\n viewportResizeCb({\n width: Number(width),\n height: Number(height)\n });\n lastH = height;\n lastW = width;\n }\n }),\n 200\n )\n );\n return on(\"resize\", updateDimension, win);\n}\nconst INPUT_TAGS = [\"INPUT\", \"TEXTAREA\", \"SELECT\"];\nconst lastInputValueMap = /* @__PURE__ */ new WeakMap();\nfunction initInputObserver({\n inputCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n ignoreClass,\n ignoreSelector,\n maskInputOptions,\n maskInputFn,\n sampling,\n userTriggeredOnInput\n}) {\n function eventHandler(event) {\n let target = getEventTarget(event);\n const userTriggered = event.isTrusted;\n const tagName = target && target.tagName;\n if (target && tagName === \"OPTION\") {\n target = index.parentElement(target);\n }\n if (!target || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n if (target.classList.contains(ignoreClass) || ignoreSelector && target.matches(ignoreSelector)) {\n return;\n }\n let text = target.value;\n let isChecked = false;\n const type = getInputType(target) || \"\";\n if (type === \"radio\" || type === \"checkbox\") {\n isChecked = target.checked;\n } else if (maskInputOptions[tagName.toLowerCase()] || maskInputOptions[type]) {\n text = maskInputValue({\n element: target,\n maskInputOptions,\n tagName,\n type,\n value: text,\n maskInputFn\n });\n }\n cbWithDedup(\n target,\n userTriggeredOnInput ? { text, isChecked, userTriggered } : { text, isChecked }\n );\n const name = target.name;\n if (type === \"radio\" && name && isChecked) {\n doc.querySelectorAll(`input[type=\"radio\"][name=\"${name}\"]`).forEach((el) => {\n if (el !== target) {\n const text2 = el.value;\n cbWithDedup(\n el,\n userTriggeredOnInput ? { text: text2, isChecked: !isChecked, userTriggered: false } : { text: text2, isChecked: !isChecked }\n );\n }\n });\n }\n }\n function cbWithDedup(target, v2) {\n const lastInputValue = lastInputValueMap.get(target);\n if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {\n lastInputValueMap.set(target, v2);\n const id = mirror2.getId(target);\n callbackWrapper(inputCb)({\n ...v2,\n id\n });\n }\n }\n const events = sampling.input === \"last\" ? [\"change\"] : [\"input\", \"change\"];\n const handlers = events.map(\n (eventName) => on(eventName, callbackWrapper(eventHandler), doc)\n );\n const currentWindow = doc.defaultView;\n if (!currentWindow) {\n return () => {\n handlers.forEach((h) => h());\n };\n }\n const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(\n currentWindow.HTMLInputElement.prototype,\n \"value\"\n );\n const hookProperties = [\n [currentWindow.HTMLInputElement.prototype, \"value\"],\n [currentWindow.HTMLInputElement.prototype, \"checked\"],\n [currentWindow.HTMLSelectElement.prototype, \"value\"],\n [currentWindow.HTMLTextAreaElement.prototype, \"value\"],\n // Some UI library use selectedIndex to set select value\n [currentWindow.HTMLSelectElement.prototype, \"selectedIndex\"],\n [currentWindow.HTMLOptionElement.prototype, \"selected\"]\n ];\n if (propertyDescriptor && propertyDescriptor.set) {\n handlers.push(\n ...hookProperties.map(\n (p) => hookSetter(\n p[0],\n p[1],\n {\n set() {\n callbackWrapper(eventHandler)({\n target: this,\n isTrusted: false\n // userTriggered to false as this could well be programmatic\n });\n }\n },\n false,\n currentWindow\n )\n )\n );\n }\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction getNestedCSSRulePositions(rule2) {\n const positions = [];\n function recurse(childRule, pos) {\n if (hasNestedCSSRule(\"CSSGroupingRule\") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule(\"CSSMediaRule\") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule(\"CSSSupportsRule\") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule(\"CSSConditionRule\") && childRule.parentRule instanceof CSSConditionRule) {\n const rules2 = Array.from(\n childRule.parentRule.cssRules\n );\n const index2 = rules2.indexOf(childRule);\n pos.unshift(index2);\n } else if (childRule.parentStyleSheet) {\n const rules2 = Array.from(childRule.parentStyleSheet.cssRules);\n const index2 = rules2.indexOf(childRule);\n pos.unshift(index2);\n }\n return pos;\n }\n return recurse(rule2, positions);\n}\nfunction getIdAndStyleId(sheet, mirror2, styleMirror) {\n let id, styleId;\n if (!sheet) return {};\n if (sheet.ownerNode) id = mirror2.getId(sheet.ownerNode);\n else styleId = styleMirror.getId(sheet);\n return {\n styleId,\n id\n };\n}\nfunction initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetManager }, { win }) {\n if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) {\n return () => {\n };\n }\n const insertRule = win.CSSStyleSheet.prototype.insertRule;\n win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [rule2, index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n adds: [{ rule: rule2, index: index2 }]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n win.CSSStyleSheet.prototype.addRule = function(selector, styleBlock, index2 = this.cssRules.length) {\n const rule2 = `${selector} { ${styleBlock} }`;\n return win.CSSStyleSheet.prototype.insertRule.apply(this, [rule2, index2]);\n };\n const deleteRule = win.CSSStyleSheet.prototype.deleteRule;\n win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n removes: [{ index: index2 }]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n win.CSSStyleSheet.prototype.removeRule = function(index2) {\n return win.CSSStyleSheet.prototype.deleteRule.apply(this, [index2]);\n };\n let replace;\n if (win.CSSStyleSheet.prototype.replace) {\n replace = win.CSSStyleSheet.prototype.replace;\n win.CSSStyleSheet.prototype.replace = new Proxy(replace, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [text] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n replace: text\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n }\n let replaceSync;\n if (win.CSSStyleSheet.prototype.replaceSync) {\n replaceSync = win.CSSStyleSheet.prototype.replaceSync;\n win.CSSStyleSheet.prototype.replaceSync = new Proxy(replaceSync, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [text] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n replaceSync: text\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n }\n const supportedNestedCSSRuleTypes = {};\n if (canMonkeyPatchNestedCSSRule(\"CSSGroupingRule\")) {\n supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;\n } else {\n if (canMonkeyPatchNestedCSSRule(\"CSSMediaRule\")) {\n supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule;\n }\n if (canMonkeyPatchNestedCSSRule(\"CSSConditionRule\")) {\n supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule;\n }\n if (canMonkeyPatchNestedCSSRule(\"CSSSupportsRule\")) {\n supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule;\n }\n }\n const unmodifiedFunctions = {};\n Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {\n unmodifiedFunctions[typeKey] = {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n insertRule: type.prototype.insertRule,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n deleteRule: type.prototype.deleteRule\n };\n type.prototype.insertRule = new Proxy(\n unmodifiedFunctions[typeKey].insertRule,\n {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [rule2, index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n adds: [\n {\n rule: rule2,\n index: [\n ...getNestedCSSRulePositions(thisArg),\n index2 || 0\n // defaults to 0\n ]\n }\n ]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n }\n );\n type.prototype.deleteRule = new Proxy(\n unmodifiedFunctions[typeKey].deleteRule,\n {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n removes: [\n { index: [...getNestedCSSRulePositions(thisArg), index2] }\n ]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n }\n );\n });\n return callbackWrapper(() => {\n win.CSSStyleSheet.prototype.insertRule = insertRule;\n win.CSSStyleSheet.prototype.deleteRule = deleteRule;\n replace && (win.CSSStyleSheet.prototype.replace = replace);\n replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync);\n Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {\n type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;\n type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;\n });\n });\n}\nfunction initAdoptedStyleSheetObserver({\n mirror: mirror2,\n stylesheetManager\n}, host2) {\n var _a2, _b, _c;\n let hostId = null;\n if (host2.nodeName === \"#document\") hostId = mirror2.getId(host2);\n else hostId = mirror2.getId(index.host(host2));\n const patchTarget = host2.nodeName === \"#document\" ? (_a2 = host2.defaultView) == null ? void 0 : _a2.Document : (_c = (_b = host2.ownerDocument) == null ? void 0 : _b.defaultView) == null ? void 0 : _c.ShadowRoot;\n const originalPropertyDescriptor = (patchTarget == null ? void 0 : patchTarget.prototype) ? Object.getOwnPropertyDescriptor(\n patchTarget == null ? void 0 : patchTarget.prototype,\n \"adoptedStyleSheets\"\n ) : void 0;\n if (hostId === null || hostId === -1 || !patchTarget || !originalPropertyDescriptor)\n return () => {\n };\n Object.defineProperty(host2, \"adoptedStyleSheets\", {\n configurable: originalPropertyDescriptor.configurable,\n enumerable: originalPropertyDescriptor.enumerable,\n get() {\n var _a3;\n return (_a3 = originalPropertyDescriptor.get) == null ? void 0 : _a3.call(this);\n },\n set(sheets) {\n var _a3;\n const result2 = (_a3 = originalPropertyDescriptor.set) == null ? void 0 : _a3.call(this, sheets);\n if (hostId !== null && hostId !== -1) {\n try {\n stylesheetManager.adoptStyleSheets(sheets, hostId);\n } catch (e2) {\n }\n }\n return result2;\n }\n });\n return callbackWrapper(() => {\n Object.defineProperty(host2, \"adoptedStyleSheets\", {\n configurable: originalPropertyDescriptor.configurable,\n enumerable: originalPropertyDescriptor.enumerable,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n get: originalPropertyDescriptor.get,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n set: originalPropertyDescriptor.set\n });\n });\n}\nfunction initStyleDeclarationObserver({\n styleDeclarationCb,\n mirror: mirror2,\n ignoreCSSAttributes,\n stylesheetManager\n}, { win }) {\n const setProperty = win.CSSStyleDeclaration.prototype.setProperty;\n win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n var _a2;\n const [property, value, priority] = argumentsList;\n if (ignoreCSSAttributes.has(property)) {\n return setProperty.apply(thisArg, [property, value, priority]);\n }\n const { id, styleId } = getIdAndStyleId(\n (_a2 = thisArg.parentRule) == null ? void 0 : _a2.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleDeclarationCb({\n id,\n styleId,\n set: {\n property,\n value,\n priority\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n index: getNestedCSSRulePositions(thisArg.parentRule)\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;\n win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n var _a2;\n const [property] = argumentsList;\n if (ignoreCSSAttributes.has(property)) {\n return removeProperty.apply(thisArg, [property]);\n }\n const { id, styleId } = getIdAndStyleId(\n (_a2 = thisArg.parentRule) == null ? void 0 : _a2.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleDeclarationCb({\n id,\n styleId,\n remove: {\n property\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n index: getNestedCSSRulePositions(thisArg.parentRule)\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n return callbackWrapper(() => {\n win.CSSStyleDeclaration.prototype.setProperty = setProperty;\n win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;\n });\n}\nfunction initMediaInteractionObserver({\n mediaInteractionCb,\n blockClass,\n blockSelector,\n mirror: mirror2,\n sampling,\n doc\n}) {\n const handler = callbackWrapper(\n (type) => throttle(\n callbackWrapper((event) => {\n const target = getEventTarget(event);\n if (!target || isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n const { currentTime, volume, muted, playbackRate, loop } = target;\n mediaInteractionCb({\n type,\n id: mirror2.getId(target),\n currentTime,\n volume,\n muted,\n playbackRate,\n loop\n });\n }),\n sampling.media || 500\n )\n );\n const handlers = [\n on(\"play\", handler(MediaInteractions.Play), doc),\n on(\"pause\", handler(MediaInteractions.Pause), doc),\n on(\"seeked\", handler(MediaInteractions.Seeked), doc),\n on(\"volumechange\", handler(MediaInteractions.VolumeChange), doc),\n on(\"ratechange\", handler(MediaInteractions.RateChange), doc)\n ];\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initFontObserver({ fontCb, doc }) {\n const win = doc.defaultView;\n if (!win) {\n return () => {\n };\n }\n const handlers = [];\n const fontMap = /* @__PURE__ */ new WeakMap();\n const originalFontFace = win.FontFace;\n win.FontFace = function FontFace2(family, source, descriptors) {\n const fontFace = new originalFontFace(family, source, descriptors);\n fontMap.set(fontFace, {\n family,\n buffer: typeof source !== \"string\",\n descriptors,\n fontSource: typeof source === \"string\" ? source : JSON.stringify(Array.from(new Uint8Array(source)))\n });\n return fontFace;\n };\n const restoreHandler = patch(\n doc.fonts,\n \"add\",\n function(original) {\n return function(fontFace) {\n setTimeout(\n callbackWrapper(() => {\n const p = fontMap.get(fontFace);\n if (p) {\n fontCb(p);\n fontMap.delete(fontFace);\n }\n }),\n 0\n );\n return original.apply(this, [fontFace]);\n };\n }\n );\n handlers.push(() => {\n win.FontFace = originalFontFace;\n });\n handlers.push(restoreHandler);\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initSelectionObserver(param) {\n const { doc, mirror: mirror2, blockClass, blockSelector, selectionCb } = param;\n let collapsed = true;\n const updateSelection = callbackWrapper(() => {\n const selection = doc.getSelection();\n if (!selection || collapsed && (selection == null ? void 0 : selection.isCollapsed)) return;\n collapsed = selection.isCollapsed || false;\n const ranges = [];\n const count = selection.rangeCount || 0;\n for (let i2 = 0; i2 < count; i2++) {\n const range = selection.getRangeAt(i2);\n const { startContainer, startOffset, endContainer, endOffset } = range;\n const blocked = isBlocked(startContainer, blockClass, blockSelector, true) || isBlocked(endContainer, blockClass, blockSelector, true);\n if (blocked) continue;\n ranges.push({\n start: mirror2.getId(startContainer),\n startOffset,\n end: mirror2.getId(endContainer),\n endOffset\n });\n }\n selectionCb({ ranges });\n });\n updateSelection();\n return on(\"selectionchange\", updateSelection);\n}\nfunction initCustomElementObserver({\n doc,\n customElementCb\n}) {\n const win = doc.defaultView;\n if (!win || !win.customElements) return () => {\n };\n const restoreHandler = patch(\n win.customElements,\n \"define\",\n function(original) {\n return function(name, constructor, options) {\n try {\n customElementCb({\n define: {\n name\n }\n });\n } catch (e2) {\n console.warn(`Custom element callback failed for ${name}`);\n }\n return original.apply(this, [name, constructor, options]);\n };\n }\n );\n return restoreHandler;\n}\nfunction mergeHooks(o2, hooks) {\n const {\n mutationCb,\n mousemoveCb,\n mouseInteractionCb,\n scrollCb,\n viewportResizeCb,\n inputCb,\n mediaInteractionCb,\n styleSheetRuleCb,\n styleDeclarationCb,\n canvasMutationCb,\n fontCb,\n selectionCb,\n customElementCb\n } = o2;\n o2.mutationCb = (...p) => {\n if (hooks.mutation) {\n hooks.mutation(...p);\n }\n mutationCb(...p);\n };\n o2.mousemoveCb = (...p) => {\n if (hooks.mousemove) {\n hooks.mousemove(...p);\n }\n mousemoveCb(...p);\n };\n o2.mouseInteractionCb = (...p) => {\n if (hooks.mouseInteraction) {\n hooks.mouseInteraction(...p);\n }\n mouseInteractionCb(...p);\n };\n o2.scrollCb = (...p) => {\n if (hooks.scroll) {\n hooks.scroll(...p);\n }\n scrollCb(...p);\n };\n o2.viewportResizeCb = (...p) => {\n if (hooks.viewportResize) {\n hooks.viewportResize(...p);\n }\n viewportResizeCb(...p);\n };\n o2.inputCb = (...p) => {\n if (hooks.input) {\n hooks.input(...p);\n }\n inputCb(...p);\n };\n o2.mediaInteractionCb = (...p) => {\n if (hooks.mediaInteaction) {\n hooks.mediaInteaction(...p);\n }\n mediaInteractionCb(...p);\n };\n o2.styleSheetRuleCb = (...p) => {\n if (hooks.styleSheetRule) {\n hooks.styleSheetRule(...p);\n }\n styleSheetRuleCb(...p);\n };\n o2.styleDeclarationCb = (...p) => {\n if (hooks.styleDeclaration) {\n hooks.styleDeclaration(...p);\n }\n styleDeclarationCb(...p);\n };\n o2.canvasMutationCb = (...p) => {\n if (hooks.canvasMutation) {\n hooks.canvasMutation(...p);\n }\n canvasMutationCb(...p);\n };\n o2.fontCb = (...p) => {\n if (hooks.font) {\n hooks.font(...p);\n }\n fontCb(...p);\n };\n o2.selectionCb = (...p) => {\n if (hooks.selection) {\n hooks.selection(...p);\n }\n selectionCb(...p);\n };\n o2.customElementCb = (...c2) => {\n if (hooks.customElement) {\n hooks.customElement(...c2);\n }\n customElementCb(...c2);\n };\n}\nfunction initObservers(o2, hooks = {}) {\n const currentWindow = o2.doc.defaultView;\n if (!currentWindow) {\n return () => {\n };\n }\n mergeHooks(o2, hooks);\n let mutationObserver;\n if (o2.recordDOM) {\n mutationObserver = initMutationObserver(o2, o2.doc);\n }\n const mousemoveHandler = initMoveObserver(o2);\n const mouseInteractionHandler = initMouseInteractionObserver(o2);\n const scrollHandler = initScrollObserver(o2);\n const viewportResizeHandler = initViewportResizeObserver(o2, {\n win: currentWindow\n });\n const inputHandler = initInputObserver(o2);\n const mediaInteractionHandler = initMediaInteractionObserver(o2);\n let styleSheetObserver = () => {\n };\n let adoptedStyleSheetObserver = () => {\n };\n let styleDeclarationObserver = () => {\n };\n let fontObserver = () => {\n };\n if (o2.recordDOM) {\n styleSheetObserver = initStyleSheetObserver(o2, { win: currentWindow });\n adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o2, o2.doc);\n styleDeclarationObserver = initStyleDeclarationObserver(o2, {\n win: currentWindow\n });\n if (o2.collectFonts) {\n fontObserver = initFontObserver(o2);\n }\n }\n const selectionObserver = initSelectionObserver(o2);\n const customElementObserver = initCustomElementObserver(o2);\n const pluginHandlers = [];\n for (const plugin3 of o2.plugins) {\n pluginHandlers.push(\n plugin3.observer(plugin3.callback, currentWindow, plugin3.options)\n );\n }\n return callbackWrapper(() => {\n mutationBuffers.forEach((b) => b.reset());\n mutationObserver == null ? void 0 : mutationObserver.disconnect();\n mousemoveHandler();\n mouseInteractionHandler();\n scrollHandler();\n viewportResizeHandler();\n inputHandler();\n mediaInteractionHandler();\n styleSheetObserver();\n adoptedStyleSheetObserver();\n styleDeclarationObserver();\n fontObserver();\n selectionObserver();\n customElementObserver();\n pluginHandlers.forEach((h) => h());\n });\n}\nfunction hasNestedCSSRule(prop) {\n return typeof window[prop] !== \"undefined\";\n}\nfunction canMonkeyPatchNestedCSSRule(prop) {\n return Boolean(\n typeof window[prop] !== \"undefined\" && // Note: Generally, this check _shouldn't_ be necessary\n // However, in some scenarios (e.g. jsdom) this can sometimes fail, so we check for it here\n window[prop].prototype && \"insertRule\" in window[prop].prototype && \"deleteRule\" in window[prop].prototype\n );\n}\nclass CrossOriginIframeMirror {\n constructor(generateIdFn) {\n __publicField(this, \"iframeIdToRemoteIdMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"iframeRemoteIdToIdMap\", /* @__PURE__ */ new WeakMap());\n this.generateIdFn = generateIdFn;\n }\n getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) {\n const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe);\n const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe);\n let id = idToRemoteIdMap.get(remoteId);\n if (!id) {\n id = this.generateIdFn();\n idToRemoteIdMap.set(remoteId, id);\n remoteIdToIdMap.set(id, remoteId);\n }\n return id;\n }\n getIds(iframe, remoteId) {\n const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe);\n const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);\n return remoteId.map(\n (id) => this.getId(iframe, id, idToRemoteIdMap, remoteIdToIdMap)\n );\n }\n getRemoteId(iframe, id, map) {\n const remoteIdToIdMap = map || this.getRemoteIdToIdMap(iframe);\n if (typeof id !== \"number\") return id;\n const remoteId = remoteIdToIdMap.get(id);\n if (!remoteId) return -1;\n return remoteId;\n }\n getRemoteIds(iframe, ids) {\n const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);\n return ids.map((id) => this.getRemoteId(iframe, id, remoteIdToIdMap));\n }\n reset(iframe) {\n if (!iframe) {\n this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap();\n this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap();\n return;\n }\n this.iframeIdToRemoteIdMap.delete(iframe);\n this.iframeRemoteIdToIdMap.delete(iframe);\n }\n getIdToRemoteIdMap(iframe) {\n let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe);\n if (!idToRemoteIdMap) {\n idToRemoteIdMap = /* @__PURE__ */ new Map();\n this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap);\n }\n return idToRemoteIdMap;\n }\n getRemoteIdToIdMap(iframe) {\n let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe);\n if (!remoteIdToIdMap) {\n remoteIdToIdMap = /* @__PURE__ */ new Map();\n this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap);\n }\n return remoteIdToIdMap;\n }\n}\nclass IframeManager {\n constructor(options) {\n __publicField(this, \"iframes\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"crossOriginIframeMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"crossOriginIframeMirror\", new CrossOriginIframeMirror(genId));\n __publicField(this, \"crossOriginIframeStyleMirror\");\n __publicField(this, \"crossOriginIframeRootIdMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"mirror\");\n __publicField(this, \"mutationCb\");\n __publicField(this, \"wrappedEmit\");\n __publicField(this, \"loadListener\");\n __publicField(this, \"stylesheetManager\");\n __publicField(this, \"recordCrossOriginIframes\");\n this.mutationCb = options.mutationCb;\n this.wrappedEmit = options.wrappedEmit;\n this.stylesheetManager = options.stylesheetManager;\n this.recordCrossOriginIframes = options.recordCrossOriginIframes;\n this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(\n this.stylesheetManager.styleMirror.generateId.bind(\n this.stylesheetManager.styleMirror\n )\n );\n this.mirror = options.mirror;\n if (this.recordCrossOriginIframes) {\n window.addEventListener(\"message\", this.handleMessage.bind(this));\n }\n }\n addIframe(iframeEl) {\n this.iframes.set(iframeEl, true);\n if (iframeEl.contentWindow)\n this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);\n }\n addLoadListener(cb) {\n this.loadListener = cb;\n }\n attachIframe(iframeEl, childSn) {\n var _a2, _b;\n this.mutationCb({\n adds: [\n {\n parentId: this.mirror.getId(iframeEl),\n nextId: null,\n node: childSn\n }\n ],\n removes: [],\n texts: [],\n attributes: [],\n isAttachIframe: true\n });\n if (this.recordCrossOriginIframes)\n (_a2 = iframeEl.contentWindow) == null ? void 0 : _a2.addEventListener(\n \"message\",\n this.handleMessage.bind(this)\n );\n (_b = this.loadListener) == null ? void 0 : _b.call(this, iframeEl);\n if (iframeEl.contentDocument && iframeEl.contentDocument.adoptedStyleSheets && iframeEl.contentDocument.adoptedStyleSheets.length > 0)\n this.stylesheetManager.adoptStyleSheets(\n iframeEl.contentDocument.adoptedStyleSheets,\n this.mirror.getId(iframeEl.contentDocument)\n );\n }\n handleMessage(message) {\n const crossOriginMessageEvent = message;\n if (crossOriginMessageEvent.data.type !== \"rrweb\" || // To filter out the rrweb messages which are forwarded by some sites.\n crossOriginMessageEvent.origin !== crossOriginMessageEvent.data.origin)\n return;\n const iframeSourceWindow = message.source;\n if (!iframeSourceWindow) return;\n const iframeEl = this.crossOriginIframeMap.get(message.source);\n if (!iframeEl) return;\n const transformedEvent = this.transformCrossOriginEvent(\n iframeEl,\n crossOriginMessageEvent.data.event\n );\n if (transformedEvent)\n this.wrappedEmit(\n transformedEvent,\n crossOriginMessageEvent.data.isCheckout\n );\n }\n transformCrossOriginEvent(iframeEl, e2) {\n var _a2;\n switch (e2.type) {\n case EventType.FullSnapshot: {\n this.crossOriginIframeMirror.reset(iframeEl);\n this.crossOriginIframeStyleMirror.reset(iframeEl);\n this.replaceIdOnNode(e2.data.node, iframeEl);\n const rootId = e2.data.node.id;\n this.crossOriginIframeRootIdMap.set(iframeEl, rootId);\n this.patchRootIdOnNode(e2.data.node, rootId);\n return {\n timestamp: e2.timestamp,\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Mutation,\n adds: [\n {\n parentId: this.mirror.getId(iframeEl),\n nextId: null,\n node: e2.data.node\n }\n ],\n removes: [],\n texts: [],\n attributes: [],\n isAttachIframe: true\n }\n };\n }\n case EventType.Meta:\n case EventType.Load:\n case EventType.DomContentLoaded: {\n return false;\n }\n case EventType.Plugin: {\n return e2;\n }\n case EventType.Custom: {\n this.replaceIds(\n e2.data.payload,\n iframeEl,\n [\"id\", \"parentId\", \"previousId\", \"nextId\"]\n );\n return e2;\n }\n case EventType.IncrementalSnapshot: {\n switch (e2.data.source) {\n case IncrementalSource.Mutation: {\n e2.data.adds.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\n \"parentId\",\n \"nextId\",\n \"previousId\"\n ]);\n this.replaceIdOnNode(n2.node, iframeEl);\n const rootId = this.crossOriginIframeRootIdMap.get(iframeEl);\n rootId && this.patchRootIdOnNode(n2.node, rootId);\n });\n e2.data.removes.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\"parentId\", \"id\"]);\n });\n e2.data.attributes.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\"id\"]);\n });\n e2.data.texts.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\"id\"]);\n });\n return e2;\n }\n case IncrementalSource.Drag:\n case IncrementalSource.TouchMove:\n case IncrementalSource.MouseMove: {\n e2.data.positions.forEach((p) => {\n this.replaceIds(p, iframeEl, [\"id\"]);\n });\n return e2;\n }\n case IncrementalSource.ViewportResize: {\n return false;\n }\n case IncrementalSource.MediaInteraction:\n case IncrementalSource.MouseInteraction:\n case IncrementalSource.Scroll:\n case IncrementalSource.CanvasMutation:\n case IncrementalSource.Input: {\n this.replaceIds(e2.data, iframeEl, [\"id\"]);\n return e2;\n }\n case IncrementalSource.StyleSheetRule:\n case IncrementalSource.StyleDeclaration: {\n this.replaceIds(e2.data, iframeEl, [\"id\"]);\n this.replaceStyleIds(e2.data, iframeEl, [\"styleId\"]);\n return e2;\n }\n case IncrementalSource.Font: {\n return e2;\n }\n case IncrementalSource.Selection: {\n e2.data.ranges.forEach((range) => {\n this.replaceIds(range, iframeEl, [\"start\", \"end\"]);\n });\n return e2;\n }\n case IncrementalSource.AdoptedStyleSheet: {\n this.replaceIds(e2.data, iframeEl, [\"id\"]);\n this.replaceStyleIds(e2.data, iframeEl, [\"styleIds\"]);\n (_a2 = e2.data.styles) == null ? void 0 : _a2.forEach((style) => {\n this.replaceStyleIds(style, iframeEl, [\"styleId\"]);\n });\n return e2;\n }\n }\n }\n }\n return false;\n }\n replace(iframeMirror, obj, iframeEl, keys) {\n for (const key of keys) {\n if (!Array.isArray(obj[key]) && typeof obj[key] !== \"number\") continue;\n if (Array.isArray(obj[key])) {\n obj[key] = iframeMirror.getIds(\n iframeEl,\n obj[key]\n );\n } else {\n obj[key] = iframeMirror.getId(iframeEl, obj[key]);\n }\n }\n return obj;\n }\n replaceIds(obj, iframeEl, keys) {\n return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys);\n }\n replaceStyleIds(obj, iframeEl, keys) {\n return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys);\n }\n replaceIdOnNode(node2, iframeEl) {\n this.replaceIds(node2, iframeEl, [\"id\", \"rootId\"]);\n if (\"childNodes\" in node2) {\n node2.childNodes.forEach((child) => {\n this.replaceIdOnNode(child, iframeEl);\n });\n }\n }\n patchRootIdOnNode(node2, rootId) {\n if (node2.type !== NodeType$2.Document && !node2.rootId) node2.rootId = rootId;\n if (\"childNodes\" in node2) {\n node2.childNodes.forEach((child) => {\n this.patchRootIdOnNode(child, rootId);\n });\n }\n }\n}\nclass ShadowDomManager {\n constructor(options) {\n __publicField(this, \"shadowDoms\", /* @__PURE__ */ new WeakSet());\n __publicField(this, \"mutationCb\");\n __publicField(this, \"scrollCb\");\n __publicField(this, \"bypassOptions\");\n __publicField(this, \"mirror\");\n __publicField(this, \"restoreHandlers\", []);\n this.mutationCb = options.mutationCb;\n this.scrollCb = options.scrollCb;\n this.bypassOptions = options.bypassOptions;\n this.mirror = options.mirror;\n this.init();\n }\n init() {\n this.reset();\n this.patchAttachShadow(Element, document);\n }\n addShadowRoot(shadowRoot2, doc) {\n if (!isNativeShadowDom(shadowRoot2)) return;\n if (this.shadowDoms.has(shadowRoot2)) return;\n this.shadowDoms.add(shadowRoot2);\n const observer = initMutationObserver(\n {\n ...this.bypassOptions,\n doc,\n mutationCb: this.mutationCb,\n mirror: this.mirror,\n shadowDomManager: this\n },\n shadowRoot2\n );\n this.restoreHandlers.push(() => observer.disconnect());\n this.restoreHandlers.push(\n initScrollObserver({\n ...this.bypassOptions,\n scrollCb: this.scrollCb,\n // https://gist.github.com/praveenpuglia/0832da687ed5a5d7a0907046c9ef1813\n // scroll is not allowed to pass the boundary, so we need to listen the shadow document\n doc: shadowRoot2,\n mirror: this.mirror\n })\n );\n setTimeout(() => {\n if (shadowRoot2.adoptedStyleSheets && shadowRoot2.adoptedStyleSheets.length > 0)\n this.bypassOptions.stylesheetManager.adoptStyleSheets(\n shadowRoot2.adoptedStyleSheets,\n this.mirror.getId(index.host(shadowRoot2))\n );\n this.restoreHandlers.push(\n initAdoptedStyleSheetObserver(\n {\n mirror: this.mirror,\n stylesheetManager: this.bypassOptions.stylesheetManager\n },\n shadowRoot2\n )\n );\n }, 0);\n }\n /**\n * Monkey patch 'attachShadow' of an IFrameElement to observe newly added shadow doms.\n */\n observeAttachShadow(iframeElement) {\n if (!iframeElement.contentWindow || !iframeElement.contentDocument) return;\n this.patchAttachShadow(\n iframeElement.contentWindow.Element,\n iframeElement.contentDocument\n );\n }\n /**\n * Patch 'attachShadow' to observe newly added shadow doms.\n */\n patchAttachShadow(element, doc) {\n const manager = this;\n this.restoreHandlers.push(\n patch(\n element.prototype,\n \"attachShadow\",\n function(original) {\n return function(option) {\n const sRoot = original.call(this, option);\n const shadowRootEl = index.shadowRoot(this);\n if (shadowRootEl && inDom(this))\n manager.addShadowRoot(shadowRootEl, doc);\n return sRoot;\n };\n }\n )\n );\n }\n reset() {\n this.restoreHandlers.forEach((handler) => {\n try {\n handler();\n } catch (e2) {\n }\n });\n this.restoreHandlers = [];\n this.shadowDoms = /* @__PURE__ */ new WeakSet();\n }\n}\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar lookup = typeof Uint8Array === \"undefined\" ? [] : new Uint8Array(256);\nfor (var i$1 = 0; i$1 < chars.length; i$1++) {\n lookup[chars.charCodeAt(i$1)] = i$1;\n}\nvar encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = \"\";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n return base64;\n};\nconst canvasVarMap = /* @__PURE__ */ new Map();\nfunction variableListFor$1(ctx, ctor) {\n let contextMap = canvasVarMap.get(ctx);\n if (!contextMap) {\n contextMap = /* @__PURE__ */ new Map();\n canvasVarMap.set(ctx, contextMap);\n }\n if (!contextMap.has(ctor)) {\n contextMap.set(ctor, []);\n }\n return contextMap.get(ctor);\n}\nconst saveWebGLVar = (value, win, ctx) => {\n if (!value || !(isInstanceOfWebGLObject(value, win) || typeof value === \"object\"))\n return;\n const name = value.constructor.name;\n const list2 = variableListFor$1(ctx, name);\n let index2 = list2.indexOf(value);\n if (index2 === -1) {\n index2 = list2.length;\n list2.push(value);\n }\n return index2;\n};\nfunction serializeArg(value, win, ctx) {\n if (value instanceof Array) {\n return value.map((arg) => serializeArg(arg, win, ctx));\n } else if (value === null) {\n return value;\n } else if (value instanceof Float32Array || value instanceof Float64Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Int16Array || value instanceof Int8Array || value instanceof Uint8ClampedArray) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [Object.values(value)]\n };\n } else if (\n // SharedArrayBuffer disabled on most browsers due to spectre.\n // More info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/SharedArrayBuffer\n // value instanceof SharedArrayBuffer ||\n value instanceof ArrayBuffer\n ) {\n const name = value.constructor.name;\n const base64 = encode(value);\n return {\n rr_type: name,\n base64\n };\n } else if (value instanceof DataView) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [\n serializeArg(value.buffer, win, ctx),\n value.byteOffset,\n value.byteLength\n ]\n };\n } else if (value instanceof HTMLImageElement) {\n const name = value.constructor.name;\n const { src } = value;\n return {\n rr_type: name,\n src\n };\n } else if (value instanceof HTMLCanvasElement) {\n const name = \"HTMLImageElement\";\n const src = value.toDataURL();\n return {\n rr_type: name,\n src\n };\n } else if (value instanceof ImageData) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [serializeArg(value.data, win, ctx), value.width, value.height]\n };\n } else if (isInstanceOfWebGLObject(value, win) || typeof value === \"object\") {\n const name = value.constructor.name;\n const index2 = saveWebGLVar(value, win, ctx);\n return {\n rr_type: name,\n index: index2\n };\n }\n return value;\n}\nconst serializeArgs = (args, win, ctx) => {\n return args.map((arg) => serializeArg(arg, win, ctx));\n};\nconst isInstanceOfWebGLObject = (value, win) => {\n const webGLConstructorNames = [\n \"WebGLActiveInfo\",\n \"WebGLBuffer\",\n \"WebGLFramebuffer\",\n \"WebGLProgram\",\n \"WebGLRenderbuffer\",\n \"WebGLShader\",\n \"WebGLShaderPrecisionFormat\",\n \"WebGLTexture\",\n \"WebGLUniformLocation\",\n \"WebGLVertexArrayObject\",\n // In old Chrome versions, value won't be an instanceof WebGLVertexArrayObject.\n \"WebGLVertexArrayObjectOES\"\n ];\n const supportedWebGLConstructorNames = webGLConstructorNames.filter(\n (name) => typeof win[name] === \"function\"\n );\n return Boolean(\n supportedWebGLConstructorNames.find(\n (name) => value instanceof win[name]\n )\n );\n};\nfunction initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {\n const handlers = [];\n const props2D = Object.getOwnPropertyNames(\n win.CanvasRenderingContext2D.prototype\n );\n for (const prop of props2D) {\n try {\n if (typeof win.CanvasRenderingContext2D.prototype[prop] !== \"function\") {\n continue;\n }\n const restoreHandler = patch(\n win.CanvasRenderingContext2D.prototype,\n prop,\n function(original) {\n return function(...args) {\n if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {\n setTimeout(() => {\n const recordArgs = serializeArgs(args, win, this);\n cb(this.canvas, {\n type: CanvasContext[\"2D\"],\n property: prop,\n args: recordArgs\n });\n }, 0);\n }\n return original.apply(this, args);\n };\n }\n );\n handlers.push(restoreHandler);\n } catch {\n const hookHandler = hookSetter(\n win.CanvasRenderingContext2D.prototype,\n prop,\n {\n set(v2) {\n cb(this.canvas, {\n type: CanvasContext[\"2D\"],\n property: prop,\n args: [v2],\n setter: true\n });\n }\n }\n );\n handlers.push(hookHandler);\n }\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nfunction getNormalizedContextName(contextType) {\n return contextType === \"experimental-webgl\" ? \"webgl\" : contextType;\n}\nfunction initCanvasContextObserver(win, blockClass, blockSelector, setPreserveDrawingBufferToTrue) {\n const handlers = [];\n try {\n const restoreHandler = patch(\n win.HTMLCanvasElement.prototype,\n \"getContext\",\n function(original) {\n return function(contextType, ...args) {\n if (!isBlocked(this, blockClass, blockSelector, true)) {\n const ctxName = getNormalizedContextName(contextType);\n if (!(\"__context\" in this)) this.__context = ctxName;\n if (setPreserveDrawingBufferToTrue && [\"webgl\", \"webgl2\"].includes(ctxName)) {\n if (args[0] && typeof args[0] === \"object\") {\n const contextAttributes = args[0];\n if (!contextAttributes.preserveDrawingBuffer) {\n contextAttributes.preserveDrawingBuffer = true;\n }\n } else {\n args.splice(0, 1, {\n preserveDrawingBuffer: true\n });\n }\n }\n }\n return original.apply(this, [contextType, ...args]);\n };\n }\n );\n handlers.push(restoreHandler);\n } catch {\n console.error(\"failed to patch HTMLCanvasElement.prototype.getContext\");\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nfunction patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {\n const handlers = [];\n const props = Object.getOwnPropertyNames(prototype);\n for (const prop of props) {\n if (\n //prop.startsWith('get') || // e.g. getProgramParameter, but too risky\n [\n \"isContextLost\",\n \"canvas\",\n \"drawingBufferWidth\",\n \"drawingBufferHeight\"\n ].includes(prop)\n ) {\n continue;\n }\n try {\n if (typeof prototype[prop] !== \"function\") {\n continue;\n }\n const restoreHandler = patch(\n prototype,\n prop,\n function(original) {\n return function(...args) {\n const result2 = original.apply(this, args);\n saveWebGLVar(result2, win, this);\n if (\"tagName\" in this.canvas && !isBlocked(this.canvas, blockClass, blockSelector, true)) {\n const recordArgs = serializeArgs(args, win, this);\n const mutation = {\n type,\n property: prop,\n args: recordArgs\n };\n cb(this.canvas, mutation);\n }\n return result2;\n };\n }\n );\n handlers.push(restoreHandler);\n } catch {\n const hookHandler = hookSetter(prototype, prop, {\n set(v2) {\n cb(this.canvas, {\n type,\n property: prop,\n args: [v2],\n setter: true\n });\n }\n });\n handlers.push(hookHandler);\n }\n }\n return handlers;\n}\nfunction initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {\n const handlers = [];\n handlers.push(\n ...patchGLPrototype(\n win.WebGLRenderingContext.prototype,\n CanvasContext.WebGL,\n cb,\n blockClass,\n blockSelector,\n win\n )\n );\n if (typeof win.WebGL2RenderingContext !== \"undefined\") {\n handlers.push(\n ...patchGLPrototype(\n win.WebGL2RenderingContext.prototype,\n CanvasContext.WebGL2,\n cb,\n blockClass,\n blockSelector,\n win\n )\n );\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nconst encodedJs = \"KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3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Yk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=\";\nconst decodeBase64 = (base64) => Uint8Array.from(atob(base64), (c2) => c2.charCodeAt(0));\nconst blob = typeof window !== \"undefined\" && window.Blob && new Blob([decodeBase64(encodedJs)], { type: \"text/javascript;charset=utf-8\" });\nfunction WorkerWrapper(options) {\n let objURL;\n try {\n objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob);\n if (!objURL) throw \"\";\n const worker = new Worker(objURL, {\n name: options == null ? void 0 : options.name\n });\n worker.addEventListener(\"error\", () => {\n (window.URL || window.webkitURL).revokeObjectURL(objURL);\n });\n return worker;\n } catch (e2) {\n return new Worker(\n \"data:text/javascript;base64,\" + encodedJs,\n {\n name: options == null ? void 0 : options.name\n }\n );\n } finally {\n objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL);\n }\n}\nclass CanvasManager {\n constructor(options) {\n __publicField(this, \"pendingCanvasMutations\", /* @__PURE__ */ new Map());\n __publicField(this, \"rafStamps\", { latestId: 0, invokeId: null });\n __publicField(this, \"mirror\");\n __publicField(this, \"mutationCb\");\n __publicField(this, \"resetObservers\");\n __publicField(this, \"frozen\", false);\n __publicField(this, \"locked\", false);\n __publicField(this, \"processMutation\", (target, mutation) => {\n const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;\n if (newFrame || !this.rafStamps.invokeId)\n this.rafStamps.invokeId = this.rafStamps.latestId;\n if (!this.pendingCanvasMutations.has(target)) {\n this.pendingCanvasMutations.set(target, []);\n }\n this.pendingCanvasMutations.get(target).push(mutation);\n });\n const {\n sampling = \"all\",\n win,\n blockClass,\n blockSelector,\n recordCanvas,\n dataURLOptions\n } = options;\n this.mutationCb = options.mutationCb;\n this.mirror = options.mirror;\n if (recordCanvas && sampling === \"all\")\n this.initCanvasMutationObserver(win, blockClass, blockSelector);\n if (recordCanvas && typeof sampling === \"number\")\n this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector, {\n dataURLOptions\n });\n }\n reset() {\n this.pendingCanvasMutations.clear();\n this.resetObservers && this.resetObservers();\n }\n freeze() {\n this.frozen = true;\n }\n unfreeze() {\n this.frozen = false;\n }\n lock() {\n this.locked = true;\n }\n unlock() {\n this.locked = false;\n }\n initCanvasFPSObserver(fps, win, blockClass, blockSelector, options) {\n const canvasContextReset = initCanvasContextObserver(\n win,\n blockClass,\n blockSelector,\n true\n );\n const snapshotInProgressMap = /* @__PURE__ */ new Map();\n const worker = new WorkerWrapper();\n worker.onmessage = (e2) => {\n const { id } = e2.data;\n snapshotInProgressMap.set(id, false);\n if (!(\"base64\" in e2.data)) return;\n const { base64, type, width, height } = e2.data;\n this.mutationCb({\n id,\n type: CanvasContext[\"2D\"],\n commands: [\n {\n property: \"clearRect\",\n // wipe canvas\n args: [0, 0, width, height]\n },\n {\n property: \"drawImage\",\n // draws (semi-transparent) image\n args: [\n {\n rr_type: \"ImageBitmap\",\n args: [\n {\n rr_type: \"Blob\",\n data: [{ rr_type: \"ArrayBuffer\", base64 }],\n type\n }\n ]\n },\n 0,\n 0\n ]\n }\n ]\n });\n };\n const timeBetweenSnapshots = 1e3 / fps;\n let lastSnapshotTime = 0;\n let rafId;\n const getCanvas = () => {\n const matchedCanvas = [];\n const searchCanvas = (root) => {\n root.querySelectorAll(\"canvas\").forEach((canvas) => {\n if (!isBlocked(canvas, blockClass, blockSelector, true)) {\n matchedCanvas.push(canvas);\n }\n });\n root.querySelectorAll(\"*\").forEach((elem) => {\n if (elem.shadowRoot) {\n searchCanvas(elem.shadowRoot);\n }\n });\n };\n searchCanvas(win.document);\n return matchedCanvas;\n };\n const takeCanvasSnapshots = (timestamp) => {\n if (lastSnapshotTime && timestamp - lastSnapshotTime < timeBetweenSnapshots) {\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n return;\n }\n lastSnapshotTime = timestamp;\n getCanvas().forEach(async (canvas) => {\n var _a2;\n const id = this.mirror.getId(canvas);\n if (snapshotInProgressMap.get(id)) return;\n if (canvas.width === 0 || canvas.height === 0) return;\n snapshotInProgressMap.set(id, true);\n if ([\"webgl\", \"webgl2\"].includes(canvas.__context)) {\n const context = canvas.getContext(canvas.__context);\n if (((_a2 = context == null ? void 0 : context.getContextAttributes()) == null ? void 0 : _a2.preserveDrawingBuffer) === false) {\n context.clear(context.COLOR_BUFFER_BIT);\n }\n }\n // createImageBitmap throws if resizing to 0\n // Fallback to intrinsic size if canvas has not yet rendered\n const width = canvas.clientWidth || canvas.width;\n const height = canvas.clientHeight || canvas.height;\n const bitmap = await createImageBitmap(canvas, {\n resizeWidth: width,\n resizeHeight: height\n });\n worker.postMessage(\n {\n id,\n bitmap,\n width: width,\n height: height,\n dataURLOptions: options.dataURLOptions\n },\n [bitmap]\n );\n });\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n };\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n this.resetObservers = () => {\n canvasContextReset();\n cancelAnimationFrame(rafId);\n };\n }\n initCanvasMutationObserver(win, blockClass, blockSelector) {\n this.startRAFTimestamping();\n this.startPendingCanvasMutationFlusher();\n const canvasContextReset = initCanvasContextObserver(\n win,\n blockClass,\n blockSelector,\n false\n );\n const canvas2DReset = initCanvas2DMutationObserver(\n this.processMutation.bind(this),\n win,\n blockClass,\n blockSelector\n );\n const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(\n this.processMutation.bind(this),\n win,\n blockClass,\n blockSelector\n );\n this.resetObservers = () => {\n canvasContextReset();\n canvas2DReset();\n canvasWebGL1and2Reset();\n };\n }\n startPendingCanvasMutationFlusher() {\n requestAnimationFrame(() => this.flushPendingCanvasMutations());\n }\n startRAFTimestamping() {\n const setLatestRAFTimestamp = (timestamp) => {\n this.rafStamps.latestId = timestamp;\n requestAnimationFrame(setLatestRAFTimestamp);\n };\n requestAnimationFrame(setLatestRAFTimestamp);\n }\n flushPendingCanvasMutations() {\n this.pendingCanvasMutations.forEach(\n (_values, canvas) => {\n const id = this.mirror.getId(canvas);\n this.flushPendingCanvasMutationFor(canvas, id);\n }\n );\n requestAnimationFrame(() => this.flushPendingCanvasMutations());\n }\n flushPendingCanvasMutationFor(canvas, id) {\n if (this.frozen || this.locked) {\n return;\n }\n const valuesWithType = this.pendingCanvasMutations.get(canvas);\n if (!valuesWithType || id === -1) return;\n const values = valuesWithType.map((value) => {\n const { type: type2, ...rest } = value;\n return rest;\n });\n const { type } = valuesWithType[0];\n this.mutationCb({ id, type, commands: values });\n this.pendingCanvasMutations.delete(canvas);\n }\n}\nclass StylesheetManager {\n constructor(options) {\n __publicField(this, \"trackedLinkElements\", /* @__PURE__ */ new WeakSet());\n __publicField(this, \"mutationCb\");\n __publicField(this, \"adoptedStyleSheetCb\");\n __publicField(this, \"styleMirror\", new StyleSheetMirror());\n this.mutationCb = options.mutationCb;\n this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;\n }\n attachLinkElement(linkEl, childSn) {\n if (\"_cssText\" in childSn.attributes)\n this.mutationCb({\n adds: [],\n removes: [],\n texts: [],\n attributes: [\n {\n id: childSn.id,\n attributes: childSn.attributes\n }\n ]\n });\n this.trackLinkElement(linkEl);\n }\n trackLinkElement(linkEl) {\n if (this.trackedLinkElements.has(linkEl)) return;\n this.trackedLinkElements.add(linkEl);\n this.trackStylesheetInLinkElement(linkEl);\n }\n adoptStyleSheets(sheets, hostId) {\n if (sheets.length === 0) return;\n const adoptedStyleSheetData = {\n id: hostId,\n styleIds: []\n };\n const styles = [];\n for (const sheet of sheets) {\n let styleId;\n if (!this.styleMirror.has(sheet)) {\n styleId = this.styleMirror.add(sheet);\n styles.push({\n styleId,\n rules: Array.from(sheet.rules || CSSRule, (r2, index2) => ({\n rule: stringifyRule(r2, sheet.href),\n index: index2\n }))\n });\n } else styleId = this.styleMirror.getId(sheet);\n adoptedStyleSheetData.styleIds.push(styleId);\n }\n if (styles.length > 0) adoptedStyleSheetData.styles = styles;\n this.adoptedStyleSheetCb(adoptedStyleSheetData);\n }\n reset() {\n this.styleMirror.reset();\n this.trackedLinkElements = /* @__PURE__ */ new WeakSet();\n }\n // TODO: take snapshot on stylesheet reload by applying event listener\n trackStylesheetInLinkElement(_linkEl) {\n }\n}\nclass ProcessedNodeManager {\n constructor() {\n __publicField(this, \"nodeMap\", /* @__PURE__ */ new WeakMap());\n __publicField(this, \"active\", false);\n }\n inOtherBuffer(node2, thisBuffer) {\n const buffers = this.nodeMap.get(node2);\n return buffers && Array.from(buffers).some((buffer) => buffer !== thisBuffer);\n }\n add(node2, buffer) {\n if (!this.active) {\n this.active = true;\n requestAnimationFrame(() => {\n this.nodeMap = /* @__PURE__ */ new WeakMap();\n this.active = false;\n });\n }\n this.nodeMap.set(node2, (this.nodeMap.get(node2) || /* @__PURE__ */ new Set()).add(buffer));\n }\n destroy() {\n }\n}\nlet wrappedEmit;\nlet takeFullSnapshot$1;\nlet canvasManager;\nlet recording = false;\ntry {\n if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {\n const cleanFrame = document.createElement(\"iframe\");\n document.body.appendChild(cleanFrame);\n Array.from = ((_a = cleanFrame.contentWindow) == null ? void 0 : _a.Array.from) || Array.from;\n document.body.removeChild(cleanFrame);\n }\n} catch (err) {\n console.debug(\"Unable to override Array.from\", err);\n}\nconst mirror = createMirror$2();\nfunction record(options = {}) {\n const {\n emit,\n checkoutEveryNms,\n checkoutEveryNth,\n blockClass = \"rr-block\",\n blockSelector = null,\n ignoreClass = \"rr-ignore\",\n ignoreSelector = null,\n maskTextClass = \"rr-mask\",\n maskTextSelector = null,\n inlineStylesheet = true,\n maskAllInputs,\n maskInputOptions: _maskInputOptions,\n slimDOMOptions: _slimDOMOptions,\n maskInputFn,\n maskTextFn,\n hooks,\n packFn,\n sampling = {},\n dataURLOptions = {},\n mousemoveWait,\n recordDOM = true,\n recordCanvas = false,\n recordCrossOriginIframes = false,\n recordAfter = options.recordAfter === \"DOMContentLoaded\" ? options.recordAfter : \"load\",\n userTriggeredOnInput = false,\n collectFonts = false,\n inlineImages = false,\n plugins,\n keepIframeSrcFn = () => false,\n ignoreCSSAttributes = /* @__PURE__ */ new Set([]),\n errorHandler: errorHandler2\n } = options;\n registerErrorHandler(errorHandler2);\n const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;\n let passEmitsToParent = false;\n if (!inEmittingFrame) {\n try {\n if (window.parent.document) {\n passEmitsToParent = false;\n }\n } catch (e2) {\n passEmitsToParent = true;\n }\n }\n if (inEmittingFrame && !emit) {\n throw new Error(\"emit function is required\");\n }\n if (!inEmittingFrame && !passEmitsToParent) {\n return () => {\n };\n }\n if (mousemoveWait !== void 0 && sampling.mousemove === void 0) {\n sampling.mousemove = mousemoveWait;\n }\n mirror.reset();\n const maskInputOptions = maskAllInputs === true ? {\n color: true,\n date: true,\n \"datetime-local\": true,\n email: true,\n month: true,\n number: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n time: true,\n url: true,\n week: true,\n textarea: true,\n select: true,\n password: true\n } : _maskInputOptions !== void 0 ? _maskInputOptions : { password: true };\n const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === \"all\" ? {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaVerification: true,\n // the following are off for slimDOMOptions === true,\n // as they destroy some (hidden) info:\n headMetaAuthorship: _slimDOMOptions === \"all\",\n headMetaDescKeywords: _slimDOMOptions === \"all\",\n headTitleMutations: _slimDOMOptions === \"all\"\n } : _slimDOMOptions ? _slimDOMOptions : {};\n polyfill$1();\n let lastFullSnapshotEvent;\n let incrementalSnapshotCount = 0;\n const eventProcessor = (e2) => {\n for (const plugin3 of plugins || []) {\n if (plugin3.eventProcessor) {\n e2 = plugin3.eventProcessor(e2);\n }\n }\n if (packFn && // Disable packing events which will be emitted to parent frames.\n !passEmitsToParent) {\n e2 = packFn(e2);\n }\n return e2;\n };\n wrappedEmit = (r2, isCheckout) => {\n var _a2;\n const e2 = r2;\n e2.timestamp = nowTimestamp();\n if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {\n mutationBuffers.forEach((buf) => buf.unfreeze());\n }\n if (inEmittingFrame) {\n emit == null ? void 0 : emit(eventProcessor(e2), isCheckout);\n } else if (passEmitsToParent) {\n const message = {\n type: \"rrweb\",\n event: eventProcessor(e2),\n origin: window.location.origin,\n isCheckout\n };\n window.parent.postMessage(message, \"*\");\n }\n if (e2.type === EventType.FullSnapshot) {\n lastFullSnapshotEvent = e2;\n incrementalSnapshotCount = 0;\n } else if (e2.type === EventType.IncrementalSnapshot) {\n if (e2.data.source === IncrementalSource.Mutation && e2.data.isAttachIframe) {\n return;\n }\n incrementalSnapshotCount++;\n const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;\n const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;\n if (exceedCount || exceedTime) {\n takeFullSnapshot$1(true);\n }\n }\n };\n const wrappedMutationEmit = (m) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Mutation,\n ...m\n }\n });\n };\n const wrappedScrollEmit = (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Scroll,\n ...p\n }\n });\n const wrappedCanvasMutationEmit = (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.CanvasMutation,\n ...p\n }\n });\n const wrappedAdoptedStyleSheetEmit = (a2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.AdoptedStyleSheet,\n ...a2\n }\n });\n const stylesheetManager = new StylesheetManager({\n mutationCb: wrappedMutationEmit,\n adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit\n });\n const iframeManager = new IframeManager({\n mirror,\n mutationCb: wrappedMutationEmit,\n stylesheetManager,\n recordCrossOriginIframes,\n wrappedEmit\n });\n for (const plugin3 of plugins || []) {\n if (plugin3.getMirror)\n plugin3.getMirror({\n nodeMirror: mirror,\n crossOriginIframeMirror: iframeManager.crossOriginIframeMirror,\n crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror\n });\n }\n const processedNodeManager = new ProcessedNodeManager();\n canvasManager = new CanvasManager({\n recordCanvas,\n mutationCb: wrappedCanvasMutationEmit,\n win: window,\n blockClass,\n blockSelector,\n mirror,\n sampling: sampling.canvas,\n dataURLOptions\n });\n const shadowDomManager = new ShadowDomManager({\n mutationCb: wrappedMutationEmit,\n scrollCb: wrappedScrollEmit,\n bypassOptions: {\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n inlineStylesheet,\n maskInputOptions,\n dataURLOptions,\n maskTextFn,\n maskInputFn,\n recordCanvas,\n inlineImages,\n sampling,\n slimDOMOptions,\n iframeManager,\n stylesheetManager,\n canvasManager,\n keepIframeSrcFn,\n processedNodeManager\n },\n mirror\n });\n takeFullSnapshot$1 = (isCheckout = false) => {\n if (!recordDOM) {\n return;\n }\n wrappedEmit(\n {\n type: EventType.Meta,\n data: {\n href: window.location.href,\n width: getWindowWidth(),\n height: getWindowHeight()\n }\n },\n isCheckout\n );\n stylesheetManager.reset();\n shadowDomManager.init();\n mutationBuffers.forEach((buf) => buf.lock());\n const node2 = snapshot(document, {\n mirror,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n inlineStylesheet,\n maskAllInputs: maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOM: slimDOMOptions,\n dataURLOptions,\n recordCanvas,\n inlineImages,\n onSerialize: (n2) => {\n if (isSerializedIframe(n2, mirror)) {\n iframeManager.addIframe(n2);\n }\n if (isSerializedStylesheet(n2, mirror)) {\n stylesheetManager.trackLinkElement(n2);\n }\n if (hasShadowRoot(n2)) {\n shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);\n }\n },\n onIframeLoad: (iframe, childSn) => {\n iframeManager.attachIframe(iframe, childSn);\n shadowDomManager.observeAttachShadow(iframe);\n },\n onStylesheetLoad: (linkEl, childSn) => {\n stylesheetManager.attachLinkElement(linkEl, childSn);\n },\n keepIframeSrcFn\n });\n if (!node2) {\n return console.warn(\"Failed to snapshot the document\");\n }\n wrappedEmit(\n {\n type: EventType.FullSnapshot,\n data: {\n node: node2,\n initialOffset: getWindowScroll(window)\n }\n },\n isCheckout\n );\n mutationBuffers.forEach((buf) => buf.unlock());\n if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)\n stylesheetManager.adoptStyleSheets(\n document.adoptedStyleSheets,\n mirror.getId(document)\n );\n };\n try {\n const handlers = [];\n const observe = (doc) => {\n var _a2;\n return callbackWrapper(initObservers)(\n {\n mutationCb: wrappedMutationEmit,\n mousemoveCb: (positions, source) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source,\n positions\n }\n }),\n mouseInteractionCb: (d) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.MouseInteraction,\n ...d\n }\n }),\n scrollCb: wrappedScrollEmit,\n viewportResizeCb: (d) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.ViewportResize,\n ...d\n }\n }),\n inputCb: (v2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Input,\n ...v2\n }\n }),\n mediaInteractionCb: (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.MediaInteraction,\n ...p\n }\n }),\n styleSheetRuleCb: (r2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.StyleSheetRule,\n ...r2\n }\n }),\n styleDeclarationCb: (r2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.StyleDeclaration,\n ...r2\n }\n }),\n canvasMutationCb: wrappedCanvasMutationEmit,\n fontCb: (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Font,\n ...p\n }\n }),\n selectionCb: (p) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Selection,\n ...p\n }\n });\n },\n customElementCb: (c2) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.CustomElement,\n ...c2\n }\n });\n },\n blockClass,\n ignoreClass,\n ignoreSelector,\n maskTextClass,\n maskTextSelector,\n maskInputOptions,\n inlineStylesheet,\n sampling,\n recordDOM,\n recordCanvas,\n inlineImages,\n userTriggeredOnInput,\n collectFonts,\n doc,\n maskInputFn,\n maskTextFn,\n keepIframeSrcFn,\n blockSelector,\n slimDOMOptions,\n dataURLOptions,\n mirror,\n iframeManager,\n stylesheetManager,\n shadowDomManager,\n processedNodeManager,\n canvasManager,\n ignoreCSSAttributes,\n plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({\n observer: p.observer,\n options: p.options,\n callback: (payload) => wrappedEmit({\n type: EventType.Plugin,\n data: {\n plugin: p.name,\n payload\n }\n })\n }))) || []\n },\n hooks\n );\n };\n iframeManager.addLoadListener((iframeEl) => {\n try {\n handlers.push(observe(iframeEl.contentDocument));\n } catch (error) {\n console.warn(error);\n }\n });\n const init = () => {\n takeFullSnapshot$1();\n handlers.push(observe(document));\n recording = true;\n };\n if (document.readyState === \"interactive\" || document.readyState === \"complete\") {\n init();\n } else {\n handlers.push(\n on(\"DOMContentLoaded\", () => {\n wrappedEmit({\n type: EventType.DomContentLoaded,\n data: {}\n });\n if (recordAfter === \"DOMContentLoaded\") init();\n })\n );\n handlers.push(\n on(\n \"load\",\n () => {\n wrappedEmit({\n type: EventType.Load,\n data: {}\n });\n if (recordAfter === \"load\") init();\n },\n window\n )\n );\n }\n return () => {\n handlers.forEach((h) => h());\n processedNodeManager.destroy();\n recording = false;\n unregisterErrorHandler();\n };\n } catch (error) {\n console.warn(error);\n }\n}\nrecord.addCustomEvent = (tag, payload) => {\n if (!recording) {\n throw new Error(\"please add custom event after start recording\");\n }\n wrappedEmit({\n type: EventType.Custom,\n data: {\n tag,\n payload\n }\n });\n};\nrecord.freezePage = () => {\n mutationBuffers.forEach((buf) => buf.freeze());\n};\nrecord.takeFullSnapshot = (isCheckout) => {\n if (!recording) {\n throw new Error(\"please take full snapshot after start recording\");\n }\n takeFullSnapshot$1(isCheckout);\n};\nrecord.mirror = mirror;\nvar n;\n!function(t2) {\n t2[t2.NotStarted = 0] = \"NotStarted\", t2[t2.Running = 1] = \"Running\", t2[t2.Stopped = 2] = \"Stopped\";\n}(n || (n = {}));\nexport {\n record\n};\n//# sourceMappingURL=record.js.map\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar __defProp2 = Object.defineProperty;\nvar __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar _a;\nvar __defProp$1 = Object.defineProperty;\nvar __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nconst testableAccessors$1 = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods$1 = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\nconst untaintedBasePrototype$1 = {};\nfunction getUntaintedPrototype$1(key) {\n if (untaintedBasePrototype$1[key])\n return untaintedBasePrototype$1[key];\n const defaultObj = globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a2, _b;\n return Boolean(\n (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a2;\n return typeof defaultPrototype[method] === \"function\" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods) {\n untaintedBasePrototype$1[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype$1[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache$1 = {};\nfunction getUntaintedAccessor$1(key, instance, accessor) {\n var _a2;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache$1[cacheKey])\n return untaintedAccessorCache$1[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype$1(key);\n const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a2.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache$1[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache$1 = {};\nfunction getUntaintedMethod$1(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache$1[cacheKey])\n return untaintedMethodCache$1[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype$1(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache$1[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"childNodes\");\n}\nfunction parentNode$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"parentNode\");\n}\nfunction parentElement$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"parentElement\");\n}\nfunction textContent$1(n2) {\n return getUntaintedAccessor$1(\"Node\", n2, \"textContent\");\n}\nfunction contains$1(n2, other) {\n return getUntaintedMethod$1(\"Node\", n2, \"contains\")(other);\n}\nfunction getRootNode$1(n2) {\n return getUntaintedMethod$1(\"Node\", n2, \"getRootNode\")();\n}\nfunction host$1(n2) {\n if (!n2 || !(\"host\" in n2)) return null;\n return getUntaintedAccessor$1(\"ShadowRoot\", n2, \"host\");\n}\nfunction styleSheets$1(n2) {\n return n2.styleSheets;\n}\nfunction shadowRoot$1(n2) {\n if (!n2 || !(\"shadowRoot\" in n2)) return null;\n return getUntaintedAccessor$1(\"Element\", n2, \"shadowRoot\");\n}\nfunction querySelector$1(n2, selectors) {\n return getUntaintedAccessor$1(\"Element\", n2, \"querySelector\")(selectors);\n}\nfunction querySelectorAll$1(n2, selectors) {\n return getUntaintedAccessor$1(\"Element\", n2, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor$1() {\n return getUntaintedPrototype$1(\"MutationObserver\").constructor;\n}\nconst index$1 = {\n childNodes: childNodes$1,\n parentNode: parentNode$1,\n parentElement: parentElement$1,\n textContent: textContent$1,\n contains: contains$1,\n getRootNode: getRootNode$1,\n host: host$1,\n styleSheets: styleSheets$1,\n shadowRoot: shadowRoot$1,\n querySelector: querySelector$1,\n querySelectorAll: querySelectorAll$1,\n mutationObserver: mutationObserverCtor$1\n};\nfunction isShadowRoot(n2) {\n const hostEl = (\n // anchor and textarea elements also have a `host` property\n // but only shadow roots have a `mode` property\n n2 && \"host\" in n2 && \"mode\" in n2 && index$1.host(n2) || null\n );\n return Boolean(\n hostEl && \"shadowRoot\" in hostEl && index$1.shadowRoot(hostEl) === n2\n );\n}\nclass Mirror {\n constructor() {\n __publicField$1(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField$1(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n2) {\n var _a2;\n if (!n2) return -1;\n const id = (_a2 = this.getMeta(n2)) == null ? void 0 : _a2.id;\n return id ?? -1;\n }\n getNode(id) {\n return this.idNodeMap.get(id) || null;\n }\n getIds() {\n return Array.from(this.idNodeMap.keys());\n }\n getMeta(n2) {\n return this.nodeMetaMap.get(n2) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n2) {\n const id = this.getId(n2);\n this.idNodeMap.delete(id);\n if (n2.childNodes) {\n n2.childNodes.forEach(\n (childNode) => this.removeNodeFromMap(childNode)\n );\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node2) {\n return this.nodeMetaMap.has(node2);\n }\n add(n2, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n2);\n this.nodeMetaMap.set(n2, meta);\n }\n replace(id, n2) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n2, meta);\n }\n this.idNodeMap.set(id, n2);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction createMirror$2() {\n return new Mirror();\n}\nconst IGNORED_NODE = -2;\nfunction classMatchesRegex(node2, regex, checkAncestors) {\n if (!node2) return false;\n if (node2.nodeType !== node2.ELEMENT_NODE) {\n if (!checkAncestors) return false;\n return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);\n }\n for (let eIndex = node2.classList.length; eIndex--; ) {\n const className = node2.classList[eIndex];\n if (regex.test(className)) {\n return true;\n }\n }\n if (!checkAncestors) return false;\n return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);\n}\nfunction getDefaultExportFromCjs$1(x2) {\n return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, \"default\") ? x2[\"default\"] : x2;\n}\nfunction getAugmentedNamespace$1(n2) {\n if (n2.__esModule) return n2;\n var f2 = n2.default;\n if (typeof f2 == \"function\") {\n var a2 = function a22() {\n if (this instanceof a22) {\n return Reflect.construct(f2, arguments, this.constructor);\n }\n return f2.apply(this, arguments);\n };\n a2.prototype = f2.prototype;\n } else a2 = {};\n Object.defineProperty(a2, \"__esModule\", { value: true });\n Object.keys(n2).forEach(function(k) {\n var d = Object.getOwnPropertyDescriptor(n2, k);\n Object.defineProperty(a2, k, d.get ? d : {\n enumerable: true,\n get: function() {\n return n2[k];\n }\n });\n });\n return a2;\n}\n// Removed postcss here\nclass BaseRRNode {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n constructor(..._args) {\n __publicField22(this, \"parentElement\", null);\n __publicField22(this, \"parentNode\", null);\n __publicField22(this, \"ownerDocument\");\n __publicField22(this, \"firstChild\", null);\n __publicField22(this, \"lastChild\", null);\n __publicField22(this, \"previousSibling\", null);\n __publicField22(this, \"nextSibling\", null);\n __publicField22(this, \"ELEMENT_NODE\", 1);\n __publicField22(this, \"TEXT_NODE\", 3);\n __publicField22(this, \"nodeType\");\n __publicField22(this, \"nodeName\");\n __publicField22(this, \"RRNodeType\");\n }\n get childNodes() {\n const childNodes2 = [];\n let childIterator = this.firstChild;\n while (childIterator) {\n childNodes2.push(childIterator);\n childIterator = childIterator.nextSibling;\n }\n return childNodes2;\n }\n contains(node2) {\n if (!(node2 instanceof BaseRRNode)) return false;\n else if (node2.ownerDocument !== this.ownerDocument) return false;\n else if (node2 === this) return true;\n while (node2.parentNode) {\n if (node2.parentNode === this) return true;\n node2 = node2.parentNode;\n }\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n appendChild(_newChild) {\n throw new Error(\n `RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n insertBefore(_newChild, _refChild) {\n throw new Error(\n `RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n removeChild(_node) {\n throw new Error(\n `RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n toString() {\n return \"RRNode\";\n }\n}\nconst testableAccessors = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\nconst untaintedBasePrototype = {};\nfunction getUntaintedPrototype(key) {\n if (untaintedBasePrototype[key])\n return untaintedBasePrototype[key];\n const defaultObj = globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a2, _b;\n return Boolean(\n (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods ? testableMethods[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a2;\n return typeof defaultPrototype[method] === \"function\" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods) {\n untaintedBasePrototype[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache = {};\nfunction getUntaintedAccessor(key, instance, accessor) {\n var _a2;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache[cacheKey])\n return untaintedAccessorCache[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a2.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache = {};\nfunction getUntaintedMethod(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache[cacheKey])\n return untaintedMethodCache[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"childNodes\");\n}\nfunction parentNode(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"parentNode\");\n}\nfunction parentElement(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"parentElement\");\n}\nfunction textContent(n2) {\n return getUntaintedAccessor(\"Node\", n2, \"textContent\");\n}\nfunction contains(n2, other) {\n return getUntaintedMethod(\"Node\", n2, \"contains\")(other);\n}\nfunction getRootNode(n2) {\n return getUntaintedMethod(\"Node\", n2, \"getRootNode\")();\n}\nfunction host(n2) {\n if (!n2 || !(\"host\" in n2)) return null;\n return getUntaintedAccessor(\"ShadowRoot\", n2, \"host\");\n}\nfunction styleSheets(n2) {\n return n2.styleSheets;\n}\nfunction shadowRoot(n2) {\n if (!n2 || !(\"shadowRoot\" in n2)) return null;\n return getUntaintedAccessor(\"Element\", n2, \"shadowRoot\");\n}\nfunction querySelector(n2, selectors) {\n return getUntaintedAccessor(\"Element\", n2, \"querySelector\")(selectors);\n}\nfunction querySelectorAll(n2, selectors) {\n return getUntaintedAccessor(\"Element\", n2, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor() {\n return getUntaintedPrototype(\"MutationObserver\").constructor;\n}\nconst index = {\n childNodes,\n parentNode,\n parentElement,\n textContent,\n contains,\n getRootNode,\n host,\n styleSheets,\n shadowRoot,\n querySelector,\n querySelectorAll,\n mutationObserver: mutationObserverCtor\n};\nfunction on(type, fn, target = document) {\n const options = { capture: true, passive: true };\n target.addEventListener(type, fn, options);\n return () => target.removeEventListener(type, fn, options);\n}\nconst DEPARTED_MIRROR_ACCESS_WARNING = \"Please stop import mirror directly. Instead of that,\\r\\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\\r\\nor you can use record.mirror to access the mirror instance during recording.\";\nlet _mirror = {\n map: {},\n getId() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return -1;\n },\n getNode() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return null;\n },\n removeNodeFromMap() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n },\n has() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return false;\n },\n reset() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n};\nif (typeof window !== \"undefined\" && window.Proxy && window.Reflect) {\n _mirror = new Proxy(_mirror, {\n get(target, prop, receiver) {\n if (prop === \"map\") {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n return Reflect.get(target, prop, receiver);\n }\n });\n}\nfunction throttle(func, wait, options = {}) {\n let timeout = null;\n let previous = 0;\n return function(...args) {\n const now = Date.now();\n if (!previous && options.leading === false) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n const context = this;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n func.apply(context, args);\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(() => {\n previous = options.leading === false ? 0 : Date.now();\n timeout = null;\n func.apply(context, args);\n }, remaining);\n }\n };\n}\nfunction hookSetter(target, key, d, isRevoked, win = window) {\n const original = win.Object.getOwnPropertyDescriptor(target, key);\n win.Object.defineProperty(\n target,\n key,\n isRevoked ? d : {\n set(value) {\n setTimeout(() => {\n d.set.call(this, value);\n }, 0);\n if (original && original.set) {\n original.set.call(this, value);\n }\n }\n }\n );\n return () => hookSetter(target, key, original || {}, true);\n}\nfunction patch(source, name, replacement) {\n try {\n if (!(name in source)) {\n return () => {\n };\n }\n const original = source[name];\n const wrapped = replacement(original);\n if (typeof wrapped === \"function\") {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original\n }\n });\n }\n source[name] = wrapped;\n return () => {\n source[name] = original;\n };\n } catch {\n return () => {\n };\n }\n}\nlet nowTimestamp = Date.now;\nif (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {\n nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();\n}\nfunction getWindowScroll(win) {\n var _a2, _b, _c, _d;\n const doc = win.document;\n return {\n left: doc.scrollingElement ? doc.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : doc.documentElement.scrollLeft || (doc == null ? void 0 : doc.body) && ((_a2 = index.parentElement(doc.body)) == null ? void 0 : _a2.scrollLeft) || ((_b = doc == null ? void 0 : doc.body) == null ? void 0 : _b.scrollLeft) || 0,\n top: doc.scrollingElement ? doc.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : (doc == null ? void 0 : doc.documentElement.scrollTop) || (doc == null ? void 0 : doc.body) && ((_c = index.parentElement(doc.body)) == null ? void 0 : _c.scrollTop) || ((_d = doc == null ? void 0 : doc.body) == null ? void 0 : _d.scrollTop) || 0\n };\n}\nfunction getWindowHeight() {\n return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;\n}\nfunction getWindowWidth() {\n return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;\n}\nfunction closestElementOfNode(node2) {\n if (!node2) {\n return null;\n }\n const el = node2.nodeType === node2.ELEMENT_NODE ? node2 : index.parentElement(node2);\n return el;\n}\nfunction isBlocked(node2, blockClass, blockSelector, checkAncestors) {\n if (!node2) {\n return false;\n }\n const el = closestElementOfNode(node2);\n if (!el) {\n return false;\n }\n try {\n if (typeof blockClass === \"string\") {\n if (el.classList.contains(blockClass)) return true;\n if (checkAncestors && el.closest(\".\" + blockClass) !== null) return true;\n } else {\n if (classMatchesRegex(el, blockClass, checkAncestors)) return true;\n }\n } catch (e2) {\n }\n if (blockSelector) {\n if (el.matches(blockSelector)) return true;\n if (checkAncestors && el.closest(blockSelector) !== null) return true;\n }\n return false;\n}\nfunction isSerialized(n2, mirror2) {\n return mirror2.getId(n2) !== -1;\n}\nfunction isIgnored(n2, mirror2, slimDOMOptions) {\n if (n2.tagName === \"TITLE\" && slimDOMOptions.headTitleMutations) {\n return true;\n }\n return mirror2.getId(n2) === IGNORED_NODE;\n}\nfunction isAncestorRemoved(target, mirror2) {\n if (isShadowRoot(target)) {\n return false;\n }\n const id = mirror2.getId(target);\n if (!mirror2.has(id)) {\n return true;\n }\n const parent = index.parentNode(target);\n if (parent && parent.nodeType === target.DOCUMENT_NODE) {\n return false;\n }\n if (!parent) {\n return true;\n }\n return isAncestorRemoved(parent, mirror2);\n}\nfunction legacy_isTouchEvent(event) {\n return Boolean(event.changedTouches);\n}\nfunction polyfill$1(win = window) {\n if (\"NodeList\" in win && !win.NodeList.prototype.forEach) {\n win.NodeList.prototype.forEach = Array.prototype.forEach;\n }\n if (\"DOMTokenList\" in win && !win.DOMTokenList.prototype.forEach) {\n win.DOMTokenList.prototype.forEach = Array.prototype.forEach;\n }\n}\nfunction queueToResolveTrees(queue) {\n const queueNodeMap = {};\n const putIntoMap = (m, parent) => {\n const nodeInTree = {\n value: m,\n parent,\n children: []\n };\n queueNodeMap[m.node.id] = nodeInTree;\n return nodeInTree;\n };\n const queueNodeTrees = [];\n for (const mutation of queue) {\n const { nextId, parentId } = mutation;\n if (nextId && nextId in queueNodeMap) {\n const nextInTree = queueNodeMap[nextId];\n if (nextInTree.parent) {\n const idx = nextInTree.parent.children.indexOf(nextInTree);\n nextInTree.parent.children.splice(\n idx,\n 0,\n putIntoMap(mutation, nextInTree.parent)\n );\n } else {\n const idx = queueNodeTrees.indexOf(nextInTree);\n queueNodeTrees.splice(idx, 0, putIntoMap(mutation, null));\n }\n continue;\n }\n if (parentId in queueNodeMap) {\n const parentInTree = queueNodeMap[parentId];\n parentInTree.children.push(putIntoMap(mutation, parentInTree));\n continue;\n }\n queueNodeTrees.push(putIntoMap(mutation, null));\n }\n return queueNodeTrees;\n}\nfunction iterateResolveTree(tree, cb) {\n cb(tree.value);\n for (let i2 = tree.children.length - 1; i2 >= 0; i2--) {\n iterateResolveTree(tree.children[i2], cb);\n }\n}\nfunction isSerializedIframe(n2, mirror2) {\n return Boolean(n2.nodeName === \"IFRAME\" && mirror2.getMeta(n2));\n}\nfunction isSerializedStylesheet(n2, mirror2) {\n return Boolean(\n n2.nodeName === \"LINK\" && n2.nodeType === n2.ELEMENT_NODE && n2.getAttribute && n2.getAttribute(\"rel\") === \"stylesheet\" && mirror2.getMeta(n2)\n );\n}\nfunction getBaseDimension(node2, rootIframe) {\n var _a2, _b;\n const frameElement = (_b = (_a2 = node2.ownerDocument) == null ? void 0 : _a2.defaultView) == null ? void 0 : _b.frameElement;\n if (!frameElement || frameElement === rootIframe) {\n return {\n x: 0,\n y: 0,\n relativeScale: 1,\n absoluteScale: 1\n };\n }\n const frameDimension = frameElement.getBoundingClientRect();\n const frameBaseDimension = getBaseDimension(frameElement, rootIframe);\n const relativeScale = frameDimension.height / frameElement.clientHeight;\n return {\n x: frameDimension.x * frameBaseDimension.relativeScale + frameBaseDimension.x,\n y: frameDimension.y * frameBaseDimension.relativeScale + frameBaseDimension.y,\n relativeScale,\n absoluteScale: frameBaseDimension.absoluteScale * relativeScale\n };\n}\nfunction hasShadowRoot(n2) {\n if (!n2) return false;\n if (n2 instanceof BaseRRNode && \"shadowRoot\" in n2) {\n return Boolean(n2.shadowRoot);\n }\n return Boolean(index.shadowRoot(n2));\n}\nfunction getNestedRule(rules2, position) {\n const rule2 = rules2[position[0]];\n if (position.length === 1) {\n return rule2;\n } else {\n return getNestedRule(\n rule2.cssRules[position[1]].cssRules,\n position.slice(2)\n );\n }\n}\nfunction getPositionsAndIndex(nestedIndex) {\n const positions = [...nestedIndex];\n const index2 = positions.pop();\n return { positions, index: index2 };\n}\nfunction uniqueTextMutations(mutations) {\n const idSet = /* @__PURE__ */ new Set();\n const uniqueMutations = [];\n for (let i2 = mutations.length; i2--; ) {\n const mutation = mutations[i2];\n if (!idSet.has(mutation.id)) {\n uniqueMutations.push(mutation);\n idSet.add(mutation.id);\n }\n }\n return uniqueMutations;\n}\nclass StyleSheetMirror {\n constructor() {\n __publicField2(this, \"id\", 1);\n __publicField2(this, \"styleIDMap\", /* @__PURE__ */ new WeakMap());\n __publicField2(this, \"idStyleMap\", /* @__PURE__ */ new Map());\n }\n getId(stylesheet) {\n return this.styleIDMap.get(stylesheet) ?? -1;\n }\n has(stylesheet) {\n return this.styleIDMap.has(stylesheet);\n }\n /**\n * @returns If the stylesheet is in the mirror, returns the id of the stylesheet. If not, return the new assigned id.\n */\n add(stylesheet, id) {\n if (this.has(stylesheet)) return this.getId(stylesheet);\n let newId;\n if (id === void 0) {\n newId = this.id++;\n } else newId = id;\n this.styleIDMap.set(stylesheet, newId);\n this.idStyleMap.set(newId, stylesheet);\n return newId;\n }\n getStyle(id) {\n return this.idStyleMap.get(id) || null;\n }\n reset() {\n this.styleIDMap = /* @__PURE__ */ new WeakMap();\n this.idStyleMap = /* @__PURE__ */ new Map();\n this.id = 1;\n }\n generateId() {\n return this.id++;\n }\n}\nfunction getShadowHost(n2) {\n var _a2;\n let shadowHost = null;\n if (\"getRootNode\" in n2 && ((_a2 = index.getRootNode(n2)) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && index.host(index.getRootNode(n2)))\n shadowHost = index.host(index.getRootNode(n2));\n return shadowHost;\n}\nfunction getRootShadowHost(n2) {\n let rootShadowHost = n2;\n let shadowHost;\n while (shadowHost = getShadowHost(rootShadowHost))\n rootShadowHost = shadowHost;\n return rootShadowHost;\n}\nfunction shadowHostInDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n const shadowHost = getRootShadowHost(n2);\n return index.contains(doc, shadowHost);\n}\nfunction inDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n return index.contains(doc, n2) || shadowHostInDom(n2);\n}\nconst utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n StyleSheetMirror,\n get _mirror() {\n return _mirror;\n },\n closestElementOfNode,\n getBaseDimension,\n getNestedRule,\n getPositionsAndIndex,\n getRootShadowHost,\n getShadowHost,\n getWindowHeight,\n getWindowScroll,\n getWindowWidth,\n hasShadowRoot,\n hookSetter,\n inDom,\n isAncestorRemoved,\n isBlocked,\n isIgnored,\n isSerialized,\n isSerializedIframe,\n isSerializedStylesheet,\n iterateResolveTree,\n legacy_isTouchEvent,\n get nowTimestamp() {\n return nowTimestamp;\n },\n on,\n patch,\n polyfill: polyfill$1,\n queueToResolveTrees,\n shadowHostInDom,\n throttle,\n uniqueTextMutations\n}, Symbol.toStringTag, { value: \"Module\" }));\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar lookup = typeof Uint8Array === \"undefined\" ? [] : new Uint8Array(256);\nfor (var i$1 = 0; i$1 < chars.length; i$1++) {\n lookup[chars.charCodeAt(i$1)] = i$1;\n}\nconst encodedJs = \"KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsK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kxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=\";\nconst decodeBase64 = (base64) => Uint8Array.from(atob(base64), (c2) => c2.charCodeAt(0));\ntypeof window !== \"undefined\" && window.Blob && new Blob([decodeBase64(encodedJs)], { type: \"text/javascript;charset=utf-8\" });\ntry {\n if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {\n const cleanFrame = document.createElement(\"iframe\");\n document.body.appendChild(cleanFrame);\n Array.from = ((_a = cleanFrame.contentWindow) == null ? void 0 : _a.Array.from) || Array.from;\n document.body.removeChild(cleanFrame);\n }\n} catch (err) {\n console.debug(\"Unable to override Array.from\", err);\n}\ncreateMirror$2();\nvar n;\n!function(t2) {\n t2[t2.NotStarted = 0] = \"NotStarted\", t2[t2.Running = 1] = \"Running\", t2[t2.Stopped = 2] = \"Stopped\";\n}(n || (n = {}));\nclass StackFrame {\n constructor(obj) {\n __publicField(this, \"fileName\");\n __publicField(this, \"functionName\");\n __publicField(this, \"lineNumber\");\n __publicField(this, \"columnNumber\");\n this.fileName = obj.fileName || \"\";\n this.functionName = obj.functionName || \"\";\n this.lineNumber = obj.lineNumber;\n this.columnNumber = obj.columnNumber;\n }\n toString() {\n const lineNumber = this.lineNumber || \"\";\n const columnNumber = this.columnNumber || \"\";\n if (this.functionName)\n return `${this.functionName} (${this.fileName}:${lineNumber}:${columnNumber})`;\n return `${this.fileName}:${lineNumber}:${columnNumber}`;\n }\n}\nconst FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\nconst CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\nconst SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\nconst ErrorStackParser = {\n /**\n * Given an Error object, extract the most information from it.\n */\n parse: function(error) {\n if (!error) {\n return [];\n }\n if (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n typeof error.stacktrace !== \"undefined\" || // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n typeof error[\"opera#sourceloc\"] !== \"undefined\"\n ) {\n return this.parseOpera(\n error\n );\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n console.warn(\n \"[console-record-plugin]: Failed to parse error object:\",\n error\n );\n return [];\n }\n },\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function(urlLike) {\n if (urlLike.indexOf(\":\") === -1) {\n return [urlLike];\n }\n const regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n const parts = regExp.exec(urlLike.replace(/[()]/g, \"\"));\n if (!parts) throw new Error(`Cannot parse given url: ${urlLike}`);\n return [parts[1], parts[2] || void 0, parts[3] || void 0];\n },\n parseV8OrIE: function(error) {\n const filtered = error.stack.split(\"\\n\").filter(function(line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n return filtered.map(function(line) {\n if (line.indexOf(\"(eval \") > -1) {\n line = line.replace(/eval code/g, \"eval\").replace(/(\\(eval at [^()]*)|(\\),.*$)/g, \"\");\n }\n let sanitizedLine = line.replace(/^\\s+/, \"\").replace(/\\(eval code/g, \"(\");\n const location = sanitizedLine.match(/ (\\((.+):(\\d+):(\\d+)\\)$)/);\n sanitizedLine = location ? sanitizedLine.replace(location[0], \"\") : sanitizedLine;\n const tokens = sanitizedLine.split(/\\s+/).slice(1);\n const locationParts = this.extractLocation(\n location ? location[1] : tokens.pop()\n );\n const functionName = tokens.join(\" \") || void 0;\n const fileName = [\"eval\", \"<anonymous>\"].indexOf(locationParts[0]) > -1 ? void 0 : locationParts[0];\n return new StackFrame({\n functionName,\n fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2]\n });\n }, this);\n },\n parseFFOrSafari: function(error) {\n const filtered = error.stack.split(\"\\n\").filter(function(line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n return filtered.map(function(line) {\n if (line.indexOf(\" > eval\") > -1) {\n line = line.replace(\n / line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g,\n \":$1\"\n );\n }\n if (line.indexOf(\"@\") === -1 && line.indexOf(\":\") === -1) {\n return new StackFrame({\n functionName: line\n });\n } else {\n const functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n const matches = line.match(functionNameRegex);\n const functionName = matches && matches[1] ? matches[1] : void 0;\n const locationParts = this.extractLocation(\n line.replace(functionNameRegex, \"\")\n );\n return new StackFrame({\n functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2]\n });\n }\n }, this);\n },\n parseOpera: function(e) {\n if (!e.stacktrace || e.message.indexOf(\"\\n\") > -1 && e.message.split(\"\\n\").length > e.stacktrace.split(\"\\n\").length) {\n return this.parseOpera9(e);\n } else if (!e.stack) {\n return this.parseOpera10(e);\n } else {\n return this.parseOpera11(e);\n }\n },\n parseOpera9: function(e) {\n const lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n const lines = e.message.split(\"\\n\");\n const result2 = [];\n for (let i = 2, len = lines.length; i < len; i += 2) {\n const match = lineRE.exec(lines[i]);\n if (match) {\n result2.push(\n new StackFrame({\n fileName: match[2],\n lineNumber: parseFloat(match[1])\n })\n );\n }\n }\n return result2;\n },\n parseOpera10: function(e) {\n const lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n const lines = e.stacktrace.split(\"\\n\");\n const result2 = [];\n for (let i = 0, len = lines.length; i < len; i += 2) {\n const match = lineRE.exec(lines[i]);\n if (match) {\n result2.push(\n new StackFrame({\n functionName: match[3] || void 0,\n fileName: match[2],\n lineNumber: parseFloat(match[1])\n })\n );\n }\n }\n return result2;\n },\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function(error) {\n const filtered = error.stack.split(\"\\n\").filter(function(line) {\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\n }, this);\n return filtered.map(function(line) {\n const tokens = line.split(\"@\");\n const locationParts = this.extractLocation(tokens.pop());\n const functionCall = tokens.shift() || \"\";\n const functionName = functionCall.replace(/<anonymous function(: (\\w+))?>/, \"$2\").replace(/\\([^)]*\\)/g, \"\") || void 0;\n return new StackFrame({\n functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2]\n });\n }, this);\n }\n};\nfunction pathToSelector(node2) {\n if (!node2 || !node2.outerHTML) {\n return \"\";\n }\n let path = \"\";\n while (node2.parentElement) {\n let name = node2.localName;\n if (!name) {\n break;\n }\n name = name.toLowerCase();\n const parent = node2.parentElement;\n const domSiblings = [];\n if (parent.children && parent.children.length > 0) {\n for (let i = 0; i < parent.children.length; i++) {\n const sibling = parent.children[i];\n if (sibling.localName && sibling.localName.toLowerCase) {\n if (sibling.localName.toLowerCase() === name) {\n domSiblings.push(sibling);\n }\n }\n }\n }\n if (domSiblings.length > 1) {\n name += `:eq(${domSiblings.indexOf(node2)})`;\n }\n path = name + (path ? \">\" + path : \"\");\n node2 = parent;\n }\n return path;\n}\nfunction isObject(obj) {\n return Object.prototype.toString.call(obj) === \"[object Object]\";\n}\nfunction isObjTooDeep(obj, limit) {\n if (limit === 0) {\n return true;\n }\n const keys = Object.keys(obj);\n for (const key of keys) {\n if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {\n return true;\n }\n }\n return false;\n}\nfunction stringify(obj, stringifyOptions) {\n const options = {\n numOfKeysLimit: 50,\n depthOfLimit: 4\n };\n Object.assign(options, stringifyOptions);\n const stack = [];\n const keys = [];\n return JSON.stringify(\n obj,\n function(key, value) {\n if (stack.length > 0) {\n const thisPos = stack.indexOf(this);\n ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);\n ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);\n if (~stack.indexOf(value)) {\n if (stack[0] === value) {\n value = \"[Circular ~]\";\n } else {\n value = \"[Circular ~.\" + keys.slice(0, stack.indexOf(value)).join(\".\") + \"]\";\n }\n }\n } else {\n stack.push(value);\n }\n if (value === null) return value;\n if (value === void 0) return \"undefined\";\n if (shouldIgnore(value)) {\n return toString(value);\n }\n if (typeof value === \"bigint\") {\n return value.toString() + \"n\";\n }\n if (value instanceof Event) {\n const eventResult = {};\n for (const eventKey in value) {\n const eventValue = value[eventKey];\n if (Array.isArray(eventValue)) {\n eventResult[eventKey] = pathToSelector(\n eventValue.length ? eventValue[0] : null\n );\n } else {\n eventResult[eventKey] = eventValue;\n }\n }\n return eventResult;\n } else if (value instanceof Node) {\n if (value instanceof HTMLElement) {\n return value ? value.outerHTML : \"\";\n }\n return value.nodeName;\n } else if (value instanceof Error) {\n return value.stack ? value.stack + \"\\nEnd of stack for Error object\" : value.name + \": \" + value.message;\n }\n return value;\n }\n );\n function shouldIgnore(_obj) {\n if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {\n return true;\n }\n if (typeof _obj === \"function\") {\n return true;\n }\n if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {\n return true;\n }\n return false;\n }\n function toString(_obj) {\n let str = _obj.toString();\n if (options.stringLengthLimit && str.length > options.stringLengthLimit) {\n str = `${str.slice(0, options.stringLengthLimit)}...`;\n }\n return str;\n }\n}\nconst defaultLogOptions = {\n level: [\n \"assert\",\n \"clear\",\n \"count\",\n \"countReset\",\n \"debug\",\n \"dir\",\n \"dirxml\",\n \"error\",\n \"group\",\n \"groupCollapsed\",\n \"groupEnd\",\n \"info\",\n \"log\",\n \"table\",\n \"time\",\n \"timeEnd\",\n \"timeLog\",\n \"trace\",\n \"warn\"\n ],\n lengthThreshold: 1e3,\n logger: \"console\"\n};\nfunction initLogObserver(cb, win, options) {\n const logOptions = options ? Object.assign({}, defaultLogOptions, options) : defaultLogOptions;\n const loggerType = logOptions.logger;\n if (!loggerType) {\n return () => {\n };\n }\n let logger;\n if (typeof loggerType === \"string\") {\n logger = win[loggerType];\n } else {\n logger = loggerType;\n }\n let logCount = 0;\n let inStack = false;\n const cancelHandlers = [];\n if (logOptions.level.includes(\"error\")) {\n const errorHandler = (event) => {\n const message = event.message, error = event.error;\n const trace = ErrorStackParser.parse(error).map(\n (stackFrame) => stackFrame.toString()\n );\n const payload = [stringify(message, logOptions.stringifyOptions)];\n cb({\n level: \"error\",\n trace,\n payload\n });\n };\n win.addEventListener(\"error\", errorHandler);\n cancelHandlers.push(() => {\n win.removeEventListener(\"error\", errorHandler);\n });\n const unhandledrejectionHandler = (event) => {\n let error;\n let payload;\n if (event.reason instanceof Error) {\n error = event.reason;\n payload = [\n stringify(\n `Uncaught (in promise) ${error.name}: ${error.message}`,\n logOptions.stringifyOptions\n )\n ];\n } else {\n error = new Error();\n payload = [\n stringify(\"Uncaught (in promise)\", logOptions.stringifyOptions),\n stringify(event.reason, logOptions.stringifyOptions)\n ];\n }\n const trace = ErrorStackParser.parse(error).map(\n (stackFrame) => stackFrame.toString()\n );\n cb({\n level: \"error\",\n trace,\n payload\n });\n };\n win.addEventListener(\"unhandledrejection\", unhandledrejectionHandler);\n cancelHandlers.push(() => {\n win.removeEventListener(\"unhandledrejection\", unhandledrejectionHandler);\n });\n }\n for (const levelType of logOptions.level) {\n cancelHandlers.push(replace(logger, levelType));\n }\n return () => {\n cancelHandlers.forEach((h) => h());\n };\n function replace(_logger, level) {\n if (!_logger[level]) {\n return () => {\n };\n }\n return utils.patch(\n _logger,\n level,\n (original) => {\n return (...args) => {\n original.apply(this, args);\n if (level === \"assert\" && !!args[0]) {\n return;\n }\n if (inStack) {\n return;\n }\n inStack = true;\n try {\n const trace = ErrorStackParser.parse(new Error()).map((stackFrame) => stackFrame.toString()).splice(1);\n const argsForPayload = level === \"assert\" ? args.slice(1) : args;\n const payload = argsForPayload.map(\n (s) => stringify(s, logOptions.stringifyOptions)\n );\n logCount++;\n if (logCount < logOptions.lengthThreshold) {\n cb({\n level,\n trace,\n payload\n });\n } else if (logCount === logOptions.lengthThreshold) {\n cb({\n level: \"warn\",\n trace: [],\n payload: [\n stringify(\"The number of log records reached the threshold.\")\n ]\n });\n }\n } catch (error) {\n original(\"rrweb logger error:\", error, ...args);\n } finally {\n inStack = false;\n }\n };\n }\n );\n }\n}\nconst PLUGIN_NAME = \"rrweb/console@1\";\nconst getRecordConsolePlugin = (options) => ({\n name: PLUGIN_NAME,\n observer: initLogObserver,\n options\n});\nexport {\n PLUGIN_NAME,\n getRecordConsolePlugin\n};\n//# sourceMappingURL=rrweb-plugin-console-record.js.map\n","import { ErrorProperties } from '../extensions/exception-autocapture/error-conversion'\nimport type { PostHog } from '../posthog-core'\nimport { SessionIdManager } from '../sessionid'\nimport {\n DeadClicksAutoCaptureConfig,\n ErrorConversionArgs,\n ErrorMetadata,\n Properties,\n RemoteConfig,\n SiteAppLoader,\n} from '../types'\n\n/*\n * Global helpers to protect access to browser globals in a way that is safer for different targets\n * like DOM, SSR, Web workers etc.\n *\n * NOTE: Typically we want the \"window\" but globalThis works for both the typical browser context as\n * well as other contexts such as the web worker context. Window is still exported for any bits that explicitly require it.\n * If in doubt - export the global you need from this file and use that as an optional value. This way the code path is forced\n * to handle the case where the global is not available.\n */\n\n// eslint-disable-next-line no-restricted-globals\nconst win: (Window & typeof globalThis) | undefined = typeof window !== 'undefined' ? window : undefined\n\nexport type AssignableWindow = Window &\n typeof globalThis &\n Record<string, any> & {\n __PosthogExtensions__?: PostHogExtensions\n\n _POSTHOG_REMOTE_CONFIG?: Record<\n string,\n {\n config: RemoteConfig\n siteApps: SiteAppLoader[]\n }\n >\n }\n\n/**\n * This is our contract between (potentially) lazily loaded extensions and the SDK\n * changes to this interface can be breaking changes for users of the SDK\n */\n\nexport type PostHogExtensionKind =\n | 'toolbar'\n | 'exception-autocapture'\n | 'web-vitals'\n | 'recorder'\n | 'tracing-headers'\n | 'surveys'\n | 'dead-clicks-autocapture'\n | 'remote-config'\n\nexport interface LazyLoadedDeadClicksAutocaptureInterface {\n start: (observerTarget: Node) => void\n stop: () => void\n}\n\ninterface PostHogExtensions {\n loadExternalDependency?: (\n posthog: PostHog,\n kind: PostHogExtensionKind,\n callback: (error?: string | Event, event?: Event) => void\n ) => void\n\n loadSiteApp?: (posthog: PostHog, appUrl: string, callback: (error?: string | Event, event?: Event) => void) => void\n\n parseErrorAsProperties?: ({ error, event }: ErrorConversionArgs, metadata?: ErrorMetadata) => ErrorProperties\n errorWrappingFunctions?: {\n wrapOnError: (captureFn: (props: Properties) => void) => () => void\n wrapUnhandledRejection: (captureFn: (props: Properties) => void) => () => void\n }\n rrweb?: { record: any; version: string }\n rrwebPlugins?: { getRecordConsolePlugin: any; getRecordNetworkPlugin?: any }\n canActivateRepeatedly?: (survey: any) => boolean\n generateSurveys?: (posthog: PostHog) => any | undefined\n postHogWebVitalsCallbacks?: {\n onLCP: (metric: any) => void\n onCLS: (metric: any) => void\n onFCP: (metric: any) => void\n onINP: (metric: any) => void\n }\n tracingHeadersPatchFns?: {\n _patchFetch: (sessionManager?: SessionIdManager) => () => void\n _patchXHR: (sessionManager?: SessionIdManager) => () => void\n }\n initDeadClicksAutocapture?: (\n ph: PostHog,\n config: DeadClicksAutoCaptureConfig\n ) => LazyLoadedDeadClicksAutocaptureInterface\n}\n\nconst global: typeof globalThis | undefined = typeof globalThis !== 'undefined' ? globalThis : win\n\nexport const ArrayProto = Array.prototype\nexport const nativeForEach = ArrayProto.forEach\nexport const nativeIndexOf = ArrayProto.indexOf\n\nexport const navigator = global?.navigator\nexport const document = global?.document\nexport const location = global?.location\nexport const fetch = global?.fetch\nexport const XMLHttpRequest =\n global?.XMLHttpRequest && 'withCredentials' in new global.XMLHttpRequest() ? global.XMLHttpRequest : undefined\nexport const AbortController = global?.AbortController\nexport const userAgent = navigator?.userAgent\nexport const assignableWindow: AssignableWindow = win ?? ({} as any)\n\nexport { win as window }\n","import type { recordOptions } from './extensions/replay/types/rrweb'\nimport type { SegmentAnalytics } from './extensions/segment-integration'\nimport { PostHog } from './posthog-core'\n\nexport type Property = any\nexport type Properties = Record<string, Property>\n\nexport const COPY_AUTOCAPTURE_EVENT = '$copy_autocapture'\n\nexport const knownUnsafeEditableEvent = [\n '$snapshot',\n '$pageview',\n '$pageleave',\n '$set',\n 'survey dismissed',\n 'survey sent',\n 'survey shown',\n '$identify',\n '$groupidentify',\n '$create_alias',\n '$$client_ingestion_warning',\n '$web_experiment_applied',\n '$feature_enrollment_update',\n '$feature_flag_called',\n] as const\n\n/**\n * These events can be processed by the `beforeCapture` function\n * but can cause unexpected confusion in data.\n *\n * Some features of PostHog rely on receiving 100% of these events\n */\nexport type KnownUnsafeEditableEvent = (typeof knownUnsafeEditableEvent)[number]\n\n/**\n * These are known events PostHog events that can be processed by the `beforeCapture` function\n * That means PostHog functionality does not rely on receiving 100% of these for calculations\n * So, it is safe to sample them to reduce the volume of events sent to PostHog\n */\nexport type KnownEventName =\n | '$heatmaps_data'\n | '$opt_in'\n | '$exception'\n | '$$heatmap'\n | '$web_vitals'\n | '$dead_click'\n | '$autocapture'\n | typeof COPY_AUTOCAPTURE_EVENT\n | '$rageclick'\n\nexport type EventName =\n | KnownUnsafeEditableEvent\n | KnownEventName\n // magic value so that the type of EventName is a set of known strings or any other string\n // which means you get autocomplete for known strings\n // but no type complaints when you add an arbitrary string\n | (string & {})\n\nexport interface CaptureResult {\n uuid: string\n event: EventName\n properties: Properties\n $set?: Properties\n $set_once?: Properties\n timestamp?: Date\n}\n\nexport type AutocaptureCompatibleElement = 'a' | 'button' | 'form' | 'input' | 'select' | 'textarea' | 'label'\nexport type DomAutocaptureEvents = 'click' | 'change' | 'submit'\n\n/**\n * If an array is passed for an allowlist, autocapture events will only be sent for elements matching\n * at least one of the elements in the array. Multiple allowlists can be used\n */\nexport interface AutocaptureConfig {\n /**\n * List of URLs to allow autocapture on, can be strings to match\n * or regexes e.g. ['https://example.com', 'test.com/.*']\n * this is useful when you want to autocapture on specific pages only\n *\n * if you set both url_allowlist and url_ignorelist,\n * we check the allowlist first and then the ignorelist.\n * the ignorelist can override the allowlist\n */\n url_allowlist?: (string | RegExp)[]\n\n /**\n * List of URLs to not allow autocapture on, can be strings to match\n * or regexes e.g. ['https://example.com', 'test.com/.*']\n * this is useful when you want to autocapture on most pages but not some specific ones\n *\n * if you set both url_allowlist and url_ignorelist,\n * we check the allowlist first and then the ignorelist.\n * the ignorelist can override the allowlist\n */\n url_ignorelist?: (string | RegExp)[]\n\n /**\n * List of DOM events to allow autocapture on e.g. ['click', 'change', 'submit']\n */\n dom_event_allowlist?: DomAutocaptureEvents[]\n\n /**\n * List of DOM elements to allow autocapture on\n * e.g. ['a', 'button', 'form', 'input', 'select', 'textarea', 'label']\n *\n * We consider the tree of elements from the root to the target element of the click event\n * so for the tree `div > div > button > svg`\n * if the allowlist has `button` then we allow the capture when the `button` or the `svg` is the click target\n * but not if either of the `div`s are detected as the click target\n */\n element_allowlist?: AutocaptureCompatibleElement[]\n\n /**\n * List of CSS selectors to allow autocapture on\n * e.g. ['[ph-capture]']\n * we consider the tree of elements from the root to the target element of the click event\n * so for the tree div > div > button > svg\n * and allow list config `['[id]']`\n * we will capture the click if the click-target or its parents has any id\n *\n * Everything is allowed when there's no allowlist\n */\n css_selector_allowlist?: string[]\n\n /**\n * Exclude certain element attributes from autocapture\n * E.g. ['aria-label'] or [data-attr-pii]\n */\n element_attribute_ignorelist?: string[]\n\n /**\n * When set to true, autocapture will capture the text of any element that is cut or copied.\n */\n capture_copied_text?: boolean\n}\n\nexport interface BootstrapConfig {\n distinctID?: string\n isIdentifiedID?: boolean\n featureFlags?: Record<string, boolean | string>\n featureFlagPayloads?: Record<string, JsonType>\n\n /**\n * Optionally provide a sessionID, this is so that you can provide an existing sessionID here to continue a user's session across a domain or device. It MUST be:\n * - unique to this user\n * - a valid UUID v7\n * - the timestamp part must be <= the timestamp of the first event in the session\n * - the timestamp of the last event in the session must be < the timestamp part + 24 hours\n * **/\n sessionID?: string\n}\n\nexport type SupportedWebVitalsMetrics = 'LCP' | 'CLS' | 'FCP' | 'INP'\n\nexport interface PerformanceCaptureConfig {\n /**\n * Works with session replay to use the browser's native performance observer to capture performance metrics\n */\n network_timing?: boolean\n\n /**\n * Use chrome's web vitals library to wrap fetch and capture web vitals\n */\n web_vitals?: boolean\n\n /**\n * We observe very large values reported by the Chrome web vitals library\n * These outliers are likely not real, useful values, and we exclude them\n * You can set this to 0 in order to include all values, NB this is not recommended\n *\n * @default 15 * 60 * 1000 (15 minutes)\n */\n __web_vitals_max_value?: number\n\n /**\n * By default all 4 metrics are captured\n * You can set this config to restrict which metrics are captured\n * e.g. ['CLS', 'FCP'] to only capture those two metrics\n * NB setting this does not override whether the capture is enabled\n *\n * @default ['LCP', 'CLS', 'FCP', 'INP']\n */\n web_vitals_allowed_metrics?: SupportedWebVitalsMetrics[]\n\n /**\n * We delay flushing web vitals metrics to reduce the number of events we send\n * This is the maximum time we will wait before sending the metrics\n *\n * @default 5000\n */\n web_vitals_delayed_flush_ms?: number\n}\n\nexport interface DeadClickCandidate {\n node: Element\n originalEvent: MouseEvent\n timestamp: number\n // time between click and the most recent scroll\n scrollDelayMs?: number\n // time between click and the most recent mutation\n mutationDelayMs?: number\n // time between click and the most recent selection changed event\n selectionChangedDelayMs?: number\n // if neither scroll nor mutation seen before threshold passed\n absoluteDelayMs?: number\n}\n\nexport type DeadClicksAutoCaptureConfig = {\n /**\n * We'll not consider a click to be a dead click, if it's followed by a scroll within `scroll_threshold_ms` milliseconds\n *\n * @default 100\n */\n scroll_threshold_ms?: number\n\n /**\n * We'll not consider a click to be a dead click, if it's followed by a selection change within `selection_change_threshold_ms` milliseconds\n *\n * @default 100\n */\n selection_change_threshold_ms?: number\n\n /**\n * We'll not consider a click to be a dead click, if it's followed by a mutation within `mutation_threshold_ms` milliseconds\n *\n * @default 2500\n */\n mutation_threshold_ms?: number\n\n /**\n * Allows setting behavior for when a dead click is captured.\n * For e.g. to support capture to heatmaps\n *\n * If not provided the default behavior is to auto-capture dead click events\n *\n * Only intended to be provided by our own SDK\n */\n __onCapture?: ((click: DeadClickCandidate, properties: Properties) => void) | undefined\n} & Pick<AutocaptureConfig, 'element_attribute_ignorelist'>\n\nexport interface HeatmapConfig {\n /**\n * How often to send batched data in `$heatmap_data` events\n * If set to 0 or not set, sends using the default interval of 1 second\n *\n * @default 1000\n */\n flush_interval_milliseconds: number\n}\n\nexport type BeforeSendFn = (cr: CaptureResult | null) => CaptureResult | null\n\n/**\n * Configuration options for the PostHog JavaScript SDK.\n * @see https://posthog.com/docs/libraries/js#config\n */\nexport interface PostHogConfig {\n /** URL of your PostHog instance.\n *\n * @default 'https://us.i.posthog.com'\n */\n api_host: string\n\n /**\n * If using a reverse proxy for `api_host` then this should be the actual PostHog app URL (e.g. https://us.posthog.com).\n * This ensures that links to PostHog point to the correct host.\n *\n * @default null\n */\n ui_host: string | null\n\n /**\n * The transport method to use for API requests.\n *\n * @default 'fetch'\n */\n api_transport?: 'XHR' | 'fetch'\n\n /**\n * The token for your PostHog project.\n * It should NOT be provided manually in the config, but rather passed as the first parameter to `posthog.init()`.\n */\n token: string\n\n /**\n * The name this instance will be identified by.\n * You don't need to set this most of the time,\n * but can be useful if you have several Posthog instances running at the same time.\n *\n * @default 'posthog'\n */\n name: string\n\n /**\n * Determines whether PostHog should autocapture events.\n * This setting does not affect capturing pageview events (see `capture_pageview`).\n *\n * @default true\n */\n autocapture: boolean | AutocaptureConfig\n\n /**\n * Determines whether PostHog should capture rage clicks.\n *\n * @default true\n */\n rageclick: boolean\n\n /**\n * Determines if cookie should be set on the top level domain (example.com).\n * If PostHog-js is loaded on a subdomain (test.example.com), and `cross_subdomain_cookie` is set to false,\n * it'll set the cookie on the subdomain only (test.example.com).\n *\n * NOTE: It will be set to `false` if we detect that the domain is a subdomain of a platform that is excluded from cross-subdomain cookie setting.\n * The current list of excluded platforms is `herokuapp.com`, `vercel.app`, and `netlify.app`.\n *\n * @see `isCrossDomainCookie`\n * @default true\n */\n cross_subdomain_cookie: boolean\n\n /**\n * Determines how PostHog stores information about the user. See [persistence](https://posthog.com/docs/libraries/js#persistence) for details.\n *\n * @default 'localStorage+cookie'\n */\n persistence: 'localStorage' | 'cookie' | 'memory' | 'localStorage+cookie' | 'sessionStorage'\n\n /**\n * The name for the super properties persistent store\n *\n * @default ''\n */\n persistence_name: string\n\n /** @deprecated - Use 'persistence_name' instead */\n cookie_name?: string\n\n /**\n * A function to be called once the PostHog scripts have loaded successfully.\n *\n * @param posthog_instance - The PostHog instance that has been loaded.\n */\n loaded: (posthog_instance: PostHog) => void\n\n /**\n * Determines whether PostHog should save referrer information.\n *\n * @default true\n */\n save_referrer: boolean\n\n /**\n * Determines whether PostHog should save marketing parameters.\n * These are `utm_*` paramaters and friends.\n *\n * @see {CAMPAIGN_PARAMS} from './utils/event-utils' - Default campaign parameters like utm_source, utm_medium, etc.\n * @default true\n */\n save_campaign_params: boolean\n\n /** @deprecated - Use `save_campaign_params` instead */\n store_google?: boolean\n\n /**\n * Used to extend the list of campaign parameters that are saved by default.\n *\n * @see {CAMPAIGN_PARAMS} from './utils/event-utils' - Default campaign parameters like utm_source, utm_medium, etc.\n * @default []\n */\n custom_campaign_params: string[]\n\n /**\n * Used to extend the list of user agents that are blocked by default.\n *\n * @see {DEFAULT_BLOCKED_UA_STRS} from './utils/blocked-uas' - Default list of blocked user agents.\n * @default []\n */\n custom_blocked_useragents: string[]\n\n /**\n * Determines whether PostHog should be in debug mode.\n * You can enable this to get more detailed logging.\n *\n * You can also enable this on your website by appending `?__posthog_debug=true` at the end of your URL\n * You can also call `posthog.debug()` in your code to enable debug mode\n *\n * @default false\n */\n debug: boolean\n\n /** @deprecated Use `debug` instead */\n verbose?: boolean\n\n /**\n * Determines whether PostHog should capture pageview events automatically.\n *\n * @default true\n */\n capture_pageview: boolean\n\n /**\n * Determines whether PostHog should capture pageleave events.\n * If set to `true`, it will capture pageleave events for all pages.\n * If set to `'if_capture_pageview'`, it will only capture pageleave events if `capture_pageview` is also set to `true`.\n *\n * @default 'if_capture_pageview'\n */\n capture_pageleave: boolean | 'if_capture_pageview'\n\n /**\n * Determines the number of days to store cookies for.\n *\n * @default 365\n */\n cookie_expiration: number\n\n /**\n * Determines whether PostHog should upgrade old cookies.\n * If set to `true`, the library will check for a cookie from our old js library and import super properties from it, then the old cookie is deleted.\n * This option only works in the initialization, so make sure you set it when you create the library.\n *\n * @default false\n */\n upgrade: boolean\n\n /**\n * Determines whether PostHog should disable session recording.\n *\n * @default false\n */\n disable_session_recording: boolean\n\n /**\n * Determines whether PostHog should disable persistence.\n * If set to `true`, the library will not save any data to the browser. It will also delete any data previously saved to the browser.\n *\n * @default false\n */\n disable_persistence: boolean\n\n /** @deprecated - use `disable_persistence` instead */\n disable_cookie?: boolean\n\n /**\n * Determines whether PostHog should disable surveys.\n *\n * @default false\n */\n disable_surveys: boolean\n\n /**\n * Determines whether PostHog should disable web experiments.\n *\n * Currently disabled while we're in BETA. It will be toggled to `true` in a future release.\n *\n * @default true\n */\n disable_web_experiments: boolean\n\n /**\n * Determines whether PostHog should disable any external dependency loading.\n * This will prevent PostHog from requesting any external scripts such as those needed for Session Replay, Surveys or Site Apps.\n *\n * @default false\n */\n disable_external_dependency_loading: boolean\n\n /**\n * A function to be called when a script is being loaded.\n * This can be used to modify the script before it is loaded.\n * This is useful for adding a nonce to the script, for example.\n *\n * @param script - The script element that is being loaded.\n * @returns The modified script element, or null if the script should not be loaded.\n */\n prepare_external_dependency_script?: (script: HTMLScriptElement) => HTMLScriptElement | null\n\n /**\n * A function to be called when a stylesheet is being loaded.\n * This can be used to modify the stylesheet before it is loaded.\n * This is useful for adding a nonce to the stylesheet, for example.\n *\n * @param stylesheet - The stylesheet element that is being loaded.\n * @returns The modified stylesheet element, or null if the stylesheet should not be loaded.\n */\n prepare_external_dependency_stylesheet?: (stylesheet: HTMLStyleElement) => HTMLStyleElement | null\n\n /**\n * Determines whether PostHog should enable recording console logs.\n * When undefined, it falls back to the remote config setting.\n *\n * @default undefined\n */\n enable_recording_console_log?: boolean\n\n /**\n * Determines whether PostHog should use secure cookies.\n * If this is `true`, PostHog cookies will be marked as secure,\n * meaning they will only be transmitted over HTTPS.\n *\n * @default window.location.protocol === 'https:'\n */\n secure_cookie: boolean\n\n /**\n * Determines whether PostHog should capture IP addresses.\n *\n * @default true\n */\n ip: boolean\n\n /**\n * Determines if users should be opted out of PostHog tracking by default,\n * requiring additional logic to opt them into capturing by calling `posthog.opt_in_capturing()`.\n *\n * @default false\n */\n opt_out_capturing_by_default: boolean\n\n /**\n * Determines where we'll save the information about whether users are opted out of capturing.\n *\n * @default 'localStorage'\n */\n opt_out_capturing_persistence_type: 'localStorage' | 'cookie'\n\n /**\n * Determines if users should be opted out of browser data storage by this PostHog instance by default,\n * requiring additional logic to opt them into capturing by calling `posthog.opt_in_capturing()`.\n *\n * @default false\n */\n opt_out_persistence_by_default?: boolean\n\n /**\n * Determines if users should be opted out of user agent filtering such as googlebot or other bots.\n * If this is set to `true`, PostHog will set `$browser_type` to either `bot` or `browser` for all events,\n * but will process all events as if they were from a browser.\n *\n * @default false\n */\n opt_out_useragent_filter: boolean\n\n /**\n * Determines the prefix for the cookie used to store the information about whether users are opted out of capturing.\n * When `null`, it falls back to the default prefix found in `consent.ts`.\n *\n * @default null\n */\n opt_out_capturing_cookie_prefix: string | null\n\n /**\n * Determines if users should be opted in to site apps.\n *\n * @default false\n */\n opt_in_site_apps: boolean\n\n /**\n * Determines whether PostHog should respect the Do Not Track header when computing\n * consent in `ConsentManager`.\n *\n * @see `ConsentManager`\n * @default false\n */\n respect_dnt: boolean\n\n /**\n * A list of properties that should never be sent with capture calls.\n *\n * @default []\n */\n property_denylist: string[]\n\n /** @deprecated - use `property_denylist` instead */\n property_blacklist?: string[]\n\n /**\n * A list of headers that should be sent with requests to the PostHog API.\n *\n * @default {}\n */\n request_headers: { [header_name: string]: string }\n\n /** @deprecated - use `request_headers` instead */\n xhr_headers?: { [header_name: string]: string }\n\n /**\n * A function that is called when a request to the PostHog API fails.\n *\n * @param error - The `RequestResponse` object that occurred.\n */\n on_request_error?: (error: RequestResponse) => void\n\n /** @deprecated - use `on_request_error` instead */\n on_xhr_error?: (failedRequest: XMLHttpRequest) => void\n\n /**\n * Determines whether PostHog should batch requests to the PostHog API.\n *\n * @default true\n */\n request_batching: boolean\n\n /**\n * Determines the maximum length of the properties string that can be sent with capture calls.\n *\n * @default 65535\n */\n properties_string_max_length: number\n\n /**\n * Determines the session recording options.\n *\n * @see `SessionRecordingOptions`\n * @default {}\n */\n session_recording: SessionRecordingOptions\n\n /**\n * Determines the session idle timeout in seconds.\n * Any new event that's happened after this timeout will create a new session.\n *\n * @default 30 * 60 -- 30 minutes\n */\n session_idle_timeout_seconds: number\n\n /**\n * Prevent autocapture from capturing any attribute names on elements.\n *\n * @default false\n */\n mask_all_element_attributes: boolean\n\n /**\n * Prevent autocapture from capturing `textContent` on elements.\n *\n * @default false\n */\n mask_all_text: boolean\n\n /**\n * Prevent autocapture from capturing personal data properties.\n * These include campaign parameters, UTM parameters, and other parameters that could be considered personal data under e.g. GDPR.\n *\n * @default false\n */\n mask_personal_data_properties: boolean\n\n /**\n * Custom list of personal data properties to mask.\n *\n * @default []\n */\n custom_personal_data_properties: string[]\n\n /**\n * One of the very first things the PostHog library does when init() is called\n * is make a request to the /decide endpoint on PostHog's backend.\n * This endpoint contains information on how to run the PostHog library\n * so events are properly received in the backend.\n *\n * This endpoint is required to run most features of the library.\n * However, if you're not using any of the described features,\n * you may wish to turn off the call completely to avoid an extra request\n * and reduce resource usage on both the client and the server.\n *\n * @default false\n */\n advanced_disable_decide: boolean\n\n /**\n * Will keep /decide running, but without any feature flag requests\n *\n * @default false\n */\n advanced_disable_feature_flags: boolean\n\n /**\n * Stops from firing feature flag requests on first page load.\n * Only requests feature flags when user identity or properties are updated,\n * or you manually request for flags to be loaded.\n *\n * @default false\n */\n advanced_disable_feature_flags_on_first_load: boolean\n\n /**\n * Determines whether PostHog should disable toolbar metrics.\n * This is our internal instrumentation for our toolbar in your website.\n *\n * @default false\n */\n advanced_disable_toolbar_metrics: boolean\n\n /**\n * Sets timeout for fetching feature flags\n *\n * @default 3000\n */\n feature_flag_request_timeout_ms: number\n\n /**\n * Sets timeout for fetching surveys\n *\n * @default 10000\n */\n surveys_request_timeout_ms: number\n\n /**\n * Function to get the device ID.\n * This doesn't usually need to be set, but can be useful if you want to use a custom device ID.\n *\n * @param uuid - The UUID we would use for the device ID.\n * @returns The device ID.\n *\n * @default (uuid) => uuid\n */\n get_device_id: (uuid: string) => string\n\n /**\n * This function or array of functions - if provided - are called immediately before sending data to the server.\n * It allows you to edit data before it is sent, or choose not to send it all.\n * if provided as an array the functions are called in the order they are provided\n * any one function returning null means the event will not be sent\n */\n before_send?: BeforeSendFn | BeforeSendFn[]\n\n /** @deprecated - use `before_send` instead */\n sanitize_properties: ((properties: Properties, event_name: string) => Properties) | null\n\n /** @deprecated - use `before_send` instead */\n _onCapture: (eventName: string, eventData: CaptureResult) => void\n\n /**\n * Determines whether to capture performance metrics.\n * These include Network Timing and Web Vitals.\n *\n * When `undefined`, fallback to the remote configuration.\n * If `false`, neither network timing nor web vitals will work.\n * If an object, that will override the remote configuration.\n *\n * @see {PerformanceCaptureConfig}\n * @default undefined\n */\n capture_performance?: boolean | PerformanceCaptureConfig\n\n /**\n * Determines whether to disable compression when sending events to the server.\n * WARNING: Should only be used for testing. Could negatively impact performance.\n *\n * @default false\n */\n disable_compression: boolean\n\n /**\n * An object containing the `distinctID`, `isIdentifiedID`, and `featureFlags` keys,\n * where `distinctID` is a string, and `featureFlags` is an object of key-value pairs.\n *\n * Since there is a delay between initializing PostHog and fetching feature flags,\n * feature flags are not always available immediately.\n * This makes them unusable if you want to do something like redirecting a user\n * to a different page based on a feature flag.\n *\n * You can, therefore, fetch the feature flags in your server and pre-fill them here,\n * allowing PostHog to know the feature flag values immediately.\n *\n * After the SDK fetches feature flags from PostHog, it will use those flag values instead of bootstrapped ones.\n *\n * @default {}\n */\n bootstrap: BootstrapConfig\n\n /**\n * The segment analytics object.\n *\n * @see https://posthog.com/docs/libraries/segment\n */\n segment?: SegmentAnalytics\n\n /**\n * Determines whether to capture heatmaps.\n *\n * @see {HeatmapConfig}\n * @default undefined\n */\n capture_heatmaps?: boolean | HeatmapConfig\n\n /* @deprecated - use `capture_heatmaps` instead */\n enable_heatmaps?: boolean\n\n /**\n * Determines whether to capture dead clicks.\n *\n * @see {DeadClicksAutoCaptureConfig}\n * @default undefined\n */\n capture_dead_clicks?: boolean | DeadClicksAutoCaptureConfig\n\n /**\n * Determines whether to capture exceptions.\n *\n * @default undefined\n */\n capture_exceptions?: boolean\n\n /**\n * Determines whether to disable scroll properties.\n * These allow you to keep track of how far down someone scrolled in your website.\n *\n * @default false\n */\n disable_scroll_properties?: boolean\n\n /**\n * Let the pageview scroll stats use a custom css selector for the root element, e.g. `main`\n * It will use `window.document.documentElement` if not specified.\n */\n scroll_root_selector?: string | string[]\n\n /**\n * You can control whether events from PostHog-js have person processing enabled with the `person_profiles` config setting.\n * There are three options:\n * - `person_profiles: 'always'` - we will process persons data for all events\n * - `person_profiles: 'never'` - we won't process persons for any event. This means that anonymous users will not be merged once they sign up or login, so you lose the ability to create funnels that track users from anonymous to identified. All events (including `$identify`) will be sent with `$process_person_profile: False`.\n * - `person_profiles: 'identified_only'` _(default)_ - we will only process persons when you call `posthog.identify`, `posthog.alias`, `posthog.setPersonProperties`, `posthog.group`, `posthog.setPersonPropertiesForFlags` or `posthog.setGroupPropertiesForFlags` Anonymous users won't get person profiles.\n *\n * @default 'identified_only'\n */\n person_profiles?: 'always' | 'never' | 'identified_only'\n\n /** @deprecated - use `person_profiles` instead */\n process_person?: 'always' | 'never' | 'identified_only'\n\n /**\n * Client side rate limiting\n */\n rate_limiting?: {\n /**\n * The average number of events per second that should be permitted\n *\n * @default 10\n */\n events_per_second?: number\n\n /**\n * How many events can be captured in a burst. This defaults to 10 times the events_per_second count\n *\n * @default 10 * `events_per_second`\n */\n events_burst_limit?: number\n }\n\n /**\n * Used when sending data via `fetch`, use with care.\n * This is intentionally meant to be used with NextJS `fetch`\n *\n * Incorrect `cache` usage may cause out-of-date data for feature flags, actions tracking, etc.\n * See https://nextjs.org/docs/app/api-reference/functions/fetch#fetchurl-options\n */\n fetch_options?: {\n cache?: RequestInit['cache']\n next_options?: NextOptions\n }\n\n /**\n * Used to change the behavior of the request queue.\n * This is an advanced feature and should be used with caution.\n */\n request_queue_config?: RequestQueueConfig\n\n // ------- PREVIEW CONFIGS -------\n\n /**\n * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION\n * Whether to wrap fetch and add tracing headers to the request\n * */\n __add_tracing_headers?: boolean\n\n /**\n * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION\n * Enables the new RemoteConfig approach to loading config instead of decide\n * */\n __preview_remote_config?: boolean\n\n /**\n * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION\n * Whether to send a sentinel value for distinct id, device id, and session id, which will be replaced server-side by a cookieless hash\n * */\n __preview_experimental_cookieless_mode?: boolean\n\n // ------- RETIRED CONFIGS - NO REPLACEMENT OR USAGE -------\n\n /** @deprecated - NOT USED ANYMORE, kept here for backwards compatibility reasons */\n api_method?: string\n\n /** @deprecated - NOT USED ANYMORE, kept here for backwards compatibility reasons */\n inapp_protocol?: string\n\n /** @deprecated - NOT USED ANYMORE, kept here for backwards compatibility reasons */\n inapp_link_new_window?: boolean\n}\n\nexport interface SessionRecordingOptions {\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default 'ph-no-capture'\n */\n blockClass?: string | RegExp\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default null\n */\n blockSelector?: string | null\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default 'ph-ignore-input'\n */\n ignoreClass?: string | RegExp\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default 'ph-mask'\n */\n maskTextClass?: string | RegExp\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n */\n maskTextSelector?: string | null\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n */\n maskTextFn?: ((text: string, element?: HTMLElement) => string) | null\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n */\n maskAllInputs?: boolean\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n */\n maskInputOptions?: recordOptions['maskInputOptions']\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n */\n maskInputFn?: ((text: string, element?: HTMLElement) => string) | null\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default {}\n */\n slimDOMOptions?: recordOptions['slimDOMOptions']\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default false\n */\n collectFonts?: boolean\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default true\n */\n inlineStylesheet?: boolean\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default false\n */\n recordCrossOriginIframes?: boolean\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default false\n */\n recordHeaders?: boolean\n\n /**\n * Derived from `rrweb.record` options\n * @see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * @default false\n */\n recordBody?: boolean\n\n /**\n * Allows local config to override remote canvas recording settings from the decide response\n */\n captureCanvas?: SessionRecordingCanvasOptions\n\n /**\n * Modify the network request before it is captured. Returning null or undefined stops it being captured\n */\n maskCapturedNetworkRequestFn?: ((data: CapturedNetworkRequest) => CapturedNetworkRequest | null | undefined) | null\n\n /** @deprecated - use maskCapturedNetworkRequestFn instead */\n maskNetworkRequestFn?: ((data: NetworkRequest) => NetworkRequest | null | undefined) | null\n\n /**\n * ADVANCED: while a user is active we take a full snapshot of the browser every interval.\n * For very few sites playback performance might be better with different interval.\n * Set to 0 to disable\n *\n * @default 1000 * 60 * 5 (5 minutes)\n */\n full_snapshot_interval_millis?: number\n\n /**\n * ADVANCED: whether to partially compress rrweb events before sending them to the server,\n * defaults to true, can be set to false to disable partial compression\n * NB requests are still compressed when sent to the server regardless of this setting\n *\n * @default true\n */\n compress_events?: boolean\n\n /**\n * ADVANCED: alters the threshold before a recording considers a user has become idle.\n * Normally only altered alongside changes to session_idle_timeout_ms.\n *\n * @default 1000 * 60 * 5 (5 minutes)\n */\n session_idle_threshold_ms?: number\n\n /**\n * ADVANCED: alters the refill rate for the token bucket mutation throttling\n * Normally only altered alongside posthog support guidance.\n * Accepts values between 0 and 100\n *\n * @default 10\n */\n __mutationRateLimiterRefillRate?: number\n\n /**\n * ADVANCED: alters the bucket size for the token bucket mutation throttling\n * Normally only altered alongside posthog support guidance.\n * Accepts values between 0 and 100\n *\n * @default 100\n */\n __mutationRateLimiterBucketSize?: number\n}\n\nexport type SessionIdChangedCallback = (\n sessionId: string,\n windowId: string | null | undefined,\n changeReason?: { noSessionId: boolean; activityTimeout: boolean; sessionPastMaximumLength: boolean }\n) => void\n\nexport enum Compression {\n GZipJS = 'gzip-js',\n Base64 = 'base64',\n}\n\n// Request types - these should be kept minimal to what request.ts needs\n\n// Minimal class to allow interop between different request methods (xhr / fetch)\nexport interface RequestResponse {\n statusCode: number\n text?: string\n json?: any\n}\n\nexport type RequestCallback = (response: RequestResponse) => void\n\n// See https://nextjs.org/docs/app/api-reference/functions/fetch#fetchurl-options\ntype NextOptions = { revalidate: false | 0 | number; tags: string[] }\n\nexport interface RequestWithOptions {\n url: string\n // Data can be a single object or an array of objects when batched\n data?: Record<string, any> | Record<string, any>[]\n headers?: Record<string, any>\n transport?: 'XHR' | 'fetch' | 'sendBeacon'\n method?: 'POST' | 'GET'\n urlQueryArgs?: { compression: Compression }\n callback?: RequestCallback\n timeout?: number\n noRetries?: boolean\n compression?: Compression | 'best-available'\n fetchOptions?: {\n cache?: RequestInit['cache']\n next?: NextOptions\n }\n}\n\n// Queued request types - the same as a request but with additional queueing information\n\nexport interface QueuedRequestWithOptions extends RequestWithOptions {\n /** key of queue, e.g. 'sessionRecording' vs 'event' */\n batchKey?: string\n}\n\n// Used explicitly for retriable requests\nexport interface RetriableRequestWithOptions extends QueuedRequestWithOptions {\n retriesPerformedSoFar?: number\n}\n\n// we used to call a request that was sent to the queue with options attached `RequestQueueOptions`\n// so we can't call the options used to configure the behavior of the RequestQueue that as well,\n// so instead we call them config\nexport interface RequestQueueConfig {\n /**\n * ADVANCED - alters the frequency which PostHog sends events to the server.\n * generally speaking this is only set when apps have automatic page refreshes, or very short visits.\n * Defaults to 3 seconds when not set\n * Allowed values between 250 and 5000\n * */\n flush_interval_ms?: number\n}\n\nexport interface CaptureOptions {\n /**\n * Used when `$identify` is called\n * Will set person properties overriding previous values\n */\n $set?: Properties\n\n /**\n * Used when `$identify` is called\n * Will set person properties but only once, it will NOT override previous values\n */\n $set_once?: Properties\n\n /**\n * Used to override the desired endpoint for the captured event\n */\n _url?: string\n\n /**\n * key of queue, e.g. 'sessionRecording' vs 'event'\n */\n _batchKey?: string\n\n /**\n * If set, overrides and disables config.properties_string_max_length\n */\n _noTruncate?: boolean\n\n /**\n * If set, skips the batched queue\n */\n send_instantly?: boolean\n\n /**\n * If set, skips the client side rate limiting\n */\n skip_client_rate_limiting?: boolean\n\n /**\n * If set, overrides the desired transport method\n */\n transport?: RequestWithOptions['transport']\n\n /**\n * If set, overrides the current timestamp\n */\n timestamp?: Date\n}\n\nexport type FlagVariant = { flag: string; variant: string }\n\nexport type SessionRecordingCanvasOptions = {\n /**\n * If set, records the canvas\n *\n * @default false\n */\n recordCanvas?: boolean | null\n\n /**\n * If set, records the canvas at the given FPS\n * Can be set in the remote configuration\n * Limited between 0 and 12\n * When canvas recording is enabled, if this is not set locally, then remote config sets this as 4\n *\n * @default null-ish\n */\n canvasFps?: number | null\n\n /**\n * If set, records the canvas at the given quality\n * Can be set in the remote configuration\n * Must be a string that is a valid decimal between 0 and 1\n * When canvas recording is enabled, if this is not set locally, then remote config sets this as \"0.4\"\n *\n * @default null-ish\n */\n canvasQuality?: string | null\n}\n\n/**\n * Remote configuration for the PostHog instance\n *\n * All of these settings can be configured directly in your PostHog instance\n * Any configuration set in the client overrides the information from the server\n */\nexport interface RemoteConfig {\n /**\n * Supported compression algorithms\n */\n supportedCompression: Compression[]\n\n /**\n * If set, disables autocapture\n */\n autocapture_opt_out?: boolean\n\n /**\n * originally capturePerformance was replay only and so boolean true\n * is equivalent to { network_timing: true }\n * now capture performance can be separately enabled within replay\n * and as a standalone web vitals tracker\n * people can have them enabled separately\n * they work standalone but enhance each other\n * TODO: deprecate this so we make a new config that doesn't need this explanation\n */\n capturePerformance?: boolean | PerformanceCaptureConfig\n\n /**\n * Whether we should use a custom endpoint for analytics\n *\n * @default { endpoint: \"/e\" }\n */\n analytics?: {\n endpoint?: string\n }\n\n /**\n * Whether the `$elements_chain` property should be sent as a string or as an array\n *\n * @default false\n */\n elementsChainAsString?: boolean\n\n /**\n * This is currently in development and may have breaking changes without a major version bump\n */\n autocaptureExceptions?: boolean | { endpoint?: string }\n\n /**\n * Session recording configuration options\n */\n sessionRecording?: SessionRecordingCanvasOptions & {\n endpoint?: string\n consoleLogRecordingEnabled?: boolean\n // the API returns a decimal between 0 and 1 as a string\n sampleRate?: string | null\n minimumDurationMilliseconds?: number\n linkedFlag?: string | FlagVariant | null\n networkPayloadCapture?: Pick<NetworkRecordOptions, 'recordBody' | 'recordHeaders'>\n masking?: Pick<SessionRecordingOptions, 'maskAllInputs' | 'maskTextSelector'>\n urlTriggers?: SessionRecordingUrlTrigger[]\n scriptConfig?: { script?: string | undefined }\n urlBlocklist?: SessionRecordingUrlTrigger[]\n eventTriggers?: string[]\n }\n\n /**\n * Whether surveys are enabled\n */\n surveys?: boolean\n\n /**\n * Parameters for the toolbar\n */\n toolbarParams: ToolbarParams\n\n /**\n * @deprecated renamed to toolbarParams, still present on older API responses\n */\n editorParams?: ToolbarParams\n\n /**\n * @deprecated, moved to toolbarParams\n */\n toolbarVersion: 'toolbar'\n\n /**\n * Whether the user is authenticated\n */\n isAuthenticated: boolean\n\n /**\n * List of site apps with their IDs and URLs\n */\n siteApps: { id: string; url: string }[]\n\n /**\n * Whether heatmaps are enabled\n */\n heatmaps?: boolean\n\n /**\n * Whether to only capture identified users by default\n */\n defaultIdentifiedOnly?: boolean\n\n /**\n * Whether to capture dead clicks\n */\n captureDeadClicks?: boolean\n\n /**\n * Indicates if the team has any flags enabled (if not we don't need to load them)\n */\n hasFeatureFlags?: boolean\n}\n\n/**\n * Decide returns everything we have on the remote config plus feature flags and their payloads\n */\nexport interface DecideResponse extends RemoteConfig {\n featureFlags: Record<string, string | boolean>\n featureFlagPayloads: Record<string, JsonType>\n errorsWhileComputingFlags: boolean\n requestId?: string\n flags: Record<string, FeatureFlagDetail>\n}\n\nexport type SiteAppGlobals = {\n event: {\n uuid: string\n event: EventName\n properties: Properties\n timestamp?: Date\n elements_chain?: string\n distinct_id?: string\n }\n person: {\n properties: Properties\n }\n groups: Record<string, { id: string; type: string; properties: Properties }>\n}\n\nexport type SiteAppLoader = {\n id: string\n init: (config: { posthog: PostHog; callback: (success: boolean) => void }) => {\n processEvent?: (globals: SiteAppGlobals) => void\n }\n}\n\nexport type SiteApp = {\n id: string\n loaded: boolean\n errored: boolean\n processedBuffer: boolean\n processEvent?: (globals: SiteAppGlobals) => void\n}\n\nexport type FeatureFlagsCallback = (\n flags: string[],\n variants: Record<string, string | boolean>,\n context?: {\n errorsLoading?: boolean\n }\n) => void\n\nexport type FeatureFlagDetail = {\n key: string\n enabled: boolean\n // Only used when overriding a flag payload.\n original_enabled?: boolean | undefined\n variant: string | undefined\n // Only used when overriding a flag payload.\n original_variant?: string | undefined\n reason: EvaluationReason | undefined\n metadata: FeatureFlagMetadata | undefined\n}\n\nexport type FeatureFlagMetadata = {\n id: number\n version: number | undefined\n description: string | undefined\n payload: JsonType | undefined\n // Only used when overriding a flag payload.\n original_payload?: JsonType | undefined\n}\n\nexport type EvaluationReason = {\n code: string\n condition_index: number | undefined\n description: string | undefined\n}\n\nexport type RemoteConfigFeatureFlagCallback = (payload: JsonType) => void\n\nexport interface PersistentStore {\n is_supported: () => boolean\n error: (error: any) => void\n parse: (name: string) => any\n get: (name: string) => any\n set: (\n name: string,\n value: any,\n expire_days?: number | null,\n cross_subdomain?: boolean,\n secure?: boolean,\n debug?: boolean\n ) => void\n remove: (name: string, cross_subdomain?: boolean) => void\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport type Breaker = {}\nexport type EventHandler = (event: Event) => boolean | void\n\nexport type ToolbarUserIntent = 'add-action' | 'edit-action'\nexport type ToolbarSource = 'url' | 'localstorage'\nexport type ToolbarVersion = 'toolbar'\n\n/* sync with posthog */\nexport interface ToolbarParams {\n token?: string /** public posthog-js token */\n temporaryToken?: string /** private temporary user token */\n actionId?: number\n userIntent?: ToolbarUserIntent\n source?: ToolbarSource\n toolbarVersion?: ToolbarVersion\n instrument?: boolean\n distinctId?: string\n userEmail?: string\n dataAttributes?: string[]\n featureFlags?: Record<string, string | boolean>\n}\n\nexport type SnippetArrayItem = [method: string, ...args: any[]]\n\nexport type JsonRecord = { [key: string]: JsonType }\nexport type JsonType = string | number | boolean | null | undefined | JsonRecord | Array<JsonType>\n\n/** A feature that isn't publicly available yet.*/\nexport interface EarlyAccessFeature {\n // Sync this with the backend's EarlyAccessFeatureSerializer!\n name: string\n description: string\n stage: 'concept' | 'alpha' | 'beta'\n documentationUrl: string | null\n flagKey: string | null\n}\n\nexport type EarlyAccessFeatureStage = 'concept' | 'alpha' | 'beta' | 'general-availability'\nexport type EarlyAccessFeatureCallback = (earlyAccessFeatures: EarlyAccessFeature[]) => void\n\nexport interface EarlyAccessFeatureResponse {\n earlyAccessFeatures: EarlyAccessFeature[]\n}\n\nexport type Headers = Record<string, string>\n\n/* for rrweb/network@1\n ** when that is released as part of rrweb this can be removed\n ** don't rely on this type, it may change without notice\n */\nexport type InitiatorType =\n | 'audio'\n | 'beacon'\n | 'body'\n | 'css'\n | 'early-hint'\n | 'embed'\n | 'fetch'\n | 'frame'\n | 'iframe'\n | 'icon'\n | 'image'\n | 'img'\n | 'input'\n | 'link'\n | 'navigation'\n | 'object'\n | 'ping'\n | 'script'\n | 'track'\n | 'video'\n | 'xmlhttprequest'\n\nexport type NetworkRecordOptions = {\n initiatorTypes?: InitiatorType[]\n maskRequestFn?: (data: CapturedNetworkRequest) => CapturedNetworkRequest | undefined\n recordHeaders?: boolean | { request: boolean; response: boolean }\n recordBody?: boolean | string[] | { request: boolean | string[]; response: boolean | string[] }\n recordInitialRequests?: boolean\n /**\n * whether to record PerformanceEntry events for network requests\n */\n recordPerformance?: boolean\n /**\n * the PerformanceObserver will only observe these entry types\n */\n performanceEntryTypeToObserve: string[]\n /**\n * the maximum size of the request/response body to record\n * NB this will be at most 1MB even if set larger\n */\n payloadSizeLimitBytes: number\n /**\n * some domains we should never record the payload\n * for example other companies session replay ingestion payloads aren't super useful but are gigantic\n * if this isn't provided we use a default list\n * if this is provided - we add the provided list to the default list\n * i.e. we never record the payloads on the default deny list\n */\n payloadHostDenyList?: string[]\n}\n\n/** @deprecated - use CapturedNetworkRequest instead */\nexport type NetworkRequest = {\n url: string\n}\n\n// In rrweb this is called NetworkRequest, but we already exposed that as having only URL\n// we also want to vary from the rrweb NetworkRequest because we want to include\n// all PerformanceEntry properties too.\n// that has 4 required properties\n// readonly duration: DOMHighResTimeStamp;\n// readonly entryType: string;\n// readonly name: string;\n// readonly startTime: DOMHighResTimeStamp;\n// NB: properties below here are ALPHA, don't rely on them, they may change without notice\n\n// we mirror PerformanceEntry since we read into this type from a PerformanceObserver,\n// but we don't want to inherit its readonly-iness\ntype Writable<T> = { -readonly [P in keyof T]: T[P] }\n\nexport type CapturedNetworkRequest = Writable<Omit<PerformanceEntry, 'toJSON'>> & {\n // properties below here are ALPHA, don't rely on them, they may change without notice\n method?: string\n initiatorType?: InitiatorType\n status?: number\n timeOrigin?: number\n timestamp?: number\n startTime?: number\n endTime?: number\n requestHeaders?: Headers\n requestBody?: string | null\n responseHeaders?: Headers\n responseBody?: string | null\n // was this captured before fetch/xhr could have been wrapped\n isInitial?: boolean\n}\n\nexport type ErrorConversionArgs = {\n event: string | Event\n error?: Error\n}\n\nexport type ErrorEventArgs = [\n event: string | Event,\n source?: string | undefined,\n lineno?: number | undefined,\n colno?: number | undefined,\n error?: Error | undefined,\n]\n\nexport type ErrorMetadata = {\n handled?: boolean\n synthetic?: boolean\n syntheticException?: Error\n overrideExceptionType?: string\n overrideExceptionMessage?: string\n defaultExceptionType?: string\n defaultExceptionMessage?: string\n}\n\n// levels originally copied from Sentry to work with the sentry integration\n// and to avoid relying on a frequently changing @sentry/types dependency\n// but provided as an array of literal types, so we can constrain the level below\nexport const severityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug'] as const\nexport declare type SeverityLevel = (typeof severityLevels)[number]\n\nexport interface ErrorProperties {\n $exception_type: string\n $exception_message: string\n $exception_level: SeverityLevel\n $exception_source?: string\n $exception_lineno?: number\n $exception_colno?: number\n $exception_DOMException_code?: string\n $exception_is_synthetic?: boolean\n $exception_stack_trace_raw?: string\n $exception_handled?: boolean\n $exception_personURL?: string\n}\n\nexport interface ErrorConversions {\n errorToProperties: (args: ErrorEventArgs) => ErrorProperties\n unhandledRejectionToProperties: (args: [ev: PromiseRejectionEvent]) => ErrorProperties\n}\n\nexport interface SessionRecordingUrlTrigger {\n url: string\n matching: 'regex'\n}\n","export function includes(str: string, needle: string): boolean\nexport function includes<T>(arr: T[], needle: T): boolean\nexport function includes(str: unknown[] | string, needle: unknown): boolean {\n return (str as any).indexOf(needle) !== -1\n}\n\nexport const trim = function (str: string): string {\n // Previous implementation was using underscore's trim function.\n // When switching to just using the native trim() function, we ran some tests to make sure that it was able to trim both the BOM character \\uFEFF and the NBSP character \\u00A0.\n // We tested modern Chrome (134.0.6998.118) and Firefox (136.0.2), and IE11 running on Windows 10, and all of them were able to trim both characters.\n // See https://posthog.slack.com/archives/C0113360FFV/p1742811455647359\n return str.trim()\n}\n\n// UNDERSCORE\n// Embed part of the Underscore Library\nexport const stripLeadingDollar = function (s: string): string {\n return s.replace(/^\\$/, '')\n}\n\nexport function isDistinctIdStringLike(value: string): boolean {\n return ['distinct_id', 'distinctid'].includes(value.toLowerCase())\n}\n","import { window } from './globals'\nimport { knownUnsafeEditableEvent, KnownUnsafeEditableEvent } from '../types'\nimport { includes } from './string-utils'\n\n// eslint-disable-next-line posthog-js/no-direct-array-check\nconst nativeIsArray = Array.isArray\nconst ObjProto = Object.prototype\nexport const hasOwnProperty = ObjProto.hasOwnProperty\nconst toString = ObjProto.toString\n\nexport const isArray =\n nativeIsArray ||\n function (obj: any): obj is any[] {\n return toString.call(obj) === '[object Array]'\n }\n\n// from a comment on http://dbj.org/dbj/?p=286\n// fails on only one very rare and deliberate custom object:\n// let bomb = { toString : undefined, valueOf: function(o) { return \"function BOMBA!\"; }};\nexport const isFunction = (x: unknown): x is (...args: any[]) => any => {\n // eslint-disable-next-line posthog-js/no-direct-function-check\n return typeof x === 'function'\n}\n\nexport const isNativeFunction = (x: unknown): x is (...args: any[]) => any =>\n isFunction(x) && x.toString().indexOf('[native code]') !== -1\n\n// When angular patches functions they pass the above `isNativeFunction` check (at least the MutationObserver)\nexport const isAngularZonePresent = (): boolean => {\n return !!(window as any).Zone\n}\n\n// Underscore Addons\nexport const isObject = (x: unknown): x is Record<string, any> => {\n // eslint-disable-next-line posthog-js/no-direct-object-check\n return x === Object(x) && !isArray(x)\n}\nexport const isEmptyObject = (x: unknown) => {\n if (isObject(x)) {\n for (const key in x) {\n if (hasOwnProperty.call(x, key)) {\n return false\n }\n }\n return true\n }\n return false\n}\nexport const isUndefined = (x: unknown): x is undefined => x === void 0\n\nexport const isString = (x: unknown): x is string => {\n // eslint-disable-next-line posthog-js/no-direct-string-check\n return toString.call(x) == '[object String]'\n}\n\nexport const isEmptyString = (x: unknown): boolean => isString(x) && x.trim().length === 0\n\nexport const isNull = (x: unknown): x is null => {\n // eslint-disable-next-line posthog-js/no-direct-null-check\n return x === null\n}\n\n/*\n sometimes you want to check if something is null or undefined\n that's what this is for\n */\nexport const isNullish = (x: unknown): x is null | undefined => isUndefined(x) || isNull(x)\n\nexport const isNumber = (x: unknown): x is number => {\n // eslint-disable-next-line posthog-js/no-direct-number-check\n return toString.call(x) == '[object Number]'\n}\nexport const isBoolean = (x: unknown): x is boolean => {\n // eslint-disable-next-line posthog-js/no-direct-boolean-check\n return toString.call(x) === '[object Boolean]'\n}\n\nexport const isDocument = (x: unknown): x is Document => {\n // eslint-disable-next-line posthog-js/no-direct-document-check\n return x instanceof Document\n}\n\nexport const isFormData = (x: unknown): x is FormData => {\n // eslint-disable-next-line posthog-js/no-direct-form-data-check\n return x instanceof FormData\n}\n\nexport const isFile = (x: unknown): x is File => {\n // eslint-disable-next-line posthog-js/no-direct-file-check\n return x instanceof File\n}\n\nexport const isError = (x: unknown): x is Error => {\n return x instanceof Error\n}\n\nexport const isKnownUnsafeEditableEvent = (x: unknown): x is KnownUnsafeEditableEvent => {\n return includes(knownUnsafeEditableEvent as unknown as string[], x)\n}\n","import Config from '../config'\nimport { isUndefined } from './type-utils'\nimport { assignableWindow, window } from './globals'\n\nexport type Logger = {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => void\n info: (...args: any[]) => void\n warn: (...args: any[]) => void\n error: (...args: any[]) => void\n critical: (...args: any[]) => void\n uninitializedWarning: (methodName: string) => void\n createLogger: (prefix: string) => Logger\n}\n\nconst _createLogger = (prefix: string): Logger => {\n const logger: Logger = {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => {\n if (\n window &&\n (Config.DEBUG || assignableWindow.POSTHOG_DEBUG) &&\n !isUndefined(window.console) &&\n window.console\n ) {\n const consoleLog =\n '__rrweb_original__' in window.console[level]\n ? (window.console[level] as any)['__rrweb_original__']\n : window.console[level]\n\n // eslint-disable-next-line no-console\n consoleLog(prefix, ...args)\n }\n },\n\n info: (...args: any[]) => {\n logger._log('log', ...args)\n },\n\n warn: (...args: any[]) => {\n logger._log('warn', ...args)\n },\n\n error: (...args: any[]) => {\n logger._log('error', ...args)\n },\n\n critical: (...args: any[]) => {\n // Critical errors are always logged to the console\n // eslint-disable-next-line no-console\n console.error(prefix, ...args)\n },\n\n uninitializedWarning: (methodName: string) => {\n logger.error(`You must initialize PostHog before calling ${methodName}`)\n },\n\n createLogger: (additionalPrefix: string) => _createLogger(`${prefix} ${additionalPrefix}`),\n }\n return logger\n}\n\nexport const logger = _createLogger('[PostHog.js]')\n\nexport const createLogger = logger.createLogger\n","import { Breaker, Properties } from '../types'\nimport { hasOwnProperty, isArray, isFormData, isNull, isNullish, isString } from './type-utils'\nimport { logger } from './logger'\nimport { nativeForEach, nativeIndexOf } from './globals'\n\nconst breaker: Breaker = {}\n\nexport function eachArray<E = any>(\n obj: E[] | null | undefined,\n iterator: (value: E, key: number) => void | Breaker,\n thisArg?: any\n): void {\n if (isArray(obj)) {\n if (nativeForEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, thisArg)\n } else if ('length' in obj && obj.length === +obj.length) {\n for (let i = 0, l = obj.length; i < l; i++) {\n if (i in obj && iterator.call(thisArg, obj[i], i) === breaker) {\n return\n }\n }\n }\n }\n}\n\n/**\n * @param {*=} obj\n * @param {function(...*)=} iterator\n * @param {Object=} thisArg\n */\nexport function each(obj: any, iterator: (value: any, key: any) => void | Breaker, thisArg?: any): void {\n if (isNullish(obj)) {\n return\n }\n if (isArray(obj)) {\n return eachArray(obj, iterator, thisArg)\n }\n if (isFormData(obj)) {\n for (const pair of obj.entries()) {\n if (iterator.call(thisArg, pair[1], pair[0]) === breaker) {\n return\n }\n }\n return\n }\n for (const key in obj) {\n if (hasOwnProperty.call(obj, key)) {\n if (iterator.call(thisArg, obj[key], key) === breaker) {\n return\n }\n }\n }\n}\n\nexport const extend = function (obj: Record<string, any>, ...args: Record<string, any>[]): Record<string, any> {\n eachArray(args, function (source) {\n for (const prop in source) {\n if (source[prop] !== void 0) {\n obj[prop] = source[prop]\n }\n }\n })\n return obj\n}\n\nexport const extendArray = function <T>(obj: T[], ...args: T[][]): T[] {\n eachArray(args, function (source) {\n eachArray(source, function (item) {\n obj.push(item)\n })\n })\n return obj\n}\n\nexport const include = function (\n obj: null | string | Array<any> | Record<string, any>,\n target: any\n): boolean | Breaker {\n let found = false\n if (isNull(obj)) {\n return found\n }\n if (nativeIndexOf && obj.indexOf === nativeIndexOf) {\n return obj.indexOf(target) != -1\n }\n each(obj, function (value) {\n if (found || (found = value === target)) {\n return breaker\n }\n return\n })\n return found\n}\n\n/**\n * Object.entries() polyfill\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries\n */\nexport function entries<T = any>(obj: Record<string, T>): [string, T][] {\n const ownProps = Object.keys(obj)\n let i = ownProps.length\n const resArray = new Array(i) // preallocate the Array\n\n while (i--) {\n resArray[i] = [ownProps[i], obj[ownProps[i]]]\n }\n return resArray\n}\n\nexport const trySafe = function <T>(fn: () => T): T | undefined {\n try {\n return fn()\n } catch {\n return undefined\n }\n}\n\nexport const safewrap = function <F extends (...args: any[]) => any = (...args: any[]) => any>(f: F): F {\n return function (...args) {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return f.apply(this, args)\n } catch (e) {\n logger.critical(\n 'Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.'\n )\n logger.critical(e)\n }\n } as F\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport const safewrapClass = function (klass: Function, functions: string[]): void {\n for (let i = 0; i < functions.length; i++) {\n klass.prototype[functions[i]] = safewrap(klass.prototype[functions[i]])\n }\n}\n\nexport const stripEmptyProperties = function (p: Properties): Properties {\n const ret: Properties = {}\n each(p, function (v, k) {\n if (isString(v) && v.length > 0) {\n ret[k] = v\n }\n })\n return ret\n}\n\n/**\n * Deep copies an object.\n * It handles cycles by replacing all references to them with `undefined`\n * Also supports customizing native values\n *\n * @param value\n * @param customizer\n * @returns {{}|undefined|*}\n */\nfunction deepCircularCopy<T extends Record<string, any> = Record<string, any>>(\n value: T,\n customizer?: <K extends keyof T = keyof T>(value: T[K], key?: K) => T[K]\n): T | undefined {\n const COPY_IN_PROGRESS_SET = new Set()\n\n function internalDeepCircularCopy(value: T, key?: string): T | undefined {\n if (value !== Object(value)) return customizer ? customizer(value as any, key) : value // primitive value\n\n if (COPY_IN_PROGRESS_SET.has(value)) return undefined\n COPY_IN_PROGRESS_SET.add(value)\n let result: T\n\n if (isArray(value)) {\n result = [] as any as T\n eachArray(value, (it) => {\n result.push(internalDeepCircularCopy(it))\n })\n } else {\n result = {} as T\n each(value, (val, key) => {\n if (!COPY_IN_PROGRESS_SET.has(val)) {\n ;(result as any)[key] = internalDeepCircularCopy(val, key)\n }\n })\n }\n return result\n }\n return internalDeepCircularCopy(value)\n}\n\nexport function _copyAndTruncateStrings<T extends Record<string, any> = Record<string, any>>(\n object: T,\n maxStringLength: number | null\n): T {\n return deepCircularCopy(object, (value: any) => {\n if (isString(value) && !isNull(maxStringLength)) {\n return (value as string).slice(0, maxStringLength)\n }\n return value\n }) as T\n}\n\n// NOTE: Update PostHogConfig docs if you change this list\n// We will not try to catch all bullets here, but we should make an effort to catch the most common ones\n// You should be highly against adding more to this list, because ultimately customers can configure\n// their `cross_subdomain_cookie` setting to anything they want.\nconst EXCLUDED_FROM_CROSS_SUBDOMAIN_COOKIE = ['herokuapp.com', 'vercel.app', 'netlify.app']\nexport function isCrossDomainCookie(documentLocation: Location | undefined) {\n const hostname = documentLocation?.hostname\n\n if (!isString(hostname)) {\n return false\n }\n // split and slice isn't a great way to match arbitrary domains,\n // but it's good enough for ensuring we only match herokuapp.com when it is the TLD\n // for the hostname\n const lastTwoParts = hostname.split('.').slice(-2).join('.')\n\n for (const excluded of EXCLUDED_FROM_CROSS_SUBDOMAIN_COOKIE) {\n if (lastTwoParts === excluded) {\n return false\n }\n }\n\n return true\n}\n\nexport function find<T>(value: T[], predicate: (value: T) => boolean): T | undefined {\n for (let i = 0; i < value.length; i++) {\n if (predicate(value[i])) {\n return value[i]\n }\n }\n return undefined\n}\n\n// Use this instead of element.addEventListener to avoid eslint errors\n// this properly implements the default options for passive event listeners\nexport function addEventListener(\n element: Window | Document | Element | undefined,\n event: string,\n callback: EventListener,\n options?: AddEventListenerOptions\n): void {\n const { capture = false, passive = true } = options ?? {}\n\n // This is the only place where we are allowed to call this function\n // because the whole idea is that we should be calling this instead of the built-in one\n // eslint-disable-next-line posthog-js/no-add-event-listener\n element?.addEventListener(event, callback, { capture, passive })\n}\n","import { each } from './'\n\nimport { isArray, isFile, isUndefined } from './type-utils'\nimport { logger } from './logger'\nimport { document } from './globals'\n\nconst localDomains = ['localhost', '127.0.0.1']\n\n/**\n * IE11 doesn't support `new URL`\n * so we can create an anchor element and use that to parse the URL\n * there's a lot of overlap between HTMLHyperlinkElementUtils and URL\n * meaning useful properties like `pathname` are available on both\n */\nexport const convertToURL = (url: string): HTMLAnchorElement | null => {\n const location = document?.createElement('a')\n if (isUndefined(location)) {\n return null\n }\n\n location.href = url\n return location\n}\n\nexport const formDataToQuery = function (formdata: Record<string, any> | FormData, arg_separator = '&'): string {\n let use_val: string\n let use_key: string\n const tph_arr: string[] = []\n\n each(formdata, function (val: File | string | undefined, key: string | undefined) {\n // the key might be literally the string undefined for e.g. if {undefined: 'something'}\n if (isUndefined(val) || isUndefined(key) || key === 'undefined') {\n return\n }\n\n use_val = encodeURIComponent(isFile(val) ? val.name : val.toString())\n use_key = encodeURIComponent(key)\n tph_arr[tph_arr.length] = use_key + '=' + use_val\n })\n\n return tph_arr.join(arg_separator)\n}\n\n// NOTE: Once we get rid of IE11/op_mini we can start using URLSearchParams\nexport const getQueryParam = function (url: string, param: string): string {\n const withoutHash: string = url.split('#')[0] || ''\n\n // Split only on the first ? to sort problem out for those with multiple ?s\n // and then remove them\n const queryParams: string = withoutHash.split(/\\?(.*)/)[1] || ''\n const cleanedQueryParams = queryParams.replace(/^\\?+/g, '')\n\n const queryParts = cleanedQueryParams.split('&')\n let keyValuePair\n\n for (let i = 0; i < queryParts.length; i++) {\n const parts = queryParts[i].split('=')\n if (parts[0] === param) {\n keyValuePair = parts\n break\n }\n }\n\n if (!isArray(keyValuePair) || keyValuePair.length < 2) {\n return ''\n } else {\n let result = keyValuePair[1]\n try {\n result = decodeURIComponent(result)\n } catch {\n logger.error('Skipping decoding for malformed query param: ' + result)\n }\n return result.replace(/\\+/g, ' ')\n }\n}\n\n// replace any query params in the url with the provided mask value. Tries to keep the URL as instant as possible,\n// including preserving malformed text in most cases\nexport const maskQueryParams = function <T extends string | undefined>(\n url: T,\n maskedParams: string[] | undefined,\n mask: string\n): T extends string ? string : undefined {\n if (!url || !maskedParams || !maskedParams.length) {\n return url as any\n }\n\n const splitHash = url.split('#')\n const withoutHash: string = splitHash[0] || ''\n const hash = splitHash[1]\n\n const splitQuery: string[] = withoutHash.split('?')\n const queryString: string = splitQuery[1]\n const urlWithoutQueryAndHash: string = splitQuery[0]\n const queryParts = (queryString || '').split('&')\n\n // use an array of strings rather than an object to preserve ordering and duplicates\n const paramStrings: string[] = []\n\n for (let i = 0; i < queryParts.length; i++) {\n const keyValuePair = queryParts[i].split('=')\n if (!isArray(keyValuePair)) {\n continue\n } else if (maskedParams.includes(keyValuePair[0])) {\n paramStrings.push(keyValuePair[0] + '=' + mask)\n } else {\n paramStrings.push(queryParts[i])\n }\n }\n\n let result = urlWithoutQueryAndHash\n if (queryString != null) {\n result += '?' + paramStrings.join('&')\n }\n if (hash != null) {\n result += '#' + hash\n }\n\n return result as any\n}\n\nexport const _getHashParam = function (hash: string, param: string): string | null {\n const matches = hash.match(new RegExp(param + '=([^&]*)'))\n return matches ? matches[1] : null\n}\n\nexport const isLocalhost = (): boolean => {\n return localDomains.includes(location.hostname)\n}\n","// import { patch } from 'rrweb/typings/utils'\n// copied from https://github.com/rrweb-io/rrweb/blob/8aea5b00a4dfe5a6f59bd2ae72bb624f45e51e81/packages/rrweb/src/utils.ts#L129\n// which was copied from https://github.com/getsentry/sentry-javascript/blob/b2109071975af8bf0316d3b5b38f519bdaf5dc15/packages/utils/src/object.ts\nimport { isFunction } from '../../../utils/type-utils'\n\nexport function patch(\n source: { [key: string]: any },\n name: string,\n replacement: (...args: unknown[]) => unknown\n): () => void {\n try {\n if (!(name in source)) {\n return () => {\n //\n }\n }\n\n const original = source[name] as () => unknown\n const wrapped = replacement(original)\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n if (isFunction(wrapped)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n wrapped.prototype = wrapped.prototype || {}\n Object.defineProperties(wrapped, {\n __posthog_wrapped__: {\n enumerable: false,\n value: true,\n },\n })\n }\n\n source[name] = wrapped\n\n return () => {\n source[name] = original\n }\n } catch {\n return () => {\n //\n }\n // This can throw if multiple fill happens on a global object like XMLHttpRequest\n // Fixes https://github.com/getsentry/sentry-javascript/issues/2043\n }\n}\n","import { NetworkRecordOptions } from '../../../types'\n\nfunction hostnameFromURL(url: string | URL | RequestInfo): string | null {\n try {\n if (typeof url === 'string') {\n return new URL(url).hostname\n }\n if ('url' in url) {\n return new URL(url.url).hostname\n }\n return url.hostname\n } catch {\n return null\n }\n}\n\nexport function isHostOnDenyList(url: string | URL | Request, options: NetworkRecordOptions) {\n const hostname = hostnameFromURL(url)\n const defaultNotDenied = { hostname, isHostDenied: false }\n\n if (!options.payloadHostDenyList?.length || !hostname?.trim().length) {\n return defaultNotDenied\n }\n\n for (const deny of options.payloadHostDenyList) {\n if (hostname.endsWith(deny)) {\n return { hostname, isHostDenied: true }\n }\n }\n\n return defaultNotDenied\n}\n","/*\n * Constants\n */\n\n/* PROPERTY KEYS */\n\n// This key is deprecated, but we want to check for it to see whether aliasing is allowed.\nexport const PEOPLE_DISTINCT_ID_KEY = '$people_distinct_id'\nexport const DISTINCT_ID = 'distinct_id'\nexport const ALIAS_ID_KEY = '__alias'\nexport const CAMPAIGN_IDS_KEY = '__cmpns'\nexport const EVENT_TIMERS_KEY = '__timers'\nexport const AUTOCAPTURE_DISABLED_SERVER_SIDE = '$autocapture_disabled_server_side'\nexport const HEATMAPS_ENABLED_SERVER_SIDE = '$heatmaps_enabled_server_side'\nexport const EXCEPTION_CAPTURE_ENABLED_SERVER_SIDE = '$exception_capture_enabled_server_side'\nexport const WEB_VITALS_ENABLED_SERVER_SIDE = '$web_vitals_enabled_server_side'\nexport const DEAD_CLICKS_ENABLED_SERVER_SIDE = '$dead_clicks_enabled_server_side'\nexport const WEB_VITALS_ALLOWED_METRICS = '$web_vitals_allowed_metrics'\nexport const SESSION_RECORDING_ENABLED_SERVER_SIDE = '$session_recording_enabled_server_side'\nexport const CONSOLE_LOG_RECORDING_ENABLED_SERVER_SIDE = '$console_log_recording_enabled_server_side'\nexport const SESSION_RECORDING_NETWORK_PAYLOAD_CAPTURE = '$session_recording_network_payload_capture'\nexport const SESSION_RECORDING_MASKING = '$session_recording_masking'\nexport const SESSION_RECORDING_CANVAS_RECORDING = '$session_recording_canvas_recording'\nexport const SESSION_RECORDING_SAMPLE_RATE = '$replay_sample_rate'\nexport const SESSION_RECORDING_MINIMUM_DURATION = '$replay_minimum_duration'\nexport const SESSION_RECORDING_SCRIPT_CONFIG = '$replay_script_config'\nexport const SESSION_ID = '$sesid'\nexport const SESSION_RECORDING_IS_SAMPLED = '$session_is_sampled'\nexport const SESSION_RECORDING_URL_TRIGGER_ACTIVATED_SESSION = '$session_recording_url_trigger_activated_session'\nexport const SESSION_RECORDING_URL_TRIGGER_STATUS = '$session_recording_url_trigger_status'\nexport const SESSION_RECORDING_EVENT_TRIGGER_ACTIVATED_SESSION = '$session_recording_event_trigger_activated_session'\nexport const SESSION_RECORDING_EVENT_TRIGGER_STATUS = '$session_recording_event_trigger_status'\nexport const ENABLED_FEATURE_FLAGS = '$enabled_feature_flags'\nexport const PERSISTENCE_EARLY_ACCESS_FEATURES = '$early_access_features'\nexport const PERSISTENCE_FEATURE_FLAG_DETAILS = '$feature_flag_details'\nexport const STORED_PERSON_PROPERTIES_KEY = '$stored_person_properties'\nexport const STORED_GROUP_PROPERTIES_KEY = '$stored_group_properties'\nexport const SURVEYS = '$surveys'\nexport const SURVEYS_ACTIVATED = '$surveys_activated'\nexport const FLAG_CALL_REPORTED = '$flag_call_reported'\nexport const USER_STATE = '$user_state'\nexport const CLIENT_SESSION_PROPS = '$client_session_props'\nexport const CAPTURE_RATE_LIMIT = '$capture_rate_limit'\n\n/** @deprecated Delete this when INITIAL_PERSON_INFO has been around for long enough to ignore backwards compat */\nexport const INITIAL_CAMPAIGN_PARAMS = '$initial_campaign_params'\n/** @deprecated Delete this when INITIAL_PERSON_INFO has been around for long enough to ignore backwards compat */\nexport const INITIAL_REFERRER_INFO = '$initial_referrer_info'\nexport const INITIAL_PERSON_INFO = '$initial_person_info'\nexport const ENABLE_PERSON_PROCESSING = '$epp'\nexport const TOOLBAR_ID = '__POSTHOG_TOOLBAR__'\nexport const TOOLBAR_CONTAINER_CLASS = 'toolbar-global-fade-container'\n\n/**\n * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION\n * Sentinel value for distinct id, device id, session id. Signals that the server should generate the value\n * */\nexport const COOKIELESS_SENTINEL_VALUE = '$posthog_cookieless'\nexport const COOKIELESS_MODE_FLAG_PROPERTY = '$cookieless_mode'\n\nexport const WEB_EXPERIMENTS = '$web_experiments'\n\n// These are properties that are reserved and will not be automatically included in events\nexport const PERSISTENCE_RESERVED_PROPERTIES = [\n PEOPLE_DISTINCT_ID_KEY,\n ALIAS_ID_KEY,\n CAMPAIGN_IDS_KEY,\n EVENT_TIMERS_KEY,\n SESSION_RECORDING_ENABLED_SERVER_SIDE,\n HEATMAPS_ENABLED_SERVER_SIDE,\n SESSION_ID,\n ENABLED_FEATURE_FLAGS,\n USER_STATE,\n PERSISTENCE_EARLY_ACCESS_FEATURES,\n PERSISTENCE_FEATURE_FLAG_DETAILS,\n STORED_GROUP_PROPERTIES_KEY,\n STORED_PERSON_PROPERTIES_KEY,\n SURVEYS,\n FLAG_CALL_REPORTED,\n CLIENT_SESSION_PROPS,\n CAPTURE_RATE_LIMIT,\n INITIAL_CAMPAIGN_PARAMS,\n INITIAL_REFERRER_INFO,\n ENABLE_PERSON_PROCESSING,\n]\n\nexport const SURVEYS_REQUEST_TIMEOUT_MS = 10000\n","import { TOOLBAR_CONTAINER_CLASS, TOOLBAR_ID } from '../constants'\n\nexport function isElementInToolbar(el: EventTarget | null): boolean {\n if (el instanceof Element) {\n // closest isn't available in IE11, but we'll polyfill when bundling\n return el.id === TOOLBAR_ID || !!el.closest?.('.' + TOOLBAR_CONTAINER_CLASS)\n }\n return false\n}\n\n/*\n * Check whether an element has nodeType Node.ELEMENT_NODE\n * @param {Element} el - element to check\n * @returns {boolean} whether el is of the correct nodeType\n */\nexport function isElementNode(el: Node | Element | undefined | null): el is Element {\n return !!el && el.nodeType === 1 // Node.ELEMENT_NODE - use integer constant for browser portability\n}\n\n/*\n * Check whether an element is of a given tag type.\n * Due to potential reference discrepancies (such as the webcomponents.js polyfill),\n * we want to match tagNames instead of specific references because something like\n * element === document.body won't always work because element might not be a native\n * element.\n * @param {Element} el - element to check\n * @param {string} tag - tag name (e.g., \"div\")\n * @returns {boolean} whether el is of the given tag type\n */\nexport function isTag(el: Element | undefined | null, tag: string): el is HTMLElement {\n return !!el && !!el.tagName && el.tagName.toLowerCase() === tag.toLowerCase()\n}\n\n/*\n * Check whether an element has nodeType Node.TEXT_NODE\n * @param {Element} el - element to check\n * @returns {boolean} whether el is of the correct nodeType\n */\nexport function isTextNode(el: Element | undefined | null): el is HTMLElement {\n return !!el && el.nodeType === 3 // Node.TEXT_NODE - use integer constant for browser portability\n}\n\n/*\n * Check whether an element has nodeType Node.DOCUMENT_FRAGMENT_NODE\n * @param {Element} el - element to check\n * @returns {boolean} whether el is of the correct nodeType\n */\nexport function isDocumentFragment(el: Element | ParentNode | undefined | null): el is DocumentFragment {\n return !!el && el.nodeType === 11 // Node.DOCUMENT_FRAGMENT_NODE - use integer constant for browser portability\n}\n","import { AutocaptureConfig, Properties } from './types'\nimport { each, entries } from './utils'\n\nimport { isArray, isNullish, isString, isUndefined } from './utils/type-utils'\nimport { logger } from './utils/logger'\nimport { window } from './utils/globals'\nimport { isDocumentFragment, isElementNode, isTag, isTextNode } from './utils/element-utils'\nimport { includes, trim } from './utils/string-utils'\n\nexport function splitClassString(s: string): string[] {\n return s ? trim(s).split(/\\s+/) : []\n}\n\nfunction checkForURLMatches(urlsList: (string | RegExp)[]): boolean {\n const url = window?.location.href\n return !!(url && urlsList && urlsList.some((regex) => url.match(regex)))\n}\n\n/*\n * Get the className of an element, accounting for edge cases where element.className is an object\n *\n * Because this is a string it can contain unexpected characters\n * So, this method safely splits the className and returns that array.\n */\nexport function getClassNames(el: Element): string[] {\n let className = ''\n switch (typeof el.className) {\n case 'string':\n className = el.className\n break\n // TODO: when is this ever used?\n case 'object': // handle cases where className might be SVGAnimatedString or some other type\n className =\n (el.className && 'baseVal' in el.className ? (el.className as any).baseVal : null) ||\n el.getAttribute('class') ||\n ''\n break\n default:\n className = ''\n }\n\n return splitClassString(className)\n}\n\nexport function makeSafeText(s: string | null | undefined): string | null {\n if (isNullish(s)) {\n return null\n }\n\n return (\n trim(s)\n // scrub potentially sensitive values\n .split(/(\\s+)/)\n .filter((s) => shouldCaptureValue(s))\n .join('')\n // normalize whitespace\n .replace(/[\\r\\n]/g, ' ')\n .replace(/[ ]+/g, ' ')\n // truncate\n .substring(0, 255)\n )\n}\n\n/*\n * Get the direct text content of an element, protecting against sensitive data collection.\n * Concats textContent of each of the element's text node children; this avoids potential\n * collection of sensitive data that could happen if we used element.textContent and the\n * element had sensitive child elements, since element.textContent includes child content.\n * Scrubs values that look like they could be sensitive (i.e. cc or ssn number).\n * @param {Element} el - element to get the text of\n * @returns {string} the element's direct text content\n */\nexport function getSafeText(el: Element): string {\n let elText = ''\n\n if (shouldCaptureElement(el) && !isSensitiveElement(el) && el.childNodes && el.childNodes.length) {\n each(el.childNodes, function (child) {\n if (isTextNode(child) && child.textContent) {\n elText += makeSafeText(child.textContent) ?? ''\n }\n })\n }\n\n return trim(elText)\n}\n\nexport function getEventTarget(e: Event): Element | null {\n // https://developer.mozilla.org/en-US/docs/Web/API/Event/target#Compatibility_notes\n if (isUndefined(e.target)) {\n return (e.srcElement as Element) || null\n } else {\n if ((e.target as HTMLElement)?.shadowRoot) {\n return (e.composedPath()[0] as Element) || null\n }\n return (e.target as Element) || null\n }\n}\n\nexport const autocaptureCompatibleElements = ['a', 'button', 'form', 'input', 'select', 'textarea', 'label']\n\n/*\n if there is no config, then all elements are allowed\n if there is a config, and there is an allow list, then only elements in the allow list are allowed\n assumes that some other code is checking this element's parents\n */\nfunction checkIfElementTreePassesElementAllowList(\n elements: Element[],\n autocaptureConfig: AutocaptureConfig | undefined\n): boolean {\n const allowlist = autocaptureConfig?.element_allowlist\n if (isUndefined(allowlist)) {\n // everything is allowed, when there is no allow list\n return true\n }\n\n // check each element in the tree\n // if any of the elements are in the allow list, then the tree is allowed\n for (const el of elements) {\n if (allowlist.some((elementType) => el.tagName.toLowerCase() === elementType)) {\n return true\n }\n }\n\n // otherwise there is an allow list and this element tree didn't match it\n return false\n}\n\n/*\n if there is no config, then all elements are allowed\n if there is a config, and there is an allow list, then\n only elements that match the css selector in the allow list are allowed\n assumes that some other code is checking this element's parents\n */\nfunction checkIfElementTreePassesCSSSelectorAllowList(\n elements: Element[],\n autocaptureConfig: AutocaptureConfig | undefined\n): boolean {\n const allowlist = autocaptureConfig?.css_selector_allowlist\n if (isUndefined(allowlist)) {\n // everything is allowed, when there is no allow list\n return true\n }\n\n // check each element in the tree\n // if any of the elements are in the allow list, then the tree is allowed\n for (const el of elements) {\n if (allowlist.some((selector) => el.matches(selector))) {\n return true\n }\n }\n\n // otherwise there is an allow list and this element tree didn't match it\n return false\n}\n\nexport function getParentElement(curEl: Element): Element | false {\n const parentNode = curEl.parentNode\n if (!parentNode || !isElementNode(parentNode)) return false\n return parentNode\n}\n\n/*\n * Check whether a DOM event should be \"captured\" or if it may contain sentitive data\n * using a variety of heuristics.\n * @param {Element} el - element to check\n * @param {Event} event - event to check\n * @param {Object} autocaptureConfig - autocapture config\n * @param {boolean} captureOnAnyElement - whether to capture on any element, clipboard autocapture doesn't restrict to \"clickable\" elements\n * @param {string[]} allowedEventTypes - event types to capture, normally just 'click', but some autocapture types react to different events, some elements have fixed events (e.g., form has \"submit\")\n * @returns {boolean} whether the event should be captured\n */\nexport function shouldCaptureDomEvent(\n el: Element,\n event: Event,\n autocaptureConfig: AutocaptureConfig | undefined = undefined,\n captureOnAnyElement?: boolean,\n allowedEventTypes?: string[]\n): boolean {\n if (!window || !el || isTag(el, 'html') || !isElementNode(el)) {\n return false\n }\n\n if (autocaptureConfig?.url_allowlist) {\n // if the current URL is not in the allow list, don't capture\n if (!checkForURLMatches(autocaptureConfig.url_allowlist)) {\n return false\n }\n }\n\n if (autocaptureConfig?.url_ignorelist) {\n // if the current URL is in the ignore list, don't capture\n if (checkForURLMatches(autocaptureConfig.url_ignorelist)) {\n return false\n }\n }\n\n if (autocaptureConfig?.dom_event_allowlist) {\n const allowlist = autocaptureConfig.dom_event_allowlist\n if (allowlist && !allowlist.some((eventType) => event.type === eventType)) {\n return false\n }\n }\n\n let parentIsUsefulElement = false\n const targetElementList: Element[] = [el]\n let parentNode: Element | boolean = true\n let curEl: Element = el\n while (curEl.parentNode && !isTag(curEl, 'body')) {\n // If element is a shadow root, we skip it\n if (isDocumentFragment(curEl.parentNode)) {\n targetElementList.push((curEl.parentNode as any).host)\n curEl = (curEl.parentNode as any).host\n continue\n }\n parentNode = getParentElement(curEl)\n if (!parentNode) break\n if (captureOnAnyElement || autocaptureCompatibleElements.indexOf(parentNode.tagName.toLowerCase()) > -1) {\n parentIsUsefulElement = true\n } else {\n const compStyles = window.getComputedStyle(parentNode)\n if (compStyles && compStyles.getPropertyValue('cursor') === 'pointer') {\n parentIsUsefulElement = true\n }\n }\n\n targetElementList.push(parentNode)\n curEl = parentNode\n }\n\n if (!checkIfElementTreePassesElementAllowList(targetElementList, autocaptureConfig)) {\n return false\n }\n\n if (!checkIfElementTreePassesCSSSelectorAllowList(targetElementList, autocaptureConfig)) {\n return false\n }\n\n const compStyles = window.getComputedStyle(el)\n if (compStyles && compStyles.getPropertyValue('cursor') === 'pointer' && event.type === 'click') {\n return true\n }\n\n const tag = el.tagName.toLowerCase()\n switch (tag) {\n case 'html':\n return false\n case 'form':\n return (allowedEventTypes || ['submit']).indexOf(event.type) >= 0\n case 'input':\n case 'select':\n case 'textarea':\n return (allowedEventTypes || ['change', 'click']).indexOf(event.type) >= 0\n default:\n if (parentIsUsefulElement) return (allowedEventTypes || ['click']).indexOf(event.type) >= 0\n return (\n (allowedEventTypes || ['click']).indexOf(event.type) >= 0 &&\n (autocaptureCompatibleElements.indexOf(tag) > -1 || el.getAttribute('contenteditable') === 'true')\n )\n }\n}\n\n/*\n * Check whether a DOM element should be \"captured\" or if it may contain sentitive data\n * using a variety of heuristics.\n * @param {Element} el - element to check\n * @returns {boolean} whether the element should be captured\n */\nexport function shouldCaptureElement(el: Element): boolean {\n for (let curEl = el; curEl.parentNode && !isTag(curEl, 'body'); curEl = curEl.parentNode as Element) {\n const classes = getClassNames(curEl)\n if (includes(classes, 'ph-sensitive') || includes(classes, 'ph-no-capture')) {\n return false\n }\n }\n\n if (includes(getClassNames(el), 'ph-include')) {\n return true\n }\n\n // don't include hidden or password fields\n const type = (el as HTMLInputElement).type || ''\n if (isString(type)) {\n // it's possible for el.type to be a DOM element if el is a form with a child input[name=\"type\"]\n switch (type.toLowerCase()) {\n case 'hidden':\n return false\n case 'password':\n return false\n }\n }\n\n // filter out data from fields that look like sensitive fields\n const name = (el as HTMLInputElement).name || el.id || ''\n // See https://github.com/posthog/posthog-js/issues/165\n // Under specific circumstances a bug caused .replace to be called on a DOM element\n // instead of a string, removing the element from the page. Ensure this issue is mitigated.\n if (isString(name)) {\n // it's possible for el.name or el.id to be a DOM element if el is a form with a child input[name=\"name\"]\n const sensitiveNameRegex =\n /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i\n if (sensitiveNameRegex.test(name.replace(/[^a-zA-Z0-9]/g, ''))) {\n return false\n }\n }\n\n return true\n}\n\n/*\n * Check whether a DOM element is 'sensitive' and we should only capture limited data\n * @param {Element} el - element to check\n * @returns {boolean} whether the element should be captured\n */\nexport function isSensitiveElement(el: Element): boolean {\n // don't send data from inputs or similar elements since there will always be\n // a risk of clientside javascript placing sensitive data in attributes\n const allowedInputTypes = ['button', 'checkbox', 'submit', 'reset']\n if (\n (isTag(el, 'input') && !allowedInputTypes.includes((el as HTMLInputElement).type)) ||\n isTag(el, 'select') ||\n isTag(el, 'textarea') ||\n el.getAttribute('contenteditable') === 'true'\n ) {\n return true\n }\n return false\n}\n\n// Define the core pattern for matching credit card numbers\nconst coreCCPattern = `(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})`\n// Create the Anchored version of the regex by adding '^' at the start and '$' at the end\nconst anchoredCCRegex = new RegExp(`^(?:${coreCCPattern})$`)\n// The Unanchored version is essentially the core pattern, usable as is for partial matches\nconst unanchoredCCRegex = new RegExp(coreCCPattern)\n\n// Define the core pattern for matching SSNs with optional dashes\nconst coreSSNPattern = `\\\\d{3}-?\\\\d{2}-?\\\\d{4}`\n// Create the Anchored version of the regex by adding '^' at the start and '$' at the end\nconst anchoredSSNRegex = new RegExp(`^(${coreSSNPattern})$`)\n// The Unanchored version is essentially the core pattern itself, usable for partial matches\nconst unanchoredSSNRegex = new RegExp(`(${coreSSNPattern})`)\n\n/*\n * Check whether a string value should be \"captured\" or if it may contain sensitive data\n * using a variety of heuristics.\n * @param {string} value - string value to check\n * @param {boolean} anchorRegexes - whether to anchor the regexes to the start and end of the string\n * @returns {boolean} whether the element should be captured\n */\nexport function shouldCaptureValue(value: string, anchorRegexes = true): boolean {\n if (isNullish(value)) {\n return false\n }\n\n if (isString(value)) {\n value = trim(value)\n\n // check to see if input value looks like a credit card number\n // see: https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9781449327453/ch04s20.html\n const ccRegex = anchorRegexes ? anchoredCCRegex : unanchoredCCRegex\n if (ccRegex.test((value || '').replace(/[- ]/g, ''))) {\n return false\n }\n\n // check to see if input value looks like a social security number\n const ssnRegex = anchorRegexes ? anchoredSSNRegex : unanchoredSSNRegex\n if (ssnRegex.test(value)) {\n return false\n }\n }\n\n return true\n}\n\n/*\n * Check whether an attribute name is an Angular style attr (either _ngcontent or _nghost)\n * These update on each build and lead to noise in the element chain\n * More details on the attributes here: https://angular.io/guide/view-encapsulation\n * @param {string} attributeName - string value to check\n * @returns {boolean} whether the element is an angular tag\n */\nexport function isAngularStyleAttr(attributeName: string): boolean {\n if (isString(attributeName)) {\n return attributeName.substring(0, 10) === '_ngcontent' || attributeName.substring(0, 7) === '_nghost'\n }\n return false\n}\n\n/*\n * Iterate through children of a target element looking for span tags\n * and return the text content of the span tags, separated by spaces,\n * along with the direct text content of the target element\n * @param {Element} target - element to check\n * @returns {string} text content of the target element and its child span tags\n */\nexport function getDirectAndNestedSpanText(target: Element): string {\n let text = getSafeText(target)\n text = `${text} ${getNestedSpanText(target)}`.trim()\n return shouldCaptureValue(text) ? text : ''\n}\n\n/*\n * Iterate through children of a target element looking for span tags\n * and return the text content of the span tags, separated by spaces\n * @param {Element} target - element to check\n * @returns {string} text content of span tags\n */\nexport function getNestedSpanText(target: Element): string {\n let text = ''\n if (target && target.childNodes && target.childNodes.length) {\n each(target.childNodes, function (child) {\n if (child && child.tagName?.toLowerCase() === 'span') {\n try {\n const spanText = getSafeText(child)\n text = `${text} ${spanText}`.trim()\n\n if (child.childNodes && child.childNodes.length) {\n text = `${text} ${getNestedSpanText(child)}`.trim()\n }\n } catch (e) {\n logger.error('[AutoCapture]', e)\n }\n }\n })\n }\n return text\n}\n\n/*\nBack in the day storing events in Postgres we use Elements for autocapture events.\nNow we're using elements_chain. We used to do this parsing/processing during ingestion.\nThis code is just copied over from ingestion, but we should optimize it\nto create elements_chain string directly.\n*/\nexport function getElementsChainString(elements: Properties[]): string {\n return elementsToString(extractElements(elements))\n}\n\n// This interface is called 'Element' in plugin-scaffold https://github.com/PostHog/plugin-scaffold/blob/b07d3b879796ecc7e22deb71bf627694ba05386b/src/types.ts#L200\n// However 'Element' is a DOM Element when run in the browser, so we have to rename it\ninterface PHElement {\n text?: string\n tag_name?: string\n href?: string\n attr_id?: string\n attr_class?: string[]\n nth_child?: number\n nth_of_type?: number\n attributes?: Record<string, any>\n event_id?: number\n order?: number\n group_id?: number\n}\n\nfunction escapeQuotes(input: string): string {\n return input.replace(/\"|\\\\\"/g, '\\\\\"')\n}\n\nfunction elementsToString(elements: PHElement[]): string {\n const ret = elements.map((element) => {\n let el_string = ''\n if (element.tag_name) {\n el_string += element.tag_name\n }\n if (element.attr_class) {\n element.attr_class.sort()\n for (const single_class of element.attr_class) {\n el_string += `.${single_class.replace(/\"/g, '')}`\n }\n }\n const attributes: Record<string, any> = {\n ...(element.text ? { text: element.text } : {}),\n 'nth-child': element.nth_child ?? 0,\n 'nth-of-type': element.nth_of_type ?? 0,\n ...(element.href ? { href: element.href } : {}),\n ...(element.attr_id ? { attr_id: element.attr_id } : {}),\n ...element.attributes,\n }\n const sortedAttributes: Record<string, any> = {}\n entries(attributes)\n .sort(([a], [b]) => a.localeCompare(b))\n .forEach(\n ([key, value]) => (sortedAttributes[escapeQuotes(key.toString())] = escapeQuotes(value.toString()))\n )\n el_string += ':'\n el_string += entries(attributes)\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join('')\n return el_string\n })\n return ret.join(';')\n}\n\nfunction extractElements(elements: Properties[]): PHElement[] {\n return elements.map((el) => {\n const response = {\n text: el['$el_text']?.slice(0, 400),\n tag_name: el['tag_name'],\n href: el['attr__href']?.slice(0, 2048),\n attr_class: extractAttrClass(el),\n attr_id: el['attr__id'],\n nth_child: el['nth_child'],\n nth_of_type: el['nth_of_type'],\n attributes: {} as { [id: string]: any },\n }\n\n entries(el)\n .filter(([key]) => key.indexOf('attr__') === 0)\n .forEach(([key, value]) => (response.attributes[key] = value))\n return response\n })\n}\n\nfunction extractAttrClass(el: Properties): PHElement['attr_class'] {\n const attr_class = el['attr__class']\n if (!attr_class) {\n return undefined\n } else if (isArray(attr_class)) {\n return attr_class\n } else {\n return splitClassString(attr_class)\n }\n}\n","import { CapturedNetworkRequest, NetworkRecordOptions, PostHogConfig } from '../../types'\nimport { isFunction, isNullish, isString, isUndefined } from '../../utils/type-utils'\nimport { convertToURL } from '../../utils/request-utils'\nimport { logger } from '../../utils/logger'\nimport { shouldCaptureValue } from '../../autocapture-utils'\nimport { each } from '../../utils'\n\nconst LOGGER_PREFIX = '[SessionRecording]'\n\nconst REDACTED = 'redacted'\n\nexport const defaultNetworkOptions: Required<NetworkRecordOptions> = {\n initiatorTypes: [\n 'audio',\n 'beacon',\n 'body',\n 'css',\n 'early-hint',\n 'embed',\n 'fetch',\n 'frame',\n 'iframe',\n 'icon',\n 'image',\n 'img',\n 'input',\n 'link',\n 'navigation',\n 'object',\n 'ping',\n 'script',\n 'track',\n 'video',\n 'xmlhttprequest',\n ],\n maskRequestFn: (data: CapturedNetworkRequest) => data,\n recordHeaders: false,\n recordBody: false,\n recordInitialRequests: false,\n recordPerformance: false,\n performanceEntryTypeToObserve: [\n // 'event', // This is too noisy as it covers all browser events\n 'first-input',\n // 'mark', // Mark is used too liberally. We would need to filter for specific marks\n // 'measure', // Measure is used too liberally. We would need to filter for specific measures\n 'navigation',\n 'paint',\n 'resource',\n ],\n payloadSizeLimitBytes: 1000000,\n payloadHostDenyList: [\n '.lr-ingest.io',\n '.ingest.sentry.io',\n '.clarity.ms',\n // NB no leading dot here\n 'analytics.google.com',\n ],\n}\n\nconst HEADER_DENY_LIST = [\n 'authorization',\n 'x-forwarded-for',\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-real-ip',\n 'remote-addr',\n 'forwarded',\n 'proxy-authorization',\n 'x-csrf-token',\n 'x-csrftoken',\n 'x-xsrf-token',\n]\n\nconst PAYLOAD_CONTENT_DENY_LIST = [\n 'password',\n 'secret',\n 'passwd',\n 'api_key',\n 'apikey',\n 'auth',\n 'credentials',\n 'mysql_pwd',\n 'privatekey',\n 'private_key',\n 'token',\n]\n\n// we always remove headers on the deny list because we never want to capture this sensitive data\nconst removeAuthorizationHeader = (data: CapturedNetworkRequest): CapturedNetworkRequest => {\n const headers = data.requestHeaders\n if (!isNullish(headers)) {\n each(Object.keys(headers ?? {}), (header) => {\n if (HEADER_DENY_LIST.includes(header.toLowerCase())) {\n headers[header] = REDACTED\n }\n })\n }\n return data\n}\n\nconst POSTHOG_PATHS_TO_IGNORE = ['/s/', '/e/', '/i/']\n// want to ignore posthog paths when capturing requests, or we can get trapped in a loop\n// because calls to PostHog would be reported using a call to PostHog which would be reported....\nconst ignorePostHogPaths = (\n data: CapturedNetworkRequest,\n apiHostConfig: PostHogConfig['api_host']\n): CapturedNetworkRequest | undefined => {\n const url = convertToURL(data.name)\n\n // we need to account for api host config as e.g. pathname could be /ingest/s/ and we want to ignore that\n let replaceValue = apiHostConfig.indexOf('http') === 0 ? convertToURL(apiHostConfig)?.pathname : apiHostConfig\n if (replaceValue === '/') {\n replaceValue = ''\n }\n const pathname = url?.pathname.replace(replaceValue || '', '')\n\n if (url && pathname && POSTHOG_PATHS_TO_IGNORE.some((path) => pathname.indexOf(path) === 0)) {\n return undefined\n }\n return data\n}\n\nfunction estimateBytes(payload: string): number {\n return new Blob([payload]).size\n}\n\nfunction enforcePayloadSizeLimit(\n payload: string | null | undefined,\n headers: Record<string, any> | undefined,\n limit: number,\n description: string\n): string | null | undefined {\n if (isNullish(payload)) {\n return payload\n }\n\n let requestContentLength: string | number = headers?.['content-length'] || estimateBytes(payload)\n if (isString(requestContentLength)) {\n requestContentLength = parseInt(requestContentLength)\n }\n\n if (requestContentLength > limit) {\n return LOGGER_PREFIX + ` ${description} body too large to record (${requestContentLength} bytes)`\n }\n\n return payload\n}\n\n// people can have arbitrarily large payloads on their site, but we don't want to ingest them\nconst limitPayloadSize = (\n options: NetworkRecordOptions\n): ((data: CapturedNetworkRequest | undefined) => CapturedNetworkRequest | undefined) => {\n // the smallest of 1MB or the specified limit if there is one\n const limit = Math.min(1000000, options.payloadSizeLimitBytes ?? 1000000)\n\n return (data) => {\n if (data?.requestBody) {\n data.requestBody = enforcePayloadSizeLimit(data.requestBody, data.requestHeaders, limit, 'Request')\n }\n\n if (data?.responseBody) {\n data.responseBody = enforcePayloadSizeLimit(data.responseBody, data.responseHeaders, limit, 'Response')\n }\n\n return data\n }\n}\n\nfunction scrubPayload(payload: string | null | undefined, label: 'Request' | 'Response'): string | null | undefined {\n if (isNullish(payload)) {\n return payload\n }\n let scrubbed = payload\n\n if (!shouldCaptureValue(scrubbed, false)) {\n scrubbed = LOGGER_PREFIX + ' ' + label + ' body ' + REDACTED\n }\n each(PAYLOAD_CONTENT_DENY_LIST, (text) => {\n if (scrubbed?.length && scrubbed?.indexOf(text) !== -1) {\n scrubbed = LOGGER_PREFIX + ' ' + label + ' body ' + REDACTED + ' as might contain: ' + text\n }\n })\n\n return scrubbed\n}\n\nfunction scrubPayloads(capturedRequest: CapturedNetworkRequest | undefined): CapturedNetworkRequest | undefined {\n if (isUndefined(capturedRequest)) {\n return undefined\n }\n\n capturedRequest.requestBody = scrubPayload(capturedRequest.requestBody, 'Request')\n capturedRequest.responseBody = scrubPayload(capturedRequest.responseBody, 'Response')\n\n return capturedRequest\n}\n\n/**\n * whether a maskRequestFn is provided or not,\n * we ensure that we remove the denied header from requests\n * we _never_ want to record that header by accident\n * if someone complains then we'll add an opt-in to let them override it\n */\nexport const buildNetworkRequestOptions = (\n instanceConfig: PostHogConfig,\n remoteNetworkOptions: Pick<\n NetworkRecordOptions,\n 'recordHeaders' | 'recordBody' | 'recordPerformance' | 'payloadHostDenyList'\n >\n): NetworkRecordOptions => {\n const config: NetworkRecordOptions = {\n payloadSizeLimitBytes: defaultNetworkOptions.payloadSizeLimitBytes,\n performanceEntryTypeToObserve: [...defaultNetworkOptions.performanceEntryTypeToObserve],\n payloadHostDenyList: [\n ...(remoteNetworkOptions.payloadHostDenyList || []),\n ...defaultNetworkOptions.payloadHostDenyList,\n ],\n }\n // client can always disable despite remote options\n const canRecordHeaders =\n instanceConfig.session_recording.recordHeaders === false ? false : remoteNetworkOptions.recordHeaders\n const canRecordBody =\n instanceConfig.session_recording.recordBody === false ? false : remoteNetworkOptions.recordBody\n const canRecordPerformance =\n instanceConfig.capture_performance === false ? false : remoteNetworkOptions.recordPerformance\n\n const payloadLimiter = limitPayloadSize(config)\n\n const enforcedCleaningFn: NetworkRecordOptions['maskRequestFn'] = (d: CapturedNetworkRequest) =>\n payloadLimiter(ignorePostHogPaths(removeAuthorizationHeader(d), instanceConfig.api_host))\n\n const hasDeprecatedMaskFunction = isFunction(instanceConfig.session_recording.maskNetworkRequestFn)\n\n if (hasDeprecatedMaskFunction && isFunction(instanceConfig.session_recording.maskCapturedNetworkRequestFn)) {\n logger.warn(\n 'Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored.'\n )\n }\n\n if (hasDeprecatedMaskFunction) {\n instanceConfig.session_recording.maskCapturedNetworkRequestFn = (data: CapturedNetworkRequest) => {\n const cleanedURL = instanceConfig.session_recording.maskNetworkRequestFn!({ url: data.name })\n return {\n ...data,\n name: cleanedURL?.url,\n } as CapturedNetworkRequest\n }\n }\n\n config.maskRequestFn = isFunction(instanceConfig.session_recording.maskCapturedNetworkRequestFn)\n ? (data) => {\n const cleanedRequest = enforcedCleaningFn(data)\n return cleanedRequest\n ? (instanceConfig.session_recording.maskCapturedNetworkRequestFn?.(cleanedRequest) ?? undefined)\n : undefined\n }\n : (data) => scrubPayloads(enforcedCleaningFn(data))\n\n return {\n ...defaultNetworkOptions,\n ...config,\n recordHeaders: canRecordHeaders,\n recordBody: canRecordBody,\n recordPerformance: canRecordPerformance,\n recordInitialRequests: canRecordPerformance,\n }\n}\n","/// <reference lib=\"dom\" />\n\n// rrweb/network@1 code starts\n// most of what is below here will be removed when rrweb release their code for this\n// see https://github.com/rrweb-io/rrweb/pull/1105\n\n// NB adopted from https://github.com/rrweb-io/rrweb/pull/1105 which looks like it will be accepted into rrweb\n// however, in the PR, it throws when the performance observer data is not available\n// and assumes it is running in a browser with the Request API (i.e. not IE11)\n// copying here so that we can use it before rrweb adopt it\nimport type { IWindow, listenerHandler, RecordPlugin } from '@rrweb/types'\nimport { CapturedNetworkRequest, Headers, InitiatorType, NetworkRecordOptions } from '../../../types'\nimport {\n isArray,\n isBoolean,\n isDocument,\n isFormData,\n isNull,\n isNullish,\n isObject,\n isString,\n isUndefined,\n} from '../../../utils/type-utils'\nimport { createLogger } from '../../../utils/logger'\nimport { formDataToQuery } from '../../../utils/request-utils'\nimport { patch } from '../rrweb-plugins/patch'\nimport { isHostOnDenyList } from '../../../extensions/replay/external/denylist'\nimport { defaultNetworkOptions } from '../config'\n\nconst logger = createLogger('[Recorder]')\n\nexport type NetworkData = {\n requests: CapturedNetworkRequest[]\n isInitial?: boolean\n}\n\ntype networkCallback = (data: NetworkData) => void\n\nconst isNavigationTiming = (entry: PerformanceEntry): entry is PerformanceNavigationTiming =>\n entry.entryType === 'navigation'\nconst isResourceTiming = (entry: PerformanceEntry): entry is PerformanceResourceTiming => entry.entryType === 'resource'\n\ntype ObservedPerformanceEntry = (PerformanceNavigationTiming | PerformanceResourceTiming) & {\n responseStatus?: number\n}\n\nexport function findLast<T>(array: Array<T>, predicate: (value: T) => boolean): T | undefined {\n const length = array.length\n for (let i = length - 1; i >= 0; i -= 1) {\n if (predicate(array[i])) {\n return array[i]\n }\n }\n return undefined\n}\n\nfunction initPerformanceObserver(cb: networkCallback, win: IWindow, options: Required<NetworkRecordOptions>) {\n // if we are only observing timings then we could have a single observer for all types, with buffer true,\n // but we are going to filter by initiatorType _if we are wrapping fetch and xhr as the wrapped functions\n // will deal with those.\n // so we have a block which captures requests from before fetch/xhr is wrapped\n // these are marked `isInitial` so playback can display them differently if needed\n // they will never have method/status/headers/body because they are pre-wrapping that provides that\n if (options.recordInitialRequests) {\n const initialPerformanceEntries = win.performance\n .getEntries()\n .filter(\n (entry): entry is ObservedPerformanceEntry =>\n isNavigationTiming(entry) ||\n (isResourceTiming(entry) && options.initiatorTypes.includes(entry.initiatorType as InitiatorType))\n )\n cb({\n requests: initialPerformanceEntries.flatMap((entry) =>\n prepareRequest({ entry, method: undefined, status: undefined, networkRequest: {}, isInitial: true })\n ),\n isInitial: true,\n })\n }\n const observer = new win.PerformanceObserver((entries) => {\n // if recordBody or recordHeaders is true then we don't want to record fetch or xhr here\n // as the wrapped functions will do that. Otherwise, this filter becomes a noop\n // because we do want to record them here\n const wrappedInitiatorFilter = (entry: ObservedPerformanceEntry) =>\n options.recordBody || options.recordHeaders\n ? entry.initiatorType !== 'xmlhttprequest' && entry.initiatorType !== 'fetch'\n : true\n\n const performanceEntries = entries.getEntries().filter(\n (entry): entry is ObservedPerformanceEntry =>\n isNavigationTiming(entry) ||\n (isResourceTiming(entry) &&\n options.initiatorTypes.includes(entry.initiatorType as InitiatorType) &&\n // TODO if we are _only_ capturing timing we don't want to filter initiator here\n wrappedInitiatorFilter(entry))\n )\n\n cb({\n requests: performanceEntries.flatMap((entry) =>\n prepareRequest({ entry, method: undefined, status: undefined, networkRequest: {} })\n ),\n })\n })\n // compat checked earlier\n // eslint-disable-next-line compat/compat\n const entryTypes = PerformanceObserver.supportedEntryTypes.filter((x) =>\n options.performanceEntryTypeToObserve.includes(x)\n )\n // initial records are gathered above, so we don't need to observe and buffer each type separately\n observer.observe({ entryTypes })\n return () => {\n observer.disconnect()\n }\n}\n\nfunction shouldRecordHeaders(type: 'request' | 'response', recordHeaders: NetworkRecordOptions['recordHeaders']) {\n return !!recordHeaders && (isBoolean(recordHeaders) || recordHeaders[type])\n}\n\nexport function shouldRecordBody({\n type,\n recordBody,\n headers,\n url,\n}: {\n type: 'request' | 'response'\n headers: Headers\n url: string | URL | RequestInfo\n recordBody: NetworkRecordOptions['recordBody']\n}) {\n function matchesContentType(contentTypes: string[]) {\n const contentTypeHeader = Object.keys(headers).find((key) => key.toLowerCase() === 'content-type')\n const contentType = contentTypeHeader && headers[contentTypeHeader]\n return contentTypes.some((ct) => contentType?.includes(ct))\n }\n\n /**\n * particularly in canvas applications we see many requests to blob URLs\n * e.g. blob:https://video_url\n * these blob/object URLs are local to the browser, we can never capture that body\n * so we can just return false here\n */\n function isBlobURL(url: string | URL | RequestInfo) {\n try {\n if (typeof url === 'string') {\n return url.startsWith('blob:')\n }\n if (url instanceof URL) {\n return url.protocol === 'blob:'\n }\n if (url instanceof Request) {\n return isBlobURL(url.url)\n }\n return false\n } catch {\n return false\n }\n }\n if (!recordBody) return false\n if (isBlobURL(url)) return false\n if (isBoolean(recordBody)) return true\n if (isArray(recordBody)) return matchesContentType(recordBody)\n const recordBodyType = recordBody[type]\n if (isBoolean(recordBodyType)) return recordBodyType\n return matchesContentType(recordBodyType)\n}\n\nasync function getRequestPerformanceEntry(\n win: IWindow,\n initiatorType: string,\n url: string,\n start?: number,\n end?: number,\n attempt = 0\n): Promise<PerformanceResourceTiming | null> {\n if (attempt > 10) {\n logger.warn('Failed to get performance entry for request', { url, initiatorType })\n return null\n }\n const urlPerformanceEntries = win.performance.getEntriesByName(url) as PerformanceResourceTiming[]\n const performanceEntry = findLast(\n urlPerformanceEntries,\n (entry) =>\n isResourceTiming(entry) &&\n entry.initiatorType === initiatorType &&\n (isUndefined(start) || entry.startTime >= start) &&\n (isUndefined(end) || entry.startTime <= end)\n )\n if (!performanceEntry) {\n await new Promise((resolve) => setTimeout(resolve, 50 * attempt))\n return getRequestPerformanceEntry(win, initiatorType, url, start, end, attempt + 1)\n }\n return performanceEntry\n}\n\n/**\n * According to MDN https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/response\n * xhr response is typed as any but can be an ArrayBuffer, a Blob, a Document, a JavaScript object,\n * or a string, depending on the value of XMLHttpRequest.responseType, that contains the response entity body.\n *\n * XHR request body is Document | XMLHttpRequestBodyInit | null | undefined\n */\nfunction _tryReadXHRBody({\n body,\n options,\n url,\n}: {\n body: Document | XMLHttpRequestBodyInit | any | null | undefined\n options: NetworkRecordOptions\n url: string | URL | RequestInfo\n}): string | null {\n if (isNullish(body)) {\n return null\n }\n\n const { hostname, isHostDenied } = isHostOnDenyList(url, options)\n if (isHostDenied) {\n return hostname + ' is in deny list'\n }\n\n if (isString(body)) {\n return body\n }\n\n if (isDocument(body)) {\n return body.textContent\n }\n\n if (isFormData(body)) {\n return formDataToQuery(body)\n }\n\n if (isObject(body)) {\n try {\n return JSON.stringify(body)\n } catch {\n return '[SessionReplay] Failed to stringify response object'\n }\n }\n\n return '[SessionReplay] Cannot read body of type ' + toString.call(body)\n}\n\nfunction initXhrObserver(cb: networkCallback, win: IWindow, options: Required<NetworkRecordOptions>): listenerHandler {\n if (!options.initiatorTypes.includes('xmlhttprequest')) {\n return () => {\n //\n }\n }\n const recordRequestHeaders = shouldRecordHeaders('request', options.recordHeaders)\n const recordResponseHeaders = shouldRecordHeaders('response', options.recordHeaders)\n\n const restorePatch = patch(\n win.XMLHttpRequest.prototype,\n 'open',\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (originalOpen: typeof XMLHttpRequest.prototype.open) => {\n return function (\n method: string,\n url: string | URL,\n async = true,\n username?: string | null,\n password?: string | null\n ) {\n // because this function is returned in its actual context `this` _is_ an XMLHttpRequest\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const xhr = this as XMLHttpRequest\n\n // check IE earlier than this, we only initialize if Request is present\n // eslint-disable-next-line compat/compat\n const req = new Request(url)\n const networkRequest: Partial<CapturedNetworkRequest> = {}\n let start: number | undefined\n let end: number | undefined\n\n const requestHeaders: Headers = {}\n const originalSetRequestHeader = xhr.setRequestHeader.bind(xhr)\n xhr.setRequestHeader = (header: string, value: string) => {\n requestHeaders[header] = value\n return originalSetRequestHeader(header, value)\n }\n if (recordRequestHeaders) {\n networkRequest.requestHeaders = requestHeaders\n }\n\n const originalSend = xhr.send.bind(xhr)\n xhr.send = (body) => {\n if (\n shouldRecordBody({\n type: 'request',\n headers: requestHeaders,\n url,\n recordBody: options.recordBody,\n })\n ) {\n networkRequest.requestBody = _tryReadXHRBody({ body, options, url })\n }\n start = win.performance.now()\n return originalSend(body)\n }\n\n // This is very tricky code, and making it passive won't bring many performance benefits,\n // so let's ignore the rule here.\n // eslint-disable-next-line posthog-js/no-add-event-listener\n xhr.addEventListener('readystatechange', () => {\n if (xhr.readyState !== xhr.DONE) {\n return\n }\n end = win.performance.now()\n const responseHeaders: Headers = {}\n const rawHeaders = xhr.getAllResponseHeaders()\n const headers = rawHeaders.trim().split(/[\\r\\n]+/)\n headers.forEach((line) => {\n const parts = line.split(': ')\n const header = parts.shift()\n const value = parts.join(': ')\n if (header) {\n responseHeaders[header] = value\n }\n })\n if (recordResponseHeaders) {\n networkRequest.responseHeaders = responseHeaders\n }\n if (\n shouldRecordBody({\n type: 'response',\n headers: responseHeaders,\n url,\n recordBody: options.recordBody,\n })\n ) {\n networkRequest.responseBody = _tryReadXHRBody({ body: xhr.response, options, url })\n }\n getRequestPerformanceEntry(win, 'xmlhttprequest', req.url, start, end)\n .then((entry) => {\n const requests = prepareRequest({\n entry,\n method: method,\n status: xhr?.status,\n networkRequest,\n start,\n end,\n url: url.toString(),\n initiatorType: 'xmlhttprequest',\n })\n cb({ requests })\n })\n .catch(() => {\n //\n })\n })\n\n originalOpen.call(xhr, method, url, async, username, password)\n }\n }\n )\n return () => {\n restorePatch()\n }\n}\n\n/**\n * Check if this PerformanceEntry is either a PerformanceResourceTiming or a PerformanceNavigationTiming\n * NB PerformanceNavigationTiming extends PerformanceResourceTiming\n * Here we don't care which interface it implements as both expose `serverTimings`\n */\nconst exposesServerTiming = (event: PerformanceEntry | null): event is PerformanceResourceTiming =>\n !isNull(event) && (event.entryType === 'navigation' || event.entryType === 'resource')\n\nfunction prepareRequest({\n entry,\n method,\n status,\n networkRequest,\n isInitial,\n start,\n end,\n url,\n initiatorType,\n}: {\n entry: PerformanceResourceTiming | null\n method: string | undefined\n status: number | undefined\n networkRequest: Partial<CapturedNetworkRequest>\n isInitial?: boolean\n start?: number\n end?: number\n // if there is no performance observer entry, we still need to know the url\n url?: string\n // if there is no performance observer entry, we can provide the initiatorType\n initiatorType?: string\n}): CapturedNetworkRequest[] {\n start = entry ? entry.startTime : start\n end = entry ? entry.responseEnd : end\n\n // kudos to sentry javascript sdk for excellent background on why to use Date.now() here\n // https://github.com/getsentry/sentry-javascript/blob/e856e40b6e71a73252e788cd42b5260f81c9c88e/packages/utils/src/time.ts#L70\n // can't start observer if performance.now() is not available\n // eslint-disable-next-line compat/compat\n const timeOrigin = Math.floor(Date.now() - performance.now())\n // clickhouse can't ingest timestamps that are floats\n // (in this case representing fractions of a millisecond we don't care about anyway)\n // use timeOrigin if we really can't gather a start time\n const timestamp = Math.floor(timeOrigin + (start || 0))\n\n const entryJSON = entry ? entry.toJSON() : { name: url }\n\n const requests: CapturedNetworkRequest[] = [\n {\n ...entryJSON,\n startTime: isUndefined(start) ? undefined : Math.round(start),\n endTime: isUndefined(end) ? undefined : Math.round(end),\n timeOrigin,\n timestamp,\n method: method,\n initiatorType: initiatorType ? initiatorType : entry ? (entry.initiatorType as InitiatorType) : undefined,\n status,\n requestHeaders: networkRequest.requestHeaders,\n requestBody: networkRequest.requestBody,\n responseHeaders: networkRequest.responseHeaders,\n responseBody: networkRequest.responseBody,\n isInitial,\n },\n ]\n\n if (exposesServerTiming(entry)) {\n for (const timing of entry.serverTiming || []) {\n requests.push({\n timeOrigin,\n timestamp,\n startTime: Math.round(entry.startTime),\n name: timing.name,\n duration: timing.duration,\n // the spec has a closed list of possible types\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType\n // but, we need to know this was a server timing so that we know to\n // match it to the appropriate navigation or resource timing\n // that matching will have to be on timestamp and $current_url\n entryType: 'serverTiming',\n })\n }\n }\n\n return requests\n}\n\nconst contentTypePrefixDenyList = ['video/', 'audio/']\n\nfunction _checkForCannotReadResponseBody({\n r,\n options,\n url,\n}: {\n r: Response\n options: NetworkRecordOptions\n url: string | URL | RequestInfo\n}): string | null {\n if (r.headers.get('Transfer-Encoding') === 'chunked') {\n return 'Chunked Transfer-Encoding is not supported'\n }\n\n // `get` and `has` are case-insensitive\n // but return the header value with the casing that was supplied\n const contentType = r.headers.get('Content-Type')?.toLowerCase()\n const contentTypeIsDenied = contentTypePrefixDenyList.some((prefix) => contentType?.startsWith(prefix))\n if (contentType && contentTypeIsDenied) {\n return `Content-Type ${contentType} is not supported`\n }\n\n const { hostname, isHostDenied } = isHostOnDenyList(url, options)\n if (isHostDenied) {\n return hostname + ' is in deny list'\n }\n\n return null\n}\n\nfunction _tryReadBody(r: Request | Response): Promise<string> {\n // there are now already multiple places where we're using Promise...\n // eslint-disable-next-line compat/compat\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => resolve('[SessionReplay] Timeout while trying to read body'), 500)\n try {\n r.clone()\n .text()\n .then(\n (txt) => resolve(txt),\n (reason) => reject(reason)\n )\n .finally(() => clearTimeout(timeout))\n } catch {\n clearTimeout(timeout)\n resolve('[SessionReplay] Failed to read body')\n }\n })\n}\n\nasync function _tryReadRequestBody({\n r,\n options,\n url,\n}: {\n r: Request\n options: NetworkRecordOptions\n url: string | URL | RequestInfo\n}): Promise<string> {\n const { hostname, isHostDenied } = isHostOnDenyList(url, options)\n if (isHostDenied) {\n return Promise.resolve(hostname + ' is in deny list')\n }\n\n return _tryReadBody(r)\n}\n\nasync function _tryReadResponseBody({\n r,\n options,\n url,\n}: {\n r: Response\n options: NetworkRecordOptions\n url: string | URL | RequestInfo\n}): Promise<string> {\n const cannotReadBodyReason: string | null = _checkForCannotReadResponseBody({ r, options, url })\n if (!isNull(cannotReadBodyReason)) {\n return Promise.resolve(cannotReadBodyReason)\n }\n\n return _tryReadBody(r)\n}\n\nfunction initFetchObserver(\n cb: networkCallback,\n win: IWindow,\n options: Required<NetworkRecordOptions>\n): listenerHandler {\n if (!options.initiatorTypes.includes('fetch')) {\n return () => {\n //\n }\n }\n const recordRequestHeaders = shouldRecordHeaders('request', options.recordHeaders)\n const recordResponseHeaders = shouldRecordHeaders('response', options.recordHeaders)\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const restorePatch = patch(win, 'fetch', (originalFetch: typeof fetch) => {\n return async function (url: URL | RequestInfo, init?: RequestInit | undefined) {\n // check IE earlier than this, we only initialize if Request is present\n // eslint-disable-next-line compat/compat\n const req = new Request(url, init)\n let res: Response | undefined\n const networkRequest: Partial<CapturedNetworkRequest> = {}\n let start: number | undefined\n let end: number | undefined\n\n try {\n const requestHeaders: Headers = {}\n req.headers.forEach((value, header) => {\n requestHeaders[header] = value\n })\n if (recordRequestHeaders) {\n networkRequest.requestHeaders = requestHeaders\n }\n if (\n shouldRecordBody({\n type: 'request',\n headers: requestHeaders,\n url,\n recordBody: options.recordBody,\n })\n ) {\n networkRequest.requestBody = await _tryReadRequestBody({ r: req, options, url })\n }\n\n start = win.performance.now()\n res = await originalFetch(req)\n end = win.performance.now()\n\n const responseHeaders: Headers = {}\n res.headers.forEach((value, header) => {\n responseHeaders[header] = value\n })\n if (recordResponseHeaders) {\n networkRequest.responseHeaders = responseHeaders\n }\n if (\n shouldRecordBody({\n type: 'response',\n headers: responseHeaders,\n url,\n recordBody: options.recordBody,\n })\n ) {\n networkRequest.responseBody = await _tryReadResponseBody({ r: res, options, url })\n }\n\n return res\n } finally {\n getRequestPerformanceEntry(win, 'fetch', req.url, start, end)\n .then((entry) => {\n const requests = prepareRequest({\n entry,\n method: req.method,\n status: res?.status,\n networkRequest,\n start,\n end,\n url: req.url,\n initiatorType: 'fetch',\n })\n cb({ requests })\n })\n .catch(() => {\n //\n })\n }\n }\n })\n return () => {\n restorePatch()\n }\n}\n\nlet initialisedHandler: listenerHandler | null = null\n\nfunction initNetworkObserver(\n callback: networkCallback,\n win: IWindow, // top window or in an iframe\n options: NetworkRecordOptions\n): listenerHandler {\n if (!('performance' in win)) {\n return () => {\n //\n }\n }\n\n if (initialisedHandler) {\n logger.warn('Network observer already initialised, doing nothing')\n return () => {\n // the first caller should already have this handler and will be responsible for teardown\n }\n }\n\n const networkOptions = (\n options ? Object.assign({}, defaultNetworkOptions, options) : defaultNetworkOptions\n ) as Required<NetworkRecordOptions>\n\n const cb: networkCallback = (data) => {\n const requests: CapturedNetworkRequest[] = []\n data.requests.forEach((request) => {\n const maskedRequest = networkOptions.maskRequestFn(request)\n if (maskedRequest) {\n requests.push(maskedRequest)\n }\n })\n\n if (requests.length > 0) {\n callback({ ...data, requests })\n }\n }\n const performanceObserver = initPerformanceObserver(cb, win, networkOptions)\n\n // only wrap fetch and xhr if headers or body are being recorded\n let xhrObserver: listenerHandler = () => {}\n let fetchObserver: listenerHandler = () => {}\n if (networkOptions.recordHeaders || networkOptions.recordBody) {\n xhrObserver = initXhrObserver(cb, win, networkOptions)\n fetchObserver = initFetchObserver(cb, win, networkOptions)\n }\n\n initialisedHandler = () => {\n performanceObserver()\n xhrObserver()\n fetchObserver()\n }\n return initialisedHandler\n}\n\n// use the plugin name so that when this functionality is adopted into rrweb\n// we can remove this plugin and use the core functionality with the same data\nexport const NETWORK_PLUGIN_NAME = 'rrweb/network@1'\n\n// TODO how should this be typed?\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nexport const getRecordNetworkPlugin: (options?: NetworkRecordOptions) => RecordPlugin = (options) => {\n return {\n name: NETWORK_PLUGIN_NAME,\n observer: initNetworkObserver,\n options: options,\n }\n}\n\n// rrweb/networ@1 ends\n","import { record as rrwebRecord } from '@rrweb/record'\nimport { getRecordConsolePlugin } from '@rrweb/rrweb-plugin-console-record'\nimport { getRecordNetworkPlugin } from '../extensions/replay/external/network-plugin'\nimport { assignableWindow } from '../utils/globals'\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.rrwebPlugins = { getRecordConsolePlugin, getRecordNetworkPlugin }\nassignableWindow.__PosthogExtensions__.rrweb = { record: rrwebRecord, version: 'v2' }\n\n// we used to put all of these items directly on window, and now we put it on __PosthogExtensions__\n// but that means that old clients which lazily load this extension are looking in the wrong place\n// yuck,\n// so we also put them directly on the window\n// when 1.161.1 is the oldest version seen in production we can remove this\nassignableWindow.rrweb = { record: rrwebRecord, version: 'v2' }\nassignableWindow.rrwebConsoleRecord = { getRecordConsolePlugin }\nassignableWindow.getRecordNetworkPlugin = getRecordNetworkPlugin\n\nexport default rrwebRecord\n","/**\n * Having Survey types in types.ts was confusing tsc\n * and generating an invalid module.d.ts\n * See https://github.com/PostHog/posthog-js/issues/698\n */\n\nexport interface SurveyAppearance {\n // keep in sync with frontend/src/types.ts -> SurveyAppearance\n backgroundColor?: string\n submitButtonColor?: string\n // text color is deprecated, use auto contrast text color instead\n textColor?: string\n // deprecate submit button text eventually\n submitButtonText?: string\n submitButtonTextColor?: string\n descriptionTextColor?: string\n ratingButtonColor?: string\n ratingButtonActiveColor?: string\n ratingButtonHoverColor?: string\n whiteLabel?: boolean\n autoDisappear?: boolean\n displayThankYouMessage?: boolean\n thankYouMessageHeader?: string\n thankYouMessageDescription?: string\n thankYouMessageDescriptionContentType?: SurveyQuestionDescriptionContentType\n thankYouMessageCloseButtonText?: string\n borderColor?: string\n position?: 'left' | 'right' | 'center'\n placeholder?: string\n shuffleQuestions?: boolean\n surveyPopupDelaySeconds?: number\n // widget options\n widgetType?: 'button' | 'tab' | 'selector'\n widgetSelector?: string\n widgetLabel?: string\n widgetColor?: string\n fontFamily?: string\n // questionable: Not in frontend/src/types.ts -> SurveyAppearance, but used in site app\n maxWidth?: string\n zIndex?: string\n disabledButtonOpacity?: string\n}\n\nexport enum SurveyType {\n Popover = 'popover',\n API = 'api',\n Widget = 'widget',\n}\n\nexport type SurveyQuestion = BasicSurveyQuestion | LinkSurveyQuestion | RatingSurveyQuestion | MultipleSurveyQuestion\n\nexport type SurveyQuestionDescriptionContentType = 'html' | 'text'\n\ninterface SurveyQuestionBase {\n question: string\n id?: string\n description?: string | null\n descriptionContentType?: SurveyQuestionDescriptionContentType\n optional?: boolean\n buttonText?: string\n branching?: NextQuestionBranching | EndBranching | ResponseBasedBranching | SpecificQuestionBranching\n}\n\nexport interface BasicSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Open\n}\n\nexport interface LinkSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Link\n link?: string | null\n}\n\nexport interface RatingSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Rating\n display: 'number' | 'emoji'\n scale: 3 | 5 | 7 | 10\n lowerBoundLabel: string\n upperBoundLabel: string\n}\n\nexport interface MultipleSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.SingleChoice | SurveyQuestionType.MultipleChoice\n choices: string[]\n hasOpenChoice?: boolean\n shuffleOptions?: boolean\n}\n\nexport enum SurveyQuestionType {\n Open = 'open',\n MultipleChoice = 'multiple_choice',\n SingleChoice = 'single_choice',\n Rating = 'rating',\n Link = 'link',\n}\n\nexport enum SurveyQuestionBranchingType {\n NextQuestion = 'next_question',\n End = 'end',\n ResponseBased = 'response_based',\n SpecificQuestion = 'specific_question',\n}\n\ninterface NextQuestionBranching {\n type: SurveyQuestionBranchingType.NextQuestion\n}\n\ninterface EndBranching {\n type: SurveyQuestionBranchingType.End\n}\n\ninterface ResponseBasedBranching {\n type: SurveyQuestionBranchingType.ResponseBased\n responseValues: Record<string, any>\n}\n\ninterface SpecificQuestionBranching {\n type: SurveyQuestionBranchingType.SpecificQuestion\n index: number\n}\n\nexport interface SurveyResponse {\n surveys: Survey[]\n}\n\nexport type SurveyCallback = (surveys: Survey[], context?: { isLoaded: boolean; error?: string }) => void\n\nexport type SurveyMatchType = 'regex' | 'not_regex' | 'exact' | 'is_not' | 'icontains' | 'not_icontains'\n\nexport interface SurveyElement {\n text?: string\n $el_text?: string\n tag_name?: string\n href?: string\n attr_id?: string\n attr_class?: string[]\n nth_child?: number\n nth_of_type?: number\n attributes?: Record<string, any>\n event_id?: number\n order?: number\n group_id?: number\n}\nexport interface SurveyRenderReason {\n visible: boolean\n disabledReason?: string\n}\n\nexport enum SurveySchedule {\n Once = 'once',\n Recurring = 'recurring',\n Always = 'always',\n}\n\nexport interface Survey {\n // Sync this with the backend's SurveyAPISerializer!\n id: string\n name: string\n description: string\n type: SurveyType\n feature_flag_keys:\n | {\n key: string\n value?: string\n }[]\n | null\n linked_flag_key: string | null\n targeting_flag_key: string | null\n internal_targeting_flag_key: string | null\n questions: SurveyQuestion[]\n appearance: SurveyAppearance | null\n conditions: {\n url?: string\n selector?: string\n seenSurveyWaitPeriodInDays?: number\n urlMatchType?: SurveyMatchType\n events: {\n repeatedActivation?: boolean\n values: {\n name: string\n }[]\n } | null\n actions: {\n values: SurveyActionType[]\n } | null\n deviceTypes?: string[]\n deviceTypesMatchType?: SurveyMatchType\n } | null\n start_date: string | null\n end_date: string | null\n current_iteration: number | null\n current_iteration_start_date: string | null\n schedule?: SurveySchedule | null\n}\n\nexport interface SurveyActionType {\n id: number\n name: string | null\n steps?: ActionStepType[]\n}\n\n/** Sync with plugin-server/src/types.ts */\nexport type ActionStepStringMatching = 'contains' | 'exact' | 'regex'\n\nexport interface ActionStepType {\n event?: string | null\n selector?: string | null\n /** @deprecated Only `selector` should be used now. */\n tag_name?: string\n text?: string | null\n /** @default StringMatching.Exact */\n text_matching?: ActionStepStringMatching | null\n href?: string | null\n /** @default ActionStepStringMatching.Exact */\n href_matching?: ActionStepStringMatching | null\n url?: string | null\n /** @default StringMatching.Contains */\n url_matching?: ActionStepStringMatching | null\n}\n","var n,l,u,t,i,o,r,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(n,l){for(var u in l)n[u]=l[u];return n}function p(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,t){var i,o,r,f={};for(r in u)\"key\"==r?i=u[r]:\"ref\"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),\"function\"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d(l,f,i,o,null)}function d(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function g(n){return n.children}function b(n,l){this.props=n,this.context=l}function m(n,l){if(null==l)return n.__?m(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return\"function\"==typeof n.type?m(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function w(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!x.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(x)}function x(){var n,u,t,o,r,e,c,s,a;for(i.sort(f);n=i.shift();)n.__d&&(u=i.length,o=void 0,e=(r=(t=n).__v).__e,s=[],a=[],(c=t.__P)&&((o=v({},r)).__v=r.__v+1,l.vnode&&l.vnode(o),L(c,o,r,t.__n,void 0!==c.ownerSVGElement,32&r.__u?[e]:null,s,null==e?m(r):e,!!(32&r.__u),a),o.__.__k[o.__i]=o,M(s,o,a),o.__e!=e&&k(o)),i.length>u&&i.sort(f));x.__r=0}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v<b;v++)null!=(y=u.__k[v])&&\"boolean\"!=typeof y&&\"function\"!=typeof y&&(p=-1===y.__i?c:g[y.__i]||c,y.__i=v,L(n,y,p,i,o,r,f,e,a,h),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&z(p.ref,null,y),h.push(y.ref,y.__c||d,y)),null==_&&null!=d&&(_=d),65536&y.__u||p.__k===y.__k?e=S(y,e,n):\"function\"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=_}function P(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)null!=(i=n.__k[t]=null==(i=l[t])||\"boolean\"==typeof i||\"function\"==typeof i?null:\"string\"==typeof i||\"number\"==typeof i||\"bigint\"==typeof i||i.constructor==String?d(null,i,null,null,i):h(i)?d(g,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?d(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r=t+a,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,\"function\"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:a=f<r&&f==r-1?f-r:0,f!==t+a&&(i.__u|=65536))):(o=u[t])&&null==o.key&&o.__e&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o,!1),u[t]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o))}function S(n,l,u){var t,i;if(\"function\"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=S(t[i],l,u));return l}return n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e),l&&l.nextSibling}function $(n,l){return l=l||[],null==n||\"boolean\"==typeof n||(h(n)?n.some(function(n){$(n,l)}):l.push(n)),l}function H(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type)return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++}}return-1}function I(n,l,u){\"-\"===l[0]?n.setProperty(l,null==u?\"\":u):n[l]=null==u?\"\":\"number\"!=typeof u||a.test(l)?u:u+\"px\"}function T(n,l,u,t,i){var o;n:if(\"style\"===l)if(\"string\"==typeof u)n.style.cssText=u;else{if(\"string\"==typeof t&&(n.style.cssText=t=\"\"),t)for(l in t)u&&l in u||I(n.style,l,\"\");if(u)for(l in u)t&&u[l]===t[l]||I(n.style,l,u[l])}else if(\"o\"===l[0]&&\"n\"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/,\"$1\")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?D:A,o)):n.removeEventListener(l,o?D:A,o);else{if(i)l=l.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(\"width\"!==l&&\"height\"!==l&&\"href\"!==l&&\"list\"!==l&&\"form\"!==l&&\"tabIndex\"!==l&&\"download\"!==l&&\"rowSpan\"!==l&&\"colSpan\"!==l&&\"role\"!==l&&l in n)try{n[l]=null==u?\"\":u;break n}catch(n){}\"function\"==typeof u||(null==u||!1===u&&\"-\"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u))}}function A(n){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l.event?l.event(n):n)}function D(n){return this.l[n.type+!0](l.event?l.event(n):n)}function L(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,m,k,w,x,P,S,$,H,I,T,A=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l.__b)&&a(u);n:if(\"function\"==typeof A)try{if(w=u.props,x=(a=A.contextType)&&i[a.__c],P=a?x?x.props.value:a.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:(\"prototype\"in A&&A.prototype.render?u.__c=p=new A(w,P):(u.__c=p=new b(w,P),p.constructor=A,p.render=O),x&&x.sub(p),p.props=w,p.state||(p.state={}),p.context=P,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(w,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==A.getDerivedStateFromProps&&w!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,P),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,P)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=w,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u)}),S=0;S<p._sb.length;S++)p.__h.push(p._sb[S]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,P),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,m)})}if(p.context=P,p.props=w,p.__P=n,p.__e=!1,$=l.__r,H=0,\"prototype\"in A&&A.prototype.render){for(p.state=p.__s,p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),I=0;I<p._sb.length;I++)p.__h.push(p._sb[I]);p._sb=[]}else do{p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=v(v({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,_)),C(n,h(T=null!=a&&a.type===g&&null==a.key?a.props.children:a)?T:[T],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__u&=-161,p.__h.length&&f.push(p),k&&(p.__E=p.__=null)}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function M(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)z(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function j(l,u,t,i,o,r,f,e,s){var a,v,y,d,_,g,b,k=t.props,w=u.props,x=u.type;if(\"svg\"===x&&(o=!0),null!=r)for(a=0;a<r.length;a++)if((_=r[a])&&\"setAttribute\"in _==!!x&&(x?_.localName===x:3===_.nodeType)){l=_,r[a]=null;break}if(null==l){if(null===x)return document.createTextNode(w);l=o?document.createElementNS(\"http://www.w3.org/2000/svg\",x):document.createElement(x,w.is&&w),r=null,e=!1}if(null===x)k===w||e&&l.data===w||(l.data=w);else{if(r=r&&n.call(l.childNodes),k=t.props||c,!e&&null!=r)for(k={},a=0;a<l.attributes.length;a++)k[(_=l.attributes[a]).name]=_.value;for(a in k)_=k[a],\"children\"==a||(\"dangerouslySetInnerHTML\"==a?y=_:\"key\"===a||a in w||T(l,a,null,_,o));for(a in w)_=w[a],\"children\"==a?d=_:\"dangerouslySetInnerHTML\"==a?v=_:\"value\"==a?g=_:\"checked\"==a?b=_:\"key\"===a||e&&\"function\"!=typeof _||k[a]===_||T(l,a,_,k[a],o);if(v)e||y&&(v.__html===y.__html||v.__html===l.innerHTML)||(l.innerHTML=v.__html),u.__k=[];else if(y&&(l.innerHTML=\"\"),C(l,h(d)?d:[d],u,t,i,o&&\"foreignObject\"!==x,r,f,r?r[0]:t.__k&&m(t,0),e,s),null!=r)for(a=r.length;a--;)null!=r[a]&&p(r[a]);e||(a=\"value\",void 0!==g&&(g!==l[a]||\"progress\"===x&&!g||\"option\"===x&&g!==k[a])&&T(l,a,g,k[a],!1),a=\"checked\",void 0!==b&&b!==l[a]&&T(l,a,b,k[a],!1))}return l}function z(n,u,t){try{\"function\"==typeof n?n(u):n.current=u}catch(n){l.__e(n,t)}}function N(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null,n.__c=void 0}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&N(i[o],u,t||\"function\"!=typeof n.type);t||null==n.__e||p(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function q(u,t,i){var o,r,f,e;l.__&&l.__(u,t),r=(o=\"function\"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],L(t,u=(!o&&i||t).__k=y(g,null,[u]),r||c,c,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),M(f,u,e)}function B(n,l){q(n,l,B)}function E(l,u,t){var i,o,r,f,e=v({},l.props);for(r in l.type&&l.type.defaultProps&&(f=l.type.defaultProps),u)\"key\"==r?i=u[r]:\"ref\"==r?o=u[r]:e[r]=void 0===u[r]&&void 0!==f?f[r]:u[r];return arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),d(l.type,e,i||l.key,o||l.ref,null)}function F(n,l){var u={__c:l=\"__cC\"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,w(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),\"function\"==typeof n&&(n=n(v({},u),this.props)),n&&v(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w(this))},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w(this))},b.prototype.render=g,i=[],r=\"function\"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e=0;export{b as Component,g as Fragment,E as cloneElement,F as createContext,y as createElement,_ as createRef,y as h,B as hydrate,t as isValidElement,l as options,q as render,$ as toChildArray};\n//# sourceMappingURL=preact.module.js.map\n","import { PostHog } from '../../posthog-core'\nimport { createLogger } from '../../utils/logger'\n\nconst logger = createLogger('[Stylesheet Loader]')\n\nexport const prepareStylesheet = (document: Document, innerText: string, posthog?: PostHog) => {\n // Forcing the existence of `document` requires this function to be called in a browser environment\n let stylesheet: HTMLStyleElement | null = document.createElement('style')\n stylesheet.innerText = innerText\n\n if (posthog?.config?.prepare_external_dependency_stylesheet) {\n stylesheet = posthog.config.prepare_external_dependency_stylesheet(stylesheet)\n }\n\n if (!stylesheet) {\n logger.error('prepare_external_dependency_stylesheet returned null')\n return null\n }\n\n return stylesheet\n}\n","import { VNode, cloneElement, createContext } from 'preact'\nimport { PostHog } from '../../posthog-core'\nimport {\n MultipleSurveyQuestion,\n Survey,\n SurveyAppearance,\n SurveyQuestion,\n SurveySchedule,\n SurveyType,\n} from '../../posthog-surveys-types'\nimport { document as _document, window as _window } from '../../utils/globals'\nimport { createLogger } from '../../utils/logger'\nimport { prepareStylesheet } from '../utils/stylesheet-loader'\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst window = _window as Window & typeof globalThis\nconst document = _document as Document\nconst SurveySeenPrefix = 'seenSurvey_'\n\nconst logger = createLogger('[Surveys]')\n\nexport const SURVEY_DEFAULT_Z_INDEX = 2147483647\n\nexport function getFontFamily(fontFamily?: string): string {\n if (fontFamily === 'inherit') {\n return 'inherit'\n }\n\n const defaultFontStack =\n 'BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"'\n return fontFamily ? `${fontFamily}, ${defaultFontStack}` : `-apple-system, ${defaultFontStack}`\n}\n\nexport function getSurveyResponseKey(questionId: string) {\n return `$survey_response_${questionId}`\n}\n\nexport const style = (appearance: SurveyAppearance | null) => {\n const positions = {\n left: 'left: 30px;',\n right: 'right: 30px;',\n center: `\n left: 50%;\n transform: translateX(-50%);\n `,\n }\n return `\n .survey-form, .thank-you-message {\n position: fixed;\n margin: 0px;\n bottom: 0px;\n color: black;\n font-weight: normal;\n font-family: ${getFontFamily(appearance?.fontFamily)};\n text-align: left;\n max-width: ${parseInt(appearance?.maxWidth || '300')}px;\n width: 100%;\n z-index: ${parseInt(appearance?.zIndex || SURVEY_DEFAULT_Z_INDEX.toString())};\n border: 1.5px solid ${appearance?.borderColor || '#c9c6c6'};\n border-bottom: 0px;\n ${positions[appearance?.position || 'right'] || 'right: 30px;'}\n flex-direction: column;\n background: ${appearance?.backgroundColor || '#eeeded'};\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);\n }\n\n .survey-box, .thank-you-message-container {\n padding: 20px 25px 10px;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n }\n\n .thank-you-message {\n text-align: center;\n }\n\n .form-submit[disabled] {\n opacity: ${appearance?.disabledButtonOpacity || '0.6'};\n filter: grayscale(50%);\n cursor: not-allowed;\n }\n .survey-form textarea {\n color: #2d2d2d;\n font-size: 14px;\n font-family: ${getFontFamily(appearance?.fontFamily)};\n background: white;\n color: black;\n outline: none;\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 10px;\n border-radius: 6px;\n border-color: ${appearance?.borderColor || '#c9c6c6'};\n margin-top: 14px;\n width: 100%;\n box-sizing: border-box;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) textarea {\n margin-top: 0;\n }\n .form-submit {\n box-sizing: border-box;\n margin: 0;\n font-family: inherit;\n overflow: visible;\n text-transform: none;\n position: relative;\n display: inline-block;\n font-weight: 700;\n white-space: nowrap;\n text-align: center;\n border: 1.5px solid transparent;\n cursor: pointer;\n user-select: none;\n touch-action: manipulation;\n padding: 12px;\n font-size: 14px;\n border-radius: 6px;\n outline: 0;\n background: ${appearance?.submitButtonColor || 'black'} !important;\n text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);\n width: 100%;\n }\n .form-cancel {\n display: flex;\n float: right;\n border: none;\n background: none;\n cursor: pointer;\n }\n .cancel-btn-wrapper {\n position: absolute;\n width: 35px;\n height: 35px;\n border-radius: 100%;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n background: white;\n border: 1.5px solid ${appearance?.borderColor || '#c9c6c6'};\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .bolded { font-weight: 600; }\n .buttons {\n display: flex;\n justify-content: center;\n }\n .footer-branding {\n font-size: 11px;\n margin-top: 10px;\n text-align: center;\n display: flex;\n justify-content: center;\n gap: 4px;\n align-items: center;\n font-weight: 500;\n background: ${appearance?.backgroundColor || '#eeeded'};\n text-decoration: none;\n backgroundColor: ${appearance?.backgroundColor || '#eeeded'};\n color: ${getContrastingTextColor(appearance?.backgroundColor || '#eeeded')};\n }\n .survey-question {\n font-weight: 500;\n font-size: 14px;\n background: ${appearance?.backgroundColor || '#eeeded'};\n }\n .question-textarea-wrapper {\n display: flex;\n flex-direction: column;\n }\n .survey-question-description {\n font-size: 13px;\n padding-top: 5px;\n background: ${appearance?.backgroundColor || '#eeeded'};\n }\n .ratings-number {\n font-size: 16px;\n font-weight: 600;\n padding: 8px 0px;\n border: none;\n }\n .ratings-number:hover {\n cursor: pointer;\n }\n .rating-options {\n margin-top: 14px;\n }\n .rating-options-number {\n display: grid;\n border-radius: 6px;\n overflow: hidden;\n border: 1.5px solid ${appearance?.borderColor || '#c9c6c6'};\n }\n .rating-options-number > .ratings-number {\n border-right: 1px solid ${appearance?.borderColor || '#c9c6c6'};\n }\n .rating-options-number > .ratings-number:last-of-type {\n border-right: 0px;\n }\n .rating-options-number .rating-active {\n background: ${appearance?.ratingButtonActiveColor || 'black'};\n }\n .rating-options-emoji {\n display: flex;\n justify-content: space-between;\n }\n .ratings-emoji {\n font-size: 16px;\n background-color: transparent;\n border: none;\n padding: 0px;\n }\n .ratings-emoji:hover {\n cursor: pointer;\n }\n .ratings-emoji.rating-active svg {\n fill: ${appearance?.ratingButtonActiveColor || 'black'};\n }\n .emoji-svg {\n fill: '#939393';\n }\n .rating-text {\n display: flex;\n flex-direction: row;\n font-size: 11px;\n justify-content: space-between;\n margin-top: 6px;\n background: ${appearance?.backgroundColor || '#eeeded'};\n opacity: .60;\n }\n .limit-height {\n max-height: 300px;\n overflow: auto;\n scrollbar-width: thin;\n scrollbar-color: ${appearance?.borderColor || '#c9c6c6'} ${appearance?.backgroundColor || '#eeeded'};\n }\n .multiple-choice-options {\n margin-top: 13px;\n font-size: 14px;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) .multiple-choice-options {\n margin-top: 0;\n }\n .multiple-choice-options .choice-option {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 13px;\n cursor: pointer;\n margin-bottom: 5px;\n position: relative;\n }\n .multiple-choice-options > .choice-option:last-of-type {\n margin-bottom: 0px;\n }\n .multiple-choice-options input {\n cursor: pointer;\n position: absolute;\n opacity: 0;\n }\n .choice-check {\n position: absolute;\n right: 10px;\n background: white;\n }\n .choice-check svg {\n display: none;\n }\n .multiple-choice-options .choice-option:hover .choice-check svg {\n display: inline-block;\n opacity: .25;\n }\n .multiple-choice-options input:checked + label + .choice-check svg {\n display: inline-block;\n opacity: 100% !important;\n }\n .multiple-choice-options input:checked + label {\n font-weight: bold;\n border: 1.5px solid rgba(0,0,0);\n }\n .multiple-choice-options input:checked + label input {\n font-weight: bold;\n }\n .multiple-choice-options label {\n width: 100%;\n cursor: pointer;\n padding: 10px;\n border: 1.5px solid rgba(0,0,0,.25);\n border-radius: 4px;\n background: white;\n }\n .multiple-choice-options .choice-option-open label {\n padding-right: 30px;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n max-width: 100%;\n }\n .multiple-choice-options .choice-option-open label span {\n width: 100%;\n }\n .multiple-choice-options .choice-option-open input:disabled + label {\n opacity: 0.6;\n }\n .multiple-choice-options .choice-option-open label input {\n position: relative;\n opacity: 1;\n flex-grow: 1;\n border: 0;\n outline: 0;\n }\n .thank-you-message-body {\n margin-top: 6px;\n font-size: 14px;\n background: ${appearance?.backgroundColor || '#eeeded'};\n }\n .thank-you-message-header {\n margin: 10px 0px 0px;\n background: ${appearance?.backgroundColor || '#eeeded'};\n }\n .thank-you-message-container .form-submit {\n margin-top: 20px;\n margin-bottom: 10px;\n }\n .thank-you-message-countdown {\n margin-left: 6px;\n }\n .bottom-section {\n margin-top: 14px;\n }\n `\n}\n\nfunction nameToHex(name: string) {\n return {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n 'indianred ': '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgrey: '#d3d3d3',\n lightgreen: '#90ee90',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370d8',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#d87093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n }[name.toLowerCase()]\n}\n\nfunction hex2rgb(c: string) {\n if (c[0] === '#') {\n const hexColor = c.replace(/^#/, '')\n const r = parseInt(hexColor.slice(0, 2), 16)\n const g = parseInt(hexColor.slice(2, 4), 16)\n const b = parseInt(hexColor.slice(4, 6), 16)\n return 'rgb(' + r + ',' + g + ',' + b + ')'\n }\n return 'rgb(255, 255, 255)'\n}\n\nexport function getContrastingTextColor(color: string = defaultBackgroundColor) {\n let rgb\n if (color[0] === '#') {\n rgb = hex2rgb(color)\n }\n if (color.startsWith('rgb')) {\n rgb = color\n }\n // otherwise it's a color name\n const nameColorToHex = nameToHex(color)\n if (nameColorToHex) {\n rgb = hex2rgb(nameColorToHex)\n }\n if (!rgb) {\n return 'black'\n }\n const colorMatch = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (colorMatch) {\n const r = parseInt(colorMatch[1])\n const g = parseInt(colorMatch[2])\n const b = parseInt(colorMatch[3])\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? 'black' : 'white'\n }\n return 'black'\n}\nexport function getTextColor(el: HTMLElement) {\n const backgroundColor = window.getComputedStyle(el).backgroundColor\n if (backgroundColor === 'rgba(0, 0, 0, 0)') {\n return 'black'\n }\n const colorMatch = backgroundColor.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (!colorMatch) return 'black'\n\n const r = parseInt(colorMatch[1])\n const g = parseInt(colorMatch[2])\n const b = parseInt(colorMatch[3])\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? 'black' : 'white'\n}\n\nexport const defaultSurveyAppearance: SurveyAppearance = {\n backgroundColor: '#eeeded',\n submitButtonColor: 'black',\n submitButtonTextColor: 'white',\n ratingButtonColor: 'white',\n ratingButtonActiveColor: 'black',\n borderColor: '#c9c6c6',\n placeholder: 'Start typing...',\n whiteLabel: false,\n displayThankYouMessage: true,\n thankYouMessageHeader: 'Thank you for your feedback!',\n position: 'right',\n}\n\nexport const defaultBackgroundColor = '#eeeded'\n\nexport const createShadow = (styleSheet: string, surveyId: string, element?: Element, posthog?: PostHog) => {\n const div = document.createElement('div')\n div.className = `PostHogSurvey${surveyId}`\n const shadow = div.attachShadow({ mode: 'open' })\n if (styleSheet) {\n const styleElement = prepareStylesheet(document, styleSheet, posthog)\n if (styleElement) {\n shadow.appendChild(styleElement)\n }\n }\n ;(element ? element : document.body).appendChild(div)\n return shadow\n}\n\nexport const sendSurveyEvent = (\n responses: Record<string, string | number | string[] | null> = {},\n survey: Survey,\n posthog?: PostHog\n) => {\n if (!posthog) {\n logger.error('[survey sent] event not captured, PostHog instance not found.')\n return\n }\n localStorage.setItem(getSurveySeenKey(survey), 'true')\n\n posthog.capture('survey sent', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n $survey_iteration: survey.current_iteration,\n $survey_iteration_start_date: survey.current_iteration_start_date,\n $survey_questions: survey.questions.map((question, index) => ({\n id: question.id,\n question: question.question,\n index,\n })),\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...responses,\n $set: {\n [getSurveyInteractionProperty(survey, 'responded')]: true,\n },\n })\n window.dispatchEvent(new Event('PHSurveySent'))\n}\n\nexport const dismissedSurveyEvent = (survey: Survey, posthog?: PostHog, readOnly?: boolean) => {\n // TODO: state management and unit tests for this would be nice\n if (!posthog) {\n logger.error('[survey dismissed] event not captured, PostHog instance not found.')\n return\n }\n if (readOnly) {\n return\n }\n posthog.capture('survey dismissed', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n $survey_iteration: survey.current_iteration,\n $survey_iteration_start_date: survey.current_iteration_start_date,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n $set: {\n [getSurveyInteractionProperty(survey, 'dismissed')]: true,\n },\n })\n localStorage.setItem(getSurveySeenKey(survey), 'true')\n window.dispatchEvent(new Event('PHSurveyClosed'))\n}\n\n// Use the Fisher-yates algorithm to shuffle this array\n// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\nexport const shuffle = (array: any[]) => {\n return array\n .map((a) => ({ sort: Math.floor(Math.random() * 10), value: a }))\n .sort((a, b) => a.sort - b.sort)\n .map((a) => a.value)\n}\n\nconst reverseIfUnshuffled = (unshuffled: any[], shuffled: any[]): any[] => {\n if (unshuffled.length === shuffled.length && unshuffled.every((val, index) => val === shuffled[index])) {\n return shuffled.reverse()\n }\n\n return shuffled\n}\n\nexport const getDisplayOrderChoices = (question: MultipleSurveyQuestion): string[] => {\n if (!question.shuffleOptions) {\n return question.choices\n }\n\n const displayOrderChoices = question.choices\n let openEndedChoice = ''\n if (question.hasOpenChoice) {\n // if the question has an open-ended choice, its always the last element in the choices array.\n openEndedChoice = displayOrderChoices.pop()!\n }\n\n const shuffledOptions = reverseIfUnshuffled(displayOrderChoices, shuffle(displayOrderChoices))\n\n if (question.hasOpenChoice) {\n question.choices.push(openEndedChoice)\n shuffledOptions.push(openEndedChoice)\n }\n\n return shuffledOptions\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n if (!survey.appearance || !survey.appearance.shuffleQuestions) {\n return survey.questions\n }\n\n return reverseIfUnshuffled(survey.questions, shuffle(survey.questions))\n}\n\nexport const hasEvents = (survey: Pick<Survey, 'conditions'>): boolean => {\n return survey.conditions?.events?.values?.length != undefined && survey.conditions?.events?.values?.length > 0\n}\n\nexport const canActivateRepeatedly = (survey: Pick<Survey, 'schedule' | 'type' | 'conditions'>): boolean => {\n if (survey.schedule === SurveySchedule.Always && survey.type === SurveyType.Widget) {\n return true\n }\n\n return !!(survey.conditions?.events?.repeatedActivation && hasEvents(survey))\n}\n\n/**\n * getSurveySeen checks local storage for the surveySeen Key a\n * and overrides this value if the survey can be repeatedly activated by its events.\n * @param survey\n */\nexport const getSurveySeen = (survey: Survey): boolean => {\n const surveySeen = localStorage.getItem(getSurveySeenKey(survey))\n if (surveySeen) {\n // if a survey has already been seen,\n // we will override it with the event repeated activation value.\n return !canActivateRepeatedly(survey)\n }\n\n return false\n}\n\nexport const getSurveySeenKey = (survey: Survey): string => {\n let surveySeenKey = `${SurveySeenPrefix}${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n surveySeenKey = `${SurveySeenPrefix}${survey.id}_${survey.current_iteration}`\n }\n\n return surveySeenKey\n}\n\nexport const getSurveySeenStorageKeys = (): string[] => {\n const surveyKeys = []\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i)\n if (key?.startsWith(SurveySeenPrefix)) {\n surveyKeys.push(key)\n }\n }\n\n return surveyKeys\n}\n\nconst getSurveyInteractionProperty = (survey: Survey, action: string): string => {\n let surveyProperty = `$survey_${action}/${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n surveyProperty = `$survey_${action}/${survey.id}/${survey.current_iteration}`\n }\n\n return surveyProperty\n}\n\nexport const hasWaitPeriodPassed = (\n lastSeenSurveyDate: string | null,\n waitPeriodInDays: number | undefined\n): boolean => {\n if (!waitPeriodInDays || !lastSeenSurveyDate) {\n return true\n }\n\n const today = new Date()\n const diff = Math.abs(today.getTime() - new Date(lastSeenSurveyDate).getTime())\n const diffDaysFromToday = Math.ceil(diff / (1000 * 3600 * 24))\n return diffDaysFromToday > waitPeriodInDays\n}\n\ninterface SurveyContextProps {\n isPreviewMode: boolean\n previewPageIndex: number | undefined\n onPopupSurveyDismissed: () => void\n isPopup: boolean\n onPreviewSubmit: (res: string | string[] | number | null) => void\n}\n\nexport const SurveyContext = createContext<SurveyContextProps>({\n isPreviewMode: false,\n previewPageIndex: 0,\n onPopupSurveyDismissed: () => {},\n isPopup: true,\n onPreviewSubmit: () => {},\n})\n\ninterface RenderProps {\n component: VNode<{ className: string }>\n children: string\n renderAsHtml?: boolean\n style?: React.CSSProperties\n}\n\nexport const renderChildrenAsTextOrHtml = ({ component, children, renderAsHtml, style }: RenderProps) => {\n return renderAsHtml\n ? cloneElement(component, {\n dangerouslySetInnerHTML: { __html: children },\n style,\n })\n : cloneElement(component, {\n children,\n style,\n })\n}\n","import { getQueryParam, convertToURL, maskQueryParams } from './request-utils'\nimport { isNull } from './type-utils'\nimport { Properties } from '../types'\nimport Config from '../config'\nimport { each, extend, extendArray, stripEmptyProperties } from './index'\nimport { document, location, userAgent, window } from './globals'\nimport { detectBrowser, detectBrowserVersion, detectDevice, detectDeviceType, detectOS } from './user-agent-utils'\nimport { stripLeadingDollar } from './string-utils'\n\nconst URL_REGEX_PREFIX = 'https?://(.*)'\n\n// CAMPAIGN_PARAMS and EVENT_TO_PERSON_PROPERTIES should be kept in sync with\n// https://github.com/PostHog/posthog/blob/master/plugin-server/src/utils/db/utils.ts#L60\n\n// The list of campaign parameters that could be considered personal data under e.g. GDPR.\n// These can be masked in URLs and properties before being sent to posthog.\nexport const PERSONAL_DATA_CAMPAIGN_PARAMS = [\n 'gclid', // google ads\n 'gclsrc', // google ads 360\n 'dclid', // google display ads\n 'gbraid', // google ads, web to app\n 'wbraid', // google ads, app to web\n 'fbclid', // facebook\n 'msclkid', // microsoft\n 'twclid', // twitter\n 'li_fat_id', // linkedin\n 'igshid', // instagram\n 'ttclid', // tiktok\n 'rdt_cid', // reddit\n 'irclid', // impact\n '_kx', // klaviyo\n]\n\nexport const CAMPAIGN_PARAMS = extendArray(\n [\n 'utm_source',\n 'utm_medium',\n 'utm_campaign',\n 'utm_content',\n 'utm_term',\n 'gad_source', // google ads source\n 'mc_cid', // mailchimp campaign id\n ],\n PERSONAL_DATA_CAMPAIGN_PARAMS\n)\n\nexport const EVENT_TO_PERSON_PROPERTIES = [\n // mobile params\n '$app_build',\n '$app_name',\n '$app_namespace',\n '$app_version',\n // web params\n '$browser',\n '$browser_version',\n '$device_type',\n '$current_url',\n '$pathname',\n '$os',\n '$os_name', // $os_name is a special case, it's treated as an alias of $os!\n '$os_version',\n '$referring_domain',\n '$referrer',\n '$screen_height',\n '$screen_width',\n '$viewport_height',\n '$viewport_width',\n '$raw_user_agent',\n]\n\nexport const MASKED = '<masked>'\n\nexport const Info = {\n campaignParams: function ({\n customTrackedParams,\n maskPersonalDataProperties,\n customPersonalDataProperties,\n }: {\n customTrackedParams?: string[]\n maskPersonalDataProperties?: boolean\n customPersonalDataProperties?: string[] | undefined\n } = {}): Record<string, string> {\n if (!document) {\n return {}\n }\n\n const paramsToMask = maskPersonalDataProperties\n ? extendArray([], PERSONAL_DATA_CAMPAIGN_PARAMS, customPersonalDataProperties || [])\n : []\n\n return this._campaignParamsFromUrl(maskQueryParams(document.URL, paramsToMask, MASKED), customTrackedParams)\n },\n\n _campaignParamsFromUrl: function (url: string, customParams?: string[]): Record<string, string> {\n const campaign_keywords = CAMPAIGN_PARAMS.concat(customParams || [])\n\n const params: Record<string, any> = {}\n each(campaign_keywords, function (kwkey) {\n const kw = getQueryParam(url, kwkey)\n params[kwkey] = kw ? kw : null\n })\n\n return params\n },\n\n _searchEngine: function (referrer: string): string | null {\n if (!referrer) {\n return null\n } else {\n if (referrer.search(URL_REGEX_PREFIX + 'google.([^/?]*)') === 0) {\n return 'google'\n } else if (referrer.search(URL_REGEX_PREFIX + 'bing.com') === 0) {\n return 'bing'\n } else if (referrer.search(URL_REGEX_PREFIX + 'yahoo.com') === 0) {\n return 'yahoo'\n } else if (referrer.search(URL_REGEX_PREFIX + 'duckduckgo.com') === 0) {\n return 'duckduckgo'\n } else {\n return null\n }\n }\n },\n\n _searchInfoFromReferrer: function (referrer: string): Record<string, any> {\n const search = Info._searchEngine(referrer)\n const param = search != 'yahoo' ? 'q' : 'p'\n const ret: Record<string, any> = {}\n\n if (!isNull(search)) {\n ret['$search_engine'] = search\n\n const keyword = document ? getQueryParam(document.referrer, param) : ''\n if (keyword.length) {\n ret['ph_keyword'] = keyword\n }\n }\n\n return ret\n },\n\n searchInfo: function (): Record<string, any> {\n const referrer = document?.referrer\n if (!referrer) {\n return {}\n }\n return this._searchInfoFromReferrer(referrer)\n },\n\n /**\n * This function detects which browser is running this script.\n * The order of the checks are important since many user agents\n * include keywords used in later checks.\n */\n browser: detectBrowser,\n\n /**\n * This function detects which browser version is running this script,\n * parsing major and minor version (e.g., 42.1). User agent strings from:\n * http://www.useragentstring.com/pages/useragentstring.php\n *\n * `navigator.vendor` is passed in and used to help with detecting certain browsers\n * NB `navigator.vendor` is deprecated and not present in every browser\n */\n browserVersion: detectBrowserVersion,\n\n browserLanguage: function (): string | undefined {\n return (\n navigator.language || // Any modern browser\n (navigator as Record<string, any>).userLanguage // IE11\n )\n },\n\n browserLanguagePrefix: function (): string | undefined {\n const browserLanguage = this.browserLanguage()\n return typeof browserLanguage === 'string' ? browserLanguage.split('-')[0] : undefined\n },\n\n os: detectOS,\n\n device: detectDevice,\n\n deviceType: detectDeviceType,\n\n referrer: function (): string {\n return document?.referrer || '$direct'\n },\n\n referringDomain: function (): string {\n if (!document?.referrer) {\n return '$direct'\n }\n return convertToURL(document.referrer)?.host || '$direct'\n },\n\n referrerInfo: function (): Record<string, any> {\n return {\n $referrer: this.referrer(),\n $referring_domain: this.referringDomain(),\n }\n },\n\n personInfo: function ({\n maskPersonalDataProperties,\n customPersonalDataProperties,\n }: {\n maskPersonalDataProperties?: boolean\n customPersonalDataProperties?: string[]\n } = {}) {\n const paramsToMask = maskPersonalDataProperties\n ? extendArray([], PERSONAL_DATA_CAMPAIGN_PARAMS, customPersonalDataProperties || [])\n : []\n const url = location?.href.substring(0, 1000)\n // we're being a bit more economical with bytes here because this is stored in the cookie\n return {\n r: this.referrer().substring(0, 1000),\n u: url ? maskQueryParams(url, paramsToMask, MASKED) : undefined,\n }\n },\n\n personPropsFromInfo: function (info: Record<string, any>): Record<string, any> {\n const { r: referrer, u: url } = info\n const referring_domain =\n referrer == null ? undefined : referrer == '$direct' ? '$direct' : convertToURL(referrer)?.host\n\n const props: Record<string, string | undefined> = {\n $referrer: referrer,\n $referring_domain: referring_domain,\n }\n if (url) {\n props['$current_url'] = url\n const location = convertToURL(url)\n props['$host'] = location?.host\n props['$pathname'] = location?.pathname\n const campaignParams = this._campaignParamsFromUrl(url)\n extend(props, campaignParams)\n }\n if (referrer) {\n const searchInfo = this._searchInfoFromReferrer(referrer)\n extend(props, searchInfo)\n }\n return props\n },\n\n initialPersonPropsFromInfo: function (info: Record<string, any>): Record<string, any> {\n const personProps = this.personPropsFromInfo(info)\n const props: Record<string, any> = {}\n each(personProps, function (val: any, key: string) {\n props[`$initial_${stripLeadingDollar(key)}`] = val\n })\n return props\n },\n\n timezone: function (): string | undefined {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone\n } catch {\n return undefined\n }\n },\n\n timezoneOffset: function (): number | undefined {\n try {\n return new Date().getTimezoneOffset()\n } catch {\n return undefined\n }\n },\n\n properties: function ({\n maskPersonalDataProperties,\n customPersonalDataProperties,\n }: {\n maskPersonalDataProperties?: boolean\n customPersonalDataProperties?: string[]\n } = {}): Properties {\n if (!userAgent) {\n return {}\n }\n const paramsToMask = maskPersonalDataProperties\n ? extendArray([], PERSONAL_DATA_CAMPAIGN_PARAMS, customPersonalDataProperties || [])\n : []\n const [os_name, os_version] = Info.os(userAgent)\n return extend(\n stripEmptyProperties({\n $os: os_name,\n $os_version: os_version,\n $browser: Info.browser(userAgent, navigator.vendor),\n $device: Info.device(userAgent),\n $device_type: Info.deviceType(userAgent),\n $timezone: Info.timezone(),\n $timezone_offset: Info.timezoneOffset(),\n }),\n {\n $current_url: maskQueryParams(location?.href, paramsToMask, MASKED),\n $host: location?.host,\n $pathname: location?.pathname,\n $raw_user_agent: userAgent.length > 1000 ? userAgent.substring(0, 997) + '...' : userAgent,\n $browser_version: Info.browserVersion(userAgent, navigator.vendor),\n $browser_language: Info.browserLanguage(),\n $browser_language_prefix: Info.browserLanguagePrefix(),\n $screen_height: window?.screen.height,\n $screen_width: window?.screen.width,\n $viewport_height: window?.innerHeight,\n $viewport_width: window?.innerWidth,\n $lib: 'web',\n $lib_version: Config.LIB_VERSION,\n $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),\n $time: Date.now() / 1000, // epoch time in seconds\n }\n )\n },\n\n people_properties: function (): Properties {\n if (!userAgent) {\n return {}\n }\n\n const [os_name, os_version] = Info.os(userAgent)\n return extend(\n stripEmptyProperties({\n $os: os_name,\n $os_version: os_version,\n $browser: Info.browser(userAgent, navigator.vendor),\n }),\n {\n $browser_version: Info.browserVersion(userAgent, navigator.vendor),\n }\n )\n },\n}\n","export const isValidRegex = function (str: string): boolean {\n try {\n new RegExp(str)\n } catch {\n return false\n }\n return true\n}\n\nexport const isMatchingRegex = function (value: string, pattern: string): boolean {\n if (!isValidRegex(pattern)) return false\n\n try {\n return new RegExp(pattern).test(value)\n } catch {\n return false\n }\n}\n","export class SimpleEventEmitter {\n private events: { [key: string]: ((...args: any[]) => void)[] } = {}\n\n constructor() {\n this.events = {}\n }\n\n on(event: string, listener: (...args: any[]) => void): () => void {\n if (!this.events[event]) {\n this.events[event] = []\n }\n this.events[event].push(listener)\n\n return () => {\n this.events[event] = this.events[event].filter((x) => x !== listener)\n }\n }\n\n emit(event: string, payload: any): void {\n for (const listener of this.events[event] || []) {\n listener(payload)\n }\n for (const listener of this.events['*'] || []) {\n listener(event, payload)\n }\n }\n}\n","import { PostHog } from '../../posthog-core'\nimport { ActionStepStringMatching, ActionStepType, SurveyActionType, SurveyElement } from '../../posthog-surveys-types'\nimport { SimpleEventEmitter } from '../../utils/simple-event-emitter'\nimport { CaptureResult } from '../../types'\nimport { isUndefined } from '../../utils/type-utils'\nimport { window } from '../../utils/globals'\nimport { isMatchingRegex } from '../../utils/regex-utils'\n\nexport class ActionMatcher {\n private readonly actionRegistry?: Set<SurveyActionType>\n private readonly instance?: PostHog\n private readonly actionEvents: Set<string>\n private _debugEventEmitter = new SimpleEventEmitter()\n\n constructor(instance?: PostHog) {\n this.instance = instance\n this.actionEvents = new Set<string>()\n this.actionRegistry = new Set<SurveyActionType>()\n }\n\n init() {\n if (!isUndefined(this.instance?._addCaptureHook)) {\n const matchEventToAction = (eventName: string, eventPayload: any) => {\n this.on(eventName, eventPayload)\n }\n this.instance?._addCaptureHook(matchEventToAction)\n }\n }\n\n register(actions: SurveyActionType[]): void {\n if (isUndefined(this.instance?._addCaptureHook)) {\n return\n }\n\n actions.forEach((action) => {\n this.actionRegistry?.add(action)\n action.steps?.forEach((step) => {\n this.actionEvents?.add(step?.event || '')\n })\n })\n\n if (this.instance?.autocapture) {\n const selectorsToWatch: Set<string> = new Set<string>()\n actions.forEach((action) => {\n action.steps?.forEach((step) => {\n if (step?.selector) {\n selectorsToWatch.add(step?.selector)\n }\n })\n })\n this.instance?.autocapture.setElementSelectors(selectorsToWatch)\n }\n }\n\n on(eventName: string, eventPayload?: CaptureResult) {\n if (eventPayload == null || eventName.length == 0) {\n return\n }\n\n if (!this.actionEvents.has(eventName) && !this.actionEvents.has(<string>eventPayload?.event)) {\n return\n }\n\n if (this.actionRegistry && this.actionRegistry?.size > 0) {\n this.actionRegistry.forEach((action) => {\n if (this.checkAction(eventPayload, action)) {\n this._debugEventEmitter.emit('actionCaptured', action.name)\n }\n })\n }\n }\n\n _addActionHook(callback: (actionName: string, eventPayload?: any) => void): void {\n this.onAction('actionCaptured', (data) => callback(data))\n }\n\n private checkAction(event?: CaptureResult, action?: SurveyActionType): boolean {\n if (action?.steps == null) {\n return false\n }\n\n for (const step of action.steps) {\n if (this.checkStep(event, step)) {\n return true\n }\n }\n\n return false\n }\n\n onAction(event: 'actionCaptured', cb: (...args: any[]) => void): () => void {\n return this._debugEventEmitter.on(event, cb)\n }\n\n private checkStep = (event?: CaptureResult, step?: ActionStepType): boolean => {\n return this.checkStepEvent(event, step) && this.checkStepUrl(event, step) && this.checkStepElement(event, step)\n }\n\n private checkStepEvent = (event?: CaptureResult, step?: ActionStepType): boolean => {\n // CHECK CONDITIONS, OTHERWISE SKIPPED\n if (step?.event && event?.event !== step?.event) {\n return false // EVENT NAME IS A MISMATCH\n }\n return true\n }\n\n private checkStepUrl(event?: CaptureResult, step?: ActionStepType): boolean {\n // CHECK CONDITIONS, OTHERWISE SKIPPED\n if (step?.url) {\n const eventUrl = event?.properties?.$current_url\n if (!eventUrl || typeof eventUrl !== 'string') {\n return false // URL IS UNKNOWN\n }\n if (!ActionMatcher.matchString(eventUrl, step?.url, step?.url_matching || 'contains')) {\n return false // URL IS A MISMATCH\n }\n }\n return true\n }\n\n private static matchString(url: string, pattern: string, matching: ActionStepStringMatching): boolean {\n switch (matching) {\n case 'regex':\n return !!window && isMatchingRegex(url, pattern)\n case 'exact':\n return pattern === url\n case 'contains':\n // Simulating SQL LIKE behavior (_ = any single character, % = any zero or more characters)\n // eslint-disable-next-line no-case-declarations\n const adjustedRegExpStringPattern = ActionMatcher.escapeStringRegexp(pattern)\n .replace(/_/g, '.')\n .replace(/%/g, '.*')\n return isMatchingRegex(url, adjustedRegExpStringPattern)\n\n default:\n return false\n }\n }\n\n private static escapeStringRegexp(pattern: string): string {\n // Escape characters with special meaning either inside or outside character sets.\n // Use a simple backslash escape when it’s always valid, and a `\\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.\n return pattern.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d')\n }\n\n private checkStepElement(event?: CaptureResult, step?: ActionStepType): boolean {\n // CHECK CONDITIONS, OTHERWISE SKIPPED\n if (step?.href || step?.tag_name || step?.text) {\n const elements = this.getElementsList(event)\n if (\n !elements.some((element) => {\n if (\n step?.href &&\n !ActionMatcher.matchString(element.href || '', step?.href, step?.href_matching || 'exact')\n ) {\n return false // ELEMENT HREF IS A MISMATCH\n }\n if (step?.tag_name && element.tag_name !== step?.tag_name) {\n return false // ELEMENT TAG NAME IS A MISMATCH\n }\n if (\n step?.text &&\n !(\n ActionMatcher.matchString(element.text || '', step?.text, step?.text_matching || 'exact') ||\n ActionMatcher.matchString(\n element.$el_text || '',\n step?.text,\n step?.text_matching || 'exact'\n )\n )\n ) {\n return false // ELEMENT TEXT IS A MISMATCH\n }\n return true\n })\n ) {\n // AT LEAST ONE ELEMENT MUST BE A SUBMATCH\n return false\n }\n }\n\n if (step?.selector) {\n const elementSelectors = event?.properties?.$element_selectors as unknown as string[]\n if (!elementSelectors) {\n return false // SELECTOR IS A MISMATCH\n }\n if (!elementSelectors.includes(step?.selector)) {\n return false // SELECTOR IS A MISMATCH\n }\n }\n\n return true\n }\n\n private getElementsList(event?: CaptureResult): SurveyElement[] {\n if (event?.properties.$elements == null) {\n return []\n }\n\n return event?.properties.$elements as unknown as SurveyElement[]\n }\n}\n","import { Survey } from '../posthog-surveys-types'\nimport { SURVEYS_ACTIVATED } from '../constants'\n\nimport { CaptureResult } from '../types'\nimport { ActionMatcher } from '../extensions/surveys/action-matcher'\nimport { PostHog } from '../posthog-core'\nimport { isUndefined } from './type-utils'\n\nexport class SurveyEventReceiver {\n // eventToSurveys is a mapping of event name to all the surveys that are activated by it\n private readonly eventToSurveys: Map<string, string[]>\n // actionToSurveys is a mapping of action name to all the surveys that are activated by it\n private readonly actionToSurveys: Map<string, string[]>\n // actionMatcher can look at CaptureResult payloads and match an event to its corresponding action.\n private actionMatcher?: ActionMatcher | null\n private readonly instance?: PostHog\n private static SURVEY_SHOWN_EVENT_NAME = 'survey shown'\n\n constructor(instance: PostHog) {\n this.instance = instance\n this.eventToSurveys = new Map<string, string[]>()\n this.actionToSurveys = new Map<string, string[]>()\n }\n\n register(surveys: Survey[]): void {\n if (isUndefined(this.instance?._addCaptureHook)) {\n return\n }\n\n this.setupEventBasedSurveys(surveys)\n this.setupActionBasedSurveys(surveys)\n }\n\n private setupActionBasedSurveys(surveys: Survey[]) {\n const actionBasedSurveys = surveys.filter(\n (survey: Survey) => survey.conditions?.actions && survey.conditions?.actions?.values?.length > 0\n )\n\n if (actionBasedSurveys.length === 0) {\n return\n }\n\n if (this.actionMatcher == null) {\n this.actionMatcher = new ActionMatcher(this.instance)\n this.actionMatcher.init()\n // match any actions to its corresponding survey.\n const matchActionToSurvey = (actionName: string) => {\n this.onAction(actionName)\n }\n\n this.actionMatcher._addActionHook(matchActionToSurvey)\n }\n\n actionBasedSurveys.forEach((survey) => {\n if (\n survey.conditions &&\n survey.conditions?.actions &&\n survey.conditions?.actions?.values &&\n survey.conditions?.actions?.values?.length > 0\n ) {\n // register the known set of actions with\n // the action-matcher so it can match\n // events to actions\n this.actionMatcher?.register(survey.conditions.actions.values)\n\n // maintain a mapping of (Action1) => [Survey1, Survey2, Survey3]\n // where Surveys 1-3 are all activated by Action1\n survey.conditions?.actions?.values?.forEach((action) => {\n if (action && action.name) {\n const knownSurveys: string[] | undefined = this.actionToSurveys.get(action.name)\n if (knownSurveys) {\n knownSurveys.push(survey.id)\n }\n this.actionToSurveys.set(action.name, knownSurveys || [survey.id])\n }\n })\n }\n })\n }\n\n private setupEventBasedSurveys(surveys: Survey[]) {\n const eventBasedSurveys = surveys.filter(\n (survey: Survey) => survey.conditions?.events && survey.conditions?.events?.values?.length > 0\n )\n\n if (eventBasedSurveys.length === 0) {\n return\n }\n\n // match any events to its corresponding survey.\n const matchEventToSurvey = (eventName: string, eventPayload?: CaptureResult) => {\n this.onEvent(eventName, eventPayload)\n }\n this.instance?._addCaptureHook(matchEventToSurvey)\n\n surveys.forEach((survey) => {\n // maintain a mapping of (Event1) => [Survey1, Survey2, Survey3]\n // where Surveys 1-3 are all activated by Event1\n survey.conditions?.events?.values?.forEach((event) => {\n if (event && event.name) {\n const knownSurveys: string[] | undefined = this.eventToSurveys.get(event.name)\n if (knownSurveys) {\n knownSurveys.push(survey.id)\n }\n this.eventToSurveys.set(event.name, knownSurveys || [survey.id])\n }\n })\n })\n }\n\n onEvent(event: string, eventPayload?: CaptureResult): void {\n const existingActivatedSurveys: string[] = this.instance?.persistence?.props[SURVEYS_ACTIVATED] || []\n if (\n SurveyEventReceiver.SURVEY_SHOWN_EVENT_NAME == event &&\n eventPayload &&\n existingActivatedSurveys.length > 0\n ) {\n // remove survey that from activatedSurveys here.\n const surveyId = eventPayload?.properties?.$survey_id\n if (surveyId) {\n const index = existingActivatedSurveys.indexOf(surveyId)\n if (index >= 0) {\n existingActivatedSurveys.splice(index, 1)\n this._updateActivatedSurveys(existingActivatedSurveys)\n }\n }\n } else {\n if (this.eventToSurveys.has(event)) {\n this._updateActivatedSurveys(existingActivatedSurveys.concat(this.eventToSurveys.get(event) || []))\n }\n }\n }\n\n onAction(actionName: string): void {\n const existingActivatedSurveys: string[] = this.instance?.persistence?.props[SURVEYS_ACTIVATED] || []\n if (this.actionToSurveys.has(actionName)) {\n this._updateActivatedSurveys(existingActivatedSurveys.concat(this.actionToSurveys.get(actionName) || []))\n }\n }\n\n private _updateActivatedSurveys(activatedSurveys: string[]) {\n // we use a new Set here to remove duplicates.\n this.instance?.persistence?.register({\n [SURVEYS_ACTIVATED]: [...new Set(activatedSurveys)],\n })\n }\n\n getSurveys(): string[] {\n const existingActivatedSurveys = this.instance?.persistence?.props[SURVEYS_ACTIVATED]\n return existingActivatedSurveys ? existingActivatedSurveys : []\n }\n\n getEventToSurveys(): Map<string, string[]> {\n return this.eventToSurveys\n }\n\n _getActionMatcher(): ActionMatcher | null | undefined {\n return this.actionMatcher\n }\n}\n","import { SURVEYS } from './constants'\nimport { getSurveySeenStorageKeys } from './extensions/surveys/surveys-utils'\nimport { PostHog } from './posthog-core'\nimport { Survey, SurveyCallback, SurveyMatchType } from './posthog-surveys-types'\nimport { RemoteConfig } from './types'\nimport { Info } from './utils/event-utils'\nimport { assignableWindow, document, userAgent, window } from './utils/globals'\nimport { createLogger } from './utils/logger'\nimport { isMatchingRegex } from './utils/regex-utils'\nimport { SurveyEventReceiver } from './utils/survey-event-receiver'\nimport { isNullish } from './utils/type-utils'\n\nconst logger = createLogger('[Surveys]')\n\nexport const surveyValidationMap: Record<SurveyMatchType, (targets: string[], value: string) => boolean> = {\n icontains: (targets, value) => targets.some((target) => value.toLowerCase().includes(target.toLowerCase())),\n\n not_icontains: (targets, value) => targets.every((target) => !value.toLowerCase().includes(target.toLowerCase())),\n\n regex: (targets, value) => targets.some((target) => isMatchingRegex(value, target)),\n\n not_regex: (targets, value) => targets.every((target) => !isMatchingRegex(value, target)),\n\n exact: (targets, value) => targets.some((target) => value === target),\n\n is_not: (targets, value) => targets.every((target) => value !== target),\n}\n\nfunction defaultMatchType(matchType?: SurveyMatchType): SurveyMatchType {\n return matchType ?? 'icontains'\n}\n\n// use urlMatchType to validate url condition, fallback to contains for backwards compatibility\nexport function doesSurveyUrlMatch(survey: Pick<Survey, 'conditions'>): boolean {\n if (!survey.conditions?.url) {\n return true\n }\n // if we dont know the url, assume it is not a match\n const href = window?.location?.href\n if (!href) {\n return false\n }\n\n const targets = [survey.conditions.url]\n return surveyValidationMap[defaultMatchType(survey.conditions?.urlMatchType)](targets, href)\n}\n\nexport function doesSurveyDeviceTypesMatch(survey: Survey): boolean {\n if (!survey.conditions?.deviceTypes || survey.conditions?.deviceTypes.length === 0) {\n return true\n }\n // if we dont know the device type, assume it is not a match\n if (!userAgent) {\n return false\n }\n\n const deviceType = Info.deviceType(userAgent)\n return surveyValidationMap[defaultMatchType(survey.conditions?.deviceTypesMatchType)](\n survey.conditions.deviceTypes,\n deviceType\n )\n}\n\nexport class PostHogSurveys {\n private _decideServerResponse?: boolean\n public _surveyEventReceiver: SurveyEventReceiver | null\n private _surveyManager: any\n private _isFetchingSurveys: boolean = false\n private _isInitializingSurveys: boolean = false\n private _surveyCallbacks: SurveyCallback[] = []\n\n constructor(private readonly instance: PostHog) {\n // we set this to undefined here because we need the persistence storage for this type\n // but that's not initialized until loadIfEnabled is called.\n this._surveyEventReceiver = null\n }\n\n onRemoteConfig(response: RemoteConfig) {\n this._decideServerResponse = !!response['surveys']\n logger.info(`decideServerResponse set to ${this._decideServerResponse}`)\n\n this.loadIfEnabled()\n }\n\n reset(): void {\n localStorage.removeItem('lastSeenSurveyDate')\n const surveyKeys = getSurveySeenStorageKeys()\n surveyKeys.forEach((key) => localStorage.removeItem(key))\n }\n\n loadIfEnabled() {\n if (this._surveyManager) {\n // Surveys already loaded.\n return\n }\n\n if (this._isInitializingSurveys) {\n logger.info('Already initializing surveys, skipping...')\n return\n }\n\n const disableSurveys = this.instance.config.disable_surveys\n\n if (disableSurveys) {\n logger.info('Disabled. Not loading surveys.')\n return\n }\n\n const phExtensions = assignableWindow?.__PosthogExtensions__\n\n if (!phExtensions) {\n logger.error('PostHog Extensions not found.')\n return\n }\n\n if (!this._decideServerResponse) {\n logger.warn('Decide not loaded yet. Not loading surveys.')\n return\n }\n\n this._isInitializingSurveys = true\n\n try {\n const generateSurveys = phExtensions.generateSurveys\n\n if (!generateSurveys) {\n const loadExternalDependency = phExtensions.loadExternalDependency\n\n if (loadExternalDependency) {\n loadExternalDependency(this.instance, 'surveys', (err) => {\n if (err || !phExtensions.generateSurveys) {\n logger.error('Could not load surveys script', err)\n this._isInitializingSurveys = false\n return\n }\n\n this._surveyManager = phExtensions.generateSurveys(this.instance)\n this._isInitializingSurveys = false\n this._surveyEventReceiver = new SurveyEventReceiver(this.instance)\n logger.info('Surveys loaded successfully')\n this._notifySurveyCallbacks({\n isLoaded: true,\n })\n })\n } else {\n const error = 'PostHog loadExternalDependency extension not found. Cannot load remote config.'\n logger.error(error)\n this._isInitializingSurveys = false\n this._notifySurveyCallbacks({\n isLoaded: false,\n error,\n })\n }\n } else {\n this._surveyManager = generateSurveys(this.instance)\n this._isInitializingSurveys = false\n this._surveyEventReceiver = new SurveyEventReceiver(this.instance)\n logger.info('Surveys loaded successfully')\n this._notifySurveyCallbacks({\n isLoaded: true,\n })\n }\n } catch (e) {\n logger.error('Error initializing surveys', e)\n this._isInitializingSurveys = false\n this._notifySurveyCallbacks({\n isLoaded: false,\n error: 'Error initializing surveys',\n })\n throw e\n }\n }\n\n /**\n * Register a callback that runs when surveys are initialized.\n * ### Usage:\n *\n * posthog.onSurveysLoaded((surveys) => {\n * // You can work with all surveys\n * console.log('All available surveys:', surveys)\n *\n * // Or get active matching surveys\n * posthog.getActiveMatchingSurveys((activeMatchingSurveys) => {\n * if (activeMatchingSurveys.length > 0) {\n * posthog.renderSurvey(activeMatchingSurveys[0].id, '#survey-container')\n * }\n * })\n * })\n *\n * @param {Function} callback The callback function will be called when surveys are loaded or updated.\n * It receives the array of all surveys and a context object with error status.\n * @returns {Function} A function that can be called to unsubscribe the listener.\n */\n onSurveysLoaded(callback: SurveyCallback): () => void {\n this._surveyCallbacks.push(callback)\n\n if (this._surveyManager) {\n this._notifySurveyCallbacks({\n isLoaded: true,\n })\n }\n // Return unsubscribe function\n return () => {\n this._surveyCallbacks = this._surveyCallbacks.filter((cb: SurveyCallback) => cb !== callback)\n }\n }\n\n getSurveys(callback: SurveyCallback, forceReload = false) {\n // In case we manage to load the surveys script, but config says not to load surveys\n // then we shouldn't return survey data\n if (this.instance.config.disable_surveys) {\n logger.info('Disabled. Not loading surveys.')\n return callback([])\n }\n\n const existingSurveys = this.instance.get_property(SURVEYS)\n\n if (!existingSurveys || forceReload) {\n // Prevent concurrent API calls\n if (this._isFetchingSurveys) {\n return callback([], {\n isLoaded: false,\n error: 'Surveys are already being loaded',\n })\n }\n\n try {\n this._isFetchingSurveys = true\n this.instance._send_request({\n url: this.instance.requestRouter.endpointFor(\n 'api',\n `/api/surveys/?token=${this.instance.config.token}`\n ),\n method: 'GET',\n timeout: this.instance.config.surveys_request_timeout_ms,\n callback: (response) => {\n this._isFetchingSurveys = false\n const statusCode = response.statusCode\n if (statusCode !== 200 || !response.json) {\n const error = `Surveys API could not be loaded, status: ${statusCode}`\n logger.error(error)\n return callback([], {\n isLoaded: false,\n error,\n })\n }\n const surveys = response.json.surveys || []\n\n const eventOrActionBasedSurveys = surveys.filter(\n (survey: Survey) =>\n (survey.conditions?.events &&\n survey.conditions?.events?.values &&\n survey.conditions?.events?.values?.length > 0) ||\n (survey.conditions?.actions &&\n survey.conditions?.actions?.values &&\n survey.conditions?.actions?.values?.length > 0)\n )\n\n if (eventOrActionBasedSurveys.length > 0) {\n this._surveyEventReceiver?.register(eventOrActionBasedSurveys)\n }\n\n this.instance.persistence?.register({ [SURVEYS]: surveys })\n return callback(surveys, {\n isLoaded: true,\n })\n },\n })\n } catch (e) {\n this._isFetchingSurveys = false\n throw e\n }\n } else {\n return callback(existingSurveys, {\n isLoaded: true,\n })\n }\n }\n\n /** Helper method to notify all registered callbacks */\n private _notifySurveyCallbacks(context: { isLoaded: boolean; error?: string }): void {\n for (const callback of this._surveyCallbacks) {\n try {\n if (!context.isLoaded) {\n callback([], context)\n } else {\n this.getSurveys(callback)\n }\n } catch (error) {\n logger.error('Error in survey callback', error)\n }\n }\n }\n\n private isSurveyFeatureFlagEnabled(flagKey: string | null) {\n if (!flagKey) {\n return true\n }\n return this.instance.featureFlags.isFeatureEnabled(flagKey)\n }\n\n getActiveMatchingSurveys(callback: SurveyCallback, forceReload = false) {\n this.getSurveys((surveys) => {\n const activeSurveys = surveys.filter((survey) => {\n return !!(survey.start_date && !survey.end_date)\n })\n\n const conditionMatchedSurveys = activeSurveys.filter((survey) => {\n if (!survey.conditions) {\n return true\n }\n\n const urlCheck = doesSurveyUrlMatch(survey)\n const selectorCheck = survey.conditions?.selector\n ? document?.querySelector(survey.conditions.selector)\n : true\n const deviceTypeCheck = doesSurveyDeviceTypesMatch(survey)\n return urlCheck && selectorCheck && deviceTypeCheck\n })\n\n // get all the surveys that have been activated so far with user actions.\n const activatedSurveys: string[] | undefined = this._surveyEventReceiver?.getSurveys()\n const targetingMatchedSurveys = conditionMatchedSurveys.filter((survey) => {\n if (\n !survey.linked_flag_key &&\n !survey.targeting_flag_key &&\n !survey.internal_targeting_flag_key &&\n !survey.feature_flag_keys?.length\n ) {\n return true\n }\n const linkedFlagCheck = this.isSurveyFeatureFlagEnabled(survey.linked_flag_key)\n const targetingFlagCheck = this.isSurveyFeatureFlagEnabled(survey.targeting_flag_key)\n\n const hasEvents = (survey.conditions?.events?.values?.length ?? 0) > 0\n const hasActions = (survey.conditions?.actions?.values?.length ?? 0) > 0\n\n const eventBasedTargetingFlagCheck =\n hasEvents || hasActions ? activatedSurveys?.includes(survey.id) : true\n\n const overrideInternalTargetingFlagCheck = this._canActivateRepeatedly(survey)\n const internalTargetingFlagCheck =\n overrideInternalTargetingFlagCheck ||\n this.isSurveyFeatureFlagEnabled(survey.internal_targeting_flag_key)\n\n const flagsCheck = this.checkFlags(survey)\n return (\n linkedFlagCheck &&\n targetingFlagCheck &&\n internalTargetingFlagCheck &&\n eventBasedTargetingFlagCheck &&\n flagsCheck\n )\n })\n\n return callback(targetingMatchedSurveys)\n }, forceReload)\n }\n\n checkFlags(survey: Survey): boolean {\n if (!survey.feature_flag_keys?.length) {\n return true\n }\n\n return survey.feature_flag_keys.every(({ key, value }) => {\n if (!key || !value) {\n return true\n }\n return this.instance.featureFlags.isFeatureEnabled(value)\n })\n }\n\n // this method is lazily loaded onto the window to avoid loading preact and other dependencies if surveys is not enabled\n private _canActivateRepeatedly(survey: Survey) {\n if (isNullish(assignableWindow.__PosthogExtensions__?.canActivateRepeatedly)) {\n logger.warn('init was not called')\n return false // TODO does it make sense to have a default here?\n }\n return assignableWindow.__PosthogExtensions__.canActivateRepeatedly(survey)\n }\n\n canRenderSurvey(surveyId: string) {\n if (isNullish(this._surveyManager)) {\n logger.warn('init was not called')\n return\n }\n this.getSurveys((surveys) => {\n const survey = surveys.filter((x) => x.id === surveyId)[0]\n this._surveyManager.canRenderSurvey(survey)\n })\n }\n\n renderSurvey(surveyId: string, selector: string) {\n if (isNullish(this._surveyManager)) {\n logger.warn('init was not called')\n return\n }\n this.getSurveys((surveys) => {\n const survey = surveys.filter((x) => x.id === surveyId)[0]\n this._surveyManager.renderSurvey(survey, document?.querySelector(selector))\n })\n }\n}\n","import{options as n}from\"preact\";var t,r,u,i,o=0,f=[],c=[],e=n.__b,a=n.__r,v=n.diffed,l=n.__c,m=n.unmount;function d(t,u){n.__h&&n.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function h(n){return o=1,s(B,n)}function s(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function p(u,i){var o=d(t++,3);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o))}function y(u,i){var o=d(t++,4);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o))}function _(n){return o=5,F(function(){return{current:n}},[])}function A(n,t,r){o=6,y(function(){return\"function\"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function q(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function x(t,r){n.useDebugValue&&n.useDebugValue(r?r(t):t)}function P(n){var u=d(t++,10),i=h();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function V(){var n=d(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__=\"P\"+i[0]+\"-\"+i[1]++}return n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[]}catch(r){t.__H.__h=[],n.__e(r,t.__v)}}n.__b=function(n){r=null,e&&e(n)},n.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[],t=0)),u=r},n.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===n.requestAnimationFrame||((i=n.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c})),u=r=null},n.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return!n.__||w(n)})}catch(u){r.some(function(n){n.__h&&(n.__h=[])}),r=[],n.__e(u,t.__v)}}),l&&l(t,r)},n.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n)}catch(n){r=n}}),u.__H=void 0,r&&n.__e(r,u.__v))};var g=\"function\"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r))}function k(n){var t=r,u=n.__c;\"function\"==typeof u&&(n.__c=void 0,u()),r=t}function w(n){var t=r;n.__c=n.__(),r=t}function z(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return\"function\"==typeof t?t(n):t}export{T as useCallback,q as useContext,x as useDebugValue,p as useEffect,P as useErrorBoundary,V as useId,A as useImperativeHandle,y as useLayoutEffect,F as useMemo,s as useReducer,_ as useRef,h as useState};\n//# sourceMappingURL=hooks.module.js.map\n","import { PostHog } from '../posthog-core'\nimport { Survey } from '../posthog-surveys-types'\nimport { document as _document } from '../utils/globals'\nimport { SURVEY_DEFAULT_Z_INDEX } from './surveys/surveys-utils'\nimport { prepareStylesheet } from './utils/stylesheet-loader'\n\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst document = _document as Document\n\nexport function createWidgetShadow(survey: Survey, posthog?: PostHog) {\n const div = document.createElement('div')\n div.className = `PostHogWidget${survey.id}`\n const shadow = div.attachShadow({ mode: 'open' })\n const widgetStyleSheet = createWidgetStyle(survey.appearance?.widgetColor)\n\n const stylesheet = prepareStylesheet(document, widgetStyleSheet, posthog)\n if (stylesheet) {\n shadow.append(stylesheet)\n }\n\n document.body.appendChild(div)\n return shadow\n}\n\nexport function createWidgetStyle(widgetColor?: string) {\n return `\n .ph-survey-widget-tab {\n position: fixed;\n top: 50%;\n right: 0;\n background: ${widgetColor || '#e0a045'};\n color: white;\n transform: rotate(-90deg) translate(0, -100%);\n transform-origin: right top;\n min-width: 40px;\n padding: 8px 12px;\n font-weight: 500;\n border-radius: 3px 3px 0 0;\n text-align: center;\n cursor: pointer;\n z-index: ${SURVEY_DEFAULT_Z_INDEX};\n }\n .ph-survey-widget-tab:hover {\n padding-bottom: 13px;\n }\n .ph-survey-widget-button {\n position: fixed;\n }\n `\n}\n","export const satisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <path d=\"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z\" />\n </svg>\n)\nexport const neutralEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <path d=\"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z\" />\n </svg>\n)\nexport const dissatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <path d=\"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z\" />\n </svg>\n)\nexport const veryDissatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <path d=\"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z\" />\n </svg>\n)\nexport const verySatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <path d=\"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z\" />\n </svg>\n)\nexport const cancelSVG = (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z\"\n fill=\"black\"\n />\n </svg>\n)\nexport const IconPosthogLogo = (\n <svg width=\"77\" height=\"14\" viewBox=\"0 0 77 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0_2415_6911)\">\n <mask\n id=\"mask0_2415_6911\"\n style={{ maskType: 'luminance' }}\n maskUnits=\"userSpaceOnUse\"\n x=\"0\"\n y=\"0\"\n width=\"77\"\n height=\"14\"\n >\n <path d=\"M0.5 0H76.5V14H0.5V0Z\" fill=\"white\" />\n </mask>\n <g mask=\"url(#mask0_2415_6911)\">\n <path\n d=\"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z\"\n fill=\"#1D4AFF\"\n />\n <path\n d=\"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z\"\n fill=\"#F9BD2B\"\n />\n <path\n d=\"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z\"\n fill=\"currentColor\"\n />\n <path\n d=\"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z\"\n fill=\"#1D4AFF\"\n />\n <path\n d=\"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z\"\n fill=\"#F54E00\"\n />\n <path\n d=\"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z\"\n fill=\"currentColor\"\n />\n </g>\n </g>\n <defs>\n <clipPath id=\"clip0_2415_6911\">\n <rect width=\"76\" height=\"14\" fill=\"white\" transform=\"translate(0.5)\" />\n </clipPath>\n </defs>\n </svg>\n)\nexport const checkSVG = (\n <svg width=\"16\" height=\"12\" viewBox=\"0 0 16 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n","import { IconPosthogLogo } from '../icons'\n// import { getContrastingTextColor } from '../surveys-utils'\n\nexport function PostHogLogo() {\n // const textColor = getContrastingTextColor(backgroundColor)\n\n return (\n <a\n href=\"https://posthog.com\"\n target=\"_blank\"\n rel=\"noopener\"\n // style={{ backgroundColor: backgroundColor, color: textColor }}\n className=\"footer-branding\"\n >\n Survey by {IconPosthogLogo}\n </a>\n )\n}\n","import { window } from '../../../utils/globals'\n\nimport { SurveyAppearance } from '../../../posthog-surveys-types'\n\nimport { useContext } from 'preact/hooks'\nimport { SurveyContext, defaultSurveyAppearance, getContrastingTextColor } from '../surveys-utils'\nimport { PostHogLogo } from './PostHogLogo'\n\nexport function BottomSection({\n text,\n submitDisabled,\n appearance,\n onSubmit,\n link,\n onPreviewSubmit,\n}: {\n text: string\n submitDisabled: boolean\n appearance: SurveyAppearance\n onSubmit: () => void\n link?: string | null\n onPreviewSubmit?: () => void\n}) {\n const { isPreviewMode, isPopup } = useContext(SurveyContext)\n const textColor =\n appearance.submitButtonTextColor ||\n getContrastingTextColor(appearance.submitButtonColor || defaultSurveyAppearance.submitButtonColor)\n return (\n <div className=\"bottom-section\">\n <div className=\"buttons\">\n <button\n className=\"form-submit\"\n disabled={submitDisabled}\n aria-label=\"Submit survey\"\n type=\"button\"\n style={isPopup ? { color: textColor } : {}}\n onClick={() => {\n if (link) {\n window?.open(link)\n }\n if (isPreviewMode) {\n onPreviewSubmit?.()\n } else {\n onSubmit()\n }\n }}\n >\n {text}\n </button>\n </div>\n {!appearance.whiteLabel && <PostHogLogo />}\n </div>\n )\n}\n","import { h } from 'preact'\nimport { useContext } from 'preact/hooks'\nimport { SurveyQuestionDescriptionContentType } from '../../../posthog-surveys-types'\nimport { cancelSVG } from '../icons'\nimport { SurveyContext, defaultSurveyAppearance, renderChildrenAsTextOrHtml } from '../surveys-utils'\n\nexport function QuestionHeader({\n question,\n description,\n descriptionContentType,\n backgroundColor,\n forceDisableHtml,\n}: {\n question: string\n description?: string | null\n descriptionContentType?: SurveyQuestionDescriptionContentType\n forceDisableHtml: boolean\n backgroundColor?: string\n}) {\n const { isPopup } = useContext(SurveyContext)\n return (\n <div style={isPopup ? { backgroundColor: backgroundColor || defaultSurveyAppearance.backgroundColor } : {}}>\n <div className=\"survey-question\">{question}</div>\n {description &&\n renderChildrenAsTextOrHtml({\n component: h('div', { className: 'survey-question-description' }),\n children: description,\n renderAsHtml: !forceDisableHtml && descriptionContentType !== 'text',\n })}\n </div>\n )\n}\n\nexport function Cancel({ onClick }: { onClick: () => void }) {\n const { isPreviewMode } = useContext(SurveyContext)\n\n return (\n <div className=\"cancel-btn-wrapper\">\n <button\n className=\"form-cancel\"\n onClick={onClick}\n disabled={isPreviewMode}\n aria-label=\"Close survey\"\n role=\"button\"\n >\n {cancelSVG}\n </button>\n </div>\n )\n}\n","import { h } from 'preact'\nimport { SurveyAppearance, SurveyQuestionDescriptionContentType } from '../../../posthog-surveys-types'\nimport { defaultSurveyAppearance, getContrastingTextColor, renderChildrenAsTextOrHtml } from '../surveys-utils'\nimport { BottomSection } from './BottomSection'\nimport { Cancel } from './QuestionHeader'\n\nimport { useContext } from 'preact/hooks'\nimport { SurveyContext } from '../../surveys/surveys-utils'\n\nexport function ConfirmationMessage({\n header,\n description,\n contentType,\n forceDisableHtml,\n appearance,\n onClose,\n styleOverrides,\n}: {\n header: string\n description: string\n forceDisableHtml: boolean\n contentType?: SurveyQuestionDescriptionContentType\n appearance: SurveyAppearance\n onClose: () => void\n styleOverrides?: React.CSSProperties\n}) {\n const textColor = getContrastingTextColor(appearance.backgroundColor || defaultSurveyAppearance.backgroundColor)\n\n const { isPopup } = useContext(SurveyContext)\n\n return (\n <div className=\"thank-you-message\" style={{ ...styleOverrides }}>\n <div className=\"thank-you-message-container\">\n {isPopup && <Cancel onClick={() => onClose()} />}\n <h3 className=\"thank-you-message-header\" style={{ color: textColor }}>\n {header}\n </h3>\n {description &&\n renderChildrenAsTextOrHtml({\n component: h('div', { className: 'thank-you-message-body' }),\n children: description,\n renderAsHtml: !forceDisableHtml && contentType !== 'text',\n style: { color: textColor },\n })}\n {isPopup && (\n <BottomSection\n text={appearance.thankYouMessageCloseButtonText || 'Close'}\n submitDisabled={false}\n appearance={appearance}\n onSubmit={() => onClose()}\n />\n )}\n </div>\n </div>\n )\n}\n","import { useEffect, useRef, useState } from 'preact/hooks'\nimport { SurveyAppearance } from '../../../posthog-surveys-types'\nimport * as Preact from 'preact'\nimport { getTextColor } from '../surveys-utils'\n\nexport function useContrastingTextColor(options: {\n appearance: SurveyAppearance\n defaultTextColor?: string\n forceUpdate?: boolean\n}): {\n ref: Preact.RefObject<HTMLElement>\n textColor: string\n} {\n const ref = useRef<HTMLElement>(null)\n const [textColor, setTextColor] = useState(options.defaultTextColor ?? 'black')\n\n // TODO: useContext to get the background colors instead of querying the DOM\n useEffect(() => {\n if (ref.current) {\n const color = getTextColor(ref.current)\n setTextColor(color)\n }\n }, [options.appearance, options.forceUpdate])\n\n return {\n ref,\n textColor,\n }\n}\n","import { RefObject } from 'preact'\nimport { useMemo, useRef, useState } from 'preact/hooks'\nimport {\n BasicSurveyQuestion,\n LinkSurveyQuestion,\n MultipleSurveyQuestion,\n RatingSurveyQuestion,\n SurveyAppearance,\n SurveyQuestionType,\n} from '../../../posthog-surveys-types'\nimport { isArray, isNull } from '../../../utils/type-utils'\nimport { useContrastingTextColor } from '../hooks/useContrastingTextColor'\nimport {\n checkSVG,\n dissatisfiedEmoji,\n neutralEmoji,\n satisfiedEmoji,\n veryDissatisfiedEmoji,\n verySatisfiedEmoji,\n} from '../icons'\nimport { getDisplayOrderChoices } from '../surveys-utils'\nimport { BottomSection } from './BottomSection'\nimport { QuestionHeader } from './QuestionHeader'\n\ninterface CommonProps {\n forceDisableHtml: boolean\n appearance: SurveyAppearance\n onSubmit: (res: string | string[] | number | null) => void\n onPreviewSubmit: (res: string | string[] | number | null) => void\n}\n\nexport function OpenTextQuestion({\n question,\n forceDisableHtml,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: CommonProps & {\n question: BasicSurveyQuestion\n}) {\n const textRef = useRef(null)\n const [text, setText] = useState('')\n\n return (\n <div ref={textRef}>\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n backgroundColor={appearance.backgroundColor}\n forceDisableHtml={forceDisableHtml}\n />\n <textarea rows={4} placeholder={appearance?.placeholder} onInput={(e) => setText(e.currentTarget.value)} />\n <BottomSection\n text={question.buttonText || 'Submit'}\n submitDisabled={!text && !question.optional}\n appearance={appearance}\n onSubmit={() => onSubmit(text)}\n onPreviewSubmit={() => onPreviewSubmit(text)}\n />\n </div>\n )\n}\n\nexport function LinkQuestion({\n question,\n forceDisableHtml,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: CommonProps & {\n question: LinkSurveyQuestion\n}) {\n return (\n <>\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n forceDisableHtml={forceDisableHtml}\n />\n <BottomSection\n text={question.buttonText || 'Submit'}\n submitDisabled={false}\n link={question.link}\n appearance={appearance}\n onSubmit={() => onSubmit('link clicked')}\n onPreviewSubmit={() => onPreviewSubmit('link clicked')}\n />\n </>\n )\n}\n\nexport function RatingQuestion({\n question,\n forceDisableHtml,\n displayQuestionIndex,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: CommonProps & {\n question: RatingSurveyQuestion\n displayQuestionIndex: number\n}) {\n const scale = question.scale\n const starting = question.scale === 10 ? 0 : 1\n const [rating, setRating] = useState<number | null>(null)\n\n return (\n <>\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n forceDisableHtml={forceDisableHtml}\n backgroundColor={appearance.backgroundColor}\n />\n <div className=\"rating-section\">\n <div className=\"rating-options\">\n {question.display === 'emoji' && (\n <div className=\"rating-options-emoji\">\n {(question.scale === 3 ? threeScaleEmojis : fiveScaleEmojis).map((emoji, idx) => {\n const active = idx + 1 === rating\n return (\n <button\n className={`ratings-emoji question-${displayQuestionIndex}-rating-${idx} ${\n active ? 'rating-active' : null\n }`}\n value={idx + 1}\n key={idx}\n type=\"button\"\n onClick={() => {\n setRating(idx + 1)\n }}\n style={{\n fill: active\n ? appearance.ratingButtonActiveColor\n : appearance.ratingButtonColor,\n borderColor: appearance.borderColor,\n }}\n >\n {emoji}\n </button>\n )\n })}\n </div>\n )}\n {question.display === 'number' && (\n <div\n className=\"rating-options-number\"\n style={{ gridTemplateColumns: `repeat(${scale - starting + 1}, minmax(0, 1fr))` }}\n >\n {getScaleNumbers(question.scale).map((number, idx) => {\n const active = rating === number\n return (\n <RatingButton\n key={idx}\n displayQuestionIndex={displayQuestionIndex}\n active={active}\n appearance={appearance}\n num={number}\n setActiveNumber={(num) => {\n setRating(num)\n }}\n />\n )\n })}\n </div>\n )}\n </div>\n <div className=\"rating-text\">\n <div>{question.lowerBoundLabel}</div>\n <div>{question.upperBoundLabel}</div>\n </div>\n </div>\n <BottomSection\n text={question.buttonText || appearance?.submitButtonText || 'Submit'}\n submitDisabled={isNull(rating) && !question.optional}\n appearance={appearance}\n onSubmit={() => onSubmit(rating)}\n onPreviewSubmit={() => onPreviewSubmit(rating)}\n />\n </>\n )\n}\n\nexport function RatingButton({\n num,\n active,\n displayQuestionIndex,\n appearance,\n setActiveNumber,\n}: {\n num: number\n active: boolean\n displayQuestionIndex: number\n appearance: SurveyAppearance\n setActiveNumber: (num: number) => void\n}) {\n const { textColor, ref } = useContrastingTextColor({ appearance, defaultTextColor: 'black', forceUpdate: active })\n return (\n <button\n ref={ref as RefObject<HTMLButtonElement>}\n className={`ratings-number question-${displayQuestionIndex}-rating-${num} ${\n active ? 'rating-active' : null\n }`}\n type=\"button\"\n onClick={() => {\n setActiveNumber(num)\n }}\n style={{\n color: textColor,\n backgroundColor: active ? appearance.ratingButtonActiveColor : appearance.ratingButtonColor,\n borderColor: appearance.borderColor,\n }}\n >\n {num}\n </button>\n )\n}\n\nexport function MultipleChoiceQuestion({\n question,\n forceDisableHtml,\n displayQuestionIndex,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: CommonProps & {\n question: MultipleSurveyQuestion\n displayQuestionIndex: number\n}) {\n const textRef = useRef(null)\n const choices = useMemo(() => getDisplayOrderChoices(question), [question])\n const [selectedChoices, setSelectedChoices] = useState<string | string[] | null>(\n question.type === SurveyQuestionType.MultipleChoice ? [] : null\n )\n const [openChoiceSelected, setOpenChoiceSelected] = useState(false)\n const [openEndedInput, setOpenEndedInput] = useState('')\n\n const inputType = question.type === SurveyQuestionType.SingleChoice ? 'radio' : 'checkbox'\n return (\n <div ref={textRef}>\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n forceDisableHtml={forceDisableHtml}\n backgroundColor={appearance.backgroundColor}\n />\n <div className=\"multiple-choice-options limit-height\">\n {/* Remove the last element from the choices, if hasOpenChoice is set */}\n {/* shuffle all other options here if question.shuffleOptions is set */}\n {/* Always ensure that the open ended choice is the last option */}\n {choices.map((choice: string, idx: number) => {\n let choiceClass = 'choice-option'\n const val = choice\n const option = choice\n if (!!question.hasOpenChoice && idx === question.choices.length - 1) {\n choiceClass += ' choice-option-open'\n }\n return (\n <div className={choiceClass}>\n <input\n type={inputType}\n id={`surveyQuestion${displayQuestionIndex}Choice${idx}`}\n name={`question${displayQuestionIndex}`}\n value={val}\n disabled={!val}\n onInput={() => {\n if (question.hasOpenChoice && idx === question.choices.length - 1) {\n return setOpenChoiceSelected(!openChoiceSelected)\n }\n if (question.type === SurveyQuestionType.SingleChoice) {\n return setSelectedChoices(val)\n }\n if (\n question.type === SurveyQuestionType.MultipleChoice &&\n isArray(selectedChoices)\n ) {\n if (selectedChoices.includes(val)) {\n // filter out values because clicking on a selected choice should deselect it\n return setSelectedChoices(\n selectedChoices.filter((choice) => choice !== val)\n )\n }\n return setSelectedChoices([...selectedChoices, val])\n }\n }}\n />\n <label\n htmlFor={`surveyQuestion${displayQuestionIndex}Choice${idx}`}\n style={{ color: 'black' }}\n >\n {question.hasOpenChoice && idx === question.choices.length - 1 ? (\n <>\n <span>{option}:</span>\n <input\n type=\"text\"\n id={`surveyQuestion${displayQuestionIndex}Choice${idx}Open`}\n name={`question${displayQuestionIndex}`}\n onInput={(e) => {\n const userValue = e.currentTarget.value\n if (question.type === SurveyQuestionType.SingleChoice) {\n return setSelectedChoices(userValue)\n }\n if (\n question.type === SurveyQuestionType.MultipleChoice &&\n isArray(selectedChoices)\n ) {\n return setOpenEndedInput(userValue)\n }\n }}\n />\n </>\n ) : (\n option\n )}\n </label>\n <span className=\"choice-check\" style={{ color: 'black' }}>\n {checkSVG}\n </span>\n </div>\n )\n })}\n </div>\n <BottomSection\n text={question.buttonText || 'Submit'}\n submitDisabled={\n (isNull(selectedChoices) ||\n (isArray(selectedChoices) && !openChoiceSelected && selectedChoices.length === 0) ||\n (isArray(selectedChoices) &&\n openChoiceSelected &&\n !openEndedInput &&\n selectedChoices.length === 0 &&\n !question.optional)) &&\n !question.optional\n }\n appearance={appearance}\n onSubmit={() => {\n if (openChoiceSelected && question.type === SurveyQuestionType.MultipleChoice) {\n if (isArray(selectedChoices)) {\n onSubmit([...selectedChoices, openEndedInput])\n }\n } else {\n onSubmit(selectedChoices)\n }\n }}\n onPreviewSubmit={() => {\n if (openChoiceSelected && question.type === SurveyQuestionType.MultipleChoice) {\n if (isArray(selectedChoices)) {\n onPreviewSubmit([...selectedChoices, openEndedInput])\n }\n } else {\n onPreviewSubmit(selectedChoices)\n }\n }}\n />\n </div>\n )\n}\n\nconst threeScaleEmojis = [dissatisfiedEmoji, neutralEmoji, satisfiedEmoji]\nconst fiveScaleEmojis = [veryDissatisfiedEmoji, dissatisfiedEmoji, neutralEmoji, satisfiedEmoji, verySatisfiedEmoji]\nconst fiveScaleNumbers = [1, 2, 3, 4, 5]\nconst sevenScaleNumbers = [1, 2, 3, 4, 5, 6, 7]\nconst tenScaleNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\nfunction getScaleNumbers(scale: number): number[] {\n switch (scale) {\n case 5:\n return fiveScaleNumbers\n case 7:\n return sevenScaleNumbers\n case 10:\n return tenScaleNumbers\n default:\n return fiveScaleNumbers\n }\n}\n","import { PostHog } from '../posthog-core'\nimport { doesSurveyUrlMatch } from '../posthog-surveys'\nimport {\n Survey,\n SurveyAppearance,\n SurveyQuestion,\n SurveyQuestionBranchingType,\n SurveyQuestionType,\n SurveyRenderReason,\n SurveyType,\n} from '../posthog-surveys-types'\n\nimport * as Preact from 'preact'\nimport { useContext, useEffect, useMemo, useRef, useState } from 'preact/hooks'\nimport { addEventListener } from '../utils'\nimport { document as _document, window as _window } from '../utils/globals'\nimport { createLogger } from '../utils/logger'\nimport { isNull, isNumber } from '../utils/type-utils'\nimport { createWidgetShadow, createWidgetStyle } from './surveys-widget'\nimport { ConfirmationMessage } from './surveys/components/ConfirmationMessage'\nimport { Cancel } from './surveys/components/QuestionHeader'\nimport {\n LinkQuestion,\n MultipleChoiceQuestion,\n OpenTextQuestion,\n RatingQuestion,\n} from './surveys/components/QuestionTypes'\nimport {\n createShadow,\n defaultSurveyAppearance,\n dismissedSurveyEvent,\n getContrastingTextColor,\n getDisplayOrderQuestions,\n getSurveyResponseKey,\n getSurveySeen,\n hasWaitPeriodPassed,\n sendSurveyEvent,\n style,\n SURVEY_DEFAULT_Z_INDEX,\n SurveyContext,\n} from './surveys/surveys-utils'\nimport { prepareStylesheet } from './utils/stylesheet-loader'\nconst logger = createLogger('[Surveys]')\n\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst window = _window as Window & typeof globalThis\nconst document = _document as Document\n\nfunction getPosthogWidgetClass(surveyId: string) {\n return `.PostHogWidget${surveyId}`\n}\n\nfunction getRatingBucketForResponseValue(responseValue: number, scale: number) {\n if (scale === 3) {\n if (responseValue < 1 || responseValue > 3) {\n throw new Error('The response must be in range 1-3')\n }\n\n return responseValue === 1 ? 'negative' : responseValue === 2 ? 'neutral' : 'positive'\n } else if (scale === 5) {\n if (responseValue < 1 || responseValue > 5) {\n throw new Error('The response must be in range 1-5')\n }\n\n return responseValue <= 2 ? 'negative' : responseValue === 3 ? 'neutral' : 'positive'\n } else if (scale === 7) {\n if (responseValue < 1 || responseValue > 7) {\n throw new Error('The response must be in range 1-7')\n }\n\n return responseValue <= 3 ? 'negative' : responseValue === 4 ? 'neutral' : 'positive'\n } else if (scale === 10) {\n if (responseValue < 0 || responseValue > 10) {\n throw new Error('The response must be in range 0-10')\n }\n\n return responseValue <= 6 ? 'detractors' : responseValue <= 8 ? 'passives' : 'promoters'\n }\n\n throw new Error('The scale must be one of: 3, 5, 7, 10')\n}\n\nexport function getNextSurveyStep(\n survey: Survey,\n currentQuestionIndex: number,\n response: string | string[] | number | null\n) {\n const question = survey.questions[currentQuestionIndex]\n const nextQuestionIndex = currentQuestionIndex + 1\n\n if (!question.branching?.type) {\n if (currentQuestionIndex === survey.questions.length - 1) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n\n if (question.branching.type === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n } else if (question.branching.type === SurveyQuestionBranchingType.SpecificQuestion) {\n if (Number.isInteger(question.branching.index)) {\n return question.branching.index\n }\n } else if (question.branching.type === SurveyQuestionBranchingType.ResponseBased) {\n // Single choice\n if (question.type === SurveyQuestionType.SingleChoice) {\n // :KLUDGE: for now, look up the choiceIndex based on the response\n // TODO: once QuestionTypes.MultipleChoiceQuestion is refactored, pass the selected choiceIndex into this method\n const selectedChoiceIndex = question.choices.indexOf(`${response}`)\n\n if (question.branching?.responseValues?.hasOwnProperty(selectedChoiceIndex)) {\n const nextStep = question.branching.responseValues[selectedChoiceIndex]\n\n // Specific question\n if (Number.isInteger(nextStep)) {\n return nextStep\n }\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n } else if (question.type === SurveyQuestionType.Rating) {\n if (typeof response !== 'number' || !Number.isInteger(response)) {\n throw new Error('The response type must be an integer')\n }\n\n const ratingBucket = getRatingBucketForResponseValue(response, question.scale)\n\n if (question.branching?.responseValues?.hasOwnProperty(ratingBucket)) {\n const nextStep = question.branching.responseValues[ratingBucket]\n\n // Specific question\n if (Number.isInteger(nextStep)) {\n return nextStep\n }\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n }\n\n return nextQuestionIndex\n }\n\n logger.warn('Falling back to next question index due to unexpected branching type')\n return nextQuestionIndex\n}\n\nexport class SurveyManager {\n private posthog: PostHog\n private surveyInFocus: string | null\n private surveyTimeouts: Map<string, NodeJS.Timeout> = new Map()\n\n constructor(posthog: PostHog) {\n this.posthog = posthog\n // This is used to track the survey that is currently in focus. We only show one survey at a time.\n this.surveyInFocus = null\n }\n\n private canShowNextEventBasedSurvey = (): boolean => {\n // with event based surveys, we need to show the next survey without reloading the page.\n // A simple check for div elements with the class name pattern of PostHogSurvey_xyz doesn't work here\n // because preact leaves behind the div element for any surveys responded/dismissed with a <style> node.\n // To alleviate this, we check the last div in the dom and see if it has any elements other than a Style node.\n // if the last PostHogSurvey_xyz div has only one style node, we can show the next survey in the queue\n // without reloading the page.\n const surveyPopups = document.querySelectorAll(`div[class^=PostHogSurvey]`)\n if (surveyPopups.length > 0) {\n return surveyPopups[surveyPopups.length - 1].shadowRoot?.childElementCount === 1\n }\n return true\n }\n\n private clearSurveyTimeout(surveyId: string) {\n const timeout = this.surveyTimeouts.get(surveyId)\n if (timeout) {\n clearTimeout(timeout)\n this.surveyTimeouts.delete(surveyId)\n }\n }\n\n private handlePopoverSurvey = (survey: Survey): void => {\n const surveyWaitPeriodInDays = survey.conditions?.seenSurveyWaitPeriodInDays\n const lastSeenSurveyDate = localStorage.getItem(`lastSeenSurveyDate`)\n\n if (!hasWaitPeriodPassed(lastSeenSurveyDate, surveyWaitPeriodInDays)) {\n return\n }\n\n const surveySeen = getSurveySeen(survey)\n if (!surveySeen) {\n this.clearSurveyTimeout(survey.id)\n this.addSurveyToFocus(survey.id)\n const delaySeconds = survey.appearance?.surveyPopupDelaySeconds || 0\n const shadow = createShadow(style(survey?.appearance), survey.id, undefined, this.posthog)\n if (delaySeconds <= 0) {\n return Preact.render(\n <SurveyPopup\n key={'popover-survey'}\n posthog={this.posthog}\n survey={survey}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n isPopup={true}\n />,\n shadow\n )\n }\n const timeoutId = setTimeout(() => {\n if (!doesSurveyUrlMatch(survey)) {\n return this.removeSurveyFromFocus(survey.id)\n }\n // rendering with surveyPopupDelaySeconds = 0 because we're already handling the timeout here\n Preact.render(\n <SurveyPopup\n key={'popover-survey'}\n posthog={this.posthog}\n survey={{ ...survey, appearance: { ...survey.appearance, surveyPopupDelaySeconds: 0 } }}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n isPopup={true}\n />,\n shadow\n )\n }, delaySeconds * 1000)\n this.surveyTimeouts.set(survey.id, timeoutId)\n }\n }\n\n private handleWidget = (survey: Survey): void => {\n const shadow = createWidgetShadow(survey, this.posthog)\n\n const stylesheetContent = style(survey.appearance)\n const stylesheet = prepareStylesheet(document, stylesheetContent, this.posthog)\n\n if (stylesheet) {\n shadow.appendChild(stylesheet)\n }\n\n Preact.render(\n <FeedbackWidget\n key={'feedback-survey'}\n posthog={this.posthog}\n survey={survey}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n />,\n shadow\n )\n }\n\n private handleWidgetSelector = (survey: Survey): void => {\n const selectorOnPage =\n survey.appearance?.widgetSelector && document.querySelector(survey.appearance.widgetSelector)\n if (selectorOnPage) {\n if (document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 0) {\n this.handleWidget(survey)\n } else if (document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 1) {\n // we have to check if user selector already has a survey listener attached to it because we always have to check if it's on the page or not\n if (!selectorOnPage.getAttribute('PHWidgetSurveyClickListener')) {\n const surveyPopup = document\n .querySelector(getPosthogWidgetClass(survey.id))\n ?.shadowRoot?.querySelector(`.survey-form`) as HTMLFormElement\n\n addEventListener(selectorOnPage, 'click', () => {\n if (surveyPopup) {\n surveyPopup.style.display = surveyPopup.style.display === 'none' ? 'block' : 'none'\n addEventListener(surveyPopup, 'PHSurveyClosed', () => {\n this.removeSurveyFromFocus(survey.id)\n surveyPopup.style.display = 'none'\n })\n }\n })\n\n selectorOnPage.setAttribute('PHWidgetSurveyClickListener', 'true')\n }\n }\n }\n }\n\n /**\n * Sorts surveys by their appearance delay in ascending order. If a survey does not have an appearance delay,\n * it is considered to have a delay of 0.\n * @param surveys\n * @returns The surveys sorted by their appearance delay\n */\n private sortSurveysByAppearanceDelay(surveys: Survey[]): Survey[] {\n return surveys.sort(\n (a, b) => (a.appearance?.surveyPopupDelaySeconds || 0) - (b.appearance?.surveyPopupDelaySeconds || 0)\n )\n }\n\n /**\n * Checks the feature flags associated with this Survey to see if the survey can be rendered.\n * @param survey\n * @param instance\n */\n public canRenderSurvey = (survey: Survey): SurveyRenderReason => {\n const renderReason: SurveyRenderReason = {\n visible: false,\n }\n\n if (survey.end_date) {\n renderReason.disabledReason = `survey was completed on ${survey.end_date}`\n return renderReason\n }\n\n if (survey.type != SurveyType.Popover) {\n renderReason.disabledReason = `Only Popover survey types can be rendered`\n return renderReason\n }\n\n const linkedFlagCheck = survey.linked_flag_key\n ? this.posthog.featureFlags.isFeatureEnabled(survey.linked_flag_key)\n : true\n\n if (!linkedFlagCheck) {\n renderReason.disabledReason = `linked feature flag ${survey.linked_flag_key} is false`\n return renderReason\n }\n\n const targetingFlagCheck = survey.targeting_flag_key\n ? this.posthog.featureFlags.isFeatureEnabled(survey.targeting_flag_key)\n : true\n\n if (!targetingFlagCheck) {\n renderReason.disabledReason = `targeting feature flag ${survey.targeting_flag_key} is false`\n return renderReason\n }\n\n const internalTargetingFlagCheck = survey.internal_targeting_flag_key\n ? this.posthog.featureFlags.isFeatureEnabled(survey.internal_targeting_flag_key)\n : true\n\n if (!internalTargetingFlagCheck) {\n renderReason.disabledReason = `internal targeting feature flag ${survey.internal_targeting_flag_key} is false`\n return renderReason\n }\n\n renderReason.visible = true\n return renderReason\n }\n\n public renderSurvey = (survey: Survey, selector: Element): void => {\n Preact.render(\n <SurveyPopup\n key={'popover-survey'}\n posthog={this.posthog}\n survey={survey}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n isPopup={false}\n />,\n selector\n )\n }\n\n public callSurveysAndEvaluateDisplayLogic = (forceReload: boolean = false): void => {\n this.posthog?.getActiveMatchingSurveys((surveys) => {\n const nonAPISurveys = surveys.filter((survey) => survey.type !== 'api')\n\n // Create a queue of surveys sorted by their appearance delay. We will evaluate the display logic\n // for each survey in the queue in order, and only display one survey at a time.\n const nonAPISurveyQueue = this.sortSurveysByAppearanceDelay(nonAPISurveys)\n\n nonAPISurveyQueue.forEach((survey) => {\n // We only evaluate the display logic for one survey at a time\n if (!isNull(this.surveyInFocus)) {\n return\n }\n if (survey.type === SurveyType.Widget) {\n if (\n survey.appearance?.widgetType === 'tab' &&\n document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 0\n ) {\n this.handleWidget(survey)\n }\n if (survey.appearance?.widgetType === 'selector' && survey.appearance?.widgetSelector) {\n this.handleWidgetSelector(survey)\n }\n }\n\n if (survey.type === SurveyType.Popover && this.canShowNextEventBasedSurvey()) {\n this.handlePopoverSurvey(survey)\n }\n })\n }, forceReload)\n }\n\n private addSurveyToFocus = (id: string): void => {\n if (!isNull(this.surveyInFocus)) {\n logger.error(`Survey ${[...this.surveyInFocus]} already in focus. Cannot add survey ${id}.`)\n }\n this.surveyInFocus = id\n }\n\n private removeSurveyFromFocus = (id: string): void => {\n if (this.surveyInFocus !== id) {\n logger.error(`Survey ${id} is not in focus. Cannot remove survey ${id}.`)\n }\n this.clearSurveyTimeout(id)\n this.surveyInFocus = null\n }\n\n // Expose internal state and methods for testing\n public getTestAPI() {\n return {\n addSurveyToFocus: this.addSurveyToFocus,\n removeSurveyFromFocus: this.removeSurveyFromFocus,\n surveyInFocus: this.surveyInFocus,\n surveyTimeouts: this.surveyTimeouts,\n canShowNextEventBasedSurvey: this.canShowNextEventBasedSurvey,\n handleWidget: this.handleWidget,\n handlePopoverSurvey: this.handlePopoverSurvey,\n handleWidgetSelector: this.handleWidgetSelector,\n sortSurveysByAppearanceDelay: this.sortSurveysByAppearanceDelay,\n }\n }\n}\n\nexport const renderSurveysPreview = ({\n survey,\n parentElement,\n previewPageIndex,\n forceDisableHtml,\n onPreviewSubmit,\n posthog,\n}: {\n survey: Survey\n parentElement: HTMLElement\n previewPageIndex: number\n forceDisableHtml?: boolean\n onPreviewSubmit?: (res: string | string[] | number | null) => void\n posthog?: PostHog\n}) => {\n const stylesheetContent = style(survey.appearance)\n const stylesheet = prepareStylesheet(document, stylesheetContent, posthog)\n\n // Remove previously attached <style>\n Array.from(parentElement.children).forEach((child) => {\n if (child instanceof HTMLStyleElement) {\n parentElement.removeChild(child)\n }\n })\n\n if (stylesheet) {\n parentElement.appendChild(stylesheet)\n }\n\n const textColor = getContrastingTextColor(\n survey.appearance?.backgroundColor || defaultSurveyAppearance.backgroundColor || 'white'\n )\n\n Preact.render(\n <SurveyPopup\n key=\"surveys-render-preview\"\n survey={survey}\n forceDisableHtml={forceDisableHtml}\n style={{\n position: 'relative',\n right: 0,\n borderBottom: `1px solid ${survey.appearance?.borderColor}`,\n borderRadius: 10,\n color: textColor,\n }}\n onPreviewSubmit={onPreviewSubmit}\n previewPageIndex={previewPageIndex}\n removeSurveyFromFocus={() => {}}\n isPopup={true}\n />,\n parentElement\n )\n}\n\nexport const renderFeedbackWidgetPreview = ({\n survey,\n root,\n forceDisableHtml,\n posthog,\n}: {\n survey: Survey\n root: HTMLElement\n forceDisableHtml?: boolean\n posthog?: PostHog\n}) => {\n const stylesheetContent = createWidgetStyle(survey.appearance?.widgetColor)\n const stylesheet = prepareStylesheet(document, stylesheetContent, posthog)\n if (stylesheet) {\n root.appendChild(stylesheet)\n }\n\n Preact.render(\n <FeedbackWidget\n key={'feedback-render-preview'}\n forceDisableHtml={forceDisableHtml}\n survey={survey}\n readOnly={true}\n removeSurveyFromFocus={() => {}}\n />,\n root\n )\n}\n\n// This is the main exported function\nexport function generateSurveys(posthog: PostHog) {\n // NOTE: Important to ensure we never try and run surveys without a window environment\n if (!document || !window) {\n return\n }\n\n const surveyManager = new SurveyManager(posthog)\n surveyManager.callSurveysAndEvaluateDisplayLogic(true)\n\n // recalculate surveys every second to check if URL or selectors have changed\n setInterval(() => {\n surveyManager.callSurveysAndEvaluateDisplayLogic(false)\n }, 1000)\n return surveyManager\n}\n\ntype UseHideSurveyOnURLChangeProps = {\n survey: Pick<Survey, 'id' | 'conditions'>\n removeSurveyFromFocus: (id: string) => void\n setSurveyVisible: (visible: boolean) => void\n isPreviewMode?: boolean\n}\n\n/**\n * This hook handles URL-based survey visibility after the initial mount.\n * The initial URL check is handled by the `getActiveMatchingSurveys` method in the `PostHogSurveys` class,\n * which ensures the URL matches before displaying a survey for the first time.\n * That is the method that is called every second to see if there's a matching survey.\n *\n * This separation of concerns means:\n * 1. Initial URL matching is done by `getActiveMatchingSurveys` before displaying the survey\n * 2. Subsequent URL changes are handled here to hide the survey as the user navigates\n */\nexport function useHideSurveyOnURLChange({\n survey,\n removeSurveyFromFocus,\n setSurveyVisible,\n isPreviewMode = false,\n}: UseHideSurveyOnURLChangeProps) {\n useEffect(() => {\n if (isPreviewMode || !survey.conditions?.url) {\n return\n }\n\n const checkUrlMatch = () => {\n const urlCheck = doesSurveyUrlMatch(survey)\n if (!urlCheck) {\n setSurveyVisible(false)\n return removeSurveyFromFocus(survey.id)\n }\n }\n\n // Listen for browser back/forward browser history changes\n addEventListener(window, 'popstate', checkUrlMatch)\n // Listen for hash changes, for SPA frameworks that use hash-based routing\n // The hashchange event is fired when the fragment identifier of the URL has changed (the part of the URL beginning with and following the # symbol).\n addEventListener(window, 'hashchange', checkUrlMatch)\n\n // Listen for SPA navigation\n const originalPushState = window.history.pushState\n const originalReplaceState = window.history.replaceState\n\n window.history.pushState = function (...args) {\n originalPushState.apply(this, args)\n checkUrlMatch()\n }\n\n window.history.replaceState = function (...args) {\n originalReplaceState.apply(this, args)\n checkUrlMatch()\n }\n\n return () => {\n window.removeEventListener('popstate', checkUrlMatch)\n window.removeEventListener('hashchange', checkUrlMatch)\n window.history.pushState = originalPushState\n window.history.replaceState = originalReplaceState\n }\n }, [isPreviewMode, survey, removeSurveyFromFocus, setSurveyVisible])\n}\n\nexport function usePopupVisibility(\n survey: Survey,\n posthog: PostHog | undefined,\n millisecondDelay: number,\n isPreviewMode: boolean,\n removeSurveyFromFocus: (id: string) => void\n) {\n const [isPopupVisible, setIsPopupVisible] = useState(isPreviewMode || millisecondDelay === 0)\n const [isSurveySent, setIsSurveySent] = useState(false)\n\n useEffect(() => {\n if (!posthog) {\n logger.error('usePopupVisibility hook called without a PostHog instance.')\n return\n }\n if (isPreviewMode) {\n return\n }\n\n const handleSurveyClosed = () => {\n removeSurveyFromFocus(survey.id)\n setIsPopupVisible(false)\n }\n\n const handleSurveySent = () => {\n if (!survey.appearance?.displayThankYouMessage) {\n removeSurveyFromFocus(survey.id)\n setIsPopupVisible(false)\n } else {\n setIsSurveySent(true)\n removeSurveyFromFocus(survey.id)\n if (survey.appearance?.autoDisappear) {\n setTimeout(() => {\n setIsPopupVisible(false)\n }, 5000)\n }\n }\n }\n\n const showSurvey = () => {\n // check if the url is still matching, necessary for delayed surveys, as the URL may have changed\n if (!doesSurveyUrlMatch(survey)) {\n return\n }\n\n setIsPopupVisible(true)\n window.dispatchEvent(new Event('PHSurveyShown'))\n posthog.capture('survey shown', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n $survey_iteration: survey.current_iteration,\n $survey_iteration_start_date: survey.current_iteration_start_date,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n })\n localStorage.setItem('lastSeenSurveyDate', new Date().toISOString())\n setTimeout(() => {\n const inputField = document\n .querySelector(getPosthogWidgetClass(survey.id))\n ?.shadowRoot?.querySelector('textarea, input[type=\"text\"]') as HTMLElement\n if (inputField) {\n inputField.focus()\n }\n }, 100)\n }\n\n addEventListener(window, 'PHSurveyClosed', handleSurveyClosed)\n addEventListener(window, 'PHSurveySent', handleSurveySent)\n\n if (millisecondDelay > 0) {\n // This path is only used for direct usage of SurveyPopup,\n // not for surveys managed by SurveyManager\n const timeoutId = setTimeout(showSurvey, millisecondDelay)\n return () => {\n clearTimeout(timeoutId)\n window.removeEventListener('PHSurveyClosed', handleSurveyClosed)\n window.removeEventListener('PHSurveySent', handleSurveySent)\n }\n } else {\n // This is the path used for surveys managed by SurveyManager\n showSurvey()\n return () => {\n window.removeEventListener('PHSurveyClosed', handleSurveyClosed)\n window.removeEventListener('PHSurveySent', handleSurveySent)\n }\n }\n }, [])\n\n useHideSurveyOnURLChange({\n survey,\n removeSurveyFromFocus,\n setSurveyVisible: setIsPopupVisible,\n isPreviewMode,\n })\n\n return { isPopupVisible, isSurveySent, setIsPopupVisible }\n}\n\ninterface SurveyPopupProps {\n survey: Survey\n forceDisableHtml?: boolean\n posthog?: PostHog\n style?: React.CSSProperties\n previewPageIndex?: number | undefined\n removeSurveyFromFocus: (id: string) => void\n isPopup?: boolean\n onPreviewSubmit?: (res: string | string[] | number | null) => void\n onPopupSurveyDismissed?: () => void\n onCloseConfirmationMessage?: () => void\n}\n\nexport function SurveyPopup({\n survey,\n forceDisableHtml,\n posthog,\n style,\n previewPageIndex,\n removeSurveyFromFocus,\n isPopup,\n onPreviewSubmit = () => {},\n onPopupSurveyDismissed = () => {},\n onCloseConfirmationMessage = () => {},\n}: SurveyPopupProps) {\n const isPreviewMode = Number.isInteger(previewPageIndex)\n // NB: The client-side code passes the millisecondDelay in seconds, but setTimeout expects milliseconds, so we multiply by 1000\n const surveyPopupDelayMilliseconds = survey.appearance?.surveyPopupDelaySeconds\n ? survey.appearance.surveyPopupDelaySeconds * 1000\n : 0\n const { isPopupVisible, isSurveySent, setIsPopupVisible } = usePopupVisibility(\n survey,\n posthog,\n surveyPopupDelayMilliseconds,\n isPreviewMode,\n removeSurveyFromFocus\n )\n const shouldShowConfirmation = isSurveySent || previewPageIndex === survey.questions.length\n const confirmationBoxLeftStyle = style?.left && isNumber(style?.left) ? { left: style.left - 40 } : {}\n\n if (isPreviewMode) {\n style = style || {}\n style.left = 'unset'\n style.right = 'unset'\n style.transform = 'unset'\n }\n\n return isPopupVisible ? (\n <SurveyContext.Provider\n value={{\n isPreviewMode,\n previewPageIndex: previewPageIndex,\n onPopupSurveyDismissed: () => {\n dismissedSurveyEvent(survey, posthog, isPreviewMode)\n onPopupSurveyDismissed()\n },\n isPopup: isPopup || false,\n onPreviewSubmit,\n }}\n >\n {!shouldShowConfirmation ? (\n <Questions\n survey={survey}\n forceDisableHtml={!!forceDisableHtml}\n posthog={posthog}\n styleOverrides={style}\n />\n ) : (\n <ConfirmationMessage\n header={survey.appearance?.thankYouMessageHeader || 'Thank you!'}\n description={survey.appearance?.thankYouMessageDescription || ''}\n forceDisableHtml={!!forceDisableHtml}\n contentType={survey.appearance?.thankYouMessageDescriptionContentType}\n appearance={survey.appearance || defaultSurveyAppearance}\n styleOverrides={{ ...style, ...confirmationBoxLeftStyle }}\n onClose={() => {\n setIsPopupVisible(false)\n onCloseConfirmationMessage()\n }}\n />\n )}\n </SurveyContext.Provider>\n ) : null\n}\n\nexport function Questions({\n survey,\n forceDisableHtml,\n posthog,\n styleOverrides,\n}: {\n survey: Survey\n forceDisableHtml: boolean\n posthog?: PostHog\n styleOverrides?: React.CSSProperties\n}) {\n const textColor = getContrastingTextColor(\n survey.appearance?.backgroundColor || defaultSurveyAppearance.backgroundColor\n )\n const [questionsResponses, setQuestionsResponses] = useState({})\n const { previewPageIndex, onPopupSurveyDismissed, isPopup, onPreviewSubmit } = useContext(SurveyContext)\n const [currentQuestionIndex, setCurrentQuestionIndex] = useState(previewPageIndex || 0)\n const surveyQuestions = useMemo(() => getDisplayOrderQuestions(survey), [survey])\n\n // Sync preview state\n useEffect(() => {\n setCurrentQuestionIndex(previewPageIndex ?? 0)\n }, [previewPageIndex])\n\n const onNextButtonClick = ({\n res,\n displayQuestionIndex,\n questionId,\n }: {\n res: string | string[] | number | null\n displayQuestionIndex: number\n questionId?: string\n }) => {\n if (!posthog) {\n logger.error('onNextButtonClick called without a PostHog instance.')\n return\n }\n\n if (!questionId) {\n logger.error('onNextButtonClick called without a questionId.')\n return\n }\n\n const responseKey = getSurveyResponseKey(questionId)\n\n setQuestionsResponses({ ...questionsResponses, [responseKey]: res })\n\n const nextStep = getNextSurveyStep(survey, displayQuestionIndex, res)\n if (nextStep === SurveyQuestionBranchingType.End) {\n sendSurveyEvent({ ...questionsResponses, [responseKey]: res }, survey, posthog)\n } else {\n setCurrentQuestionIndex(nextStep)\n }\n }\n\n return (\n <form\n className=\"survey-form\"\n style={\n isPopup\n ? {\n color: textColor,\n borderColor: survey.appearance?.borderColor,\n ...styleOverrides,\n }\n : {}\n }\n >\n {surveyQuestions.map((question, displayQuestionIndex) => {\n const isVisible = currentQuestionIndex === displayQuestionIndex\n return (\n isVisible && (\n <div\n className=\"survey-box\"\n style={\n isPopup\n ? {\n backgroundColor:\n survey.appearance?.backgroundColor ||\n defaultSurveyAppearance.backgroundColor,\n }\n : {}\n }\n >\n {isPopup && (\n <Cancel\n onClick={() => {\n onPopupSurveyDismissed()\n }}\n />\n )}\n {getQuestionComponent({\n question,\n forceDisableHtml,\n displayQuestionIndex,\n appearance: survey.appearance || defaultSurveyAppearance,\n onSubmit: (res) =>\n onNextButtonClick({\n res,\n displayQuestionIndex,\n questionId: question.id,\n }),\n onPreviewSubmit,\n })}\n </div>\n )\n )\n })}\n </form>\n )\n}\n\nexport function FeedbackWidget({\n survey,\n forceDisableHtml,\n posthog,\n readOnly,\n removeSurveyFromFocus,\n}: {\n survey: Survey\n forceDisableHtml?: boolean\n posthog?: PostHog\n readOnly?: boolean\n removeSurveyFromFocus: (id: string) => void\n}): JSX.Element | null {\n const [isFeedbackButtonVisible, setIsFeedbackButtonVisible] = useState(true)\n const [showSurvey, setShowSurvey] = useState(false)\n const [styleOverrides, setStyle] = useState({})\n const widgetRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!posthog) {\n logger.error('FeedbackWidget called without a PostHog instance.')\n return\n }\n if (readOnly) {\n return\n }\n\n if (survey.appearance?.widgetType === 'tab') {\n if (widgetRef.current) {\n const widgetPos = widgetRef.current.getBoundingClientRect()\n const style = {\n top: '50%',\n left: parseInt(`${widgetPos.right - 360}`),\n bottom: 'auto',\n borderRadius: 10,\n borderBottom: `1.5px solid ${survey.appearance?.borderColor || '#c9c6c6'}`,\n }\n setStyle(style)\n }\n }\n if (survey.appearance?.widgetType === 'selector') {\n const widget = document.querySelector(survey.appearance.widgetSelector || '') ?? undefined\n\n addEventListener(widget, 'click', (event) => {\n // Calculate position based on the selector button\n const buttonRect = (event.currentTarget as HTMLElement).getBoundingClientRect()\n const viewportHeight = window.innerHeight\n\n // Get survey width from maxWidth or default to 300px\n const surveyWidth = parseInt(survey.appearance?.maxWidth || '300')\n\n // Calculate horizontal center position of the button\n const buttonCenterX = buttonRect.left + buttonRect.width / 2\n\n // Calculate horizontal center position\n let left = buttonCenterX - surveyWidth / 2\n\n // Ensure the survey doesn't go off-screen horizontally\n const rightEdge = left + surveyWidth\n if (rightEdge > window.innerWidth) {\n left = window.innerWidth - surveyWidth - 20 // 20px padding from right edge\n }\n if (left < 20) {\n left = 20 // 20px padding from left edge\n }\n\n // Determine if we should show above or below\n let showAbove = false\n\n // Check if there's enough space below (need at least 300px)\n // If not enough space below, show above\n if (buttonRect.bottom + 300 > viewportHeight) {\n showAbove = true\n }\n\n // Simple spacing between button and survey\n const spacing = 12\n\n // Calculate positions\n let topPosition\n\n if (showAbove) {\n // Problem: When showing above, we're trying to position based on an estimated height,\n // but we don't know the actual height of the survey yet.\n // Solution: Instead of using top positioning for above, use bottom positioning\n // This will anchor the survey to the bottom edge at the button's top position\n topPosition = null // We'll use bottom positioning instead\n } else {\n // When showing below, position the top of the survey below the button plus spacing\n topPosition = buttonRect.bottom + window.scrollY + spacing\n }\n\n // Set style overrides for positioning\n setStyle({\n position: 'fixed',\n top: showAbove ? 'auto' : topPosition + 'px',\n left: left + 'px',\n right: 'auto',\n bottom: showAbove ? window.innerHeight - buttonRect.top + spacing + 'px' : 'auto',\n transform: 'none',\n border: `1.5px solid ${survey.appearance?.borderColor || '#c9c6c6'}`,\n borderRadius: '10px',\n width: `${surveyWidth}px`,\n zIndex: SURVEY_DEFAULT_Z_INDEX,\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n maxHeight: showAbove\n ? `calc(100vh - 40px - ${spacing * 2}px)`\n : `calc(100vh - ${topPosition}px - 20px)`,\n })\n\n setShowSurvey(!showSurvey)\n })\n\n widget?.setAttribute('PHWidgetSurveyClickListener', 'true')\n }\n }, [])\n\n useHideSurveyOnURLChange({\n survey,\n removeSurveyFromFocus,\n setSurveyVisible: setIsFeedbackButtonVisible,\n })\n\n if (!isFeedbackButtonVisible) {\n return null\n }\n\n const resetShowSurvey = () => {\n setShowSurvey(false)\n }\n\n return (\n <Preact.Fragment>\n {survey.appearance?.widgetType === 'tab' && (\n <div\n className=\"ph-survey-widget-tab\"\n ref={widgetRef}\n onClick={() => !readOnly && setShowSurvey(!showSurvey)}\n style={{ color: getContrastingTextColor(survey.appearance.widgetColor) }}\n >\n <div className=\"ph-survey-widget-tab-icon\"></div>\n {survey.appearance?.widgetLabel || ''}\n </div>\n )}\n {showSurvey && (\n <SurveyPopup\n key={'feedback-widget-survey'}\n posthog={posthog}\n survey={survey}\n forceDisableHtml={forceDisableHtml}\n style={styleOverrides}\n removeSurveyFromFocus={removeSurveyFromFocus}\n isPopup={true}\n onPopupSurveyDismissed={resetShowSurvey}\n onCloseConfirmationMessage={resetShowSurvey}\n />\n )}\n </Preact.Fragment>\n )\n}\n\ninterface GetQuestionComponentProps {\n question: SurveyQuestion\n forceDisableHtml: boolean\n displayQuestionIndex: number\n appearance: SurveyAppearance\n onSubmit: (res: string | string[] | number | null) => void\n onPreviewSubmit: (res: string | string[] | number | null) => void\n}\n\nconst getQuestionComponent = ({\n question,\n forceDisableHtml,\n displayQuestionIndex,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: GetQuestionComponentProps): JSX.Element => {\n const questionComponents = {\n [SurveyQuestionType.Open]: OpenTextQuestion,\n [SurveyQuestionType.Link]: LinkQuestion,\n [SurveyQuestionType.Rating]: RatingQuestion,\n [SurveyQuestionType.SingleChoice]: MultipleChoiceQuestion,\n [SurveyQuestionType.MultipleChoice]: MultipleChoiceQuestion,\n }\n\n const commonProps = {\n question,\n forceDisableHtml,\n appearance,\n onPreviewSubmit: (res: string | string[] | number | null) => {\n onPreviewSubmit(res)\n },\n onSubmit: (res: string | string[] | number | null) => {\n onSubmit(res)\n },\n }\n\n const additionalProps: Record<SurveyQuestionType, any> = {\n [SurveyQuestionType.Open]: {},\n [SurveyQuestionType.Link]: {},\n [SurveyQuestionType.Rating]: { displayQuestionIndex },\n [SurveyQuestionType.SingleChoice]: { displayQuestionIndex },\n [SurveyQuestionType.MultipleChoice]: { displayQuestionIndex },\n }\n\n const Component = questionComponents[question.type]\n const componentProps = { ...commonProps, ...additionalProps[question.type] }\n\n return <Component {...componentProps} />\n}\n","import { isFunction, isNull, isObject, isUndefined } from '../../utils/type-utils'\n\nexport function isEvent(candidate: unknown): candidate is Event {\n return !isUndefined(Event) && isInstanceOf(candidate, Event)\n}\n\nexport function isPlainObject(candidate: unknown): candidate is Record<string, unknown> {\n return isBuiltin(candidate, 'Object')\n}\n\nexport function isInstanceOf(candidate: unknown, base: any): boolean {\n try {\n return candidate instanceof base\n } catch {\n return false\n }\n}\n\nexport function isPrimitive(\n candidate: unknown\n): candidate is number | string | boolean | bigint | symbol | null | undefined {\n return isNull(candidate) || (!isObject(candidate) && !isFunction(candidate))\n}\n\nexport function isError(candidate: unknown): candidate is Error {\n switch (Object.prototype.toString.call(candidate)) {\n case '[object Error]':\n case '[object Exception]':\n case '[object DOMException]':\n case '[object DOMError]':\n return true\n default:\n return isInstanceOf(candidate, Error)\n }\n}\n\nexport function isErrorEvent(event: string | Error | Event): event is ErrorEvent {\n return isBuiltin(event, 'ErrorEvent')\n}\n\nexport function isErrorWithStack(candidate: unknown): candidate is Error {\n return 'stack' in (candidate as Error)\n}\n\nexport function isBuiltin(candidate: unknown, className: string): boolean {\n return Object.prototype.toString.call(candidate) === `[object ${className}]`\n}\n\nexport function isDOMException(candidate: unknown): boolean {\n return isBuiltin(candidate, 'DOMException')\n}\n\nexport function isDOMError(candidate: unknown): boolean {\n return isBuiltin(candidate, 'DOMError')\n}\n","import { generateSurveys } from '../extensions/surveys'\n\nimport { assignableWindow } from '../utils/globals'\nimport { canActivateRepeatedly } from '../extensions/surveys/surveys-utils'\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.canActivateRepeatedly = canActivateRepeatedly\nassignableWindow.__PosthogExtensions__.generateSurveys = generateSurveys\n\n// this used to be directly on window, but we moved it to __PosthogExtensions__\n// it is still on window for backwards compatibility\nassignableWindow.extendPostHogWithSurveys = generateSurveys\n\nexport default generateSurveys\n","// copied and adapted from https://github.com/getsentry/sentry-javascript/blob/41fef4b10f3a644179b77985f00f8696c908539f/packages/browser/src/stack-parsers.ts\n// 💖open source\n\n// This was originally forked from https://github.com/csnover/TraceKit, and was largely\n// re-written as part of raven - js.\n//\n// This code was later copied to the JavaScript mono - repo and further modified and\n// refactored over the years.\n\n// Copyright (c) 2013 Onur Can Cakmak onur.cakmak@gmail.com and all TraceKit contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this\n// software and associated documentation files(the 'Software'), to deal in the Software\n// without restriction, including without limitation the rights to use, copy, modify,\n// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to the following\n// conditions:\n//\n// The above copyright notice and this permission notice shall be included in all copies\n// or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE\n// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nimport { isUndefined } from '../../utils/type-utils'\n\nexport type StackParser = (stack: string, skipFirstLines?: number) => StackFrame[]\nexport type StackLineParserFn = (line: string) => StackFrame | undefined\nexport type StackLineParser = [number, StackLineParserFn]\n\nexport interface StackFrame {\n platform: string\n filename?: string\n function?: string\n module?: string\n lineno?: number\n colno?: number\n abs_path?: string\n context_line?: string\n pre_context?: string[]\n post_context?: string[]\n in_app?: boolean\n instruction_addr?: string\n addr_mode?: string\n vars?: { [key: string]: any }\n chunk_id?: string\n}\n\nconst WEBPACK_ERROR_REGEXP = /\\(error: (.*)\\)/\nconst STACKTRACE_FRAME_LIMIT = 50\n\nconst UNKNOWN_FUNCTION = '?'\n\nconst OPERA10_PRIORITY = 10\nconst OPERA11_PRIORITY = 20\nconst CHROME_PRIORITY = 30\nconst WINJS_PRIORITY = 40\nconst GECKO_PRIORITY = 50\n\nfunction createFrame(filename: string, func: string, lineno?: number, colno?: number): StackFrame {\n const frame: StackFrame = {\n platform: 'web:javascript',\n filename,\n function: func === '<anonymous>' ? UNKNOWN_FUNCTION : func,\n in_app: true, // All browser frames are considered in_app\n }\n\n if (!isUndefined(lineno)) {\n frame.lineno = lineno\n }\n\n if (!isUndefined(colno)) {\n frame.colno = colno\n }\n\n return frame\n}\n\n// This regex matches frames that have no function name (ie. are at the top level of a module).\n// For example \"at http://localhost:5000//script.js:1:126\"\n// Frames _with_ function names usually look as follows: \"at commitLayoutEffects (react-dom.development.js:23426:1)\"\nconst chromeRegexNoFnName = /^\\s*at (\\S+?)(?::(\\d+))(?::(\\d+))\\s*$/i\n\n// This regex matches all the frames that have a function name.\nconst chromeRegex =\n /^\\s*at (?:(.+?\\)(?: \\[.+\\])?|.*?) ?\\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\\/)?.*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i\n\nconst chromeEvalRegex = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/\n\n// Chromium based browsers: Chrome, Brave, new Opera, new Edge\n// We cannot call this variable `chrome` because it can conflict with global `chrome` variable in certain environments\n// See: https://github.com/getsentry/sentry-javascript/issues/6880\nconst chromeStackParserFn: StackLineParserFn = (line) => {\n // If the stack line has no function name, we need to parse it differently\n const noFnParts = chromeRegexNoFnName.exec(line) as null | [string, string, string, string]\n\n if (noFnParts) {\n const [, filename, line, col] = noFnParts\n return createFrame(filename, UNKNOWN_FUNCTION, +line, +col)\n }\n\n const parts = chromeRegex.exec(line) as null | [string, string, string, string, string]\n\n if (parts) {\n const isEval = parts[2] && parts[2].indexOf('eval') === 0 // start of line\n\n if (isEval) {\n const subMatch = chromeEvalRegex.exec(parts[2]) as null | [string, string, string, string]\n\n if (subMatch) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = subMatch[1] // url\n parts[3] = subMatch[2] // line\n parts[4] = subMatch[3] // column\n }\n }\n\n // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now\n // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)\n const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2])\n\n return createFrame(filename, func, parts[3] ? +parts[3] : undefined, parts[4] ? +parts[4] : undefined)\n }\n\n return\n}\n\nexport const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chromeStackParserFn]\n\n// gecko regex: `(?:bundle|\\d+\\.js)`: `bundle` is for react native, `\\d+\\.js` also but specifically for ram bundles because it\n// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js\n// We need this specific case for now because we want no other regex to match.\nconst geckoREgex =\n /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)?((?:[-a-z]+)?:\\/.*?|\\[native code\\]|[^@]*(?:bundle|\\d+\\.js)|\\/[\\w\\-. /=]+)(?::(\\d+))?(?::(\\d+))?\\s*$/i\nconst geckoEvalRegex = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i\n\nconst gecko: StackLineParserFn = (line) => {\n const parts = geckoREgex.exec(line) as null | [string, string, string, string, string, string]\n\n if (parts) {\n const isEval = parts[3] && parts[3].indexOf(' > eval') > -1\n if (isEval) {\n const subMatch = geckoEvalRegex.exec(parts[3]) as null | [string, string, string]\n\n if (subMatch) {\n // throw out eval line/column and use top-most line number\n parts[1] = parts[1] || 'eval'\n parts[3] = subMatch[1]\n parts[4] = subMatch[2]\n parts[5] = '' // no column when eval\n }\n }\n\n let filename = parts[3]\n let func = parts[1] || UNKNOWN_FUNCTION\n ;[func, filename] = extractSafariExtensionDetails(func, filename)\n\n return createFrame(filename, func, parts[4] ? +parts[4] : undefined, parts[5] ? +parts[5] : undefined)\n }\n\n return\n}\n\nexport const geckoStackLineParser: StackLineParser = [GECKO_PRIORITY, gecko]\n\nconst winjsRegex = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:[-a-z]+):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i\n\nconst winjs: StackLineParserFn = (line) => {\n const parts = winjsRegex.exec(line) as null | [string, string, string, string, string]\n\n return parts\n ? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)\n : undefined\n}\n\nexport const winjsStackLineParser: StackLineParser = [WINJS_PRIORITY, winjs]\n\nconst opera10Regex = / line (\\d+).*script (?:in )?(\\S+)(?:: in function (\\S+))?$/i\n\nconst opera10: StackLineParserFn = (line) => {\n const parts = opera10Regex.exec(line) as null | [string, string, string, string]\n return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined\n}\n\nexport const opera10StackLineParser: StackLineParser = [OPERA10_PRIORITY, opera10]\n\nconst opera11Regex = / line (\\d+), column (\\d+)\\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\\(.*\\))? in (.*):\\s*$/i\n\nconst opera11: StackLineParserFn = (line) => {\n const parts = opera11Regex.exec(line) as null | [string, string, string, string, string, string]\n return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined\n}\n\nexport const opera11StackLineParser: StackLineParser = [OPERA11_PRIORITY, opera11]\n\nexport const defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser]\n\nexport const defaultStackParser = createStackParser(...defaultStackLineParsers)\n\nexport function reverseAndStripFrames(stack: ReadonlyArray<StackFrame>): StackFrame[] {\n if (!stack.length) {\n return []\n }\n\n const localStack = Array.from(stack)\n\n localStack.reverse()\n\n return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map((frame) => ({\n ...frame,\n filename: frame.filename || getLastStackFrame(localStack).filename,\n function: frame.function || UNKNOWN_FUNCTION,\n }))\n}\n\nfunction getLastStackFrame(arr: StackFrame[]): StackFrame {\n return arr[arr.length - 1] || {}\n}\n\nexport function createStackParser(...parsers: StackLineParser[]): StackParser {\n const sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map((p) => p[1])\n\n return (stack: string, skipFirstLines: number = 0): StackFrame[] => {\n const frames: StackFrame[] = []\n const lines = stack.split('\\n')\n\n for (let i = skipFirstLines; i < lines.length; i++) {\n const line = lines[i] as string\n // Ignore lines over 1kb as they are unlikely to be stack frames.\n // Many of the regular expressions use backtracking which results in run time that increases exponentially with\n // input size. Huge strings can result in hangs/Denial of Service:\n // https://github.com/getsentry/sentry-javascript/issues/2286\n if (line.length > 1024) {\n continue\n }\n\n // https://github.com/getsentry/sentry-javascript/issues/5459\n // Remove webpack (error: *) wrappers\n const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, '$1') : line\n\n // https://github.com/getsentry/sentry-javascript/issues/7813\n // Skip Error: lines\n if (cleanedLine.match(/\\S*Error: /)) {\n continue\n }\n\n for (const parser of sortedParsers) {\n const frame = parser(cleanedLine)\n if (frame) {\n frames.push(frame)\n break\n }\n }\n\n if (frames.length >= STACKTRACE_FRAME_LIMIT) {\n break\n }\n }\n\n return reverseAndStripFrames(frames)\n }\n}\n\n/**\n * Safari web extensions, starting version unknown, can produce \"frames-only\" stacktraces.\n * What it means, is that instead of format like:\n *\n * Error: wat\n * at function@url:row:col\n * at function@url:row:col\n * at function@url:row:col\n *\n * it produces something like:\n *\n * function@url:row:col\n * function@url:row:col\n * function@url:row:col\n *\n * Because of that, it won't be captured by `chrome` RegExp and will fall into `Gecko` branch.\n * This function is extracted so that we can use it in both places without duplicating the logic.\n * Unfortunately \"just\" changing RegExp is too complicated now and making it pass all tests\n * and fix this case seems like an impossible, or at least way too time-consuming task.\n */\nconst extractSafariExtensionDetails = (func: string, filename: string): [string, string] => {\n const isSafariExtension = func.indexOf('safari-extension') !== -1\n const isSafariWebExtension = func.indexOf('safari-web-extension') !== -1\n\n return isSafariExtension || isSafariWebExtension\n ? [\n func.indexOf('@') !== -1 ? (func.split('@')[0] as string) : UNKNOWN_FUNCTION,\n isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`,\n ]\n : [func, filename]\n}\n","import type { StackParser } from './stack-trace'\n\ntype StackString = string\ntype CachedResult = [string, string]\n\ntype ChunkIdMapType = Record<string, string>\n\nlet parsedStackResults: Record<StackString, CachedResult> | undefined\nlet lastKeysCount: number | undefined\nlet cachedFilenameChunkIds: ChunkIdMapType | undefined\n\nexport function getFilenameToChunkIdMap(stackParser: StackParser): ChunkIdMapType {\n const chunkIdMap = (globalThis as any)._posthogChunkIds as ChunkIdMapType | undefined\n if (!chunkIdMap) {\n return {}\n }\n\n const chunkIdKeys = Object.keys(chunkIdMap)\n\n if (cachedFilenameChunkIds && chunkIdKeys.length === lastKeysCount) {\n return cachedFilenameChunkIds\n }\n\n lastKeysCount = chunkIdKeys.length\n\n cachedFilenameChunkIds = chunkIdKeys.reduce<Record<string, string>>((acc, stackKey) => {\n if (!parsedStackResults) {\n parsedStackResults = {}\n }\n\n const result = parsedStackResults[stackKey]\n\n if (result) {\n acc[result[0]] = result[1]\n } else {\n const parsedStack = stackParser(stackKey)\n\n for (let i = parsedStack.length - 1; i >= 0; i--) {\n const stackFrame = parsedStack[i]\n const filename = stackFrame?.filename\n const chunkId = chunkIdMap[stackKey]\n\n if (filename && chunkId) {\n acc[filename] = chunkId\n parsedStackResults[stackKey] = [filename, chunkId]\n break\n }\n }\n }\n\n return acc\n }, {})\n\n return cachedFilenameChunkIds\n}\n","import {\n isDOMError,\n isDOMException,\n isError,\n isErrorEvent,\n isErrorWithStack,\n isEvent,\n isPlainObject,\n isPrimitive,\n} from './type-checking'\nimport { defaultStackParser, StackFrame, StackParser } from './stack-trace'\n\nimport { isEmptyString, isString, isUndefined } from '../../utils/type-utils'\nimport { ErrorConversionArgs, ErrorEventArgs, ErrorMetadata, SeverityLevel, severityLevels } from '../../types'\nimport { getFilenameToChunkIdMap } from './chunk-ids'\n\nexport interface ErrorProperties {\n $exception_list: Exception[]\n $exception_level?: SeverityLevel\n $exception_DOMException_code?: string\n $exception_personURL?: string\n}\n\nexport interface Exception {\n type?: string\n value?: string\n mechanism?: {\n /**\n * In theory, whether or not the exception has been handled by the user. In practice, whether or not we see it before\n * it hits the global error/rejection handlers, whether through explicit handling by the user or auto instrumentation.\n */\n handled?: boolean\n type?: string\n source?: string\n /**\n * True when `captureException` is called with anything other than an instance of `Error` (or, in the case of browser,\n * an instance of `ErrorEvent`, `DOMError`, or `DOMException`). causing us to create a synthetic error in an attempt\n * to recreate the stacktrace.\n */\n synthetic?: boolean\n }\n module?: string\n thread_id?: number\n stacktrace?: {\n frames?: StackFrame[]\n type: 'raw'\n }\n}\n\nexport interface ErrorConversions {\n errorToProperties: (args: ErrorEventArgs, metadata?: ErrorMetadata) => ErrorProperties\n unhandledRejectionToProperties: (args: [ev: PromiseRejectionEvent]) => ErrorProperties\n}\n/**\n * based on the very wonderful MIT licensed Sentry SDK\n */\n\nconst ERROR_TYPES_PATTERN =\n /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i\n\nexport function parseStackFrames(ex: Error & { stacktrace?: string }, framesToPop: number = 0): StackFrame[] {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace || ex.stack || ''\n\n const skipLines = getSkipFirstStackStringLines(ex)\n\n try {\n const parser = defaultStackParser\n const frames = applyChunkIds(parser(stacktrace, skipLines), parser)\n // frames are reversed so we remove the from the back of the array\n return frames.slice(0, frames.length - framesToPop)\n } catch {\n // no-empty\n }\n\n return []\n}\n\nexport function applyChunkIds(frames: StackFrame[], parser: StackParser): StackFrame[] {\n const filenameDebugIdMap = getFilenameToChunkIdMap(parser)\n\n frames.forEach((frame) => {\n if (frame.filename) {\n frame.chunk_id = filenameDebugIdMap[frame.filename]\n }\n })\n\n return frames\n}\n\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i\n\n/**\n * Certain known React errors contain links that would be falsely\n * parsed as frames. This function check for these errors and\n * returns number of the stack string lines to skip.\n */\nfunction getSkipFirstStackStringLines(ex: Error): number {\n if (ex && reactMinifiedRegexp.test(ex.message)) {\n return 1\n }\n\n return 0\n}\n\nfunction errorPropertiesFromError(error: Error, metadata?: ErrorMetadata): ErrorProperties {\n const frames = parseStackFrames(error)\n\n const handled = metadata?.handled ?? true\n const synthetic = metadata?.synthetic ?? false\n\n const exceptionType = metadata?.overrideExceptionType ? metadata.overrideExceptionType : error.name\n const exceptionMessage = metadata?.overrideExceptionMessage\n ? metadata.overrideExceptionMessage\n : extractMessage(error)\n\n return {\n $exception_list: [\n {\n type: exceptionType,\n value: exceptionMessage,\n stacktrace: {\n frames,\n type: 'raw',\n },\n mechanism: {\n handled,\n synthetic,\n },\n },\n ],\n $exception_level: 'error',\n }\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\nexport function extractMessage(err: Error & { message: { error?: Error } }): string {\n const message = err.message\n\n if (message.error && typeof message.error.message === 'string') {\n return message.error.message\n }\n\n return message\n}\n\nfunction errorPropertiesFromString(candidate: string, metadata?: ErrorMetadata): ErrorProperties {\n // Defaults for metadata are based on what the error candidate is.\n const handled = metadata?.handled ?? true\n const synthetic = metadata?.synthetic ?? true\n\n const exceptionType = metadata?.overrideExceptionType\n ? metadata.overrideExceptionType\n : (metadata?.defaultExceptionType ?? 'Error')\n const exceptionMessage = metadata?.overrideExceptionMessage\n ? metadata.overrideExceptionMessage\n : candidate\n ? candidate\n : metadata?.defaultExceptionMessage\n\n const exception: Exception = {\n type: exceptionType,\n value: exceptionMessage,\n mechanism: {\n handled,\n synthetic,\n },\n }\n\n if (metadata?.syntheticException) {\n // Kludge: strip the last frame from a synthetically created error\n // so that it does not appear in a users stack trace\n const frames = parseStackFrames(metadata.syntheticException, 1)\n if (frames.length) {\n exception.stacktrace = { frames, type: 'raw' }\n }\n }\n\n return {\n $exception_list: [exception],\n $exception_level: 'error',\n }\n}\n\n/**\n * Given any captured exception, extract its keys and create a sorted\n * and truncated list that will be used inside the event message.\n * eg. `Non-error exception captured with keys: foo, bar, baz`\n */\nfunction extractExceptionKeysForMessage(exception: Record<string, unknown>, maxLength = 40): string {\n const keys = Object.keys(exception)\n keys.sort()\n\n if (!keys.length) {\n return '[object has no keys]'\n }\n\n for (let i = keys.length; i > 0; i--) {\n const serialized = keys.slice(0, i).join(', ')\n if (serialized.length > maxLength) {\n continue\n }\n if (i === keys.length) {\n return serialized\n }\n return serialized.length <= maxLength ? serialized : `${serialized.slice(0, maxLength)}...`\n }\n\n return ''\n}\n\nfunction isSeverityLevel(x: unknown): x is SeverityLevel {\n return isString(x) && !isEmptyString(x) && severityLevels.indexOf(x as SeverityLevel) >= 0\n}\n\nfunction errorPropertiesFromObject(candidate: Record<string, unknown>, metadata?: ErrorMetadata): ErrorProperties {\n // Defaults for metadata are based on what the error candidate is.\n const handled = metadata?.handled ?? true\n const synthetic = metadata?.synthetic ?? true\n\n const exceptionType = metadata?.overrideExceptionType\n ? metadata.overrideExceptionType\n : isEvent(candidate)\n ? candidate.constructor.name\n : 'Error'\n const exceptionMessage = metadata?.overrideExceptionMessage\n ? metadata.overrideExceptionMessage\n : `Non-Error ${'exception'} captured with keys: ${extractExceptionKeysForMessage(candidate)}`\n\n const exception: Exception = {\n type: exceptionType,\n value: exceptionMessage,\n mechanism: {\n handled,\n synthetic,\n },\n }\n\n if (metadata?.syntheticException) {\n // Kludge: strip the last frame from a synthetically created error\n // so that it does not appear in a users stack trace\n const frames = parseStackFrames(metadata?.syntheticException, 1)\n if (frames.length) {\n exception.stacktrace = { frames, type: 'raw' }\n }\n }\n\n return {\n $exception_list: [exception],\n $exception_level: isSeverityLevel(candidate.level) ? candidate.level : 'error',\n }\n}\n\nexport function errorToProperties({ error, event }: ErrorConversionArgs, metadata?: ErrorMetadata): ErrorProperties {\n let errorProperties: ErrorProperties = { $exception_list: [] }\n\n const candidate = error || event\n\n if (isDOMError(candidate) || isDOMException(candidate)) {\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n\n const domException = candidate as unknown as DOMException\n\n if (isErrorWithStack(candidate)) {\n errorProperties = errorPropertiesFromError(candidate as Error, metadata)\n } else {\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException')\n const message = domException.message ? `${name}: ${domException.message}` : name\n const exceptionType = isDOMError(domException) ? 'DOMError' : 'DOMException'\n errorProperties = errorPropertiesFromString(message, {\n ...metadata,\n overrideExceptionType: exceptionType,\n defaultExceptionMessage: message,\n })\n }\n if ('code' in domException) {\n errorProperties['$exception_DOMException_code'] = `${domException.code}`\n }\n return errorProperties\n } else if (isErrorEvent(candidate as ErrorEvent) && (candidate as ErrorEvent).error) {\n return errorPropertiesFromError((candidate as ErrorEvent).error as Error, metadata)\n } else if (isError(candidate)) {\n return errorPropertiesFromError(candidate, metadata)\n } else if (isPlainObject(candidate) || isEvent(candidate)) {\n // group these by using the keys available on the object\n const objectException = candidate as Record<string, unknown>\n return errorPropertiesFromObject(objectException, metadata)\n } else if (isUndefined(error) && isString(event)) {\n let name = 'Error'\n let message = event\n const groups = event.match(ERROR_TYPES_PATTERN)\n if (groups) {\n name = groups[1]\n message = groups[2]\n }\n\n return errorPropertiesFromString(message, {\n ...metadata,\n overrideExceptionType: name,\n defaultExceptionMessage: message,\n })\n } else {\n return errorPropertiesFromString(candidate as string, metadata)\n }\n}\n\nexport function unhandledRejectionToProperties([ev]: [ev: PromiseRejectionEvent]): ErrorProperties {\n const error = getUnhandledRejectionError(ev)\n\n if (isPrimitive(error)) {\n return errorPropertiesFromString(`Non-Error promise rejection captured with value: ${String(error)}`, {\n handled: false,\n synthetic: false,\n overrideExceptionType: 'UnhandledRejection',\n })\n }\n\n return errorToProperties(\n { event: error as string | Event },\n {\n handled: false,\n overrideExceptionType: 'UnhandledRejection',\n defaultExceptionMessage: String(error),\n }\n )\n}\n\nfunction getUnhandledRejectionError(error: unknown): unknown {\n if (isPrimitive(error)) {\n return error\n }\n\n // dig the object of the rejection out of known event types\n try {\n type ErrorWithReason = { reason: unknown }\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in (error as ErrorWithReason)) {\n return (error as ErrorWithReason).reason\n }\n\n type CustomEventWithDetail = { detail: { reason: unknown } }\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n if ('detail' in (error as CustomEventWithDetail) && 'reason' in (error as CustomEventWithDetail).detail) {\n return (error as CustomEventWithDetail).detail.reason\n }\n } catch {\n // no-empty\n }\n\n return error\n}\n","import { errorToProperties, unhandledRejectionToProperties } from '../extensions/exception-autocapture/error-conversion'\nimport { assignableWindow, window } from '../utils/globals'\nimport { ErrorEventArgs, Properties } from '../types'\nimport { createLogger } from '../utils/logger'\n\nconst logger = createLogger('[ExceptionAutocapture]')\n\nconst wrapOnError = (captureFn: (props: Properties) => void) => {\n const win = window as any\n if (!win) {\n logger.info('window not available, cannot wrap onerror')\n }\n const originalOnError = win.onerror\n\n win.onerror = function (...args: ErrorEventArgs): boolean {\n const errorProperties = errorToProperties({ event: args[0], error: args[4] })\n captureFn(errorProperties)\n return originalOnError?.(...args) ?? false\n }\n win.onerror.__POSTHOG_INSTRUMENTED__ = true\n\n return () => {\n delete win.onerror?.__POSTHOG_INSTRUMENTED__\n win.onerror = originalOnError\n }\n}\n\nconst wrapUnhandledRejection = (captureFn: (props: Properties) => void) => {\n const win = window as any\n if (!win) {\n logger.info('window not available, cannot wrap onUnhandledRejection')\n }\n\n const originalOnUnhandledRejection = win.onunhandledrejection\n\n win.onunhandledrejection = function (...args: [ev: PromiseRejectionEvent]): boolean {\n const errorProperties = unhandledRejectionToProperties(args)\n captureFn(errorProperties)\n return originalOnUnhandledRejection?.apply(win, args) ?? false\n }\n win.onunhandledrejection.__POSTHOG_INSTRUMENTED__ = true\n\n return () => {\n delete win.onunhandledrejection?.__POSTHOG_INSTRUMENTED__\n win.onunhandledrejection = originalOnUnhandledRejection\n }\n}\n\nconst posthogErrorWrappingFunctions = {\n wrapOnError,\n wrapUnhandledRejection,\n}\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.errorWrappingFunctions = posthogErrorWrappingFunctions\nassignableWindow.__PosthogExtensions__.parseErrorAsProperties = errorToProperties\n\n// we used to put these on window, and now we put them on __PosthogExtensions__\n// but that means that old clients which lazily load this extension are looking in the wrong place\n// yuck,\n// so we also put them directly on the window\n// when 1.161.1 is the oldest version seen in production we can remove this\nassignableWindow.posthogErrorWrappingFunctions = posthogErrorWrappingFunctions\nassignableWindow.parseErrorAsProperties = errorToProperties\n\nexport default posthogErrorWrappingFunctions\n","import { SessionIdManager } from '../sessionid'\nimport { patch } from '../extensions/replay/rrweb-plugins/patch'\nimport { assignableWindow, window } from '../utils/globals'\n\nconst addTracingHeaders = (sessionManager: SessionIdManager | undefined, req: Request) => {\n if (sessionManager) {\n const { sessionId, windowId } = sessionManager.checkAndGetSessionAndWindowId(true)\n req.headers.set('X-POSTHOG-SESSION-ID', sessionId)\n req.headers.set('X-POSTHOG-WINDOW-ID', windowId)\n }\n}\n\nconst patchFetch = (sessionManager?: SessionIdManager): (() => void) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return patch(window, 'fetch', (originalFetch: typeof fetch) => {\n return async function (url: URL | RequestInfo, init?: RequestInit | undefined) {\n // check IE earlier than this, we only initialize if Request is present\n // eslint-disable-next-line compat/compat\n const req = new Request(url, init)\n\n addTracingHeaders(sessionManager, req)\n\n return originalFetch(req)\n }\n })\n}\n\nconst patchXHR = (sessionManager?: SessionIdManager): (() => void) => {\n return patch(\n // we can assert this is present because we've checked previously\n window!.XMLHttpRequest.prototype,\n 'open',\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (originalOpen: typeof XMLHttpRequest.prototype.open) => {\n return function (\n method: string,\n url: string | URL,\n async = true,\n username?: string | null,\n password?: string | null\n ) {\n // because this function is returned in its actual context `this` _is_ an XMLHttpRequest\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const xhr = this as XMLHttpRequest\n\n // check IE earlier than this, we only initialize if Request is present\n // eslint-disable-next-line compat/compat\n const req = new Request(url)\n\n addTracingHeaders(sessionManager, req)\n\n return originalOpen.call(xhr, method, req.url, async, username, password)\n }\n }\n )\n}\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nconst patchFns = {\n _patchFetch: patchFetch,\n _patchXHR: patchXHR,\n}\nassignableWindow.__PosthogExtensions__.tracingHeadersPatchFns = patchFns\n\n// we used to put tracingHeadersPatchFns on window, and now we put it on __PosthogExtensions__\n// but that means that old clients which lazily load this extension are looking in the wrong place\n// yuck,\n// so we also put it directly on the window\n// when 1.161.1 is the oldest version seen in production we can remove this\nassignableWindow.postHogTracingHeadersPatchFns = patchFns\n\nexport default patchFns\n","var t,e,n=function(){var t=self.performance&&performance.getEntriesByType&&performance.getEntriesByType(\"navigation\")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},r=function(t){if(\"loading\"===document.readyState)return\"loading\";var e=n();if(e){if(t<e.domInteractive)return\"loading\";if(0===e.domContentLoadedEventStart||t<e.domContentLoadedEventStart)return\"dom-interactive\";if(0===e.domComplete||t<e.domComplete)return\"dom-content-loaded\"}return\"complete\"},i=function(t){var e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,\"\")},a=function(t,e){var n=\"\";try{for(;t&&9!==t.nodeType;){var r=t,a=r.id?\"#\"+r.id:i(r)+(r.classList&&r.classList.value&&r.classList.value.trim()&&r.classList.value.trim().length?\".\"+r.classList.value.trim().replace(/\\s+/g,\".\"):\"\");if(n.length+a.length>(e||100)-1)return n||a;if(n=n?a+\">\"+n:a,r.id)break;t=r.parentNode}}catch(t){}return n},o=-1,c=function(){return o},u=function(t){addEventListener(\"pageshow\",(function(e){e.persisted&&(o=e.timeStamp,t(e))}),!0)},s=function(){var t=n();return t&&t.activationStart||0},f=function(t,e){var r=n(),i=\"navigate\";c()>=0?i=\"back-forward-cache\":r&&(document.prerendering||s()>0?i=\"prerender\":document.wasDiscarded?i=\"restore\":r.type&&(i=r.type.replace(/_/g,\"-\")));return{name:t,value:void 0===e?-1:e,rating:\"good\",delta:0,entries:[],id:\"v4-\".concat(Date.now(),\"-\").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},d=function(t,e,n){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var r=new PerformanceObserver((function(t){Promise.resolve().then((function(){e(t.getEntries())}))}));return r.observe(Object.assign({type:t,buffered:!0},n||{})),r}}catch(t){}},l=function(t,e,n,r){var i,a;return function(o){e.value>=0&&(o||r)&&((a=e.value-(i||0))||void 0===i)&&(i=e.value,e.delta=a,e.rating=function(t,e){return t>e[1]?\"poor\":t>e[0]?\"needs-improvement\":\"good\"}(e.value,n),t(e))}},m=function(t){requestAnimationFrame((function(){return requestAnimationFrame((function(){return t()}))}))},p=function(t){document.addEventListener(\"visibilitychange\",(function(){\"hidden\"===document.visibilityState&&t()}))},v=function(t){var e=!1;return function(){e||(t(),e=!0)}},g=-1,h=function(){return\"hidden\"!==document.visibilityState||document.prerendering?1/0:0},T=function(t){\"hidden\"===document.visibilityState&&g>-1&&(g=\"visibilitychange\"===t.type?t.timeStamp:0,E())},y=function(){addEventListener(\"visibilitychange\",T,!0),addEventListener(\"prerenderingchange\",T,!0)},E=function(){removeEventListener(\"visibilitychange\",T,!0),removeEventListener(\"prerenderingchange\",T,!0)},S=function(){return g<0&&(g=h(),y(),u((function(){setTimeout((function(){g=h(),y()}),0)}))),{get firstHiddenTime(){return g}}},b=function(t){document.prerendering?addEventListener(\"prerenderingchange\",(function(){return t()}),!0):t()},L=[1800,3e3],C=function(t,e){e=e||{},b((function(){var n,r=S(),i=f(\"FCP\"),a=d(\"paint\",(function(t){t.forEach((function(t){\"first-contentful-paint\"===t.name&&(a.disconnect(),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-s(),0),i.entries.push(t),n(!0)))}))}));a&&(n=l(t,i,L,e.reportAllChanges),u((function(r){i=f(\"FCP\"),n=l(t,i,L,e.reportAllChanges),m((function(){i.value=performance.now()-r.timeStamp,n(!0)}))})))}))},M=[.1,.25],D=function(t,e){!function(t,e){e=e||{},C(v((function(){var n,r=f(\"CLS\",0),i=0,a=[],o=function(t){t.forEach((function(t){if(!t.hadRecentInput){var e=a[0],n=a[a.length-1];i&&t.startTime-n.startTime<1e3&&t.startTime-e.startTime<5e3?(i+=t.value,a.push(t)):(i=t.value,a=[t])}})),i>r.value&&(r.value=i,r.entries=a,n())},c=d(\"layout-shift\",o);c&&(n=l(t,r,M,e.reportAllChanges),p((function(){o(c.takeRecords()),n(!0)})),u((function(){i=0,r=f(\"CLS\",0),n=l(t,r,M,e.reportAllChanges),m((function(){return n()}))})),setTimeout(n,0))})))}((function(e){var n=function(t){var e,n={};if(t.entries.length){var i=t.entries.reduce((function(t,e){return t&&t.value>e.value?t:e}));if(i&&i.sources&&i.sources.length){var o=(e=i.sources).find((function(t){return t.node&&1===t.node.nodeType}))||e[0];o&&(n={largestShiftTarget:a(o.node),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:o,largestShiftEntry:i,loadState:r(i.startTime)})}}return Object.assign(t,{attribution:n})}(e);t(n)}),e)},w=function(t,e){C((function(e){var i=function(t){var e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:r(c())};if(t.entries.length){var i=n(),a=t.entries[t.entries.length-1];if(i){var o=i.activationStart||0,u=Math.max(0,i.responseStart-o);e={timeToFirstByte:u,firstByteToFCP:t.value-u,loadState:r(t.entries[0].startTime),navigationEntry:i,fcpEntry:a}}}return Object.assign(t,{attribution:e})}(e);t(i)}),e)},x=0,I=1/0,k=0,A=function(t){t.forEach((function(t){t.interactionId&&(I=Math.min(I,t.interactionId),k=Math.max(k,t.interactionId),x=k?(k-I)/7+1:0)}))},F=function(){return t?x:performance.interactionCount||0},P=function(){\"interactionCount\"in performance||t||(t=d(\"event\",A,{type:\"event\",buffered:!0,durationThreshold:0}))},B=[],O=new Map,R=0,j=function(){var t=Math.min(B.length-1,Math.floor((F()-R)/50));return B[t]},q=[],H=function(t){if(q.forEach((function(e){return e(t)})),t.interactionId||\"first-input\"===t.entryType){var e=B[B.length-1],n=O.get(t.interactionId);if(n||B.length<10||t.duration>e.latency){if(n)t.duration>n.latency?(n.entries=[t],n.latency=t.duration):t.duration===n.latency&&t.startTime===n.entries[0].startTime&&n.entries.push(t);else{var r={id:t.interactionId,latency:t.duration,entries:[t]};O.set(r.id,r),B.push(r)}B.sort((function(t,e){return e.latency-t.latency})),B.length>10&&B.splice(10).forEach((function(t){return O.delete(t.id)}))}}},N=function(t){var e=self.requestIdleCallback||self.setTimeout,n=-1;return t=v(t),\"hidden\"===document.visibilityState?t():(n=e(t),p(t)),n},W=[200,500],z=function(t,e){\"PerformanceEventTiming\"in self&&\"interactionId\"in PerformanceEventTiming.prototype&&(e=e||{},b((function(){var n;P();var r,i=f(\"INP\"),a=function(t){N((function(){t.forEach(H);var e=j();e&&e.latency!==i.value&&(i.value=e.latency,i.entries=e.entries,r())}))},o=d(\"event\",a,{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40});r=l(t,i,W,e.reportAllChanges),o&&(o.observe({type:\"first-input\",buffered:!0}),p((function(){a(o.takeRecords()),r(!0)})),u((function(){R=F(),B.length=0,O.clear(),i=f(\"INP\"),r=l(t,i,W,e.reportAllChanges)})))})))},U=[],V=[],_=0,G=new WeakMap,J=new Map,K=-1,Q=function(t){U=U.concat(t),X()},X=function(){K<0&&(K=N(Y))},Y=function(){J.size>10&&J.forEach((function(t,e){O.has(e)||J.delete(e)}));var t=B.map((function(t){return G.get(t.entries[0])})),e=V.length-50;V=V.filter((function(n,r){return r>=e||t.includes(n)}));for(var n=new Set,r=0;r<V.length;r++){var i=V[r];nt(i.startTime,i.processingEnd).forEach((function(t){n.add(t)}))}var a=U.length-1-50;U=U.filter((function(t,e){return t.startTime>_&&e>a||n.has(t)})),K=-1};q.push((function(t){t.interactionId&&t.target&&!J.has(t.interactionId)&&J.set(t.interactionId,t.target)}),(function(t){var e,n=t.startTime+t.duration;_=Math.max(_,t.processingEnd);for(var r=V.length-1;r>=0;r--){var i=V[r];if(Math.abs(n-i.renderTime)<=8){(e=i).startTime=Math.min(t.startTime,e.startTime),e.processingStart=Math.min(t.processingStart,e.processingStart),e.processingEnd=Math.max(t.processingEnd,e.processingEnd),e.entries.push(t);break}}e||(e={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:n,entries:[t]},V.push(e)),(t.interactionId||\"first-input\"===t.entryType)&&G.set(t,e),X()}));var Z,$,tt,et,nt=function(t,e){for(var n,r=[],i=0;n=U[i];i++)if(!(n.startTime+n.duration<t)){if(n.startTime>e)break;r.push(n)}return r},rt=function(t,n){e||(e=d(\"long-animation-frame\",Q)),z((function(e){var n=function(t){var e=t.entries[0],n=G.get(e),i=e.processingStart,o=n.processingEnd,c=n.entries.sort((function(t,e){return t.processingStart-e.processingStart})),u=nt(e.startTime,o),s=t.entries.find((function(t){return t.target})),f=s&&s.target||J.get(e.interactionId),d=[e.startTime+e.duration,o].concat(u.map((function(t){return t.startTime+t.duration}))),l=Math.max.apply(Math,d),m={interactionTarget:a(f),interactionTargetElement:f,interactionType:e.name.startsWith(\"key\")?\"keyboard\":\"pointer\",interactionTime:e.startTime,nextPaintTime:l,processedEventEntries:c,longAnimationFrameEntries:u,inputDelay:i-e.startTime,processingDuration:o-i,presentationDelay:Math.max(l-o,0),loadState:r(e.startTime)};return Object.assign(t,{attribution:m})}(e);t(n)}),n)},it=[2500,4e3],at={},ot=function(t,e){!function(t,e){e=e||{},b((function(){var n,r=S(),i=f(\"LCP\"),a=function(t){e.reportAllChanges||(t=t.slice(-1)),t.forEach((function(t){t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-s(),0),i.entries=[t],n())}))},o=d(\"largest-contentful-paint\",a);if(o){n=l(t,i,it,e.reportAllChanges);var c=v((function(){at[i.id]||(a(o.takeRecords()),o.disconnect(),at[i.id]=!0,n(!0))}));[\"keydown\",\"click\"].forEach((function(t){addEventListener(t,(function(){return N(c)}),{once:!0,capture:!0})})),p(c),u((function(r){i=f(\"LCP\"),n=l(t,i,it,e.reportAllChanges),m((function(){i.value=performance.now()-r.timeStamp,at[i.id]=!0,n(!0)}))}))}}))}((function(e){var r=function(t){var e={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:t.value};if(t.entries.length){var r=n();if(r){var i=r.activationStart||0,o=t.entries[t.entries.length-1],c=o.url&&performance.getEntriesByType(\"resource\").filter((function(t){return t.name===o.url}))[0],u=Math.max(0,r.responseStart-i),s=Math.max(u,c?(c.requestStart||c.startTime)-i:0),f=Math.max(s,c?c.responseEnd-i:0),d=Math.max(f,o.startTime-i);e={element:a(o.element),timeToFirstByte:u,resourceLoadDelay:s-u,resourceLoadDuration:f-s,elementRenderDelay:d-f,navigationEntry:r,lcpEntry:o},o.url&&(e.url=o.url),c&&(e.lcpResourceEntry=c)}}return Object.assign(t,{attribution:e})}(e);t(r)}),e)},ct=[800,1800],ut=function t(e){document.prerendering?b((function(){return t(e)})):\"complete\"!==document.readyState?addEventListener(\"load\",(function(){return t(e)}),!0):setTimeout(e,0)},st=function(t,e){e=e||{};var r=f(\"TTFB\"),i=l(t,r,ct,e.reportAllChanges);ut((function(){var a=n();a&&(r.value=Math.max(a.responseStart-s(),0),r.entries=[a],i(!0),u((function(){r=f(\"TTFB\",0),(i=l(t,r,ct,e.reportAllChanges))(!0)})))}))},ft=function(t,e){st((function(e){var n=function(t){var e={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(t.entries.length){var n=t.entries[0],r=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart)-r,0),a=Math.max(n.domainLookupStart-r,0),o=Math.max(n.connectStart-r,0),c=Math.max(n.connectEnd-r,0);e={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:c-o,requestDuration:t.value-c,navigationEntry:n}}return Object.assign(t,{attribution:e})}(e);t(n)}),e)},dt={passive:!0,capture:!0},lt=new Date,mt=function(t,e){Z||(Z=e,$=t,tt=new Date,gt(removeEventListener),pt())},pt=function(){if($>=0&&$<tt-lt){var t={entryType:\"first-input\",name:Z.type,target:Z.target,cancelable:Z.cancelable,startTime:Z.timeStamp,processingStart:Z.timeStamp+$};et.forEach((function(e){e(t)})),et=[]}},vt=function(t){if(t.cancelable){var e=(t.timeStamp>1e12?new Date:performance.now())-t.timeStamp;\"pointerdown\"==t.type?function(t,e){var n=function(){mt(t,e),i()},r=function(){i()},i=function(){removeEventListener(\"pointerup\",n,dt),removeEventListener(\"pointercancel\",r,dt)};addEventListener(\"pointerup\",n,dt),addEventListener(\"pointercancel\",r,dt)}(e,t):mt(e,t)}},gt=function(t){[\"mousedown\",\"keydown\",\"touchstart\",\"pointerdown\"].forEach((function(e){return t(e,vt,dt)}))},ht=[100,300],Tt=function(t,e){e=e||{},b((function(){var n,r=S(),i=f(\"FID\"),a=function(t){t.startTime<r.firstHiddenTime&&(i.value=t.processingStart-t.startTime,i.entries.push(t),n(!0))},o=function(t){t.forEach(a)},c=d(\"first-input\",o);n=l(t,i,ht,e.reportAllChanges),c&&(p(v((function(){o(c.takeRecords()),c.disconnect()}))),u((function(){var r;i=f(\"FID\"),n=l(t,i,ht,e.reportAllChanges),et=[],$=-1,Z=null,gt(addEventListener),r=a,et.push(r),pt()})))}))},yt=function(t,e){Tt((function(e){var n=function(t){var e=t.entries[0],n={eventTarget:a(e.target),eventType:e.name,eventTime:e.startTime,eventEntry:e,loadState:r(e.startTime)};return Object.assign(t,{attribution:n})}(e);t(n)}),e)};export{M as CLSThresholds,L as FCPThresholds,ht as FIDThresholds,W as INPThresholds,it as LCPThresholds,ct as TTFBThresholds,D as onCLS,w as onFCP,yt as onFID,rt as onINP,ot as onLCP,ft as onTTFB};\n","import { onINP, onLCP, onCLS, onFCP } from 'web-vitals/attribution'\nimport { assignableWindow } from '../utils/globals'\n\nconst postHogWebVitalsCallbacks = {\n onLCP,\n onCLS,\n onFCP,\n onINP,\n}\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.postHogWebVitalsCallbacks = postHogWebVitalsCallbacks\n\n// we used to put posthogWebVitalsCallbacks on window, and now we put it on __PosthogExtensions__\n// but that means that old clients which lazily load this extension are looking in the wrong place\n// yuck,\n// so we also put it directly on the window\n// when 1.161.1 is the oldest version seen in production we can remove this\nassignableWindow.postHogWebVitalsCallbacks = postHogWebVitalsCallbacks\n\nexport default postHogWebVitalsCallbacks\n","import { addEventListener, each, extend } from './utils'\nimport {\n autocaptureCompatibleElements,\n getClassNames,\n getDirectAndNestedSpanText,\n getElementsChainString,\n getEventTarget,\n getSafeText,\n isAngularStyleAttr,\n isSensitiveElement,\n makeSafeText,\n shouldCaptureDomEvent,\n shouldCaptureElement,\n shouldCaptureValue,\n splitClassString,\n} from './autocapture-utils'\nimport RageClick from './extensions/rageclick'\nimport { AutocaptureConfig, COPY_AUTOCAPTURE_EVENT, EventName, Properties, RemoteConfig } from './types'\nimport { PostHog } from './posthog-core'\nimport { AUTOCAPTURE_DISABLED_SERVER_SIDE } from './constants'\n\nimport { isBoolean, isFunction, isNull, isObject } from './utils/type-utils'\nimport { createLogger } from './utils/logger'\nimport { document, window } from './utils/globals'\nimport { convertToURL } from './utils/request-utils'\nimport { isDocumentFragment, isElementNode, isTag, isTextNode } from './utils/element-utils'\nimport { includes } from './utils/string-utils'\n\nconst logger = createLogger('[AutoCapture]')\n\nfunction limitText(length: number, text: string): string {\n if (text.length > length) {\n return text.slice(0, length) + '...'\n }\n return text\n}\n\nexport function getAugmentPropertiesFromElement(elem: Element): Properties {\n const shouldCaptureEl = shouldCaptureElement(elem)\n if (!shouldCaptureEl) {\n return {}\n }\n\n const props: Properties = {}\n\n each(elem.attributes, function (attr: Attr) {\n if (attr.name && attr.name.indexOf('data-ph-capture-attribute') === 0) {\n const propertyKey = attr.name.replace('data-ph-capture-attribute-', '')\n const propertyValue = attr.value\n if (propertyKey && propertyValue && shouldCaptureValue(propertyValue)) {\n props[propertyKey] = propertyValue\n }\n }\n })\n\n return props\n}\n\nexport function previousElementSibling(el: Element): Element | null {\n if (el.previousElementSibling) {\n return el.previousElementSibling\n }\n let _el: Element | null = el\n do {\n _el = _el.previousSibling as Element | null // resolves to ChildNode->Node, which is Element's parent class\n } while (_el && !isElementNode(_el))\n return _el\n}\n\nexport function getDefaultProperties(eventType: string): Properties {\n return {\n $event_type: eventType,\n $ce_version: 1,\n }\n}\n\nexport function getPropertiesFromElement(\n elem: Element,\n maskAllAttributes: boolean,\n maskText: boolean,\n elementAttributeIgnorelist: string[] | undefined\n): Properties {\n const tag_name = elem.tagName.toLowerCase()\n const props: Properties = {\n tag_name: tag_name,\n }\n if (autocaptureCompatibleElements.indexOf(tag_name) > -1 && !maskText) {\n if (tag_name.toLowerCase() === 'a' || tag_name.toLowerCase() === 'button') {\n props['$el_text'] = limitText(1024, getDirectAndNestedSpanText(elem))\n } else {\n props['$el_text'] = limitText(1024, getSafeText(elem))\n }\n }\n\n const classes = getClassNames(elem)\n if (classes.length > 0)\n props['classes'] = classes.filter(function (c) {\n return c !== ''\n })\n\n // capture the deny list here because this not-a-class class makes it tricky to use this.config in the function below\n each(elem.attributes, function (attr: Attr) {\n // Only capture attributes we know are safe\n if (isSensitiveElement(elem) && ['name', 'id', 'class', 'aria-label'].indexOf(attr.name) === -1) return\n\n if (elementAttributeIgnorelist?.includes(attr.name)) return\n\n if (!maskAllAttributes && shouldCaptureValue(attr.value) && !isAngularStyleAttr(attr.name)) {\n let value = attr.value\n if (attr.name === 'class') {\n // html attributes can _technically_ contain linebreaks,\n // but we're very intolerant of them in the class string,\n // so we strip them.\n value = splitClassString(value).join(' ')\n }\n props['attr__' + attr.name] = limitText(1024, value)\n }\n })\n\n let nthChild = 1\n let nthOfType = 1\n let currentElem: Element | null = elem\n while ((currentElem = previousElementSibling(currentElem))) {\n // eslint-disable-line no-cond-assign\n nthChild++\n if (currentElem.tagName === elem.tagName) {\n nthOfType++\n }\n }\n props['nth_child'] = nthChild\n props['nth_of_type'] = nthOfType\n\n return props\n}\n\nexport function autocapturePropertiesForElement(\n target: Element,\n {\n e,\n maskAllElementAttributes,\n maskAllText,\n elementAttributeIgnoreList,\n elementsChainAsString,\n }: {\n e: Event\n maskAllElementAttributes: boolean\n maskAllText: boolean\n elementAttributeIgnoreList?: string[] | undefined\n elementsChainAsString: boolean\n }\n): { props: Properties; explicitNoCapture?: boolean } {\n const targetElementList = [target]\n let curEl = target\n while (curEl.parentNode && !isTag(curEl, 'body')) {\n if (isDocumentFragment(curEl.parentNode)) {\n targetElementList.push((curEl.parentNode as any).host)\n curEl = (curEl.parentNode as any).host\n continue\n }\n targetElementList.push(curEl.parentNode as Element)\n curEl = curEl.parentNode as Element\n }\n\n const elementsJson: Properties[] = []\n const autocaptureAugmentProperties: Properties = {}\n let href: string | false = false\n let explicitNoCapture = false\n\n each(targetElementList, (el) => {\n const shouldCaptureEl = shouldCaptureElement(el)\n\n // if the element or a parent element is an anchor tag\n // include the href as a property\n if (el.tagName.toLowerCase() === 'a') {\n href = el.getAttribute('href')\n href = shouldCaptureEl && href && shouldCaptureValue(href) && href\n }\n\n // allow users to programmatically prevent capturing of elements by adding class 'ph-no-capture'\n const classes = getClassNames(el)\n if (includes(classes, 'ph-no-capture')) {\n explicitNoCapture = true\n }\n\n elementsJson.push(\n getPropertiesFromElement(el, maskAllElementAttributes, maskAllText, elementAttributeIgnoreList)\n )\n\n const augmentProperties = getAugmentPropertiesFromElement(el)\n extend(autocaptureAugmentProperties, augmentProperties)\n })\n\n if (explicitNoCapture) {\n return { props: {}, explicitNoCapture }\n }\n\n if (!maskAllText) {\n // if the element is a button or anchor tag get the span text from any\n // children and include it as/with the text property on the parent element\n if (target.tagName.toLowerCase() === 'a' || target.tagName.toLowerCase() === 'button') {\n elementsJson[0]['$el_text'] = getDirectAndNestedSpanText(target)\n } else {\n elementsJson[0]['$el_text'] = getSafeText(target)\n }\n }\n\n let externalHref: string | undefined\n if (href) {\n elementsJson[0]['attr__href'] = href\n const hrefHost = convertToURL(href)?.host\n const locationHost = window?.location?.host\n if (hrefHost && locationHost && hrefHost !== locationHost) {\n externalHref = href\n }\n }\n\n const props = extend(\n getDefaultProperties(e.type),\n // Sending \"$elements\" is deprecated. Only one client on US cloud uses this.\n !elementsChainAsString ? { $elements: elementsJson } : {},\n // Always send $elements_chain, as it's needed downstream in site app filtering\n { $elements_chain: getElementsChainString(elementsJson) },\n elementsJson[0]?.['$el_text'] ? { $el_text: elementsJson[0]?.['$el_text'] } : {},\n externalHref && e.type === 'click' ? { $external_click_url: externalHref } : {},\n autocaptureAugmentProperties\n )\n\n return { props }\n}\n\nexport class Autocapture {\n instance: PostHog\n _initialized: boolean = false\n _isDisabledServerSide: boolean | null = null\n _elementSelectors: Set<string> | null\n rageclicks = new RageClick()\n _elementsChainAsString = false\n\n constructor(instance: PostHog) {\n this.instance = instance\n this._elementSelectors = null\n }\n\n private get config(): AutocaptureConfig {\n const config = isObject(this.instance.config.autocapture) ? this.instance.config.autocapture : {}\n // precompile the regex\n config.url_allowlist = config.url_allowlist?.map((url) => new RegExp(url))\n config.url_ignorelist = config.url_ignorelist?.map((url) => new RegExp(url))\n return config\n }\n\n _addDomEventHandlers(): void {\n if (!this.isBrowserSupported()) {\n logger.info('Disabling Automatic Event Collection because this browser is not supported')\n return\n }\n\n if (!window || !document) {\n return\n }\n\n const handler = (e: Event) => {\n e = e || window?.event\n try {\n this._captureEvent(e)\n } catch (error) {\n logger.error('Failed to capture event', error)\n }\n }\n\n addEventListener(document, 'submit', handler, { capture: true })\n addEventListener(document, 'change', handler, { capture: true })\n addEventListener(document, 'click', handler, { capture: true })\n\n if (this.config.capture_copied_text) {\n const copiedTextHandler = (e: Event) => {\n e = e || window?.event\n this._captureEvent(e, COPY_AUTOCAPTURE_EVENT)\n }\n\n addEventListener(document, 'copy', copiedTextHandler, { capture: true })\n addEventListener(document, 'cut', copiedTextHandler, { capture: true })\n }\n }\n\n public startIfEnabled() {\n if (this.isEnabled && !this._initialized) {\n this._addDomEventHandlers()\n this._initialized = true\n }\n }\n\n public onRemoteConfig(response: RemoteConfig) {\n if (response.elementsChainAsString) {\n this._elementsChainAsString = response.elementsChainAsString\n }\n\n if (this.instance.persistence) {\n this.instance.persistence.register({\n [AUTOCAPTURE_DISABLED_SERVER_SIDE]: !!response['autocapture_opt_out'],\n })\n }\n // store this in-memory in case persistence is disabled\n this._isDisabledServerSide = !!response['autocapture_opt_out']\n this.startIfEnabled()\n }\n\n public setElementSelectors(selectors: Set<string>): void {\n this._elementSelectors = selectors\n }\n\n public getElementSelectors(element: Element | null): string[] | null {\n const elementSelectors: string[] = []\n\n this._elementSelectors?.forEach((selector) => {\n const matchedElements = document?.querySelectorAll(selector)\n matchedElements?.forEach((matchedElement: Element) => {\n if (element === matchedElement) {\n elementSelectors.push(selector)\n }\n })\n })\n\n return elementSelectors\n }\n\n public get isEnabled(): boolean {\n const persistedServerDisabled = this.instance.persistence?.props[AUTOCAPTURE_DISABLED_SERVER_SIDE]\n const memoryDisabled = this._isDisabledServerSide\n\n if (\n isNull(memoryDisabled) &&\n !isBoolean(persistedServerDisabled) &&\n !this.instance.config.advanced_disable_decide\n ) {\n // We only enable if we know that the server has not disabled it (unless decide is disabled)\n return false\n }\n\n const disabledServer = this._isDisabledServerSide ?? !!persistedServerDisabled\n const disabledClient = !this.instance.config.autocapture\n return !disabledClient && !disabledServer\n }\n\n private _captureEvent(e: Event, eventName: EventName = '$autocapture'): boolean | void {\n if (!this.isEnabled) {\n return\n }\n\n /*** Don't mess with this code without running IE8 tests on it ***/\n let target = getEventTarget(e)\n if (isTextNode(target)) {\n // defeat Safari bug (see: http://www.quirksmode.org/js/events_properties.html)\n target = (target.parentNode || null) as Element | null\n }\n\n if (eventName === '$autocapture' && e.type === 'click' && e instanceof MouseEvent) {\n if (\n this.instance.config.rageclick &&\n this.rageclicks?.isRageClick(e.clientX, e.clientY, new Date().getTime())\n ) {\n this._captureEvent(e, '$rageclick')\n }\n }\n\n const isCopyAutocapture = eventName === COPY_AUTOCAPTURE_EVENT\n if (\n target &&\n shouldCaptureDomEvent(\n target,\n e,\n this.config,\n // mostly this method cares about the target element, but in the case of copy events,\n // we want some of the work this check does without insisting on the target element's type\n isCopyAutocapture,\n // we also don't want to restrict copy checks to clicks,\n // so we pass that knowledge in here, rather than add the logic inside the check\n isCopyAutocapture ? ['copy', 'cut'] : undefined\n )\n ) {\n const { props, explicitNoCapture } = autocapturePropertiesForElement(target, {\n e,\n maskAllElementAttributes: this.instance.config.mask_all_element_attributes,\n maskAllText: this.instance.config.mask_all_text,\n elementAttributeIgnoreList: this.config.element_attribute_ignorelist,\n elementsChainAsString: this._elementsChainAsString,\n })\n\n if (explicitNoCapture) {\n return false\n }\n\n const elementSelectors = this.getElementSelectors(target)\n if (elementSelectors && elementSelectors.length > 0) {\n props['$element_selectors'] = elementSelectors\n }\n\n if (eventName === COPY_AUTOCAPTURE_EVENT) {\n // you can't read the data from the clipboard event,\n // but you can guess that you can read it from the window's current selection\n const selectedContent = makeSafeText(window?.getSelection()?.toString())\n const clipType = (e as ClipboardEvent).type || 'clipboard'\n if (!selectedContent) {\n return false\n }\n props['$selected_content'] = selectedContent\n props['$copy_type'] = clipType\n }\n\n this.instance.capture(eventName, props)\n return true\n }\n }\n\n isBrowserSupported(): boolean {\n return isFunction(document?.querySelectorAll)\n }\n}\n","/**\n * adapted from https://github.com/getsentry/sentry-javascript/blob/72751dacb88c5b970d8bac15052ee8e09b28fd5d/packages/browser-utils/src/getNativeImplementation.ts#L27\n * and https://github.com/PostHog/rrweb/blob/804380afbb1b9bed70b8792cb5a25d827f5c0cb5/packages/utils/src/index.ts#L31\n * after a number of performance reports from Angular users\n */\n\nimport { AssignableWindow } from './globals'\nimport { isAngularZonePresent, isFunction, isNativeFunction } from './type-utils'\nimport { logger } from './logger'\n\ninterface NativeImplementationsCache {\n MutationObserver: typeof MutationObserver\n}\n\nconst cachedImplementations: Partial<NativeImplementationsCache> = {}\n\nexport function getNativeImplementation<T extends keyof NativeImplementationsCache>(\n name: T,\n assignableWindow: AssignableWindow\n): NativeImplementationsCache[T] {\n const cached = cachedImplementations[name]\n if (cached) {\n return cached\n }\n\n let impl = assignableWindow[name] as NativeImplementationsCache[T]\n\n if (isNativeFunction(impl) && !isAngularZonePresent()) {\n return (cachedImplementations[name] = impl.bind(assignableWindow) as NativeImplementationsCache[T])\n }\n\n const document = assignableWindow.document\n if (document && isFunction(document.createElement)) {\n try {\n const sandbox = document.createElement('iframe')\n sandbox.hidden = true\n document.head.appendChild(sandbox)\n const contentWindow = sandbox.contentWindow\n if (contentWindow && (contentWindow as any)[name]) {\n impl = (contentWindow as any)[name] as NativeImplementationsCache[T]\n }\n document.head.removeChild(sandbox)\n } catch (e) {\n // Could not create sandbox iframe, just use assignableWindow.xxx\n logger.warn(`Could not create sandbox iframe for ${name} check, bailing to assignableWindow.${name}: `, e)\n }\n }\n\n // Sanity check: This _should_ not happen, but if it does, we just skip caching...\n // This can happen e.g. in tests where fetch may not be available in the env, or similar.\n if (!impl || !isFunction(impl)) {\n return impl\n }\n\n return (cachedImplementations[name] = impl.bind(assignableWindow) as NativeImplementationsCache[T])\n}\n\nexport function getNativeMutationObserverImplementation(assignableWindow: AssignableWindow): typeof MutationObserver {\n return getNativeImplementation('MutationObserver', assignableWindow)\n}\n","import { assignableWindow, LazyLoadedDeadClicksAutocaptureInterface } from '../utils/globals'\nimport { PostHog } from '../posthog-core'\nimport { isNull, isNumber, isUndefined } from '../utils/type-utils'\nimport { autocaptureCompatibleElements, getEventTarget } from '../autocapture-utils'\nimport { DeadClickCandidate, DeadClicksAutoCaptureConfig, Properties } from '../types'\nimport { autocapturePropertiesForElement } from '../autocapture'\nimport { isElementInToolbar, isElementNode, isTag } from '../utils/element-utils'\nimport { getNativeMutationObserverImplementation } from '../utils/prototype-utils'\nimport { addEventListener } from '../utils'\n\nfunction asClick(event: MouseEvent): DeadClickCandidate | null {\n const eventTarget = getEventTarget(event)\n if (eventTarget) {\n return {\n node: eventTarget,\n originalEvent: event,\n timestamp: Date.now(),\n }\n }\n return null\n}\n\nfunction checkTimeout(value: number | undefined, thresholdMs: number) {\n return isNumber(value) && value >= thresholdMs\n}\n\nclass LazyLoadedDeadClicksAutocapture implements LazyLoadedDeadClicksAutocaptureInterface {\n private _mutationObserver: MutationObserver | undefined\n private _lastMutation: number | undefined\n private _lastSelectionChanged: number | undefined\n private _clicks: DeadClickCandidate[] = []\n private _checkClickTimer: number | undefined\n private _config: Required<DeadClicksAutoCaptureConfig>\n private _onCapture: (click: DeadClickCandidate, properties: Properties) => void\n\n private _defaultConfig = (defaultOnCapture: (click: DeadClickCandidate, properties: Properties) => void) => ({\n element_attribute_ignorelist: [],\n scroll_threshold_ms: 100,\n selection_change_threshold_ms: 100,\n mutation_threshold_ms: 2500,\n __onCapture: defaultOnCapture,\n })\n\n private asRequiredConfig(providedConfig?: DeadClicksAutoCaptureConfig): Required<DeadClicksAutoCaptureConfig> {\n const defaultConfig = this._defaultConfig(providedConfig?.__onCapture || this._captureDeadClick.bind(this))\n return {\n element_attribute_ignorelist:\n providedConfig?.element_attribute_ignorelist ?? defaultConfig.element_attribute_ignorelist,\n scroll_threshold_ms: providedConfig?.scroll_threshold_ms ?? defaultConfig.scroll_threshold_ms,\n selection_change_threshold_ms:\n providedConfig?.selection_change_threshold_ms ?? defaultConfig.selection_change_threshold_ms,\n mutation_threshold_ms: providedConfig?.mutation_threshold_ms ?? defaultConfig.mutation_threshold_ms,\n __onCapture: defaultConfig.__onCapture,\n }\n }\n\n constructor(\n readonly instance: PostHog,\n config?: DeadClicksAutoCaptureConfig\n ) {\n this._config = this.asRequiredConfig(config)\n this._onCapture = this._config.__onCapture\n }\n\n start(observerTarget: Node) {\n this._startClickObserver()\n this._startScrollObserver()\n this._startSelectionChangedObserver()\n this._startMutationObserver(observerTarget)\n }\n\n private _startMutationObserver(observerTarget: Node) {\n if (!this._mutationObserver) {\n const NativeMutationObserver = getNativeMutationObserverImplementation(assignableWindow)\n this._mutationObserver = new NativeMutationObserver((mutations) => {\n this.onMutation(mutations)\n })\n this._mutationObserver.observe(observerTarget, {\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n })\n }\n }\n\n stop() {\n this._mutationObserver?.disconnect()\n this._mutationObserver = undefined\n assignableWindow.removeEventListener('click', this._onClick)\n assignableWindow.removeEventListener('scroll', this._onScroll, { capture: true })\n assignableWindow.removeEventListener('selectionchange', this._onSelectionChange)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n private onMutation(_mutations: MutationRecord[]): void {\n // we don't actually care about the content of the mutations, right now\n this._lastMutation = Date.now()\n }\n\n private _startClickObserver() {\n addEventListener(assignableWindow, 'click', this._onClick)\n }\n\n private _onClick = (event: Event): void => {\n const click = asClick(event as MouseEvent)\n if (!isNull(click) && !this._ignoreClick(click)) {\n this._clicks.push(click)\n }\n\n if (this._clicks.length && isUndefined(this._checkClickTimer)) {\n this._checkClickTimer = assignableWindow.setTimeout(() => {\n this._checkClicks()\n }, 1000)\n }\n }\n\n // `capture: true` is required to get scroll events for other scrollable elements\n // on the page, not just the window\n // see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#usecapture\n //\n // `passive: true` is used to tell the browser that the scroll event handler will not call `preventDefault()`\n // This allows the browser to optimize scrolling performance by not waiting for our handling of the scroll event\n // see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#passive\n private _startScrollObserver() {\n addEventListener(assignableWindow, 'scroll', this._onScroll, { capture: true })\n }\n\n private _onScroll = (): void => {\n const candidateNow = Date.now()\n // very naive throttle\n if (candidateNow % 50 === 0) {\n // we can see many scrolls between scheduled checks,\n // so we update scroll delay as we see them\n // to avoid false positives\n this._clicks.forEach((click) => {\n if (isUndefined(click.scrollDelayMs)) {\n click.scrollDelayMs = candidateNow - click.timestamp\n }\n })\n }\n }\n\n private _startSelectionChangedObserver() {\n addEventListener(assignableWindow, 'selectionchange', this._onSelectionChange)\n }\n\n private _onSelectionChange = (): void => {\n this._lastSelectionChanged = Date.now()\n }\n\n private _ignoreClick(click: DeadClickCandidate | null): boolean {\n if (!click) {\n return true\n }\n\n if (isElementInToolbar(click.node)) {\n return true\n }\n\n const alreadyClickedInLastSecond = this._clicks.some((c) => {\n return c.node === click.node && Math.abs(c.timestamp - click.timestamp) < 1000\n })\n\n if (alreadyClickedInLastSecond) {\n return true\n }\n\n if (\n isTag(click.node, 'html') ||\n !isElementNode(click.node) ||\n autocaptureCompatibleElements.includes(click.node.tagName.toLowerCase())\n ) {\n return true\n }\n\n return false\n }\n\n private _checkClicks() {\n if (!this._clicks.length) {\n return\n }\n\n clearTimeout(this._checkClickTimer)\n this._checkClickTimer = undefined\n\n const clicksToCheck = this._clicks\n this._clicks = []\n\n for (const click of clicksToCheck) {\n click.mutationDelayMs =\n click.mutationDelayMs ??\n (this._lastMutation && click.timestamp <= this._lastMutation\n ? this._lastMutation - click.timestamp\n : undefined)\n click.absoluteDelayMs = Date.now() - click.timestamp\n click.selectionChangedDelayMs =\n this._lastSelectionChanged && click.timestamp <= this._lastSelectionChanged\n ? this._lastSelectionChanged - click.timestamp\n : undefined\n\n const scrollTimeout = checkTimeout(click.scrollDelayMs, this._config.scroll_threshold_ms)\n const selectionChangedTimeout = checkTimeout(\n click.selectionChangedDelayMs,\n this._config.selection_change_threshold_ms\n )\n const mutationTimeout = checkTimeout(click.mutationDelayMs, this._config.mutation_threshold_ms)\n // we want to timeout eventually even if nothing else catches it...\n // we leave a little longer than the maximum threshold to give the other checks a chance to catch it\n const absoluteTimeout = checkTimeout(click.absoluteDelayMs, this._config.mutation_threshold_ms * 1.1)\n\n const hadScroll = isNumber(click.scrollDelayMs) && click.scrollDelayMs < this._config.scroll_threshold_ms\n const hadMutation =\n isNumber(click.mutationDelayMs) && click.mutationDelayMs < this._config.mutation_threshold_ms\n const hadSelectionChange =\n isNumber(click.selectionChangedDelayMs) &&\n click.selectionChangedDelayMs < this._config.selection_change_threshold_ms\n\n if (hadScroll || hadMutation || hadSelectionChange) {\n // ignore clicks that had a scroll or mutation\n continue\n }\n\n if (scrollTimeout || mutationTimeout || absoluteTimeout || selectionChangedTimeout) {\n this._onCapture(click, {\n $dead_click_last_mutation_timestamp: this._lastMutation,\n $dead_click_event_timestamp: click.timestamp,\n $dead_click_scroll_timeout: scrollTimeout,\n $dead_click_mutation_timeout: mutationTimeout,\n $dead_click_absolute_timeout: absoluteTimeout,\n $dead_click_selection_changed_timeout: selectionChangedTimeout,\n })\n } else if (click.absoluteDelayMs < this._config.mutation_threshold_ms) {\n // keep waiting until next check\n this._clicks.push(click)\n }\n }\n\n if (this._clicks.length && isUndefined(this._checkClickTimer)) {\n this._checkClickTimer = assignableWindow.setTimeout(() => {\n this._checkClicks()\n }, 1000)\n }\n }\n\n private _captureDeadClick(click: DeadClickCandidate, properties: Properties) {\n // TODO need to check safe and captur-able as with autocapture\n // TODO autocaputure config\n this.instance.capture(\n '$dead_click',\n {\n ...properties,\n ...autocapturePropertiesForElement(click.node, {\n e: click.originalEvent,\n maskAllElementAttributes: this.instance.config.mask_all_element_attributes,\n maskAllText: this.instance.config.mask_all_text,\n elementAttributeIgnoreList: this._config.element_attribute_ignorelist,\n // TRICKY: it appears that we were moving to elementsChainAsString, but the UI still depends on elements, so :shrug:\n elementsChainAsString: false,\n }).props,\n $dead_click_scroll_delay_ms: click.scrollDelayMs,\n $dead_click_mutation_delay_ms: click.mutationDelayMs,\n $dead_click_absolute_delay_ms: click.absoluteDelayMs,\n $dead_click_selection_changed_delay_ms: click.selectionChangedDelayMs,\n },\n {\n timestamp: new Date(click.timestamp),\n }\n )\n }\n}\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.initDeadClicksAutocapture = (ph, config) =>\n new LazyLoadedDeadClicksAutocapture(ph, config)\n\nexport default LazyLoadedDeadClicksAutocapture\n"],"names":["_a","__defProp","Object","defineProperty","__publicField","obj","key","value","__defNormalProp","enumerable","configurable","writable","__defProp$1","__publicField$1","__defNormalProp$1","NodeType$2","NodeType2","testableAccessors$1","Node","ShadowRoot","Element","MutationObserver","testableMethods$1","untaintedBasePrototype$1","getUntaintedPrototype$1","defaultObj","angularZoneUnpatchedAlternative","_globalThis$Zone","_globalThis$Zone$__sy","angularUnpatchedVersionSymbol","globalThis","Zone","__symbol__","defaultPrototype","prototype","accessorNames","isUntaintedAccessors","Boolean","every","accessor","_a2","_b","getOwnPropertyDescriptor","get","toString","includes","methodNames","method","iframeEl","document","createElement","win","contentWindow","untaintedObject","body","removeChild","_unused","untaintedAccessorCache$1","getUntaintedAccessor$1","cacheKey","concat","call","instance","untaintedPrototype","untaintedAccessor","untaintedMethodCache$1","getUntaintedMethod$1","bind","untaintedMethod","index$1","childNodes","n2","parentNode","parentNode$1","parentElement","parentElement$1","textContent","textContent$1","contains","contains$1","other","getRootNode","getRootNode$1","host","host$1","styleSheets","styleSheets$1","shadowRoot","shadowRoot$1","querySelector","selectors","querySelectorAll","querySelectorAll$1","mutationObserver","constructor","isElement","nodeType","ELEMENT_NODE","isShadowRoot","hostEl","isNativeShadowDom","shadowRoot2","stringifyStylesheet","s2","rules2","stringifiedRules","rule2","stringifyRule","href","join","fixBrowserCompatibilityIssuesInCSS","cssText","replace","error","isCSSImportRule","importStringified","styleSheet","escapeImportStatement","split","length","statement","layerName","push","supportsText","media","absolutifyURLs","regex","ruleStringified","isCSSStyleRule","selectorText","sheetHref","findStylesheet","Array","from","doc","find","s","Mirror$1","getId","id","getNode","this","getIds","idNodeMap","keys","getMeta","nodeMetaMap","removeNodeFromMap","delete","childNode","has","hasNode","node2","add","meta","set","oldNode","reset","Map","WeakMap","maskInputValue","_ref","element","maskInputOptions","tagName","type","maskInputFn","text","actualType","toLowerCase","str","ORIGINAL_ATTRIBUTE_NAME","getInputType","hasAttribute","extractFileExtension","_ref2","url","URL","baseURL","window","location","err","match","URL_IN_CSS_REF","URL_PROTOCOL_MATCH","URL_WWW_MATCH","DATA_URI","origin","quote1","path1","quote2","path2","extractOrigin","filePath","path3","maybeQuote","test","indexOf","slice","stack","parts","part","canvasService","canvasCtx","_id","tagNameRegex","RegExp","IGNORED_NODE","genId","SRCSET_NOT_SPACES","SRCSET_COMMAS_OR_SPACES","cachedDocument","absoluteToDoc","attributeValue","trim","getHref","isSVGElement","el","ownerSVGElement","a2","customHref","startsWith","transformAttribute","name","pos","collectCharacters","regEx","chars2","exec","substring","output","descriptorsStr","inParens","c2","getAbsoluteSrcsetString","ignoreAttribute","_value","classMatchesRegex","checkAncestors","eIndex","classList","className","needMaskingText","maskTextClass","closest","maskTextSelector","matches","e2","serializeNode","mirror","mirror2","blockClass","blockSelector","needsMask","inlineStylesheet","maskTextFn","dataURLOptions","inlineImages","recordCanvas","keepIframeSrcFn","newlyAddedElement","options","rootId","getRootId","docId","compatMode","Document","publicId","systemId","serializeElementNode","isCustomElement","needBlock","_isBlockedElement","getValidTagName$1","HTMLFormElement","processedTagName","attributes","len","i2","attr","hrefFrom","n","stylesheet","rel","_cssText","innerText","sheet","checked","selected","open","rr_open_mode","_unused2","ph_rr_could_not_detect_modal","__context","is2DCanvasBlank","ctx","x2","canvas","width","y","height","getImageData","originalGetImageData","pixelBuffer","Math","min","data","buffer","quality","canvasDataURL","blankCanvas","toDataURL","rr_dataURL","getContext","image","imageSrc","currentSrc","getAttribute","priorCrossOrigin","crossOrigin","recordInlineImage","removeEventListener","complete","naturalWidth","addEventListener","console","removeAttribute","mediaAttributes","rr_mediaState","paused","rr_mediaCurrentTime","currentTime","rr_mediaPlaybackRate","muted","rr_mediaLoop","loop","rr_mediaVolume","volume","scrollLeft","rr_scrollLeft","scrollTop","rr_scrollTop","getBoundingClientRect","class","rr_width","rr_height","src","contentDocument","customElements","isSVG","isCustom","TEXT_NODE","serializeTextNode","parent","parentTagName","isStyle","isScript","nextSibling","previousSibling","cssRules","Text","CDATA_SECTION_NODE","CDATA","COMMENT_NODE","Comment","lowerIfExists","maybeAttr","serializeNodeWithId","skipChild","slimDOMOptions","onSerialize","onIframeLoad","iframeLoadTimeout","onStylesheetLoad","stylesheetLoadTimeout","preserveWhiteSpace","_serializedNode","slimDOMExcluded","script","sn","as","headMetaDescKeywords","headMetaSocial","property","headMetaRobots","headMetaHttpEquiv","headMetaAuthorship","headMetaVerification","serializedNode","assign","recordChild","shadowRootEl","isShadowHost","headWhitespace","bypassOptions","childN","serializedChildNode","_shadowRootEl","_childN","_serializedChildNode","isShadow","listener","readyState","fired","blankUrl","setTimeout","timer","clearTimeout","onceIframeLoaded","iframeDoc","serializedIframeNode","onceStylesheetLoaded","styleSheetLoaded","styleSheetLoadTimeout","link","serializedLinkNode","BaseRRNode$1","BaseRRNode","__publicField2","childNodes2","childIterator","firstChild","ownerDocument","appendChild","_newChild","Error","insertBefore","_node","testableAccessors","testableMethods","untaintedBasePrototype","getUntaintedPrototype","angularZoneUnpatchedAlternative$1","_globalThis$Zone2","_globalThis$Zone2$__s","isUntaintedMethods","_unused3","untaintedAccessorCache","getUntaintedAccessor","String","untaintedMethodCache","getUntaintedMethod","mutationObserverCtor","index","on","target","arguments","undefined","capture","passive","fn","DEPARTED_MIRROR_ACCESS_WARNING","_mirror","map","throttle","timeout","previous","_len","args","_key","now","Date","leading","remaining","wait","context","func","trailing","hookSetter","original","isRevoked","d","patch","source","wrapped","replacement","defineProperties","__rrweb_original__","_unused4","Proxy","Reflect","prop","receiver","nowTimestamp","getWindowScroll","left","top","scrollingElement","pageYOffset","documentElement","_c","_d","getWindowHeight","innerHeight","clientHeight","getWindowWidth","innerWidth","clientWidth","closestElementOfNode","isBlocked","isIgnored","headTitleMutations","isAncestorRemoved","DOCUMENT_NODE","legacy_isTouchEvent","event","changedTouches","isSerializedIframe","isSerializedStylesheet","hasShadowRoot","StyleSheetMirror$1","_this$styleIDMap$get","styleIDMap","newId","idStyleMap","getStyle","generateId","getShadowHost","shadowHost","shadowHostInDom","getRootShadowHost","rootShadowHost","inDom","EventType","EventType2","IncrementalSource","IncrementalSource2","MouseInteractions","MouseInteractions2","PointerTypes","PointerTypes2","CanvasContext","CanvasContext2","MediaInteractions","MediaInteractions2","isNodeInLinkedList","DoubleLinkedList","position","current","head","index2","next","addNode","__ln","_current","tail","removeNode","errorHandler","moveKey","MutationBuffer","Set","mutations","emit","frozen","locked","adds","addedIds","addList","getNextId","ns","nextId","pushAdd","parentId","currentN","iframeManager","addIframe","stylesheetManager","shadowDomManager","addShadowRoot","iframe","childSn","attachIframe","observeAttachShadow","attachLinkElement","node","mapRemoves","shift","movedSet","isParentRemoved","removes","addedSet","droppedSet","_n","isAncestorInSet","candidate","tailNode","_parentId","unhandledNode","payload","texts","genTextAreaValueMutation","filter","attribute","style","diffAsStr","JSON","stringify","styleDiff","unchangedAsStr","_unchangedStyles","attributeMap","movedMap","textarea","item","cn","m","oldValue","attributeName","_value2","unattachedDoc","old","pname","newValue","getPropertyValue","newPriority","getPropertyPriority","_pname","addedNodes","forEach","genAdds","nodeId","isSerialized","deepDelete","processedNodeManager","inOtherBuffer","targetId","init","freeze","canvasManager","unfreeze","isFrozen","lock","unlock","addsSet","_loop","some","r2","v","_ret","_isParentRemoved","_isAncestorInSet","callbackWrapper","cb","mutationBuffers","getEventTarget","path","composedPath","_unused5","initMutationObserver","rootEl","mutationBuffer","observer","observe","attributeOldValue","characterData","characterDataOldValue","childList","subtree","initMouseInteractionObserver","_ref4","mouseInteractionCb","sampling","mouseInteraction","disableMap","handlers","currentPointerType","Number","isNaN","endsWith","eventKey","eventName","handler","pointerType","thisEventKey","Touch","MouseDown","MouseUp","Pen","Mouse","clientX","clientY","x","getHandler","PointerEvent","TouchStart","TouchEnd","h","initScrollObserver","_ref5","scrollCb","evt","scrollLeftTop","defaultView","scroll","INPUT_TAGS","lastInputValueMap","getNestedCSSRulePositions","hasNestedCSSRule","childRule","parentRule","CSSGroupingRule","CSSMediaRule","CSSSupportsRule","CSSConditionRule","parentStyleSheet","_index","unshift","recurse","getIdAndStyleId","styleMirror","styleId","initAdoptedStyleSheetObserver","host2","_ref13","hostId","nodeName","patchTarget","originalPropertyDescriptor","_a3","sheets","result2","adoptStyleSheets","initObservers","hooks","currentWindow","mergeHooks","mutationCb","mousemoveCb","viewportResizeCb","inputCb","mediaInteractionCb","styleSheetRuleCb","styleDeclarationCb","canvasMutationCb","fontCb","selectionCb","customElementCb","o2","mutation","mousemove","viewportResize","input","mediaInteaction","styleSheetRule","styleDeclaration","canvasMutation","font","selection","customElement","recordDOM","mousemoveHandler","_ref3","timeBaseline","threshold","callbackThreshold","mousemoveCallback","positions","wrappedCb","totalOffset","p","updatePosition","timeOffset","DragEvent","Drag","MouseEvent","MouseMove","TouchMove","initMoveObserver","mouseInteractionHandler","scrollHandler","viewportResizeHandler","initViewportResizeObserver","_ref6","_ref7","lastH","lastW","inputHandler","_ref8","ignoreClass","ignoreSelector","userTriggeredOnInput","eventHandler","userTriggered","isTrusted","isChecked","cbWithDedup","text2","v2","lastInputValue","propertyDescriptor","HTMLInputElement","hookProperties","HTMLSelectElement","HTMLTextAreaElement","initInputObserver","mediaInteractionHandler","_ref16","playbackRate","Play","VolumeChange","RateChange","initMediaInteractionObserver","styleSheetObserver","adoptedStyleSheetObserver","styleDeclarationObserver","fontObserver","_ref9","_ref10","CSSStyleSheet","insertRule","apply","thisArg","argumentsList","rule","addRule","selector","styleBlock","replaceSync","deleteRule","removeRule","supportedNestedCSSRuleTypes","canMonkeyPatchNestedCSSRule","unmodifiedFunctions","entries","_ref11","typeKey","_ref12","initStyleSheetObserver","_ref14","_ref15","ignoreCSSAttributes","setProperty","CSSStyleDeclaration","priority","removeProperty","remove","initStyleDeclarationObserver","initFontObserver","_ref17","fontMap","originalFontFace","FontFace","family","fontFace","descriptors","fontSource","Uint8Array","restoreHandler","fonts","selectionObserver","initSelectionObserver","param","collapsed","updateSelection","isCollapsed","ranges","count","range","startContainer","startOffset","endContainer","endOffset","blocked","start","end","customElementObserver","_ref18","define","warn","initCustomElementObserver","pluginHandlers","plugin3","plugins","callback","b","disconnect","CrossOriginIframeMirror","generateIdFn","remoteId","idToRemoteIdMap","idToRemoteMap","getIdToRemoteIdMap","remoteIdToIdMap","remoteToIdMap","getRemoteIdToIdMap","getRemoteId","getRemoteIds","ids","iframeIdToRemoteIdMap","iframeRemoteIdToIdMap","IframeManager","wrappedEmit","recordCrossOriginIframes","iframes","crossOriginIframeMap","addLoadListener","loadListener","isAttachIframe","handleMessage","adoptedStyleSheets","message","crossOriginMessageEvent","transformedEvent","isCheckout","transformCrossOriginEvent","FullSnapshot","crossOriginIframeMirror","crossOriginIframeStyleMirror","crossOriginIframeRootIdMap","patchRootIdOnNode","timestamp","IncrementalSnapshot","Mutation","Load","DomContentLoaded","Plugin","Custom","replaceIds","replaceIdOnNode","ViewportResize","MediaInteraction","MouseInteraction","Scroll","CanvasMutation","Input","StyleSheetRule","StyleDeclaration","replaceStyleIds","Font","AdoptedStyleSheet","styles","isArray","iframeMirror","child","ShadowDomManager","WeakSet","patchAttachShadow","shadowDoms","_objectSpread","restoreHandlers","iframeElement","manager","option","sRoot","chars","lookup","i$1","charCodeAt","canvasVarMap","saveWebGLVar","isInstanceOfWebGLObject","list2","ctor","contextMap","serializeArg","Float32Array","Float64Array","Int32Array","Uint32Array","Uint16Array","Int16Array","Int8Array","Uint8ClampedArray","rr_type","values","ArrayBuffer","base64","arraybuffer","bytes","encode","DataView","byteLength","HTMLImageElement","HTMLCanvasElement","ImageData","serializeArgs","arg","supportedWebGLConstructorNames","initCanvasContextObserver","contextType","_len3","_key3","ctxName","getNormalizedContextName","setPreserveDrawingBufferToTrue","contextAttributes","preserveDrawingBuffer","_unused7","patchGLPrototype","props","_loop3","_len4","_key4","recordArgs","_unused8","hookHandler","setter","takeFullSnapshot$1","encodedJs","blob","Blob","atob","WorkerWrapper","objURL","webkitURL","createObjectURL","worker","Worker","revokeObjectURL","CanvasManager","latestId","invokeId","newFrame","rafStamps","pendingCanvasMutations","initCanvasMutationObserver","initCanvasFPSObserver","clear","resetObservers","_this","canvasContextReset","snapshotInProgressMap","commands","rafId","timeBetweenSnapshots","fps","lastSnapshotTime","takeCanvasSnapshots","getCanvas","matchedCanvas","searchCanvas","root","elem","getContextAttributes","bitmap","resizeWidth","resizeHeight","_x","_ref19","cancelAnimationFrame","startRAFTimestamping","startPendingCanvasMutationFlusher","canvas2DReset","initCanvas2DMutationObserver","props2D","CanvasRenderingContext2D","_len2","_key2","_unused6","_loop2","processMutation","canvasWebGL1and2Reset","WebGL","WebGL2RenderingContext","initCanvasWebGLMutationObserver","requestAnimationFrame","flushPendingCanvasMutations","setLatestRAFTimestamp","_values","flushPendingCanvasMutationFor","valuesWithType","rest","StylesheetManager","adoptedStyleSheetCb","trackLinkElement","linkEl","trackedLinkElements","trackStylesheetInLinkElement","_this2","adoptedStyleSheetData","styleIds","_loop4","rules","CSSRule","ProcessedNodeManager","buffers","nodeMap","thisBuffer","active","destroy","recording","cleanFrame","t2","Mirror","record","checkoutEveryNms","checkoutEveryNth","maskAllInputs","_maskInputOptions","_slimDOMOptions","packFn","mousemoveWait","recordAfter","collectFonts","errorHandler2","inEmittingFrame","passEmitsToParent","lastFullSnapshotEvent","color","date","email","month","number","search","tel","time","week","select","password","comment","headFavicon","NodeList","DOMTokenList","polyfill$1","incrementalSnapshotCount","eventProcessor","buf","exceedCount","exceedTime","wrappedMutationEmit","wrappedScrollEmit","wrappedCanvasMutationEmit","getMirror","nodeMirror","Meta","slimDOM","snapshot","initialOffset","CustomElement","plugin","addCustomEvent","tag","Running","__defNormalProp2","__publicField22","getTime","DOCUMENT_FRAGMENT_NODE","__proto__","StyleSheetMirror","getBaseDimension","frameElement","rootIframe","relativeScale","absoluteScale","frameDimension","frameBaseDimension","getNestedRule","getPositionsAndIndex","nestedIndex","pop","pageXOffset","iterateResolveTree","tree","children","polyfill","queueToResolveTrees","queueNodeMap","putIntoMap","nodeInTree","queueNodeTrees","queue","nextInTree","idx","splice","_idx","parentInTree","uniqueTextMutations","idSet","uniqueMutations","Symbol","toStringTag","decodeBase64","debug","NotStarted","Stopped","StackFrame","fileName","functionName","columnNumber","lineNumber","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","ErrorStackParser","parse","stacktrace","parseOpera","parseV8OrIE","extractLocation","urlLike","line","filtered","sanitizedLine","tokens","locationParts","parseFFOrSafari","functionNameRegex","e","parseOpera9","parseOpera11","lineRE","lines","i","parseFloat","parseOpera10","pathToSelector","outerHTML","localName","domSiblings","sibling","isObject","isObjTooDeep","limit","numOfKeysLimit","depthOfLimit","stringifyOptions","thisPos","Infinity","shouldIgnore","_obj","stringLengthLimit","Event","eventResult","eventValue","HTMLElement","defaultLogOptions","level","lengthThreshold","logger","initLogObserver","logOptions","loggerType","logCount","inStack","cancelHandlers","trace","stackFrame","unhandledrejectionHandler","reason","levelType","_logger","getRecordConsolePlugin","global","nativeForEach","navigator","fetch","XMLHttpRequest","AbortController","userAgent","Compression","assignableWindow","severityLevels","needle","nativeIsArray","ObjProto","hasOwnProperty","isFunction","isNativeFunction","isAngularZonePresent","isUndefined","isString","isEmptyString","isNull","isNullish","isNumber","isBoolean","isDocument","isFormData","FormData","_createLogger","prefix","_log","consoleLog","info","critical","_len5","_key5","uninitializedWarning","methodName","createLogger","additionalPrefix","breaker","eachArray","iterator","l","each","pair","extend","ownProps","resArray","formDataToQuery","formdata","use_val","use_key","arg_separator","tph_arr","val","encodeURIComponent","File","isFile","__posthog_wrapped__","isHostOnDenyList","_options$payloadHostD","hostname","hostnameFromURL","defaultNotDenied","isHostDenied","payloadHostDenyList","deny","SURVEYS_ACTIVATED","isElementNode","isTag","splitClassString","getClassNames","baseVal","getSafeText","elText","shouldCaptureElement","isSensitiveElement","_makeSafeText","isTextNode","shouldCaptureValue","makeSafeText","autocaptureCompatibleElements","curEl","classes","coreCCPattern","anchoredCCRegex","unanchoredCCRegex","coreSSNPattern","anchoredSSNRegex","unanchoredSSNRegex","anchorRegexes","getDirectAndNestedSpanText","getNestedSpanText","_child$tagName","spanText","getElementsChainString","elements","ret","_element$nth_child","_element$nth_of_type","el_string","tag_name","attr_class","single_class","sort","nth_child","nth_of_type","attr_id","sortedAttributes","a","localeCompare","escapeQuotes","elementsToString","_el$$el_text","_el$attr__href","response","extractAttrClass","extractElements","defaultNetworkOptions","initiatorTypes","maskRequestFn","recordHeaders","recordBody","recordInitialRequests","recordPerformance","performanceEntryTypeToObserve","payloadSizeLimitBytes","isNavigationTiming","entry","entryType","isResourceTiming","initPerformanceObserver","initialPerformanceEntries","performance","getEntries","initiatorType","requests","flatMap","prepareRequest","status","networkRequest","isInitial","PerformanceObserver","performanceEntries","wrappedInitiatorFilter","entryTypes","supportedEntryTypes","shouldRecordHeaders","shouldRecordBody","headers","matchesContentType","contentTypes","contentTypeHeader","contentType","ct","isBlobURL","protocol","Request","recordBodyType","getRequestPerformanceEntry","_x2","_x3","_x4","_x5","_getRequestPerformanceEntry","_asyncToGenerator","attempt","performanceEntry","array","predicate","findLast","getEntriesByName","startTime","Promise","resolve","_tryReadXHRBody","exposesServerTiming","responseEnd","timeOrigin","floor","toJSON","round","endTime","requestHeaders","requestBody","responseHeaders","responseBody","timing","serverTiming","duration","contentTypePrefixDenyList","_tryReadBody","r","reject","clone","then","txt","finally","_tryReadRequestBody2","_tryReadResponseBody2","cannotReadBodyReason","_r$headers$get","contentTypeIsDenied","_checkForCannotReadResponseBody","initFetchObserver","recordRequestHeaders","recordResponseHeaders","restorePatch","originalFetch","res","req","header","_x6","_tryReadRequestBody","_x7","_tryReadResponseBody","_res","catch","_x8","_x9","initialisedHandler","initNetworkObserver","networkOptions","request","maskedRequest","performanceObserver","xhrObserver","fetchObserver","originalOpen","async","username","xhr","originalSetRequestHeader","setRequestHeader","originalSend","send","DONE","getAllResponseHeaders","initXhrObserver","getRecordNetworkPlugin","__PosthogExtensions__","rrwebPlugins","rrweb","rrwebRecord","version","rrwebConsoleRecord","SurveyType","SurveyQuestionType","SurveyQuestionBranchingType","SurveySchedule","EMPTY_OBJ","EMPTY_ARR","IS_NON_DIMENSIONAL","__u","prepareStylesheet","posthog","_posthog$config","config","prepare_external_dependency_stylesheet","_window","_document","SurveySeenPrefix","SURVEY_DEFAULT_Z_INDEX","getFontFamily","fontFamily","defaultFontStack","appearance","parseInt","maxWidth","zIndex","borderColor","right","center","backgroundColor","disabledButtonOpacity","submitButtonColor","getContrastingTextColor","ratingButtonActiveColor","hex2rgb","c","hexColor","rgb","defaultBackgroundColor","nameColorToHex","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","colorMatch","g","sqrt","defaultSurveyAppearance","submitButtonTextColor","ratingButtonColor","placeholder","whiteLabel","displayThankYouMessage","thankYouMessageHeader","sendSurveyEvent","_posthog$get_session_","responses","survey","localStorage","setItem","getSurveySeenKey","$survey_name","$survey_id","$survey_iteration","current_iteration","$survey_iteration_start_date","current_iteration_start_date","$survey_questions","questions","question","sessionRecordingUrl","get_session_replay_url","$set","getSurveyInteractionProperty","dispatchEvent","dismissedSurveyEvent","readOnly","_posthog$get_session_2","shuffle","random","reverseIfUnshuffled","unshuffled","shuffled","reverse","getDisplayOrderQuestions","shuffleQuestions","canActivateRepeatedly","_survey$conditions3","_survey$conditions3$e","schedule","Always","Widget","conditions","events","repeatedActivation","_survey$conditions","_survey$conditions$ev","_survey$conditions$ev2","_survey$conditions2","_survey$conditions2$e","_survey$conditions2$e2","hasEvents","surveySeenKey","action","surveyProperty","SurveyContext","createContext","isPreviewMode","previewPageIndex","onPopupSurveyDismissed","isPopup","onPreviewSubmit","renderChildrenAsTextOrHtml","component","renderAsHtml","cloneElement","dangerouslySetInnerHTML","__html","extendArray","isMatchingRegex","pattern","isValidRegex","SimpleEventEmitter","_defineProperty","ActionMatcher","step","checkStepEvent","checkStepUrl","checkStepElement","actionEvents","actionRegistry","_this$instance","_addCaptureHook","_this$instance2","matchEventToAction","eventPayload","register","actions","_this$instance3","_this$instance4","_this$actionRegistry","_action$steps","steps","_this$actionEvents","autocapture","_this$instance5","selectorsToWatch","_action$steps2","setElementSelectors","_this$actionRegistry2","size","checkAction","_debugEventEmitter","_addActionHook","onAction","checkStep","_event$properties","eventUrl","properties","$current_url","matchString","url_matching","matching","adjustedRegExpStringPattern","escapeStringRegexp","getElementsList","href_matching","text_matching","$el_text","_event$properties2","elementSelectors","$element_selectors","$elements","SurveyEventReceiver","eventToSurveys","actionToSurveys","surveys","setupEventBasedSurveys","setupActionBasedSurveys","actionBasedSurveys","_survey$conditions2$a","_survey$conditions2$a2","actionMatcher","actionName","_survey$conditions4","_survey$conditions4$a","_survey$conditions5","_survey$conditions5$a","_survey$conditions5$a2","_this$actionMatcher","_survey$conditions6","_survey$conditions6$a","_survey$conditions6$a2","knownSurveys","_survey$conditions7","_survey$conditions8","_survey$conditions8$e","_survey$conditions8$e2","matchEventToSurvey","onEvent","_survey$conditions9","_survey$conditions9$e","_survey$conditions9$e2","_this$instance3$persi","existingActivatedSurveys","persistence","SURVEY_SHOWN_EVENT_NAME","_eventPayload$propert","surveyId","_updateActivatedSurveys","_this$instance4$persi","activatedSurveys","_this$instance5$persi","getSurveys","_this$instance6","_this$instance6$persi","getEventToSurveys","_getActionMatcher","surveyValidationMap","icontains","targets","not_icontains","not_regex","exact","is_not","doesSurveyUrlMatch","_window$location","matchType","urlMatchType","currentIndex","currentComponent","previousComponent","prevRaf","currentHook","afterPaintEffects","EMPTY","oldBeforeDiff","__b","oldBeforeRender","__r","oldAfterDiff","diffed","oldCommit","__c","oldBeforeUnmount","unmount","getHookState","__h","__H","__","__V","useState","initialState","useReducer","reducer","hookState","_reducer","invokeOrReturn","currentValue","__N","nextValue","setState","_hasScuFromHooks","updateHookState","f","stateHooks","prevScu","shouldUpdate","hookItem","shouldComponentUpdate","prevCWU","componentWillUpdate","__e","tmp","useEffect","state","__s","argsChanged","_pendingArgs","useRef","initialValue","useMemo","factory","useContext","provider","sub","flushAfterPaintEffects","__P","invokeCleanup","invokeEffect","__v","vnode","t","afterNextFrame","commitQueue","hasErrored","HAS_RAF","raf","done","hook","comp","cleanup","oldArgs","newArgs","createWidgetShadow","_survey$appearance","div","widgetColor","shadow","attachShadow","mode","widgetStyleSheet","append","satisfiedEmoji","_jsx","xmlns","viewBox","neutralEmoji","dissatisfiedEmoji","veryDissatisfiedEmoji","verySatisfiedEmoji","cancelSVG","fill","IconPosthogLogo","_jsxs","maskType","maskUnits","mask","transform","checkSVG","PostHogLogo","BottomSection","submitDisabled","onSubmit","textColor","disabled","onClick","QuestionHeader","description","descriptionContentType","forceDisableHtml","Cancel","role","ConfirmationMessage","onClose","styleOverrides","thankYouMessageCloseButtonText","useContrastingTextColor","_options$defaultTextC","ref","setTextColor","defaultTextColor","getComputedStyle","getTextColor","forceUpdate","OpenTextQuestion","textRef","setText","rows","onInput","currentTarget","buttonText","optional","LinkQuestion","_Fragment","RatingQuestion","displayQuestionIndex","scale","starting","rating","setRating","display","threeScaleEmojis","fiveScaleEmojis","emoji","gridTemplateColumns","getScaleNumbers","RatingButton","num","setActiveNumber","lowerBoundLabel","upperBoundLabel","submitButtonText","MultipleChoiceQuestion","choices","shuffleOptions","displayOrderChoices","openEndedChoice","hasOpenChoice","shuffledOptions","getDisplayOrderChoices","selectedChoices","setSelectedChoices","MultipleChoice","openChoiceSelected","setOpenChoiceSelected","openEndedInput","setOpenEndedInput","inputType","SingleChoice","choice","choiceClass","htmlFor","userValue","fiveScaleNumbers","sevenScaleNumbers","tenScaleNumbers","getPosthogWidgetClass","getNextSurveyStep","currentQuestionIndex","_question$branching","nextQuestionIndex","branching","End","SpecificQuestion","isInteger","ResponseBased","_question$branching2","_question$branching2$","selectedChoiceIndex","responseValues","nextStep","Rating","_question$branching3","_question$branching3$","ratingBucket","responseValue","getRatingBucketForResponseValue","SurveyManager","_surveyPopups$shadowR","surveyPopups","childElementCount","surveyWaitPeriodInDays","seenSurveyWaitPeriodInDays","hasWaitPeriodPassed","lastSeenSurveyDate","waitPeriodInDays","today","diff","abs","ceil","getItem","surveySeen","getSurveySeen","clearSurveyTimeout","addSurveyToFocus","delaySeconds","surveyPopupDelaySeconds","createShadow","styleElement","Preact","SurveyPopup","removeSurveyFromFocus","timeoutId","surveyTimeouts","stylesheetContent","FeedbackWidget","_survey$appearance2","selectorOnPage","widgetSelector","handleWidget","_document$querySelect","_document$querySelect2","surveyPopup","setAttribute","renderReason","visible","end_date","disabledReason","Popover","linked_flag_key","featureFlags","isFeatureEnabled","targeting_flag_key","internal_targeting_flag_key","_this$posthog","forceReload","getActiveMatchingSurveys","nonAPISurveys","sortSurveysByAppearanceDelay","surveyInFocus","_survey$appearance3","_survey$appearance4","_survey$appearance5","widgetType","handleWidgetSelector","canShowNextEventBasedSurvey","handlePopoverSurvey","_a$appearance","_b$appearance","getTestAPI","generateSurveys","surveyManager","callSurveysAndEvaluateDisplayLogic","setInterval","useHideSurveyOnURLChange","setSurveyVisible","checkUrlMatch","originalPushState","history","pushState","originalReplaceState","replaceState","_survey$appearance11","_style","_style2","_survey$appearance12","_survey$appearance13","_survey$appearance14","onCloseConfirmationMessage","surveyPopupDelayMilliseconds","isPopupVisible","isSurveySent","setIsPopupVisible","millisecondDelay","setIsSurveySent","handleSurveyClosed","handleSurveySent","_survey$appearance9","_survey$appearance10","autoDisappear","showSurvey","toISOString","_document$querySelect3","_document$querySelect4","inputField","focus","usePopupVisibility","shouldShowConfirmation","confirmationBoxLeftStyle","Provider","thankYouMessageDescription","thankYouMessageDescriptionContentType","Questions","_survey$appearance15","_survey$appearance16","questionsResponses","setQuestionsResponses","setCurrentQuestionIndex","surveyQuestions","_survey$appearance17","getQuestionComponent","questionId","responseKey","getSurveyResponseKey","onNextButtonClick","_survey$appearance23","_survey$appearance24","isFeedbackButtonVisible","setIsFeedbackButtonVisible","setShowSurvey","setStyle","widgetRef","_survey$appearance18","_survey$appearance20","_survey$appearance19","widgetPos","bottom","borderRadius","borderBottom","_document$querySelect5","widget","_survey$appearance21","_survey$appearance22","buttonRect","viewportHeight","surveyWidth","showAbove","topPosition","scrollY","border","boxShadow","maxHeight","spacing","resetShowSurvey","widgetLabel","questionComponents","Open","Link","commonProps","additionalProps","Component","componentProps","isEvent","isInstanceOf","base","isPrimitive","isBuiltin","isDOMError","extendPostHogWithSurveys","WEBPACK_ERROR_REGEXP","STACKTRACE_FRAME_LIMIT","UNKNOWN_FUNCTION","createFrame","filename","lineno","colno","frame","platform","function","in_app","chromeRegexNoFnName","chromeRegex","chromeEvalRegex","geckoREgex","geckoEvalRegex","defaultStackParser","parsers","sortedParsers","skipFirstLines","frames","cleanedLine","parser","localStack","getLastStackFrame","reverseAndStripFrames","createStackParser","noFnParts","col","subMatch","extractSafariExtensionDetails","arr","parsedStackResults","lastKeysCount","cachedFilenameChunkIds","isSafariExtension","isSafariWebExtension","ERROR_TYPES_PATTERN","parseStackFrames","ex","framesToPop","skipLines","reactMinifiedRegexp","getSkipFirstStackStringLines","filenameDebugIdMap","stackParser","chunkIdMap","_posthogChunkIds","chunkIdKeys","reduce","acc","stackKey","result","parsedStack","chunkId","getFilenameToChunkIdMap","chunk_id","applyChunkIds","errorPropertiesFromError","metadata","_metadata$handled","_metadata$synthetic","handled","synthetic","$exception_list","overrideExceptionType","overrideExceptionMessage","extractMessage","mechanism","$exception_level","errorPropertiesFromString","_metadata$handled2","_metadata$synthetic2","_metadata$defaultExce","exception","defaultExceptionType","defaultExceptionMessage","syntheticException","isSeverityLevel","errorPropertiesFromObject","_metadata$handled3","_metadata$synthetic3","exceptionType","exceptionMessage","maxLength","serialized","extractExceptionKeysForMessage","errorToProperties","errorProperties","isDOMException","domException","isErrorWithStack","code","isErrorEvent","isError","isPlainObject","groups","unhandledRejectionToProperties","ev","detail","getUnhandledRejectionError","posthogErrorWrappingFunctions","wrapOnError","captureFn","originalOnError","onerror","_originalOnError","__POSTHOG_INSTRUMENTED__","_win$onerror","wrapUnhandledRejection","originalOnUnhandledRejection","onunhandledrejection","_originalOnUnhandledR","_win$onunhandledrejec","errorWrappingFunctions","parseErrorAsProperties","addTracingHeaders","sessionManager","sessionId","windowId","checkAndGetSessionAndWindowId","patchFns","_patchFetch","_patchXHR","tracingHeadersPatchFns","postHogTracingHeadersPatchFns","self","getEntriesByType","responseStart","domInteractive","domContentLoadedEventStart","domComplete","toUpperCase","o","u","persisted","timeStamp","activationStart","prerendering","wasDiscarded","delta","navigationType","buffered","visibilityState","T","E","S","firstHiddenTime","L","C","max","reportAllChanges","M","I","k","A","interactionId","F","interactionCount","P","durationThreshold","B","O","R","q","H","latency","N","requestIdleCallback","W","z","PerformanceEventTiming","j","takeRecords","U","V","_","G","J","K","Q","X","Y","nt","processingEnd","renderTime","processingStart","it","at","postHogWebVitalsCallbacks","once","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","requestStart","navigationEntry","lcpEntry","lcpResourceEntry","attribution","hadRecentInput","sources","largestShiftTarget","largestShiftTime","largestShiftValue","largestShiftSource","largestShiftEntry","loadState","firstByteToFCP","fcpEntry","onINP","interactionTarget","interactionTargetElement","interactionType","interactionTime","nextPaintTime","processedEventEntries","longAnimationFrameEntries","inputDelay","processingDuration","presentationDelay","limitText","previousElementSibling","_el","getPropertiesFromElement","maskAllAttributes","maskText","elementAttributeIgnorelist","nthChild","nthOfType","currentElem","autocapturePropertiesForElement","_elementsJson$","_elementsJson$2","maskAllElementAttributes","maskAllText","elementAttributeIgnoreList","elementsChainAsString","targetElementList","externalHref","elementsJson","autocaptureAugmentProperties","explicitNoCapture","shouldCaptureEl","augmentProperties","propertyKey","propertyValue","getAugmentPropertiesFromElement","_convertToURL","hrefHost","locationHost","$event_type","$ce_version","$elements_chain","$external_click_url","cachedImplementations","getNativeMutationObserverImplementation","cached","impl","sandbox","hidden","getNativeImplementation","asClick","eventTarget","srcElement","_e$target","originalEvent","checkTimeout","thresholdMs","LazyLoadedDeadClicksAutocapture","asRequiredConfig","providedConfig","_providedConfig$eleme","_providedConfig$scrol","_providedConfig$selec","_providedConfig$mutat","defaultConfig","_defaultConfig","__onCapture","_captureDeadClick","element_attribute_ignorelist","scroll_threshold_ms","selection_change_threshold_ms","mutation_threshold_ms","defaultOnCapture","click","_ignoreClick","_clicks","_checkClickTimer","_checkClicks","candidateNow","scrollDelayMs","_lastSelectionChanged","_config","_onCapture","observerTarget","_startClickObserver","_startScrollObserver","_startSelectionChangedObserver","_startMutationObserver","_mutationObserver","NativeMutationObserver","onMutation","stop","_this$_mutationObserv","_onClick","_onScroll","_onSelectionChange","_mutations","_lastMutation","_el$closest","alreadyClickedInLastSecond","clicksToCheck","_click$mutationDelayM","mutationDelayMs","absoluteDelayMs","selectionChangedDelayMs","scrollTimeout","selectionChangedTimeout","mutationTimeout","absoluteTimeout","hadScroll","hadMutation","hadSelectionChange","$dead_click_last_mutation_timestamp","$dead_click_event_timestamp","$dead_click_scroll_timeout","$dead_click_mutation_timeout","$dead_click_absolute_timeout","$dead_click_selection_changed_timeout","mask_all_element_attributes","mask_all_text","$dead_click_scroll_delay_ms","$dead_click_mutation_delay_ms","$dead_click_absolute_delay_ms","$dead_click_selection_changed_delay_ms","initDeadClicksAutocapture","ph"],"mappings":"o4CAGIA,aAHAC,EAAYC,OAAOC,eAEnBC,EAAgBA,CAACC,EAAKC,EAAKC,IADTC,EAACH,EAAKC,EAAKC,IAAUD,KAAOD,EAAMJ,EAAUI,EAAKC,EAAK,CAAEG,YAAY,EAAMC,c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