@amplitude/plugin-autocapture-browser 1.25.3 → 1.26.0

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 (53) hide show
  1. package/lib/cjs/autocapture/track-long-task.d.ts +9 -0
  2. package/lib/cjs/autocapture/track-long-task.d.ts.map +1 -0
  3. package/lib/cjs/autocapture/track-long-task.js +124 -0
  4. package/lib/cjs/autocapture/track-long-task.js.map +1 -0
  5. package/lib/cjs/constants.d.ts +2 -0
  6. package/lib/cjs/constants.d.ts.map +1 -1
  7. package/lib/cjs/constants.js +3 -1
  8. package/lib/cjs/constants.js.map +1 -1
  9. package/lib/cjs/index.d.ts +1 -0
  10. package/lib/cjs/index.d.ts.map +1 -1
  11. package/lib/cjs/index.js +3 -1
  12. package/lib/cjs/index.js.map +1 -1
  13. package/lib/cjs/performance-plugin.d.ts +5 -0
  14. package/lib/cjs/performance-plugin.d.ts.map +1 -0
  15. package/lib/cjs/performance-plugin.js +74 -0
  16. package/lib/cjs/performance-plugin.js.map +1 -0
  17. package/lib/cjs/version.d.ts +1 -1
  18. package/lib/cjs/version.js +1 -1
  19. package/lib/cjs/version.js.map +1 -1
  20. package/lib/esm/autocapture/track-long-task.d.ts +9 -0
  21. package/lib/esm/autocapture/track-long-task.d.ts.map +1 -0
  22. package/lib/esm/autocapture/track-long-task.js +120 -0
  23. package/lib/esm/autocapture/track-long-task.js.map +1 -0
  24. package/lib/esm/constants.d.ts +2 -0
  25. package/lib/esm/constants.d.ts.map +1 -1
  26. package/lib/esm/constants.js +2 -0
  27. package/lib/esm/constants.js.map +1 -1
  28. package/lib/esm/index.d.ts +1 -0
  29. package/lib/esm/index.d.ts.map +1 -1
  30. package/lib/esm/index.js +1 -0
  31. package/lib/esm/index.js.map +1 -1
  32. package/lib/esm/performance-plugin.d.ts +5 -0
  33. package/lib/esm/performance-plugin.d.ts.map +1 -0
  34. package/lib/esm/performance-plugin.js +70 -0
  35. package/lib/esm/performance-plugin.js.map +1 -0
  36. package/lib/esm/version.d.ts +1 -1
  37. package/lib/esm/version.js +1 -1
  38. package/lib/esm/version.js.map +1 -1
  39. package/lib/scripts/amplitude-min.js +1 -1
  40. package/lib/scripts/amplitude-min.js.gz +0 -0
  41. package/lib/scripts/amplitude-min.js.map +1 -1
  42. package/lib/scripts/amplitude-min.umd.js +1 -1
  43. package/lib/scripts/amplitude-min.umd.js.gz +0 -0
  44. package/lib/scripts/autocapture/track-long-task.d.ts +9 -0
  45. package/lib/scripts/autocapture/track-long-task.d.ts.map +1 -0
  46. package/lib/scripts/constants.d.ts +2 -0
  47. package/lib/scripts/constants.d.ts.map +1 -1
  48. package/lib/scripts/index.d.ts +1 -0
  49. package/lib/scripts/index.d.ts.map +1 -1
  50. package/lib/scripts/performance-plugin.d.ts +5 -0
  51. package/lib/scripts/performance-plugin.d.ts.map +1 -0
  52. package/lib/scripts/version.d.ts +1 -1
  53. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,WAAW,GAAG,uCAAuC,CAAC;AACnE,MAAM,CAAC,IAAM,uBAAuB,GAAG,uCAAuC,CAAC;AAE/E,MAAM,CAAC,IAAM,+BAA+B,GAAG,6BAA6B,CAAC;AAC7E,MAAM,CAAC,IAAM,oCAAoC,GAAG,wBAAwB,CAAC;AAC7E,MAAM,CAAC,IAAM,oCAAoC,GAAG,wBAAwB,CAAC;AAC7E,MAAM,CAAC,IAAM,qCAAqC,GAAG,yBAAyB,CAAC;AAC/E,MAAM,CAAC,IAAM,+BAA+B,GAAG,6BAA6B,CAAC;AAC7E,MAAM,CAAC,IAAM,6BAA6B,GAAG,2BAA2B,CAAC;AACzE,MAAM,CAAC,IAAM,+BAA+B,GAAG,6BAA6B,CAAC;AAE7E,MAAM,CAAC,IAAM,+BAA+B,GAAG,wBAAwB,CAAC;AACxE,MAAM,CAAC,IAAM,kCAAkC,GAAG,2BAA2B,CAAC;AAC9E,MAAM,CAAC,IAAM,gCAAgC,GAAG,yBAAyB,CAAC;AAC1E,MAAM,CAAC,IAAM,iCAAiC,GAAG,0BAA0B,CAAC;AAC5E,MAAM,CAAC,IAAM,sCAAsC,GAAG,+BAA+B,CAAC;AACtF,MAAM,CAAC,IAAM,iCAAiC,GAAG,0BAA0B,CAAC;AAC5E,MAAM,CAAC,IAAM,0CAA0C,GAAG,mCAAmC,CAAC;AAC9F,MAAM,CAAC,IAAM,yCAAyC,GAAG,kCAAkC,CAAC;AAC5F,MAAM,CAAC,IAAM,uCAAuC,GAAG,gCAAgC,CAAC;AACxF,MAAM,CAAC,IAAM,uCAAuC,GAAG,gCAAgC,CAAC;AACxF,MAAM,CAAC,IAAM,iCAAiC,GAAG,0BAA0B,CAAC;AAE5E,MAAM,CAAC,IAAM,yCAAyC,GAAG,kCAAkC,CAAC;AAC5F,MAAM,CAAC,IAAM,6BAA6B,GAAG,sBAAsB,CAAC;AACpE,MAAM,CAAC,IAAM,+BAA+B,GAAG,wBAAwB,CAAC;AACxE,MAAM,CAAC,IAAM,oCAAoC,GAAG,6BAA6B,CAAC;AAClF,MAAM,CAAC,IAAM,mCAAmC,GAAG,4BAA4B,CAAC;AAChF,MAAM,CAAC,IAAM,+BAA+B,GAAG,wBAAwB,CAAC;AACxE,MAAM,CAAC,IAAM,+BAA+B,GAAG,wBAAwB,CAAC;AAExE,MAAM,CAAC,IAAM,iCAAiC,GAAG,0BAA0B,CAAC;AAE5E,4FAA4F;AAC5F,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,uCAAuC,GACxC,MAAM,2BAA2B,CAAC;AAEnC,MAAM,CAAC,IAAM,4CAA4C,GACvD,0EAA0E,CAAC;AAC7E,gGAAgG;AAChG,6CAA6C;AAC7C,MAAM,CAAC,IAAM,wCAAwC,GAAG,uCAAuC,CAAC;AAEhG,qFAAqF;AACrF,MAAM,CAAC,IAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAEnE,MAAM,CAAC,IAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,MAAM,CAAC,IAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC,qDAAqD;AACrD,MAAM,CAAC,IAAM,6BAA6B,GAAG,eAAe,CAAC;AAE7D,MAAM,CAAC,IAAM,8BAA8B,GAAG,KAAM,CAAC","sourcesContent":["export const PLUGIN_NAME = '@amplitude/plugin-autocapture-browser';\nexport const FRUSTRATION_PLUGIN_NAME = '@amplitude/plugin-frustration-browser';\n\nexport const AMPLITUDE_ELEMENT_CLICKED_EVENT = '[Amplitude] Element Clicked';\nexport const AMPLITUDE_ELEMENT_DEAD_CLICKED_EVENT = '[Amplitude] Dead Click';\nexport const AMPLITUDE_ELEMENT_RAGE_CLICKED_EVENT = '[Amplitude] Rage Click';\nexport const AMPLITUDE_ELEMENT_ERROR_CLICKED_EVENT = '[Amplitude] Error Click';\nexport const AMPLITUDE_ELEMENT_CHANGED_EVENT = '[Amplitude] Element Changed';\nexport const AMPLITUDE_PAGE_SCROLLED_EVENT = '[Amplitude] Page Scrolled';\nexport const AMPLITUDE_THRASHED_CURSOR_EVENT = '[Amplitude] Thrashed Cursor';\n\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_ID = '[Amplitude] Element ID';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_CLASS = '[Amplitude] Element Class';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_TAG = '[Amplitude] Element Tag';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_TEXT = '[Amplitude] Element Text';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_HIERARCHY = '[Amplitude] Element Hierarchy';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_HREF = '[Amplitude] Element Href';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_POSITION_LEFT = '[Amplitude] Element Position Left';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_POSITION_TOP = '[Amplitude] Element Position Top';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_ARIA_LABEL = '[Amplitude] Element Aria Label';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_ATTRIBUTES = '[Amplitude] Element Attributes';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_PATH = '[Amplitude] Element Path';\n\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_PARENT_LABEL = '[Amplitude] Element Parent Label';\nexport const AMPLITUDE_EVENT_PROP_PAGE_URL = '[Amplitude] Page URL';\nexport const AMPLITUDE_EVENT_PROP_PAGE_TITLE = '[Amplitude] Page Title';\nexport const AMPLITUDE_EVENT_PROP_VIEWPORT_HEIGHT = '[Amplitude] Viewport Height';\nexport const AMPLITUDE_EVENT_PROP_VIEWPORT_WIDTH = '[Amplitude] Viewport Width';\nexport const AMPLITUDE_EVENT_PROP_MAX_PAGE_X = '[Amplitude] Max Page X';\nexport const AMPLITUDE_EVENT_PROP_MAX_PAGE_Y = '[Amplitude] Max Page Y';\n\nexport const AMPLITUDE_EVENT_PROP_PAGE_VIEW_ID = '[Amplitude] Page View ID';\n\n// Origin constants are now shared via analytics-core; re-export for backwards compatibility\nexport {\n AMPLITUDE_ORIGIN,\n AMPLITUDE_ORIGIN_EU,\n AMPLITUDE_ORIGIN_STAGING,\n AMPLITUDE_ORIGINS_MAP,\n AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL,\n} from '@amplitude/analytics-core';\n\nexport const AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL =\n 'https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz';\n// This is the class name used by the visual tagging selector to highlight the selected element.\n// Should not use this class in the selector.\nexport const AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS = 'amp-visual-tagging-selector-highlight';\n\n// Data attribute for specifying which attributes should be redacted from autocapture\nexport const DATA_AMP_MASK_ATTRIBUTES = 'data-amp-mask-attributes';\n\nexport const MAX_MASK_TEXT_PATTERNS = 25;\n\nexport const MAX_ATTRIBUTE_LENGTH = 128;\n\n// The key for the page view object in sessionStorage\nexport const PAGE_VIEW_SESSION_STORAGE_KEY = 'AMP_PAGE_VIEW';\n\nexport const MAX_ELEMENT_EXPOSED_STR_LENGTH = 18_000;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,WAAW,GAAG,uCAAuC,CAAC;AACnE,MAAM,CAAC,IAAM,uBAAuB,GAAG,uCAAuC,CAAC;AAC/E,MAAM,CAAC,IAAM,uBAAuB,GAAG,uCAAuC,CAAC;AAE/E,MAAM,CAAC,IAAM,+BAA+B,GAAG,6BAA6B,CAAC;AAC7E,MAAM,CAAC,IAAM,oCAAoC,GAAG,wBAAwB,CAAC;AAC7E,MAAM,CAAC,IAAM,oCAAoC,GAAG,wBAAwB,CAAC;AAC7E,MAAM,CAAC,IAAM,qCAAqC,GAAG,yBAAyB,CAAC;AAC/E,MAAM,CAAC,IAAM,+BAA+B,GAAG,6BAA6B,CAAC;AAC7E,MAAM,CAAC,IAAM,6BAA6B,GAAG,2BAA2B,CAAC;AACzE,MAAM,CAAC,IAAM,+BAA+B,GAAG,6BAA6B,CAAC;AAC7E,MAAM,CAAC,IAAM,iCAAiC,GAAG,+BAA+B,CAAC;AAEjF,MAAM,CAAC,IAAM,+BAA+B,GAAG,wBAAwB,CAAC;AACxE,MAAM,CAAC,IAAM,kCAAkC,GAAG,2BAA2B,CAAC;AAC9E,MAAM,CAAC,IAAM,gCAAgC,GAAG,yBAAyB,CAAC;AAC1E,MAAM,CAAC,IAAM,iCAAiC,GAAG,0BAA0B,CAAC;AAC5E,MAAM,CAAC,IAAM,sCAAsC,GAAG,+BAA+B,CAAC;AACtF,MAAM,CAAC,IAAM,iCAAiC,GAAG,0BAA0B,CAAC;AAC5E,MAAM,CAAC,IAAM,0CAA0C,GAAG,mCAAmC,CAAC;AAC9F,MAAM,CAAC,IAAM,yCAAyC,GAAG,kCAAkC,CAAC;AAC5F,MAAM,CAAC,IAAM,uCAAuC,GAAG,gCAAgC,CAAC;AACxF,MAAM,CAAC,IAAM,uCAAuC,GAAG,gCAAgC,CAAC;AACxF,MAAM,CAAC,IAAM,iCAAiC,GAAG,0BAA0B,CAAC;AAE5E,MAAM,CAAC,IAAM,yCAAyC,GAAG,kCAAkC,CAAC;AAC5F,MAAM,CAAC,IAAM,6BAA6B,GAAG,sBAAsB,CAAC;AACpE,MAAM,CAAC,IAAM,+BAA+B,GAAG,wBAAwB,CAAC;AACxE,MAAM,CAAC,IAAM,oCAAoC,GAAG,6BAA6B,CAAC;AAClF,MAAM,CAAC,IAAM,mCAAmC,GAAG,4BAA4B,CAAC;AAChF,MAAM,CAAC,IAAM,+BAA+B,GAAG,wBAAwB,CAAC;AACxE,MAAM,CAAC,IAAM,+BAA+B,GAAG,wBAAwB,CAAC;AAExE,MAAM,CAAC,IAAM,iCAAiC,GAAG,0BAA0B,CAAC;AAE5E,4FAA4F;AAC5F,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,uCAAuC,GACxC,MAAM,2BAA2B,CAAC;AAEnC,MAAM,CAAC,IAAM,4CAA4C,GACvD,0EAA0E,CAAC;AAC7E,gGAAgG;AAChG,6CAA6C;AAC7C,MAAM,CAAC,IAAM,wCAAwC,GAAG,uCAAuC,CAAC;AAEhG,qFAAqF;AACrF,MAAM,CAAC,IAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAEnE,MAAM,CAAC,IAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,MAAM,CAAC,IAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC,qDAAqD;AACrD,MAAM,CAAC,IAAM,6BAA6B,GAAG,eAAe,CAAC;AAE7D,MAAM,CAAC,IAAM,8BAA8B,GAAG,KAAM,CAAC","sourcesContent":["export const PLUGIN_NAME = '@amplitude/plugin-autocapture-browser';\nexport const FRUSTRATION_PLUGIN_NAME = '@amplitude/plugin-frustration-browser';\nexport const PERFORMANCE_PLUGIN_NAME = '@amplitude/plugin-performance-browser';\n\nexport const AMPLITUDE_ELEMENT_CLICKED_EVENT = '[Amplitude] Element Clicked';\nexport const AMPLITUDE_ELEMENT_DEAD_CLICKED_EVENT = '[Amplitude] Dead Click';\nexport const AMPLITUDE_ELEMENT_RAGE_CLICKED_EVENT = '[Amplitude] Rage Click';\nexport const AMPLITUDE_ELEMENT_ERROR_CLICKED_EVENT = '[Amplitude] Error Click';\nexport const AMPLITUDE_ELEMENT_CHANGED_EVENT = '[Amplitude] Element Changed';\nexport const AMPLITUDE_PAGE_SCROLLED_EVENT = '[Amplitude] Page Scrolled';\nexport const AMPLITUDE_THRASHED_CURSOR_EVENT = '[Amplitude] Thrashed Cursor';\nexport const AMPLITUDE_MAIN_THREAD_BLOCK_EVENT = '[Amplitude] Main Thread Block';\n\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_ID = '[Amplitude] Element ID';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_CLASS = '[Amplitude] Element Class';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_TAG = '[Amplitude] Element Tag';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_TEXT = '[Amplitude] Element Text';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_HIERARCHY = '[Amplitude] Element Hierarchy';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_HREF = '[Amplitude] Element Href';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_POSITION_LEFT = '[Amplitude] Element Position Left';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_POSITION_TOP = '[Amplitude] Element Position Top';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_ARIA_LABEL = '[Amplitude] Element Aria Label';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_ATTRIBUTES = '[Amplitude] Element Attributes';\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_PATH = '[Amplitude] Element Path';\n\nexport const AMPLITUDE_EVENT_PROP_ELEMENT_PARENT_LABEL = '[Amplitude] Element Parent Label';\nexport const AMPLITUDE_EVENT_PROP_PAGE_URL = '[Amplitude] Page URL';\nexport const AMPLITUDE_EVENT_PROP_PAGE_TITLE = '[Amplitude] Page Title';\nexport const AMPLITUDE_EVENT_PROP_VIEWPORT_HEIGHT = '[Amplitude] Viewport Height';\nexport const AMPLITUDE_EVENT_PROP_VIEWPORT_WIDTH = '[Amplitude] Viewport Width';\nexport const AMPLITUDE_EVENT_PROP_MAX_PAGE_X = '[Amplitude] Max Page X';\nexport const AMPLITUDE_EVENT_PROP_MAX_PAGE_Y = '[Amplitude] Max Page Y';\n\nexport const AMPLITUDE_EVENT_PROP_PAGE_VIEW_ID = '[Amplitude] Page View ID';\n\n// Origin constants are now shared via analytics-core; re-export for backwards compatibility\nexport {\n AMPLITUDE_ORIGIN,\n AMPLITUDE_ORIGIN_EU,\n AMPLITUDE_ORIGIN_STAGING,\n AMPLITUDE_ORIGINS_MAP,\n AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL,\n} from '@amplitude/analytics-core';\n\nexport const AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL =\n 'https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz';\n// This is the class name used by the visual tagging selector to highlight the selected element.\n// Should not use this class in the selector.\nexport const AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS = 'amp-visual-tagging-selector-highlight';\n\n// Data attribute for specifying which attributes should be redacted from autocapture\nexport const DATA_AMP_MASK_ATTRIBUTES = 'data-amp-mask-attributes';\n\nexport const MAX_MASK_TEXT_PATTERNS = 25;\n\nexport const MAX_ATTRIBUTE_LENGTH = 128;\n\n// The key for the page view object in sessionStorage\nexport const PAGE_VIEW_SESSION_STORAGE_KEY = 'AMP_PAGE_VIEW';\n\nexport const MAX_ELEMENT_EXPOSED_STR_LENGTH = 18_000;\n"]}
