@amplitude/plugin-autocapture-browser 1.14.2 → 1.14.3

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.
@@ -10,7 +10,7 @@ var CC_REGEX = /\b(?:\d[ -]*?){13,16}\b/;
10
10
  var SSN_REGEX = /(\d{3}-?\d{2}-?\d{4})/g;
11
11
  var EMAIL_REGEX = /[^\s@]+@[^\s@.]+\.[^\s@]+/g;
12
12
  var DataExtractor = /** @class */ (function () {
13
- function DataExtractor(options) {
13
+ function DataExtractor(options, context) {
14
14
  var e_1, _a;
15
15
  var _this = this;
16
16
  var _b;
@@ -50,7 +50,8 @@ var DataExtractor = /** @class */ (function () {
50
50
  // Get the DOM hierarchy of the element, starting from the target element to the root element.
51
51
  this.getHierarchy = function (element) {
52
52
  var e_3, _a;
53
- var _b;
53
+ var _b, _c;
54
+ var startTime = performance.now();
54
55
  var hierarchy = [];
55
56
  if (!element) {
56
57
  return [];
@@ -93,6 +94,8 @@ var DataExtractor = /** @class */ (function () {
93
94
  }
94
95
  finally { if (e_3) throw e_3.error; }
95
96
  }
97
+ var endTime = performance.now();
98
+ (_c = _this.diagnosticsClient) === null || _c === void 0 ? void 0 : _c.recordHistogram('autocapturePlugin.getHierarchy', endTime - startTime);
96
99
  return hierarchy;
97
100
  };
98
101
  this.getNearestLabel = function (element) {
@@ -234,6 +237,7 @@ var DataExtractor = /** @class */ (function () {
234
237
  _a);
235
238
  return removeEmptyProperties(properties);
236
239
  };
240
+ this.diagnosticsClient = context === null || context === void 0 ? void 0 : context.diagnosticsClient;
237
241
  var rawPatterns = (_b = options.maskTextRegex) !== null && _b !== void 0 ? _b : [];
238
242
  var compiled = [];
239
243
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"data-extractor.js","sourceRoot":"","sources":["../../src/data-extractor.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,OAAO,EAA0C,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEjG,OAAO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AU;gBACd,GAAC,SAAS,CAAC,gCAAgC,IAAG,GAAG;gBACjD,GAAC,SAAS,CAAC,iCAAiC,IAAG,KAAI,CAAC,OAAO,CAAC,OAAO,CAAC;gBACpE,GAAC,SAAS,CAAC,6BAA6B,IAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;mBAC9E,CAAC;YACF,OAAO,qBAAqB,CAAC,UAAU,CAA8B,CAAC;QACxE,CAAC,CAAC;QA7PA,IAAM,WAAW,GAAG,MAAA,OAAO,CAAC,aAAa,mCAAI,EAAE,CAAC;QAEhD,IAAM,QAAQ,GAAa,EAAE,CAAC;;YAC9B,KAAoB,IAAA,gBAAA,SAAA,WAAW,CAAA,wCAAA,iEAAE;gBAA5B,IAAM,KAAK,wBAAA;gBACd,IAAI,QAAQ,CAAC,MAAM,IAAI,SAAS,CAAC,sBAAsB,EAAE;oBACvD,MAAM;iBACP;gBACD,IAAI,KAAK,YAAY,MAAM,EAAE;oBAC3B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBACtB;qBAAM,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE;oBAClE,IAAI;wBACF,QAAQ,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;qBAC/C;oBAAC,WAAM;wBACN,iCAAiC;qBAClC;iBACF;aACF;;;;;;;;;QACD,IAAI,CAAC,0BAA0B,GAAG,QAAQ,CAAC;IAC7C,CAAC;IA4OH,oBAAC;AAAD,CAAC,AAlQD,IAkQC","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport { ElementInteractionsOptions, ActionType, getDecodeURI } from '@amplitude/analytics-core';\nimport type { DataSource } from '@amplitude/analytics-core/lib/esm/types/element-interactions';\nimport * as constants from './constants';\nimport {\n removeEmptyProperties,\n extractPrefixedAttributes,\n isElementPointerCursor,\n getClosestElement,\n isElementBasedEvent,\n parseAttributesToMask,\n} from './helpers';\nimport type { BaseTimestampedEvent, ElementBasedTimestampedEvent, TimestampedEvent } from './helpers';\nimport { getAncestors, getElementProperties } from './hierarchy';\nimport type { JSONValue } from './helpers';\nimport { getDataSource } from './pageActions/actions';\nimport { Hierarchy } from './typings/autocapture';\nimport { MASKED_TEXT_VALUE, TEXT_MASK_ATTRIBUTE, getPageTitle } from '@amplitude/analytics-client-common';\n\nconst CC_REGEX = /\\b(?:\\d[ -]*?){13,16}\\b/;\nconst SSN_REGEX = /(\\d{3}-?\\d{2}-?\\d{4})/g;\nconst EMAIL_REGEX = /[^\\s@]+@[^\\s@.]+\\.[^\\s@]+/g;\n\nexport class DataExtractor {\n private readonly additionalMaskTextPatterns: RegExp[];\n\n constructor(options: ElementInteractionsOptions) {\n const rawPatterns = options.maskTextRegex ?? [];\n\n const compiled: RegExp[] = [];\n for (const entry of rawPatterns) {\n if (compiled.length >= constants.MAX_MASK_TEXT_PATTERNS) {\n break;\n }\n if (entry instanceof RegExp) {\n compiled.push(entry);\n } else if ('pattern' in entry && typeof entry.pattern === 'string') {\n try {\n compiled.push(new RegExp(entry.pattern, 'i'));\n } catch {\n // ignore invalid pattern strings\n }\n }\n }\n this.additionalMaskTextPatterns = compiled;\n }\n\n replaceSensitiveString = (text: string | null): string => {\n if (typeof text !== 'string') {\n return '';\n }\n\n let result = text;\n\n // Check for credit card number (with or without spaces/dashes)\n result = result.replace(CC_REGEX, MASKED_TEXT_VALUE);\n\n // Check for social security number\n result = result.replace(SSN_REGEX, MASKED_TEXT_VALUE);\n\n // Check for email\n result = result.replace(EMAIL_REGEX, MASKED_TEXT_VALUE);\n\n // Check for additional mask text patterns\n for (const pattern of this.additionalMaskTextPatterns) {\n try {\n result = result.replace(pattern, MASKED_TEXT_VALUE);\n } catch {\n // ignore invalid pattern\n }\n }\n\n return result;\n };\n\n // Get the DOM hierarchy of the element, starting from the target element to the root element.\n getHierarchy = (element: Element | null): Hierarchy => {\n let hierarchy: Hierarchy = [];\n if (!element) {\n return [];\n }\n\n // Get list of ancestors including itself and get properties at each level in the hierarchy\n const ancestors = getAncestors(element);\n\n // Build attributes to mask map\n const elementToAttributesToMaskMap = new Map<Element, Set<string>>();\n\n for (let i = ancestors.length - 1; i >= 0; i--) {\n const node = ancestors[i];\n if (node) {\n const attributesToMask = parseAttributesToMask(node.getAttribute(constants.DATA_AMP_MASK_ATTRIBUTES));\n const ancestorAttributesToMask =\n i === ancestors.length - 1 ? [] : elementToAttributesToMaskMap.get(ancestors[i + 1]) ?? new Set<string>();\n const combinedAttributesToMask = new Set([...ancestorAttributesToMask, ...attributesToMask]);\n elementToAttributesToMaskMap.set(node, combinedAttributesToMask);\n }\n }\n\n hierarchy = ancestors.map((el) =>\n getElementProperties(el, elementToAttributesToMaskMap.get(el) ?? new Set<string>()),\n );\n\n // Search for and mask any sensitive attribute values\n for (const hierarchyNode of hierarchy) {\n if (hierarchyNode?.attrs) {\n Object.entries(hierarchyNode.attrs).forEach(([key, value]) => {\n if (hierarchyNode.attrs) {\n hierarchyNode.attrs[key] = this.replaceSensitiveString(value);\n }\n });\n }\n }\n\n return hierarchy;\n };\n\n getNearestLabel = (element: Element): string => {\n const parent = element.parentElement;\n if (!parent) {\n return '';\n }\n let labelElement: Element | null;\n try {\n labelElement = parent.querySelector(':scope>span,h1,h2,h3,h4,h5,h6');\n } catch {\n /* istanbul ignore next */\n labelElement = null;\n }\n if (labelElement) {\n /* istanbul ignore next */\n return this.getText(labelElement);\n }\n return this.getNearestLabel(parent);\n };\n\n // Returns the Amplitude event properties for the given element.\n getEventProperties = (actionType: ActionType, element: Element, dataAttributePrefix: string) => {\n /* istanbul ignore next */\n const tag = element?.tagName?.toLowerCase?.();\n /* istanbul ignore next */\n const rect =\n typeof element.getBoundingClientRect === 'function' ? element.getBoundingClientRect() : { left: null, top: null };\n\n const hierarchy = this.getHierarchy(element);\n const currentElementAttributes = hierarchy[0]?.attrs;\n const nearestLabel = this.getNearestLabel(element);\n const attributes = extractPrefixedAttributes(currentElementAttributes ?? {}, dataAttributePrefix);\n\n /* istanbul ignore next */\n const properties: Record<string, any> = {\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_HIERARCHY]: hierarchy,\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_TAG]: tag,\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_TEXT]: this.getText(element),\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_POSITION_LEFT]: rect.left == null ? null : Math.round(rect.left),\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_POSITION_TOP]: rect.top == null ? null : Math.round(rect.top),\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_ATTRIBUTES]: attributes,\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_PARENT_LABEL]: nearestLabel,\n [constants.AMPLITUDE_EVENT_PROP_PAGE_URL]: getDecodeURI(window.location.href.split('?')[0]),\n [constants.AMPLITUDE_EVENT_PROP_PAGE_TITLE]: (\n getPageTitle as (parseTitleFunction: (title: string) => string) => string\n )(this.replaceSensitiveString),\n [constants.AMPLITUDE_EVENT_PROP_VIEWPORT_HEIGHT]: window.innerHeight,\n [constants.AMPLITUDE_EVENT_PROP_VIEWPORT_WIDTH]: window.innerWidth,\n };\n\n // id is never masked, so always include it\n properties[constants.AMPLITUDE_EVENT_PROP_ELEMENT_ID] = element.getAttribute('id') || '';\n\n // class is never masked, so always include it\n properties[constants.AMPLITUDE_EVENT_PROP_ELEMENT_CLASS] = element.getAttribute('class');\n\n properties[constants.AMPLITUDE_EVENT_PROP_ELEMENT_ARIA_LABEL] = currentElementAttributes?.['aria-label'];\n\n if (tag === 'a' && actionType === 'click' && element instanceof HTMLAnchorElement) {\n properties[constants.AMPLITUDE_EVENT_PROP_ELEMENT_HREF] = this.replaceSensitiveString(element.href); // we don't use hierarchy here because we don't want href value to be changed\n }\n\n return removeEmptyProperties(properties);\n };\n\n addAdditionalEventProperties = <T>(\n event: T,\n type: TimestampedEvent<T>['type'],\n selectorAllowlist: string[],\n dataAttributePrefix: string,\n // capture the event if the cursor is a \"pointer\" when this element is clicked on\n // reason: a \"pointer\" cursor indicates that an element should be interactable\n // regardless of the element's tag name\n isCapturingCursorPointer = false,\n ): TimestampedEvent<T> | ElementBasedTimestampedEvent<T> => {\n const baseEvent: BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T> = {\n event,\n timestamp: Date.now(),\n type,\n };\n\n if (isElementBasedEvent(baseEvent) && baseEvent.event.target !== null) {\n if (isCapturingCursorPointer) {\n const isCursorPointer = isElementPointerCursor(baseEvent.event.target as Element, baseEvent.type);\n if (isCursorPointer) {\n baseEvent.closestTrackedAncestor = baseEvent.event.target as HTMLElement;\n baseEvent.targetElementProperties = this.getEventProperties(\n baseEvent.type,\n baseEvent.closestTrackedAncestor,\n dataAttributePrefix,\n );\n return baseEvent;\n }\n }\n // Retrieve additional event properties from the target element\n const closestTrackedAncestor = getClosestElement(baseEvent.event.target as HTMLElement, selectorAllowlist);\n if (closestTrackedAncestor) {\n baseEvent.closestTrackedAncestor = closestTrackedAncestor;\n baseEvent.targetElementProperties = this.getEventProperties(\n baseEvent.type,\n closestTrackedAncestor,\n dataAttributePrefix,\n );\n }\n return baseEvent;\n }\n\n return baseEvent;\n };\n\n extractDataFromDataSource = (dataSource: DataSource, contextElement: HTMLElement) => {\n // Extract from DOM Element\n if (dataSource.sourceType === 'DOM_ELEMENT') {\n const sourceElement = getDataSource(dataSource, contextElement);\n if (!sourceElement) {\n return undefined;\n }\n\n if (dataSource.elementExtractType === 'TEXT') {\n return this.getText(sourceElement);\n } else if (dataSource.elementExtractType === 'ATTRIBUTE' && dataSource.attribute) {\n return sourceElement.getAttribute(dataSource.attribute);\n }\n return undefined;\n }\n\n // TODO: Extract from other source types\n return undefined;\n };\n\n getText = (element: Element): string => {\n // Check if element or any parent has data-amp-mask attribute\n const hasMaskAttribute = element.closest(`[${TEXT_MASK_ATTRIBUTE}]`) !== null;\n if (hasMaskAttribute) {\n return MASKED_TEXT_VALUE;\n }\n let output = '';\n if (!element.querySelector(`[${TEXT_MASK_ATTRIBUTE}], [contenteditable]`)) {\n output = (element as HTMLElement).innerText || '';\n } else {\n const clonedTree = element.cloneNode(true) as HTMLElement;\n // replace all elements with TEXT_MASK_ATTRIBUTE attribute and contenteditable with the text MASKED_TEXT_VALUE\n clonedTree.querySelectorAll(`[${TEXT_MASK_ATTRIBUTE}], [contenteditable]`).forEach((node) => {\n (node as HTMLElement).innerText = MASKED_TEXT_VALUE;\n });\n output = clonedTree.innerText || '';\n }\n return this.replaceSensitiveString(output.substring(0, 255)).replace(/\\s+/g, ' ').trim();\n };\n\n // Returns the element properties for the given element in Visual Labeling.\n getEventTagProps = (element: Element): Record<string, JSONValue> => {\n if (!element) {\n return {};\n }\n /* istanbul ignore next */\n const tag = element?.tagName?.toLowerCase?.();\n\n const properties = {\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_TAG]: tag,\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_TEXT]: this.getText(element),\n [constants.AMPLITUDE_EVENT_PROP_PAGE_URL]: window.location.href.split('?')[0],\n };\n return removeEmptyProperties(properties) as Record<string, JSONValue>;\n };\n}\n"]}
1
+ {"version":3,"file":"data-extractor.js","sourceRoot":"","sources":["../../src/data-extractor.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,OAAO,EAA0C,YAAY,EAAsB,MAAM,2BAA2B,CAAC;AAErH,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE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IAAG,KAAI,CAAC,OAAO,CAAC,OAAO,CAAC;gBACpE,GAAC,SAAS,CAAC,6BAA6B,IAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;mBAC9E,CAAC;YACF,OAAO,qBAAqB,CAAC,UAAU,CAA8B,CAAC;QACxE,CAAC,CAAC;QApQA,IAAI,CAAC,iBAAiB,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,CAAC;QAEpD,IAAM,WAAW,GAAG,MAAA,OAAO,CAAC,aAAa,mCAAI,EAAE,CAAC;QAEhD,IAAM,QAAQ,GAAa,EAAE,CAAC;;YAC9B,KAAoB,IAAA,gBAAA,SAAA,WAAW,CAAA,wCAAA,iEAAE;gBAA5B,IAAM,KAAK,wBAAA;gBACd,IAAI,QAAQ,CAAC,MAAM,IAAI,SAAS,CAAC,sBAAsB,EAAE;oBACvD,MAAM;iBACP;gBACD,IAAI,KAAK,YAAY,MAAM,EAAE;oBAC3B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBACtB;qBAAM,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE;oBAClE,IAAI;wBACF,QAAQ,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;qBAC/C;oBAAC,WAAM;wBACN,iCAAiC;qBAClC;iBACF;aACF;;;;;;;;;QACD,IAAI,CAAC,0BAA0B,GAAG,QAAQ,CAAC;IAC7C,CAAC;IAiPH,oBAAC;AAAD,CAAC,AA1QD,IA0QC","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport { ElementInteractionsOptions, ActionType, getDecodeURI, IDiagnosticsClient } from '@amplitude/analytics-core';\nimport type { DataSource } from '@amplitude/analytics-core/lib/esm/types/element-interactions';\nimport * as constants from './constants';\nimport {\n removeEmptyProperties,\n extractPrefixedAttributes,\n isElementPointerCursor,\n getClosestElement,\n isElementBasedEvent,\n parseAttributesToMask,\n} from './helpers';\nimport type { BaseTimestampedEvent, ElementBasedTimestampedEvent, TimestampedEvent } from './helpers';\nimport { getAncestors, getElementProperties } from './hierarchy';\nimport type { JSONValue } from './helpers';\nimport { getDataSource } from './pageActions/actions';\nimport { Hierarchy } from './typings/autocapture';\nimport { MASKED_TEXT_VALUE, TEXT_MASK_ATTRIBUTE, getPageTitle } from '@amplitude/analytics-client-common';\n\nconst CC_REGEX = /\\b(?:\\d[ -]*?){13,16}\\b/;\nconst SSN_REGEX = /(\\d{3}-?\\d{2}-?\\d{4})/g;\nconst EMAIL_REGEX = /[^\\s@]+@[^\\s@.]+\\.[^\\s@]+/g;\n\nexport class DataExtractor {\n private readonly additionalMaskTextPatterns: RegExp[];\n diagnosticsClient?: IDiagnosticsClient;\n\n constructor(options: ElementInteractionsOptions, context?: { diagnosticsClient: IDiagnosticsClient }) {\n this.diagnosticsClient = context?.diagnosticsClient;\n\n const rawPatterns = options.maskTextRegex ?? [];\n\n const compiled: RegExp[] = [];\n for (const entry of rawPatterns) {\n if (compiled.length >= constants.MAX_MASK_TEXT_PATTERNS) {\n break;\n }\n if (entry instanceof RegExp) {\n compiled.push(entry);\n } else if ('pattern' in entry && typeof entry.pattern === 'string') {\n try {\n compiled.push(new RegExp(entry.pattern, 'i'));\n } catch {\n // ignore invalid pattern strings\n }\n }\n }\n this.additionalMaskTextPatterns = compiled;\n }\n\n replaceSensitiveString = (text: string | null): string => {\n if (typeof text !== 'string') {\n return '';\n }\n\n let result = text;\n\n // Check for credit card number (with or without spaces/dashes)\n result = result.replace(CC_REGEX, MASKED_TEXT_VALUE);\n\n // Check for social security number\n result = result.replace(SSN_REGEX, MASKED_TEXT_VALUE);\n\n // Check for email\n result = result.replace(EMAIL_REGEX, MASKED_TEXT_VALUE);\n\n // Check for additional mask text patterns\n for (const pattern of this.additionalMaskTextPatterns) {\n try {\n result = result.replace(pattern, MASKED_TEXT_VALUE);\n } catch {\n // ignore invalid pattern\n }\n }\n\n return result;\n };\n\n // Get the DOM hierarchy of the element, starting from the target element to the root element.\n getHierarchy = (element: Element | null): Hierarchy => {\n const startTime = performance.now();\n\n let hierarchy: Hierarchy = [];\n if (!element) {\n return [];\n }\n\n // Get list of ancestors including itself and get properties at each level in the hierarchy\n const ancestors = getAncestors(element);\n\n // Build attributes to mask map\n const elementToAttributesToMaskMap = new Map<Element, Set<string>>();\n\n for (let i = ancestors.length - 1; i >= 0; i--) {\n const node = ancestors[i];\n if (node) {\n const attributesToMask = parseAttributesToMask(node.getAttribute(constants.DATA_AMP_MASK_ATTRIBUTES));\n const ancestorAttributesToMask =\n i === ancestors.length - 1 ? [] : elementToAttributesToMaskMap.get(ancestors[i + 1]) ?? new Set<string>();\n const combinedAttributesToMask = new Set([...ancestorAttributesToMask, ...attributesToMask]);\n elementToAttributesToMaskMap.set(node, combinedAttributesToMask);\n }\n }\n\n hierarchy = ancestors.map((el) =>\n getElementProperties(el, elementToAttributesToMaskMap.get(el) ?? new Set<string>()),\n );\n\n // Search for and mask any sensitive attribute values\n for (const hierarchyNode of hierarchy) {\n if (hierarchyNode?.attrs) {\n Object.entries(hierarchyNode.attrs).forEach(([key, value]) => {\n if (hierarchyNode.attrs) {\n hierarchyNode.attrs[key] = this.replaceSensitiveString(value);\n }\n });\n }\n }\n\n const endTime = performance.now();\n this.diagnosticsClient?.recordHistogram('autocapturePlugin.getHierarchy', endTime - startTime);\n\n return hierarchy;\n };\n\n getNearestLabel = (element: Element): string => {\n const parent = element.parentElement;\n if (!parent) {\n return '';\n }\n let labelElement: Element | null;\n try {\n labelElement = parent.querySelector(':scope>span,h1,h2,h3,h4,h5,h6');\n } catch {\n /* istanbul ignore next */\n labelElement = null;\n }\n if (labelElement) {\n /* istanbul ignore next */\n return this.getText(labelElement);\n }\n return this.getNearestLabel(parent);\n };\n\n // Returns the Amplitude event properties for the given element.\n getEventProperties = (actionType: ActionType, element: Element, dataAttributePrefix: string) => {\n /* istanbul ignore next */\n const tag = element?.tagName?.toLowerCase?.();\n /* istanbul ignore next */\n const rect =\n typeof element.getBoundingClientRect === 'function' ? element.getBoundingClientRect() : { left: null, top: null };\n\n const hierarchy = this.getHierarchy(element);\n const currentElementAttributes = hierarchy[0]?.attrs;\n const nearestLabel = this.getNearestLabel(element);\n const attributes = extractPrefixedAttributes(currentElementAttributes ?? {}, dataAttributePrefix);\n\n /* istanbul ignore next */\n const properties: Record<string, any> = {\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_HIERARCHY]: hierarchy,\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_TAG]: tag,\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_TEXT]: this.getText(element),\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_POSITION_LEFT]: rect.left == null ? null : Math.round(rect.left),\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_POSITION_TOP]: rect.top == null ? null : Math.round(rect.top),\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_ATTRIBUTES]: attributes,\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_PARENT_LABEL]: nearestLabel,\n [constants.AMPLITUDE_EVENT_PROP_PAGE_URL]: getDecodeURI(window.location.href.split('?')[0]),\n [constants.AMPLITUDE_EVENT_PROP_PAGE_TITLE]: (\n getPageTitle as (parseTitleFunction: (title: string) => string) => string\n )(this.replaceSensitiveString),\n [constants.AMPLITUDE_EVENT_PROP_VIEWPORT_HEIGHT]: window.innerHeight,\n [constants.AMPLITUDE_EVENT_PROP_VIEWPORT_WIDTH]: window.innerWidth,\n };\n\n // id is never masked, so always include it\n properties[constants.AMPLITUDE_EVENT_PROP_ELEMENT_ID] = element.getAttribute('id') || '';\n\n // class is never masked, so always include it\n properties[constants.AMPLITUDE_EVENT_PROP_ELEMENT_CLASS] = element.getAttribute('class');\n\n properties[constants.AMPLITUDE_EVENT_PROP_ELEMENT_ARIA_LABEL] = currentElementAttributes?.['aria-label'];\n\n if (tag === 'a' && actionType === 'click' && element instanceof HTMLAnchorElement) {\n properties[constants.AMPLITUDE_EVENT_PROP_ELEMENT_HREF] = this.replaceSensitiveString(element.href); // we don't use hierarchy here because we don't want href value to be changed\n }\n\n return removeEmptyProperties(properties);\n };\n\n addAdditionalEventProperties = <T>(\n event: T,\n type: TimestampedEvent<T>['type'],\n selectorAllowlist: string[],\n dataAttributePrefix: string,\n // capture the event if the cursor is a \"pointer\" when this element is clicked on\n // reason: a \"pointer\" cursor indicates that an element should be interactable\n // regardless of the element's tag name\n isCapturingCursorPointer = false,\n ): TimestampedEvent<T> | ElementBasedTimestampedEvent<T> => {\n const baseEvent: BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T> = {\n event,\n timestamp: Date.now(),\n type,\n };\n\n if (isElementBasedEvent(baseEvent) && baseEvent.event.target !== null) {\n if (isCapturingCursorPointer) {\n const isCursorPointer = isElementPointerCursor(baseEvent.event.target as Element, baseEvent.type);\n if (isCursorPointer) {\n baseEvent.closestTrackedAncestor = baseEvent.event.target as HTMLElement;\n baseEvent.targetElementProperties = this.getEventProperties(\n baseEvent.type,\n baseEvent.closestTrackedAncestor,\n dataAttributePrefix,\n );\n return baseEvent;\n }\n }\n // Retrieve additional event properties from the target element\n const closestTrackedAncestor = getClosestElement(baseEvent.event.target as HTMLElement, selectorAllowlist);\n if (closestTrackedAncestor) {\n baseEvent.closestTrackedAncestor = closestTrackedAncestor;\n baseEvent.targetElementProperties = this.getEventProperties(\n baseEvent.type,\n closestTrackedAncestor,\n dataAttributePrefix,\n );\n }\n return baseEvent;\n }\n\n return baseEvent;\n };\n\n extractDataFromDataSource = (dataSource: DataSource, contextElement: HTMLElement) => {\n // Extract from DOM Element\n if (dataSource.sourceType === 'DOM_ELEMENT') {\n const sourceElement = getDataSource(dataSource, contextElement);\n if (!sourceElement) {\n return undefined;\n }\n\n if (dataSource.elementExtractType === 'TEXT') {\n return this.getText(sourceElement);\n } else if (dataSource.elementExtractType === 'ATTRIBUTE' && dataSource.attribute) {\n return sourceElement.getAttribute(dataSource.attribute);\n }\n return undefined;\n }\n\n // TODO: Extract from other source types\n return undefined;\n };\n\n getText = (element: Element): string => {\n // Check if element or any parent has data-amp-mask attribute\n const hasMaskAttribute = element.closest(`[${TEXT_MASK_ATTRIBUTE}]`) !== null;\n if (hasMaskAttribute) {\n return MASKED_TEXT_VALUE;\n }\n let output = '';\n if (!element.querySelector(`[${TEXT_MASK_ATTRIBUTE}], [contenteditable]`)) {\n output = (element as HTMLElement).innerText || '';\n } else {\n const clonedTree = element.cloneNode(true) as HTMLElement;\n // replace all elements with TEXT_MASK_ATTRIBUTE attribute and contenteditable with the text MASKED_TEXT_VALUE\n clonedTree.querySelectorAll(`[${TEXT_MASK_ATTRIBUTE}], [contenteditable]`).forEach((node) => {\n (node as HTMLElement).innerText = MASKED_TEXT_VALUE;\n });\n output = clonedTree.innerText || '';\n }\n return this.replaceSensitiveString(output.substring(0, 255)).replace(/\\s+/g, ' ').trim();\n };\n\n // Returns the element properties for the given element in Visual Labeling.\n getEventTagProps = (element: Element): Record<string, JSONValue> => {\n if (!element) {\n return {};\n }\n /* istanbul ignore next */\n const tag = element?.tagName?.toLowerCase?.();\n\n const properties = {\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_TAG]: tag,\n [constants.AMPLITUDE_EVENT_PROP_ELEMENT_TEXT]: this.getText(element),\n [constants.AMPLITUDE_EVENT_PROP_PAGE_URL]: window.location.href.split('?')[0],\n };\n return removeEmptyProperties(properties) as Record<string, JSONValue>;\n };\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.14.2";
1
+ export declare const VERSION = "1.14.3";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export var VERSION = '1.14.2';
1
+ export var VERSION = '1.14.3';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["export const VERSION = '1.14.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["export const VERSION = '1.14.3';\n"]}
@@ -1,2 +1,2 @@
1
- var amplitudeAutocapturePlugin=function(e){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};function i(e,t,n,r){return new(n||(n=Promise))((function(i,o){function u(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,c)}l((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(l){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,l])}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)u.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return u}function l(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function s(e){return this instanceof s?(this.v=e,this):new s(e)}function a(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",(function(e){return function(t){return Promise.resolve(t).then(e,a)}})),r[Symbol.asyncIterator]=function(){return this},r;function u(e,t){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||c(e,t)}))},t&&(r[e]=t(r[e])))}function c(e,t){try{(n=i[e](t)).value instanceof s?Promise.resolve(n.value.v).then(l,a):d(o[0][2],n)}catch(e){d(o[0][3],e)}var n}function l(e){c("next",e)}function a(e){c("throw",e)}function d(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}}function d(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=u(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}"function"==typeof SuppressedError&&SuppressedError;var f,v,h=function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))},p=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],y="data-amp-track-",b=["div","span","h1","h2","h3","h4","h5","h6"],m=l(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],c(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),g=["*"];!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(f||(f={})),function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(v||(v={}));var w=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,u,c,l,s,a,d,f,h,p,y,b,m,g,w,x,_,E;if("object"!=typeof e)return null;var A=e.code||0,S=this.buildStatus(A);switch(S){case v.Success:return{status:S,statusCode:A,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case v.Invalid:return{status:S,statusCode:A,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(u=e.events_with_invalid_fields)&&void 0!==u?u:{},eventsWithMissingFields:null!==(c=e.events_with_missing_fields)&&void 0!==c?c:{},eventsWithInvalidIdLengths:null!==(l=e.events_with_invalid_id_lengths)&&void 0!==l?l:{},epsThreshold:null!==(s=e.eps_threshold)&&void 0!==s?s:0,exceededDailyQuotaDevices:null!==(a=e.exceeded_daily_quota_devices)&&void 0!==a?a:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(h=e.throttled_devices)&&void 0!==h?h:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case v.PayloadTooLarge:return{status:S,statusCode:A,body:{error:null!==(y=e.error)&&void 0!==y?y:""}};case v.RateLimit:return{status:S,statusCode:A,body:{error:null!==(b=e.error)&&void 0!==b?b:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(g=e.throttled_devices)&&void 0!==g?g:{},throttledUsers:null!==(w=e.throttled_users)&&void 0!==w?w:{},exceededDailyQuotaDevices:null!==(x=e.exceeded_daily_quota_devices)&&void 0!==x?x:{},exceededDailyQuotaUsers:null!==(_=e.exceeded_daily_quota_users)&&void 0!==_?_:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case v.Timeout:default:return{status:S,statusCode:A}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?v.Success:429===e?v.RateLimit:413===e?v.PayloadTooLarge:408===e?v.Timeout:e>=400&&e<500?v.Invalid:e>=500?v.Failed:v.Unknown},e}(),x="Remote config fetch rejected due to timeout after 5 seconds",_="Unexpected error occurred",E=function(){function e(e){var t=e.localConfig,n=e.configKeys,c=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteNamespaceConfig=function(e,t){return i(c,void 0,void 0,(function(){var n,r,i;return o(this,(function(o){switch(o.label){case 0:return n=Date.now(),[4,this.fetchWithTimeout(t)];case 1:return(r=o.sent())&&(i=r.configs&&r.configs[e])?(this.metrics.fetchTimeAPISuccess=Date.now()-n,[2,i]):(this.metrics.fetchTimeAPIFail=Date.now()-n,[2,void 0])}}))}))},this.getRemoteConfig=function(e,t,n){return i(c,void 0,void 0,(function(){var r;return o(this,(function(i){switch(i.label){case 0:return[4,this.getRemoteNamespaceConfig(e,n)];case 1:return[2,null==(r=i.sent())?void 0:r[t]]}}))}))},this.fetchWithTimeout=function(e){return i(c,void 0,void 0,(function(){var t,n,r;return o(this,(function(i){switch(i.label){case 0:return t=new AbortController,n=setTimeout((function(){return t.abort()}),5e3),[4,this.fetchRemoteConfig(t.signal,e)];case 1:return r=i.sent(),clearTimeout(n),[2,r]}}))}))},this.fetchRemoteConfig=function(e,t){return i(c,void 0,void 0,(function(){var n,i,c,l,s,a,d,f,h,p,y,b;return o(this,(function(o){switch(o.label){case 0:if(t===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:"Remote config fetch rejected due to exceeded retry count"})];if(e.aborted)return[2,this.completeRequest({err:x})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),o.label=1;case 1:o.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(i=u(this.configKeys),c=i.next();!c.done;c=i.next())l=c.value,n.append("config_keys",l)}catch(e){p={error:e}}finally{try{c&&!c.done&&(y=i.return)&&y.call(i)}finally{if(p)throw p.error}}return t&&n.set("session_id",String(t)),s={headers:{Accept:"*/*"},method:"GET"},a="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(a,r(r({},s),{signal:e}))];case 2:if(null===(d=o.sent()))return[2,this.completeRequest({err:_})];switch((new w).buildStatus(d.status)){case v.Success:return this.attempts=0,[2,this.parseAndStoreConfig(d)];case v.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:return f=o.sent(),h=f,e.aborted?[2,this.completeRequest({err:x})]:[2,this.completeRequest({err:null!==(b=h.message)&&void 0!==b?b:_})];case 4:return[2]}}))}))},this.retryFetch=function(e,t){return i(c,void 0,void 0,(function(){var n=this;return o(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(e){return setTimeout(e,n.attempts*n.retryTimeout)}))];case 1:return r.sent(),[2,this.fetchRemoteConfig(e,t)]}}))}))},this.parseAndStoreConfig=function(e){return i(c,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return[4,e.json()];case 1:return t=n.sent(),this.completeRequest({success:"Remote config successfully fetched"}),[2,t]}}))}))},this.localConfig=t,this.configKeys=n}return e.prototype.getServerUrl=function(){return this.localConfig.configServerUrl?this.localConfig.configServerUrl:this.localConfig.serverZone===f.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===f.EU?"https://sr-client-cfg.eu.amplitude.com/config":"https://sr-client-cfg.amplitude.com/config"},e.prototype.completeRequest=function(e){var t=e.err,n=e.success;if(t)throw new Error(t);n&&this.localConfig.loggerProvider.log(n)},e}(),A=function(e){var t=e.localConfig,n=e.configKeys;return i(void 0,void 0,void 0,(function(){return o(this,(function(e){return[2,new E({localConfig:t,configKeys:n})]}))}))},S="[Amplitude] Element Clicked",k="[Amplitude] Rage Click",T="[Amplitude] Element Tag",C="[Amplitude] Element Text",O="[Amplitude] Page URL",P="https://app.amplitude.com",I={US:P,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},M="data-amp-mask-attributes";function R(e){return"function"==typeof e}function L(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var j=L((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function F(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var q=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=u(o),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var d=this.initialTeardown;if(R(d))try{d()}catch(e){i=e instanceof j?e.errors:[e]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var v=u(f),h=v.next();!h.done;h=v.next()){var p=h.value;try{U(p)}catch(e){i=null!=i?i:[],e instanceof j?i=l(l([],c(i)),c(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}}if(i)throw new j(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)U(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&F(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&F(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),D=q.EMPTY;function N(e){return e instanceof q||e&&"closed"in e&&R(e.remove)&&R(e.add)&&R(e.unsubscribe)}function U(e){R(e)?e():e.unsubscribe()}var z={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},W=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,l([e,t],c(n)))};function Y(e){W((function(){throw e}))}function H(){}function V(e){e()}var B=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,N(t)&&t.add(n)):n.destination=Q,n}return n(t,e),t.create=function(e,t,n){return new Z(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(q),G=Function.prototype.bind;function K(e,t){return G.call(e,t)}var X=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){J(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){J(e)}else J(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){J(e)}},e}(),Z=function(e){function t(t,n,r){var i,o,u=e.call(this)||this;R(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:u&&z.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},i={next:t.next&&K(t.next,o),error:t.error&&K(t.error,o),complete:t.complete&&K(t.complete,o)}):i=t;return u.destination=new X(i),u}return n(t,e),t}(B);function J(e){Y(e)}var Q={closed:!0,next:H,error:function(e){throw e},complete:H},$="function"==typeof Symbol&&Symbol.observable||"@@observable";function ee(e){return e}var te=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof B||function(e){return e&&R(e.next)&&R(e.error)&&R(e.complete)}(r)&&N(r)?e:new Z(e,t,n);return V((function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=ne(t))((function(t,r){var i=new Z({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[$]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(0===(e=t).length?ee:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=ne(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function ne(e){var t;return null!==(t=null!=e?e:z.Promise)&&void 0!==t?t:Promise}function re(e){return R(null==e?void 0:e.lift)}function ie(e){return function(t){if(re(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function oe(e,t,n,r,i){return new ue(e,t,n,r,i)}var ue=function(e){function t(t,n,r,i,o,u){var c=e.call(this,t)||this;return c.onFinalize=o,c.shouldUnsubscribe=u,c._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,c._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,c}return n(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(B);!function(e){function t(t,n){var r=e.call(this)||this;return r.source=t,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,re(t)&&(r.lift=t.lift),r}n(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new q;var n=this.getSubject();t.add(this.source.subscribe(oe(n,void 0,(function(){e._teardown(),n.complete()}),(function(t){e._teardown(),n.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=q.EMPTY)}return t},t.prototype.refCount=function(){return ie((function(e,t){var n=null;e._refCount++;var r=oe(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)n=null;else{var r=e._connection,i=n;n=null,!r||i&&r!==i||r.unsubscribe(),t.unsubscribe()}}));e.subscribe(r),r.closed||(n=e.connect())}))(this)}}(te);var ce,le={now:function(){return(le.delegate||performance).now()},delegate:void 0},se={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=t((function(t){n=void 0,e(t)}));return new q((function(){return null==n?void 0:n(r)}))},requestAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=se.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,l([],c(e)))},cancelAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cancelAnimationFrame.apply(void 0,l([],c(e)))},delegate:void 0};new te((function(e){var t=ce||le,n=t.now(),r=0,i=function(){e.closed||(r=se.requestAnimationFrame((function(o){r=0;var u=t.now();e.next({timestamp:ce?u:o,elapsed:u-n}),i()})))};return i(),function(){r&&se.cancelAnimationFrame(r)}}));var ae=L((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),de=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return n(t,e),t.prototype.lift=function(e){var t=new fe(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new ae},t.prototype.next=function(e){var t=this;V((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=u(t.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(e)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;V((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},t.prototype.complete=function(){var e=this;V((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?D:(this.currentObservers=null,o.push(e),new q((function(){t.currentObservers=null,F(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new te;return e.source=this,e},t.create=function(e,t){return new fe(e,t)},t}(te),fe=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return n(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:D},t}(de);!function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}n(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)}}(de);var ve={now:function(){return(ve.delegate||Date).now()},delegate:void 0};!function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=ve);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}n(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,u=n._timestampProvider,c=n._windowTime;r||(i.push(t),!o&&i.push(u.now()+c)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var u=n.now(),c=0,l=1;l<r.length&&r[l]<=u;l+=2)c=l;c&&r.splice(0,c+1)}}}(de),function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}n(t,e),t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t._hasValue,i=t._value,o=t.thrownError,u=t.isStopped,c=t._isComplete;n?e.error(o):(u||c)&&(r&&e.next(i),e.complete())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.prototype.complete=function(){var t=this,n=t._hasValue,r=t._value;t._isComplete||(this._isComplete=!0,n&&e.prototype.next.call(this,r),e.prototype.complete.call(this))}}(de);var he,pe=function(e){function t(t,n){return e.call(this)||this}return n(t,e),t.prototype.schedule=function(e,t){return this},t}(q),ye=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,l([e,t],c(n)))},be=function(e){return clearInterval(e)},me=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return n(t,e),t.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),ye(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&be(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,F(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(pe),ge=1,we={};function xe(e){return e in we&&(delete we[e],!0)}var _e=function(e){var t=ge++;return we[t]=!0,he||(he=Promise.resolve()),he.then((function(){return xe(t)&&e()})),t},Ee=function(e){xe(e)},Ae={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Ae.delegate;return((null==n?void 0:n.setImmediate)||_e).apply(void 0,l([],c(e)))},clearImmediate:function(e){return Ee(e)},delegate:void 0},Se=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n(t,e),t.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!==r&&r>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t._scheduled||(t._scheduled=Ae.setImmediate(t.flush.bind(t,void 0))))},t.prototype.recycleAsyncId=function(t,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);var o=t.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(Ae.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},t}(me),ke=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=ve.now,e}(),Te=function(e){function t(t,n){void 0===n&&(n=ke.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return n(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(ke),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var n,r=this.actions;e=e||r.shift();do{if(n=e.execute(e.state,e.delay))break}while((e=r[0])&&e.id===t&&r.shift());if(this._active=!1,n){for(;(e=r[0])&&e.id===t&&r.shift();)e.unsubscribe();throw n}},t}(Te);new Ce(Se);var Oe=new Te(me),Pe=Oe,Ie=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n(t,e),t.prototype.schedule=function(t,n){return void 0===n&&(n=0),n>0?e.prototype.schedule.call(this,t,n):(this.delay=n,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},t.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.flush(this),0)},t}(me),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(Te);new Me(Ie);var Re=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n(t,e),t.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!==r&&r>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t._scheduled||(t._scheduled=se.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.prototype.recycleAsyncId=function(t,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);var o=t.actions;null!=n&&n===t._scheduled&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(se.cancelAnimationFrame(n),t._scheduled=void 0)},t}(me),Le=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.flush=function(e){var t;this._active=!0,e?t=e.id:(t=this._scheduled,this._scheduled=void 0);var n,r=this.actions;e=e||r.shift();do{if(n=e.execute(e.state,e.delay))break}while((e=r[0])&&e.id===t&&r.shift());if(this._active=!1,n){for(;(e=r[0])&&e.id===t&&r.shift();)e.unsubscribe();throw n}},t}(Te);new Le(Re),function(e){function t(t,n){void 0===t&&(t=je),void 0===n&&(n=1/0);var r=e.call(this,t,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}n(t,e),t.prototype.flush=function(){for(var e,t,n=this.actions,r=this.maxFrames;(t=n[0])&&t.delay<=r&&(n.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=n.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10}(Te);var je=function(e){function t(t,n,r){void 0===r&&(r=t.index+=1);var i=e.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.index=r,i.active=!0,i.index=t.index=r,i}return n(t,e),t.prototype.schedule=function(n,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return e.prototype.schedule.call(this,n,r);this.active=!1;var i=new t(this.scheduler,this.work);return this.add(i),i.schedule(n,r)}return q.EMPTY},t.prototype.requestAsyncId=function(e,n,r){void 0===r&&(r=0),this.delay=e.frame+r;var i=e.actions;return i.push(this),i.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(e,t,n){},t.prototype._execute=function(t,n){if(!0===this.active)return e.prototype._execute.call(this,t,n)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(me),Fe=new te((function(e){return e.complete()}));function qe(e){return e&&R(e.schedule)}function De(e){return e[e.length-1]}function Ne(e){return qe(De(e))?e.pop():void 0}var Ue=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function ze(e){return R(null==e?void 0:e.then)}function We(e){return R(e[$])}function Ye(e){return Symbol.asyncIterator&&R(null==e?void 0:e[Symbol.asyncIterator])}function He(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Ve,Be="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Ge(e){return R(null==e?void 0:e[Be])}function Ke(e){return a(this,arguments,(function(){var t,n,r;return o(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,s(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,s(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,s(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function Xe(e){return R(null==e?void 0:e.getReader)}function Ze(e){if(e instanceof te)return e;if(null!=e){if(We(e))return i=e,new te((function(e){var t=i[$]();if(R(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Ue(e))return r=e,new te((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(ze(e))return n=e,new te((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Y)}));if(Ye(e))return Je(e);if(Ge(e))return t=e,new te((function(e){var n,r;try{for(var i=u(t),o=i.next();!o.done;o=i.next()){var c=o.value;if(e.next(c),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()}));if(Xe(e))return Je(Ke(e))}var t,n,r,i;throw He(e)}function Je(e){return new te((function(t){(function(e,t){var n,r,u,c;return i(this,void 0,void 0,(function(){var i,l;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,11]),n=d(e),o.label=1;case 1:return[4,n.next()];case 2:if((r=o.sent()).done)return[3,4];if(i=r.value,t.next(i),t.closed)return[2];o.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=o.sent(),u={error:l},[3,11];case 6:return o.trys.push([6,,9,10]),r&&!r.done&&(c=n.return)?[4,c.call(n)]:[3,8];case 7:o.sent(),o.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function Qe(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule((function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(o),!i)return o}function $e(e,t){return void 0===t&&(t=0),ie((function(n,r){n.subscribe(oe(r,(function(n){return Qe(r,e,(function(){return r.next(n)}),t)}),(function(){return Qe(r,e,(function(){return r.complete()}),t)}),(function(n){return Qe(r,e,(function(){return r.error(n)}),t)})))}))}function et(e,t){return void 0===t&&(t=0),ie((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function tt(e,t){if(!e)throw new Error("Iterable cannot be null");return new te((function(n){Qe(n,t,(function(){var r=e[Symbol.asyncIterator]();Qe(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function nt(e,t){if(null!=e){if(We(e))return function(e,t){return Ze(e).pipe(et(t),$e(t))}(e,t);if(Ue(e))return function(e,t){return new te((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if(ze(e))return function(e,t){return Ze(e).pipe(et(t),$e(t))}(e,t);if(Ye(e))return tt(e,t);if(Ge(e))return function(e,t){return new te((function(n){var r;return Qe(n,t,(function(){r=e[Be](),Qe(n,t,(function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(e){return void n.error(e)}i?n.complete():n.next(t)}),0,!0)})),function(){return R(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(Xe(e))return function(e,t){return tt(Ke(e),t)}(e,t)}throw He(e)}function rt(e,t){return t?nt(e,t):Ze(e)}function it(e){return e instanceof Date&&!isNaN(e)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(Ve||(Ve={})),L((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),L((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),L((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),L((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}));var ot=L((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function ut(e){throw new ot(e)}function ct(e,t){return ie((function(n,r){var i=0;n.subscribe(oe(r,(function(n){r.next(e.call(t,n,i++))})))}))}var lt=Array.isArray;function st(e){return ct((function(t){return function(e,t){return lt(t)?e.apply(void 0,l([],c(t))):e(t)}(e,t)}))}function at(e,t,n){return void 0===n&&(n=1/0),R(t)?at((function(n,r){return ct((function(e,i){return t(n,e,r,i)}))(Ze(e(n,r)))}),n):("number"==typeof t&&(n=t),ie((function(t,r){return function(e,t,n,r,i,o,u,c){var l=[],s=0,a=0,d=!1,f=function(){!d||l.length||s||t.complete()},v=function(e){return s<r?h(e):l.push(e)},h=function(e){o&&t.next(e),s++;var c=!1;Ze(n(e,a++)).subscribe(oe(t,(function(e){null==i||i(e),o?v(e):t.next(e)}),(function(){c=!0}),void 0,(function(){if(c)try{s--;for(var e=function(){var e=l.shift();u?Qe(t,u,(function(){return h(e)})):h(e)};l.length&&s<r;)e();f()}catch(e){t.error(e)}})))};return e.subscribe(oe(t,v,(function(){d=!0,f()}))),function(){null==c||c()}}(t,r,e,n)})))}function dt(e){return void 0===e&&(e=1/0),at(ee,e)}function ft(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return dt(1)(rt(e,Ne(e)))}var vt=["addListener","removeListener"],ht=["addEventListener","removeEventListener"],pt=["on","off"];function yt(e,t,n,r){if(R(n)&&(r=n,n=void 0),r)return yt(e,t,n).pipe(st(r));var i=c(function(e){return R(e.addEventListener)&&R(e.removeEventListener)}(e)?ht.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return R(e.addListener)&&R(e.removeListener)}(e)?vt.map(bt(e,t)):function(e){return R(e.on)&&R(e.off)}(e)?pt.map(bt(e,t)):[],2),o=i[0],u=i[1];if(!o&&Ue(e))return at((function(e){return yt(e,t,n)}))(Ze(e));if(!o)throw new TypeError("Invalid event target");return new te((function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return o(t),function(){return u(t)}}))}function bt(e,t){return function(n){return function(r){return e[n](t,r)}}}function mt(e,t,n){void 0===e&&(e=0),void 0===n&&(n=Pe);var r=-1;return null!=t&&(qe(t)?n=t:r=t),new te((function(t){var i=it(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule((function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())}),i)}))}function gt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Ne(e),r=function(e,t){return"number"==typeof De(e)?e.pop():t}(e,1/0),i=e;return i.length?1===i.length?Ze(i[0]):dt(r)(rt(i,n)):Fe}new te(H);var wt=Array.isArray;function xt(e,t){return ie((function(n,r){var i=0;n.subscribe(oe(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function _t(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===(t=1===(e=t).length&&wt(e[0])?e[0]:e).length?Ze(t[0]):new te(function(e){return function(t){for(var n=[],r=function(r){n.push(Ze(e[r]).subscribe(oe(t,(function(e){if(n){for(var i=0;i<n.length;i++)i!==r&&n[i].unsubscribe();n=null}t.next(e)}))))},i=0;n&&!t.closed&&i<e.length;i++)r(i)}}(t))}function Et(e){return e<=0?function(){return Fe}:ie((function(t,n){var r=0;t.subscribe(oe(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function At(e,t){return t?function(n){return ft(t.pipe(Et(1),ie((function(e,t){e.subscribe(oe(t,H))}))),n.pipe(At(e)))}:at((function(t,n){return Ze(e(t,n)).pipe(Et(1),function(e){return ct((function(){return e}))}(t))}))}function St(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new de}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,u=void 0===o||o,c=e.resetOnRefCountZero,l=void 0===c||c;return function(e){var t,r,o,c=0,s=!1,a=!1,d=function(){null==r||r.unsubscribe(),r=void 0},f=function(){d(),t=o=void 0,s=a=!1},v=function(){var e=t;f(),null==e||e.unsubscribe()};return ie((function(e,h){c++,a||s||d();var p=o=null!=o?o:n();h.add((function(){0!==--c||a||s||(r=kt(v,l))})),p.subscribe(h),!t&&c>0&&(t=new Z({next:function(e){return p.next(e)},error:function(e){a=!0,d(),r=kt(f,i,e),p.error(e)},complete:function(){s=!0,d(),r=kt(f,u),p.complete()}}),Ze(e).subscribe(t))}))(e)}}function kt(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var i=new Z({next:function(){i.unsubscribe(),e()}});return Ze(t.apply(void 0,l([],c(n)))).subscribe(i)}}else e()}function Tt(e,t,n){void 0===t&&(t=Oe);var r=mt(e,t);return function(e,t){return ie((function(n,r){var i=null!=t?t:{},o=i.leading,u=void 0===o||o,c=i.trailing,l=void 0!==c&&c,s=!1,a=null,d=null,f=!1,v=function(){null==d||d.unsubscribe(),d=null,l&&(y(),f&&r.complete())},h=function(){d=null,f&&r.complete()},p=function(t){return d=Ze(e(t)).subscribe(oe(r,v,h))},y=function(){if(s){s=!1;var e=a;a=null,r.next(e),!f&&p(e)}};n.subscribe(oe(r,(function(e){s=!0,a=e,(!d||d.closed)&&(u?y():p(e))}),(function(){f=!0,(!(l&&s&&d)||d.closed)&&r.complete()})))}))}((function(){return r}),n)}var Ct=["input","select","textarea"],Ot=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t},Pt=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,u,c=e.pageUrlAllowlist,l=e.pageUrlExcludelist,s=e.shouldTrackEventResolver,a=null===(u=null===(o=null==i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===u?void 0:u.call(o);if(!a)return!1;if(s)return s(r,i);if(!h(window.location.href,c))return!1;if(l&&l.length>0&&h(window.location.href,l))return!1;var d=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof d)switch(d.toLowerCase()){case"hidden":case"password":return!1}var f=Ot(i,r);if(n&&f)return!0;if(t){var v=t.some((function(e){var t;return!!(null===(t=null==i?void 0:i.matches)||void 0===t?void 0:t.call(i,e))}));if(!v)return!1}switch(a){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!f||"click"===r}}},It=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},Mt=function(e,t){return e?t.some((function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:Mt(null==e?void 0:e.parentElement,t):null};var Rt=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};var Lt="data-amp-mask",jt="*****",Ft=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",M,Lt]),qt=["type"],Dt=["svg","path","g"],Nt=["password","hidden"];function Ut(e,t){var n,r,i,o,c,l;if(null===e)return null;var s=String(e.tagName).toLowerCase(),a={tag:s},d=Array.from(null!==(o=null===(i=e.parentElement)||void 0===i?void 0:i.children)&&void 0!==o?o:[]);d.length&&(a.index=d.indexOf(e),a.indexOfType=d.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var f=null===(l=null===(c=e.previousElementSibling)||void 0===c?void 0:c.tagName)||void 0===l?void 0:l.toLowerCase();f&&(a.prevSib=String(f));var v=e.getAttribute("id");v&&(a.id=String(v));var h=Array.from(e.classList);h.length&&(a.classes=h);var p={},y=Array.from(e.attributes).filter((function(e){return!Ft.has(e.name)})),b=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!Ct.includes(i)&&!o}(e);if(!Nt.includes(String(e.getAttribute("type")))&&!Dt.includes(s))try{for(var m=u(y),g=m.next();!g.done;g=m.next()){var w=g.value;b&&!qt.includes(w.name)||(t.has(w.name)?p[w.name]=jt:p[w.name]=String(w.value).substring(0,128))}}catch(e){n={error:e}}finally{try{g&&!g.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}return Object.keys(p).length&&(a.attrs=p),a}var zt=function(e,t,n){e.forEach((function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}}))},Wt=/\b(?:\d[ -]*?){13,16}\b/,Yt=/(\d{3}-?\d{2}-?\d{4})/g,Ht=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,Vt=function(e){var t,n,r,i=this;this.replaceSensitiveString=function(e){var t,n;if("string"!=typeof e)return"";var r=e;r=(r=(r=r.replace(Wt,jt)).replace(Yt,jt)).replace(Ht,jt);try{for(var o=u(i.additionalMaskTextPatterns),c=o.next();!c.done;c=o.next()){var l=c.value;try{r=r.replace(l,jt)}catch(e){}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r},this.getHierarchy=function(e){var t,n,r,o;if(!e)return[];for(var s,a=function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e),d=new Map,f=a.length-1;f>=0;f--){var v=a[f];if(v){var h=(s=v.getAttribute(M))?s.split(",").map((function(e){return e.trim()})).filter((function(e){return e.length>0&&"id"!==e&&"class"!==e})):[],p=f===a.length-1?[]:null!==(r=d.get(a[f+1]))&&void 0!==r?r:new Set,y=new Set(l(l([],c(p),!1),c(h),!1));d.set(v,y)}}o=a.map((function(e){var t;return Ut(e,null!==(t=d.get(e))&&void 0!==t?t:new Set)}));var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach((function(t){var n=c(t,2),r=n[0],o=n[1];e.attrs&&(e.attrs[r]=i.replaceSensitiveString(o))}))};try{for(var m=u(o),g=m.next();!g.done;g=m.next())b(g.value)}catch(e){t={error:e}}finally{try{g&&!g.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}return o},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?i.getText(t):i.getNearestLabel(n)},this.getEventProperties=function(e,t,n){var r,o,u,l,s,a,d=null===(u=null===(o=null==t?void 0:t.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===u?void 0:u.call(o),f="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},v=i.getHierarchy(t),h=null===(l=v[0])||void 0===l?void 0:l.attrs,p=i.getNearestLabel(t),y=(s=null!=h?h:{},a=n,Object.entries(s).reduce((function(e,t){var n=c(t,2),r=n[0],i=n[1];if(r.startsWith(a)){var o=r.replace(a,"");o&&(e[o]=i||"")}return e}),{})),b=((r={})["[Amplitude] Element Hierarchy"]=v,r[T]=d,r[C]=i.getText(t),r["[Amplitude] Element Position Left"]=null==f.left?null:Math.round(f.left),r["[Amplitude] Element Position Top"]=null==f.top?null:Math.round(f.top),r["[Amplitude] Element Attributes"]=y,r["[Amplitude] Element Parent Label"]=p,r[O]=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n}(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(Lt)?jt:e?e(document.title):document.title}(i.replaceSensitiveString),r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return b["[Amplitude] Element ID"]=t.getAttribute("id")||"",b["[Amplitude] Element Class"]=t.getAttribute("class"),b["[Amplitude] Element Aria Label"]=null==h?void 0:h["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement&&(b["[Amplitude] Element Href"]=i.replaceSensitiveString(t.href)),It(b)},this.addAdditionalEventProperties=function(e,t,n,r,o){void 0===o&&(o=!1);var u={event:e,timestamp:Date.now(),type:t};if(function(e){return"click"===e.type||"change"===e.type}(u)&&null!==u.event.target){if(o&&Ot(u.event.target,u.type))return u.closestTrackedAncestor=u.event.target,u.targetElementProperties=i.getEventProperties(u.type,u.closestTrackedAncestor,r),u;var c=Mt(u.event.target,n);return c&&(u.closestTrackedAncestor=c,u.targetElementProperties=i.getEventProperties(u.type,c,r)),u}return u},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?i.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getText=function(e){if(null!==e.closest("[".concat(Lt,"]")))return jt;var t="";if(e.querySelector("[".concat(Lt,"], [contenteditable]"))){var n=e.cloneNode(!0);n.querySelectorAll("[".concat(Lt,"], [contenteditable]")).forEach((function(e){e.innerText=jt})),t=n.innerText||""}else t=e.innerText||"";return i.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var o=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),u=((t={})[T]=o,t[C]=i.getText(e),t[O]=window.location.href.split("?")[0],t);return It(u)};var o=null!==(r=e.maskTextRegex)&&void 0!==r?r:[],s=[];try{for(var a=u(o),d=a.next();!d.done;d=a.next()){var f=d.value;if(s.length>=25)break;if(f instanceof RegExp)s.push(f);else if("pattern"in f&&"string"==typeof f.pattern)try{s.push(new RegExp(f.pattern,"i"))}catch(e){}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}this.additionalMaskTextPatterns=s},Bt=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?P:t,r=this;this.endpoint=P,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise((function(t,u){r.requestCallbacks[i]={resolve:t,reject:u},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout((function(){u(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{dataExtractor:new Vt({})}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,u=n.cssSelectorAllowlist,c=n.actionClickAllowlist,l=n.dataExtractor;this.logger=r,i&&this.endpoint===P&&(this.endpoint=i);var s=null;window.addEventListener("message",(function(e){var n,r,i,a,d;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var f,v=null==e?void 0:e.data,h=null==v?void 0:v.action;if(h)if("id"in v)null===(a=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===a||a.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(v);else if("ping"===h)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===h){var p=null==v?void 0:v.data;(f="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=f,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(f)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;s=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:l.getEventTagProps,isElementSelectable:function(e){return!o||o((null==p?void 0:p.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:t,cssSelectorAllowlist:u,actionClickAllowlist:c,extractDataFromDataSource:l.extractDataFromDataSource,dataExtractor:l,diagnostics:{autocapture:{version:"1.14.2"}}}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===h&&(null===(d=null==s?void 0:s.close)||void 0===d||d.call(s))}})),this.notify({action:"page-loaded"})},e}();function Gt(e){var t,n,r,i=e.amplitude,o=e.allObservables,l=e.options,s=e.shouldTrackEvent,a=e.evaluateTriggers,d=o.clickObservable,f=d.pipe(ie((function(e,t){var n,r=!1;e.subscribe(oe(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),xt((function(e){var t=c(e,2),n=t[0],r=t[1],i=n.event.target!==r.event.target,o=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return i&&!o}))),v=gt(f,d.pipe((t=l.debounceTime,void 0===n&&(n=Oe),ie((function(e,r){var i=null,o=null,u=null,c=function(){if(i){i.unsubscribe(),i=null;var e=o;o=null,r.next(e)}};function l(){var e=u+t,o=n.now();if(o<e)return i=this.schedule(void 0,e-o),void r.add(i);c()}e.subscribe(oe(r,(function(e){o=e,u=n.now(),i||(i=n.schedule(l,t),r.add(i))}),(function(){c(),r.complete()}),void 0,(function(){o=i=null})))}))),ct((function(){return"timeout"})))),h=d.pipe(function(e,t){void 0===t&&(t=Oe);var n=mt(e,t);return At((function(){return n}))}(0),xt(Rt),xt((function(e){return s("click",e.closestTrackedAncestor)})),ct((function(e){return a(e)})),(r=v,ie((function(e,t){var n=[];return e.subscribe(oe(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),Ze(r).subscribe(oe(t,(function(){var e=n;n=[],t.next(e)}),H)),function(){n=null}}))));return h.subscribe((function(e){var t,n,r=(e.length,S);try{for(var o=u(e),c=o.next();!c.done;c=o.next()){var l=c.value;null==i||i.track(r,l.targetElementProperties)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}))}function Kt(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,u=e.shouldTrackActionClick,s=n.clickObservable,a=n.mutationObservable,d=n.navigateObservable,f=s.pipe(xt((function(e){return!o("click",e.closestTrackedAncestor)})),ct((function(e){var t=Mt(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})),xt(Rt),xt((function(e){return u("click",e.closestTrackedAncestor)}))),v=[a];d&&v.push(d);var h,p,y=gt.apply(void 0,l([],c(v),!1)),b=f.pipe((h=function(e){return y.pipe(Et(1),function(e,t){var n=it(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,u=void 0===o?ut:o,c=n.scheduler,l=void 0===c?null!=t?t:Oe:c,s=n.meta,a=void 0===s?null:s;if(null==r&&null==i)throw new TypeError("No timeout provided.");return ie((function(e,t){var n,o,c=null,s=0,d=function(e){o=Qe(t,l,(function(){try{n.unsubscribe(),Ze(u({meta:a,lastValue:c,seen:s})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(oe(t,(function(e){null==o||o.unsubscribe(),s++,t.next(c=e),i>0&&d(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),c=null}))),!s&&d(null!=r?"number"==typeof r?r:+r-l.now():i)}))}({first:500,with:function(){return Fe}}),ct((function(){return e})))},ie((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(oe(t,(function(e){null==n||n.unsubscribe();var i=0,u=r++;Ze(h(e,u)).subscribe(n=oe(t,(function(n){return t.next(p?p(e,n,u,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return b.subscribe((function(e){null==t||t.track(S,i("click",e.closestTrackedAncestor))}))}var Xt,Zt=function(){return new te((function(e){var t=new MutationObserver((function(t){e.next(t)}));return t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}}))},Jt=function(e){return void 0===e&&(e="click"),yt(document,e,{capture:!0})},Qt={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},$t=function(e){var t,n,r,i,o=Object.values(Qt).reduce((function(e,t){return e[t]=new Set,e}),{});if(!e)return o;try{for(var c=u(e),l=c.next();!l.done;l=c.next()){var s=l.value;try{try{for(var a=(r=void 0,u(s.definition)),d=a.next();!d.done;d=a.next()){var f=d.value,v=Qt[f.event_type];v&&o[v].add(s.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==s?void 0:s.id,e)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return o},en=function(e){var t,n,r,i,o=new Map;try{for(var c=u(e),l=c.next();!l.done;l=c.next()){var s=l.value;try{for(var a=(r=void 0,u(s.conditions)),d=a.next();!d.done;d=a.next()){var f=d.value;if("LABELED_EVENT"===f.type){var v=f.match.eventId,h=o.get(v);h||(h=[],o.set(v,h)),h.push(s)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return o},tn=function(e,t){return t.filter((function(t){return t.definition.some((function(t){return Qt[t.event_type]===e.type&&t.filters.every((function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)}))}))}))},nn=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=function(e,t){var n,r,i,o,c=new Set;try{for(var l=u(e),s=l.next();!s.done;s=l.next()){var a=s.value,d=t.get(a.id);if(d)try{for(var f=(i=void 0,u(d)),v=f.next();!v.done;v=f.next()){var h=v.value;c.add(h)}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return Array.from(c)}(tn(e,Array.from(this.groupedLabeledEvents[e.type]).map((function(e){return r.labeledEvents[e]}))),this.labeledEventToTriggerMap);try{for(var o=u(i),c=o.next();!c.done;c=o.next()){var l=c.value;zt(l.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}();!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable"}(Xt||(Xt={}));var rn=function(e){var t,n,s,a,d,f,v,h;void 0===e&&(e={});var m=e.dataAttributePrefix,g=void 0===m?y:m,w=e.visualTaggingOptions,x=void 0===w?{enabled:!0,messenger:new Bt}:w;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:p,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:b,e.debounceTime=null!==(s=e.debounceTime)&&void 0!==s?s:0,e.pageUrlExcludelist=null===(a=e.pageUrlExcludelist)||void 0===a?void 0:a.reduce((function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e}),[]);var _="@amplitude/plugin-autocapture-browser",E=[],S=new Vt(e),k=$t(Object.values(null!==(f=null===(d=e.pageActions)||void 0===d?void 0:d.labeledEvents)&&void 0!==f?f:{})),T=en(null!==(h=null===(v=e.pageActions)||void 0===v?void 0:v.triggers)&&void 0!==h?h:[]),C=function(e,t,n,r){return new nn(e,t,n,r)}(k,T,S,e);return{name:_,type:"enrichment",setup:function(t,n){return i(void 0,void 0,void 0,(function(){var u,s,a,d,f,v,h,p,y,b;return o(this,(function(m){return"undefined"==typeof document||(t.fetchRemoteConfig&&A({localConfig:t,configKeys:["analyticsSDK.pageActions"]}).then((function(n){return i(void 0,void 0,void 0,(function(){var i,u;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,n.getRemoteConfig("analyticsSDK","pageActions")];case 1:return function(t){var n,i;t&&(e.pageActions=r(r({},e.pageActions),t),k=$t(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),T=en(null!==(i=e.pageActions.triggers)&&void 0!==i?i:[]),C.update(k,T,e))}(o.sent()),[3,3];case 2:return i=o.sent(),null===(u=null==t?void 0:t.loggerProvider)||void 0===u||u.error("Failed to fetch remote config: ".concat(String(i))),[3,3];case 3:return[2]}}))}))})).catch((function(e){var n;null===(n=null==t?void 0:t.loggerProvider)||void 0===n||n.error("Failed to create remote config fetch: ".concat(String(e)))})),u=Pt(e,e.cssSelectorAllowlist),s=Pt(e,e.actionClickAllowlist),a=function(){var t,n,r=Jt().pipe(ct((function(t){return S.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,g)})),St()),i=yt(document,"change",{capture:!0}).pipe(ct((function(t){return S.addAdditionalEventProperties(t,"change",e.cssSelectorAllowlist,g)})),St());window.navigation&&(n=yt(window.navigation,"navigate").pipe(ct((function(t){return S.addAdditionalEventProperties(t,"navigate",e.cssSelectorAllowlist,g)})),St()));var o=Zt().pipe(ct((function(t){return S.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,g)})),St());return(t={})[Xt.ClickObservable]=r,t[Xt.ChangeObservable]=i,t[Xt.NavigateObservable]=n,t[Xt.MutationObservable]=o,t}(),d=Gt({allObservables:a,options:e,amplitude:n,shouldTrackEvent:u,evaluateTriggers:C.evaluate.bind(C)}),E.push(d),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.pipe(xt(Rt),xt((function(e){return i("change",e.closestTrackedAncestor)})),ct((function(e){return o(e)}))).subscribe((function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))}))}({allObservables:a,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return S.getEventProperties.apply(S,l(l([],c(e),!1),[g],!1))},amplitude:n,shouldTrackEvent:u,evaluateTriggers:C.evaluate.bind(C)}),E.push(f),v=Kt({allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return S.getEventProperties.apply(S,l(l([],c(e),!1),[g],!1))},amplitude:n,shouldTrackEvent:u,shouldTrackActionClick:s}),E.push(v),null===(y=null==t?void 0:t.loggerProvider)||void 0===y||y.log("".concat(_," has been successfully added.")),window.opener&&x.enabled&&(h=e.cssSelectorAllowlist,p=e.actionClickAllowlist,null===(b=x.messenger)||void 0===b||b.setup(r(r({dataExtractor:S,logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:I[t.serverZone]}),{isElementSelectable:Pt(e,l(l([],c(h),!1),c(p),!1)),cssSelectorAllowlist:h,actionClickAllowlist:p})))),[2]}))}))},execute:function(e){return i(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))},teardown:function(){return i(void 0,void 0,void 0,(function(){var e,t,n,r;return o(this,(function(i){try{for(e=u(E),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}};function on(e,t){var n,r,i,o,u=t.event,c=u.clientX,l=u.clientY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:l,l),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:l,l),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:c,c),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:c,c),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function un(e){var t=e[0],n=e[e.length-1];return{rageClickEvent:r({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map((function(e){return{X:e.event.clientX,Y:e.event.clientY,Time:e.timestamp}})),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function cn(e){var t,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.clickObservable,u=[],c={};function l(e){u=[],c={},e&&(on(c,e),u.push(e))}return o.pipe(xt(Rt),xt((function(e){return i("click",e.closestTrackedAncestor)})),ct((function(e){if(t&&clearTimeout(t),on(c,e),0===u.length)return u.push(e),null;if(function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(u,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(u,e)||c.isOutOfBounds){var r=u.length>=4?un(u):null;return l(e),r}return u.push(e),u.length>=4&&(t=setTimeout((function(){var e=un(u),t=e.rageClickEvent,r=e.time;n.track(k,t,{time:r}),l()}),1e3)),null})),xt((function(e){return null!==e}))).subscribe((function(e){null!==e&&n.track(k,e.rageClickEvent,{time:e.time})}))}return e.DataExtractor=Vt,e.WindowMessenger=Bt,e.autocapturePlugin=rn,e.frustrationPlugin=function(e){var t,n,s,a,d;void 0===e&&(e={});var f="@amplitude/plugin-frustration-browser",v=[],h=null!==(n=null===(t=e.rageClicks)||void 0===t?void 0:t.cssSelectorAllowlist)&&void 0!==n?n:g,p=null!==(a=null===(s=e.deadClicks)||void 0===s?void 0:s.cssSelectorAllowlist)&&void 0!==a?a:m,b=null!==(d=e.dataAttributePrefix)&&void 0!==d?d:y,w=new Vt(e),x=l([],c(new Set(l(l([],c(h),!1),c(p),!1))),!1);return{name:f,type:"enrichment",setup:function(t,n){return i(void 0,void 0,void 0,(function(){var i,u,s,a,d,y;return o(this,(function(o){return"undefined"==typeof document||(i=Pt(e,h),u=Pt(e,p),s=function(){var e,t,n=Jt("pointerdown").pipe(ct((function(e){return w.addAdditionalEventProperties(e,"click",x,b,!0)})),St());window.navigation&&(t=yt(window.navigation,"navigate").pipe(ct((function(e){return w.addAdditionalEventProperties(e,"navigate",x,b)})),St()));var r=Zt().pipe(ct((function(e){return w.addAdditionalEventProperties(e,"mutation",x,b)})),St());return(e={})[Xt.ClickObservable]=n,e[Xt.ChangeObservable]=new te,e[Xt.NavigateObservable]=t,e[Xt.MutationObservable]=r,e}(),a=cn({allObservables:s,amplitude:n,shouldTrackRageClick:i}),v.push(a),d=function(e){var t=e.amplitude,n=e.allObservables,i=e.getEventProperties,o=e.shouldTrackDeadClick,u=n.clickObservable,s=n.mutationObservable,a=n.navigateObservable,d=u.pipe(xt(Rt),xt((function(e){return o("click",e.closestTrackedAncestor)})),xt((function(e){return null===e.event.target.closest('a[target="_blank"]')}))),f=[s];a&&f.push(a);var v=gt.apply(void 0,l([],c(f),!1));return d.pipe(at((function(e){var t;return _t(new te((function(n){return t=setTimeout((function(){return n.next(e)}),3e3),function(){clearTimeout(t)}})),v.pipe(Et(1),ct((function(){return null})))).pipe(xt((function(e){return null!==e})))})),Tt(3e3)).subscribe((function(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",r(r({},i("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}))}({amplitude:n,allObservables:s,getEventProperties:function(e,t){return w.getEventProperties(e,t,b)},shouldTrackDeadClick:u}),v.push(d),null===(y=null==t?void 0:t.loggerProvider)||void 0===y||y.log("".concat(f," has been successfully added."))),[2]}))}))},execute:function(e){return i(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))},teardown:function(){return i(void 0,void 0,void 0,(function(){var e,t,n,r;return o(this,(function(i){try{for(e=u(v),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}},e.plugin=rn,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
1
+ var amplitudeAutocapturePlugin=function(t){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function i(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{l(r.next(t))}catch(t){o(t)}}function c(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}l((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(l){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=e.call(t,o)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,l])}}}function u(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)u.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return u}function l(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function s(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",(function(t){return function(e){return Promise.resolve(e).then(t,s)}})),r[Symbol.asyncIterator]=function(){return this},r;function u(t,e){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||c(t,e)}))},e&&(r[t]=e(r[t])))}function c(t,e){try{(n=i[t](e)).value instanceof a?Promise.resolve(n.value.v).then(l,s):f(o[0][2],n)}catch(t){f(o[0][3],t)}var n}function l(t){c("next",t)}function s(t){c("throw",t)}function f(t,e){t(e),o.shift(),o.length&&c(o[0][0],o[0][1])}}function f(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=u(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,i,(e=t[n](e)).done,e.value)}))}}}"function"==typeof SuppressedError&&SuppressedError;var d=function(t,e){return!e||!e.length||e.some((function(e){return"string"==typeof e?t===e:t.match(e)}))},v=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],p="data-amp-track-",h=["div","span","h1","h2","h3","h4","h5","h6"],b=l(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],c(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),y=["*"],m="[Amplitude] Element Clicked",g="[Amplitude] Rage Click",w="[Amplitude] Element Tag",x="[Amplitude] Element Text",E="[Amplitude] Page URL",A="https://app.amplitude.com",_={US:A,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},k="data-amp-mask-attributes";function S(t){return"function"==typeof t}function T(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var O=T((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function C(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var P=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=u(o),s=a.next();!s.done;s=a.next()){s.value.remove(this)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var f=this.initialTeardown;if(S(f))try{f()}catch(t){i=t instanceof O?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var v=u(d),p=v.next();!p.done;p=v.next()){var h=p.value;try{j(h)}catch(t){i=null!=i?i:[],t instanceof O?i=l(l([],c(i)),c(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{p&&!p.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}}if(i)throw new O(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)j(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&C(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&C(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),I=P.EMPTY;function M(t){return t instanceof P||t&&"closed"in t&&S(t.remove)&&S(t.add)&&S(t.unsubscribe)}function j(t){S(t)?t():t.unsubscribe()}var L={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},N=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,l([t,e],c(n)))};function q(t){N((function(){throw t}))}function R(){}function F(t){t()}var D=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,M(e)&&e.add(n)):n.destination=B,n}return n(e,t),e.create=function(t,e,n){return new Y(t,e,n)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(P),z=Function.prototype.bind;function U(t,e){return z.call(t,e)}var H=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){V(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){V(t)}else V(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){V(t)}},t}(),Y=function(t){function e(e,n,r){var i,o,u=t.call(this)||this;S(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:u&&L.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return u.unsubscribe()},i={next:e.next&&U(e.next,o),error:e.error&&U(e.error,o),complete:e.complete&&U(e.complete,o)}):i=e;return u.destination=new H(i),u}return n(e,t),e}(D);function V(t){q(t)}var B={closed:!0,next:R,error:function(t){throw t},complete:R},W="function"==typeof Symbol&&Symbol.observable||"@@observable";function X(t){return t}var G=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,o=(r=t)&&r instanceof D||function(t){return t&&S(t.next)&&S(t.error)&&S(t.complete)}(r)&&M(r)?t:new Y(t,e,n);return F((function(){var t=i,e=t.operator,n=t.source;o.add(e?e.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=J(e))((function(e,r){var i=new Y({next:function(e){try{t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[W]=function(){return this},t.prototype.pipe=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return(0===(t=e).length?X:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)})(this)},t.prototype.toPromise=function(t){var e=this;return new(t=J(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function J(t){var e;return null!==(e=null!=t?t:L.Promise)&&void 0!==e?e:Promise}function Z(t){return S(null==t?void 0:t.lift)}function K(t){return function(e){if(Z(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Q(t,e,n,r,i){return new $(t,e,n,r,i)}var $=function(t){function e(e,n,r,i,o,u){var c=t.call(this,e)||this;return c.onFinalize=o,c.shouldUnsubscribe=u,c._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,c._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return n(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(D);!function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,Z(e)&&(r.lift=e.lift),r}n(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,null==t||t.unsubscribe()},e.prototype.connect=function(){var t=this,e=this._connection;if(!e){e=this._connection=new P;var n=this.getSubject();e.add(this.source.subscribe(Q(n,void 0,(function(){t._teardown(),n.complete()}),(function(e){t._teardown(),n.error(e)}),(function(){return t._teardown()})))),e.closed&&(this._connection=null,e=P.EMPTY)}return e},e.prototype.refCount=function(){return K((function(t,e){var n=null;t._refCount++;var r=Q(e,void 0,void 0,void 0,(function(){if(!t||t._refCount<=0||0<--t._refCount)n=null;else{var r=t._connection,i=n;n=null,!r||i&&r!==i||r.unsubscribe(),e.unsubscribe()}}));t.subscribe(r),r.closed||(n=t.connect())}))(this)}}(G);var tt,et={now:function(){return(et.delegate||performance).now()},delegate:void 0},nt={schedule:function(t){var e=requestAnimationFrame,n=cancelAnimationFrame,r=e((function(e){n=void 0,t(e)}));return new P((function(){return null==n?void 0:n(r)}))},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=nt.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,l([],c(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,l([],c(t)))},delegate:void 0};new G((function(t){var e=tt||et,n=e.now(),r=0,i=function(){t.closed||(r=nt.requestAnimationFrame((function(o){r=0;var u=e.now();t.next({timestamp:tt?u:o,elapsed:u-n}),i()})))};return i(),function(){r&&nt.cancelAnimationFrame(r)}}));var rt=T((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),it=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return n(e,t),e.prototype.lift=function(t){var e=new ot(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new rt},e.prototype.next=function(t){var e=this;F((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=u(e.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(t)}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},e.prototype.error=function(t){var e=this;F((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}}))},e.prototype.complete=function(){var t=this;F((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?I:(this.currentObservers=null,o.push(t),new P((function(){e.currentObservers=null,C(o,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new G;return t.source=this,t},e.create=function(t,e){return new ot(t,e)},e}(G),ot=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return n(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:I},e}(it);!function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)}}(it);var ut={now:function(){return(ut.delegate||Date).now()},delegate:void 0};!function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=ut);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}n(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,u=n._timestampProvider,c=n._windowTime;r||(i.push(e),!o&&i.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var u=n.now(),c=0,l=1;l<r.length&&r[l]<=u;l+=2)c=l;c&&r.splice(0,c+1)}}}(it),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._value=null,e._hasValue=!1,e._isComplete=!1,e}n(e,t),e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e._hasValue,i=e._value,o=e.thrownError,u=e.isStopped,c=e._isComplete;n?t.error(o):(u||c)&&(r&&t.next(i),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var e=this,n=e._hasValue,r=e._value;e._isComplete||(this._isComplete=!0,n&&t.prototype.next.call(this,r),t.prototype.complete.call(this))}}(it);var ct,lt=function(t){function e(e,n){return t.call(this)||this}return n(e,t),e.prototype.schedule=function(t,e){return this},e}(P),at=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,l([t,e],c(n)))},st=function(t){return clearInterval(t)},ft=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return n(e,t),e.prototype.schedule=function(t,e){var n;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,e)),this.pending=!0,this.delay=e,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),at(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;null!=e&&st(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,C(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(lt),dt=1,vt={};function pt(t){return t in vt&&(delete vt[t],!0)}var ht=function(t){var e=dt++;return vt[e]=!0,ct||(ct=Promise.resolve()),ct.then((function(){return pt(e)&&t()})),e},bt=function(t){pt(t)},yt={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=yt.delegate;return((null==n?void 0:n.setImmediate)||ht).apply(void 0,l([],c(t)))},clearImmediate:function(t){return bt(t)},delegate:void 0},mt=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=yt.setImmediate(e.flush.bind(e,void 0))))},e.prototype.recycleAsyncId=function(e,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);var o=e.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(yt.clearImmediate(n),e._scheduled===n&&(e._scheduled=void 0))},e}(ft),gt=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=ut.now,t}(),wt=function(t){function e(e,n){void 0===n&&(n=gt.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return n(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(gt),xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(wt);new xt(mt);var Et=new wt(ft),At=Et,_t=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.flush(this),0)},e}(ft),kt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(wt);new kt(_t);var St=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=nt.requestAnimationFrame((function(){return e.flush(void 0)}))))},e.prototype.recycleAsyncId=function(e,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);var o=e.actions;null!=n&&n===e._scheduled&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(nt.cancelAnimationFrame(n),e._scheduled=void 0)},e}(ft),Tt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.flush=function(t){var e;this._active=!0,t?e=t.id:(e=this._scheduled,this._scheduled=void 0);var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(wt);new Tt(St),function(t){function e(e,n){void 0===e&&(e=Ot),void 0===n&&(n=1/0);var r=t.call(this,e,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}n(e,t),e.prototype.flush=function(){for(var t,e,n=this.actions,r=this.maxFrames;(e=n[0])&&e.delay<=r&&(n.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=n.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10}(wt);var Ot=function(t){function e(e,n,r){void 0===r&&(r=e.index+=1);var i=t.call(this,e,n)||this;return i.scheduler=e,i.work=n,i.index=r,i.active=!0,i.index=e.index=r,i}return n(e,t),e.prototype.schedule=function(n,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return t.prototype.schedule.call(this,n,r);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(n,r)}return P.EMPTY},e.prototype.requestAsyncId=function(t,n,r){void 0===r&&(r=0),this.delay=t.frame+r;var i=t.actions;return i.push(this),i.sort(e.sortActions),1},e.prototype.recycleAsyncId=function(t,e,n){},e.prototype._execute=function(e,n){if(!0===this.active)return t.prototype._execute.call(this,e,n)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(ft),Ct=new G((function(t){return t.complete()}));function Pt(t){return t&&S(t.schedule)}function It(t){return t[t.length-1]}function Mt(t){return Pt(It(t))?t.pop():void 0}var jt=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function Lt(t){return S(null==t?void 0:t.then)}function Nt(t){return S(t[W])}function qt(t){return Symbol.asyncIterator&&S(null==t?void 0:t[Symbol.asyncIterator])}function Rt(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Ft,Dt="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function zt(t){return S(null==t?void 0:t[Dt])}function Ut(t){return s(this,arguments,(function(){var e,n,r;return o(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,a(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,a(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,a(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}function Ht(t){return S(null==t?void 0:t.getReader)}function Yt(t){if(t instanceof G)return t;if(null!=t){if(Nt(t))return i=t,new G((function(t){var e=i[W]();if(S(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(jt(t))return r=t,new G((function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()}));if(Lt(t))return n=t,new G((function(t){n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,q)}));if(qt(t))return Vt(t);if(zt(t))return e=t,new G((function(t){var n,r;try{for(var i=u(e),o=i.next();!o.done;o=i.next()){var c=o.value;if(t.next(c),t.closed)return}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()}));if(Ht(t))return Vt(Ut(t))}var e,n,r,i;throw Rt(t)}function Vt(t){return new G((function(e){(function(t,e){var n,r,u,c;return i(this,void 0,void 0,(function(){var i,l;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,11]),n=f(t),o.label=1;case 1:return[4,n.next()];case 2:if((r=o.sent()).done)return[3,4];if(i=r.value,e.next(i),e.closed)return[2];o.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=o.sent(),u={error:l},[3,11];case 6:return o.trys.push([6,,9,10]),r&&!r.done&&(c=n.return)?[4,c.call(n)]:[3,8];case 7:o.sent(),o.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))}))})(t,e).catch((function(t){return e.error(t)}))}))}function Bt(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=e.schedule((function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()}),r);if(t.add(o),!i)return o}function Wt(t,e){return void 0===e&&(e=0),K((function(n,r){n.subscribe(Q(r,(function(n){return Bt(r,t,(function(){return r.next(n)}),e)}),(function(){return Bt(r,t,(function(){return r.complete()}),e)}),(function(n){return Bt(r,t,(function(){return r.error(n)}),e)})))}))}function Xt(t,e){return void 0===e&&(e=0),K((function(n,r){r.add(t.schedule((function(){return n.subscribe(r)}),e))}))}function Gt(t,e){if(!t)throw new Error("Iterable cannot be null");return new G((function(n){Bt(n,e,(function(){var r=t[Symbol.asyncIterator]();Bt(n,e,(function(){r.next().then((function(t){t.done?n.complete():n.next(t.value)}))}),0,!0)}))}))}function Jt(t,e){if(null!=t){if(Nt(t))return function(t,e){return Yt(t).pipe(Xt(e),Wt(e))}(t,e);if(jt(t))return function(t,e){return new G((function(n){var r=0;return e.schedule((function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())}))}))}(t,e);if(Lt(t))return function(t,e){return Yt(t).pipe(Xt(e),Wt(e))}(t,e);if(qt(t))return Gt(t,e);if(zt(t))return function(t,e){return new G((function(n){var r;return Bt(n,e,(function(){r=t[Dt](),Bt(n,e,(function(){var t,e,i;try{e=(t=r.next()).value,i=t.done}catch(t){return void n.error(t)}i?n.complete():n.next(e)}),0,!0)})),function(){return S(null==r?void 0:r.return)&&r.return()}}))}(t,e);if(Ht(t))return function(t,e){return Gt(Ut(t),e)}(t,e)}throw Rt(t)}function Zt(t,e){return e?Jt(t,e):Yt(t)}function Kt(t){return t instanceof Date&&!isNaN(t)}!function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"}(Ft||(Ft={})),T((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}})),T((function(t){return function(){t(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),T((function(t){return function(e){t(this),this.name="NotFoundError",this.message=e}})),T((function(t){return function(e){t(this),this.name="SequenceError",this.message=e}}));var Qt=T((function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}}));function $t(t){throw new Qt(t)}function te(t,e){return K((function(n,r){var i=0;n.subscribe(Q(r,(function(n){r.next(t.call(e,n,i++))})))}))}var ee=Array.isArray;function ne(t){return te((function(e){return function(t,e){return ee(e)?t.apply(void 0,l([],c(e))):t(e)}(t,e)}))}function re(t,e,n){return void 0===n&&(n=1/0),S(e)?re((function(n,r){return te((function(t,i){return e(n,t,r,i)}))(Yt(t(n,r)))}),n):("number"==typeof e&&(n=e),K((function(e,r){return function(t,e,n,r,i,o,u,c){var l=[],a=0,s=0,f=!1,d=function(){!f||l.length||a||e.complete()},v=function(t){return a<r?p(t):l.push(t)},p=function(t){o&&e.next(t),a++;var c=!1;Yt(n(t,s++)).subscribe(Q(e,(function(t){null==i||i(t),o?v(t):e.next(t)}),(function(){c=!0}),void 0,(function(){if(c)try{a--;for(var t=function(){var t=l.shift();u?Bt(e,u,(function(){return p(t)})):p(t)};l.length&&a<r;)t();d()}catch(t){e.error(t)}})))};return t.subscribe(Q(e,v,(function(){f=!0,d()}))),function(){null==c||c()}}(e,r,t,n)})))}function ie(t){return void 0===t&&(t=1/0),re(X,t)}function oe(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ie(1)(Zt(t,Mt(t)))}var ue=["addListener","removeListener"],ce=["addEventListener","removeEventListener"],le=["on","off"];function ae(t,e,n,r){if(S(n)&&(r=n,n=void 0),r)return ae(t,e,n).pipe(ne(r));var i=c(function(t){return S(t.addEventListener)&&S(t.removeEventListener)}(t)?ce.map((function(r){return function(i){return t[r](e,i,n)}})):function(t){return S(t.addListener)&&S(t.removeListener)}(t)?ue.map(se(t,e)):function(t){return S(t.on)&&S(t.off)}(t)?le.map(se(t,e)):[],2),o=i[0],u=i[1];if(!o&&jt(t))return re((function(t){return ae(t,e,n)}))(Yt(t));if(!o)throw new TypeError("Invalid event target");return new G((function(t){var e=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.next(1<e.length?e:e[0])};return o(e),function(){return u(e)}}))}function se(t,e){return function(n){return function(r){return t[n](e,r)}}}function fe(t,e,n){void 0===t&&(t=0),void 0===n&&(n=At);var r=-1;return null!=e&&(Pt(e)?n=e:r=e),new G((function(e){var i=Kt(t)?+t-n.now():t;i<0&&(i=0);var o=0;return n.schedule((function(){e.closed||(e.next(o++),0<=r?this.schedule(void 0,r):e.complete())}),i)}))}function de(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Mt(t),r=function(t,e){return"number"==typeof It(t)?t.pop():e}(t,1/0),i=t;return i.length?1===i.length?Yt(i[0]):ie(r)(Zt(i,n)):Ct}new G(R);var ve=Array.isArray;function pe(t,e){return K((function(n,r){var i=0;n.subscribe(Q(r,(function(n){return t.call(e,n,i++)&&r.next(n)})))}))}function he(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===(e=1===(t=e).length&&ve(t[0])?t[0]:t).length?Yt(e[0]):new G(function(t){return function(e){for(var n=[],r=function(r){n.push(Yt(t[r]).subscribe(Q(e,(function(t){if(n){for(var i=0;i<n.length;i++)i!==r&&n[i].unsubscribe();n=null}e.next(t)}))))},i=0;n&&!e.closed&&i<t.length;i++)r(i)}}(e))}function be(t){return t<=0?function(){return Ct}:K((function(e,n){var r=0;e.subscribe(Q(n,(function(e){++r<=t&&(n.next(e),t<=r&&n.complete())})))}))}function ye(t,e){return e?function(n){return oe(e.pipe(be(1),K((function(t,e){t.subscribe(Q(e,R))}))),n.pipe(ye(t)))}:re((function(e,n){return Yt(t(e,n)).pipe(be(1),function(t){return te((function(){return t}))}(e))}))}function me(t){void 0===t&&(t={});var e=t.connector,n=void 0===e?function(){return new it}:e,r=t.resetOnError,i=void 0===r||r,o=t.resetOnComplete,u=void 0===o||o,c=t.resetOnRefCountZero,l=void 0===c||c;return function(t){var e,r,o,c=0,a=!1,s=!1,f=function(){null==r||r.unsubscribe(),r=void 0},d=function(){f(),e=o=void 0,a=s=!1},v=function(){var t=e;d(),null==t||t.unsubscribe()};return K((function(t,p){c++,s||a||f();var h=o=null!=o?o:n();p.add((function(){0!==--c||s||a||(r=ge(v,l))})),h.subscribe(p),!e&&c>0&&(e=new Y({next:function(t){return h.next(t)},error:function(t){s=!0,f(),r=ge(d,i,t),h.error(t)},complete:function(){a=!0,f(),r=ge(d,u),h.complete()}}),Yt(t).subscribe(e))}))(t)}}function ge(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==e){if(!1!==e){var i=new Y({next:function(){i.unsubscribe(),t()}});return Yt(e.apply(void 0,l([],c(n)))).subscribe(i)}}else t()}function we(t,e,n){void 0===e&&(e=Et);var r=fe(t,e);return function(t,e){return K((function(n,r){var i=null!=e?e:{},o=i.leading,u=void 0===o||o,c=i.trailing,l=void 0!==c&&c,a=!1,s=null,f=null,d=!1,v=function(){null==f||f.unsubscribe(),f=null,l&&(b(),d&&r.complete())},p=function(){f=null,d&&r.complete()},h=function(e){return f=Yt(t(e)).subscribe(Q(r,v,p))},b=function(){if(a){a=!1;var t=s;s=null,r.next(t),!d&&h(t)}};n.subscribe(Q(r,(function(t){a=!0,s=t,(!f||f.closed)&&(u?b():h(t))}),(function(){d=!0,(!(l&&a&&f)||f.closed)&&r.complete()})))}))}((function(){return r}),n)}var xe=["input","select","textarea"],Ee=function(t,e){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,t);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===e},Ae=function(t,e,n){return void 0===n&&(n=!1),function(r,i){var o,u,c=t.pageUrlAllowlist,l=t.pageUrlExcludelist,a=t.shouldTrackEventResolver,s=null===(u=null===(o=null==i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===u?void 0:u.call(o);if(!s)return!1;if(a)return a(r,i);if(!d(window.location.href,c))return!1;if(l&&l.length>0&&d(window.location.href,l))return!1;var f=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof f)switch(f.toLowerCase()){case"hidden":case"password":return!1}var v=Ee(i,r);if(n&&v)return!0;if(e){var p=e.some((function(t){var e;return!!(null===(e=null==i?void 0:i.matches)||void 0===e?void 0:e.call(i,t))}));if(!p)return!1}switch(s){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!v||"click"===r}}},_e=function(t){return Object.keys(t).reduce((function(e,n){var r=t[n];return function(t){return null==t||"object"==typeof t&&0===Object.keys(t).length||"string"==typeof t&&0===t.trim().length}(r)||(e[n]=r),e}),{})},ke=function(t,e){return t?e.some((function(e){var n;return null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e)}))?t:ke(null==t?void 0:t.parentElement,e):null};var Se=function(t){return!(null===t.event.target||!t.closestTrackedAncestor)};var Te="data-amp-mask",Oe="*****",Ce=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",k,Te]),Pe=["type"],Ie=["svg","path","g"],Me=["password","hidden"];function je(t,e){var n,r,i,o,c,l;if(null===t)return null;var a=String(t.tagName).toLowerCase(),s={tag:a},f=Array.from(null!==(o=null===(i=t.parentElement)||void 0===i?void 0:i.children)&&void 0!==o?o:[]);f.length&&(s.index=f.indexOf(t),s.indexOfType=f.filter((function(e){return e.tagName===t.tagName})).indexOf(t));var d=null===(l=null===(c=t.previousElementSibling)||void 0===c?void 0:c.tagName)||void 0===l?void 0:l.toLowerCase();d&&(s.prevSib=String(d));var v=t.getAttribute("id");v&&(s.id=String(v));var p=Array.from(t.classList);p.length&&(s.classes=p);var h={},b=Array.from(t.attributes).filter((function(t){return!Ce.has(t.name)})),y=!function(t){var e,n,r,i=null===(n=null===(e=null==t?void 0:t.tagName)||void 0===e?void 0:e.toLowerCase)||void 0===n?void 0:n.call(e),o=t instanceof HTMLElement&&"true"===(null===(r=t.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!xe.includes(i)&&!o}(t);if(!Me.includes(String(t.getAttribute("type")))&&!Ie.includes(a))try{for(var m=u(b),g=m.next();!g.done;g=m.next()){var w=g.value;y&&!Pe.includes(w.name)||(e.has(w.name)?h[w.name]=Oe:h[w.name]=String(w.value).substring(0,128))}}catch(t){n={error:t}}finally{try{g&&!g.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}return Object.keys(h).length&&(s.attrs=h),s}var Le=function(t,e,n){t.forEach((function(t){if("string"!=typeof t&&"ATTACH_EVENT_PROPERTY"===t.actionType){var r=n.extractDataFromDataSource(t.dataSource,e.closestTrackedAncestor);e.targetElementProperties[t.destinationKey]=r}}))},Ne=/\b(?:\d[ -]*?){13,16}\b/,qe=/(\d{3}-?\d{2}-?\d{4})/g,Re=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,Fe=function(t,e){var n,r,i,o=this;this.replaceSensitiveString=function(t){var e,n;if("string"!=typeof t)return"";var r=t;r=(r=(r=r.replace(Ne,Oe)).replace(qe,Oe)).replace(Re,Oe);try{for(var i=u(o.additionalMaskTextPatterns),c=i.next();!c.done;c=i.next()){var l=c.value;try{r=r.replace(l,Oe)}catch(t){}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},this.getHierarchy=function(t){var e,n,r,i,a,s=performance.now();if(!t)return[];for(var f,d=function(t){var e=[];if(!t)return e;e.push(t);for(var n=t.parentElement;n&&"HTML"!==n.tagName;)e.push(n),n=n.parentElement;return e}(t),v=new Map,p=d.length-1;p>=0;p--){var h=d[p];if(h){var b=(f=h.getAttribute(k))?f.split(",").map((function(t){return t.trim()})).filter((function(t){return t.length>0&&"id"!==t&&"class"!==t})):[],y=p===d.length-1?[]:null!==(r=v.get(d[p+1]))&&void 0!==r?r:new Set,m=new Set(l(l([],c(y),!1),c(b),!1));v.set(h,m)}}a=d.map((function(t){var e;return je(t,null!==(e=v.get(t))&&void 0!==e?e:new Set)}));var g=function(t){(null==t?void 0:t.attrs)&&Object.entries(t.attrs).forEach((function(e){var n=c(e,2),r=n[0],i=n[1];t.attrs&&(t.attrs[r]=o.replaceSensitiveString(i))}))};try{for(var w=u(a),x=w.next();!x.done;x=w.next())g(x.value)}catch(t){e={error:t}}finally{try{x&&!x.done&&(n=w.return)&&n.call(w)}finally{if(e)throw e.error}}var E=performance.now();return null===(i=o.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",E-s),a},this.getNearestLabel=function(t){var e,n=t.parentElement;if(!n)return"";try{e=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(t){e=null}return e?o.getText(e):o.getNearestLabel(n)},this.getEventProperties=function(t,e,n){var r,i,u,l,a,s,f=null===(u=null===(i=null==e?void 0:e.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===u?void 0:u.call(i),d="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{left:null,top:null},v=o.getHierarchy(e),p=null===(l=v[0])||void 0===l?void 0:l.attrs,h=o.getNearestLabel(e),b=(a=null!=p?p:{},s=n,Object.entries(a).reduce((function(t,e){var n=c(e,2),r=n[0],i=n[1];if(r.startsWith(s)){var o=r.replace(s,"");o&&(t[o]=i||"")}return t}),{})),y=((r={})["[Amplitude] Element Hierarchy"]=v,r[w]=f,r[x]=o.getText(e),r["[Amplitude] Element Position Left"]=null==d.left?null:Math.round(d.left),r["[Amplitude] Element Position Top"]=null==d.top?null:Math.round(d.top),r["[Amplitude] Element Attributes"]=b,r["[Amplitude] Element Parent Label"]=h,r[E]=function(t,e){var n=t;try{n=decodeURI(t)}catch(t){null==e||e.error("Malformed URI sequence: ",t)}return n}(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=function(t){if("undefined"==typeof document||!document.title)return"";var e=document.querySelector("title");return e&&e.hasAttribute(Te)?Oe:t?t(document.title):document.title}(o.replaceSensitiveString),r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return y["[Amplitude] Element ID"]=e.getAttribute("id")||"",y["[Amplitude] Element Class"]=e.getAttribute("class"),y["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===f&&"click"===t&&e instanceof HTMLAnchorElement&&(y["[Amplitude] Element Href"]=o.replaceSensitiveString(e.href)),_e(y)},this.addAdditionalEventProperties=function(t,e,n,r,i){void 0===i&&(i=!1);var u={event:t,timestamp:Date.now(),type:e};if(function(t){return"click"===t.type||"change"===t.type}(u)&&null!==u.event.target){if(i&&Ee(u.event.target,u.type))return u.closestTrackedAncestor=u.event.target,u.targetElementProperties=o.getEventProperties(u.type,u.closestTrackedAncestor,r),u;var c=ke(u.event.target,n);return c&&(u.closestTrackedAncestor=c,u.targetElementProperties=o.getEventProperties(u.type,c,r)),u}return u},this.extractDataFromDataSource=function(t,e){if("DOM_ELEMENT"===t.sourceType){var n=function(t,e){try{if("DOM_ELEMENT"===t.sourceType){var n=document.documentElement;return t.scope&&e&&(n=e.closest(t.scope)),n&&t.selector?n.querySelector(t.selector):n}}catch(t){return}}(t,e);if(!n)return;return"TEXT"===t.elementExtractType?o.getText(n):"ATTRIBUTE"===t.elementExtractType&&t.attribute?n.getAttribute(t.attribute):void 0}},this.getText=function(t){if(null!==t.closest("[".concat(Te,"]")))return Oe;var e="";if(t.querySelector("[".concat(Te,"], [contenteditable]"))){var n=t.cloneNode(!0);n.querySelectorAll("[".concat(Te,"], [contenteditable]")).forEach((function(t){t.innerText=Oe})),e=n.innerText||""}else e=t.innerText||"";return o.replaceSensitiveString(e.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(t){var e,n,r;if(!t)return{};var i=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),u=((e={})[w]=i,e[x]=o.getText(t),e[E]=window.location.href.split("?")[0],e);return _e(u)},this.diagnosticsClient=null==e?void 0:e.diagnosticsClient;var a=null!==(i=t.maskTextRegex)&&void 0!==i?i:[],s=[];try{for(var f=u(a),d=f.next();!d.done;d=f.next()){var v=d.value;if(s.length>=25)break;if(v instanceof RegExp)s.push(v);else if("pattern"in v&&"string"==typeof v.pattern)try{s.push(new RegExp(v.pattern,"i"))}catch(t){}}}catch(t){n={error:t}}finally{try{d&&!d.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=s},De=function(){function t(t){var e=(void 0===t?{}:t).origin,n=void 0===e?A:e,r=this;this.endpoint=A,this.requestCallbacks={},this.onSelect=function(t){r.notify({action:"element-selected",data:t})},this.onTrack=function(t,e){"selector-mode-changed"===t?r.notify({action:"track-selector-mode-changed",data:e}):"selector-moved"===t&&r.notify({action:"track-selector-moved",data:e})},this.endpoint=n}return t.prototype.notify=function(t){var e,n,r,i;null===(n=null===(e=this.logger)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"Message sent: ",JSON.stringify(t)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,t,this.endpoint)},t.prototype.sendRequest=function(t,e,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:t,args:e};return new Promise((function(e,u){r.requestCallbacks[i]={resolve:e,reject:u},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout((function(){u(new Error("".concat(t," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},t.prototype.handleResponse=function(t){var e;this.requestCallbacks[t.id]?(this.requestCallbacks[t.id].resolve(t.responseData),delete this.requestCallbacks[t.id]):null===(e=this.logger)||void 0===e||e.warn("No callback found for request id: ".concat(t.id))},t.prototype.setup=function(t){var e=this,n=void 0===t?{dataExtractor:new Fe({})}:t,r=n.logger,i=n.endpoint,o=n.isElementSelectable,u=n.cssSelectorAllowlist,c=n.actionClickAllowlist,l=n.dataExtractor;this.logger=r,i&&this.endpoint===A&&(this.endpoint=i);var a=null;window.addEventListener("message",(function(t){var n,r,i,s,f;if(null===(r=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(t)),e.endpoint===t.origin){var d,v=null==t?void 0:t.data,p=null==v?void 0:v.action;if(p)if("id"in v)null===(s=null===(i=e.logger)||void 0===i?void 0:i.debug)||void 0===s||s.call(i,"Received Response to previous request: ",JSON.stringify(t)),e.handleResponse(v);else if("ping"===p)e.notify({action:"pong"});else if("initialize-visual-tagging-selector"===p){var h=null==v?void 0:v.data;(d="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(t,e){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=d,r.addEventListener("load",(function(){t({status:!0})}),{once:!0}),r.addEventListener("error",(function(){e({status:!1,message:"Failed to load the script ".concat(d)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(t){e(t)}}))).then((function(){var t;a=null===(t=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===t?void 0:t.call(window,{getEventTagProps:l.getEventTagProps,isElementSelectable:function(t){return!o||o((null==h?void 0:h.actionType)||"click",t)},onTrack:e.onTrack,onSelect:e.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:u,actionClickAllowlist:c,extractDataFromDataSource:l.extractDataFromDataSource,dataExtractor:l,diagnostics:{autocapture:{version:"1.14.3"}}}),e.notify({action:"selector-loaded"})})).catch((function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===p&&(null===(f=null==a?void 0:a.close)||void 0===f||f.call(a))}})),this.notify({action:"page-loaded"})},t}();function ze(t){var e,n,r,i=t.amplitude,o=t.allObservables,l=t.options,a=t.shouldTrackEvent,s=t.evaluateTriggers,f=o.clickObservable,d=f.pipe(K((function(t,e){var n,r=!1;t.subscribe(Q(e,(function(t){var i=n;n=t,r&&e.next([i,t]),r=!0})))})),pe((function(t){var e=c(t,2),n=e[0],r=e[1],i=n.event.target!==r.event.target,o=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return i&&!o}))),v=de(d,f.pipe((e=l.debounceTime,void 0===n&&(n=Et),K((function(t,r){var i=null,o=null,u=null,c=function(){if(i){i.unsubscribe(),i=null;var t=o;o=null,r.next(t)}};function l(){var t=u+e,o=n.now();if(o<t)return i=this.schedule(void 0,t-o),void r.add(i);c()}t.subscribe(Q(r,(function(t){o=t,u=n.now(),i||(i=n.schedule(l,e),r.add(i))}),(function(){c(),r.complete()}),void 0,(function(){o=i=null})))}))),te((function(){return"timeout"})))),p=f.pipe(function(t,e){void 0===e&&(e=Et);var n=fe(t,e);return ye((function(){return n}))}(0),pe(Se),pe((function(t){return a("click",t.closestTrackedAncestor)})),te((function(t){return s(t)})),(r=v,K((function(t,e){var n=[];return t.subscribe(Q(e,(function(t){return n.push(t)}),(function(){e.next(n),e.complete()}))),Yt(r).subscribe(Q(e,(function(){var t=n;n=[],e.next(t)}),R)),function(){n=null}}))));return p.subscribe((function(t){var e,n,r=(t.length,m);try{for(var o=u(t),c=o.next();!c.done;c=o.next()){var l=c.value;null==i||i.track(r,l.targetElementProperties)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}))}function Ue(t){var e=t.amplitude,n=t.allObservables,r=t.options,i=t.getEventProperties,o=t.shouldTrackEvent,u=t.shouldTrackActionClick,a=n.clickObservable,s=n.mutationObservable,f=n.navigateObservable,d=a.pipe(pe((function(t){return!o("click",t.closestTrackedAncestor)})),te((function(t){var e=ke(t.event.target,r.actionClickAllowlist);return t.closestTrackedAncestor=e,null!==t.closestTrackedAncestor&&(t.targetElementProperties=i(t.type,t.closestTrackedAncestor)),t})),pe(Se),pe((function(t){return u("click",t.closestTrackedAncestor)}))),v=[s];f&&v.push(f);var p,h,b=de.apply(void 0,l([],c(v),!1)),y=d.pipe((p=function(t){return b.pipe(be(1),function(t,e){var n=Kt(t)?{first:t}:"number"==typeof t?{each:t}:t,r=n.first,i=n.each,o=n.with,u=void 0===o?$t:o,c=n.scheduler,l=void 0===c?null!=e?e:Et:c,a=n.meta,s=void 0===a?null:a;if(null==r&&null==i)throw new TypeError("No timeout provided.");return K((function(t,e){var n,o,c=null,a=0,f=function(t){o=Bt(e,l,(function(){try{n.unsubscribe(),Yt(u({meta:s,lastValue:c,seen:a})).subscribe(e)}catch(t){e.error(t)}}),t)};n=t.subscribe(Q(e,(function(t){null==o||o.unsubscribe(),a++,e.next(c=t),i>0&&f(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),c=null}))),!a&&f(null!=r?"number"==typeof r?r:+r-l.now():i)}))}({first:500,with:function(){return Ct}}),te((function(){return t})))},K((function(t,e){var n=null,r=0,i=!1,o=function(){return i&&!n&&e.complete()};t.subscribe(Q(e,(function(t){null==n||n.unsubscribe();var i=0,u=r++;Yt(p(t,u)).subscribe(n=Q(e,(function(n){return e.next(h?h(t,n,u,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return y.subscribe((function(t){null==e||e.track(m,i("click",t.closestTrackedAncestor))}))}var He,Ye=function(){return new G((function(t){var e=new MutationObserver((function(e){t.next(e)}));return e.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return e.disconnect()}}))},Ve=function(t){return void 0===t&&(t="click"),ae(document,t,{capture:!0})},Be={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},We=function(t){var e,n,r,i,o=Object.values(Be).reduce((function(t,e){return t[e]=new Set,t}),{});if(!t)return o;try{for(var c=u(t),l=c.next();!l.done;l=c.next()){var a=l.value;try{try{for(var s=(r=void 0,u(a.definition)),f=s.next();!f.done;f=s.next()){var d=f.value,v=Be[d.event_type];v&&o[v].add(a.id)}}catch(t){r={error:t}}finally{try{f&&!f.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}catch(t){console.warn("Skipping Labeled Event due to malformed definition",null==a?void 0:a.id,t)}}}catch(t){e={error:t}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}return o},Xe=function(t){var e,n,r,i,o=new Map;try{for(var c=u(t),l=c.next();!l.done;l=c.next()){var a=l.value;try{for(var s=(r=void 0,u(a.conditions)),f=s.next();!f.done;f=s.next()){var d=f.value;if("LABELED_EVENT"===d.type){var v=d.match.eventId,p=o.get(v);p||(p=[],o.set(v,p)),p.push(a)}}}catch(t){r={error:t}}finally{try{f&&!f.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}return o},Ge=function(t,e){return e.filter((function(e){return e.definition.some((function(e){return Be[e.event_type]===t.type&&e.filters.every((function(e){return function(t,e){try{if("[Amplitude] Element Text"===e.subprop_key)return"is"===e.subprop_op&&e.subprop_value.includes(t.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===e.subprop_key)return"autotrack css match"===e.subprop_op&&!!t.closestTrackedAncestor.closest(e.subprop_value.toString())}catch(t){return console.error("Error matching event to filter",t),!1}return!1}(t,e)}))}))}))},Je=function(){function t(t,e,n,r){this.groupedLabeledEvents=t,this.labeledEventToTriggerMap=e,this.dataExtractor=n,this.options=r}return t.prototype.evaluate=function(t){var e,n,r=this.options.pageActions;if(!r)return t;var i=function(t,e){var n,r,i,o,c=new Set;try{for(var l=u(t),a=l.next();!a.done;a=l.next()){var s=a.value,f=e.get(s.id);if(f)try{for(var d=(i=void 0,u(f)),v=d.next();!v.done;v=d.next()){var p=v.value;c.add(p)}}catch(t){i={error:t}}finally{try{v&&!v.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return Array.from(c)}(Ge(t,Array.from(this.groupedLabeledEvents[t.type]).map((function(t){return r.labeledEvents[t]}))),this.labeledEventToTriggerMap);try{for(var o=u(i),c=o.next();!c.done;c=o.next()){var l=c.value;Le(l.actions,t,this.dataExtractor)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return t},t.prototype.update=function(t,e,n){this.groupedLabeledEvents=t,this.labeledEventToTriggerMap=e,this.options=n},t}();!function(t){t.ClickObservable="clickObservable",t.ChangeObservable="changeObservable",t.NavigateObservable="navigateObservable",t.MutationObservable="mutationObservable"}(He||(He={}));var Ze=function(t,e){var n,a,s,f,d,b,y,m;void 0===t&&(t={});var g=t.dataAttributePrefix,w=void 0===g?p:g,x=t.visualTaggingOptions,E=void 0===x?{enabled:!0,messenger:new De}:x;t.cssSelectorAllowlist=null!==(n=t.cssSelectorAllowlist)&&void 0!==n?n:v,t.actionClickAllowlist=null!==(a=t.actionClickAllowlist)&&void 0!==a?a:h,t.debounceTime=null!==(s=t.debounceTime)&&void 0!==s?s:0,t.pageUrlExcludelist=null===(f=t.pageUrlExcludelist)||void 0===f?void 0:f.reduce((function(t,e){if("string"==typeof e&&t.push(e),e instanceof RegExp&&t.push(e),"object"==typeof e&&null!==e&&"pattern"in e)try{t.push(new RegExp(e.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(e.pattern),n),t}return t}),[]);var A="@amplitude/plugin-autocapture-browser",k=[],S=new Fe(t,e),T=We(Object.values(null!==(b=null===(d=t.pageActions)||void 0===d?void 0:d.labeledEvents)&&void 0!==b?b:{})),O=Xe(null!==(m=null===(y=t.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==m?m:[]),C=function(t,e,n,r){return new Je(t,e,n,r)}(T,O,S,t);return{name:A,type:"enrichment",setup:function(e,n){return i(void 0,void 0,void 0,(function(){var i,u,a,s,f,d,v,p,h,b;return o(this,(function(o){return"undefined"==typeof document||(e.fetchRemoteConfig&&(e.remoteConfigClient?e.remoteConfigClient.subscribe("analyticsSDK.pageActions","all",(function(e){!function(e){var n,i;e&&(t.pageActions=r(r({},t.pageActions),e),T=We(Object.values(null!==(n=t.pageActions.labeledEvents)&&void 0!==n?n:{})),O=Xe(null!==(i=t.pageActions.triggers)&&void 0!==i?i:[]),C.update(T,O,t))}(e)})):e.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),i=Ae(t,t.cssSelectorAllowlist),u=Ae(t,t.actionClickAllowlist),a=function(){var e,n,r=Ve().pipe(te((function(e){return S.addAdditionalEventProperties(e,"click",t.cssSelectorAllowlist,w)})),me()),i=ae(document,"change",{capture:!0}).pipe(te((function(e){return S.addAdditionalEventProperties(e,"change",t.cssSelectorAllowlist,w)})),me());window.navigation&&(n=ae(window.navigation,"navigate").pipe(te((function(e){return S.addAdditionalEventProperties(e,"navigate",t.cssSelectorAllowlist,w)})),me()));var o=Ye().pipe(te((function(e){return S.addAdditionalEventProperties(e,"mutation",t.cssSelectorAllowlist,w)})),me());return(e={})[He.ClickObservable]=r,e[He.ChangeObservable]=i,e[He.NavigateObservable]=n,e[He.MutationObservable]=o,e}(),s=ze({allObservables:a,options:t,amplitude:n,shouldTrackEvent:i,evaluateTriggers:C.evaluate.bind(C)}),k.push(s),f=function(t){var e=t.amplitude,n=t.allObservables,r=t.getEventProperties,i=t.shouldTrackEvent,o=t.evaluateTriggers;return n.changeObservable.pipe(pe(Se),pe((function(t){return i("change",t.closestTrackedAncestor)})),te((function(t){return o(t)}))).subscribe((function(t){null==e||e.track("[Amplitude] Element Changed",r("change",t.closestTrackedAncestor))}))}({allObservables:a,getEventProperties:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return S.getEventProperties.apply(S,l(l([],c(t),!1),[w],!1))},amplitude:n,shouldTrackEvent:i,evaluateTriggers:C.evaluate.bind(C)}),k.push(f),d=Ue({allObservables:a,options:t,getEventProperties:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return S.getEventProperties.apply(S,l(l([],c(t),!1),[w],!1))},amplitude:n,shouldTrackEvent:i,shouldTrackActionClick:u}),k.push(d),null===(h=null==e?void 0:e.loggerProvider)||void 0===h||h.log("".concat(A," has been successfully added.")),window.opener&&E.enabled&&(v=t.cssSelectorAllowlist,p=t.actionClickAllowlist,null===(b=E.messenger)||void 0===b||b.setup(r(r({dataExtractor:S,logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:_[e.serverZone]}),{isElementSelectable:Ae(t,l(l([],c(v),!1),c(p),!1)),cssSelectorAllowlist:v,actionClickAllowlist:p})))),[2]}))}))},execute:function(t){return i(void 0,void 0,void 0,(function(){return o(this,(function(e){return[2,t]}))}))},teardown:function(){return i(void 0,void 0,void 0,(function(){var t,e,n,r;return o(this,(function(i){try{for(t=u(k),e=t.next();!e.done;e=t.next())e.value.unsubscribe()}catch(t){n={error:t}}finally{try{e&&!e.done&&(r=t.return)&&r.call(t)}finally{if(n)throw n.error}}return[2]}))}))}}};function Ke(t,e){var n,r,i,o,u=e.event,c=u.clientX,l=u.clientY;t.yMin=Math.min(null!==(n=t.yMin)&&void 0!==n?n:l,l),t.yMax=Math.max(null!==(r=t.yMax)&&void 0!==r?r:l,l),t.xMin=Math.min(null!==(i=t.xMin)&&void 0!==i?i:c,c),t.xMax=Math.max(null!==(o=t.xMax)&&void 0!==o?o:c,c),t.isOutOfBounds=t.yMax-t.yMin>50||t.xMax-t.xMin>50}function Qe(t){var e=t[0],n=t[t.length-1];return{rageClickEvent:r({"[Amplitude] Begin Time":new Date(e.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-e.timestamp,"[Amplitude] Clicks":t.map((function(t){return{X:t.event.clientX,Y:t.event.clientY,Time:t.timestamp}})),"[Amplitude] Click Count":t.length},e.targetElementProperties),time:e.timestamp}}function $e(t){var e,n=t.amplitude,r=t.allObservables,i=t.shouldTrackRageClick,o=r.clickObservable,u=[],c={};function l(t){u=[],c={},t&&(Ke(c,t),u.push(t))}return o.pipe(pe(Se),pe((function(t){return i("click",t.closestTrackedAncestor)})),te((function(t){if(e&&clearTimeout(e),Ke(c,t),0===u.length)return u.push(t),null;if(function(t,e){return t.length>0&&t[t.length-1].closestTrackedAncestor!==e.closestTrackedAncestor}(u,t)||function(t,e){var n=t[Math.max(0,t.length-4+1)];return e.timestamp-n.timestamp>=1e3}(u,t)||c.isOutOfBounds){var r=u.length>=4?Qe(u):null;return l(t),r}return u.push(t),u.length>=4&&(e=setTimeout((function(){var t=Qe(u),e=t.rageClickEvent,r=t.time;n.track(g,e,{time:r}),l()}),1e3)),null})),pe((function(t){return null!==t}))).subscribe((function(t){null!==t&&n.track(g,t.rageClickEvent,{time:t.time})}))}return t.DataExtractor=Fe,t.WindowMessenger=De,t.autocapturePlugin=Ze,t.frustrationPlugin=function(t){var e,n,a,s,f;void 0===t&&(t={});var d="@amplitude/plugin-frustration-browser",v=[],h=null!==(n=null===(e=t.rageClicks)||void 0===e?void 0:e.cssSelectorAllowlist)&&void 0!==n?n:y,m=null!==(s=null===(a=t.deadClicks)||void 0===a?void 0:a.cssSelectorAllowlist)&&void 0!==s?s:b,g=null!==(f=t.dataAttributePrefix)&&void 0!==f?f:p,w=new Fe(t),x=l([],c(new Set(l(l([],c(h),!1),c(m),!1))),!1);return{name:d,type:"enrichment",setup:function(e,n){return i(void 0,void 0,void 0,(function(){var i,u,a,s,f,p;return o(this,(function(o){return"undefined"==typeof document||(i=Ae(t,h),u=Ae(t,m),a=function(){var t,e,n=Ve("pointerdown").pipe(te((function(t){return w.addAdditionalEventProperties(t,"click",x,g,!0)})),me());window.navigation&&(e=ae(window.navigation,"navigate").pipe(te((function(t){return w.addAdditionalEventProperties(t,"navigate",x,g)})),me()));var r=Ye().pipe(te((function(t){return w.addAdditionalEventProperties(t,"mutation",x,g)})),me());return(t={})[He.ClickObservable]=n,t[He.ChangeObservable]=new G,t[He.NavigateObservable]=e,t[He.MutationObservable]=r,t}(),s=$e({allObservables:a,amplitude:n,shouldTrackRageClick:i}),v.push(s),f=function(t){var e=t.amplitude,n=t.allObservables,i=t.getEventProperties,o=t.shouldTrackDeadClick,u=n.clickObservable,a=n.mutationObservable,s=n.navigateObservable,f=u.pipe(pe(Se),pe((function(t){return o("click",t.closestTrackedAncestor)})),pe((function(t){return null===t.event.target.closest('a[target="_blank"]')}))),d=[a];s&&d.push(s);var v=de.apply(void 0,l([],c(d),!1));return f.pipe(re((function(t){var e;return he(new G((function(n){return e=setTimeout((function(){return n.next(t)}),3e3),function(){clearTimeout(e)}})),v.pipe(be(1),te((function(){return null})))).pipe(pe((function(t){return null!==t})))})),we(3e3)).subscribe((function(t){var n={"[Amplitude] X":t.event.clientX,"[Amplitude] Y":t.event.clientY};e.track("[Amplitude] Dead Click",r(r({},i("click",t.closestTrackedAncestor)),n),{time:t.timestamp})}))}({amplitude:n,allObservables:a,getEventProperties:function(t,e){return w.getEventProperties(t,e,g)},shouldTrackDeadClick:u}),v.push(f),null===(p=null==e?void 0:e.loggerProvider)||void 0===p||p.log("".concat(d," has been successfully added."))),[2]}))}))},execute:function(t){return i(void 0,void 0,void 0,(function(){return o(this,(function(e){return[2,t]}))}))},teardown:function(){return i(void 0,void 0,void 0,(function(){var t,e,n,r;return o(this,(function(i){try{for(t=u(v),e=t.next();!e.done;e=t.next())e.value.unsubscribe()}catch(t){n={error:t}}finally{try{e&&!e.done&&(r=t.return)&&r.call(t)}finally{if(n)throw n.error}}return[2]}))}))}}},t.plugin=Ze,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
2
2
  //# sourceMappingURL=amplitude-min.js.map
Binary file