@amplitude/plugin-autocapture-browser 1.10.2 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/lib/cjs/autocapture-plugin.d.ts.map +1 -1
  2. package/lib/cjs/autocapture-plugin.js +11 -8
  3. package/lib/cjs/autocapture-plugin.js.map +1 -1
  4. package/lib/cjs/constants.d.ts +1 -0
  5. package/lib/cjs/constants.d.ts.map +1 -1
  6. package/lib/cjs/constants.js +2 -1
  7. package/lib/cjs/constants.js.map +1 -1
  8. package/lib/cjs/data-extractor.d.ts +19 -0
  9. package/lib/cjs/data-extractor.d.ts.map +1 -0
  10. package/lib/cjs/data-extractor.js +230 -0
  11. package/lib/cjs/data-extractor.js.map +1 -0
  12. package/lib/cjs/frustration-plugin.d.ts.map +1 -1
  13. package/lib/cjs/frustration-plugin.js +10 -4
  14. package/lib/cjs/frustration-plugin.js.map +1 -1
  15. package/lib/cjs/helpers.d.ts +0 -10
  16. package/lib/cjs/helpers.d.ts.map +1 -1
  17. package/lib/cjs/helpers.js +1 -154
  18. package/lib/cjs/helpers.js.map +1 -1
  19. package/lib/cjs/libs/messenger.d.ts +3 -1
  20. package/lib/cjs/libs/messenger.d.ts.map +1 -1
  21. package/lib/cjs/libs/messenger.js +4 -4
  22. package/lib/cjs/libs/messenger.js.map +1 -1
  23. package/lib/cjs/pageActions/actions.d.ts +3 -3
  24. package/lib/cjs/pageActions/actions.d.ts.map +1 -1
  25. package/lib/cjs/pageActions/actions.js +3 -23
  26. package/lib/cjs/pageActions/actions.js.map +1 -1
  27. package/lib/cjs/pageActions/triggers.d.ts +4 -2
  28. package/lib/cjs/pageActions/triggers.d.ts.map +1 -1
  29. package/lib/cjs/pageActions/triggers.js +5 -4
  30. package/lib/cjs/pageActions/triggers.js.map +1 -1
  31. package/lib/cjs/version.d.ts +1 -1
  32. package/lib/cjs/version.js +1 -1
  33. package/lib/cjs/version.js.map +1 -1
  34. package/lib/esm/autocapture-plugin.d.ts.map +1 -1
  35. package/lib/esm/autocapture-plugin.js +12 -9
  36. package/lib/esm/autocapture-plugin.js.map +1 -1
  37. package/lib/esm/constants.d.ts +1 -0
  38. package/lib/esm/constants.d.ts.map +1 -1
  39. package/lib/esm/constants.js +1 -0
  40. package/lib/esm/constants.js.map +1 -1
  41. package/lib/esm/data-extractor.d.ts +19 -0
  42. package/lib/esm/data-extractor.d.ts.map +1 -0
  43. package/lib/esm/data-extractor.js +227 -0
  44. package/lib/esm/data-extractor.js.map +1 -0
  45. package/lib/esm/frustration-plugin.d.ts.map +1 -1
  46. package/lib/esm/frustration-plugin.js +11 -5
  47. package/lib/esm/frustration-plugin.js.map +1 -1
  48. package/lib/esm/helpers.d.ts +0 -10
  49. package/lib/esm/helpers.d.ts.map +1 -1
  50. package/lib/esm/helpers.js +0 -146
  51. package/lib/esm/helpers.js.map +1 -1
  52. package/lib/esm/libs/messenger.d.ts +3 -1
  53. package/lib/esm/libs/messenger.d.ts.map +1 -1
  54. package/lib/esm/libs/messenger.js +5 -5
  55. package/lib/esm/libs/messenger.js.map +1 -1
  56. package/lib/esm/pageActions/actions.d.ts +3 -3
  57. package/lib/esm/pageActions/actions.d.ts.map +1 -1
  58. package/lib/esm/pageActions/actions.js +2 -21
  59. package/lib/esm/pageActions/actions.js.map +1 -1
  60. package/lib/esm/pageActions/triggers.d.ts +4 -2
  61. package/lib/esm/pageActions/triggers.d.ts.map +1 -1
  62. package/lib/esm/pageActions/triggers.js +5 -4
  63. package/lib/esm/pageActions/triggers.js.map +1 -1
  64. package/lib/esm/version.d.ts +1 -1
  65. package/lib/esm/version.js +1 -1
  66. package/lib/esm/version.js.map +1 -1
  67. package/lib/scripts/amplitude-min.js +1 -1
  68. package/lib/scripts/amplitude-min.js.gz +0 -0
  69. package/lib/scripts/amplitude-min.js.map +1 -1
  70. package/lib/scripts/amplitude-min.umd.js +1 -1
  71. package/lib/scripts/amplitude-min.umd.js.gz +0 -0
  72. package/lib/scripts/autocapture-plugin.d.ts.map +1 -1
  73. package/lib/scripts/constants.d.ts +1 -0
  74. package/lib/scripts/constants.d.ts.map +1 -1
  75. package/lib/scripts/data-extractor.d.ts +19 -0
  76. package/lib/scripts/data-extractor.d.ts.map +1 -0
  77. package/lib/scripts/frustration-plugin.d.ts.map +1 -1
  78. package/lib/scripts/helpers.d.ts +0 -10
  79. package/lib/scripts/helpers.d.ts.map +1 -1
  80. package/lib/scripts/libs/messenger.d.ts +3 -1
  81. package/lib/scripts/libs/messenger.d.ts.map +1 -1
  82. package/lib/scripts/pageActions/actions.d.ts +3 -3
  83. package/lib/scripts/pageActions/actions.d.ts.map +1 -1
  84. package/lib/scripts/pageActions/triggers.d.ts +4 -2
  85. package/lib/scripts/pageActions/triggers.d.ts.map +1 -1
  86. package/lib/scripts/version.d.ts +1 -1
  87. package/package.json +3 -3
@@ -1,5 +1,6 @@
1
1
  import type { DataSource, PageAction } from '@amplitude/analytics-core/lib/esm/types/element-interactions';
2
- import { ElementBasedTimestampedEvent, ElementBasedEvent } from 'src/helpers';
2
+ import type { DataExtractor } from 'src/data-extractor';
3
+ import type { ElementBasedTimestampedEvent, ElementBasedEvent } from 'src/helpers';
3
4
  /**
4
5
  * Gets the DOM element specified by the data source configuration
5
6
  * @param dataSource - Configuration for finding the target element
@@ -7,6 +8,5 @@ import { ElementBasedTimestampedEvent, ElementBasedEvent } from 'src/helpers';
7
8
  * @returns The matching DOM element or undefined if not found
8
9
  */
9
10
  export declare const getDataSource: (dataSource: DataSource, contextElement: HTMLElement) => Element | null | undefined;
10
- export declare const extractDataFromDataSource: (dataSource: DataSource, contextElement: HTMLElement) => string | null | undefined;
11
- export declare const executeActions: (actions: (string | PageAction)[], ev: ElementBasedTimestampedEvent<ElementBasedEvent>) => void;
11
+ export declare const executeActions: (actions: (string | PageAction)[], ev: ElementBasedTimestampedEvent<ElementBasedEvent>, dataExtractor: DataExtractor) => void;
12
12
  //# sourceMappingURL=actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/pageActions/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAC3G,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG9E;;;;;GAKG;AACH,eAAO,MAAM,aAAa,eAAgB,UAAU,kBAAkB,WAAW,+BAwBhF,CAAC;AAGF,eAAO,MAAM,yBAAyB,eAAgB,UAAU,kBAAkB,WAAW,8BAkB5F,CAAC;AAGF,eAAO,MAAM,cAAc,YAChB,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,MAC5B,6BAA6B,iBAAiB,CAAC,SAepD,CAAC"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/pageActions/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAC3G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGnF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,eAAgB,UAAU,kBAAkB,WAAW,+BAwBhF,CAAC;AAGF,eAAO,MAAM,cAAc,YAChB,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,MAC5B,6BAA6B,iBAAiB,CAAC,iBACpC,aAAa,SAe7B,CAAC"}
@@ -28,34 +28,15 @@ export var getDataSource = function (dataSource, contextElement) {
28
28
  // Return undefined for non-DOM_ELEMENT data sources
29
29
  return undefined;
30
30
  };
31
- // extract DataSource
32
- export var extractDataFromDataSource = function (dataSource, contextElement) {
33
- // Extract from DOM Element
34
- if (dataSource.sourceType === 'DOM_ELEMENT') {
35
- var sourceElement = getDataSource(dataSource, contextElement);
36
- if (!sourceElement) {
37
- return undefined;
38
- }
39
- if (dataSource.elementExtractType === 'TEXT') {
40
- return sourceElement.textContent;
41
- }
42
- else if (dataSource.elementExtractType === 'ATTRIBUTE' && dataSource.attribute) {
43
- return sourceElement.getAttribute(dataSource.attribute);
44
- }
45
- return undefined;
46
- }
47
- // TODO: Extract from other source types
48
- return undefined;
49
- };
50
31
  // Execute actions for a condition and attach event properties to the event if needed