@@ -1,5 +1,6 @@
1
1
  export { autocapturePlugin as plugin, autocapturePlugin } from './autocapture-plugin';
2
2
  export { frustrationPlugin } from './frustration-plugin';
3
+ export { performancePlugin } from './performance-plugin';
3
4
  export { Action, ActionData, Message, enableVisualTagging } from './libs/messenger';
4
5
  export { DataExtractor } from './data-extractor';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,MAAM,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,MAAM,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
package/lib/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { autocapturePlugin as plugin, autocapturePlugin } from './autocapture-plugin';
2
2
  export { frustrationPlugin } from './frustration-plugin';
3
+ export { performancePlugin } from './performance-plugin';
3
4
  export { enableVisualTagging } from './libs/messenger';
4
5
  export { DataExtractor } from './data-extractor';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,MAAM,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAA+B,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { autocapturePlugin as plugin, autocapturePlugin } from './autocapture-plugin';\nexport { frustrationPlugin } from './frustration-plugin';\nexport { Action, ActionData, Message, enableVisualTagging } from './libs/messenger';\nexport { DataExtractor } from './data-extractor';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,MAAM,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAA+B,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { autocapturePlugin as plugin, autocapturePlugin } from './autocapture-plugin';\nexport { frustrationPlugin } from './frustration-plugin';\nexport { performancePlugin } from './performance-plugin';\nexport { Action, ActionData, Message, enableVisualTagging } from './libs/messenger';\nexport { DataExtractor } from './data-extractor';\n"]}