51
- export var executeActions = function (actions, ev) {
32
+ export var executeActions = function (actions, ev, dataExtractor) {
52
33
  actions.forEach(function (action) {
53
34
  // Skip if actions is string until action set is implemented
54
35
  if (typeof action === 'string') {
55
36
  return;
56
37
  }
57
38
  if (action.actionType === 'ATTACH_EVENT_PROPERTY') {
58
- var data = extractDataFromDataSource(action.dataSource, ev.closestTrackedAncestor);
39
+ var data = dataExtractor.extractDataFromDataSource(action.dataSource, ev.closestTrackedAncestor);
59
40
  // Attach data to event
60
41
  ev.targetElementProperties[action.destinationKey] = data;
61
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/pageActions/actions.ts"],"names":[],"mappings":"AAGA,iBAAiB;AACjB;;;;;GAKG;AACH,MAAM,CAAC,IAAM,aAAa,GAAG,UAAC,UAAsB,EAAE,cAA2B;IAC/E,6CAA6C;IAC7C,IAAI;QACF,IAAI,UAAU,CAAC,UAAU,KAAK,aAAa,EAAE;YAC3C,4HAA4H;YAC5H,IAAI,cAAc,GAAuB,QAAQ,CAAC,eAAe,CAAC;YAClE,IAAI,UAAU,CAAC,KAAK,IAAI,cAAc,EAAE;gBACtC,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;aAC3D;YAED,kEAAkE;YAClE,IAAI,cAAc,IAAI,UAAU,CAAC,QAAQ,EAAE;gBACzC,OAAO,cAAc,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;aAC1D;YAED,qDAAqD;YACrD,OAAO,cAAc,CAAC;SACvB;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,SAAS,CAAC;KAClB;IAED,oDAAoD;IACpD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,qBAAqB;AACrB,MAAM,CAAC,IAAM,yBAAyB,GAAG,UAAC,UAAsB,EAAE,cAA2B;IAC3F,2BAA2B;IAC3B,IAAI,UAAU,CAAC,UAAU,KAAK,aAAa,EAAE;QAC3C,IAAM,aAAa,GAAG,aAAa,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAChE,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,UAAU,CAAC,kBAAkB,KAAK,MAAM,EAAE;YAC5C,OAAO,aAAa,CAAC,WAAW,CAAC;SAClC;aAAM,IAAI,UAAU,CAAC,kBAAkB,KAAK,WAAW,IAAI,UAAU,CAAC,SAAS,EAAE;YAChF,OAAO,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;SACzD;QACD,OAAO,SAAS,CAAC;KAClB;IAED,wCAAwC;IACxC,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,qFAAqF;AACrF,MAAM,CAAC,IAAM,cAAc,GAAG,UAC5B,OAAgC,EAChC,EAAmD;IAEnD,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM;QACrB,4DAA4D;QAC5D,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAC9B,OAAO;SACR;QAED,IAAI,MAAM,CAAC,UAAU,KAAK,uBAAuB,EAAE;YACjD,IAAM,IAAI,GAAG,yBAAyB,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,sBAAqC,CAAC,CAAC;YAEpG,uBAAuB;YACvB,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;SAC1D;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { DataSource, PageAction } from '@amplitude/analytics-core/lib/esm/types/element-interactions';\nimport { ElementBasedTimestampedEvent, ElementBasedEvent } from 'src/helpers';\n\n// Get DataSource\n/**\n * Gets the DOM element specified by the data source configuration\n * @param dataSource - Configuration for finding the target element\n * @param contextElement - The element to start searching from\n * @returns The matching DOM element or undefined if not found\n */\nexport const getDataSource = (dataSource: DataSource, contextElement: HTMLElement) => {\n // Only process DOM_ELEMENT type data sources\n try {\n if (dataSource.sourceType === 'DOM_ELEMENT') {\n // If scope is specified, find the closest ancestor matching the scope rather than using documentElement (html) as the scope\n let scopingElement: HTMLElement | null = document.documentElement;\n if (dataSource.scope && contextElement) {\n scopingElement = contextElement.closest(dataSource.scope);\n }\n\n // If we have both a scope and selector, find the matching element\n if (scopingElement && dataSource.selector) {\n return scopingElement.querySelector(dataSource.selector);\n }\n\n // Return scopingElement if no selector was specified\n return scopingElement;\n }\n } catch (error) {\n return undefined;\n }\n\n // Return undefined for non-DOM_ELEMENT data sources\n return undefined;\n};\n\n// extract DataSource\nexport const 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 sourceElement.textContent;\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// Execute actions for a condition and attach event properties to the event if needed\nexport const executeActions = (\n actions: (string | PageAction)[],\n ev: ElementBasedTimestampedEvent<ElementBasedEvent>,\n) => {\n actions.forEach((action) => {\n // Skip if actions is string until action set is implemented\n if (typeof action === 'string') {\n return;\n }\n\n if (action.actionType === 'ATTACH_EVENT_PROPERTY') {\n const data = extractDataFromDataSource(action.dataSource, ev.closestTrackedAncestor as HTMLElement);\n\n // Attach data to event\n ev.targetElementProperties[action.destinationKey] = data;\n }\n });\n};\n"]}
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/pageActions/actions.ts"],"names":[],"mappings":"AAIA,iBAAiB;AACjB;;;;;GAKG;AACH,MAAM,CAAC,IAAM,aAAa,GAAG,UAAC,UAAsB,EAAE,cAA2B;IAC/E,6CAA6C;IAC7C,IAAI;QACF,IAAI,UAAU,CAAC,UAAU,KAAK,aAAa,EAAE;YAC3C,4HAA4H;YAC5H,IAAI,cAAc,GAAuB,QAAQ,CAAC,eAAe,CAAC;YAClE,IAAI,UAAU,CAAC,KAAK,IAAI,cAAc,EAAE;gBACtC,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;aAC3D;YAED,kEAAkE;YAClE,IAAI,cAAc,IAAI,UAAU,CAAC,QAAQ,EAAE;gBACzC,OAAO,cAAc,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;aAC1D;YAED,qDAAqD;YACrD,OAAO,cAAc,CAAC;SACvB;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,SAAS,CAAC;KAClB;IAED,oDAAoD;IACpD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,qFAAqF;AACrF,MAAM,CAAC,IAAM,cAAc,GAAG,UAC5B,OAAgC,EAChC,EAAmD,EACnD,aAA4B;IAE5B,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM;QACrB,4DAA4D;QAC5D,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAC9B,OAAO;SACR;QAED,IAAI,MAAM,CAAC,UAAU,KAAK,uBAAuB,EAAE;YACjD,IAAM,IAAI,GAAG,aAAa,CAAC,yBAAyB,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,sBAAqC,CAAC,CAAC;YAElH,uBAAuB;YACvB,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;SAC1D;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { DataSource, PageAction } from '@amplitude/analytics-core/lib/esm/types/element-interactions';\nimport type { DataExtractor } from 'src/data-extractor';\nimport type { ElementBasedTimestampedEvent, ElementBasedEvent } from 'src/helpers';\n\n// Get DataSource\n/**\n * Gets the DOM element specified by the data source configuration\n * @param dataSource - Configuration for finding the target element\n * @param contextElement - The element to start searching from\n * @returns The matching DOM element or undefined if not found\n */\nexport const getDataSource = (dataSource: DataSource, contextElement: HTMLElement) => {\n // Only process DOM_ELEMENT type data sources\n try {\n if (dataSource.sourceType === 'DOM_ELEMENT') {\n // If scope is specified, find the closest ancestor matching the scope rather than using documentElement (html) as the scope\n let scopingElement: HTMLElement | null = document.documentElement;\n if (dataSource.scope && contextElement) {\n scopingElement = contextElement.closest(dataSource.scope);\n }\n\n // If we have both a scope and selector, find the matching element\n if (scopingElement && dataSource.selector) {\n return scopingElement.querySelector(dataSource.selector);\n }\n\n // Return scopingElement if no selector was specified\n return scopingElement;\n }\n } catch (error) {\n return undefined;\n }\n\n // Return undefined for non-DOM_ELEMENT data sources\n return undefined;\n};\n\n// Execute actions for a condition and attach event properties to the event if needed\nexport const executeActions = (\n actions: (string | PageAction)[],\n ev: ElementBasedTimestampedEvent<ElementBasedEvent>,\n dataExtractor: DataExtractor,\n) => {\n actions.forEach((action) => {\n // Skip if actions is string until action set is implemented\n if (typeof action === 'string') {\n return;\n }\n\n if (action.actionType === 'ATTACH_EVENT_PROPERTY') {\n const data = dataExtractor.extractDataFromDataSource(action.dataSource, ev.closestTrackedAncestor as HTMLElement);\n\n // Attach data to event\n ev.targetElementProperties[action.destinationKey] = data;\n }\n });\n};\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { Trigger } from '@amplitude/analytics-core/lib/esm/types/element-interactions';
2
2
  import type { ElementInteractionsOptions, LabeledEvent } from '@amplitude/analytics-core/lib/esm/types/element-interactions';
3
3
  import type { ElementBasedTimestampedEvent, ElementBasedEvent } from 'src/helpers';
4
+ import type { DataExtractor } from '../data-extractor';
4
5
  export declare const groupLabeledEventIdsByEventType: (labeledEvents: LabeledEvent[] | null | undefined) => Record<string, Set<string>>;
5
6
  export declare const createLabeledEventToTriggerMap: (triggers: Trigger[]) => Map<string, Trigger[]>;
6
7
  /**
@@ -17,10 +18,11 @@ export declare const matchLabeledEventsToTriggers: (labeledEvents: LabeledEvent[
17
18
  export declare class TriggerEvaluator {
18
19
  private groupedLabeledEvents;
19
20
  private labeledEventToTriggerMap;
21
+ private dataExtractor;
20
22
  private options;
21
- constructor(groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>, labeledEventToTriggerMap: ReturnType<typeof createLabeledEventToTriggerMap>, options: ElementInteractionsOptions);
23
+ constructor(groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>, labeledEventToTriggerMap: ReturnType<typeof createLabeledEventToTriggerMap>, dataExtractor: DataExtractor, options: ElementInteractionsOptions);
22
24
  evaluate(event: ElementBasedTimestampedEvent<ElementBasedEvent>): ElementBasedTimestampedEvent<ElementBasedEvent>;
23
25
  update(groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>, labeledEventToTriggerMap: ReturnType<typeof createLabeledEventToTriggerMap>, options: ElementInteractionsOptions): void;
24
26
  }
25
- export declare const createTriggerEvaluator: (groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>, labeledEventToTriggerMap: Map<string, Trigger[]>, options: ElementInteractionsOptions) => TriggerEvaluator;
27
+ export declare const createTriggerEvaluator: (groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>, labeledEventToTriggerMap: Map<string, Trigger[]>, dataExtractor: DataExtractor, options: ElementInteractionsOptions) => TriggerEvaluator;
26
28
  //# sourceMappingURL=triggers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../../src/pageActions/triggers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8DAA8D,CAAC;AAE5F,OAAO,KAAK,EACV,0BAA0B,EAC1B,YAAY,EACb,MAAM,8DAA8D,CAAC;AACtE,OAAO,KAAK,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAUnF,eAAO,MAAM,+BAA+B,kBAAmB,YAAY,EAAE,GAAG,IAAI,GAAG,SAAS,gCA2B/F,CAAC;AAGF,eAAO,MAAM,8BAA8B,aAAc,OAAO,EAAE,2BAkBjE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,UAC7B,6BAA6B,iBAAiB,CAAC,iBACvC,YAAY,EAAE,mBAU9B,CAAC;AAEF,eAAO,MAAM,4BAA4B,kBAAmB,YAAY,EAAE,kBAAkB,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC,cAWjH,CAAC;AAEF,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,wBAAwB;IAChC,OAAO,CAAC,OAAO;gBAFP,oBAAoB,EAAE,UAAU,CAAC,OAAO,+BAA+B,CAAC,EACxE,wBAAwB,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,EAC3E,OAAO,EAAE,0BAA0B;IAG7C,QAAQ,CAAC,KAAK,EAAE,4BAA4B,CAAC,iBAAiB,CAAC;IAqB/D,MAAM,CACJ,oBAAoB,EAAE,UAAU,CAAC,OAAO,+BAA+B,CAAC,EACxE,wBAAwB,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,EAC3E,OAAO,EAAE,0BAA0B;CAMtC;AAED,eAAO,MAAM,sBAAsB,yBACX,WAAW,sCAAsC,CAAC,6DAE/D,0BAA0B,qBAGpC,CAAC"}
1
+ {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../../src/pageActions/triggers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8DAA8D,CAAC;AAE5F,OAAO,KAAK,EACV,0BAA0B,EAC1B,YAAY,EACb,MAAM,8DAA8D,CAAC;AACtE,OAAO,KAAK,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAQvD,eAAO,MAAM,+BAA+B,kBAAmB,YAAY,EAAE,GAAG,IAAI,GAAG,SAAS,gCA2B/F,CAAC;AAGF,eAAO,MAAM,8BAA8B,aAAc,OAAO,EAAE,2BAkBjE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,UAC7B,6BAA6B,iBAAiB,CAAC,iBACvC,YAAY,EAAE,mBAU9B,CAAC;AAEF,eAAO,MAAM,4BAA4B,kBAAmB,YAAY,EAAE,kBAAkB,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC,cAWjH,CAAC;AAEF,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,wBAAwB;IAChC,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO;gBAHP,oBAAoB,EAAE,UAAU,CAAC,OAAO,+BAA+B,CAAC,EACxE,wBAAwB,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,EAC3E,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,0BAA0B;IAG7C,QAAQ,CAAC,KAAK,EAAE,4BAA4B,CAAC,iBAAiB,CAAC;IAqB/D,MAAM,CACJ,oBAAoB,EAAE,UAAU,CAAC,OAAO,+BAA+B,CAAC,EACxE,wBAAwB,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,EAC3E,OAAO,EAAE,0BAA0B;CAMtC;AAED,eAAO,MAAM,sBAAsB,yBACX,WAAW,sCAAsC,CAAC,mEAEzD,aAAa,WACnB,0BAA0B,qBAGpC,CAAC"}
@@ -147,9 +147,10 @@ export var matchLabeledEventsToTriggers = function (labeledEvents, leToTriggerMa
147
147
  return Array.from(matchingTriggers);
148
148
  };
149
149
  var TriggerEvaluator = /** @class */ (function () {
150
- function TriggerEvaluator(groupedLabeledEvents, labeledEventToTriggerMap, options) {
150
+ function TriggerEvaluator(groupedLabeledEvents, labeledEventToTriggerMap, dataExtractor, options) {
151
151
  this.groupedLabeledEvents = groupedLabeledEvents;
152
152
  this.labeledEventToTriggerMap = labeledEventToTriggerMap;
153
+ this.dataExtractor = dataExtractor;
153
154
  this.options = options;
154
155
  }
155
156
  TriggerEvaluator.prototype.evaluate = function (event) {
@@ -166,7 +167,7 @@ var TriggerEvaluator = /** @class */ (function () {
166
167
  try {
167
168
  for (var matchingTriggers_1 = __values(matchingTriggers), matchingTriggers_1_1 = matchingTriggers_1.next(); !matchingTriggers_1_1.done; matchingTriggers_1_1 = matchingTriggers_1.next()) {
168
169
  var trigger = matchingTriggers_1_1.value;
169
- executeActions(trigger.actions, event);
170
+ executeActions(trigger.actions, event, this.dataExtractor);
170
171
  }
171
172
  }
172
173
  catch (e_7_1) { e_7 = { error: e_7_1 }; }
@@ -186,7 +187,7 @@ var TriggerEvaluator = /** @class */ (function () {
186
187
  return TriggerEvaluator;
187
188
  }());
188
189
  export { TriggerEvaluator };
189
- export var createTriggerEvaluator = function (groupedLabeledEvents, labeledEventToTriggerMap, options) {
190
- return new TriggerEvaluator(groupedLabeledEvents, labeledEventToTriggerMap, options);
190
+ export var createTriggerEvaluator = function (groupedLabeledEvents, labeledEventToTriggerMap, dataExtractor, options) {
191
+ return new TriggerEvaluator(groupedLabeledEvents, labeledEventToTriggerMap, dataExtractor, options);
191
192
  };
192
193
  //# sourceMappingURL=triggers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"triggers.js","sourceRoot":"","sources":["../../../src/pageActions/triggers.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Trigger } from '@amplitude/analytics-core/lib/esm/types/element-interactions';\n// Return which labeled events, if any, the element matches\nimport type {\n ElementInteractionsOptions,\n LabeledEvent,\n} from '@amplitude/analytics-core/lib/esm/types/element-interactions';\nimport type { ElementBasedTimestampedEvent, ElementBasedEvent } from 'src/helpers';\nimport { matchEventToFilter } from './matchEventToFilter';\nimport { executeActions } from './actions';\n\nconst eventTypeToBrowserEventMap = {\n '[Amplitude] Element Clicked': 'click',\n '[Amplitude] Element Changed': 'change',\n} as const;\n// groups labeled events by event type\n// skips any labeled events with malformed definitions or unexpected event_type\nexport const groupLabeledEventIdsByEventType = (labeledEvents: LabeledEvent[] | null | undefined) => {\n // Initialize all event types with empty sets\n const groupedLabeledEvents = Object.values(eventTypeToBrowserEventMap).reduce((acc, browserEvent) => {\n acc[browserEvent] = new Set<string>();\n return acc;\n }, {} as Record<string, Set<string>>);\n\n // If there are no labeled events, return the initialized groupedLabeledEvents\n if (!labeledEvents) {\n return groupedLabeledEvents;\n }\n\n // Group labeled events by event type\n for (const le of labeledEvents) {\n try {\n for (const def of le.definition) {\n const browserEvent = eventTypeToBrowserEventMap[def.event_type];\n if (browserEvent) {\n groupedLabeledEvents[browserEvent].add(le.id);\n }\n }\n } catch (e) {\n // Skip this labeled event if there is an error\n console.warn('Skipping Labeled Event due to malformed definition', le?.id, e);\n }\n }\n return groupedLabeledEvents;\n};\n\n// TODO: add tests\nexport const createLabeledEventToTriggerMap = (triggers: Trigger[]) => {\n const labeledEventToTriggerMap = new Map<string, Trigger[]>();\n for (const trigger of triggers) {\n for (const condition of trigger.conditions) {\n if (condition.type === 'LABELED_EVENT') {\n const eventId = condition.match.eventId;\n // Get existing triggers for this event ID or initialize empty array\n let existingTriggers = labeledEventToTriggerMap.get(eventId);\n if (!existingTriggers) {\n existingTriggers = [];\n labeledEventToTriggerMap.set(eventId, existingTriggers);\n }\n // Add current trigger to the list of triggers for this event ID\n existingTriggers.push(trigger);\n }\n }\n }\n return labeledEventToTriggerMap;\n};\n\n/**\n * Matches an event to labeled events based on the event's properties.\n * The logic matches exactly what is supported by the query backend.\n * TODO: later pre-filter the labeled events based on URL first\n *\n * @param event - The event to match against labeled events\n * @param labeledEvents - Array of labeled events to match against\n * @returns Array of matching labeled events\n */\nexport const matchEventToLabeledEvents = (\n event: ElementBasedTimestampedEvent<ElementBasedEvent>,\n labeledEvents: LabeledEvent[],\n) => {\n return labeledEvents.filter((le) => {\n return le.definition.some((def) => {\n return (\n eventTypeToBrowserEventMap[def.event_type] === event.type &&\n def.filters.every((filter) => matchEventToFilter(event, filter))\n );\n });\n });\n};\n\nexport const matchLabeledEventsToTriggers = (labeledEvents: LabeledEvent[], leToTriggerMap: Map<string, Trigger[]>) => {\n const matchingTriggers = new Set<Trigger>();\n for (const le of labeledEvents) {\n const triggers = leToTriggerMap.get(le.id);\n if (triggers) {\n for (const trigger of triggers) {\n matchingTriggers.add(trigger);\n }\n }\n }\n return Array.from(matchingTriggers);\n};\n\nexport class TriggerEvaluator {\n constructor(\n private groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>,\n private labeledEventToTriggerMap: ReturnType<typeof createLabeledEventToTriggerMap>,\n private options: ElementInteractionsOptions,\n ) {}\n\n evaluate(event: ElementBasedTimestampedEvent<ElementBasedEvent>) {\n // If there is no pageActions, return the event as is\n const { pageActions } = this.options;\n if (!pageActions) {\n return event;\n }\n\n // Find matching labeled events\n const matchingLabeledEvents = matchEventToLabeledEvents(\n event,\n Array.from(this.groupedLabeledEvents[event.type]).map((id) => pageActions.labeledEvents[id]),\n );\n // Find matching conditions\n const matchingTriggers = matchLabeledEventsToTriggers(matchingLabeledEvents, this.labeledEventToTriggerMap);\n for (const trigger of matchingTriggers) {\n executeActions(trigger.actions, event);\n }\n\n return event;\n }\n\n update(\n groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>,\n labeledEventToTriggerMap: ReturnType<typeof createLabeledEventToTriggerMap>,\n options: ElementInteractionsOptions,\n ) {\n this.groupedLabeledEvents = groupedLabeledEvents;\n this.labeledEventToTriggerMap = labeledEventToTriggerMap;\n this.options = options;\n }\n}\n\nexport const createTriggerEvaluator = (\n groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>,\n labeledEventToTriggerMap: ReturnType<typeof createLabeledEventToTriggerMap>,\n options: ElementInteractionsOptions,\n) => {\n return new TriggerEvaluator(groupedLabeledEvents, labeledEventToTriggerMap, options);\n};\n"]}
1
+ {"version":3,"file":"triggers.js","sourceRoot":"","sources":["../../../src/pageActions/triggers.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Trigger } from '@amplitude/analytics-core/lib/esm/types/element-interactions';\n// Return which labeled events, if any, the element matches\nimport type {\n ElementInteractionsOptions,\n LabeledEvent,\n} from '@amplitude/analytics-core/lib/esm/types/element-interactions';\nimport type { ElementBasedTimestampedEvent, ElementBasedEvent } from 'src/helpers';\nimport { matchEventToFilter } from './matchEventToFilter';\nimport { executeActions } from './actions';\nimport type { DataExtractor } from '../data-extractor';\n\nconst eventTypeToBrowserEventMap = {\n '[Amplitude] Element Clicked': 'click',\n '[Amplitude] Element Changed': 'change',\n} as const;\n// groups labeled events by event type\n// skips any labeled events with malformed definitions or unexpected event_type\nexport const groupLabeledEventIdsByEventType = (labeledEvents: LabeledEvent[] | null | undefined) => {\n // Initialize all event types with empty sets\n const groupedLabeledEvents = Object.values(eventTypeToBrowserEventMap).reduce((acc, browserEvent) => {\n acc[browserEvent] = new Set<string>();\n return acc;\n }, {} as Record<string, Set<string>>);\n\n // If there are no labeled events, return the initialized groupedLabeledEvents\n if (!labeledEvents) {\n return groupedLabeledEvents;\n }\n\n // Group labeled events by event type\n for (const le of labeledEvents) {\n try {\n for (const def of le.definition) {\n const browserEvent = eventTypeToBrowserEventMap[def.event_type];\n if (browserEvent) {\n groupedLabeledEvents[browserEvent].add(le.id);\n }\n }\n } catch (e) {\n // Skip this labeled event if there is an error\n console.warn('Skipping Labeled Event due to malformed definition', le?.id, e);\n }\n }\n return groupedLabeledEvents;\n};\n\n// TODO: add tests\nexport const createLabeledEventToTriggerMap = (triggers: Trigger[]) => {\n const labeledEventToTriggerMap = new Map<string, Trigger[]>();\n for (const trigger of triggers) {\n for (const condition of trigger.conditions) {\n if (condition.type === 'LABELED_EVENT') {\n const eventId = condition.match.eventId;\n // Get existing triggers for this event ID or initialize empty array\n let existingTriggers = labeledEventToTriggerMap.get(eventId);\n if (!existingTriggers) {\n existingTriggers = [];\n labeledEventToTriggerMap.set(eventId, existingTriggers);\n }\n // Add current trigger to the list of triggers for this event ID\n existingTriggers.push(trigger);\n }\n }\n }\n return labeledEventToTriggerMap;\n};\n\n/**\n * Matches an event to labeled events based on the event's properties.\n * The logic matches exactly what is supported by the query backend.\n * TODO: later pre-filter the labeled events based on URL first\n *\n * @param event - The event to match against labeled events\n * @param labeledEvents - Array of labeled events to match against\n * @returns Array of matching labeled events\n */\nexport const matchEventToLabeledEvents = (\n event: ElementBasedTimestampedEvent<ElementBasedEvent>,\n labeledEvents: LabeledEvent[],\n) => {\n return labeledEvents.filter((le) => {\n return le.definition.some((def) => {\n return (\n eventTypeToBrowserEventMap[def.event_type] === event.type &&\n def.filters.every((filter) => matchEventToFilter(event, filter))\n );\n });\n });\n};\n\nexport const matchLabeledEventsToTriggers = (labeledEvents: LabeledEvent[], leToTriggerMap: Map<string, Trigger[]>) => {\n const matchingTriggers = new Set<Trigger>();\n for (const le of labeledEvents) {\n const triggers = leToTriggerMap.get(le.id);\n if (triggers) {\n for (const trigger of triggers) {\n matchingTriggers.add(trigger);\n }\n }\n }\n return Array.from(matchingTriggers);\n};\n\nexport class TriggerEvaluator {\n constructor(\n private groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>,\n private labeledEventToTriggerMap: ReturnType<typeof createLabeledEventToTriggerMap>,\n private dataExtractor: DataExtractor,\n private options: ElementInteractionsOptions,\n ) {}\n\n evaluate(event: ElementBasedTimestampedEvent<ElementBasedEvent>) {\n // If there is no pageActions, return the event as is\n const { pageActions } = this.options;\n if (!pageActions) {\n return event;\n }\n\n // Find matching labeled events\n const matchingLabeledEvents = matchEventToLabeledEvents(\n event,\n Array.from(this.groupedLabeledEvents[event.type]).map((id) => pageActions.labeledEvents[id]),\n );\n // Find matching conditions\n const matchingTriggers = matchLabeledEventsToTriggers(matchingLabeledEvents, this.labeledEventToTriggerMap);\n for (const trigger of matchingTriggers) {\n executeActions(trigger.actions, event, this.dataExtractor);\n }\n\n return event;\n }\n\n update(\n groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>,\n labeledEventToTriggerMap: ReturnType<typeof createLabeledEventToTriggerMap>,\n options: ElementInteractionsOptions,\n ) {\n this.groupedLabeledEvents = groupedLabeledEvents;\n this.labeledEventToTriggerMap = labeledEventToTriggerMap;\n this.options = options;\n }\n}\n\nexport const createTriggerEvaluator = (\n groupedLabeledEvents: ReturnType<typeof groupLabeledEventIdsByEventType>,\n labeledEventToTriggerMap: ReturnType<typeof createLabeledEventToTriggerMap>,\n dataExtractor: DataExtractor,\n options: ElementInteractionsOptions,\n) => {\n return new TriggerEvaluator(groupedLabeledEvents, labeledEventToTriggerMap, dataExtractor, options);\n};\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.10.2";
1
+ export declare const VERSION = "1.11.1";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export var VERSION = '1.10.2';
1
+ export var VERSION = '1.11.1';
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.10.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.11.1';\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):f(o[0][2],n)}catch(e){f(o[0][3],e)}var n}function l(e){c("next",e)}function a(e){c("throw",e)}function f(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}}function f(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 d,v,h=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],p="data-amp-track-",y=["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),m=["*"];!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(d||(d={})),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 g=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,f,d,h,p,y,b,m,g,w,_,x,A;if("object"!=typeof e)return null;var E=e.code||0,S=this.buildStatus(E);switch(S){case v.Success:return{status:S,statusCode:E,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:E,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!==(f=e.silenced_devices)&&void 0!==f?f:[],silencedEvents:null!==(d=e.silenced_events)&&void 0!==d?d:[],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:E,body:{error:null!==(y=e.error)&&void 0!==y?y:""}};case v.RateLimit:return{status:S,statusCode:E,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!==(_=e.exceeded_daily_quota_devices)&&void 0!==_?_:{},exceededDailyQuotaUsers:null!==(x=e.exceeded_daily_quota_users)&&void 0!==x?x:{},throttledEvents:null!==(A=e.throttled_events)&&void 0!==A?A:[]}};case v.Timeout:default:return{status:S,statusCode:E}}},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}(),w="Remote config fetch rejected due to timeout after 5 seconds",_="Unexpected error occurred",x=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,f,d,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:w})];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===(f=o.sent()))return[2,this.completeRequest({err:_})];switch((new g).buildStatus(f.status)){case v.Success:return this.attempts=0,[2,this.parseAndStoreConfig(f)];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 d=o.sent(),h=d,e.aborted?[2,this.completeRequest({err:w})]:[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===d.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===d.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 x({localConfig:t,configKeys:n})]}))}))},E="[Amplitude] Element Clicked",S="[Amplitude] Rage Click",k="[Amplitude] Element Tag",T="[Amplitude] Element Text",C="[Amplitude] Page URL",O="https://app.amplitude.com",P={US:O,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};function I(e){return"function"==typeof e}function M(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=M((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 R(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var L=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 f=this.initialTeardown;if(I(f))try{f()}catch(e){i=e instanceof j?e.errors:[e]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var v=u(d),h=v.next();!h.done;h=v.next()){var p=h.value;try{q(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)q(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)&&R(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&R(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),F=L.EMPTY;function N(e){return e instanceof L||e&&"closed"in e&&I(e.remove)&&I(e.add)&&I(e.unsubscribe)}function q(e){I(e)?e():e.unsubscribe()}var D={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},U=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 z(e){U((function(){throw e}))}function W(){}function Y(e){e()}var V=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=Z,n}return n(t,e),t.create=function(e,t,n){return new K(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}(L),B=Function.prototype.bind;function H(e,t){return B.call(e,t)}var G=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){X(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){X(e)}else X(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){X(e)}},e}(),K=function(e){function t(t,n,r){var i,o,u=e.call(this)||this;I(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:u&&D.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},i={next:t.next&&H(t.next,o),error:t.error&&H(t.error,o),complete:t.complete&&H(t.complete,o)}):i=t;return u.destination=new G(i),u}return n(t,e),t}(V);function X(e){z(e)}var Z={closed:!0,next:W,error:function(e){throw e},complete:W},J="function"==typeof Symbol&&Symbol.observable||"@@observable";function Q(e){return e}var $=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 V||function(e){return e&&I(e.next)&&I(e.error)&&I(e.complete)}(r)&&N(r)?e:new K(e,t,n);return Y((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=ee(t))((function(t,r){var i=new K({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[J]=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?Q: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=ee(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 ee(e){var t;return null!==(t=null!=e?e:D.Promise)&&void 0!==t?t:Promise}function te(e){return I(null==e?void 0:e.lift)}function ne(e){return function(t){if(te(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 re(e,t,n,r,i){return new ie(e,t,n,r,i)}var ie=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}(V);!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,te(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 L;var n=this.getSubject();t.add(this.source.subscribe(re(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=L.EMPTY)}return t},t.prototype.refCount=function(){return ne((function(e,t){var n=null;e._refCount++;var r=re(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)}}($);var oe,ue={now:function(){return(ue.delegate||performance).now()},delegate:void 0},ce={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=t((function(t){n=void 0,e(t)}));return new L((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=ce.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 $((function(e){var t=oe||ue,n=t.now(),r=0,i=function(){e.closed||(r=ce.requestAnimationFrame((function(o){r=0;var u=t.now();e.next({timestamp:oe?u:o,elapsed:u-n}),i()})))};return i(),function(){r&&ce.cancelAnimationFrame(r)}}));var le=M((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),se=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 ae(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new le},t.prototype.next=function(e){var t=this;Y((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;Y((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;Y((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?F:(this.currentObservers=null,o.push(e),new L((function(){t.currentObservers=null,R(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 $;return e.source=this,e},t.create=function(e,t){return new ae(e,t)},t}($),ae=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:F},t}(se);!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)}}(se);var fe={now:function(){return(fe.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=fe);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)}}}(se),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))}}(se);var de,ve=function(e){function t(t,n){return e.call(this)||this}return n(t,e),t.prototype.schedule=function(e,t){return this},t}(L),he=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)))},pe=function(e){return clearInterval(e)},ye=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),he(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&&pe(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,R(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(ve),be=1,me={};function ge(e){return e in me&&(delete me[e],!0)}var we=function(e){var t=be++;return me[t]=!0,de||(de=Promise.resolve()),de.then((function(){return ge(t)&&e()})),t},_e=function(e){ge(e)},xe={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=xe.delegate;return((null==n?void 0:n.setImmediate)||we).apply(void 0,l([],c(e)))},clearImmediate:function(e){return _e(e)},delegate:void 0},Ae=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=xe.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&&(xe.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},t}(ye),Ee=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=fe.now,e}(),Se=function(e){function t(t,n){void 0===n&&(n=Ee.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}(Ee),ke=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}(Se);new ke(Ae);var Te=new Se(ye),Ce=Te,Oe=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}(ye),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(Se);new Pe(Oe);var 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.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=ce.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&&(ce.cancelAnimationFrame(n),t._scheduled=void 0)},t}(ye),Me=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}(Se);new Me(Ie),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}(Se);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 L.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}(ye),Re=new $((function(e){return e.complete()}));function Le(e){return e&&I(e.schedule)}function Fe(e){return e[e.length-1]}function Ne(e){return Le(Fe(e))?e.pop():void 0}var qe=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function De(e){return I(null==e?void 0:e.then)}function Ue(e){return I(e[J])}function ze(e){return Symbol.asyncIterator&&I(null==e?void 0:e[Symbol.asyncIterator])}function We(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 Ye,Ve="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Be(e){return I(null==e?void 0:e[Ve])}function He(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 Ge(e){return I(null==e?void 0:e.getReader)}function Ke(e){if(e instanceof $)return e;if(null!=e){if(Ue(e))return i=e,new $((function(e){var t=i[J]();if(I(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(qe(e))return r=e,new $((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(De(e))return n=e,new $((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,z)}));if(ze(e))return Xe(e);if(Be(e))return t=e,new $((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(Ge(e))return Xe(He(e))}var t,n,r,i;throw We(e)}function Xe(e){return new $((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=f(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 Ze(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 Je(e,t){return void 0===t&&(t=0),ne((function(n,r){n.subscribe(re(r,(function(n){return Ze(r,e,(function(){return r.next(n)}),t)}),(function(){return Ze(r,e,(function(){return r.complete()}),t)}),(function(n){return Ze(r,e,(function(){return r.error(n)}),t)})))}))}function Qe(e,t){return void 0===t&&(t=0),ne((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function $e(e,t){if(!e)throw new Error("Iterable cannot be null");return new $((function(n){Ze(n,t,(function(){var r=e[Symbol.asyncIterator]();Ze(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function et(e,t){if(null!=e){if(Ue(e))return function(e,t){return Ke(e).pipe(Qe(t),Je(t))}(e,t);if(qe(e))return function(e,t){return new $((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(De(e))return function(e,t){return Ke(e).pipe(Qe(t),Je(t))}(e,t);if(ze(e))return $e(e,t);if(Be(e))return function(e,t){return new $((function(n){var r;return Ze(n,t,(function(){r=e[Ve](),Ze(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 I(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(Ge(e))return function(e,t){return $e(He(e),t)}(e,t)}throw We(e)}function tt(e,t){return t?et(e,t):Ke(e)}function nt(e){return e instanceof Date&&!isNaN(e)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(Ye||(Ye={})),M((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),M((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),M((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),M((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}));var rt=M((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function it(e){throw new rt(e)}function ot(e,t){return ne((function(n,r){var i=0;n.subscribe(re(r,(function(n){r.next(e.call(t,n,i++))})))}))}var ut=Array.isArray;function ct(e){return ot((function(t){return function(e,t){return ut(t)?e.apply(void 0,l([],c(t))):e(t)}(e,t)}))}function lt(e,t,n){return void 0===n&&(n=1/0),I(t)?lt((function(n,r){return ot((function(e,i){return t(n,e,r,i)}))(Ke(e(n,r)))}),n):("number"==typeof t&&(n=t),ne((function(t,r){return function(e,t,n,r,i,o,u,c){var l=[],s=0,a=0,f=!1,d=function(){!f||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;Ke(n(e,a++)).subscribe(re(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?Ze(t,u,(function(){return h(e)})):h(e)};l.length&&s<r;)e();d()}catch(e){t.error(e)}})))};return e.subscribe(re(t,v,(function(){f=!0,d()}))),function(){null==c||c()}}(t,r,e,n)})))}function st(e){return void 0===e&&(e=1/0),lt(Q,e)}function at(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return st(1)(tt(e,Ne(e)))}var ft=["addListener","removeListener"],dt=["addEventListener","removeEventListener"],vt=["on","off"];function ht(e,t,n,r){if(I(n)&&(r=n,n=void 0),r)return ht(e,t,n).pipe(ct(r));var i=c(function(e){return I(e.addEventListener)&&I(e.removeEventListener)}(e)?dt.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return I(e.addListener)&&I(e.removeListener)}(e)?ft.map(pt(e,t)):function(e){return I(e.on)&&I(e.off)}(e)?vt.map(pt(e,t)):[],2),o=i[0],u=i[1];if(!o&&qe(e))return lt((function(e){return ht(e,t,n)}))(Ke(e));if(!o)throw new TypeError("Invalid event target");return new $((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 pt(e,t){return function(n){return function(r){return e[n](t,r)}}}function yt(e,t,n){void 0===e&&(e=0),void 0===n&&(n=Ce);var r=-1;return null!=t&&(Le(t)?n=t:r=t),new $((function(t){var i=nt(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 bt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Ne(e),r=function(e,t){return"number"==typeof Fe(e)?e.pop():t}(e,1/0),i=e;return i.length?1===i.length?Ke(i[0]):st(r)(tt(i,n)):Re}new $(W);var mt=Array.isArray;function gt(e,t){return ne((function(n,r){var i=0;n.subscribe(re(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function wt(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===(t=1===(e=t).length&&mt(e[0])?e[0]:e).length?Ke(t[0]):new $(function(e){return function(t){for(var n=[],r=function(r){n.push(Ke(e[r]).subscribe(re(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 _t(e){return e<=0?function(){return Re}:ne((function(t,n){var r=0;t.subscribe(re(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function xt(e,t){return t?function(n){return at(t.pipe(_t(1),ne((function(e,t){e.subscribe(re(t,W))}))),n.pipe(xt(e)))}:lt((function(t,n){return Ke(e(t,n)).pipe(_t(1),function(e){return ot((function(){return e}))}(t))}))}function At(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new se}: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,f=function(){null==r||r.unsubscribe(),r=void 0},d=function(){f(),t=o=void 0,s=a=!1},v=function(){var e=t;d(),null==e||e.unsubscribe()};return ne((function(e,h){c++,a||s||f();var p=o=null!=o?o:n();h.add((function(){0!==--c||a||s||(r=Et(v,l))})),p.subscribe(h),!t&&c>0&&(t=new K({next:function(e){return p.next(e)},error:function(e){a=!0,f(),r=Et(d,i,e),p.error(e)},complete:function(){s=!0,f(),r=Et(d,u),p.complete()}}),Ke(e).subscribe(t))}))(e)}}function Et(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 K({next:function(){i.unsubscribe(),e()}});return Ke(t.apply(void 0,l([],c(n)))).subscribe(i)}}else e()}function St(e,t,n){void 0===t&&(t=Te);var r=yt(e,t);return function(e,t){return ne((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,f=null,d=!1,v=function(){null==f||f.unsubscribe(),f=null,l&&(y(),d&&r.complete())},h=function(){f=null,d&&r.complete()},p=function(t){return f=Ke(e(t)).subscribe(re(r,v,h))},y=function(){if(s){s=!1;var e=a;a=null,r.next(e),!d&&p(e)}};n.subscribe(re(r,(function(e){s=!0,a=e,(!f||f.closed)&&(u?y():p(e))}),(function(){d=!0,(!(l&&s&&f)||f.closed)&&r.complete()})))}))}((function(){return r}),n)}var kt=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],Tt=["type"],Ct=["svg","path","g"],Ot=["password","hidden"];var Pt=function(e){var t;return e?(t=function(e,t){for(var n=0,r=0;r<e.length;r++){var i=e[r];if(null===i)n+=4;else{var o=It(i);n+=o?Array.from(o).length:4}if(n>t)return e.slice(0,r)}return e}(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).map((function(e){return function(e){var t,n,r,i,o,c;if(null===e)return null;var l=String(e.tagName).toLowerCase(),s={tag:l},a=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);a.length&&(s.index=a.indexOf(e),s.indexOfType=a.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var f=null===(c=null===(o=e.previousElementSibling)||void 0===o?void 0:o.tagName)||void 0===c?void 0:c.toLowerCase();f&&(s.prevSib=String(f));var d=e.getAttribute("id");d&&(s.id=String(d));var v=Array.from(e.classList);v.length&&(s.classes=v);var h={},p=Array.from(e.attributes).filter((function(e){return!kt.includes(e.name)})),y=!Ft(e);if(!Ot.includes(String(e.getAttribute("type")))&&!Ct.includes(l))try{for(var b=u(p),m=b.next();!m.done;m=b.next()){var g=m.value;y&&!Tt.includes(g.name)||(h[g.name]=String(g.value).substring(0,128))}}catch(e){t={error:e}}finally{try{m&&!m.done&&(n=b.return)&&n.call(b)}finally{if(t)throw t.error}}return Object.keys(h).length&&(s.attrs=h),s}(e)})),1024),t):[]};function It(e,t){void 0===t&&(t=!1);try{if(null==e)return t?"None":null;if("string"==typeof e)return t?(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(e,"'"):e.includes("'")?'"'.concat(e.replace(/'/g,"\\'"),'"'):"'".concat(e,"'"):e;if("boolean"==typeof e)return e?"True":"False";if(Array.isArray(e)){var n=e.map((function(e){return It(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=c(e,1)[0]})).map((function(e){var t=c(e,2),n=t[0],r=t[1];return"".concat(String(It(n,!0)),": ").concat(String(It(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return e.toString()}catch(e){return null}}var Mt=["input","select","textarea"],jt=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},Rt=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,u,c=e.pageUrlAllowlist,l=e.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(l)return l(r,i);if(!function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(window.location.href,c))return!1;var a=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof a)switch(a.toLowerCase()){case"hidden":case"password":return!1}var f=jt(i,r);if(n&&f)return!0;if(t){var d=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(!d)return!1}switch(s){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!f||"click"===r}}},Lt=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1;if(/[^\s@]+@[^\s@.]+\.[^\s@]+/.test(e))return!1}return!0},Ft=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!Mt.includes(i)&&!o},Nt=function(e){var t="";return Ft(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=Nt(e),t+=r.split(/(\s+)/).filter(Lt).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},qt=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}),{})},Dt=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}if(t){var r=t.textContent||"";return Lt(r)?r:""}return Dt(n)},Ut=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:Ut(null==e?void 0:e.parentElement,t):null},zt=function(e){var t,n,r;if(!e)return{};var i=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),o=((t={})[k]=i,t[T]=Nt(e),t[C]=window.location.href.split("?")[0],t);return qt(o)};var Wt=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)},Yt=function(e,t,n){var r,i,o,u=null===(o=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i),c="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},l=t.getAttribute("aria-label"),s=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var i=r.replace(t,""),o=e.getAttribute(r);i&&(n[i]=o||"")}return n}),{})}(t,n),a=Dt(t),f=((r={})["[Amplitude] Element ID"]=t.getAttribute("id")||"",r["[Amplitude] Element Class"]=t.getAttribute("class"),r["[Amplitude] Element Hierarchy"]=Pt(t),r[k]=u,r[T]=Nt(t),r["[Amplitude] Element Position Left"]=null==c.left?null:Math.round(c.left),r["[Amplitude] Element Position Top"]=null==c.top?null:Math.round(c.top),r["[Amplitude] Element Aria Label"]=l,r["[Amplitude] Element Attributes"]=s,r["[Amplitude] Element Parent Label"]=a,r[C]=window.location.href.split("?")[0],r["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return"a"===u&&"click"===e&&t instanceof HTMLAnchorElement&&(f["[Amplitude] Element Href"]=t.href),qt(f)},Vt=function(e,t,n,r,i){void 0===i&&(i=!1);var o={event:e,timestamp:Date.now(),type:t};if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){if(i)if(jt(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=Yt(o.type,o.closestTrackedAncestor,r),o;var u=Ut(o.event.target,n);return u&&(o.closestTrackedAncestor=u,o.targetElementProperties=Yt(o.type,u,r)),o}return o};var Bt=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?n.textContent:"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},Ht=function(e,t){e.forEach((function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var n=Bt(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=n}}))},Gt=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?O:t,r=this;this.endpoint=O,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?{}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,u=n.cssSelectorAllowlist,c=n.actionClickAllowlist;this.logger=r,i&&this.endpoint===O&&(this.endpoint=i);var l=null;window.addEventListener("message",(function(e){var n,r,i,s,a;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,d=null==e?void 0:e.data,v=null==d?void 0:d.action;if(v)if("id"in d)null===(s=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===s||s.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(d);else if("ping"===v)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===v){var h=null==d?void 0:d.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;l=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:zt,isElementSelectable:function(e){return!o||o((null==h?void 0:h.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:t,cssSelectorAllowlist:u,actionClickAllowlist:c,extractDataFromDataSource:Bt,diagnostics:{autocapture:{version:"1.10.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"===v&&(null===(a=null==l?void 0:l.close)||void 0===a||a.call(l))}})),this.notify({action:"page-loaded"})},e}();function Kt(e){var t,n,r,i=e.amplitude,o=e.allObservables,l=e.options,s=e.shouldTrackEvent,a=e.evaluateTriggers,f=o.clickObservable,d=f.pipe(ne((function(e,t){var n,r=!1;e.subscribe(re(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),gt((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=bt(d,f.pipe((t=l.debounceTime,void 0===n&&(n=Te),ne((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(re(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})))}))),ot((function(){return"timeout"})))),h=f.pipe(function(e,t){void 0===t&&(t=Te);var n=yt(e,t);return xt((function(){return n}))}(0),gt(Wt),gt((function(e){return s("click",e.closestTrackedAncestor)})),ot((function(e){return a(e)})),(r=v,ne((function(e,t){var n=[];return e.subscribe(re(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),Ke(r).subscribe(re(t,(function(){var e=n;n=[],t.next(e)}),W)),function(){n=null}}))));return h.subscribe((function(e){var t,n,r=(e.length,E);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 Xt(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,f=n.navigateObservable,d=s.pipe(gt((function(e){return!o("click",e.closestTrackedAncestor)})),ot((function(e){var t=Ut(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})),gt(Wt),gt((function(e){return u("click",e.closestTrackedAncestor)}))),v=[a];f&&v.push(f);var h,p,y=bt.apply(void 0,l([],c(v),!1)),b=d.pipe((h=function(e){return y.pipe(_t(1),function(e,t){var n=nt(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,u=void 0===o?it:o,c=n.scheduler,l=void 0===c?null!=t?t:Te:c,s=n.meta,a=void 0===s?null:s;if(null==r&&null==i)throw new TypeError("No timeout provided.");return ne((function(e,t){var n,o,c=null,s=0,f=function(e){o=Ze(t,l,(function(){try{n.unsubscribe(),Ke(u({meta:a,lastValue:c,seen:s})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(re(t,(function(e){null==o||o.unsubscribe(),s++,t.next(c=e),i>0&&f(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),c=null}))),!s&&f(null!=r?"number"==typeof r?r:+r-l.now():i)}))}({first:500,with:function(){return Re}}),ot((function(){return e})))},ne((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(re(t,(function(e){null==n||n.unsubscribe();var i=0,u=r++;Ke(h(e,u)).subscribe(n=re(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(E,i("click",e.closestTrackedAncestor))}))}var Zt,Jt=function(){return new $((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()}}))},Qt=function(e){return void 0===e&&(e="click"),ht(document,e,{capture:!0})},$t={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},en=function(e){var t,n,r,i,o=Object.values($t).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)),f=a.next();!f.done;f=a.next()){var d=f.value,v=$t[d.event_type];v&&o[v].add(s.id)}}catch(e){r={error:e}}finally{try{f&&!f.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},tn=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)),f=a.next();!f.done;f=a.next()){var d=f.value;if("LABELED_EVENT"===d.type){var v=d.match.eventId,h=o.get(v);h||(h=[],o.set(v,h)),h.push(s)}}}catch(e){r={error:e}}finally{try{f&&!f.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},nn=function(e,t){return t.filter((function(t){return t.definition.some((function(t){return $t[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)}))}))}))},rn=function(){function e(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n}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,f=t.get(a.id);if(f)try{for(var d=(i=void 0,u(f)),v=d.next();!v.done;v=d.next()){var h=v.value;c.add(h)}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=d.return)&&o.call(d)}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)}(nn(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;Ht(l.actions,e)}}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"}(Zt||(Zt={}));var on=function(e){var t,n,s,a,f,d,v;void 0===e&&(e={});var b=e.dataAttributePrefix,m=void 0===b?p:b,g=e.visualTaggingOptions,w=void 0===g?{enabled:!0,messenger:new Gt}:g;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:h,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:y,e.debounceTime=null!==(s=e.debounceTime)&&void 0!==s?s:0;var _="@amplitude/plugin-autocapture-browser",x=[],E=en(Object.values(null!==(f=null===(a=e.pageActions)||void 0===a?void 0:a.labeledEvents)&&void 0!==f?f:{})),S=tn(null!==(v=null===(d=e.pageActions)||void 0===d?void 0:d.triggers)&&void 0!==v?v:[]),k=function(e,t,n){return new rn(e,t,n)}(E,S,e);return{name:_,type:"enrichment",setup:function(t,n){return i(void 0,void 0,void 0,(function(){var u,s,a,f,d,v,h,p,y,b;return o(this,(function(g){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),E=en(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),S=tn(null!==(i=e.pageActions.triggers)&&void 0!==i?i:[]),k.update(E,S,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=Rt(e,e.cssSelectorAllowlist),s=Rt(e,e.actionClickAllowlist),a=function(){var t,n,r=Qt().pipe(ot((function(t){return Vt(t,"click",e.cssSelectorAllowlist,m)})),At()),i=ht(document,"change",{capture:!0}).pipe(ot((function(t){return Vt(t,"change",e.cssSelectorAllowlist,m)})),At());window.navigation&&(n=ht(window.navigation,"navigate").pipe(ot((function(t){return Vt(t,"navigate",e.cssSelectorAllowlist,m)})),At()));var o=Jt().pipe(ot((function(t){return Vt(t,"mutation",e.cssSelectorAllowlist,m)})),At());return(t={})[Zt.ClickObservable]=r,t[Zt.ChangeObservable]=i,t[Zt.NavigateObservable]=n,t[Zt.MutationObservable]=o,t}(),f=Kt({allObservables:a,options:e,amplitude:n,shouldTrackEvent:u,evaluateTriggers:k.evaluate.bind(k)}),x.push(f),d=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.pipe(gt(Wt),gt((function(e){return i("change",e.closestTrackedAncestor)})),ot((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 Yt.apply(void 0,l(l([],c(e),!1),[m],!1))},amplitude:n,shouldTrackEvent:u,evaluateTriggers:k.evaluate.bind(k)}),x.push(d),v=Xt({allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Yt.apply(void 0,l(l([],c(e),!1),[m],!1))},amplitude:n,shouldTrackEvent:u,shouldTrackActionClick:s}),x.push(v),null===(y=null==t?void 0:t.loggerProvider)||void 0===y||y.log("".concat(_," has been successfully added.")),window.opener&&w.enabled&&(h=e.cssSelectorAllowlist,p=e.actionClickAllowlist,null===(b=w.messenger)||void 0===b||b.setup(r(r({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:P[t.serverZone]}),{isElementSelectable:Rt(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(x),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 un(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 cn(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 ln(e){var t,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.clickObservable,u=[],c={};function l(e){u=[],c={},e&&(un(c,e),u.push(e))}return o.pipe(gt(Wt),gt((function(e){return i("click",e.closestTrackedAncestor)})),ot((function(e){if(t&&clearTimeout(t),un(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?cn(u):null;return l(e),r}return u.push(e),u.length>=4&&(t=setTimeout((function(){var e=cn(u),t=e.rageClickEvent,r=e.time;n.track(S,t,{time:r}),l()}),1e3)),null})),gt((function(e){return null!==e}))).subscribe((function(e){null!==e&&n.track(S,e.rageClickEvent,{time:e.time})}))}return e.WindowMessenger=Gt,e.autocapturePlugin=on,e.frustrationPlugin=function(e){var t,n,s,a,f;void 0===e&&(e={});var d="@amplitude/plugin-frustration-browser",v=[],h=null!==(n=null===(t=e.rageClicks)||void 0===t?void 0:t.cssSelectorAllowlist)&&void 0!==n?n:m,y=null!==(a=null===(s=e.deadClicks)||void 0===s?void 0:s.cssSelectorAllowlist)&&void 0!==a?a:b,g=null!==(f=e.dataAttributePrefix)&&void 0!==f?f:p,w=l([],c(new Set(l(l([],c(h),!1),c(y),!1))),!1);return{name:d,type:"enrichment",setup:function(t,n){return i(void 0,void 0,void 0,(function(){var i,u,s,a,f,p;return o(this,(function(o){return"undefined"==typeof document||(i=Rt(e,h),u=Rt(e,y),s=function(){var e,t,n=Qt("pointerdown").pipe(ot((function(e){return Vt(e,"click",w,g,!0)})),At());window.navigation&&(t=ht(window.navigation,"navigate").pipe(ot((function(e){return Vt(e,"navigate",w,g)})),At()));var r=Jt().pipe(ot((function(e){return Vt(e,"mutation",w,g)})),At());return(e={})[Zt.ClickObservable]=n,e[Zt.ChangeObservable]=new $,e[Zt.NavigateObservable]=t,e[Zt.MutationObservable]=r,e}(),a=ln({allObservables:s,amplitude:n,shouldTrackRageClick:i}),v.push(a),f=function(e){var t=e.amplitude,n=e.allObservables,i=e.getEventProperties,o=e.shouldTrackDeadClick,u=n.clickObservable,s=n.mutationObservable,a=n.navigateObservable,f=u.pipe(gt(Wt),gt((function(e){return o("click",e.closestTrackedAncestor)}))),d=[s];a&&d.push(a);var v=bt.apply(void 0,l([],c(d),!1));return f.pipe(lt((function(e){var t;return wt(new $((function(n){return t=setTimeout((function(){return n.next(e)}),3e3),function(){clearTimeout(t)}})),v.pipe(_t(1),ot((function(){return null})))).pipe(gt((function(e){return null!==e})))})),St(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 Yt(e,t,g)},shouldTrackDeadClick:u}),v.push(f),null===(p=null==t?void 0:t.loggerProvider)||void 0===p||p.log("".concat(d," 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=on,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
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):f(o[0][2],n)}catch(e){f(o[0][3],e)}var n}function l(e){c("next",e)}function a(e){c("throw",e)}function f(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}}function f(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 d,v,h=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],p="data-amp-track-",y=["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),m=["*"];!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(d||(d={})),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 g=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,f,d,h,p,y,b,m,g,w,x,_,A;if("object"!=typeof e)return null;var E=e.code||0,S=this.buildStatus(E);switch(S){case v.Success:return{status:S,statusCode:E,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:E,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!==(f=e.silenced_devices)&&void 0!==f?f:[],silencedEvents:null!==(d=e.silenced_events)&&void 0!==d?d:[],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:E,body:{error:null!==(y=e.error)&&void 0!==y?y:""}};case v.RateLimit:return{status:S,statusCode:E,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!==(A=e.throttled_events)&&void 0!==A?A:[]}};case v.Timeout:default:return{status:S,statusCode:E}}},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}(),w="Remote config fetch rejected due to timeout after 5 seconds",x="Unexpected error occurred",_=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,f,d,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:w})];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===(f=o.sent()))return[2,this.completeRequest({err:x})];switch((new g).buildStatus(f.status)){case v.Success:return this.attempts=0,[2,this.parseAndStoreConfig(f)];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 d=o.sent(),h=d,e.aborted?[2,this.completeRequest({err:w})]:[2,this.completeRequest({err:null!==(b=h.message)&&void 0!==b?b:x})];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===d.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===d.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 _({localConfig:t,configKeys:n})]}))}))},E="[Amplitude] Element Clicked",S="[Amplitude] Rage Click",T="[Amplitude] Element Tag",k="[Amplitude] Element Text",C="[Amplitude] Page URL",O="https://app.amplitude.com",P={US:O,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};function I(e){return"function"==typeof e}function M(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 R=M((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 j(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var L=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 f=this.initialTeardown;if(I(f))try{f()}catch(e){i=e instanceof R?e.errors:[e]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var v=u(d),h=v.next();!h.done;h=v.next()){var p=h.value;try{D(p)}catch(e){i=null!=i?i:[],e instanceof R?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 R(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)D(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)&&j(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&j(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),N=L.EMPTY;function F(e){return e instanceof L||e&&"closed"in e&&I(e.remove)&&I(e.add)&&I(e.unsubscribe)}function D(e){I(e)?e():e.unsubscribe()}var q={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},U=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 z(e){U((function(){throw e}))}function W(){}function Y(e){e()}var V=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,F(t)&&t.add(n)):n.destination=Z,n}return n(t,e),t.create=function(e,t,n){return new K(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}(L),B=Function.prototype.bind;function H(e,t){return B.call(e,t)}var G=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){X(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){X(e)}else X(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){X(e)}},e}(),K=function(e){function t(t,n,r){var i,o,u=e.call(this)||this;I(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:u&&q.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},i={next:t.next&&H(t.next,o),error:t.error&&H(t.error,o),complete:t.complete&&H(t.complete,o)}):i=t;return u.destination=new G(i),u}return n(t,e),t}(V);function X(e){z(e)}var Z={closed:!0,next:W,error:function(e){throw e},complete:W},J="function"==typeof Symbol&&Symbol.observable||"@@observable";function Q(e){return e}var $=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 V||function(e){return e&&I(e.next)&&I(e.error)&&I(e.complete)}(r)&&F(r)?e:new K(e,t,n);return Y((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=ee(t))((function(t,r){var i=new K({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[J]=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?Q: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=ee(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 ee(e){var t;return null!==(t=null!=e?e:q.Promise)&&void 0!==t?t:Promise}function te(e){return I(null==e?void 0:e.lift)}function ne(e){return function(t){if(te(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 re(e,t,n,r,i){return new ie(e,t,n,r,i)}var ie=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}(V);!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,te(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 L;var n=this.getSubject();t.add(this.source.subscribe(re(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=L.EMPTY)}return t},t.prototype.refCount=function(){return ne((function(e,t){var n=null;e._refCount++;var r=re(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)}}($);var oe,ue={now:function(){return(ue.delegate||performance).now()},delegate:void 0},ce={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=t((function(t){n=void 0,e(t)}));return new L((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=ce.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 $((function(e){var t=oe||ue,n=t.now(),r=0,i=function(){e.closed||(r=ce.requestAnimationFrame((function(o){r=0;var u=t.now();e.next({timestamp:oe?u:o,elapsed:u-n}),i()})))};return i(),function(){r&&ce.cancelAnimationFrame(r)}}));var le=M((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),se=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 ae(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new le},t.prototype.next=function(e){var t=this;Y((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;Y((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;Y((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?N:(this.currentObservers=null,o.push(e),new L((function(){t.currentObservers=null,j(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 $;return e.source=this,e},t.create=function(e,t){return new ae(e,t)},t}($),ae=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:N},t}(se);!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)}}(se);var fe={now:function(){return(fe.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=fe);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)}}}(se),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))}}(se);var de,ve=function(e){function t(t,n){return e.call(this)||this}return n(t,e),t.prototype.schedule=function(e,t){return this},t}(L),he=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)))},pe=function(e){return clearInterval(e)},ye=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),he(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&&pe(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,j(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(ve),be=1,me={};function ge(e){return e in me&&(delete me[e],!0)}var we=function(e){var t=be++;return me[t]=!0,de||(de=Promise.resolve()),de.then((function(){return ge(t)&&e()})),t},xe=function(e){ge(e)},_e={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=_e.delegate;return((null==n?void 0:n.setImmediate)||we).apply(void 0,l([],c(e)))},clearImmediate:function(e){return xe(e)},delegate:void 0},Ae=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=_e.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&&(_e.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},t}(ye),Ee=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=fe.now,e}(),Se=function(e){function t(t,n){void 0===n&&(n=Ee.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}(Ee),Te=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}(Se);new Te(Ae);var ke=new Se(ye),Ce=ke,Oe=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}(ye),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(Se);new Pe(Oe);var 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.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=ce.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&&(ce.cancelAnimationFrame(n),t._scheduled=void 0)},t}(ye),Me=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}(Se);new Me(Ie),function(e){function t(t,n){void 0===t&&(t=Re),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}(Se);var Re=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 L.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}(ye),je=new $((function(e){return e.complete()}));function Le(e){return e&&I(e.schedule)}function Ne(e){return e[e.length-1]}function Fe(e){return Le(Ne(e))?e.pop():void 0}var De=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function qe(e){return I(null==e?void 0:e.then)}function Ue(e){return I(e[J])}function ze(e){return Symbol.asyncIterator&&I(null==e?void 0:e[Symbol.asyncIterator])}function We(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 Ye,Ve="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Be(e){return I(null==e?void 0:e[Ve])}function He(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 Ge(e){return I(null==e?void 0:e.getReader)}function Ke(e){if(e instanceof $)return e;if(null!=e){if(Ue(e))return i=e,new $((function(e){var t=i[J]();if(I(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(De(e))return r=e,new $((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(qe(e))return n=e,new $((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,z)}));if(ze(e))return Xe(e);if(Be(e))return t=e,new $((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(Ge(e))return Xe(He(e))}var t,n,r,i;throw We(e)}function Xe(e){return new $((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=f(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 Ze(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 Je(e,t){return void 0===t&&(t=0),ne((function(n,r){n.subscribe(re(r,(function(n){return Ze(r,e,(function(){return r.next(n)}),t)}),(function(){return Ze(r,e,(function(){return r.complete()}),t)}),(function(n){return Ze(r,e,(function(){return r.error(n)}),t)})))}))}function Qe(e,t){return void 0===t&&(t=0),ne((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function $e(e,t){if(!e)throw new Error("Iterable cannot be null");return new $((function(n){Ze(n,t,(function(){var r=e[Symbol.asyncIterator]();Ze(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function et(e,t){if(null!=e){if(Ue(e))return function(e,t){return Ke(e).pipe(Qe(t),Je(t))}(e,t);if(De(e))return function(e,t){return new $((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(qe(e))return function(e,t){return Ke(e).pipe(Qe(t),Je(t))}(e,t);if(ze(e))return $e(e,t);if(Be(e))return function(e,t){return new $((function(n){var r;return Ze(n,t,(function(){r=e[Ve](),Ze(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 I(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(Ge(e))return function(e,t){return $e(He(e),t)}(e,t)}throw We(e)}function tt(e,t){return t?et(e,t):Ke(e)}function nt(e){return e instanceof Date&&!isNaN(e)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(Ye||(Ye={})),M((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),M((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),M((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),M((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}));var rt=M((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function it(e){throw new rt(e)}function ot(e,t){return ne((function(n,r){var i=0;n.subscribe(re(r,(function(n){r.next(e.call(t,n,i++))})))}))}var ut=Array.isArray;function ct(e){return ot((function(t){return function(e,t){return ut(t)?e.apply(void 0,l([],c(t))):e(t)}(e,t)}))}function lt(e,t,n){return void 0===n&&(n=1/0),I(t)?lt((function(n,r){return ot((function(e,i){return t(n,e,r,i)}))(Ke(e(n,r)))}),n):("number"==typeof t&&(n=t),ne((function(t,r){return function(e,t,n,r,i,o,u,c){var l=[],s=0,a=0,f=!1,d=function(){!f||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;Ke(n(e,a++)).subscribe(re(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?Ze(t,u,(function(){return h(e)})):h(e)};l.length&&s<r;)e();d()}catch(e){t.error(e)}})))};return e.subscribe(re(t,v,(function(){f=!0,d()}))),function(){null==c||c()}}(t,r,e,n)})))}function st(e){return void 0===e&&(e=1/0),lt(Q,e)}function at(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return st(1)(tt(e,Fe(e)))}var ft=["addListener","removeListener"],dt=["addEventListener","removeEventListener"],vt=["on","off"];function ht(e,t,n,r){if(I(n)&&(r=n,n=void 0),r)return ht(e,t,n).pipe(ct(r));var i=c(function(e){return I(e.addEventListener)&&I(e.removeEventListener)}(e)?dt.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return I(e.addListener)&&I(e.removeListener)}(e)?ft.map(pt(e,t)):function(e){return I(e.on)&&I(e.off)}(e)?vt.map(pt(e,t)):[],2),o=i[0],u=i[1];if(!o&&De(e))return lt((function(e){return ht(e,t,n)}))(Ke(e));if(!o)throw new TypeError("Invalid event target");return new $((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 pt(e,t){return function(n){return function(r){return e[n](t,r)}}}function yt(e,t,n){void 0===e&&(e=0),void 0===n&&(n=Ce);var r=-1;return null!=t&&(Le(t)?n=t:r=t),new $((function(t){var i=nt(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 bt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Fe(e),r=function(e,t){return"number"==typeof Ne(e)?e.pop():t}(e,1/0),i=e;return i.length?1===i.length?Ke(i[0]):st(r)(tt(i,n)):je}new $(W);var mt=Array.isArray;function gt(e,t){return ne((function(n,r){var i=0;n.subscribe(re(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function wt(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===(t=1===(e=t).length&&mt(e[0])?e[0]:e).length?Ke(t[0]):new $(function(e){return function(t){for(var n=[],r=function(r){n.push(Ke(e[r]).subscribe(re(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 xt(e){return e<=0?function(){return je}:ne((function(t,n){var r=0;t.subscribe(re(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function _t(e,t){return t?function(n){return at(t.pipe(xt(1),ne((function(e,t){e.subscribe(re(t,W))}))),n.pipe(_t(e)))}:lt((function(t,n){return Ke(e(t,n)).pipe(xt(1),function(e){return ot((function(){return e}))}(t))}))}function At(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new se}: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,f=function(){null==r||r.unsubscribe(),r=void 0},d=function(){f(),t=o=void 0,s=a=!1},v=function(){var e=t;d(),null==e||e.unsubscribe()};return ne((function(e,h){c++,a||s||f();var p=o=null!=o?o:n();h.add((function(){0!==--c||a||s||(r=Et(v,l))})),p.subscribe(h),!t&&c>0&&(t=new K({next:function(e){return p.next(e)},error:function(e){a=!0,f(),r=Et(d,i,e),p.error(e)},complete:function(){s=!0,f(),r=Et(d,u),p.complete()}}),Ke(e).subscribe(t))}))(e)}}function Et(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 K({next:function(){i.unsubscribe(),e()}});return Ke(t.apply(void 0,l([],c(n)))).subscribe(i)}}else e()}function St(e,t,n){void 0===t&&(t=ke);var r=yt(e,t);return function(e,t){return ne((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,f=null,d=!1,v=function(){null==f||f.unsubscribe(),f=null,l&&(y(),d&&r.complete())},h=function(){f=null,d&&r.complete()},p=function(t){return f=Ke(e(t)).subscribe(re(r,v,h))},y=function(){if(s){s=!1;var e=a;a=null,r.next(e),!d&&p(e)}};n.subscribe(re(r,(function(e){s=!0,a=e,(!f||f.closed)&&(u?y():p(e))}),(function(){d=!0,(!(l&&s&&f)||f.closed)&&r.complete()})))}))}((function(){return r}),n)}var Tt=["input","select","textarea"],kt=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},Ct=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,u,c=e.pageUrlAllowlist,l=e.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(l)return l(r,i);if(!function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(window.location.href,c))return!1;var a=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof a)switch(a.toLowerCase()){case"hidden":case"password":return!1}var f=kt(i,r);if(n&&f)return!0;if(t){var d=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(!d)return!1}switch(s){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!f||"click"===r}}},Ot=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!Tt.includes(i)&&!o},Pt=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}),{})},It=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:It(null==e?void 0:e.parentElement,t):null};var Mt=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};var Rt=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],jt=["type"],Lt=["svg","path","g"],Nt=["password","hidden"];var Ft=function(e){var t;return e?(t=function(e,t){for(var n=0,r=0;r<e.length;r++){var i=e[r];if(null===i)n+=4;else{var o=Dt(i);n+=o?Array.from(o).length:4}if(n>t)return e.slice(0,r)}return e}(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).map((function(e){return function(e){var t,n,r,i,o,c;if(null===e)return null;var l=String(e.tagName).toLowerCase(),s={tag:l},a=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);a.length&&(s.index=a.indexOf(e),s.indexOfType=a.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var f=null===(c=null===(o=e.previousElementSibling)||void 0===o?void 0:o.tagName)||void 0===c?void 0:c.toLowerCase();f&&(s.prevSib=String(f));var d=e.getAttribute("id");d&&(s.id=String(d));var v=Array.from(e.classList);v.length&&(s.classes=v);var h={},p=Array.from(e.attributes).filter((function(e){return!Rt.includes(e.name)})),y=!Ot(e);if(!Nt.includes(String(e.getAttribute("type")))&&!Lt.includes(l))try{for(var b=u(p),m=b.next();!m.done;m=b.next()){var g=m.value;y&&!jt.includes(g.name)||(h[g.name]=String(g.value).substring(0,128))}}catch(e){t={error:e}}finally{try{m&&!m.done&&(n=b.return)&&n.call(b)}finally{if(t)throw t.error}}return Object.keys(h).length&&(s.attrs=h),s}(e)})),1024),t):[]};function Dt(e,t){void 0===t&&(t=!1);try{if(null==e)return t?"None":null;if("string"==typeof e)return t?(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(e,"'"):e.includes("'")?'"'.concat(e.replace(/'/g,"\\'"),'"'):"'".concat(e,"'"):e;if("boolean"==typeof e)return e?"True":"False";if(Array.isArray(e)){var n=e.map((function(e){return Dt(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=c(e,1)[0]})).map((function(e){var t=c(e,2),n=t[0],r=t[1];return"".concat(String(Dt(n,!0)),": ").concat(String(Dt(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return e.toString()}catch(e){return null}}var qt=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}}))},Ut=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/,zt=/(^\d{3}-?\d{2}-?\d{4}$)/,Wt=/[^\s@]+@[^\s@.]+\.[^\s@]+/,Yt=function(e){var t,n,r,i=this;this.isNonSensitiveString=function(e){var t,n;if("string"!=typeof e)return!0;if(Ut.test((e||"").replace(/[- ]/g,"")))return!1;if(zt.test(e)||Wt.test(e))return!1;try{for(var r=u(i.additionalMaskTextPatterns),o=r.next();!o.done;o=r.next()){var c=o.value;try{if(c.test(e))return!1}catch(e){}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return!0},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}if(t){var r=t.textContent||"";return i.isNonSensitiveString(r)?r:""}return i.getNearestLabel(n)},this.getEventProperties=function(e,t,n){var r,o,u,c=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),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},s=t.getAttribute("aria-label"),a=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var i=r.replace(t,""),o=e.getAttribute(r);i&&(n[i]=o||"")}return n}),{})}(t,n),f=i.getNearestLabel(t),d=((r={})["[Amplitude] Element ID"]=t.getAttribute("id")||"",r["[Amplitude] Element Class"]=t.getAttribute("class"),r["[Amplitude] Element Hierarchy"]=Ft(t),r[T]=c,r[k]=i.getText(t),r["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),r["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),r["[Amplitude] Element Aria Label"]=s,r["[Amplitude] Element Attributes"]=a,r["[Amplitude] Element Parent Label"]=f,r[C]=window.location.href.split("?")[0],r["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return"a"===c&&"click"===e&&t instanceof HTMLAnchorElement&&(d["[Amplitude] Element Href"]=t.href),Pt(d)},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&&kt(u.event.target,u.type))return u.closestTrackedAncestor=u.event.target,u.targetElementProperties=i.getEventProperties(u.type,u.closestTrackedAncestor,r),u;var c=It(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.combineText=function(e){var t="";return Ot(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=i.combineText(e),t+=r.split(/(\s+)/).filter(i.isNonSensitiveString).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},this.getText=function(e){return i.combineText(e).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[k]=i.getText(e),t[C]=window.location.href.split("?")[0],t);return Pt(u)};var o=null!==(r=e.maskTextRegex)&&void 0!==r?r:[],c=[];try{for(var l=u(o),s=l.next();!s.done;s=l.next()){var a=s.value;if(c.length>=25)break;if(a instanceof RegExp)c.push(a);else if("pattern"in a&&"string"==typeof a.pattern)try{c.push(new RegExp(a.pattern))}catch(e){}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}this.additionalMaskTextPatterns=c},Vt=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?O:t,r=this;this.endpoint=O,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 Yt({})}: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===O&&(this.endpoint=i);var s=null;window.addEventListener("message",(function(e){var n,r,i,a,f;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 d,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;(d="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=d,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(d)})})),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,diagnostics:{autocapture:{version:"1.11.1"}}}),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===(f=null==s?void 0:s.close)||void 0===f||f.call(s))}})),this.notify({action:"page-loaded"})},e}();function Bt(e){var t,n,r,i=e.amplitude,o=e.allObservables,l=e.options,s=e.shouldTrackEvent,a=e.evaluateTriggers,f=o.clickObservable,d=f.pipe(ne((function(e,t){var n,r=!1;e.subscribe(re(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),gt((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=bt(d,f.pipe((t=l.debounceTime,void 0===n&&(n=ke),ne((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(re(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})))}))),ot((function(){return"timeout"})))),h=f.pipe(function(e,t){void 0===t&&(t=ke);var n=yt(e,t);return _t((function(){return n}))}(0),gt(Mt),gt((function(e){return s("click",e.closestTrackedAncestor)})),ot((function(e){return a(e)})),(r=v,ne((function(e,t){var n=[];return e.subscribe(re(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),Ke(r).subscribe(re(t,(function(){var e=n;n=[],t.next(e)}),W)),function(){n=null}}))));return h.subscribe((function(e){var t,n,r=(e.length,E);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 Ht(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,f=n.navigateObservable,d=s.pipe(gt((function(e){return!o("click",e.closestTrackedAncestor)})),ot((function(e){var t=It(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})),gt(Mt),gt((function(e){return u("click",e.closestTrackedAncestor)}))),v=[a];f&&v.push(f);var h,p,y=bt.apply(void 0,l([],c(v),!1)),b=d.pipe((h=function(e){return y.pipe(xt(1),function(e,t){var n=nt(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,u=void 0===o?it:o,c=n.scheduler,l=void 0===c?null!=t?t:ke:c,s=n.meta,a=void 0===s?null:s;if(null==r&&null==i)throw new TypeError("No timeout provided.");return ne((function(e,t){var n,o,c=null,s=0,f=function(e){o=Ze(t,l,(function(){try{n.unsubscribe(),Ke(u({meta:a,lastValue:c,seen:s})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(re(t,(function(e){null==o||o.unsubscribe(),s++,t.next(c=e),i>0&&f(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),c=null}))),!s&&f(null!=r?"number"==typeof r?r:+r-l.now():i)}))}({first:500,with:function(){return je}}),ot((function(){return e})))},ne((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(re(t,(function(e){null==n||n.unsubscribe();var i=0,u=r++;Ke(h(e,u)).subscribe(n=re(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(E,i("click",e.closestTrackedAncestor))}))}var Gt,Kt=function(){return new $((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()}}))},Xt=function(e){return void 0===e&&(e="click"),ht(document,e,{capture:!0})},Zt={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Jt=function(e){var t,n,r,i,o=Object.values(Zt).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)),f=a.next();!f.done;f=a.next()){var d=f.value,v=Zt[d.event_type];v&&o[v].add(s.id)}}catch(e){r={error:e}}finally{try{f&&!f.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},Qt=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)),f=a.next();!f.done;f=a.next()){var d=f.value;if("LABELED_EVENT"===d.type){var v=d.match.eventId,h=o.get(v);h||(h=[],o.set(v,h)),h.push(s)}}}catch(e){r={error:e}}finally{try{f&&!f.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},$t=function(e,t){return t.filter((function(t){return t.definition.some((function(t){return Zt[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)}))}))}))},en=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,f=t.get(a.id);if(f)try{for(var d=(i=void 0,u(f)),v=d.next();!v.done;v=d.next()){var h=v.value;c.add(h)}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=d.return)&&o.call(d)}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)}($t(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;qt(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"}(Gt||(Gt={}));var tn=function(e){var t,n,s,a,f,d,v;void 0===e&&(e={});var b=e.dataAttributePrefix,m=void 0===b?p:b,g=e.visualTaggingOptions,w=void 0===g?{enabled:!0,messenger:new Vt}:g;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:h,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:y,e.debounceTime=null!==(s=e.debounceTime)&&void 0!==s?s:0;var x="@amplitude/plugin-autocapture-browser",_=[],E=new Yt(e),S=Jt(Object.values(null!==(f=null===(a=e.pageActions)||void 0===a?void 0:a.labeledEvents)&&void 0!==f?f:{})),T=Qt(null!==(v=null===(d=e.pageActions)||void 0===d?void 0:d.triggers)&&void 0!==v?v:[]),k=function(e,t,n,r){return new en(e,t,n,r)}(S,T,E,e);return{name:x,type:"enrichment",setup:function(t,n){return i(void 0,void 0,void 0,(function(){var u,s,a,f,d,v,h,p,y,b;return o(this,(function(g){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),S=Jt(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),T=Qt(null!==(i=e.pageActions.triggers)&&void 0!==i?i:[]),k.update(S,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=Ct(e,e.cssSelectorAllowlist),s=Ct(e,e.actionClickAllowlist),a=function(){var t,n,r=Xt().pipe(ot((function(t){return E.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,m)})),At()),i=ht(document,"change",{capture:!0}).pipe(ot((function(t){return E.addAdditionalEventProperties(t,"change",e.cssSelectorAllowlist,m)})),At());window.navigation&&(n=ht(window.navigation,"navigate").pipe(ot((function(t){return E.addAdditionalEventProperties(t,"navigate",e.cssSelectorAllowlist,m)})),At()));var o=Kt().pipe(ot((function(t){return E.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,m)})),At());return(t={})[Gt.ClickObservable]=r,t[Gt.ChangeObservable]=i,t[Gt.NavigateObservable]=n,t[Gt.MutationObservable]=o,t}(),f=Bt({allObservables:a,options:e,amplitude:n,shouldTrackEvent:u,evaluateTriggers:k.evaluate.bind(k)}),_.push(f),d=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.pipe(gt(Mt),gt((function(e){return i("change",e.closestTrackedAncestor)})),ot((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 E.getEventProperties.apply(E,l(l([],c(e),!1),[m],!1))},amplitude:n,shouldTrackEvent:u,evaluateTriggers:k.evaluate.bind(k)}),_.push(d),v=Ht({allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,l(l([],c(e),!1),[m],!1))},amplitude:n,shouldTrackEvent:u,shouldTrackActionClick:s}),_.push(v),null===(y=null==t?void 0:t.loggerProvider)||void 0===y||y.log("".concat(x," has been successfully added.")),window.opener&&w.enabled&&(h=e.cssSelectorAllowlist,p=e.actionClickAllowlist,null===(b=w.messenger)||void 0===b||b.setup(r(r({dataExtractor:E,logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:P[t.serverZone]}),{isElementSelectable:Ct(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(_),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 nn(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 rn(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 on(e){var t,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.clickObservable,u=[],c={};function l(e){u=[],c={},e&&(nn(c,e),u.push(e))}return o.pipe(gt(Mt),gt((function(e){return i("click",e.closestTrackedAncestor)})),ot((function(e){if(t&&clearTimeout(t),nn(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?rn(u):null;return l(e),r}return u.push(e),u.length>=4&&(t=setTimeout((function(){var e=rn(u),t=e.rageClickEvent,r=e.time;n.track(S,t,{time:r}),l()}),1e3)),null})),gt((function(e){return null!==e}))).subscribe((function(e){null!==e&&n.track(S,e.rageClickEvent,{time:e.time})}))}return e.WindowMessenger=Vt,e.autocapturePlugin=tn,e.frustrationPlugin=function(e){var t,n,s,a,f;void 0===e&&(e={});var d="@amplitude/plugin-frustration-browser",v=[],h=null!==(n=null===(t=e.rageClicks)||void 0===t?void 0:t.cssSelectorAllowlist)&&void 0!==n?n:m,y=null!==(a=null===(s=e.deadClicks)||void 0===s?void 0:s.cssSelectorAllowlist)&&void 0!==a?a:b,g=null!==(f=e.dataAttributePrefix)&&void 0!==f?f:p,w=new Yt(e),x=l([],c(new Set(l(l([],c(h),!1),c(y),!1))),!1);return{name:d,type:"enrichment",setup:function(t,n){return i(void 0,void 0,void 0,(function(){var i,u,s,a,f,p;return o(this,(function(o){return"undefined"==typeof document||(i=Ct(e,h),u=Ct(e,y),s=function(){var e,t,n=Xt("pointerdown").pipe(ot((function(e){return w.addAdditionalEventProperties(e,"click",x,g,!0)})),At());window.navigation&&(t=ht(window.navigation,"navigate").pipe(ot((function(e){return w.addAdditionalEventProperties(e,"navigate",x,g)})),At()));var r=Kt().pipe(ot((function(e){return w.addAdditionalEventProperties(e,"mutation",x,g)})),At());return(e={})[Gt.ClickObservable]=n,e[Gt.ChangeObservable]=new $,e[Gt.NavigateObservable]=t,e[Gt.MutationObservable]=r,e}(),a=on({allObservables:s,amplitude:n,shouldTrackRageClick:i}),v.push(a),f=function(e){var t=e.amplitude,n=e.allObservables,i=e.getEventProperties,o=e.shouldTrackDeadClick,u=n.clickObservable,s=n.mutationObservable,a=n.navigateObservable,f=u.pipe(gt(Mt),gt((function(e){return o("click",e.closestTrackedAncestor)}))),d=[s];a&&d.push(a);var v=bt.apply(void 0,l([],c(d),!1));return f.pipe(lt((function(e){var t;return wt(new $((function(n){return t=setTimeout((function(){return n.next(e)}),3e3),function(){clearTimeout(t)}})),v.pipe(xt(1),ot((function(){return null})))).pipe(gt((function(e){return null!==e})))})),St(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,g)},shouldTrackDeadClick:u}),v.push(f),null===(p=null==t?void 0:t.loggerProvider)||void 0===p||p.log("".concat(d," 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=tn,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
2
2
  //# sourceMappingURL=amplitude-min.js.map
Binary file