@@ -0,0 +1,5 @@
1
+ import { BrowserClient, BrowserConfig, EnrichmentPlugin, PerformanceTrackingOptions } from '@amplitude/analytics-core';
2
+ type BrowserEnrichmentPlugin = EnrichmentPlugin<BrowserClient, BrowserConfig>;
3
+ export declare const performancePlugin: (options?: PerformanceTrackingOptions) => BrowserEnrichmentPlugin;
4
+ export {};
5
+ //# sourceMappingURL=performance-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"performance-plugin.d.ts","sourceRoot":"","sources":["../../src/performance-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAE3B,MAAM,2BAA2B,CAAC;AAInC,KAAK,uBAAuB,GAAG,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAI9E,eAAO,MAAM,iBAAiB,aAAa,0BAA0B,KAAQ,uBAmD5E,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { __awaiter, __generator, __values } from "tslib";
2
+ import * as constants from './constants';
3
+ import { trackMainThreadBlock } from './autocapture/track-long-task';
4
+ var DEFAULT_DURATION_THRESHOLD = 100; // ms
5
+ export var performancePlugin = function (options) {
6
+ if (options === void 0) { options = {}; }
7
+ var name = constants.PERFORMANCE_PLUGIN_NAME;
8
+ var type = 'enrichment';
9
+ var subscriptions = [];
10
+ var mainThreadBlockEnabled = options.mainThreadBlock === true ||
11
+ (typeof options.mainThreadBlock === 'object' && options.mainThreadBlock !== null);
12
+ var setup = function (config, amplitude) { return __awaiter(void 0, void 0, void 0, function () {
13
+ var durationThreshold, subscription;
14
+ var _a;
15
+ return __generator(this, function (_b) {
16
+ /* istanbul ignore if */
17
+ if (typeof document === 'undefined') {
18
+ return [2 /*return*/];
19
+ }
20
+ if (mainThreadBlockEnabled) {
21
+ durationThreshold = DEFAULT_DURATION_THRESHOLD;
22
+ if (typeof options.mainThreadBlock === 'object' && options.mainThreadBlock.durationThreshold !== undefined) {
23
+ durationThreshold = options.mainThreadBlock.durationThreshold;
24
+ }
25
+ subscription = trackMainThreadBlock({
26
+ amplitude: amplitude,
27
+ options: options,
28
+ durationThreshold: durationThreshold,
29
+ });
30
+ subscriptions.push(subscription);
31
+ }
32
+ /* istanbul ignore next */
33
+ (_a = config === null || config === void 0 ? void 0 : config.loggerProvider) === null || _a === void 0 ? void 0 : _a.log("".concat(name, " performance tracking has been successfully added."));
34
+ return [2 /*return*/];
35
+ });
36
+ }); };
37
+ var execute = function (event) { return __awaiter(void 0, void 0, void 0, function () {
38
+ return __generator(this, function (_a) {
39
+ return [2 /*return*/, event];
40
+ });
41
+ }); };
42
+ var teardown = function () { return __awaiter(void 0, void 0, void 0, function () {
43
+ var subscriptions_1, subscriptions_1_1, subscription;
44
+ var e_1, _a;
45
+ return __generator(this, function (_b) {
46
+ try {
47
+ for (subscriptions_1 = __values(subscriptions), subscriptions_1_1 = subscriptions_1.next(); !subscriptions_1_1.done; subscriptions_1_1 = subscriptions_1.next()) {
48
+ subscription = subscriptions_1_1.value;
49
+ subscription.unsubscribe();
50
+ }
51
+ }
52
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
53
+ finally {
54
+ try {
55
+ if (subscriptions_1_1 && !subscriptions_1_1.done && (_a = subscriptions_1.return)) _a.call(subscriptions_1);
56
+ }
57
+ finally { if (e_1) throw e_1.error; }
58
+ }
59
+ return [2 /*return*/];
60
+ });
61
+ }); };
62
+ return {
63
+ name: name,
64
+ type: type,
65
+ setup: setup,
66
+ execute: execute,
67
+ teardown: teardown,
68
+ };
69
+ };
70
+ //# sourceMappingURL=performance-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"performance-plugin.js","sourceRoot":"","sources":["../../src/performance-plugin.ts"],"names":[],"mappings":";AAQA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAIrE,IAAM,0BAA0B,GAAG,GAAG,CAAC,CAAC,KAAK;AAE7C,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAC,OAAwC;IAAxC,wBAAA,EAAA,YAAwC;IACxE,IAAM,IAAI,GAAG,SAAS,CAAC,uBAAuB,CAAC;IAC/C,IAAM,IAAI,GAAG,YAAY,CAAC;IAE1B,IAAM,aAAa,GAAqB,EAAE,CAAC;IAE3C,IAAM,sBAAsB,GAC1B,OAAO,CAAC,eAAe,KAAK,IAAI;QAChC,CAAC,OAAO,OAAO,CAAC,eAAe,KAAK,QAAQ,IAAI,OAAO,CAAC,eAAe,KAAK,IAAI,CAAC,CAAC;IAEpF,IAAM,KAAK,GAAqC,UAAO,MAAM,EAAE,SAAS;;;;YACtE,wBAAwB;YACxB,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;gBACnC,sBAAO;aACR;YAED,IAAI,sBAAsB,EAAE;gBACtB,iBAAiB,GAAG,0BAA0B,CAAC;gBACnD,IAAI,OAAO,OAAO,CAAC,eAAe,KAAK,QAAQ,IAAI,OAAO,CAAC,eAAe,CAAC,iBAAiB,KAAK,SAAS,EAAE;oBAC1G,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,iBAAiB,CAAC;iBAC/D;gBAEK,YAAY,GAAG,oBAAoB,CAAC;oBACxC,SAAS,WAAA;oBACT,OAAO,SAAA;oBACP,iBAAiB,mBAAA;iBAClB,CAAC,CAAC;gBACH,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aAClC;YAED,0BAA0B;YAC1B,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,0CAAE,GAAG,CAAC,UAAG,IAAI,uDAAoD,CAAC,CAAC;;;SAC1F,CAAC;IAEF,IAAM,OAAO,GAAuC,UAAO,KAAK;;YAC9D,sBAAO,KAAK,EAAC;;SACd,CAAC;IAEF,IAAM,QAAQ,GAAG;;;;;gBACf,KAA2B,kBAAA,SAAA,aAAa,CAAA,mHAAE;oBAA/B,YAAY;oBACrB,YAAY,CAAC,WAAW,EAAE,CAAC;iBAC5B;;;;;;;;;;;SACF,CAAC;IAEF,OAAO;QACL,IAAI,MAAA;QACJ,IAAI,MAAA;QACJ,KAAK,OAAA;QACL,OAAO,SAAA;QACP,QAAQ,UAAA;KACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport {\n BrowserClient,\n BrowserConfig,\n EnrichmentPlugin,\n PerformanceTrackingOptions,\n Unsubscribable,\n} from '@amplitude/analytics-core';\nimport * as constants from './constants';\nimport { trackMainThreadBlock } from './autocapture/track-long-task';\n\ntype BrowserEnrichmentPlugin = EnrichmentPlugin<BrowserClient, BrowserConfig>;\n\nconst DEFAULT_DURATION_THRESHOLD = 100; // ms\n\nexport const performancePlugin = (options: PerformanceTrackingOptions = {}): BrowserEnrichmentPlugin => {\n const name = constants.PERFORMANCE_PLUGIN_NAME;\n const type = 'enrichment';\n\n const subscriptions: Unsubscribable[] = [];\n\n const mainThreadBlockEnabled =\n options.mainThreadBlock === true ||\n (typeof options.mainThreadBlock === 'object' && options.mainThreadBlock !== null);\n\n const setup: BrowserEnrichmentPlugin['setup'] = async (config, amplitude) => {\n /* istanbul ignore if */\n if (typeof document === 'undefined') {\n return;\n }\n\n if (mainThreadBlockEnabled) {\n let durationThreshold = DEFAULT_DURATION_THRESHOLD;\n if (typeof options.mainThreadBlock === 'object' && options.mainThreadBlock.durationThreshold !== undefined) {\n durationThreshold = options.mainThreadBlock.durationThreshold;\n }\n\n const subscription = trackMainThreadBlock({\n amplitude,\n options,\n durationThreshold,\n });\n subscriptions.push(subscription);\n }\n\n /* istanbul ignore next */\n config?.loggerProvider?.log(`${name} performance tracking has been successfully added.`);\n };\n\n const execute: BrowserEnrichmentPlugin['execute'] = async (event) => {\n return event;\n };\n\n const teardown = async () => {\n for (const subscription of subscriptions) {\n subscription.unsubscribe();\n }\n };\n\n return {\n name,\n type,\n setup,\n execute,\n teardown,\n };\n};\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.25.3";
1
+ export declare const VERSION = "1.26.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export var VERSION = '1.25.3';
1
+ export var VERSION = '1.26.0';
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.25.3';\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.26.0';\n"]}
@@ -1,2 +1,2 @@
1
- var amplitudeAutocapturePlugin=function(e){"use strict";var t=function(){return t=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},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))(function(i,o){function l(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,a)}u((r=r.apply(e,t||[])).next())})}function r(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function i(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 o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)l.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 l}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"==typeof SuppressedError&&SuppressedError;var a=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},u=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},c=a(),s=null==c?void 0:c.console,d={},v={},f=!1;var p={addListener:function(e,t){var n,r=(n=e,!!s&&"function"==typeof s[n]&&(v[n]||(v[n]=s[n],s[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(d[n]&&!f){f=!0;var r=d[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return f=!1,v[n].apply(s,e)}),!0));if(!r)return new Error("Console override failed");d[e]?d[e].push(t):d[e]=[t]},removeListener:function(e){var t,n;try{for(var r=i(Object.values(d)),o=r.next();!o.done;o=r.next())for(var l=o.value,a=l.length-1;a>=0;a--)if(l[a]===e){l.splice(a,1);break}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=i(Object.entries(v)),r=n.next();!r.done;r=n.next()){var l=o(r.value,2),a=l[0],u=l[1];u&&(s[a]=u)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}v={},d={}}},h=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],g="data-amp-track-",m=["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"]'],o(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),y=b,w=b,E=["*"],x="data-amp-mask",T="*****",A=/\b(?:\d[ -]*?){13,16}\b/,k=/(\d{3}-?\d{2}-?\d{4})/g,O=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,S={};Object.defineProperty(S,"__esModule",{value:!0}),S.Observable=void 0;const C=e=>Boolean(Symbol[e]),P=e=>C(e)?Symbol[e]:"@@"+e,M=P("iterator"),_=P("observable"),L=P("species");function N(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function D(e){let t=e.constructor;return void 0!==t&&(t=t[L],null===t&&(t=void 0)),void 0!==t?t:Y}function I(e){I.log?I.log(e):setTimeout(()=>{throw e})}function R(e){Promise.resolve().then(()=>{try{e()}catch(e){I(e)}})}function H(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=N(t,"unsubscribe");e&&e.call(t)}}catch(e){I(e)}}function j(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function U(e,t,n){e._state="running";let r=e._observer;try{let i=N(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(j(e),!i)throw n;i.call(r,n);break;case"complete":j(e),i&&i.call(r)}}catch(e){I(e)}"closed"===e._state?H(e):"running"===e._state&&(e._state="ready")}function q(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void R(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(U(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void U(e,t,n);e._queue.push({type:t,value:n})}}class X{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){q(n,"next",e)},error(e){q(n,"error",e)},complete(){q(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(j(this),H(this))}}class Y{constructor(e){if(!(this instanceof Y))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new X(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(D(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(D(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=D(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let l=!r;if(r=!0,!l||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=D(this);return new t(n=>{let r,i=0;return function o(l){r=l.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=D(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let l=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(l);e>=0&&r.splice(e,1),o()}});r.push(l)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[_](){return this}static from(e){let t="function"==typeof this?this:Y;if(null==e)throw new TypeError(e+" is not an object");let n=N(e,_);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof Y}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(C("iterator")&&(n=N(e,M),n))return new t(t=>{R(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{R(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:Y)(t=>{R(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[L](){return this}}S.Observable=Y,Object.defineProperty(Y,Symbol("extensions"),{value:{symbol:_,hostReportError:I},configurable:!0});var G=S.Observable;function z(e,t){return new G(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function B(e,t){return new G(function(n){var r=!1,o=new Set,l=function(){var e,t;r=!0;try{for(var n=i(o),l=n.next();!l.done;l=n.next()){var a=l.value;try{a.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}o.clear()},a=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),l())},complete:function(){o.delete(t),r||0!==o.size||(n.complete(),l(),r=!0)}});o.add(t)};return a(e),a(t),l})}function F(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new G(function(o){return t.add(o),null===n&&(n=e.subscribe({next:function(e){var n,r,o;try{for(var l=i(t),a=l.next();!a.done;a=l.next()){var u=a.value;null===(o=u.next)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}},error:function(e){var n,o,l;try{for(var a=i(t),u=a.next();!u.done;u=a.next()){var c=u.value;null===(l=c.error)||void 0===l||l.call(c,e)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,o;try{for(var l=i(t),a=l.next();!a.done;a=l.next()){var u=a.value;null===(o=u.complete)||void 0===o||o.call(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}r()}})),function(){t.delete(o),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var V,W="https://app.amplitude.com",J={US:W,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var K="__AMPLITUDE_MESSENGER_INSTANCE__",Z="__AMPLITUDE_MESSENGER__",$=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?W:t;this[V]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,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,l){r.requestCallbacks[i]={resolve:t,reject:l},r.notify(o),n.timeout>0&&setTimeout(function(){l(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.registerActionHandler=function(e,t){var n,r,o,l;this.actionHandlers.has(e)&&(null===(l=null===(o=this.logger)||void 0===o?void 0:o.warn)||void 0===l||l.call(o,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var a=this.pendingMessages.get(e);if(a){this.pendingMessages.delete(e);try{for(var u=i(a),c=u.next();!c.done;c=u.next()){t(c.value)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return n(this,void 0,void 0,function(){var t,n,i;return r(this,function(r){switch(r.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,n];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.scriptLoadPromises.delete(e),i;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,l=i.endpoint;o&&(this.logger=o),l&&this.endpoint===W&&(this.endpoint=l),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,l;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var a=e.data,u=null==a?void 0:a.action;if(u)if("id"in a&&a.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(a);else{if("ping"===u)return void r.notify({action:"pong"});var c=r.actionHandlers.get(u);if(c)c(a.data);else{var s=null!==(l=r.pendingMessages.get(u))&&void 0!==l?l:[];s.push(a.data),r.pendingMessages.set(u,s)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=a();(null==e?void 0:e[Z])===this&&delete e[Z]},e}();function Q(e){var t,n=a(),r=null==n?void 0:n[Z];if("object"==typeof(t=r)&&null!==t&&K in t&&!0===t[K])return r;var i=new $(e);return n&&(n[Z]=i),i}V=K;var ee="__AMPLITUDE_BACKGROUND_CAPTURE__";var te,ne="1.25.3",re="[Amplitude] Element Clicked",ie="[Amplitude] Element Tag",oe="[Amplitude] Element Text",le="[Amplitude] Page URL",ae="[Amplitude] Viewport Height",ue="[Amplitude] Viewport Width",ce="[Amplitude] Page View ID",se="data-amp-mask-attributes",de=["input","select","textarea"],ve=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},fe=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&u(window.location.href,n))&&!!u(window.location.href,t)},pe=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,l,a=e.shouldTrackEventResolver,u=null===(l=null===(o=null==i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===l?void 0:l.call(o);if(!u)return!1;if(a)return a(r,i);if(!fe(e))return!1;var c=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}var s=ve(i,r);if(n&&s)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(u){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!s||"click"===r}}},he=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},ge=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},{})},me=function(){var e;try{var t=a(),n=null===(e=null==t?void 0:t.sessionStorage)||void 0===e?void 0:e.getItem("AMP_PAGE_VIEW");if(!n)return;var r=JSON.parse(n);if("string"==typeof r.pageViewId)return r.pageViewId}catch(e){}},be=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:be(null==e?void 0:e.parentElement,t):null},ye=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(te||(te={}));var we="__AMPLITUDE_VISUAL_TAGGING__";function Ee(e,t){var n=e;if(!0!==n[we]){n[we]=!0;var r=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,l=t.actionClickAllowlist,a=null,u=function(t){e.notify({action:"element-selected",data:t})},c=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var n;a=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:c,onSelect:u,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:l,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:ne}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==a?void 0:a.close)||void 0===e||e.call(a)})}}var xe=a(),Te=function(){return new G(function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},Ae=function(e){return void 0===e&&(e="click"),new G(function(t){var n,r=function(e){t.next(e)};return null===(n=a())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=a())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}})},ke=function(){var e=B(new G(function(e){var n=function(n){if(n instanceof ErrorEvent){var r={kind:"error"};n.error instanceof Error||n.error instanceof DOMException?r=t(t({},r),{message:n.error.message,stack:n.error.stack,filename:n.filename,lineNumber:n.lineno,columnNumber:n.colno}):"string"==typeof n.error&&(r.message=n.error),e.next(r)}};return xe.addEventListener("error",n),function(){xe.removeEventListener("error",n)}}),new G(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return xe.addEventListener("unhandledrejection",t),function(){xe.removeEventListener("unhandledrejection",t)}}));return B(e,new G(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return p.addListener("error",t),function(){p.removeListener(t)}}))},Oe=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}})},Se={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Ce=function(e){var t,n,r,o,l=Object.values(Se).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return l;try{for(var a=i(e),u=a.next();!u.done;u=a.next()){var c=u.value;try{try{for(var s=(r=void 0,i(c.definition)),d=s.next();!d.done;d=s.next()){var v=d.value,f=Se[v.event_type];f&&l[f].add(c.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==c?void 0:c.id,e)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return l},Pe=function(e){var t,n,r,o,l=new Map;try{for(var a=i(e),u=a.next();!u.done;u=a.next()){var c=u.value;try{for(var s=(r=void 0,i(c.conditions)),d=s.next();!d.done;d=s.next()){var v=d.value;if("LABELED_EVENT"===v.type){var f=v.match.eventId,p=l.get(f);p||(p=[],l.set(f,p)),p.push(c)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return l},Me=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return Se[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)})})})},_e=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 o=function(e,t){var n,r,o,l,a=new Set;try{for(var u=i(e),c=u.next();!c.done;c=u.next()){var s=c.value,d=t.get(s.id);if(d)try{for(var v=(o=void 0,i(d)),f=v.next();!f.done;f=v.next()){var p=f.value;a.add(p)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(l=v.return)&&l.call(v)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return Array.from(a)}(Me(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var l=i(o),a=l.next();!a.done;a=l.next()){var u=a.value;Oe(u.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}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}(),Le=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",se,x]),Ne=["type"],De=["svg","path","g"],Ie=["password","hidden"];function Re(e,t){var n,r,o,l,a,u;if(null===e)return null;var c=String(e.tagName).toLowerCase(),s={tag:c},d=Array.from(null!==(l=null===(o=e.parentElement)||void 0===o?void 0:o.children)&&void 0!==l?l:[]);d.length&&(s.index=d.indexOf(e),s.indexOfType=d.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var v=null===(u=null===(a=e.previousElementSibling)||void 0===a?void 0:a.tagName)||void 0===u?void 0:u.toLowerCase();v&&(s.prevSib=String(v));var f=e.getAttribute("id");f&&(s.id=String(f));var p=Array.from(e.classList);p.length&&(s.classes=p);var h={},g=Array.from(e.attributes).filter(function(e){return!Le.has(e.name)}),m=!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!de.includes(i)&&!o}(e);if(!Ie.includes(String(e.getAttribute("type")))&&!De.includes(c))try{for(var b=i(g),y=b.next();!y.done;y=b.next()){var w=y.value;m&&!Ne.includes(w.name)||(t.has(w.name)?h[w.name]=T:h[w.name]=String(w.value).substring(0,128))}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=b.return)&&r.call(b)}finally{if(n)throw n.error}}return Object.keys(h).length&&(s.attrs=h),s}var He,je=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Ue=function(e,t,n){var r,o;if(e.nodeType!==Node.ELEMENT_NODE)return null;var l=e.getAttribute("id");if(t){if(l)return new je(d(l),!0);var a=e.tagName.toLowerCase();if("body"===a||"head"===a||"html"===a)return new je(a,!0)}var u=e.tagName.toLowerCase();if(l)return new je(u+d(l),!0);var c=e.parentNode;if(!c||c.nodeType===Node.DOCUMENT_NODE)return new je(u,!0);function s(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]}function d(e){return"#"+CSS.escape(e)}for(var v=s(e),f=!1,p=!1,h=-1,g=-1,m=c.children,b=0;m&&(-1===h||!p)&&b<m.length;++b){var y=m[b];if(y.nodeType===Node.ELEMENT_NODE)if(g+=1,y!==e){if(!p&&y.tagName.toLowerCase()===u){f=!0;var w=new Set(v);if(w.size)for(var E=s(y),x=0;x<E.length;++x){var T=E[x];if(w.has(T)&&(w.delete(T),!w.size)){p=!0;break}}else p=!0}}else h=g}var A=u;if(n&&"input"===u.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(A+="[type="+CSS.escape(e.getAttribute("type")||"")+"]"),p)A+=":nth-child("+String(h+1)+")";else if(f)try{for(var k=i(v),O=k.next();!O.done;O=k.next()){var S=O.value;A+="."+CSS.escape(S.slice(1))}}catch(e){r={error:e}}finally{try{O&&!O.done&&(o=k.return)&&o.call(k)}finally{if(r)throw r.error}}return new je(A,!1)},qe=function(e,t){var n,r,a,u=this;this.replaceSensitiveString=function(e){return function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var o=e;o=(o=(o=o.replace(A,T)).replace(k,T)).replace(O,T);try{for(var l=i(t),a=l.next();!a.done;a=l.next()){var u=a.value;try{o=o.replace(u,T)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return o}(e,u.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,a,c,s=performance.now();if(!e)return[];for(var d=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),v=new Map,f=d.length-1;f>=0;f--){var p=d[f];if(p){var h=he(p.getAttribute(se)),g=f===d.length-1?[]:null!==(r=v.get(d[f+1]))&&void 0!==r?r:new Set,m=new Set(l(l([],o(g),!1),o(h),!1));v.set(p,m)}}c=d.map(function(e){var t;return Re(e,null!==(t=v.get(e))&&void 0!==t?t:new Set)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=o(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=u.replaceSensitiveString(i))})};try{for(var y=i(c),w=y.next();!w.done;w=y.next())b(w.value)}catch(e){t={error:e}}finally{try{w&&!w.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}var E=performance.now();return null===(a=u.diagnosticsClient)||void 0===a||a.recordHistogram("autocapturePlugin.getHierarchy",E-s),c},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?u.getText(t):u.getNearestLabel(n)},this.getElementPath=function(e){var t;if(!e)return"";var n=performance.now(),r=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=Ue(r,Boolean(t),r===e);if(!i)break;if(n.push(i),i.optimized)break;r=r.parentElement}return n.reverse(),n.join(" > ")}(e),i=performance.now();return null===(t=u.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.getEventProperties=function(e,t,n){var r,i,l,a,c,s,d=null===(l=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===l?void 0:l.call(i),v="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},f=u.getHierarchy(t),p=null===(a=f[0])||void 0===a?void 0:a.attrs,h=u.getNearestLabel(t),g=(c=null!=p?p:{},s=n,Object.entries(c).reduce(function(e,t){var n=o(t,2),r=n[0],i=n[1];if(r.startsWith(s)){var l=r.replace(s,"");l&&(e[l]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=f,r[ie]=d,r[oe]=u.getText(t),r["[Amplitude] Element Position Left"]=null==v.left?null:Math.round(v.left),r["[Amplitude] Element Position Top"]=null==v.top?null:Math.round(v.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Path"]=u.getElementPath(t),r["[Amplitude] Element Parent Label"]=h,r[le]=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n}(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(x)?T:e?e(document.title):document.title}(u.replaceSensitiveString),r[ae]=window.innerHeight,r[ue]=window.innerWidth,r),b=me();if(b&&(m[ce]=b),m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement){var y=t.href.substring(0,128);m["[Amplitude] Element Href"]=u.replaceSensitiveString(y)}return ge(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=u.addTypeAndTimestamp(e,t);if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){if(i&&ve(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=u.getEventProperties(o.type,o.closestTrackedAncestor,r),o;var l=be(o.event.target,n);return l&&(o.closestTrackedAncestor=l,o.targetElementProperties=u.getEventProperties(o.type,l,r)),o}return o},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?u.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(x,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var o="",l=Array.from(e.childNodes);try{for(var a=i(l),c=a.next();!c.done;c=a.next()){var s=c.value;s.nodeType!==Node.TEXT_NODE?s instanceof Element&&(s.hasAttribute(x)||s.hasAttribute("contenteditable")?o+=T:o+=u.getTextWithMaskedDescendants(s)):o+=s.textContent||""}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},this.getText=function(e){if(null!==e.closest("[".concat(x,"]")))return T;var t="";return t=e.querySelector("[".concat(x,"], [contenteditable]"))?u.getTextWithMaskedDescendants(e):e.innerText||"",u.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=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={})[ie]=i,t[oe]=u.getText(e),t[le]=window.location.href.split("?")[0],t);return ge(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var c=null!==(a=e.maskTextRegex)&&void 0!==a?a:[],s=[];try{for(var d=i(c),v=d.next();!v.done;v=d.next()){var f=v.value;if(s.length>=25)break;if(f instanceof RegExp)s.push(f);else if("pattern"in f&&"string"==typeof f.pattern)try{s.push(new RegExp(f.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=s};!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(He||(He={}));var Xe=function(e,u){var c,s,d,v,f,p,b,y,w,E,x,T;void 0===e&&(e={}),null==u||u.diagnosticsClient.setTag("plugin.autocapture.version",ne);var A=e.dataAttributePrefix,k=void 0===A?g:A,O=e.visualTaggingOptions,S=void 0===O?{enabled:!0}:O;e.cssSelectorAllowlist=null!==(c=e.cssSelectorAllowlist)&&void 0!==c?c:h,e.actionClickAllowlist=null!==(s=e.actionClickAllowlist)&&void 0!==s?s:m,e.debounceTime=null!==(d=e.debounceTime)&&void 0!==d?d:0;var C=!1!==(null===(v=e.viewportContentUpdated)||void 0===v?void 0:v.enabled),P=null!==(b=null!==(p=null===(f=e.viewportContentUpdated)||void 0===f?void 0:f.exposureDuration)&&void 0!==p?p:e.exposureDuration)&&void 0!==b?b:150;e.viewportContentUpdated=t(t({},e.viewportContentUpdated),{exposureDuration:P}),e.pageUrlExcludelist=null===(y=e.pageUrlExcludelist)||void 0===y?void 0:y.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var M,_="@amplitude/plugin-autocapture-browser",L=[],N=new qe(e,u),D=new Set,I=new Set,R=function(){var t,n,r=F(Ae().map(function(t){return N.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,k)})),i=F(new G(function(t){var n,r=function(n){var r=N.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,k);t.next(r)};return null===(n=a())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=a())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=F(new G(function(t){var n=function(n){var r=N.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,k);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=F(Te().map(function(t){return N.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,k)})),l=new G(function(e){var t,n=function(t){e.next(t)};return null===(t=a())||void 0===t||t.addEventListener("scroll",n),function(){var e;null===(e=a())||void 0===e||e.removeEventListener("scroll",n)}}),u=function(e,t){return new G(function(n){var r,i=a();if(!(null==i?void 0:i.IntersectionObserver))return function(){};var o=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:"0px",threshold:1}),l=t.join(",");(null!==(r=null==i?void 0:i.document.querySelectorAll(l))&&void 0!==r?r:[]).forEach(function(e){o.observe(e)});var u=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){e instanceof Element&&(e.matches(l)&&o.observe(e),e.querySelectorAll(l).forEach(function(e){o.observe(e)}))})})});return function(){u.unsubscribe(),o.disconnect()}})}(o,e.cssSelectorAllowlist);return(t={})[He.ChangeObservable]=i,t[He.ClickObservable]=r,t[He.MutationObservable]=o,t[He.NavigateObservable]=n,t[He.ScrollObservable]=l,t[He.ExposureObservable]=u,t},H=Ce(Object.values(null!==(E=null===(w=e.pageActions)||void 0===w?void 0:w.labeledEvents)&&void 0!==E?E:{})),j=Pe(null!==(T=null===(x=e.pageActions)||void 0===x?void 0:x.triggers)&&void 0!==T?T:[]),U=function(e,t,n,r){return new _e(e,t,n,r)}(H,j,N,e);return{name:_,type:"enrichment",setup:function(i,u){return n(void 0,void 0,void 0,function(){var n,c,s,d,v,f,p,h,g,m,b,y,w,E,x,T,A,O,q,X,Y;return r(this,function(r){return"undefined"==typeof document||(n=!1,c={maxX:void 0,maxY:void 0},i.fetchRemoteConfig&&(i.remoteConfigClient?i.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(n){!function(n){var r,i;n&&(e.pageActions=t(t({},e.pageActions),n),H=Ce(Object.values(null!==(r=e.pageActions.labeledEvents)&&void 0!==r?r:{})),j=Pe(null!==(i=e.pageActions.triggers)&&void 0!==i?i:[]),U.update(H,j,e))}(n)}):i.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),s=pe(e,e.cssSelectorAllowlist),d=pe(e,e.actionClickAllowlist),v=R(),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(ye).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(re,e.targetElementProperties)})}({allObservables:v,amplitude:u,shouldTrackEvent:s,evaluateTriggers:U.evaluate.bind(U)}),L.push(f),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(ye).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:v,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return N.getEventProperties.apply(N,l(l([],o(e),!1),[k],!1))},amplitude:u,shouldTrackEvent:s,evaluateTriggers:U.evaluate.bind(U)}),L.push(p),h=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,l=e.shouldTrackActionClick,a=n.clickObservable,u=n.mutationObservable,c=n.navigateObservable,s=a.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=be(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(ye).filter(function(e){return l("click",e.closestTrackedAncestor)}),d=c?B(u,c):u,v=B(s,d),f=null,p=null;return z(v,function(e){if(f&&(clearTimeout(f),f=null),"click"===e.type)return p=e,f=setTimeout(function(){f=null,p=null},500),Promise.resolve(null);if(p){var t=p;return p=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(re,i("click",e.closestTrackedAncestor)))})}({allObservables:v,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return N.getEventProperties.apply(N,l(l([],o(e),!1),[k],!1))},amplitude:u,shouldTrackEvent:s,shouldTrackActionClick:d}),h&&L.push(h),g=function(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0},r=t.subscribe(function(){var e,t,r,i,o=a(),l=Math.floor(null!==(t=null!==(e=null==o?void 0:o.scrollX)&&void 0!==e?e:null==o?void 0:o.pageXOffset)&&void 0!==t?t:0),u=Math.floor(null!==(i=null!==(r=null==o?void 0:o.scrollY)&&void 0!==r?r:null==o?void 0:o.pageYOffset)&&void 0!==i?i:0);n.maxX=Math.max(n.maxX,l),n.maxY=Math.max(n.maxY,u)});return{unsubscribe:function(){r.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0}}}({allObservables:v,amplitude:u}),L.push(g),m={},b=a(),y=function(e){e&&n||(setTimeout(function(){n=!1},100),n=!0,function(e){var t,n,r,i,o=e.amplitude,l=e.scrollTracker,u=e.currentElementExposed,c=e.elementExposedForPage,s=e.exposureTracker,d=e.isPageEnd,v=e.lastScroll,f=l.getState(),p=a(),h=null!==(n=null==p?void 0:p.innerWidth)&&void 0!==n?n:0,g=null!==(r=null==p?void 0:p.innerHeight)&&void 0!==r?r:0,m=((t={})[le]=null===(i=null==p?void 0:p.location)||void 0===i?void 0:i.href,t["[Amplitude] Max Page X"]=f.maxX+h,t["[Amplitude] Max Page Y"]=f.maxY+g,t[ae]=g,t[ue]=h,t["[Amplitude] Element Exposed"]=Array.from(u),t),b=me();b&&(m[ce]=b),0!==u.size||f.maxX!==v.maxX||f.maxY!==v.maxY?(null==o||o.track("[Amplitude] Viewport Content Updated",m),v.maxX=f.maxX,v.maxY=f.maxY,u.clear(),d&&(l.reset(),c.clear(),null==s||s.reset())):d&&(l.reset(),c.clear(),null==s||s.reset())}({amplitude:u,scrollTracker:g,currentElementExposed:I,elementExposedForPage:D,exposureTracker:m.exposure,isPageEnd:e,lastScroll:c}))},w=function(e){!function(e,t,n,r){if(!t.has(e)){t.add(e),n.add(e);var i=Array.from(n);JSON.stringify(i).length>=18e3&&r(!1)}}(e,D,I,y)},C&&(m.exposure=function(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,o=void 0===i?150:i,l=new Map,a=new Map,u=t.exposureObservable.subscribe(function(e){var t=e,i=t.target;if(t.isIntersecting){if(!l.get(i)){var u=setTimeout(function(){l.set(i,!0);var e=r.getElementPath(i);n(e),a.set(i,null)},o);a.set(i,u)}}else!t.isIntersecting&&t.intersectionRatio<1&&(u=a.get(i))&&(clearTimeout(u),a.set(i,null))});return{unsubscribe:function(){u.unsubscribe()},reset:function(){a.forEach(function(e){e&&clearTimeout(e)}),a.clear(),l.clear()}}}({allObservables:v,onExposure:w,dataExtractor:N,exposureDuration:P}),m.exposure&&L.push(m.exposure),E=function(){y(!0)},null==b||b.addEventListener("beforeunload",E),M=function(){null==b||b.removeEventListener("beforeunload",E)},L.push({unsubscribe:function(){return M()}}),(x=v[He.NavigateObservable])?L.push(x.subscribe(function(){y(!0)})):b&&(T=function(){y(!0)},b.addEventListener("popstate",T),A=b.history.pushState,b.history&&A&&(b.history.pushState=new Proxy(A,{apply:function(e,t,n){var r=o(n,3),i=r[0],l=r[1],a=r[2];e.apply(t,[i,l,a]),y(!0)}})),L.push({unsubscribe:function(){b.removeEventListener("popstate",T),b.history&&A&&(b.history.pushState=A)}}))),null===(Y=null==i?void 0:i.loggerProvider)||void 0===Y||Y.log("".concat(_," has been successfully added.")),window.opener&&S.enabled&&(O=e.cssSelectorAllowlist,q=e.actionClickAllowlist,Ee(X=Q(),{dataExtractor:N,isElementSelectable:pe(e,l(l([],o(O),!1),o(q),!1)),cssSelectorAllowlist:O,actionClickAllowlist:q}),function(e,t){var n,r=e;if(!0!==r[ee]){r[ee]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.3.js.gz",o=null,l=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(){var t,n;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Initializing background capture (external script)");var r=new URL(i,e.endpoint).toString();e.loadScriptOnce(r).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),o=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,{messenger:e,onBackgroundCapture:l}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==o?void 0:o.close)||void 0===e||e.call(o),o=null})}}(X),X.setup(t({logger:null==i?void 0:i.loggerProvider},(null==i?void 0:i.serverZone)&&{endpoint:J[i.serverZone]})))),[2]})})},execute:function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){return[2,e]})})},teardown:function(){return n(void 0,void 0,void 0,function(){var e,t,n,o;return r(this,function(r){try{for(e=i(L),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(n)throw n.error}}return[2]})})}}},Ye=["mutation","navigate"];function Ge(e,t){var n,r,i,o,l=t.event,a=l.pageX,u=l.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:a,a),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function ze(e){if(0===e.length)return null;var n=e[0],r=e[e.length-1];return{rageClickEvent:t({"[Amplitude] Begin Time":new Date(n.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-n.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},n.targetElementProperties),time:n.timestamp}}function Be(e){var t=this,i=e.amplitude,o=e.allObservables,l=e.shouldTrackRageClick,a=o.clickObservable,u=o.selectionObservable,c=[],s={},d=null;function v(e){c=[],s={},e&&(Ge(s,e),c.push(e))}var f=z(a.filter(function(e){return l("click",e.closestTrackedAncestor)}),function(e){return n(t,void 0,void 0,function(){var t;return r(this,function(n){return Ge(s,e),t=null,0===c.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(c,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(c,e)||s.isOutOfBounds?(d&&(t=ze(c)),v(e)):c.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),c.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(ze(c))},1e3)}})]:[2,null]})})}),p=null==u?void 0:u.subscribe(function(){v()}),h=f.subscribe(function(e){null!==e&&i.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==p||p.unsubscribe()}}}var Fe,Ve;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(Fe||(Fe={})),function(e){e.X="x",e.Y="y"}(Ve||(Ve={}));function We(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function Je(e){e.changes=[],e.startTime=void 0}function Ke(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var Ze=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new G(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},l=void 0,a=null;function u(){void 0!==l&&(e.next(l),l=void 0,null!==a&&clearTimeout(a),Je(n),Je(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),function(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}(e===Ve.X?n:i);var t=function(e,t){var n=void 0;if(We(e)&&(n=e.startTime),We(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(l=l||t,a=setTimeout(function(){u(),a=null},o)):u(),Ke(n),Ke(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},$e=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=void 0===i?20:i,l=e.thresholdMs,a=void 0===l?2e3:l,u=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new G(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===Fe.DECREASING&&e.next(Ve.X),r=Fe.INCREASING):o.x<n.x&&(r===Fe.INCREASING&&e.next(Ve.X),r=Fe.DECREASING),o.y>n.y?(i===Fe.DECREASING&&e.next(Ve.Y),i=Fe.INCREASING):o.y<n.y&&(i===Fe.INCREASING&&e.next(Ve.Y),i=Fe.DECREASING),n=o):n=o})})}({allWindowObservables:r});return Ze({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:a}).subscribe(function(e){fe(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function Qe(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var et=4e3;return e.DataExtractor=qe,e.autocapturePlugin=Xe,e.enableVisualTagging=Ee,e.frustrationPlugin=function(e){var a;void 0===e&&(e={});var u="@amplitude/plugin-frustration-browser",c=[],s=!1!==e.errorClicks;e.errorClicks||(s=!1);var d=!1!==e.deadClicks&&null!==e.deadClicks,v=!1!==e.rageClicks&&null!==e.rageClicks,f=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(f=!1);var p=Qe(e,"rageClicks",E,v),h=Qe(e,"deadClicks",y,d),m=Qe(e,"errorClicks",w,s),b=null!==(a=e.dataAttributePrefix)&&void 0!==a?a:g,x=new qe(e),T=l([],o(new Set(l(l(l([],o(p),!1),o(h),!1),o(m),!1))),!1),A=function(){var e,n,r=F(Ae("pointerdown").map(function(e){return x.addAdditionalEventProperties(e,"click",T,b,!0)})),i=F(ke().map(function(e){return x.addTypeAndTimestamp(e,"error")})),o=F(Te().map(function(e){return x.addAdditionalEventProperties(e,"mutation",T,b)}));window.navigation&&(n=F(new G(function(e){var n=function(n){e.next(t(t({},n),{type:"navigate"}))};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}}).map(function(e){return x.addAdditionalEventProperties(e,"navigate",T,b)})));var l=F(new G(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),a=F(new G(function(e){var t=function(t){e.next(t)},n={capture:!0};return xe.document.addEventListener("mousemove",t,n),function(){xe.document.removeEventListener("mousemove",t,n)}}));return(e={})[He.ClickObservable]=r,e[He.MutationObservable]=o,e[He.NavigateObservable]=n,e[He.BrowserErrorObservable]=i,e[He.SelectionObservable]=l,e[He.MouseMoveObservable]=a,e};return{name:u,type:"enrichment",setup:function(i,o){return n(void 0,void 0,void 0,function(){var n,l,a,g,y,w,E,T,k,O,S;return r(this,function(r){return"undefined"==typeof document||(n=A(),v&&(l=pe(e,p),a=Be({allObservables:n,amplitude:o,shouldTrackRageClick:l}),c.push(a)),d&&(g=pe(e,h),y=function(e){var n=e.amplitude,r=e.allObservables,i=e.getEventProperties,o=e.shouldTrackDeadClick,l=r.clickObservable,a=r.mutationObservable,u=r.navigateObservable,c=l.filter(function(e){return ye(e)&&o("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===te.LEFT_OR_TOUCH_CONTACT}),s=u?B(a,u):a,d=B(c,s),v=null;return z(d,function(e){return v&&Ye.includes(e.type)?(clearTimeout(v),v=null,Promise.resolve(null)):"click"===e.type?v?Promise.resolve(null):new Promise(function(t){v=setTimeout(function(){t(e),v=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var r={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};n.track("[Amplitude] Dead Click",t(t({},i("click",e.closestTrackedAncestor)),r),{time:e.timestamp})}})}({amplitude:o,allObservables:n,getEventProperties:function(e,t){return x.getEventProperties(e,t,b)},shouldTrackDeadClick:g}),c.push(y)),s&&(w=pe(e,m),E=function(e){var n=e.amplitude,r=e.allObservables,i=e.shouldTrackErrorClick,o=r.clickObservable,l=r.browserErrorObservable,a=o.filter(function(e){return ye(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===te.LEFT_OR_TOUCH_CONTACT}),u=null,c=null,s=function(){null!==u&&(clearTimeout(u),u=null),c=null};return B(a,l).subscribe(function(e){var r;if("click"===e.type)return s(),c=e,void(u=setTimeout(s,2e3));"error"===e.type&&c&&(n.track("[Amplitude] Error Click",t(((r={})["[Amplitude] Kind"]=e.event.kind,r["[Amplitude] Message"]=e.event.message,r["[Amplitude] Stack"]=e.event.stack,r["[Amplitude] Filename"]=e.event.filename,r["[Amplitude] Line Number"]=e.event.lineNumber,r["[Amplitude] Column Number"]=e.event.columnNumber,r),c.targetElementProperties)),s())})}({amplitude:o,allObservables:n,shouldTrackErrorClick:w}),c.push(E)),f&&(T=void 0,k=void 0,"object"==typeof e.thrashedCursor&&(T=e.thrashedCursor.directionChanges,k=e.thrashedCursor.threshold,T&&T<5&&(i.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(T," is below the minimum of ").concat(5,", setting to ").concat(5)),T=5),k&&k>et&&(i.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(k," is above the maximum of ").concat(et,", setting to ").concat(et)),k=et)),O=$e({amplitude:o,options:e,allObservables:n,directionChanges:T,thresholdMs:k}),c.push(O)),null===(S=null==i?void 0:i.loggerProvider)||void 0===S||S.log("".concat(u," has been successfully added."))),[2]})})},execute:function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){return[2,e]})})},teardown:function(){return n(void 0,void 0,void 0,function(){var e,t,n,o;return r(this,function(r){try{for(e=i(c),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(n)throw n.error}}return[2]})})}}},e.plugin=Xe,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
1
+ var amplitudeAutocapturePlugin=function(e){"use strict";var t=function(){return t=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},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,l)}u((r=r.apply(e,t||[])).next())})}function r(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(u){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,u])}}}function i(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 o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.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 a}function a(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"==typeof SuppressedError&&SuppressedError;var l=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},u=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},c=l(),s=null==c?void 0:c.console,d={},v={},f=!1;var p={addListener:function(e,t){var n,r=(n=e,!!s&&"function"==typeof s[n]&&(v[n]||(v[n]=s[n],s[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(d[n]&&!f){f=!0;var r=d[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return f=!1,v[n].apply(s,e)}),!0));if(!r)return new Error("Console override failed");d[e]?d[e].push(t):d[e]=[t]},removeListener:function(e){var t,n;try{for(var r=i(Object.values(d)),o=r.next();!o.done;o=r.next())for(var a=o.value,l=a.length-1;l>=0;l--)if(a[l]===e){a.splice(l,1);break}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=i(Object.entries(v)),r=n.next();!r.done;r=n.next()){var a=o(r.value,2),l=a[0],u=a[1];u&&(s[l]=u)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}v={},d={}}},h=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],m="data-amp-track-",g=["div","span","h1","h2","h3","h4","h5","h6"],b=a(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],o(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),y=b,w=b,E=["*"],T="data-amp-mask",x="*****",k=/\b(?:\d[ -]*?){13,16}\b/,A=/(\d{3}-?\d{2}-?\d{4})/g,S=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,O={};Object.defineProperty(O,"__esModule",{value:!0}),O.Observable=void 0;const C=e=>Boolean(Symbol[e]),M=e=>C(e)?Symbol[e]:"@@"+e,P=M("iterator"),_=M("observable"),L=M("species");function N(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function D(e){let t=e.constructor;return void 0!==t&&(t=t[L],null===t&&(t=void 0)),void 0!==t?t:X}function I(e){I.log?I.log(e):setTimeout(()=>{throw e})}function R(e){Promise.resolve().then(()=>{try{e()}catch(e){I(e)}})}function B(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=N(t,"unsubscribe");e&&e.call(t)}}catch(e){I(e)}}function j(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function H(e,t,n){e._state="running";let r=e._observer;try{let i=N(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(j(e),!i)throw n;i.call(r,n);break;case"complete":j(e),i&&i.call(r)}}catch(e){I(e)}"closed"===e._state?B(e):"running"===e._state&&(e._state="ready")}function U(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void R(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(H(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void H(e,t,n);e._queue.push({type:t,value:n})}}class q{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){U(n,"next",e)},error(e){U(n,"error",e)},complete(){U(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(j(this),B(this))}}class X{constructor(e){if(!(this instanceof X))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new q(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(D(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(D(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=D(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let a=!r;if(r=!0,!a||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=D(this);return new t(n=>{let r,i=0;return function o(a){r=a.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=D(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let a=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(a);e>=0&&r.splice(e,1),o()}});r.push(a)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[_](){return this}static from(e){let t="function"==typeof this?this:X;if(null==e)throw new TypeError(e+" is not an object");let n=N(e,_);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof X}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(C("iterator")&&(n=N(e,P),n))return new t(t=>{R(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{R(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:X)(t=>{R(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[L](){return this}}O.Observable=X,Object.defineProperty(X,Symbol("extensions"),{value:{symbol:_,hostReportError:I},configurable:!0});var Y=O.Observable;function G(e,t){return new Y(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function z(e,t){return new Y(function(n){var r=!1,o=new Set,a=function(){var e,t;r=!0;try{for(var n=i(o),a=n.next();!a.done;a=n.next()){var l=a.value;try{l.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}o.clear()},l=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),a())},complete:function(){o.delete(t),r||0!==o.size||(n.complete(),a(),r=!0)}});o.add(t)};return l(e),l(t),a})}function F(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new Y(function(o){return t.add(o),null===n&&(n=e.subscribe({next:function(e){var n,r,o;try{for(var a=i(t),l=a.next();!l.done;l=a.next()){var u=l.value;null===(o=u.next)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}},error:function(e){var n,o,a;try{for(var l=i(t),u=l.next();!u.done;u=l.next()){var c=u.value;null===(a=c.error)||void 0===a||a.call(c,e)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,o;try{for(var a=i(t),l=a.next();!l.done;l=a.next()){var u=l.value;null===(o=u.complete)||void 0===o||o.call(u)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}r()}})),function(){t.delete(o),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var V,W="https://app.amplitude.com",J={US:W,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var K="__AMPLITUDE_MESSENGER_INSTANCE__",Z="__AMPLITUDE_MESSENGER__",$=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?W:t;this[V]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,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,a){r.requestCallbacks[i]={resolve:t,reject:a},r.notify(o),n.timeout>0&&setTimeout(function(){a(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.registerActionHandler=function(e,t){var n,r,o,a;this.actionHandlers.has(e)&&(null===(a=null===(o=this.logger)||void 0===o?void 0:o.warn)||void 0===a||a.call(o,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var l=this.pendingMessages.get(e);if(l){this.pendingMessages.delete(e);try{for(var u=i(l),c=u.next();!c.done;c=u.next()){t(c.value)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return n(this,void 0,void 0,function(){var t,n,i;return r(this,function(r){switch(r.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,n];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.scriptLoadPromises.delete(e),i;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,a=i.endpoint;o&&(this.logger=o),a&&this.endpoint===W&&(this.endpoint=a),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,a;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var l=e.data,u=null==l?void 0:l.action;if(u)if("id"in l&&l.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(l);else{if("ping"===u)return void r.notify({action:"pong"});var c=r.actionHandlers.get(u);if(c)c(l.data);else{var s=null!==(a=r.pendingMessages.get(u))&&void 0!==a?a:[];s.push(l.data),r.pendingMessages.set(u,s)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=l();(null==e?void 0:e[Z])===this&&delete e[Z]},e}();function Q(e){var t,n=l(),r=null==n?void 0:n[Z];if("object"==typeof(t=r)&&null!==t&&K in t&&!0===t[K])return r;var i=new $(e);return n&&(n[Z]=i),i}V=K;var ee="__AMPLITUDE_BACKGROUND_CAPTURE__";var te,ne="1.26.0",re="[Amplitude] Element Clicked",ie="[Amplitude] Element Tag",oe="[Amplitude] Element Text",ae="[Amplitude] Page URL",le="[Amplitude] Viewport Height",ue="[Amplitude] Viewport Width",ce="[Amplitude] Page View ID",se="data-amp-mask-attributes",de=["input","select","textarea"],ve=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},fe=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&u(window.location.href,n))&&!!u(window.location.href,t)},pe=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,a,l=e.shouldTrackEventResolver,u=null===(a=null===(o=null==i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===a?void 0:a.call(o);if(!u)return!1;if(l)return l(r,i);if(!fe(e))return!1;var c=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}var s=ve(i,r);if(n&&s)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(u){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!s||"click"===r}}},he=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},me=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},{})},ge=function(){var e;try{var t=l(),n=null===(e=null==t?void 0:t.sessionStorage)||void 0===e?void 0:e.getItem("AMP_PAGE_VIEW");if(!n)return;var r=JSON.parse(n);if("string"==typeof r.pageViewId)return r.pageViewId}catch(e){}},be=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:be(null==e?void 0:e.parentElement,t):null},ye=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(te||(te={}));var we="__AMPLITUDE_VISUAL_TAGGING__";function Ee(e,t){var n=e;if(!0!==n[we]){n[we]=!0;var r=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,a=t.actionClickAllowlist,l=null,u=function(t){e.notify({action:"element-selected",data:t})},c=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var n;l=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:c,onSelect:u,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:a,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:ne}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==l?void 0:l.close)||void 0===e||e.call(l)})}}var Te=l(),xe=function(){return new Y(function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},ke=function(e){return void 0===e&&(e="click"),new Y(function(t){var n,r=function(e){t.next(e)};return null===(n=l())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=l())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}})},Ae=function(){var e=z(new Y(function(e){var n=function(n){if(n instanceof ErrorEvent){var r={kind:"error"};n.error instanceof Error||n.error instanceof DOMException?r=t(t({},r),{message:n.error.message,stack:n.error.stack,filename:n.filename,lineNumber:n.lineno,columnNumber:n.colno}):"string"==typeof n.error&&(r.message=n.error),e.next(r)}};return Te.addEventListener("error",n),function(){Te.removeEventListener("error",n)}}),new Y(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return Te.addEventListener("unhandledrejection",t),function(){Te.removeEventListener("unhandledrejection",t)}}));return z(e,new Y(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return p.addListener("error",t),function(){p.removeListener(t)}}))},Se=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}})},Oe={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Ce=function(e){var t,n,r,o,a=Object.values(Oe).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return a;try{for(var l=i(e),u=l.next();!u.done;u=l.next()){var c=u.value;try{try{for(var s=(r=void 0,i(c.definition)),d=s.next();!d.done;d=s.next()){var v=d.value,f=Oe[v.event_type];f&&a[f].add(c.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==c?void 0:c.id,e)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return a},Me=function(e){var t,n,r,o,a=new Map;try{for(var l=i(e),u=l.next();!u.done;u=l.next()){var c=u.value;try{for(var s=(r=void 0,i(c.conditions)),d=s.next();!d.done;d=s.next()){var v=d.value;if("LABELED_EVENT"===v.type){var f=v.match.eventId,p=a.get(f);p||(p=[],a.set(f,p)),p.push(c)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return a},Pe=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return Oe[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)})})})},_e=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 o=function(e,t){var n,r,o,a,l=new Set;try{for(var u=i(e),c=u.next();!c.done;c=u.next()){var s=c.value,d=t.get(s.id);if(d)try{for(var v=(o=void 0,i(d)),f=v.next();!f.done;f=v.next()){var p=f.value;l.add(p)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(a=v.return)&&a.call(v)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return Array.from(l)}(Pe(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var a=i(o),l=a.next();!l.done;l=a.next()){var u=l.value;Se(u.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}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}(),Le=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",se,T]),Ne=["type"],De=["svg","path","g"],Ie=["password","hidden"];function Re(e,t){var n,r,o,a,l,u;if(null===e)return null;var c=String(e.tagName).toLowerCase(),s={tag:c},d=Array.from(null!==(a=null===(o=e.parentElement)||void 0===o?void 0:o.children)&&void 0!==a?a:[]);d.length&&(s.index=d.indexOf(e),s.indexOfType=d.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var v=null===(u=null===(l=e.previousElementSibling)||void 0===l?void 0:l.tagName)||void 0===u?void 0:u.toLowerCase();v&&(s.prevSib=String(v));var f=e.getAttribute("id");f&&(s.id=String(f));var p=Array.from(e.classList);p.length&&(s.classes=p);var h={},m=Array.from(e.attributes).filter(function(e){return!Le.has(e.name)}),g=!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!de.includes(i)&&!o}(e);if(!Ie.includes(String(e.getAttribute("type")))&&!De.includes(c))try{for(var b=i(m),y=b.next();!y.done;y=b.next()){var w=y.value;g&&!Ne.includes(w.name)||(t.has(w.name)?h[w.name]=x:h[w.name]=String(w.value).substring(0,128))}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=b.return)&&r.call(b)}finally{if(n)throw n.error}}return Object.keys(h).length&&(s.attrs=h),s}var Be,je=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),He=function(e,t,n){var r,o;if(e.nodeType!==Node.ELEMENT_NODE)return null;var a=e.getAttribute("id");if(t){if(a)return new je(d(a),!0);var l=e.tagName.toLowerCase();if("body"===l||"head"===l||"html"===l)return new je(l,!0)}var u=e.tagName.toLowerCase();if(a)return new je(u+d(a),!0);var c=e.parentNode;if(!c||c.nodeType===Node.DOCUMENT_NODE)return new je(u,!0);function s(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]}function d(e){return"#"+CSS.escape(e)}for(var v=s(e),f=!1,p=!1,h=-1,m=-1,g=c.children,b=0;g&&(-1===h||!p)&&b<g.length;++b){var y=g[b];if(y.nodeType===Node.ELEMENT_NODE)if(m+=1,y!==e){if(!p&&y.tagName.toLowerCase()===u){f=!0;var w=new Set(v);if(w.size)for(var E=s(y),T=0;T<E.length;++T){var x=E[T];if(w.has(x)&&(w.delete(x),!w.size)){p=!0;break}}else p=!0}}else h=m}var k=u;if(n&&"input"===u.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(k+="[type="+CSS.escape(e.getAttribute("type")||"")+"]"),p)k+=":nth-child("+String(h+1)+")";else if(f)try{for(var A=i(v),S=A.next();!S.done;S=A.next()){var O=S.value;k+="."+CSS.escape(O.slice(1))}}catch(e){r={error:e}}finally{try{S&&!S.done&&(o=A.return)&&o.call(A)}finally{if(r)throw r.error}}return new je(k,!1)},Ue=function(e,t){var n,r,l,u=this;this.replaceSensitiveString=function(e){return function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var o=e;o=(o=(o=o.replace(k,x)).replace(A,x)).replace(S,x);try{for(var a=i(t),l=a.next();!l.done;l=a.next()){var u=l.value;try{o=o.replace(u,x)}catch(e){}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}(e,u.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,l,c,s=performance.now();if(!e)return[];for(var d=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),v=new Map,f=d.length-1;f>=0;f--){var p=d[f];if(p){var h=he(p.getAttribute(se)),m=f===d.length-1?[]:null!==(r=v.get(d[f+1]))&&void 0!==r?r:new Set,g=new Set(a(a([],o(m),!1),o(h),!1));v.set(p,g)}}c=d.map(function(e){var t;return Re(e,null!==(t=v.get(e))&&void 0!==t?t:new Set)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=o(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=u.replaceSensitiveString(i))})};try{for(var y=i(c),w=y.next();!w.done;w=y.next())b(w.value)}catch(e){t={error:e}}finally{try{w&&!w.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}var E=performance.now();return null===(l=u.diagnosticsClient)||void 0===l||l.recordHistogram("autocapturePlugin.getHierarchy",E-s),c},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?u.getText(t):u.getNearestLabel(n)},this.getElementPath=function(e){var t;if(!e)return"";var n=performance.now(),r=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=He(r,Boolean(t),r===e);if(!i)break;if(n.push(i),i.optimized)break;r=r.parentElement}return n.reverse(),n.join(" > ")}(e),i=performance.now();return null===(t=u.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.getEventProperties=function(e,t,n){var r,i,a,l,c,s,d=null===(a=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===a?void 0:a.call(i),v="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},f=u.getHierarchy(t),p=null===(l=f[0])||void 0===l?void 0:l.attrs,h=u.getNearestLabel(t),m=(c=null!=p?p:{},s=n,Object.entries(c).reduce(function(e,t){var n=o(t,2),r=n[0],i=n[1];if(r.startsWith(s)){var a=r.replace(s,"");a&&(e[a]=i||"")}return e},{})),g=((r={})["[Amplitude] Element Hierarchy"]=f,r[ie]=d,r[oe]=u.getText(t),r["[Amplitude] Element Position Left"]=null==v.left?null:Math.round(v.left),r["[Amplitude] Element Position Top"]=null==v.top?null:Math.round(v.top),r["[Amplitude] Element Attributes"]=m,r["[Amplitude] Element Path"]=u.getElementPath(t),r["[Amplitude] Element Parent Label"]=h,r[ae]=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n}(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(T)?x:e?e(document.title):document.title}(u.replaceSensitiveString),r[le]=window.innerHeight,r[ue]=window.innerWidth,r),b=ge();if(b&&(g[ce]=b),g["[Amplitude] Element ID"]=t.getAttribute("id")||"",g["[Amplitude] Element Class"]=t.getAttribute("class"),g["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement){var y=t.href.substring(0,128);g["[Amplitude] Element Href"]=u.replaceSensitiveString(y)}return me(g)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=u.addTypeAndTimestamp(e,t);if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){if(i&&ve(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=u.getEventProperties(o.type,o.closestTrackedAncestor,r),o;var a=be(o.event.target,n);return a&&(o.closestTrackedAncestor=a,o.targetElementProperties=u.getEventProperties(o.type,a,r)),o}return o},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?u.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(T,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var o="",a=Array.from(e.childNodes);try{for(var l=i(a),c=l.next();!c.done;c=l.next()){var s=c.value;s.nodeType!==Node.TEXT_NODE?s instanceof Element&&(s.hasAttribute(T)||s.hasAttribute("contenteditable")?o+=x:o+=u.getTextWithMaskedDescendants(s)):o+=s.textContent||""}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return o},this.getText=function(e){if(null!==e.closest("[".concat(T,"]")))return x;var t="";return t=e.querySelector("[".concat(T,"], [contenteditable]"))?u.getTextWithMaskedDescendants(e):e.innerText||"",u.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=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={})[ie]=i,t[oe]=u.getText(e),t[ae]=window.location.href.split("?")[0],t);return me(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var c=null!==(l=e.maskTextRegex)&&void 0!==l?l:[],s=[];try{for(var d=i(c),v=d.next();!v.done;v=d.next()){var f=v.value;if(s.length>=25)break;if(f instanceof RegExp)s.push(f);else if("pattern"in f&&"string"==typeof f.pattern)try{s.push(new RegExp(f.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=s};!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(Be||(Be={}));var qe=function(e,u){var c,s,d,v,f,p,b,y,w,E,T,x;void 0===e&&(e={}),null==u||u.diagnosticsClient.setTag("plugin.autocapture.version",ne);var k=e.dataAttributePrefix,A=void 0===k?m:k,S=e.visualTaggingOptions,O=void 0===S?{enabled:!0}:S;e.cssSelectorAllowlist=null!==(c=e.cssSelectorAllowlist)&&void 0!==c?c:h,e.actionClickAllowlist=null!==(s=e.actionClickAllowlist)&&void 0!==s?s:g,e.debounceTime=null!==(d=e.debounceTime)&&void 0!==d?d:0;var C=!1!==(null===(v=e.viewportContentUpdated)||void 0===v?void 0:v.enabled),M=null!==(b=null!==(p=null===(f=e.viewportContentUpdated)||void 0===f?void 0:f.exposureDuration)&&void 0!==p?p:e.exposureDuration)&&void 0!==b?b:150;e.viewportContentUpdated=t(t({},e.viewportContentUpdated),{exposureDuration:M}),e.pageUrlExcludelist=null===(y=e.pageUrlExcludelist)||void 0===y?void 0:y.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var P,_="@amplitude/plugin-autocapture-browser",L=[],N=new Ue(e,u),D=new Set,I=new Set,R=function(){var t,n,r=F(ke().map(function(t){return N.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,A)})),i=F(new Y(function(t){var n,r=function(n){var r=N.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,A);t.next(r)};return null===(n=l())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=l())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=F(new Y(function(t){var n=function(n){var r=N.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,A);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=F(xe().map(function(t){return N.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,A)})),a=new Y(function(e){var t,n=function(t){e.next(t)};return null===(t=l())||void 0===t||t.addEventListener("scroll",n),function(){var e;null===(e=l())||void 0===e||e.removeEventListener("scroll",n)}}),u=function(e,t){return new Y(function(n){var r,i=l();if(!(null==i?void 0:i.IntersectionObserver))return function(){};var o=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:"0px",threshold:1}),a=t.join(",");(null!==(r=null==i?void 0:i.document.querySelectorAll(a))&&void 0!==r?r:[]).forEach(function(e){o.observe(e)});var u=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){e instanceof Element&&(e.matches(a)&&o.observe(e),e.querySelectorAll(a).forEach(function(e){o.observe(e)}))})})});return function(){u.unsubscribe(),o.disconnect()}})}(o,e.cssSelectorAllowlist);return(t={})[Be.ChangeObservable]=i,t[Be.ClickObservable]=r,t[Be.MutationObservable]=o,t[Be.NavigateObservable]=n,t[Be.ScrollObservable]=a,t[Be.ExposureObservable]=u,t},B=Ce(Object.values(null!==(E=null===(w=e.pageActions)||void 0===w?void 0:w.labeledEvents)&&void 0!==E?E:{})),j=Me(null!==(x=null===(T=e.pageActions)||void 0===T?void 0:T.triggers)&&void 0!==x?x:[]),H=function(e,t,n,r){return new _e(e,t,n,r)}(B,j,N,e);return{name:_,type:"enrichment",setup:function(i,u){return n(void 0,void 0,void 0,function(){var n,c,s,d,v,f,p,h,m,g,b,y,w,E,T,x,k,S,U,q,X;return r(this,function(r){return"undefined"==typeof document||(n=!1,c={maxX:void 0,maxY:void 0},i.fetchRemoteConfig&&(i.remoteConfigClient?i.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(n){!function(n){var r,i;n&&(e.pageActions=t(t({},e.pageActions),n),B=Ce(Object.values(null!==(r=e.pageActions.labeledEvents)&&void 0!==r?r:{})),j=Me(null!==(i=e.pageActions.triggers)&&void 0!==i?i:[]),H.update(B,j,e))}(n)}):i.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),s=pe(e,e.cssSelectorAllowlist),d=pe(e,e.actionClickAllowlist),v=R(),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(ye).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(re,e.targetElementProperties)})}({allObservables:v,amplitude:u,shouldTrackEvent:s,evaluateTriggers:H.evaluate.bind(H)}),L.push(f),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(ye).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:v,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return N.getEventProperties.apply(N,a(a([],o(e),!1),[A],!1))},amplitude:u,shouldTrackEvent:s,evaluateTriggers:H.evaluate.bind(H)}),L.push(p),h=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,a=e.shouldTrackActionClick,l=n.clickObservable,u=n.mutationObservable,c=n.navigateObservable,s=l.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=be(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(ye).filter(function(e){return a("click",e.closestTrackedAncestor)}),d=c?z(u,c):u,v=z(s,d),f=null,p=null;return G(v,function(e){if(f&&(clearTimeout(f),f=null),"click"===e.type)return p=e,f=setTimeout(function(){f=null,p=null},500),Promise.resolve(null);if(p){var t=p;return p=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(re,i("click",e.closestTrackedAncestor)))})}({allObservables:v,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return N.getEventProperties.apply(N,a(a([],o(e),!1),[A],!1))},amplitude:u,shouldTrackEvent:s,shouldTrackActionClick:d}),h&&L.push(h),m=function(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0},r=t.subscribe(function(){var e,t,r,i,o=l(),a=Math.floor(null!==(t=null!==(e=null==o?void 0:o.scrollX)&&void 0!==e?e:null==o?void 0:o.pageXOffset)&&void 0!==t?t:0),u=Math.floor(null!==(i=null!==(r=null==o?void 0:o.scrollY)&&void 0!==r?r:null==o?void 0:o.pageYOffset)&&void 0!==i?i:0);n.maxX=Math.max(n.maxX,a),n.maxY=Math.max(n.maxY,u)});return{unsubscribe:function(){r.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0}}}({allObservables:v,amplitude:u}),L.push(m),g={},b=l(),y=function(e){e&&n||(setTimeout(function(){n=!1},100),n=!0,function(e){var t,n,r,i,o=e.amplitude,a=e.scrollTracker,u=e.currentElementExposed,c=e.elementExposedForPage,s=e.exposureTracker,d=e.isPageEnd,v=e.lastScroll,f=a.getState(),p=l(),h=null!==(n=null==p?void 0:p.innerWidth)&&void 0!==n?n:0,m=null!==(r=null==p?void 0:p.innerHeight)&&void 0!==r?r:0,g=((t={})[ae]=null===(i=null==p?void 0:p.location)||void 0===i?void 0:i.href,t["[Amplitude] Max Page X"]=f.maxX+h,t["[Amplitude] Max Page Y"]=f.maxY+m,t[le]=m,t[ue]=h,t["[Amplitude] Element Exposed"]=Array.from(u),t),b=ge();b&&(g[ce]=b),0!==u.size||f.maxX!==v.maxX||f.maxY!==v.maxY?(null==o||o.track("[Amplitude] Viewport Content Updated",g),v.maxX=f.maxX,v.maxY=f.maxY,u.clear(),d&&(a.reset(),c.clear(),null==s||s.reset())):d&&(a.reset(),c.clear(),null==s||s.reset())}({amplitude:u,scrollTracker:m,currentElementExposed:I,elementExposedForPage:D,exposureTracker:g.exposure,isPageEnd:e,lastScroll:c}))},w=function(e){!function(e,t,n,r){if(!t.has(e)){t.add(e),n.add(e);var i=Array.from(n);JSON.stringify(i).length>=18e3&&r(!1)}}(e,D,I,y)},C&&(g.exposure=function(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,o=void 0===i?150:i,a=new Map,l=new Map,u=t.exposureObservable.subscribe(function(e){var t=e,i=t.target;if(t.isIntersecting){if(!a.get(i)){var u=setTimeout(function(){a.set(i,!0);var e=r.getElementPath(i);n(e),l.set(i,null)},o);l.set(i,u)}}else!t.isIntersecting&&t.intersectionRatio<1&&(u=l.get(i))&&(clearTimeout(u),l.set(i,null))});return{unsubscribe:function(){u.unsubscribe()},reset:function(){l.forEach(function(e){e&&clearTimeout(e)}),l.clear(),a.clear()}}}({allObservables:v,onExposure:w,dataExtractor:N,exposureDuration:M}),g.exposure&&L.push(g.exposure),E=function(){y(!0)},null==b||b.addEventListener("beforeunload",E),P=function(){null==b||b.removeEventListener("beforeunload",E)},L.push({unsubscribe:function(){return P()}}),(T=v[Be.NavigateObservable])?L.push(T.subscribe(function(){y(!0)})):b&&(x=function(){y(!0)},b.addEventListener("popstate",x),k=b.history.pushState,b.history&&k&&(b.history.pushState=new Proxy(k,{apply:function(e,t,n){var r=o(n,3),i=r[0],a=r[1],l=r[2];e.apply(t,[i,a,l]),y(!0)}})),L.push({unsubscribe:function(){b.removeEventListener("popstate",x),b.history&&k&&(b.history.pushState=k)}}))),null===(X=null==i?void 0:i.loggerProvider)||void 0===X||X.log("".concat(_," has been successfully added.")),window.opener&&O.enabled&&(S=e.cssSelectorAllowlist,U=e.actionClickAllowlist,Ee(q=Q(),{dataExtractor:N,isElementSelectable:pe(e,a(a([],o(S),!1),o(U),!1)),cssSelectorAllowlist:S,actionClickAllowlist:U}),function(e,t){var n,r=e;if(!0!==r[ee]){r[ee]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.3.js.gz",o=null,a=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(){var t,n;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Initializing background capture (external script)");var r=new URL(i,e.endpoint).toString();e.loadScriptOnce(r).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),o=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,{messenger:e,onBackgroundCapture:a}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==o?void 0:o.close)||void 0===e||e.call(o),o=null})}}(q),q.setup(t({logger:null==i?void 0:i.loggerProvider},(null==i?void 0:i.serverZone)&&{endpoint:J[i.serverZone]})))),[2]})})},execute:function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){return[2,e]})})},teardown:function(){return n(void 0,void 0,void 0,function(){var e,t,n,o;return r(this,function(r){try{for(e=i(L),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(n)throw n.error}}return[2]})})}}},Xe=["mutation","navigate"];function Ye(e,t){var n,r,i,o,a=t.event,l=a.pageX,u=a.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:l,l),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:l,l),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function Ge(e){if(0===e.length)return null;var n=e[0],r=e[e.length-1];return{rageClickEvent:t({"[Amplitude] Begin Time":new Date(n.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-n.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},n.targetElementProperties),time:n.timestamp}}function ze(e){var t=this,i=e.amplitude,o=e.allObservables,a=e.shouldTrackRageClick,l=o.clickObservable,u=o.selectionObservable,c=[],s={},d=null;function v(e){c=[],s={},e&&(Ye(s,e),c.push(e))}var f=G(l.filter(function(e){return a("click",e.closestTrackedAncestor)}),function(e){return n(t,void 0,void 0,function(){var t;return r(this,function(n){return Ye(s,e),t=null,0===c.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(c,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(c,e)||s.isOutOfBounds?(d&&(t=Ge(c)),v(e)):c.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),c.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(Ge(c))},1e3)}})]:[2,null]})})}),p=null==u?void 0:u.subscribe(function(){v()}),h=f.subscribe(function(e){null!==e&&i.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==p||p.unsubscribe()}}}var Fe,Ve;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(Fe||(Fe={})),function(e){e.X="x",e.Y="y"}(Ve||(Ve={}));function We(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function Je(e){e.changes=[],e.startTime=void 0}function Ke(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var Ze=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new Y(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},a=void 0,l=null;function u(){void 0!==a&&(e.next(a),a=void 0,null!==l&&clearTimeout(l),Je(n),Je(i))}return t.subscribe(function(e){null!==l&&clearTimeout(l),function(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}(e===Ve.X?n:i);var t=function(e,t){var n=void 0;if(We(e)&&(n=e.startTime),We(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(a=a||t,l=setTimeout(function(){u(),l=null},o)):u(),Ke(n),Ke(i),function(){null!==l&&(clearTimeout(l),l=null)}})})},$e=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=void 0===i?20:i,a=e.thresholdMs,l=void 0===a?2e3:a,u=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new Y(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===Fe.DECREASING&&e.next(Ve.X),r=Fe.INCREASING):o.x<n.x&&(r===Fe.INCREASING&&e.next(Ve.X),r=Fe.DECREASING),o.y>n.y?(i===Fe.DECREASING&&e.next(Ve.Y),i=Fe.INCREASING):o.y<n.y&&(i===Fe.INCREASING&&e.next(Ve.Y),i=Fe.DECREASING),n=o):n=o})})}({allWindowObservables:r});return Ze({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:l}).subscribe(function(e){fe(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function Qe(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var et=4e3;function tt(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function nt(e,n){var r,i=tt(e,n),o=null!==(r=e.scripts)&&void 0!==r?r:[],a=o.map(function(e){return e.sourceURL}).filter(Boolean),l=o.map(function(e){return e.sourceFunctionName}).filter(Boolean),u=o.map(function(e){return e.invokerType}).filter(Boolean),c=o.map(function(e){return e.invoker}).filter(Boolean);return t(t(t(t(t(t({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},i.length>0&&{"[Amplitude] Main Thread Block Measures":i}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":o.length}),a.length>0&&{"[Amplitude] Main Thread Block Script URLs":a}),l.length>0&&{"[Amplitude] Main Thread Block Script Functions":l}),u.length>0&&{"[Amplitude] Main Thread Block Invoker Types":u}),c.length>0&&{"[Amplitude] Main Thread Block Invokers":c})}function rt(e,n){var r,i=tt(e,n),o=null!==(r=e.attribution)&&void 0!==r?r:[];return t(t({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},i.length>0&&{"[Amplitude] Main Thread Block Measures":i}),o.length>0&&{"[Amplitude] Main Thread Block Attribution":o.map(function(e){return e.name})})}function it(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,o=void 0===r?100:r,a=function(){if("undefined"==typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!a)return{unsubscribe:function(){}};var l=[],u=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var o=i(e.getEntries()),a=o.next();!a.done;a=o.next()){var u=a.value;l.push(u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}for(var c=r-1e4;l.length>0&&l[0].startTime<c;)l.shift()});try{u.observe({entryTypes:["measure"]})}catch(e){}var c=new PerformanceObserver(function(e){var r,u;try{for(var c=i(e.getEntries()),s=c.next();!s.done;s=c.next()){var d=s.value;if(!fe(n))return;if(!(d.duration<o)){var v="long-animation-frame"===a?nt(d,l):rt(d,l);t.track("[Amplitude] Main Thread Block",v)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(u=c.return)&&u.call(c)}finally{if(r)throw r.error}}});try{c.observe({entryTypes:[a]})}catch(e){return u.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){c.disconnect(),u.disconnect()}}}return e.DataExtractor=Ue,e.autocapturePlugin=qe,e.enableVisualTagging=Ee,e.frustrationPlugin=function(e){var l;void 0===e&&(e={});var u="@amplitude/plugin-frustration-browser",c=[],s=!1!==e.errorClicks;e.errorClicks||(s=!1);var d=!1!==e.deadClicks&&null!==e.deadClicks,v=!1!==e.rageClicks&&null!==e.rageClicks,f=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(f=!1);var p=Qe(e,"rageClicks",E,v),h=Qe(e,"deadClicks",y,d),g=Qe(e,"errorClicks",w,s),b=null!==(l=e.dataAttributePrefix)&&void 0!==l?l:m,T=new Ue(e),x=a([],o(new Set(a(a(a([],o(p),!1),o(h),!1),o(g),!1))),!1),k=function(){var e,n,r=F(ke("pointerdown").map(function(e){return T.addAdditionalEventProperties(e,"click",x,b,!0)})),i=F(Ae().map(function(e){return T.addTypeAndTimestamp(e,"error")})),o=F(xe().map(function(e){return T.addAdditionalEventProperties(e,"mutation",x,b)}));window.navigation&&(n=F(new Y(function(e){var n=function(n){e.next(t(t({},n),{type:"navigate"}))};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}}).map(function(e){return T.addAdditionalEventProperties(e,"navigate",x,b)})));var a=F(new Y(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),l=F(new Y(function(e){var t=function(t){e.next(t)},n={capture:!0};return Te.document.addEventListener("mousemove",t,n),function(){Te.document.removeEventListener("mousemove",t,n)}}));return(e={})[Be.ClickObservable]=r,e[Be.MutationObservable]=o,e[Be.NavigateObservable]=n,e[Be.BrowserErrorObservable]=i,e[Be.SelectionObservable]=a,e[Be.MouseMoveObservable]=l,e};return{name:u,type:"enrichment",setup:function(i,o){return n(void 0,void 0,void 0,function(){var n,a,l,m,y,w,E,x,A,S,O;return r(this,function(r){return"undefined"==typeof document||(n=k(),v&&(a=pe(e,p),l=ze({allObservables:n,amplitude:o,shouldTrackRageClick:a}),c.push(l)),d&&(m=pe(e,h),y=function(e){var n=e.amplitude,r=e.allObservables,i=e.getEventProperties,o=e.shouldTrackDeadClick,a=r.clickObservable,l=r.mutationObservable,u=r.navigateObservable,c=a.filter(function(e){return ye(e)&&o("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===te.LEFT_OR_TOUCH_CONTACT}),s=u?z(l,u):l,d=z(c,s),v=null;return G(d,function(e){return v&&Xe.includes(e.type)?(clearTimeout(v),v=null,Promise.resolve(null)):"click"===e.type?v?Promise.resolve(null):new Promise(function(t){v=setTimeout(function(){t(e),v=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var r={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};n.track("[Amplitude] Dead Click",t(t({},i("click",e.closestTrackedAncestor)),r),{time:e.timestamp})}})}({amplitude:o,allObservables:n,getEventProperties:function(e,t){return T.getEventProperties(e,t,b)},shouldTrackDeadClick:m}),c.push(y)),s&&(w=pe(e,g),E=function(e){var n=e.amplitude,r=e.allObservables,i=e.shouldTrackErrorClick,o=r.clickObservable,a=r.browserErrorObservable,l=o.filter(function(e){return ye(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===te.LEFT_OR_TOUCH_CONTACT}),u=null,c=null,s=function(){null!==u&&(clearTimeout(u),u=null),c=null};return z(l,a).subscribe(function(e){var r;if("click"===e.type)return s(),c=e,void(u=setTimeout(s,2e3));"error"===e.type&&c&&(n.track("[Amplitude] Error Click",t(((r={})["[Amplitude] Kind"]=e.event.kind,r["[Amplitude] Message"]=e.event.message,r["[Amplitude] Stack"]=e.event.stack,r["[Amplitude] Filename"]=e.event.filename,r["[Amplitude] Line Number"]=e.event.lineNumber,r["[Amplitude] Column Number"]=e.event.columnNumber,r),c.targetElementProperties)),s())})}({amplitude:o,allObservables:n,shouldTrackErrorClick:w}),c.push(E)),f&&(x=void 0,A=void 0,"object"==typeof e.thrashedCursor&&(x=e.thrashedCursor.directionChanges,A=e.thrashedCursor.threshold,x&&x<5&&(i.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(x," is below the minimum of ").concat(5,", setting to ").concat(5)),x=5),A&&A>et&&(i.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(A," is above the maximum of ").concat(et,", setting to ").concat(et)),A=et)),S=$e({amplitude:o,options:e,allObservables:n,directionChanges:x,thresholdMs:A}),c.push(S)),null===(O=null==i?void 0:i.loggerProvider)||void 0===O||O.log("".concat(u," has been successfully added."))),[2]})})},execute:function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){return[2,e]})})},teardown:function(){return n(void 0,void 0,void 0,function(){var e,t,n,o;return r(this,function(r){try{for(e=i(c),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(n)throw n.error}}return[2]})})}}},e.performancePlugin=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",o=[],a=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,l){return n(void 0,void 0,void 0,function(){var n,u,c;return r(this,function(r){return"undefined"==typeof document||(a&&(n=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(n=e.mainThreadBlock.durationThreshold),u=it({amplitude:l,options:e,durationThreshold:n}),o.push(u)),null===(c=null==i?void 0:i.loggerProvider)||void 0===c||c.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){return[2,e]})})},teardown:function(){return n(void 0,void 0,void 0,function(){var e,t,n,a;return r(this,function(r){try{for(e=i(o),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(a=e.return)&&a.call(e)}finally{if(n)throw n.error}}return[2]})})}}},e.plugin=qe,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
2
2
  //# sourceMappingURL=amplitude-min.js.map
Binary file