@amplitude/plugin-autocapture-browser
Advanced tools
Comparing version 1.0.0-beta.2 to 1.0.0-beta.3
import { BrowserClient, BrowserConfig, EnrichmentPlugin } from '@amplitude/analytics-types'; | ||
import { Observable } from 'rxjs'; | ||
import { Messenger } from './libs/messenger'; | ||
import { ActionType } from './typings/autocapture'; | ||
import { HasEventTargetAddRemove } from 'rxjs/internal/observable/fromEvent'; | ||
declare global { | ||
interface Window { | ||
navigation: HasEventTargetAddRemove<Event>; | ||
} | ||
} | ||
interface NavigateEvent extends Event { | ||
readonly navigationType: 'reload' | 'push' | 'replace' | 'traverse'; | ||
readonly destination: { | ||
readonly url: string; | ||
readonly key: string | null; | ||
readonly id: string | null; | ||
readonly index: number; | ||
readonly sameDocument: boolean; | ||
getState(): any; | ||
}; | ||
readonly canIntercept: boolean; | ||
readonly userInitiated: boolean; | ||
readonly hashChange: boolean; | ||
readonly signal: AbortSignal; | ||
readonly formData: FormData | null; | ||
readonly downloadRequest: string | null; | ||
readonly info: any; | ||
readonly hasUAVisualTransition: boolean; | ||
/** @see https://github.com/WICG/navigation-api/pull/264 */ | ||
readonly sourceElement: Element | null; | ||
scroll(): void; | ||
} | ||
type BrowserEnrichmentPlugin = EnrichmentPlugin<BrowserClient, BrowserConfig>; | ||
export declare const DEFAULT_CSS_SELECTOR_ALLOWLIST: string[]; | ||
export declare const DEFAULT_ACTION_CLICK_ALLOWLIST: string[]; | ||
export declare const DEFAULT_DATA_ATTRIBUTE_PREFIX = "data-amp-track-"; | ||
@@ -41,5 +71,41 @@ export interface AutocaptureOptions { | ||
}; | ||
/** | ||
* Debounce time in milliseconds for tracking events. | ||
* This is used to detect rage clicks. | ||
*/ | ||
debounceTime?: number; | ||
/** | ||
* CSS selector allowlist for tracking clicks that result in a DOM change/navigation on elements not already allowed by the cssSelectorAllowlist | ||
*/ | ||
actionClickAllowlist?: string[]; | ||
} | ||
export type AutoCaptureOptionsWithDefaults = Required<Pick<AutocaptureOptions, 'debounceTime' | 'cssSelectorAllowlist' | 'actionClickAllowlist'>> & AutocaptureOptions; | ||
export declare enum ObservablesEnum { | ||
ClickObservable = "clickObservable", | ||
ChangeObservable = "changeObservable", | ||
NavigateObservable = "navigateObservable", | ||
MutationObservable = "mutationObservable" | ||
} | ||
type BaseTimestampedEvent<T> = { | ||
event: T; | ||
timestamp: number; | ||
type: 'rage' | 'click' | 'change' | 'error' | 'navigate' | 'mutation'; | ||
}; | ||
export type ElementBasedEvent = MouseEvent | Event; | ||
export type ElementBasedTimestampedEvent<T> = BaseTimestampedEvent<T> & { | ||
event: MouseEvent | Event; | ||
type: 'click' | 'change'; | ||
closestTrackedAncestor: Element; | ||
targetElementProperties: Record<string, any>; | ||
}; | ||
export type TimestampedEvent<T> = BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T>; | ||
export interface AllWindowObservables { | ||
[ObservablesEnum.ClickObservable]: Observable<ElementBasedTimestampedEvent<MouseEvent>>; | ||
[ObservablesEnum.ChangeObservable]: Observable<ElementBasedTimestampedEvent<Event>>; | ||
[ObservablesEnum.NavigateObservable]: Observable<TimestampedEvent<NavigateEvent>> | undefined; | ||
[ObservablesEnum.MutationObservable]: Observable<TimestampedEvent<MutationRecord[]>>; | ||
} | ||
export declare function isElementBasedEvent<T>(event: BaseTimestampedEvent<T>): event is ElementBasedTimestampedEvent<T>; | ||
export declare const autocapturePlugin: (options?: AutocaptureOptions) => BrowserEnrichmentPlugin; | ||
export {}; | ||
//# sourceMappingURL=autocapture-plugin.d.ts.map |
var _this = this; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.autocapturePlugin = exports.DEFAULT_DATA_ATTRIBUTE_PREFIX = exports.DEFAULT_CSS_SELECTOR_ALLOWLIST = void 0; | ||
exports.autocapturePlugin = exports.isElementBasedEvent = exports.ObservablesEnum = exports.DEFAULT_DATA_ATTRIBUTE_PREFIX = exports.DEFAULT_ACTION_CLICK_ALLOWLIST = exports.DEFAULT_CSS_SELECTOR_ALLOWLIST = void 0; | ||
var tslib_1 = require("tslib"); | ||
var constants = tslib_1.__importStar(require("./constants")); | ||
var rxjs_1 = require("rxjs"); | ||
var helpers_1 = require("./helpers"); | ||
var messenger_1 = require("./libs/messenger"); | ||
var hierarchy_1 = require("./hierarchy"); | ||
var track_click_1 = require("./autocapture/track-click"); | ||
var track_change_1 = require("./autocapture/track-change"); | ||
var track_action_click_1 = require("./autocapture/track-action-click"); | ||
exports.DEFAULT_CSS_SELECTOR_ALLOWLIST = [ | ||
@@ -19,80 +23,67 @@ 'a', | ||
]; | ||
exports.DEFAULT_ACTION_CLICK_ALLOWLIST = ['div', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']; | ||
exports.DEFAULT_DATA_ATTRIBUTE_PREFIX = 'data-amp-track-'; | ||
var ObservablesEnum; | ||
(function (ObservablesEnum) { | ||
ObservablesEnum["ClickObservable"] = "clickObservable"; | ||
ObservablesEnum["ChangeObservable"] = "changeObservable"; | ||
// ErrorObservable = 'errorObservable', | ||
ObservablesEnum["NavigateObservable"] = "navigateObservable"; | ||
ObservablesEnum["MutationObservable"] = "mutationObservable"; | ||
})(ObservablesEnum = exports.ObservablesEnum || (exports.ObservablesEnum = {})); | ||
// Type predicate | ||
function isElementBasedEvent(event) { | ||
return event.type === 'click' || event.type === 'change'; | ||
} | ||
exports.isElementBasedEvent = isElementBasedEvent; | ||
var autocapturePlugin = function (options) { | ||
var _a, _b, _c; | ||
if (options === void 0) { options = {}; } | ||
var _a = options.cssSelectorAllowlist, cssSelectorAllowlist = _a === void 0 ? exports.DEFAULT_CSS_SELECTOR_ALLOWLIST : _a, pageUrlAllowlist = options.pageUrlAllowlist, shouldTrackEventResolver = options.shouldTrackEventResolver, _b = options.dataAttributePrefix, dataAttributePrefix = _b === void 0 ? exports.DEFAULT_DATA_ATTRIBUTE_PREFIX : _b, _c = options.visualTaggingOptions, visualTaggingOptions = _c === void 0 ? { | ||
var _d = options.dataAttributePrefix, dataAttributePrefix = _d === void 0 ? exports.DEFAULT_DATA_ATTRIBUTE_PREFIX : _d, _e = options.visualTaggingOptions, visualTaggingOptions = _e === void 0 ? { | ||
enabled: true, | ||
messenger: new messenger_1.WindowMessenger(), | ||
} : _c; | ||
} : _e; | ||
options.cssSelectorAllowlist = (_a = options.cssSelectorAllowlist) !== null && _a !== void 0 ? _a : exports.DEFAULT_CSS_SELECTOR_ALLOWLIST; | ||
options.actionClickAllowlist = (_b = options.actionClickAllowlist) !== null && _b !== void 0 ? _b : exports.DEFAULT_ACTION_CLICK_ALLOWLIST; | ||
options.debounceTime = (_c = options.debounceTime) !== null && _c !== void 0 ? _c : 1000; | ||
var name = constants.PLUGIN_NAME; | ||
var type = 'enrichment'; | ||
var observer; | ||
var eventListeners = []; | ||
var subscriptions = []; | ||
var logger = undefined; | ||
var addEventListener = function (element, type, handler) { | ||
element.addEventListener(type, handler); | ||
eventListeners.push({ | ||
element: element, | ||
type: type, | ||
handler: handler, | ||
}); | ||
}; | ||
var removeEventListeners = function () { | ||
eventListeners.forEach(function (_ref) { | ||
var element = _ref.element, type = _ref.type, handler = _ref.handler; | ||
/* istanbul ignore next */ | ||
element === null || element === void 0 ? void 0 : element.removeEventListener(type, handler); | ||
}); | ||
eventListeners = []; | ||
}; | ||
var shouldTrackEvent = function (actionType, element) { | ||
var _a, _b, _c; | ||
/* istanbul ignore if */ | ||
if (!element) { | ||
return false; | ||
} | ||
// Create observables on events on the window | ||
var createObservables = function () { | ||
var _a; | ||
// Create Observables from direct user events | ||
var clickObservable = (0, rxjs_1.fromEvent)(document, 'click', { capture: true }).pipe((0, rxjs_1.map)(function (click) { return addAdditionalEventProperties(click, 'click'); })); | ||
var changeObservable = (0, rxjs_1.fromEvent)(document, 'change', { capture: true }).pipe((0, rxjs_1.map)(function (change) { return addAdditionalEventProperties(change, 'change'); })); | ||
// Create Observable from unhandled errors | ||
// const errorObservable = fromEvent<ErrorEvent>(window, 'error').pipe( | ||
// map((error) => addAdditionalEventProperties(error, 'error')), | ||
// ); | ||
// Create observable for URL changes | ||
var navigateObservable; | ||
/* istanbul ignore next */ | ||
var tag = (_b = (_a = element === null || element === void 0 ? void 0 : element.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
// Text nodes have no tag | ||
if (!tag) { | ||
return false; | ||
if (window.navigation) { | ||
navigateObservable = (0, rxjs_1.fromEvent)(window.navigation, 'navigate').pipe((0, rxjs_1.map)(function (navigate) { return addAdditionalEventProperties(navigate, 'navigate'); })); | ||
} | ||
if (shouldTrackEventResolver) { | ||
return shouldTrackEventResolver(actionType, element); | ||
} | ||
if (!(0, helpers_1.isPageUrlAllowed)(window.location.href, pageUrlAllowlist)) { | ||
return false; | ||
} | ||
/* istanbul ignore next */ | ||
var elementType = (element === null || element === void 0 ? void 0 : element.type) || ''; | ||
if (typeof elementType === 'string') { | ||
switch (elementType.toLowerCase()) { | ||
case 'hidden': | ||
return false; | ||
case 'password': | ||
return false; | ||
} | ||
} | ||
/* istanbul ignore if */ | ||
if (cssSelectorAllowlist) { | ||
var hasMatchAnyAllowedSelector = cssSelectorAllowlist.some(function (selector) { var _a; return !!((_a = element === null || element === void 0 ? void 0 : element.matches) === null || _a === void 0 ? void 0 : _a.call(element, selector)); }); | ||
if (!hasMatchAnyAllowedSelector) { | ||
return false; | ||
} | ||
} | ||
switch (tag) { | ||
case 'input': | ||
case 'select': | ||
case 'textarea': | ||
return actionType === 'change' || actionType === 'click'; | ||
default: { | ||
/* istanbul ignore next */ | ||
var computedStyle = (_c = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _c === void 0 ? void 0 : _c.call(window, element); | ||
/* istanbul ignore next */ | ||
if (computedStyle && computedStyle.getPropertyValue('cursor') === 'pointer' && actionType === 'click') { | ||
return true; | ||
} | ||
return actionType === 'click'; | ||
} | ||
} | ||
// Track DOM Mutations | ||
var mutationObservable = new rxjs_1.Observable(function (observer) { | ||
var mutationObserver = new MutationObserver(function (mutations) { | ||
observer.next(mutations); | ||
}); | ||
mutationObserver.observe(document.body, { | ||
childList: true, | ||
attributes: true, | ||
characterData: true, | ||
subtree: true, | ||
}); | ||
return function () { return mutationObserver.disconnect(); }; | ||
}).pipe((0, rxjs_1.map)(function (mutation) { return addAdditionalEventProperties(mutation, 'mutation'); })); | ||
return _a = {}, | ||
_a[ObservablesEnum.ClickObservable] = clickObservable, | ||
_a[ObservablesEnum.ChangeObservable] = changeObservable, | ||
// [ObservablesEnum.ErrorObservable]: errorObservable, | ||
_a[ObservablesEnum.NavigateObservable] = navigateObservable, | ||
_a[ObservablesEnum.MutationObservable] = mutationObservable, | ||
_a; | ||
}; | ||
@@ -134,4 +125,21 @@ // Returns the Amplitude event properties for the given element. | ||
}; | ||
var addAdditionalEventProperties = function (event, type) { | ||
var baseEvent = { | ||
event: event, | ||
timestamp: Date.now(), | ||
type: type, | ||
}; | ||
if (isElementBasedEvent(baseEvent) && baseEvent.event.target !== null) { | ||
// Retrieve additional event properties from the target element | ||
var closestTrackedAncestor = (0, helpers_1.getClosestElement)(baseEvent.event.target, options.cssSelectorAllowlist); | ||
if (closestTrackedAncestor) { | ||
baseEvent.closestTrackedAncestor = closestTrackedAncestor; | ||
baseEvent.targetElementProperties = getEventProperties(baseEvent.type, closestTrackedAncestor); | ||
} | ||
return baseEvent; | ||
} | ||
return baseEvent; | ||
}; | ||
var setup = function (config, amplitude) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var addListener, attachListeners; | ||
var shouldTrackEvent, shouldTrackActionClick, allObservables, clickTrackingSubscription, changeSubscription, actionClickSubscription, allowlist, actionClickAllowlist; | ||
var _a, _b, _c; | ||
@@ -149,57 +157,28 @@ return tslib_1.__generator(this, function (_d) { | ||
} | ||
addListener = function (el) { | ||
if (shouldTrackEvent('click', el)) { | ||
addEventListener(el, 'click', function (event) { | ||
// Limit to only the innermost element that matches the selectors, avoiding all propagated event after matching. | ||
/* istanbul ignore next */ | ||
if ((event === null || event === void 0 ? void 0 : event.target) != (event === null || event === void 0 ? void 0 : event.currentTarget) && | ||
(0, helpers_1.getClosestElement)(event === null || event === void 0 ? void 0 : event.target, cssSelectorAllowlist) != (event === null || event === void 0 ? void 0 : event.currentTarget)) { | ||
return; | ||
} | ||
/* istanbul ignore next */ | ||
amplitude === null || amplitude === void 0 ? void 0 : amplitude.track(constants.AMPLITUDE_ELEMENT_CLICKED_EVENT, getEventProperties('click', el)); | ||
}); | ||
} | ||
if (shouldTrackEvent('change', el)) { | ||
addEventListener(el, 'change', function (event) { | ||
// Limit to only the innermost element that matches the selectors, avoiding all propagated event after matching. | ||
/* istanbul ignore next */ | ||
if ((event === null || event === void 0 ? void 0 : event.target) != (event === null || event === void 0 ? void 0 : event.currentTarget) && | ||
(0, helpers_1.getClosestElement)(event === null || event === void 0 ? void 0 : event.target, cssSelectorAllowlist) != (event === null || event === void 0 ? void 0 : event.currentTarget)) { | ||
return; | ||
} | ||
/* istanbul ignore next */ | ||
amplitude === null || amplitude === void 0 ? void 0 : amplitude.track(constants.AMPLITUDE_ELEMENT_CHANGED_EVENT, getEventProperties('change', el)); | ||
}); | ||
} | ||
}; | ||
if (typeof MutationObserver !== 'undefined') { | ||
observer = new MutationObserver(function (mutations) { | ||
mutations.forEach(function (mutation) { | ||
mutation.addedNodes.forEach(function (node) { | ||
addListener(node); | ||
if ('querySelectorAll' in node && typeof node.querySelectorAll === 'function') { | ||
(0, helpers_1.querySelectUniqueElements)(node, cssSelectorAllowlist).map(addListener); | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
attachListeners = function () { | ||
var allElements = (0, helpers_1.querySelectUniqueElements)(document.body, cssSelectorAllowlist); | ||
allElements.forEach(addListener); | ||
/* istanbul ignore next */ | ||
observer === null || observer === void 0 ? void 0 : observer.observe(document.body, { | ||
subtree: true, | ||
childList: true, | ||
}); | ||
}; | ||
if (document.body) { | ||
attachListeners(); | ||
} | ||
else { | ||
// This is to handle the case where the plugin is loaded before the body is available. | ||
// E.g., for non-reactive frameworks. | ||
window.addEventListener('load', attachListeners); | ||
} | ||
shouldTrackEvent = (0, helpers_1.createShouldTrackEvent)(options, options.cssSelectorAllowlist); | ||
shouldTrackActionClick = (0, helpers_1.createShouldTrackEvent)(options, options.actionClickAllowlist); | ||
allObservables = createObservables(); | ||
clickTrackingSubscription = (0, track_click_1.trackClicks)({ | ||
allObservables: allObservables, | ||
options: options, | ||
amplitude: amplitude, | ||
shouldTrackEvent: shouldTrackEvent, | ||
}); | ||
subscriptions.push(clickTrackingSubscription); | ||
changeSubscription = (0, track_change_1.trackChange)({ | ||
allObservables: allObservables, | ||
getEventProperties: getEventProperties, | ||
amplitude: amplitude, | ||
shouldTrackEvent: shouldTrackEvent, | ||
}); | ||
subscriptions.push(changeSubscription); | ||
actionClickSubscription = (0, track_action_click_1.trackActionClick)({ | ||
allObservables: allObservables, | ||
options: options, | ||
getEventProperties: getEventProperties, | ||
amplitude: amplitude, | ||
shouldTrackEvent: shouldTrackEvent, | ||
shouldTrackActionClick: shouldTrackActionClick, | ||
}); | ||
subscriptions.push(actionClickSubscription); | ||
/* istanbul ignore next */ | ||
@@ -209,4 +188,6 @@ (_b = config === null || config === void 0 ? void 0 : config.loggerProvider) === null || _b === void 0 ? void 0 : _b.log("".concat(name, " has been successfully added.")); | ||
if (window.opener && visualTaggingOptions.enabled) { | ||
allowlist = options.cssSelectorAllowlist; | ||
actionClickAllowlist = options.actionClickAllowlist; | ||
/* istanbul ignore next */ | ||
(_c = visualTaggingOptions.messenger) === null || _c === void 0 ? void 0 : _c.setup(tslib_1.__assign(tslib_1.__assign({ logger: config === null || config === void 0 ? void 0 : config.loggerProvider }, ((config === null || config === void 0 ? void 0 : config.serverZone) && { endpoint: constants.AMPLITUDE_ORIGINS_MAP[config.serverZone] })), { isElementSelectable: shouldTrackEvent })); | ||
(_c = visualTaggingOptions.messenger) === null || _c === void 0 ? void 0 : _c.setup(tslib_1.__assign(tslib_1.__assign({ logger: config === null || config === void 0 ? void 0 : config.loggerProvider }, ((config === null || config === void 0 ? void 0 : config.serverZone) && { endpoint: constants.AMPLITUDE_ORIGINS_MAP[config.serverZone] })), { isElementSelectable: (0, helpers_1.createShouldTrackEvent)(options, tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(allowlist), false), tslib_1.__read(actionClickAllowlist), false)), cssSelectorAllowlist: allowlist, actionClickAllowlist: actionClickAllowlist })); | ||
} | ||
@@ -222,7 +203,18 @@ return [2 /*return*/]; | ||
var teardown = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
if (observer) { | ||
observer.disconnect(); | ||
var subscriptions_1, subscriptions_1_1, subscription; | ||
var e_1, _a; | ||
return tslib_1.__generator(this, function (_b) { | ||
try { | ||
for (subscriptions_1 = tslib_1.__values(subscriptions), subscriptions_1_1 = subscriptions_1.next(); !subscriptions_1_1.done; subscriptions_1_1 = subscriptions_1.next()) { | ||
subscription = subscriptions_1_1.value; | ||
subscription.unsubscribe(); | ||
} | ||
} | ||
removeEventListeners(); | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (subscriptions_1_1 && !subscriptions_1_1.done && (_a = subscriptions_1.return)) _a.call(subscriptions_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return [2 /*return*/]; | ||
@@ -229,0 +221,0 @@ }); |
import { Logger } from '@amplitude/analytics-types'; | ||
import { AutocaptureOptions, ElementBasedEvent, ElementBasedTimestampedEvent } from './autocapture-plugin'; | ||
import { ActionType } from './typings/autocapture'; | ||
export type JSONValue = string | number | boolean | null | { | ||
[x: string]: JSONValue; | ||
} | Array<JSONValue>; | ||
export type shouldTrackEvent = (actionType: ActionType, element: Element) => boolean; | ||
export declare const createShouldTrackEvent: (autocaptureOptions: AutocaptureOptions, allowlist: string[]) => shouldTrackEvent; | ||
export declare const isNonSensitiveString: (text: string | null) => boolean; | ||
@@ -28,2 +32,3 @@ export declare const isTextNode: (node: Node) => boolean; | ||
export declare function generateUniqueId(): string; | ||
export declare const filterOutNonTrackableEvents: (event: ElementBasedTimestampedEvent<ElementBasedEvent>) => boolean; | ||
//# sourceMappingURL=helpers.d.ts.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateUniqueId = exports.asyncLoadScript = exports.getEventTagProps = exports.getClosestElement = exports.querySelectUniqueElements = exports.getNearestLabel = exports.removeEmptyProperties = exports.isEmpty = exports.getAttributesWithPrefix = exports.isPageUrlAllowed = exports.getSelector = exports.getText = exports.isNonSensitiveElement = exports.isTextNode = exports.isNonSensitiveString = void 0; | ||
exports.filterOutNonTrackableEvents = exports.generateUniqueId = exports.asyncLoadScript = exports.getEventTagProps = exports.getClosestElement = exports.querySelectUniqueElements = exports.getNearestLabel = exports.removeEmptyProperties = exports.isEmpty = exports.getAttributesWithPrefix = exports.isPageUrlAllowed = exports.getSelector = exports.getText = exports.isNonSensitiveElement = exports.isTextNode = exports.isNonSensitiveString = exports.createShouldTrackEvent = void 0; | ||
var tslib_1 = require("tslib"); | ||
@@ -8,2 +8,53 @@ /* eslint-disable no-restricted-globals */ | ||
var SENSITIVE_TAGS = ['input', 'select', 'textarea']; | ||
var createShouldTrackEvent = function (autocaptureOptions, allowlist) { | ||
return function (actionType, element) { | ||
var _a, _b, _c; | ||
var pageUrlAllowlist = autocaptureOptions.pageUrlAllowlist, shouldTrackEventResolver = autocaptureOptions.shouldTrackEventResolver; | ||
/* istanbul ignore next */ | ||
var tag = (_b = (_a = element === null || element === void 0 ? void 0 : element.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
// window, document, and Text nodes have no tag | ||
if (!tag) { | ||
return false; | ||
} | ||
if (shouldTrackEventResolver) { | ||
return shouldTrackEventResolver(actionType, element); | ||
} | ||
if (!(0, exports.isPageUrlAllowed)(window.location.href, pageUrlAllowlist)) { | ||
return false; | ||
} | ||
/* istanbul ignore next */ | ||
var elementType = (element === null || element === void 0 ? void 0 : element.type) || ''; | ||
if (typeof elementType === 'string') { | ||
switch (elementType.toLowerCase()) { | ||
case 'hidden': | ||
return false; | ||
case 'password': | ||
return false; | ||
} | ||
} | ||
/* istanbul ignore if */ | ||
if (allowlist) { | ||
var hasMatchAnyAllowedSelector = allowlist.some(function (selector) { var _a; return !!((_a = element === null || element === void 0 ? void 0 : element.matches) === null || _a === void 0 ? void 0 : _a.call(element, selector)); }); | ||
if (!hasMatchAnyAllowedSelector) { | ||
return false; | ||
} | ||
} | ||
switch (tag) { | ||
case 'input': | ||
case 'select': | ||
case 'textarea': | ||
return actionType === 'change' || actionType === 'click'; | ||
default: { | ||
/* istanbul ignore next */ | ||
var computedStyle = (_c = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _c === void 0 ? void 0 : _c.call(window, element); | ||
/* istanbul ignore next */ | ||
if (computedStyle && computedStyle.getPropertyValue('cursor') === 'pointer' && actionType === 'click') { | ||
return true; | ||
} | ||
return actionType === 'click'; | ||
} | ||
} | ||
}; | ||
}; | ||
exports.createShouldTrackEvent = createShouldTrackEvent; | ||
var isNonSensitiveString = function (text) { | ||
@@ -31,6 +82,6 @@ if (text == null) { | ||
var isNonSensitiveElement = function (element) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
/* istanbul ignore next */ | ||
var tag = (_b = (_a = element === null || element === void 0 ? void 0 : element.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
var isContentEditable = element.getAttribute('contenteditable') === 'true'; | ||
var isContentEditable = element instanceof HTMLElement ? ((_c = element.getAttribute('contenteditable')) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'true' : false; | ||
return !SENSITIVE_TAGS.includes(tag) && !isContentEditable; | ||
@@ -236,2 +287,11 @@ }; | ||
exports.generateUniqueId = generateUniqueId; | ||
var filterOutNonTrackableEvents = function (event) { | ||
// Filter out changeEvent events with no target | ||
// This could happen when change events are triggered programmatically | ||
if (event.event.target === null || !event.closestTrackedAncestor) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
exports.filterOutNonTrackableEvents = filterOutNonTrackableEvents; | ||
//# sourceMappingURL=helpers.js.map |
@@ -59,6 +59,8 @@ import { Logger } from '@amplitude/analytics-types'; | ||
private handleResponse; | ||
setup({ logger, endpoint, isElementSelectable, }?: { | ||
setup({ logger, endpoint, isElementSelectable, cssSelectorAllowlist, actionClickAllowlist, }?: { | ||
logger?: Logger; | ||
endpoint?: string; | ||
isElementSelectable?: (action: InitializeVisualTaggingSelectorData['actionType'], element: Element) => boolean; | ||
cssSelectorAllowlist?: string[]; | ||
actionClickAllowlist?: string[]; | ||
}): void; | ||
@@ -65,0 +67,0 @@ private onSelect; |
@@ -70,3 +70,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var _this = this; | ||
var _b = _a === void 0 ? {} : _a, logger = _b.logger, endpoint = _b.endpoint, isElementSelectable = _b.isElementSelectable; | ||
var _b = _a === void 0 ? {} : _a, logger = _b.logger, endpoint = _b.endpoint, isElementSelectable = _b.isElementSelectable, cssSelectorAllowlist = _b.cssSelectorAllowlist, actionClickAllowlist = _b.actionClickAllowlist; | ||
this.logger = logger; | ||
@@ -120,2 +120,4 @@ // If endpoint is customized, don't override it. | ||
messenger: _this, | ||
cssSelectorAllowlist: cssSelectorAllowlist, | ||
actionClickAllowlist: actionClickAllowlist, | ||
}); | ||
@@ -122,0 +124,0 @@ _this.notify({ action: 'selector-loaded' }); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.0.0-beta.1"; | ||
export declare const VERSION = "1.0.0-beta.2"; | ||
//# sourceMappingURL=version.d.ts.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '1.0.0-beta.1'; | ||
exports.VERSION = '1.0.0-beta.2'; | ||
//# sourceMappingURL=version.js.map |
import { BrowserClient, BrowserConfig, EnrichmentPlugin } from '@amplitude/analytics-types'; | ||
import { Observable } from 'rxjs'; | ||
import { Messenger } from './libs/messenger'; | ||
import { ActionType } from './typings/autocapture'; | ||
import { HasEventTargetAddRemove } from 'rxjs/internal/observable/fromEvent'; | ||
declare global { | ||
interface Window { | ||
navigation: HasEventTargetAddRemove<Event>; | ||
} | ||
} | ||
interface NavigateEvent extends Event { | ||
readonly navigationType: 'reload' | 'push' | 'replace' | 'traverse'; | ||
readonly destination: { | ||
readonly url: string; | ||
readonly key: string | null; | ||
readonly id: string | null; | ||
readonly index: number; | ||
readonly sameDocument: boolean; | ||
getState(): any; | ||
}; | ||
readonly canIntercept: boolean; | ||
readonly userInitiated: boolean; | ||
readonly hashChange: boolean; | ||
readonly signal: AbortSignal; | ||
readonly formData: FormData | null; | ||
readonly downloadRequest: string | null; | ||
readonly info: any; | ||
readonly hasUAVisualTransition: boolean; | ||
/** @see https://github.com/WICG/navigation-api/pull/264 */ | ||
readonly sourceElement: Element | null; | ||
scroll(): void; | ||
} | ||
type BrowserEnrichmentPlugin = EnrichmentPlugin<BrowserClient, BrowserConfig>; | ||
export declare const DEFAULT_CSS_SELECTOR_ALLOWLIST: string[]; | ||
export declare const DEFAULT_ACTION_CLICK_ALLOWLIST: string[]; | ||
export declare const DEFAULT_DATA_ATTRIBUTE_PREFIX = "data-amp-track-"; | ||
@@ -41,5 +71,41 @@ export interface AutocaptureOptions { | ||
}; | ||
/** | ||
* Debounce time in milliseconds for tracking events. | ||
* This is used to detect rage clicks. | ||
*/ | ||
debounceTime?: number; | ||
/** | ||
* CSS selector allowlist for tracking clicks that result in a DOM change/navigation on elements not already allowed by the cssSelectorAllowlist | ||
*/ | ||
actionClickAllowlist?: string[]; | ||
} | ||
export type AutoCaptureOptionsWithDefaults = Required<Pick<AutocaptureOptions, 'debounceTime' | 'cssSelectorAllowlist' | 'actionClickAllowlist'>> & AutocaptureOptions; | ||
export declare enum ObservablesEnum { | ||
ClickObservable = "clickObservable", | ||
ChangeObservable = "changeObservable", | ||
NavigateObservable = "navigateObservable", | ||
MutationObservable = "mutationObservable" | ||
} | ||
type BaseTimestampedEvent<T> = { | ||
event: T; | ||
timestamp: number; | ||
type: 'rage' | 'click' | 'change' | 'error' | 'navigate' | 'mutation'; | ||
}; | ||
export type ElementBasedEvent = MouseEvent | Event; | ||
export type ElementBasedTimestampedEvent<T> = BaseTimestampedEvent<T> & { | ||
event: MouseEvent | Event; | ||
type: 'click' | 'change'; | ||
closestTrackedAncestor: Element; | ||
targetElementProperties: Record<string, any>; | ||
}; | ||
export type TimestampedEvent<T> = BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T>; | ||
export interface AllWindowObservables { | ||
[ObservablesEnum.ClickObservable]: Observable<ElementBasedTimestampedEvent<MouseEvent>>; | ||
[ObservablesEnum.ChangeObservable]: Observable<ElementBasedTimestampedEvent<Event>>; | ||
[ObservablesEnum.NavigateObservable]: Observable<TimestampedEvent<NavigateEvent>> | undefined; | ||
[ObservablesEnum.MutationObservable]: Observable<TimestampedEvent<MutationRecord[]>>; | ||
} | ||
export declare function isElementBasedEvent<T>(event: BaseTimestampedEvent<T>): event is ElementBasedTimestampedEvent<T>; | ||
export declare const autocapturePlugin: (options?: AutocaptureOptions) => BrowserEnrichmentPlugin; | ||
export {}; | ||
//# sourceMappingURL=autocapture-plugin.d.ts.map |
@@ -1,6 +0,10 @@ | ||
import { __assign, __awaiter, __generator } from "tslib"; | ||
import { __assign, __awaiter, __generator, __read, __spreadArray, __values } from "tslib"; | ||
import * as constants from './constants'; | ||
import { getText, isPageUrlAllowed, getAttributesWithPrefix, removeEmptyProperties, getNearestLabel, querySelectUniqueElements, getClosestElement, getSelector, } from './helpers'; | ||
import { fromEvent, map, Observable } from 'rxjs'; | ||
import { getText, getAttributesWithPrefix, removeEmptyProperties, getNearestLabel, getSelector, createShouldTrackEvent, getClosestElement, } from './helpers'; | ||
import { WindowMessenger } from './libs/messenger'; | ||
import { getHierarchy } from './hierarchy'; | ||
import { trackClicks } from './autocapture/track-click'; | ||
import { trackChange } from './autocapture/track-change'; | ||
import { trackActionClick } from './autocapture/track-action-click'; | ||
export var DEFAULT_CSS_SELECTOR_ALLOWLIST = [ | ||
@@ -16,80 +20,66 @@ 'a', | ||
]; | ||
export var DEFAULT_ACTION_CLICK_ALLOWLIST = ['div', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']; | ||
export var DEFAULT_DATA_ATTRIBUTE_PREFIX = 'data-amp-track-'; | ||
export var ObservablesEnum; | ||
(function (ObservablesEnum) { | ||
ObservablesEnum["ClickObservable"] = "clickObservable"; | ||
ObservablesEnum["ChangeObservable"] = "changeObservable"; | ||
// ErrorObservable = 'errorObservable', | ||
ObservablesEnum["NavigateObservable"] = "navigateObservable"; | ||
ObservablesEnum["MutationObservable"] = "mutationObservable"; | ||
})(ObservablesEnum || (ObservablesEnum = {})); | ||
// Type predicate | ||
export function isElementBasedEvent(event) { | ||
return event.type === 'click' || event.type === 'change'; | ||
} | ||
export var autocapturePlugin = function (options) { | ||
var _a, _b, _c; | ||
if (options === void 0) { options = {}; } | ||
var _a = options.cssSelectorAllowlist, cssSelectorAllowlist = _a === void 0 ? DEFAULT_CSS_SELECTOR_ALLOWLIST : _a, pageUrlAllowlist = options.pageUrlAllowlist, shouldTrackEventResolver = options.shouldTrackEventResolver, _b = options.dataAttributePrefix, dataAttributePrefix = _b === void 0 ? DEFAULT_DATA_ATTRIBUTE_PREFIX : _b, _c = options.visualTaggingOptions, visualTaggingOptions = _c === void 0 ? { | ||
var _d = options.dataAttributePrefix, dataAttributePrefix = _d === void 0 ? DEFAULT_DATA_ATTRIBUTE_PREFIX : _d, _e = options.visualTaggingOptions, visualTaggingOptions = _e === void 0 ? { | ||
enabled: true, | ||
messenger: new WindowMessenger(), | ||
} : _c; | ||
} : _e; | ||
options.cssSelectorAllowlist = (_a = options.cssSelectorAllowlist) !== null && _a !== void 0 ? _a : DEFAULT_CSS_SELECTOR_ALLOWLIST; | ||
options.actionClickAllowlist = (_b = options.actionClickAllowlist) !== null && _b !== void 0 ? _b : DEFAULT_ACTION_CLICK_ALLOWLIST; | ||
options.debounceTime = (_c = options.debounceTime) !== null && _c !== void 0 ? _c : 1000; | ||
var name = constants.PLUGIN_NAME; | ||
var type = 'enrichment'; | ||
var observer; | ||
var eventListeners = []; | ||
var subscriptions = []; | ||
var logger = undefined; | ||
var addEventListener = function (element, type, handler) { | ||
element.addEventListener(type, handler); | ||
eventListeners.push({ | ||
element: element, | ||
type: type, | ||
handler: handler, | ||
}); | ||
}; | ||
var removeEventListeners = function () { | ||
eventListeners.forEach(function (_ref) { | ||
var element = _ref.element, type = _ref.type, handler = _ref.handler; | ||
/* istanbul ignore next */ | ||
element === null || element === void 0 ? void 0 : element.removeEventListener(type, handler); | ||
}); | ||
eventListeners = []; | ||
}; | ||
var shouldTrackEvent = function (actionType, element) { | ||
var _a, _b, _c; | ||
/* istanbul ignore if */ | ||
if (!element) { | ||
return false; | ||
} | ||
// Create observables on events on the window | ||
var createObservables = function () { | ||
var _a; | ||
// Create Observables from direct user events | ||
var clickObservable = fromEvent(document, 'click', { capture: true }).pipe(map(function (click) { return addAdditionalEventProperties(click, 'click'); })); | ||
var changeObservable = fromEvent(document, 'change', { capture: true }).pipe(map(function (change) { return addAdditionalEventProperties(change, 'change'); })); | ||
// Create Observable from unhandled errors | ||
// const errorObservable = fromEvent<ErrorEvent>(window, 'error').pipe( | ||
// map((error) => addAdditionalEventProperties(error, 'error')), | ||
// ); | ||
// Create observable for URL changes | ||
var navigateObservable; | ||
/* istanbul ignore next */ | ||
var tag = (_b = (_a = element === null || element === void 0 ? void 0 : element.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
// Text nodes have no tag | ||
if (!tag) { | ||
return false; | ||
if (window.navigation) { | ||
navigateObservable = fromEvent(window.navigation, 'navigate').pipe(map(function (navigate) { return addAdditionalEventProperties(navigate, 'navigate'); })); | ||
} | ||
if (shouldTrackEventResolver) { | ||
return shouldTrackEventResolver(actionType, element); | ||
} | ||
if (!isPageUrlAllowed(window.location.href, pageUrlAllowlist)) { | ||
return false; | ||
} | ||
/* istanbul ignore next */ | ||
var elementType = (element === null || element === void 0 ? void 0 : element.type) || ''; | ||
if (typeof elementType === 'string') { | ||
switch (elementType.toLowerCase()) { | ||
case 'hidden': | ||
return false; | ||
case 'password': | ||
return false; | ||
} | ||
} | ||
/* istanbul ignore if */ | ||
if (cssSelectorAllowlist) { | ||
var hasMatchAnyAllowedSelector = cssSelectorAllowlist.some(function (selector) { var _a; return !!((_a = element === null || element === void 0 ? void 0 : element.matches) === null || _a === void 0 ? void 0 : _a.call(element, selector)); }); | ||
if (!hasMatchAnyAllowedSelector) { | ||
return false; | ||
} | ||
} | ||
switch (tag) { | ||
case 'input': | ||
case 'select': | ||
case 'textarea': | ||
return actionType === 'change' || actionType === 'click'; | ||
default: { | ||
/* istanbul ignore next */ | ||
var computedStyle = (_c = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _c === void 0 ? void 0 : _c.call(window, element); | ||
/* istanbul ignore next */ | ||
if (computedStyle && computedStyle.getPropertyValue('cursor') === 'pointer' && actionType === 'click') { | ||
return true; | ||
} | ||
return actionType === 'click'; | ||
} | ||
} | ||
// Track DOM Mutations | ||
var mutationObservable = new Observable(function (observer) { | ||
var mutationObserver = new MutationObserver(function (mutations) { | ||
observer.next(mutations); | ||
}); | ||
mutationObserver.observe(document.body, { | ||
childList: true, | ||
attributes: true, | ||
characterData: true, | ||
subtree: true, | ||
}); | ||
return function () { return mutationObserver.disconnect(); }; | ||
}).pipe(map(function (mutation) { return addAdditionalEventProperties(mutation, 'mutation'); })); | ||
return _a = {}, | ||
_a[ObservablesEnum.ClickObservable] = clickObservable, | ||
_a[ObservablesEnum.ChangeObservable] = changeObservable, | ||
// [ObservablesEnum.ErrorObservable]: errorObservable, | ||
_a[ObservablesEnum.NavigateObservable] = navigateObservable, | ||
_a[ObservablesEnum.MutationObservable] = mutationObservable, | ||
_a; | ||
}; | ||
@@ -131,4 +121,21 @@ // Returns the Amplitude event properties for the given element. | ||
}; | ||
var addAdditionalEventProperties = function (event, type) { | ||
var baseEvent = { | ||
event: event, | ||
timestamp: Date.now(), | ||
type: type, | ||
}; | ||
if (isElementBasedEvent(baseEvent) && baseEvent.event.target !== null) { | ||
// Retrieve additional event properties from the target element | ||
var closestTrackedAncestor = getClosestElement(baseEvent.event.target, options.cssSelectorAllowlist); | ||
if (closestTrackedAncestor) { | ||
baseEvent.closestTrackedAncestor = closestTrackedAncestor; | ||
baseEvent.targetElementProperties = getEventProperties(baseEvent.type, closestTrackedAncestor); | ||
} | ||
return baseEvent; | ||
} | ||
return baseEvent; | ||
}; | ||
var setup = function (config, amplitude) { return __awaiter(void 0, void 0, void 0, function () { | ||
var addListener, attachListeners; | ||
var shouldTrackEvent, shouldTrackActionClick, allObservables, clickTrackingSubscription, changeSubscription, actionClickSubscription, allowlist, actionClickAllowlist; | ||
var _a, _b, _c; | ||
@@ -146,57 +153,28 @@ return __generator(this, function (_d) { | ||
} | ||
addListener = function (el) { | ||
if (shouldTrackEvent('click', el)) { | ||
addEventListener(el, 'click', function (event) { | ||
// Limit to only the innermost element that matches the selectors, avoiding all propagated event after matching. | ||
/* istanbul ignore next */ | ||
if ((event === null || event === void 0 ? void 0 : event.target) != (event === null || event === void 0 ? void 0 : event.currentTarget) && | ||
getClosestElement(event === null || event === void 0 ? void 0 : event.target, cssSelectorAllowlist) != (event === null || event === void 0 ? void 0 : event.currentTarget)) { | ||
return; | ||
} | ||
/* istanbul ignore next */ | ||
amplitude === null || amplitude === void 0 ? void 0 : amplitude.track(constants.AMPLITUDE_ELEMENT_CLICKED_EVENT, getEventProperties('click', el)); | ||
}); | ||
} | ||
if (shouldTrackEvent('change', el)) { | ||
addEventListener(el, 'change', function (event) { | ||
// Limit to only the innermost element that matches the selectors, avoiding all propagated event after matching. | ||
/* istanbul ignore next */ | ||
if ((event === null || event === void 0 ? void 0 : event.target) != (event === null || event === void 0 ? void 0 : event.currentTarget) && | ||
getClosestElement(event === null || event === void 0 ? void 0 : event.target, cssSelectorAllowlist) != (event === null || event === void 0 ? void 0 : event.currentTarget)) { | ||
return; | ||
} | ||
/* istanbul ignore next */ | ||
amplitude === null || amplitude === void 0 ? void 0 : amplitude.track(constants.AMPLITUDE_ELEMENT_CHANGED_EVENT, getEventProperties('change', el)); | ||
}); | ||
} | ||
}; | ||
if (typeof MutationObserver !== 'undefined') { | ||
observer = new MutationObserver(function (mutations) { | ||
mutations.forEach(function (mutation) { | ||
mutation.addedNodes.forEach(function (node) { | ||
addListener(node); | ||
if ('querySelectorAll' in node && typeof node.querySelectorAll === 'function') { | ||
querySelectUniqueElements(node, cssSelectorAllowlist).map(addListener); | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
attachListeners = function () { | ||
var allElements = querySelectUniqueElements(document.body, cssSelectorAllowlist); | ||
allElements.forEach(addListener); | ||
/* istanbul ignore next */ | ||
observer === null || observer === void 0 ? void 0 : observer.observe(document.body, { | ||
subtree: true, | ||
childList: true, | ||
}); | ||
}; | ||
if (document.body) { | ||
attachListeners(); | ||
} | ||
else { | ||
// This is to handle the case where the plugin is loaded before the body is available. | ||
// E.g., for non-reactive frameworks. | ||
window.addEventListener('load', attachListeners); | ||
} | ||
shouldTrackEvent = createShouldTrackEvent(options, options.cssSelectorAllowlist); | ||
shouldTrackActionClick = createShouldTrackEvent(options, options.actionClickAllowlist); | ||
allObservables = createObservables(); | ||
clickTrackingSubscription = trackClicks({ | ||
allObservables: allObservables, | ||
options: options, | ||
amplitude: amplitude, | ||
shouldTrackEvent: shouldTrackEvent, | ||
}); | ||
subscriptions.push(clickTrackingSubscription); | ||
changeSubscription = trackChange({ | ||
allObservables: allObservables, | ||
getEventProperties: getEventProperties, | ||
amplitude: amplitude, | ||
shouldTrackEvent: shouldTrackEvent, | ||
}); | ||
subscriptions.push(changeSubscription); | ||
actionClickSubscription = trackActionClick({ | ||
allObservables: allObservables, | ||
options: options, | ||
getEventProperties: getEventProperties, | ||
amplitude: amplitude, | ||
shouldTrackEvent: shouldTrackEvent, | ||
shouldTrackActionClick: shouldTrackActionClick, | ||
}); | ||
subscriptions.push(actionClickSubscription); | ||
/* istanbul ignore next */ | ||
@@ -206,4 +184,6 @@ (_b = config === null || config === void 0 ? void 0 : config.loggerProvider) === null || _b === void 0 ? void 0 : _b.log("".concat(name, " has been successfully added.")); | ||
if (window.opener && visualTaggingOptions.enabled) { | ||
allowlist = options.cssSelectorAllowlist; | ||
actionClickAllowlist = options.actionClickAllowlist; | ||
/* istanbul ignore next */ | ||
(_c = visualTaggingOptions.messenger) === null || _c === void 0 ? void 0 : _c.setup(__assign(__assign({ logger: config === null || config === void 0 ? void 0 : config.loggerProvider }, ((config === null || config === void 0 ? void 0 : config.serverZone) && { endpoint: constants.AMPLITUDE_ORIGINS_MAP[config.serverZone] })), { isElementSelectable: shouldTrackEvent })); | ||
(_c = visualTaggingOptions.messenger) === null || _c === void 0 ? void 0 : _c.setup(__assign(__assign({ logger: config === null || config === void 0 ? void 0 : config.loggerProvider }, ((config === null || config === void 0 ? void 0 : config.serverZone) && { endpoint: constants.AMPLITUDE_ORIGINS_MAP[config.serverZone] })), { isElementSelectable: createShouldTrackEvent(options, __spreadArray(__spreadArray([], __read(allowlist), false), __read(actionClickAllowlist), false)), cssSelectorAllowlist: allowlist, actionClickAllowlist: actionClickAllowlist })); | ||
} | ||
@@ -219,7 +199,18 @@ return [2 /*return*/]; | ||
var teardown = function () { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (observer) { | ||
observer.disconnect(); | ||
var subscriptions_1, subscriptions_1_1, subscription; | ||
var e_1, _a; | ||
return __generator(this, function (_b) { | ||
try { | ||
for (subscriptions_1 = __values(subscriptions), subscriptions_1_1 = subscriptions_1.next(); !subscriptions_1_1.done; subscriptions_1_1 = subscriptions_1.next()) { | ||
subscription = subscriptions_1_1.value; | ||
subscription.unsubscribe(); | ||
} | ||
} | ||
removeEventListeners(); | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (subscriptions_1_1 && !subscriptions_1_1.done && (_a = subscriptions_1.return)) _a.call(subscriptions_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return [2 /*return*/]; | ||
@@ -226,0 +217,0 @@ }); |
import { Logger } from '@amplitude/analytics-types'; | ||
import { AutocaptureOptions, ElementBasedEvent, ElementBasedTimestampedEvent } from './autocapture-plugin'; | ||
import { ActionType } from './typings/autocapture'; | ||
export type JSONValue = string | number | boolean | null | { | ||
[x: string]: JSONValue; | ||
} | Array<JSONValue>; | ||
export type shouldTrackEvent = (actionType: ActionType, element: Element) => boolean; | ||
export declare const createShouldTrackEvent: (autocaptureOptions: AutocaptureOptions, allowlist: string[]) => shouldTrackEvent; | ||
export declare const isNonSensitiveString: (text: string | null) => boolean; | ||
@@ -28,2 +32,3 @@ export declare const isTextNode: (node: Node) => boolean; | ||
export declare function generateUniqueId(): string; | ||
export declare const filterOutNonTrackableEvents: (event: ElementBasedTimestampedEvent<ElementBasedEvent>) => boolean; | ||
//# sourceMappingURL=helpers.d.ts.map |
@@ -5,2 +5,52 @@ /* eslint-disable no-restricted-globals */ | ||
var SENSITIVE_TAGS = ['input', 'select', 'textarea']; | ||
export var createShouldTrackEvent = function (autocaptureOptions, allowlist) { | ||
return function (actionType, element) { | ||
var _a, _b, _c; | ||
var pageUrlAllowlist = autocaptureOptions.pageUrlAllowlist, shouldTrackEventResolver = autocaptureOptions.shouldTrackEventResolver; | ||
/* istanbul ignore next */ | ||
var tag = (_b = (_a = element === null || element === void 0 ? void 0 : element.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
// window, document, and Text nodes have no tag | ||
if (!tag) { | ||
return false; | ||
} | ||
if (shouldTrackEventResolver) { | ||
return shouldTrackEventResolver(actionType, element); | ||
} | ||
if (!isPageUrlAllowed(window.location.href, pageUrlAllowlist)) { | ||
return false; | ||
} | ||
/* istanbul ignore next */ | ||
var elementType = (element === null || element === void 0 ? void 0 : element.type) || ''; | ||
if (typeof elementType === 'string') { | ||
switch (elementType.toLowerCase()) { | ||
case 'hidden': | ||
return false; | ||
case 'password': | ||
return false; | ||
} | ||
} | ||
/* istanbul ignore if */ | ||
if (allowlist) { | ||
var hasMatchAnyAllowedSelector = allowlist.some(function (selector) { var _a; return !!((_a = element === null || element === void 0 ? void 0 : element.matches) === null || _a === void 0 ? void 0 : _a.call(element, selector)); }); | ||
if (!hasMatchAnyAllowedSelector) { | ||
return false; | ||
} | ||
} | ||
switch (tag) { | ||
case 'input': | ||
case 'select': | ||
case 'textarea': | ||
return actionType === 'change' || actionType === 'click'; | ||
default: { | ||
/* istanbul ignore next */ | ||
var computedStyle = (_c = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _c === void 0 ? void 0 : _c.call(window, element); | ||
/* istanbul ignore next */ | ||
if (computedStyle && computedStyle.getPropertyValue('cursor') === 'pointer' && actionType === 'click') { | ||
return true; | ||
} | ||
return actionType === 'click'; | ||
} | ||
} | ||
}; | ||
}; | ||
export var isNonSensitiveString = function (text) { | ||
@@ -26,6 +76,6 @@ if (text == null) { | ||
export var isNonSensitiveElement = function (element) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
/* istanbul ignore next */ | ||
var tag = (_b = (_a = element === null || element === void 0 ? void 0 : element.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
var isContentEditable = element.getAttribute('contenteditable') === 'true'; | ||
var isContentEditable = element instanceof HTMLElement ? ((_c = element.getAttribute('contenteditable')) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'true' : false; | ||
return !SENSITIVE_TAGS.includes(tag) && !isContentEditable; | ||
@@ -218,2 +268,10 @@ }; | ||
} | ||
export var filterOutNonTrackableEvents = function (event) { | ||
// Filter out changeEvent events with no target | ||
// This could happen when change events are triggered programmatically | ||
if (event.event.target === null || !event.closestTrackedAncestor) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
//# sourceMappingURL=helpers.js.map |
@@ -59,6 +59,8 @@ import { Logger } from '@amplitude/analytics-types'; | ||
private handleResponse; | ||
setup({ logger, endpoint, isElementSelectable, }?: { | ||
setup({ logger, endpoint, isElementSelectable, cssSelectorAllowlist, actionClickAllowlist, }?: { | ||
logger?: Logger; | ||
endpoint?: string; | ||
isElementSelectable?: (action: InitializeVisualTaggingSelectorData['actionType'], element: Element) => boolean; | ||
cssSelectorAllowlist?: string[]; | ||
actionClickAllowlist?: string[]; | ||
}): void; | ||
@@ -65,0 +67,0 @@ private onSelect; |
@@ -68,3 +68,3 @@ /* istanbul ignore file */ | ||
var _this = this; | ||
var _b = _a === void 0 ? {} : _a, logger = _b.logger, endpoint = _b.endpoint, isElementSelectable = _b.isElementSelectable; | ||
var _b = _a === void 0 ? {} : _a, logger = _b.logger, endpoint = _b.endpoint, isElementSelectable = _b.isElementSelectable, cssSelectorAllowlist = _b.cssSelectorAllowlist, actionClickAllowlist = _b.actionClickAllowlist; | ||
this.logger = logger; | ||
@@ -118,2 +118,4 @@ // If endpoint is customized, don't override it. | ||
messenger: _this, | ||
cssSelectorAllowlist: cssSelectorAllowlist, | ||
actionClickAllowlist: actionClickAllowlist, | ||
}); | ||
@@ -120,0 +122,0 @@ _this.notify({ action: 'selector-loaded' }); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.0.0-beta.1"; | ||
export declare const VERSION = "1.0.0-beta.2"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export var VERSION = '1.0.0-beta.1'; | ||
export var VERSION = '1.0.0-beta.2'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,1 +0,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 o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function l(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(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,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function o(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 i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)l.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return l}function l(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var a,u,c="[Amplitude] Element Tag",s="[Amplitude] Element Text",d="[Amplitude] Element Selector",f="[Amplitude] Page URL",v="https://app.amplitude.com",p={US:v,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},g="amp-visual-tagging-selector-highlight";function h(e,n){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};a=t(t({},r),n),u=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(a.root,r);var o=m(e,"all",(function(){return m(e,"two",(function(){return m(e,"one",(function(){return m(e,"none")}))}))}));if(o){var i=C(L(o,e));return i.length>0&&(o=i[0]),w(o)}throw new Error("Selector was not found.")}function m(e,t,n){for(var r=null,u=[],c=e,s=0,d=function(){var e,d,f=N(function(e){var t=e.getAttribute("id");if(t&&a.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(c))||N.apply(void 0,l([],i(function(e){var t=Array.from(e.attributes).filter((function(e){return a.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(c)),!1))||N.apply(void 0,l([],i(function(e){var t=Array.from(e.classList).filter(a.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(c)),!1))||N(function(e){var t=e.tagName.toLowerCase();if(a.tagName(t))return{name:t,penalty:2};return null}(c))||[{name:"*",penalty:3}],v=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(c);if("all"==t)v&&(f=f.concat(f.filter(S).map((function(e){return A(e,v)}))));else if("two"==t)f=f.slice(0,1),v&&(f=f.concat(f.filter(S).map((function(e){return A(e,v)}))));else if("one"==t){var p=i(f=f.slice(0,1),1)[0];v&&S(p)&&(f=[A(p,v)])}else"none"==t&&(f=[{name:"*",penalty:3}],v&&(f=[A(f[0],v)]));try{for(var g=(e=void 0,o(f)),h=g.next();!h.done;h=g.next()){(p=h.value).level=s}}catch(t){e={error:t}}finally{try{h&&!h.done&&(d=g.return)&&d.call(g)}finally{if(e)throw e.error}}if(u.push(f),u.length>=a.seedMinLength&&(r=y(u,n)))return"break";c=c.parentElement,s++};c;){if("break"===d())break}return r||(r=y(u,n)),!r&&n?n():r}function y(e,t){var n,r,i=C(T(e));if(i.length>a.threshold)return t?t():null;try{for(var l=o(i),u=l.next();!u.done;u=l.next()){var c=u.value;if(E(c))return c}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}function w(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var o=e[r].level||0;n=t.level===o-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function b(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function E(e){var t=w(e);switch(u.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function A(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function S(e){return"html"!==e.name&&!e.name.startsWith("#")}function N(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(k);return n.length>0?n:null}function k(e){return null!=e}function T(e,t){var n,i,l,a,u,c;return void 0===t&&(t=[]),r(this,(function(r){switch(r.label){case 0:if(!(e.length>0))return[3,9];r.label=1;case 1:r.trys.push([1,6,7,8]),n=o(e[0]),i=n.next(),r.label=2;case 2:return i.done?[3,5]:(l=i.value,[5,o(T(e.slice(1,e.length),t.concat(l)))]);case 3:r.sent(),r.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return a=r.sent(),u={error:a},[3,8];case 7:try{i&&!i.done&&(c=n.return)&&c.call(n)}finally{if(u)throw u.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:r.sent(),r.label=11;case 11:return[2]}}))}function C(e){return l([],i(e),!1).sort((function(e,t){return b(e)-b(t)}))}function L(e,t,n){var c,s,d;return void 0===n&&(n={counter:0,visited:new Map}),r(this,(function(r){switch(r.label){case 0:if(!(e.length>2&&e.length>a.optimizedMinLength))return[3,5];c=1,r.label=1;case 1:return c<e.length-1?n.counter>a.maxNumberOfTries?[2]:(n.counter+=1,(s=l([],i(e),!1)).splice(c,1),d=w(s),n.visited.has(d)?[2]:E(s)&&function(e,t){return u.querySelector(w(e))===t}(s,t)?[4,s]:[3,4]):[3,5];case 2:return r.sent(),n.visited.set(d,!0),[5,o(L(s,t,n))];case 3:r.sent(),r.label=4;case 4:return c++,[3,1];case 5:return[2]}}))}var x=["input","select","textarea"],O=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},M=function(e){var t,n,r=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="true"===e.getAttribute("contenteditable");return!x.includes(r)&&!o},P=function(e){var t="";return M(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=P(e),t+=r.split(/(\s+)/).filter(O).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},q=function(e,t){var n,r,o="";try{return o=h(e,{className:function(e){return e!==g}})}catch(e){if(t){var i=e;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(i.toString()))}}var l=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);if(l&&(o=l),e.id)o="#".concat(e.id);else if(e.className){var a=e.className.split(" ").filter((function(e){return e!==g})).join(".");a&&(o="".concat(o,".").concat(a))}return o},j=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}),{})},R=function(e){var t=e.parentElement;if(!t)return"";var n=t.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return O(r)?r:""}return R(t)},D=function(e,t){if(e&&"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var n=t.reduce((function(t,n){n&&Array.from(e.querySelectorAll(n)).forEach((function(e){t.add(e)}));return t}),new Set);return Array.from(n)}return[]},_=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:_(null==e?void 0:e.parentElement,t):null},U=function(e,t){var n,r,o;if(!e)return{};var i=null===(o=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l=q(e,t),a=((n={})[c]=i,n[s]=P(e),n[d]=l,n[f]=window.location.href.split("?")[0],n);return j(a)};var F=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?v:t,r=this;this.endpoint=v,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,o;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===(o=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===o||o.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var o="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),i={id:o,action:e,args:t};return new Promise((function(t,l){r.requestCallbacks[o]={resolve:t,reject:l},r.notify(i),(null==n?void 0:n.timeout)>0&&setTimeout((function(){l(new Error("".concat(e," timed out (id: ").concat(o,")"))),delete r.requestCallbacks[o]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,o=n.endpoint,i=n.isElementSelectable;this.logger=r,o&&this.endpoint===v&&(this.endpoint=o);var l=null;window.addEventListener("message",(function(e){var n,r,o,a,u;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var c,s=null==e?void 0:e.data,d=null==s?void 0:s.action;if(d)if("id"in s)null===(a=null===(o=t.logger)||void 0===o?void 0:o.debug)||void 0===a||a.call(o,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(s);else if("ping"===d)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===d){var f=null==s?void 0:s.data;(c="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=c,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(c)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;l=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:U,isElementSelectable:function(e){return!i||i((null==f?void 0:f.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:g,messenger:t}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===d&&(null===(u=null==l?void 0:l.close)||void 0===u||u.call(l))}})),this.notify({action:"page-loaded"})},e}(),H=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],W=["type"],z=["svg","path","g"],I=["password","hidden"];var V=function(e){var t;return e?(t=function(e,t){for(var n=0,r=0;r<e.length;r++){var o=e[r];if(null===o)n+=4;else{var i=B(o);n+=i?Array.from(i).length:4}if(n>t)return e.slice(0,r)}return e}(function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e).map((function(e){return function(e){var t,n,r,i,l,a;if(null===e)return null;var u=e.tagName.toLowerCase(),c={tag:u},s=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);s.length&&(c.index=s.indexOf(e),c.indexOfType=s.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var d=null===(a=null===(l=e.previousElementSibling)||void 0===l?void 0:l.tagName)||void 0===a?void 0:a.toLowerCase();d&&(c.prevSib=d);var f=e.id;f&&(c.id=f);var v=Array.from(e.classList);v.length&&(c.classes=v);var p={},g=Array.from(e.attributes).filter((function(e){return!H.includes(e.name)})),h=!M(e);if(!I.includes(e.type)&&!z.includes(u))try{for(var m=o(g),y=m.next();!y.done;y=m.next()){var w=y.value;h&&!W.includes(w.name)||(p[w.name]=String(w.value).substring(0,128))}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}return Object.keys(p).length&&(c.attrs=p),c}(e)})),1024),t):[]};function B(e,t){void 0===t&&(t=!1);try{if(null==e)return t?"None":null;if("string"==typeof e)return t?(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(e,"'"):e.includes("'")?'"'.concat(e.replace(/'/g,"\\'"),'"'):"'".concat(e,"'"):e;if("boolean"==typeof e)return e?"True":"False";if(Array.isArray(e)){var n=e.map((function(e){return B(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=i(e,1)[0]})).map((function(e){var t=i(e,2),n=t[0],r=t[1];return"".concat(String(B(n,!0)),": ").concat(String(B(r,!0)))})),o="{".concat(r.join(", "),"}");return o.includes("\\'")&&(o=o.replace(/'/g,"'").replace(/'/g,"\\'")),o}return e.toString()}catch(e){return null}}var G=["a","button","input","select","textarea","label","[data-amp-default-track]",".amp-default-track"],J="data-amp-track-",Z=function(e){void 0===e&&(e={});var o,i=e.cssSelectorAllowlist,l=void 0===i?G:i,a=e.pageUrlAllowlist,u=e.shouldTrackEventResolver,v=e.dataAttributePrefix,g=void 0===v?J:v,h=e.visualTaggingOptions,m=void 0===h?{enabled:!0,messenger:new F}:h,y="@amplitude/plugin-autocapture-browser",w=[],b=void 0,E=function(e,t,n){e.addEventListener(t,n),w.push({element:e,type:t,handler:n})},A=function(e,t){var n,r,o;if(!t)return!1;var i=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(!i)return!1;if(u)return u(e,t);if(!function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(window.location.href,a))return!1;var c=(null==t?void 0:t.type)||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}if(l){var s=l.some((function(e){var n;return!!(null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e))}));if(!s)return!1}switch(i){case"input":case"select":case"textarea":return"change"===e||"click"===e;default:var d=null===(o=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===o?void 0:o.call(window,t);return!(!d||"pointer"!==d.getPropertyValue("cursor")||"click"!==e)||"click"===e}},S=function(e,t){var n,r,o,i=null===(o=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),u=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var o=r.replace(t,""),i=e.getAttribute(r);o&&(n[o]=i||"")}return n}),{})}(t,g),v=R(t),p=q(t,b),h=((n={})["[Amplitude] Element ID"]=t.id,n["[Amplitude] Element Class"]=t.className,n["[Amplitude] Element Hierarchy"]=V(t),n[c]=i,n[s]=P(t),n["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),n["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),n["[Amplitude] Element Aria Label"]=a,n["[Amplitude] Element Attributes"]=u,n[d]=p,n["[Amplitude] Element Parent Label"]=v,n[f]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===i&&"click"===e&&t instanceof HTMLAnchorElement&&(h["[Amplitude] Element Href"]=t.href),j(h)};return{name:y,type:"enrichment",setup:function(e,i){return n(void 0,void 0,void 0,(function(){var n,a,u,c,s;return r(this,(function(r){return i?(b=e.loggerProvider,"undefined"==typeof document||(n=function(e){A("click",e)&&E(e,"click",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&_(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Clicked",S("click",e))})),A("change",e)&&E(e,"change",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&_(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Changed",S("change",e))}))},"undefined"!=typeof MutationObserver&&(o=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&D(e,l).map(n)}))}))}))),a=function(){D(document.body,l).forEach(n),null==o||o.observe(document.body,{subtree:!0,childList:!0})},document.body?a():window.addEventListener("load",a),null===(c=null==e?void 0:e.loggerProvider)||void 0===c||c.log("".concat(y," has been successfully added.")),window.opener&&m.enabled&&(null===(s=m.messenger)||void 0===s||s.setup(t(t({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:p[e.serverZone]}),{isElementSelectable:A})))),[2]):(null===(u=null==e?void 0:e.loggerProvider)||void 0===u||u.warn("".concat(y," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[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(){return r(this,(function(e){return o&&o.disconnect(),w.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),w=[],[2]}))}))}}};return e.DEFAULT_CSS_SELECTOR_ALLOWLIST=G,e.DEFAULT_DATA_ATTRIBUTE_PREFIX=J,e.WindowMessenger=F,e.autocapturePlugin=Z,e.plugin=Z,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
var amplitudeAutocapturePlugin=function(t){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function i(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{l(r.next(t))}catch(t){o(t)}}function c(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}l((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(l){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,l])}}}function u(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)u.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return u}function l(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function s(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r={},u("next"),u("throw"),u("return"),r[Symbol.asyncIterator]=function(){return this},r;function u(t){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||c(t,e)}))})}function c(t,e){try{(n=i[t](e)).value instanceof a?Promise.resolve(n.value.v).then(l,s):f(o[0][2],n)}catch(t){f(o[0][3],t)}var n}function l(t){c("next",t)}function s(t){c("throw",t)}function f(t,e){t(e),o.shift(),o.length&&c(o[0][0],o[0][1])}}function f(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=u(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,i,(e=t[n](e)).done,e.value)}))}}}var d="[Amplitude] Element Clicked",h="[Amplitude] Element Tag",p="[Amplitude] Element Text",v="[Amplitude] Element Selector",y="[Amplitude] Page URL",b="https://app.amplitude.com",m={US:b,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},g="amp-visual-tagging-selector-highlight";function w(t){return"function"==typeof t}function _(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var x=_((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function A(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var E=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=u(o),s=a.next();!s.done;s=a.next()){s.value.remove(this)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var f=this.initialTeardown;if(w(f))try{f()}catch(t){i=t instanceof x?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var h=u(d),p=h.next();!p.done;p=h.next()){var v=p.value;try{T(v)}catch(t){i=null!=i?i:[],t instanceof x?i=l(l([],c(i)),c(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}}if(i)throw new x(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)T(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&A(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&A(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),S=E.EMPTY;function k(t){return t instanceof E||t&&"closed"in t&&w(t.remove)&&w(t.add)&&w(t.unsubscribe)}function T(t){w(t)?t():t.unsubscribe()}var C={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},O=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,l([t,e],c(n)))};function N(t){O((function(){throw t}))}function P(){}function I(t){t()}var L=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,k(e)&&e.add(n)):n.destination=R,n}return n(e,t),e.create=function(t,e,n){return new q(t,e,n)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(E),j=Function.prototype.bind;function F(t,e){return j.call(t,e)}var M=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){z(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){z(t)}else z(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){z(t)}},t}(),q=function(t){function e(e,n,r){var i,o,u=t.call(this)||this;w(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:u&&C.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return u.unsubscribe()},i={next:e.next&&F(e.next,o),error:e.error&&F(e.error,o),complete:e.complete&&F(e.complete,o)}):i=e;return u.destination=new M(i),u}return n(e,t),e}(L);function z(t){N(t)}var R={closed:!0,next:P,error:function(t){throw t},complete:P},D="function"==typeof Symbol&&Symbol.observable||"@@observable";function U(t){return t}function V(t){return 0===t.length?U:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var W=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,o=(r=t)&&r instanceof L||function(t){return t&&w(t.next)&&w(t.error)&&w(t.complete)}(r)&&k(r)?t:new q(t,e,n);return I((function(){var t=i,e=t.operator,n=t.source;o.add(e?e.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=H(e))((function(e,r){var i=new q({next:function(e){try{t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[D]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return V(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=H(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function H(t){var e;return null!==(e=null!=t?t:C.Promise)&&void 0!==e?e:Promise}function Y(t){return w(null==t?void 0:t.lift)}function B(t){return function(e){if(Y(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function X(t,e,n,r,i){return new G(t,e,n,r,i)}var G=function(t){function e(e,n,r,i,o,u){var c=t.call(this,e)||this;return c.onFinalize=o,c.shouldUnsubscribe=u,c._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,c._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return n(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(L);!function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,Y(e)&&(r.lift=e.lift),r}n(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,null==t||t.unsubscribe()},e.prototype.connect=function(){var t=this,e=this._connection;if(!e){e=this._connection=new E;var n=this.getSubject();e.add(this.source.subscribe(X(n,void 0,(function(){t._teardown(),n.complete()}),(function(e){t._teardown(),n.error(e)}),(function(){return t._teardown()})))),e.closed&&(this._connection=null,e=E.EMPTY)}return e},e.prototype.refCount=function(){return B((function(t,e){var n=null;t._refCount++;var r=X(e,void 0,void 0,void 0,(function(){if(!t||t._refCount<=0||0<--t._refCount)n=null;else{var r=t._connection,i=n;n=null,!r||i&&r!==i||r.unsubscribe(),e.unsubscribe()}}));t.subscribe(r),r.closed||(n=t.connect())}))(this)}}(W);var J,Z={now:function(){return(Z.delegate||performance).now()},delegate:void 0},$={schedule:function(t){var e=requestAnimationFrame,n=cancelAnimationFrame,r=e((function(e){n=void 0,t(e)}));return new E((function(){return null==n?void 0:n(r)}))},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=$.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,l([],c(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,l([],c(t)))},delegate:void 0};new W((function(t){var e=J||Z,n=e.now(),r=0,i=function(){t.closed||(r=$.requestAnimationFrame((function(o){r=0;var u=e.now();t.next({timestamp:J?u:o,elapsed:u-n}),i()})))};return i(),function(){r&&$.cancelAnimationFrame(r)}}));var K=_((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Q=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return n(e,t),e.prototype.lift=function(t){var e=new tt(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new K},e.prototype.next=function(t){var e=this;I((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=u(e.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(t)}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},e.prototype.error=function(t){var e=this;I((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}}))},e.prototype.complete=function(){var t=this;I((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?S:(this.currentObservers=null,o.push(t),new E((function(){e.currentObservers=null,A(o,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new W;return t.source=this,t},e.create=function(t,e){return new tt(t,e)},e}(W),tt=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return n(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:S},e}(Q);!function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)}}(Q);var et={now:function(){return(et.delegate||Date).now()},delegate:void 0};!function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=et);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}n(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,u=n._timestampProvider,c=n._windowTime;r||(i.push(e),!o&&i.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var u=n.now(),c=0,l=1;l<r.length&&r[l]<=u;l+=2)c=l;c&&r.splice(0,c+1)}}}(Q),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._value=null,e._hasValue=!1,e._isComplete=!1,e}n(e,t),e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e._hasValue,i=e._value,o=e.thrownError,u=e.isStopped,c=e._isComplete;n?t.error(o):(u||c)&&(r&&t.next(i),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var e=this,n=e._hasValue,r=e._value;e._isComplete||(this._isComplete=!0,n&&t.prototype.next.call(this,r),t.prototype.complete.call(this))}}(Q);var nt,rt=function(t){function e(e,n){return t.call(this)||this}return n(e,t),e.prototype.schedule=function(t,e){return this},e}(E),it=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,l([t,e],c(n)))},ot=function(t){return clearInterval(t)},ut=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return n(e,t),e.prototype.schedule=function(t,e){var n;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,e)),this.pending=!0,this.delay=e,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),it(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;null!=e&&ot(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,A(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(rt),ct=1,lt={};function at(t){return t in lt&&(delete lt[t],!0)}var st=function(t){var e=ct++;return lt[e]=!0,nt||(nt=Promise.resolve()),nt.then((function(){return at(e)&&t()})),e},ft=function(t){at(t)},dt={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=dt.delegate;return((null==n?void 0:n.setImmediate)||st).apply(void 0,l([],c(t)))},clearImmediate:function(t){return ft(t)},delegate:void 0},ht=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=dt.setImmediate(e.flush.bind(e,void 0))))},e.prototype.recycleAsyncId=function(e,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);var o=e.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(dt.clearImmediate(n),e._scheduled===n&&(e._scheduled=void 0))},e}(ut),pt=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=et.now,t}(),vt=function(t){function e(e,n){void 0===n&&(n=pt.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return n(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(pt),yt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(vt);new yt(ht);var bt=new vt(ut),mt=bt,gt=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.flush(this),0)},e}(ut),wt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(vt);new wt(gt);var _t=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=$.requestAnimationFrame((function(){return e.flush(void 0)}))))},e.prototype.recycleAsyncId=function(e,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);var o=e.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&($.cancelAnimationFrame(n),e._scheduled=void 0)},e}(ut),xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(vt);new xt(_t),function(t){function e(e,n){void 0===e&&(e=At),void 0===n&&(n=1/0);var r=t.call(this,e,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}n(e,t),e.prototype.flush=function(){for(var t,e,n=this.actions,r=this.maxFrames;(e=n[0])&&e.delay<=r&&(n.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=n.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10}(vt);var At=function(t){function e(e,n,r){void 0===r&&(r=e.index+=1);var i=t.call(this,e,n)||this;return i.scheduler=e,i.work=n,i.index=r,i.active=!0,i.index=e.index=r,i}return n(e,t),e.prototype.schedule=function(n,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return t.prototype.schedule.call(this,n,r);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(n,r)}return E.EMPTY},e.prototype.requestAsyncId=function(t,n,r){void 0===r&&(r=0),this.delay=t.frame+r;var i=t.actions;return i.push(this),i.sort(e.sortActions),1},e.prototype.recycleAsyncId=function(t,e,n){},e.prototype._execute=function(e,n){if(!0===this.active)return t.prototype._execute.call(this,e,n)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(ut),Et=new W((function(t){return t.complete()}));function St(t){return t&&w(t.schedule)}function kt(t){return t[t.length-1]}function Tt(t){return St(kt(t))?t.pop():void 0}function Ct(t,e){return"number"==typeof kt(t)?t.pop():e}var Ot=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function Nt(t){return w(null==t?void 0:t.then)}function Pt(t){return w(t[D])}function It(t){return Symbol.asyncIterator&&w(null==t?void 0:t[Symbol.asyncIterator])}function Lt(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var jt,Ft="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Mt(t){return w(null==t?void 0:t[Ft])}function qt(t){return s(this,arguments,(function(){var e,n,r;return o(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,a(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,a(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,a(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}function zt(t){return w(null==t?void 0:t.getReader)}function Rt(t){if(t instanceof W)return t;if(null!=t){if(Pt(t))return i=t,new W((function(t){var e=i[D]();if(w(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Ot(t))return r=t,new W((function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()}));if(Nt(t))return n=t,new W((function(t){n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,N)}));if(It(t))return Dt(t);if(Mt(t))return e=t,new W((function(t){var n,r;try{for(var i=u(e),o=i.next();!o.done;o=i.next()){var c=o.value;if(t.next(c),t.closed)return}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()}));if(zt(t))return Dt(qt(t))}var e,n,r,i;throw Lt(t)}function Dt(t){return new W((function(e){(function(t,e){var n,r,u,c;return i(this,void 0,void 0,(function(){var i,l;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,11]),n=f(t),o.label=1;case 1:return[4,n.next()];case 2:if((r=o.sent()).done)return[3,4];if(i=r.value,e.next(i),e.closed)return[2];o.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=o.sent(),u={error:l},[3,11];case 6:return o.trys.push([6,,9,10]),r&&!r.done&&(c=n.return)?[4,c.call(n)]:[3,8];case 7:o.sent(),o.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))}))})(t,e).catch((function(t){return e.error(t)}))}))}function Ut(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=e.schedule((function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()}),r);if(t.add(o),!i)return o}function Vt(t,e){return void 0===e&&(e=0),B((function(n,r){n.subscribe(X(r,(function(n){return Ut(r,t,(function(){return r.next(n)}),e)}),(function(){return Ut(r,t,(function(){return r.complete()}),e)}),(function(n){return Ut(r,t,(function(){return r.error(n)}),e)})))}))}function Wt(t,e){return void 0===e&&(e=0),B((function(n,r){r.add(t.schedule((function(){return n.subscribe(r)}),e))}))}function Ht(t,e){if(!t)throw new Error("Iterable cannot be null");return new W((function(n){Ut(n,e,(function(){var r=t[Symbol.asyncIterator]();Ut(n,e,(function(){r.next().then((function(t){t.done?n.complete():n.next(t.value)}))}),0,!0)}))}))}function Yt(t,e){if(null!=t){if(Pt(t))return function(t,e){return Rt(t).pipe(Wt(e),Vt(e))}(t,e);if(Ot(t))return function(t,e){return new W((function(n){var r=0;return e.schedule((function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())}))}))}(t,e);if(Nt(t))return function(t,e){return Rt(t).pipe(Wt(e),Vt(e))}(t,e);if(It(t))return Ht(t,e);if(Mt(t))return function(t,e){return new W((function(n){var r;return Ut(n,e,(function(){r=t[Ft](),Ut(n,e,(function(){var t,e,i;try{e=(t=r.next()).value,i=t.done}catch(t){return void n.error(t)}i?n.complete():n.next(e)}),0,!0)})),function(){return w(null==r?void 0:r.return)&&r.return()}}))}(t,e);if(zt(t))return function(t,e){return Ht(qt(t),e)}(t,e)}throw Lt(t)}function Bt(t,e){return e?Yt(t,e):Rt(t)}function Xt(t){return t instanceof Date&&!isNaN(t)}!function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"}(jt||(jt={})),_((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}})),_((function(t){return function(){t(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),_((function(t){return function(e){t(this),this.name="NotFoundError",this.message=e}})),_((function(t){return function(e){t(this),this.name="SequenceError",this.message=e}}));var Gt=_((function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}}));function Jt(t){throw new Gt(t)}function Zt(t,e){return B((function(n,r){var i=0;n.subscribe(X(r,(function(n){r.next(t.call(e,n,i++))})))}))}var $t=Array.isArray;function Kt(t){return Zt((function(e){return function(t,e){return $t(e)?t.apply(void 0,l([],c(e))):t(e)}(t,e)}))}function Qt(t,e,n){return void 0===n&&(n=1/0),w(e)?Qt((function(n,r){return Zt((function(t,i){return e(n,t,r,i)}))(Rt(t(n,r)))}),n):("number"==typeof e&&(n=e),B((function(e,r){return function(t,e,n,r,i,o,u,c){var l=[],a=0,s=0,f=!1,d=function(){!f||l.length||a||e.complete()},h=function(t){return a<r?p(t):l.push(t)},p=function(t){o&&e.next(t),a++;var c=!1;Rt(n(t,s++)).subscribe(X(e,(function(t){null==i||i(t),o?h(t):e.next(t)}),(function(){c=!0}),void 0,(function(){if(c)try{a--;for(var t=function(){var t=l.shift();u?Ut(e,u,(function(){return p(t)})):p(t)};l.length&&a<r;)t();d()}catch(t){e.error(t)}})))};return t.subscribe(X(e,h,(function(){f=!0,d()}))),function(){null==c||c()}}(e,r,t,n)})))}function te(t){return void 0===t&&(t=1/0),Qt(U,t)}function ee(){return te(1)}var ne,re,ie=["addListener","removeListener"],oe=["addEventListener","removeEventListener"],ue=["on","off"];function ce(t,e,n,r){if(w(n)&&(r=n,n=void 0),r)return ce(t,e,n).pipe(Kt(r));var i=c(function(t){return w(t.addEventListener)&&w(t.removeEventListener)}(t)?oe.map((function(r){return function(i){return t[r](e,i,n)}})):function(t){return w(t.addListener)&&w(t.removeListener)}(t)?ie.map(le(t,e)):function(t){return w(t.on)&&w(t.off)}(t)?ue.map(le(t,e)):[],2),o=i[0],u=i[1];if(!o&&Ot(t))return Qt((function(t){return ce(t,e,n)}))(Rt(t));if(!o)throw new TypeError("Invalid event target");return new W((function(t){var e=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.next(1<e.length?e:e[0])};return o(e),function(){return u(e)}}))}function le(t,e){return function(n){return function(r){return t[n](e,r)}}}function ae(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Tt(t),r=Ct(t,1/0),i=t;return i.length?1===i.length?Rt(i[0]):te(r)(Bt(i,n)):Et}function se(t,e){return B((function(n,r){var i=0;n.subscribe(X(r,(function(n){return t.call(e,n,i++)&&r.next(n)})))}))}function fe(t){return t<=0?function(){return Et}:B((function(e,n){var r=0;e.subscribe(X(n,(function(e){++r<=t&&(n.next(e),t<=r&&n.complete())})))}))}function de(t,e){return e?function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ee()(Bt(t,Tt(t)))}(e.pipe(fe(1),B((function(t,e){t.subscribe(X(e,P))}))),n.pipe(de(t)))}:Qt((function(e,n){return Rt(t(e,n)).pipe(fe(1),function(t){return Zt((function(){return t}))}(e))}))}function he(t,e){void 0===e&&(e=bt);var n=function(t,e,n){void 0===t&&(t=0),void 0===n&&(n=mt);var r=-1;return null!=e&&(St(e)?n=e:r=e),new W((function(e){var i=Xt(t)?+t-n.now():t;i<0&&(i=0);var o=0;return n.schedule((function(){e.closed||(e.next(o++),0<=r?this.schedule(void 0,r):e.complete())}),i)}))}(t,e);return de((function(){return n}))}function pe(t,e){if(t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===t.tagName.toLowerCase())return"html";var n={root:document.body,idName:function(t){return!0},className:function(t){return!0},tagName:function(t){return!0},attr:function(t,e){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};ne=r(r({},n),e),re=function(t,e){if(t.nodeType===Node.DOCUMENT_NODE)return t;if(t===e.root)return t.ownerDocument;return t}(ne.root,n);var i=ve(t,"all",(function(){return ve(t,"two",(function(){return ve(t,"one",(function(){return ve(t,"none")}))}))}));if(i){var o=Se(ke(i,t));return o.length>0&&(i=o[0]),be(i)}throw new Error("Selector was not found.")}function ve(t,e,n){for(var r=null,i=[],o=t,a=0,s=function(){var t,s,f=xe(function(t){var e=t.getAttribute("id");if(e&&ne.idName(e))return{name:"#"+CSS.escape(e),penalty:0};return null}(o))||xe.apply(void 0,l([],c(function(t){var e=Array.from(t.attributes).filter((function(t){return ne.attr(t.name,t.value)}));return e.map((function(t){return{name:"[".concat(CSS.escape(t.name),'="').concat(CSS.escape(t.value),'"]'),penalty:.5}}))}(o)),!1))||xe.apply(void 0,l([],c(function(t){var e=Array.from(t.classList).filter(ne.className);return e.map((function(t){return{name:"."+CSS.escape(t),penalty:1}}))}(o)),!1))||xe(function(t){var e=t.tagName.toLowerCase();if(ne.tagName(e))return{name:e,penalty:2};return null}(o))||[{name:"*",penalty:3}],d=function(t){var e=t.parentNode;if(!e)return null;var n=e.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==t);)n=n.nextSibling;return r}(o);if("all"==e)d&&(f=f.concat(f.filter(_e).map((function(t){return we(t,d)}))));else if("two"==e)f=f.slice(0,1),d&&(f=f.concat(f.filter(_e).map((function(t){return we(t,d)}))));else if("one"==e){var h=c(f=f.slice(0,1),1)[0];d&&_e(h)&&(f=[we(h,d)])}else"none"==e&&(f=[{name:"*",penalty:3}],d&&(f=[we(f[0],d)]));try{for(var p=(t=void 0,u(f)),v=p.next();!v.done;v=p.next()){(h=v.value).level=a}}catch(e){t={error:e}}finally{try{v&&!v.done&&(s=p.return)&&s.call(p)}finally{if(t)throw t.error}}if(i.push(f),i.length>=ne.seedMinLength&&(r=ye(i,n)))return"break";o=o.parentElement,a++};o;){if("break"===s())break}return r||(r=ye(i,n)),!r&&n?n():r}function ye(t,e){var n,r,i=Se(Ee(t));if(i.length>ne.threshold)return e?e():null;try{for(var o=u(i),c=o.next();!c.done;c=o.next()){var l=c.value;if(ge(l))return l}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function be(t){for(var e=t[0],n=e.name,r=1;r<t.length;r++){var i=t[r].level||0;n=e.level===i-1?"".concat(t[r].name," > ").concat(n):"".concat(t[r].name," ").concat(n),e=t[r]}return n}function me(t){return t.map((function(t){return t.penalty})).reduce((function(t,e){return t+e}),0)}function ge(t){var e=be(t);switch(re.querySelectorAll(e).length){case 0:throw new Error("Can't select any node with this selector: ".concat(e));case 1:return!0;default:return!1}}function we(t,e){return{name:t.name+":nth-child(".concat(e,")"),penalty:t.penalty+1}}function _e(t){return"html"!==t.name&&!t.name.startsWith("#")}function xe(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.filter(Ae);return n.length>0?n:null}function Ae(t){return null!=t}function Ee(t,e){var n,r,i,c,l,a;return void 0===e&&(e=[]),o(this,(function(o){switch(o.label){case 0:if(!(t.length>0))return[3,9];o.label=1;case 1:o.trys.push([1,6,7,8]),n=u(t[0]),r=n.next(),o.label=2;case 2:return r.done?[3,5]:(i=r.value,[5,u(Ee(t.slice(1,t.length),e.concat(i)))]);case 3:o.sent(),o.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return c=o.sent(),l={error:c},[3,8];case 7:try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(l)throw l.error}return[7];case 8:return[3,11];case 9:return[4,e];case 10:o.sent(),o.label=11;case 11:return[2]}}))}function Se(t){return l([],c(t),!1).sort((function(t,e){return me(t)-me(e)}))}function ke(t,e,n){var r,i,a;return void 0===n&&(n={counter:0,visited:new Map}),o(this,(function(o){switch(o.label){case 0:if(!(t.length>2&&t.length>ne.optimizedMinLength))return[3,5];r=1,o.label=1;case 1:return r<t.length-1?n.counter>ne.maxNumberOfTries?[2]:(n.counter+=1,(i=l([],c(t),!1)).splice(r,1),a=be(i),n.visited.has(a)?[2]:ge(i)&&function(t,e){return re.querySelector(be(t))===e}(i,e)?[4,i]:[3,4]):[3,5];case 2:return o.sent(),n.visited.set(a,!0),[5,u(ke(i,e,n))];case 3:o.sent(),o.label=4;case 4:return r++,[3,1];case 5:return[2]}}))}new W(P);var Te=["input","select","textarea"],Ce=function(t,e){return function(n,r){var i,o,u,c=t.pageUrlAllowlist,l=t.shouldTrackEventResolver,a=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!a)return!1;if(l)return l(n,r);if(!Le(window.location.href,c))return!1;var s=(null==r?void 0:r.type)||"";if("string"==typeof s)switch(s.toLowerCase()){case"hidden":case"password":return!1}if(e){var f=e.some((function(t){var e;return!!(null===(e=null==r?void 0:r.matches)||void 0===e?void 0:e.call(r,t))}));if(!f)return!1}switch(a){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:var d=null===(u=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===u?void 0:u.call(window,r);return!(!d||"pointer"!==d.getPropertyValue("cursor")||"click"!==n)||"click"===n}}},Oe=function(t){if(null==t)return!1;if("string"==typeof t){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((t||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(t))return!1}return!0},Ne=function(t){var e,n,r,i=null===(n=null===(e=null==t?void 0:t.tagName)||void 0===e?void 0:e.toLowerCase)||void 0===n?void 0:n.call(e),o=t instanceof HTMLElement&&"true"===(null===(r=t.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!Te.includes(i)&&!o},Pe=function(t){var e="";return Ne(t)&&t.childNodes&&t.childNodes.length&&t.childNodes.forEach((function(t){var n,r="";(n=t)&&3===n.nodeType?t.textContent&&(r=t.textContent):r=Pe(t),e+=r.split(/(\s+)/).filter(Oe).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),e},Ie=function(t,e){var n,r,i="";try{return i=pe(t,{className:function(t){return t!==g}})}catch(t){if(e){var o=t;e.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(o.toString()))}}var u=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(u&&(i=u),t.id)i="#".concat(t.id);else if(t.className){var c=t.className.split(" ").filter((function(t){return t!==g})).join(".");c&&(i="".concat(i,".").concat(c))}return i},Le=function(t,e){return!e||!e.length||e.some((function(e){return"string"==typeof e?t===e:t.match(e)}))},je=function(t){return Object.keys(t).reduce((function(e,n){var r=t[n];return function(t){return null==t||"object"==typeof t&&0===Object.keys(t).length||"string"==typeof t&&0===t.trim().length}(r)||(e[n]=r),e}),{})},Fe=function(t){var e=t.parentElement;if(!e)return"";var n=e.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return Oe(r)?r:""}return Fe(e)},Me=function(t,e){return t?e.some((function(e){var n;return null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e)}))?t:Me(null==t?void 0:t.parentElement,e):null},qe=function(t,e){var n,r,i;if(!t)return{};var o=null===(i=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),u=Ie(t,e),c=((n={})[h]=o,n[p]=Pe(t),n[v]=u,n[y]=window.location.href.split("?")[0],n);return je(c)};var ze=function(t){return!(null===t.event.target||!t.closestTrackedAncestor)},Re=function(){function t(t){var e=(void 0===t?{}:t).origin,n=void 0===e?b:e,r=this;this.endpoint=b,this.requestCallbacks={},this.onSelect=function(t){r.notify({action:"element-selected",data:t})},this.onTrack=function(t,e){"selector-mode-changed"===t?r.notify({action:"track-selector-mode-changed",data:e}):"selector-moved"===t&&r.notify({action:"track-selector-moved",data:e})},this.endpoint=n}return t.prototype.notify=function(t){var e,n,r,i;null===(n=null===(e=this.logger)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"Message sent: ",JSON.stringify(t)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,t,this.endpoint)},t.prototype.sendRequest=function(t,e,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:t,args:e};return new Promise((function(e,u){r.requestCallbacks[i]={resolve:e,reject:u},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout((function(){u(new Error("".concat(t," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},t.prototype.handleResponse=function(t){var e;this.requestCallbacks[t.id]?(this.requestCallbacks[t.id].resolve(t.responseData),delete this.requestCallbacks[t.id]):null===(e=this.logger)||void 0===e||e.warn("No callback found for request id: ".concat(t.id))},t.prototype.setup=function(t){var e=this,n=void 0===t?{}:t,r=n.logger,i=n.endpoint,o=n.isElementSelectable,u=n.cssSelectorAllowlist,c=n.actionClickAllowlist;this.logger=r,i&&this.endpoint===b&&(this.endpoint=i);var l=null;window.addEventListener("message",(function(t){var n,r,i,a,s;if(null===(r=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(t)),e.endpoint===t.origin){var f,d=null==t?void 0:t.data,h=null==d?void 0:d.action;if(h)if("id"in d)null===(a=null===(i=e.logger)||void 0===i?void 0:i.debug)||void 0===a||a.call(i,"Received Response to previous request: ",JSON.stringify(t)),e.handleResponse(d);else if("ping"===h)e.notify({action:"pong"});else if("initialize-visual-tagging-selector"===h){var p=null==d?void 0:d.data;(f="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(t,e){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=f,r.addEventListener("load",(function(){t({status:!0})}),{once:!0}),r.addEventListener("error",(function(){e({status:!1,message:"Failed to load the script ".concat(f)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(t){e(t)}}))).then((function(){var t;l=null===(t=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===t?void 0:t.call(window,{getEventTagProps:qe,isElementSelectable:function(t){return!o||o((null==p?void 0:p.actionType)||"click",t)},onTrack:e.onTrack,onSelect:e.onSelect,visualHighlightClass:g,messenger:e,cssSelectorAllowlist:u,actionClickAllowlist:c}),e.notify({action:"selector-loaded"})})).catch((function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===h&&(null===(s=null==l?void 0:l.close)||void 0===s||s.call(l))}})),this.notify({action:"page-loaded"})},t}(),De=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],Ue=["type"],Ve=["svg","path","g"],We=["password","hidden"];var He=function(t){var e;return t?(e=function(t,e){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(null===i)n+=4;else{var o=Ye(i);n+=o?Array.from(o).length:4}if(n>e)return t.slice(0,r)}return t}(function(t){var e=[];if(!t)return e;e.push(t);for(var n=t.parentElement;n&&"HTML"!==n.tagName;)e.push(n),n=n.parentElement;return e}(t).map((function(t){return function(t){var e,n,r,i,o,c;if(null===t)return null;var l=t.tagName.toLowerCase(),a={tag:l},s=Array.from(null!==(i=null===(r=t.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);s.length&&(a.index=s.indexOf(t),a.indexOfType=s.filter((function(e){return e.tagName===t.tagName})).indexOf(t));var f=null===(c=null===(o=t.previousElementSibling)||void 0===o?void 0:o.tagName)||void 0===c?void 0:c.toLowerCase();f&&(a.prevSib=f);var d=t.id;d&&(a.id=d);var h=Array.from(t.classList);h.length&&(a.classes=h);var p={},v=Array.from(t.attributes).filter((function(t){return!De.includes(t.name)})),y=!Ne(t);if(!We.includes(t.type)&&!Ve.includes(l))try{for(var b=u(v),m=b.next();!m.done;m=b.next()){var g=m.value;y&&!Ue.includes(g.name)||(p[g.name]=String(g.value).substring(0,128))}}catch(t){e={error:t}}finally{try{m&&!m.done&&(n=b.return)&&n.call(b)}finally{if(e)throw e.error}}return Object.keys(p).length&&(a.attrs=p),a}(t)})),1024),e):[]};function Ye(t,e){void 0===e&&(e=!1);try{if(null==t)return e?"None":null;if("string"==typeof t)return e?(t=t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(t,"'"):t.includes("'")?'"'.concat(t.replace(/'/g,"\\'"),'"'):"'".concat(t,"'"):t;if("boolean"==typeof t)return t?"True":"False";if(Array.isArray(t)){var n=t.map((function(t){return Ye(t,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof t){var r=Object.entries(t).filter((function(t){return null!=c(t,1)[0]})).map((function(t){var e=c(t,2),n=e[0],r=e[1];return"".concat(String(Ye(n,!0)),": ").concat(String(Ye(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return t.toString()}catch(t){return null}}function Be(t){var e,n,r,i=t.amplitude,o=t.allObservables,l=t.options,a=t.shouldTrackEvent,s=o.clickObservable,f=s.pipe(B((function(t,e){var n,r=!1;t.subscribe(X(e,(function(t){var i=n;n=t,r&&e.next([i,t]),r=!0})))})),se((function(t){var e=c(t,2),n=e[0],r=e[1],i=n.event.target!==r.event.target,o=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return i&&!o}))),h=ae(f,s.pipe((e=l.debounceTime,void 0===n&&(n=bt),B((function(t,r){var i=null,o=null,u=null,c=function(){if(i){i.unsubscribe(),i=null;var t=o;o=null,r.next(t)}};function l(){var t=u+e,o=n.now();if(o<t)return i=this.schedule(void 0,t-o),void r.add(i);c()}t.subscribe(X(r,(function(t){o=t,u=n.now(),i||(i=n.schedule(l,e),r.add(i))}),(function(){c(),r.complete()}),void 0,(function(){o=i=null})))}))),Zt((function(){return"timeout"}))));return s.pipe(he(0),se(ze),se((function(t){return a("click",t.closestTrackedAncestor)})),(r=h,B((function(t,e){var n=[];return t.subscribe(X(e,(function(t){return n.push(t)}),(function(){e.next(n),e.complete()}))),Rt(r).subscribe(X(e,(function(){var t=n;n=[],e.next(t)}),P)),function(){n=null}})))).subscribe((function(t){var e,n,r=(t.length,d);try{for(var o=u(t),c=o.next();!c.done;c=o.next()){var l=c.value;null==i||i.track(r,l.targetElementProperties,{time:l.timestamp})}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}))}function Xe(t){var e=t.amplitude,n=t.allObservables,r=t.options,i=t.getEventProperties,o=t.shouldTrackEvent,u=t.shouldTrackActionClick,a=n.clickObservable,s=n.mutationObservable,f=n.navigateObservable,h=a.pipe(se((function(t){return!o("click",t.closestTrackedAncestor)})),Zt((function(t){var e=Me(t.event.target,r.actionClickAllowlist);return t.closestTrackedAncestor=e,null!==t.closestTrackedAncestor&&(t.targetElementProperties=i(t.type,t.closestTrackedAncestor)),t})),se(ze),se((function(t){return u("click",t.closestTrackedAncestor)}))),p=[s];f&&p.push(f);var v,y,b=ae.apply(void 0,l([],c(p),!1)),m=h.pipe((v=function(t){return b.pipe(function(t,e){var n=Xt(t)?{first:t}:"number"==typeof t?{each:t}:t,r=n.first,i=n.each,o=n.with,u=void 0===o?Jt:o,c=n.scheduler,l=void 0===c?null!=e?e:bt:c,a=n.meta,s=void 0===a?null:a;if(null==r&&null==i)throw new TypeError("No timeout provided.");return B((function(t,e){var n,o,c=null,a=0,f=function(t){o=Ut(e,l,(function(){try{n.unsubscribe(),Rt(u({meta:s,lastValue:c,seen:a})).subscribe(e)}catch(t){e.error(t)}}),t)};n=t.subscribe(X(e,(function(t){null==o||o.unsubscribe(),a++,e.next(c=t),i>0&&f(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),c=null}))),!a&&f(null!=r?"number"==typeof r?r:+r-l.now():i)}))}({first:500,with:function(){return Et}}),Zt((function(){return t})))},B((function(t,e){var n=null,r=0,i=!1,o=function(){return i&&!n&&e.complete()};t.subscribe(X(e,(function(t){null==n||n.unsubscribe();var i=0,u=r++;Rt(v(t,u)).subscribe(n=X(e,(function(n){return e.next(y?y(t,n,u,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return m.subscribe((function(t){null==e||e.track(d,i("click",t.closestTrackedAncestor))}))}var Ge,Je=["a","button","input","select","textarea","label","[data-amp-default-track]",".amp-default-track"],Ze=["div","span","h1","h2","h3","h4","h5","h6"],$e="data-amp-track-";!function(t){t.ClickObservable="clickObservable",t.ChangeObservable="changeObservable",t.NavigateObservable="navigateObservable",t.MutationObservable="mutationObservable"}(Ge||(Ge={}));var Ke=function(t){var e,n,a;void 0===t&&(t={});var s=t.dataAttributePrefix,f=void 0===s?$e:s,d=t.visualTaggingOptions,b=void 0===d?{enabled:!0,messenger:new Re}:d;t.cssSelectorAllowlist=null!==(e=t.cssSelectorAllowlist)&&void 0!==e?e:Je,t.actionClickAllowlist=null!==(n=t.actionClickAllowlist)&&void 0!==n?n:Ze,t.debounceTime=null!==(a=t.debounceTime)&&void 0!==a?a:1e3;var g="@amplitude/plugin-autocapture-browser",w=[],_=void 0,x=function(t,e){var n,r,i,o=null===(i=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),u="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{left:null,top:null},c=e.getAttribute("aria-label"),l=function(t,e){return t.getAttributeNames().reduce((function(n,r){if(r.startsWith(e)){var i=r.replace(e,""),o=t.getAttribute(r);i&&(n[i]=o||"")}return n}),{})}(e,f),a=Fe(e),s=Ie(e,_),d=((n={})["[Amplitude] Element ID"]=e.id,n["[Amplitude] Element Class"]=e.className,n["[Amplitude] Element Hierarchy"]=He(e),n[h]=o,n[p]=Pe(e),n["[Amplitude] Element Position Left"]=null==u.left?null:Math.round(u.left),n["[Amplitude] Element Position Top"]=null==u.top?null:Math.round(u.top),n["[Amplitude] Element Aria Label"]=c,n["[Amplitude] Element Attributes"]=l,n[v]=s,n["[Amplitude] Element Parent Label"]=a,n[y]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===o&&"click"===t&&e instanceof HTMLAnchorElement&&(d["[Amplitude] Element Href"]=e.href),je(d)},A=function(e,n){var r={event:e,timestamp:Date.now(),type:n};if(function(t){return"click"===t.type||"change"===t.type}(r)&&null!==r.event.target){var i=Me(r.event.target,t.cssSelectorAllowlist);return i&&(r.closestTrackedAncestor=i,r.targetElementProperties=x(r.type,i)),r}return r};return{name:g,type:"enrichment",setup:function(e,n){return i(void 0,void 0,void 0,(function(){var i,u,a,s,f,d,h,p,v,y,E;return o(this,(function(o){return n?(_=e.loggerProvider,"undefined"==typeof document||(i=Ce(t,t.cssSelectorAllowlist),u=Ce(t,t.actionClickAllowlist),a=function(){var t,e,n=ce(document,"click",{capture:!0}).pipe(Zt((function(t){return A(t,"click")}))),r=ce(document,"change",{capture:!0}).pipe(Zt((function(t){return A(t,"change")})));window.navigation&&(e=ce(window.navigation,"navigate").pipe(Zt((function(t){return A(t,"navigate")}))));var i=new W((function(t){var e=new MutationObserver((function(e){t.next(e)}));return e.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return e.disconnect()}})).pipe(Zt((function(t){return A(t,"mutation")})));return(t={})[Ge.ClickObservable]=n,t[Ge.ChangeObservable]=r,t[Ge.NavigateObservable]=e,t[Ge.MutationObservable]=i,t}(),s=Be({allObservables:a,options:t,amplitude:n,shouldTrackEvent:i}),w.push(s),f=function(t){var e=t.amplitude,n=t.allObservables,r=t.getEventProperties,i=t.shouldTrackEvent;return n.changeObservable.pipe(se(ze),se((function(t){return i("change",t.closestTrackedAncestor)}))).subscribe((function(t){null==e||e.track("[Amplitude] Element Changed",r("change",t.closestTrackedAncestor))}))}({allObservables:a,getEventProperties:x,amplitude:n,shouldTrackEvent:i}),w.push(f),d=Xe({allObservables:a,options:t,getEventProperties:x,amplitude:n,shouldTrackEvent:i,shouldTrackActionClick:u}),w.push(d),null===(y=null==e?void 0:e.loggerProvider)||void 0===y||y.log("".concat(g," has been successfully added.")),window.opener&&b.enabled&&(h=t.cssSelectorAllowlist,p=t.actionClickAllowlist,null===(E=b.messenger)||void 0===E||E.setup(r(r({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:m[e.serverZone]}),{isElementSelectable:Ce(t,l(l([],c(h),!1),c(p),!1)),cssSelectorAllowlist:h,actionClickAllowlist:p})))),[2]):(null===(v=null==e?void 0:e.loggerProvider)||void 0===v||v.warn("".concat(g," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[2])}))}))},execute:function(t){return i(void 0,void 0,void 0,(function(){return o(this,(function(e){return[2,t]}))}))},teardown:function(){return i(void 0,void 0,void 0,(function(){var t,e,n,r;return o(this,(function(i){try{for(t=u(w),e=t.next();!e.done;e=t.next())e.value.unsubscribe()}catch(t){n={error:t}}finally{try{e&&!e.done&&(r=t.return)&&r.call(t)}finally{if(n)throw n.error}}return[2]}))}))}}};return t.DEFAULT_CSS_SELECTOR_ALLOWLIST=Je,t.DEFAULT_DATA_ATTRIBUTE_PREFIX=$e,t.WindowMessenger=Re,t.autocapturePlugin=Ke,t.plugin=Ke,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(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 o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function l(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(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,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function o(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 i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)l.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return l}function l(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var a,u,c="[Amplitude] Element Tag",s="[Amplitude] Element Text",d="[Amplitude] Element Selector",f="[Amplitude] Page URL",v="https://app.amplitude.com",p={US:v,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},g="amp-visual-tagging-selector-highlight";function h(e,n){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};a=t(t({},r),n),u=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(a.root,r);var o=m(e,"all",(function(){return m(e,"two",(function(){return m(e,"one",(function(){return m(e,"none")}))}))}));if(o){var i=C(L(o,e));return i.length>0&&(o=i[0]),w(o)}throw new Error("Selector was not found.")}function m(e,t,n){for(var r=null,u=[],c=e,s=0,d=function(){var e,d,f=N(function(e){var t=e.getAttribute("id");if(t&&a.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(c))||N.apply(void 0,l([],i(function(e){var t=Array.from(e.attributes).filter((function(e){return a.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(c)),!1))||N.apply(void 0,l([],i(function(e){var t=Array.from(e.classList).filter(a.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(c)),!1))||N(function(e){var t=e.tagName.toLowerCase();if(a.tagName(t))return{name:t,penalty:2};return null}(c))||[{name:"*",penalty:3}],v=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(c);if("all"==t)v&&(f=f.concat(f.filter(A).map((function(e){return S(e,v)}))));else if("two"==t)f=f.slice(0,1),v&&(f=f.concat(f.filter(A).map((function(e){return S(e,v)}))));else if("one"==t){var p=i(f=f.slice(0,1),1)[0];v&&A(p)&&(f=[S(p,v)])}else"none"==t&&(f=[{name:"*",penalty:3}],v&&(f=[S(f[0],v)]));try{for(var g=(e=void 0,o(f)),h=g.next();!h.done;h=g.next()){(p=h.value).level=s}}catch(t){e={error:t}}finally{try{h&&!h.done&&(d=g.return)&&d.call(g)}finally{if(e)throw e.error}}if(u.push(f),u.length>=a.seedMinLength&&(r=y(u,n)))return"break";c=c.parentElement,s++};c;){if("break"===d())break}return r||(r=y(u,n)),!r&&n?n():r}function y(e,t){var n,r,i=C(T(e));if(i.length>a.threshold)return t?t():null;try{for(var l=o(i),u=l.next();!u.done;u=l.next()){var c=u.value;if(E(c))return c}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}function w(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var o=e[r].level||0;n=t.level===o-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function b(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function E(e){var t=w(e);switch(u.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function S(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function A(e){return"html"!==e.name&&!e.name.startsWith("#")}function N(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(k);return n.length>0?n:null}function k(e){return null!=e}function T(e,t){var n,i,l,a,u,c;return void 0===t&&(t=[]),r(this,(function(r){switch(r.label){case 0:if(!(e.length>0))return[3,9];r.label=1;case 1:r.trys.push([1,6,7,8]),n=o(e[0]),i=n.next(),r.label=2;case 2:return i.done?[3,5]:(l=i.value,[5,o(T(e.slice(1,e.length),t.concat(l)))]);case 3:r.sent(),r.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return a=r.sent(),u={error:a},[3,8];case 7:try{i&&!i.done&&(c=n.return)&&c.call(n)}finally{if(u)throw u.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:r.sent(),r.label=11;case 11:return[2]}}))}function C(e){return l([],i(e),!1).sort((function(e,t){return b(e)-b(t)}))}function L(e,t,n){var c,s,d;return void 0===n&&(n={counter:0,visited:new Map}),r(this,(function(r){switch(r.label){case 0:if(!(e.length>2&&e.length>a.optimizedMinLength))return[3,5];c=1,r.label=1;case 1:return c<e.length-1?n.counter>a.maxNumberOfTries?[2]:(n.counter+=1,(s=l([],i(e),!1)).splice(c,1),d=w(s),n.visited.has(d)?[2]:E(s)&&function(e,t){return u.querySelector(w(e))===t}(s,t)?[4,s]:[3,4]):[3,5];case 2:return r.sent(),n.visited.set(d,!0),[5,o(L(s,t,n))];case 3:r.sent(),r.label=4;case 4:return c++,[3,1];case 5:return[2]}}))}var x=["input","select","textarea"],O=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},M=function(e){var t,n,r=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="true"===e.getAttribute("contenteditable");return!x.includes(r)&&!o},P=function(e){var t="";return M(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=P(e),t+=r.split(/(\s+)/).filter(O).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},j=function(e,t){var n,r,o="";try{return o=h(e,{className:function(e){return e!==g}})}catch(e){if(t){var i=e;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(i.toString()))}}var l=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);if(l&&(o=l),e.id)o="#".concat(e.id);else if(e.className){var a=e.className.split(" ").filter((function(e){return e!==g})).join(".");a&&(o="".concat(o,".").concat(a))}return o},q=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}),{})},R=function(e){var t=e.parentElement;if(!t)return"";var n=t.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return O(r)?r:""}return R(t)},D=function(e,t){if(e&&"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var n=t.reduce((function(t,n){n&&Array.from(e.querySelectorAll(n)).forEach((function(e){t.add(e)}));return t}),new Set);return Array.from(n)}return[]},_=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:_(null==e?void 0:e.parentElement,t):null},U=function(e,t){var n,r,o;if(!e)return{};var i=null===(o=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l=j(e,t),a=((n={})[c]=i,n[s]=P(e),n[d]=l,n[f]=window.location.href.split("?")[0],n);return q(a)};var F=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?v:t,r=this;this.endpoint=v,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,o;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===(o=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===o||o.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var o="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),i={id:o,action:e,args:t};return new Promise((function(t,l){r.requestCallbacks[o]={resolve:t,reject:l},r.notify(i),(null==n?void 0:n.timeout)>0&&setTimeout((function(){l(new Error("".concat(e," timed out (id: ").concat(o,")"))),delete r.requestCallbacks[o]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,o=n.endpoint,i=n.isElementSelectable;this.logger=r,o&&this.endpoint===v&&(this.endpoint=o);var l=null;window.addEventListener("message",(function(e){var n,r,o,a,u;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var c,s=null==e?void 0:e.data,d=null==s?void 0:s.action;if(d)if("id"in s)null===(a=null===(o=t.logger)||void 0===o?void 0:o.debug)||void 0===a||a.call(o,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(s);else if("ping"===d)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===d){var f=null==s?void 0:s.data;(c="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=c,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(c)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;l=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:U,isElementSelectable:function(e){return!i||i((null==f?void 0:f.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:g,messenger:t}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===d&&(null===(u=null==l?void 0:l.close)||void 0===u||u.call(l))}})),this.notify({action:"page-loaded"})},e}(),H=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],W=["type"],z=["svg","path","g"],I=["password","hidden"];var V=function(e){var t;return e?(t=function(e,t){for(var n=0,r=0;r<e.length;r++){var o=e[r];if(null===o)n+=4;else{var i=B(o);n+=i?Array.from(i).length:4}if(n>t)return e.slice(0,r)}return e}(function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e).map((function(e){return function(e){var t,n,r,i,l,a;if(null===e)return null;var u=e.tagName.toLowerCase(),c={tag:u},s=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);s.length&&(c.index=s.indexOf(e),c.indexOfType=s.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var d=null===(a=null===(l=e.previousElementSibling)||void 0===l?void 0:l.tagName)||void 0===a?void 0:a.toLowerCase();d&&(c.prevSib=d);var f=e.id;f&&(c.id=f);var v=Array.from(e.classList);v.length&&(c.classes=v);var p={},g=Array.from(e.attributes).filter((function(e){return!H.includes(e.name)})),h=!M(e);if(!I.includes(e.type)&&!z.includes(u))try{for(var m=o(g),y=m.next();!y.done;y=m.next()){var w=y.value;h&&!W.includes(w.name)||(p[w.name]=String(w.value).substring(0,128))}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}return Object.keys(p).length&&(c.attrs=p),c}(e)})),1024),t):[]};function B(e,t){void 0===t&&(t=!1);try{if(null==e)return t?"None":null;if("string"==typeof e)return t?(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(e,"'"):e.includes("'")?'"'.concat(e.replace(/'/g,"\\'"),'"'):"'".concat(e,"'"):e;if("boolean"==typeof e)return e?"True":"False";if(Array.isArray(e)){var n=e.map((function(e){return B(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=i(e,1)[0]})).map((function(e){var t=i(e,2),n=t[0],r=t[1];return"".concat(String(B(n,!0)),": ").concat(String(B(r,!0)))})),o="{".concat(r.join(", "),"}");return o.includes("\\'")&&(o=o.replace(/'/g,"'").replace(/'/g,"\\'")),o}return e.toString()}catch(e){return null}}var G=["a","button","input","select","textarea","label","[data-amp-default-track]",".amp-default-track"],J="data-amp-track-",Z=function(e){void 0===e&&(e={});var o,i=e.cssSelectorAllowlist,l=void 0===i?G:i,a=e.pageUrlAllowlist,u=e.shouldTrackEventResolver,v=e.dataAttributePrefix,g=void 0===v?J:v,h=e.visualTaggingOptions,m=void 0===h?{enabled:!0,messenger:new F}:h,y="@amplitude/plugin-autocapture-browser",w=[],b=void 0,E=function(e,t,n){e.addEventListener(t,n),w.push({element:e,type:t,handler:n})},S=function(e,t){var n,r,o;if(!t)return!1;var i=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(!i)return!1;if(u)return u(e,t);if(!function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(window.location.href,a))return!1;var c=(null==t?void 0:t.type)||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}if(l){var s=l.some((function(e){var n;return!!(null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e))}));if(!s)return!1}switch(i){case"input":case"select":case"textarea":return"change"===e||"click"===e;default:var d=null===(o=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===o?void 0:o.call(window,t);return!(!d||"pointer"!==d.getPropertyValue("cursor")||"click"!==e)||"click"===e}},A=function(e,t){var n,r,o,i=null===(o=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),u=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var o=r.replace(t,""),i=e.getAttribute(r);o&&(n[o]=i||"")}return n}),{})}(t,g),v=R(t),p=j(t,b),h=((n={})["[Amplitude] Element ID"]=t.id,n["[Amplitude] Element Class"]=t.className,n["[Amplitude] Element Hierarchy"]=V(t),n[c]=i,n[s]=P(t),n["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),n["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),n["[Amplitude] Element Aria Label"]=a,n["[Amplitude] Element Attributes"]=u,n[d]=p,n["[Amplitude] Element Parent Label"]=v,n[f]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===i&&"click"===e&&t instanceof HTMLAnchorElement&&(h["[Amplitude] Element Href"]=t.href),q(h)};return{name:y,type:"enrichment",setup:function(e,i){return n(void 0,void 0,void 0,(function(){var n,a,u,c,s;return r(this,(function(r){return i?(b=e.loggerProvider,"undefined"==typeof document||(n=function(e){S("click",e)&&E(e,"click",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&_(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Clicked",A("click",e))})),S("change",e)&&E(e,"change",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&_(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Changed",A("change",e))}))},"undefined"!=typeof MutationObserver&&(o=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&D(e,l).map(n)}))}))}))),a=function(){D(document.body,l).forEach(n),null==o||o.observe(document.body,{subtree:!0,childList:!0})},document.body?a():window.addEventListener("load",a),null===(c=null==e?void 0:e.loggerProvider)||void 0===c||c.log("".concat(y," has been successfully added.")),window.opener&&m.enabled&&(null===(s=m.messenger)||void 0===s||s.setup(t(t({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:p[e.serverZone]}),{isElementSelectable:S})))),[2]):(null===(u=null==e?void 0:e.loggerProvider)||void 0===u||u.warn("".concat(y," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[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(){return r(this,(function(e){return o&&o.disconnect(),w.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),w=[],[2]}))}))}}};e.DEFAULT_CSS_SELECTOR_ALLOWLIST=G,e.DEFAULT_DATA_ATTRIBUTE_PREFIX=J,e.WindowMessenger=F,e.autocapturePlugin=Z,e.plugin=Z,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).amplitude={})}(this,(function(t){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function i(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{l(r.next(t))}catch(t){o(t)}}function c(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}l((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(l){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,l])}}}function u(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)u.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return u}function l(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function s(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r={},u("next"),u("throw"),u("return"),r[Symbol.asyncIterator]=function(){return this},r;function u(t){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||c(t,e)}))})}function c(t,e){try{(n=i[t](e)).value instanceof a?Promise.resolve(n.value.v).then(l,s):f(o[0][2],n)}catch(t){f(o[0][3],t)}var n}function l(t){c("next",t)}function s(t){c("throw",t)}function f(t,e){t(e),o.shift(),o.length&&c(o[0][0],o[0][1])}}function f(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=u(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,i,(e=t[n](e)).done,e.value)}))}}}var d="[Amplitude] Element Clicked",h="[Amplitude] Element Tag",p="[Amplitude] Element Text",v="[Amplitude] Element Selector",y="[Amplitude] Page URL",b="https://app.amplitude.com",m={US:b,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},g="amp-visual-tagging-selector-highlight";function w(t){return"function"==typeof t}function _(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var x=_((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function A(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var E=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=u(o),s=a.next();!s.done;s=a.next()){s.value.remove(this)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var f=this.initialTeardown;if(w(f))try{f()}catch(t){i=t instanceof x?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var h=u(d),p=h.next();!p.done;p=h.next()){var v=p.value;try{T(v)}catch(t){i=null!=i?i:[],t instanceof x?i=l(l([],c(i)),c(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}}if(i)throw new x(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)T(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&A(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&A(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),S=E.EMPTY;function k(t){return t instanceof E||t&&"closed"in t&&w(t.remove)&&w(t.add)&&w(t.unsubscribe)}function T(t){w(t)?t():t.unsubscribe()}var C={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},O=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,l([t,e],c(n)))};function N(t){O((function(){throw t}))}function P(){}function I(t){t()}var L=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,k(e)&&e.add(n)):n.destination=R,n}return n(e,t),e.create=function(t,e,n){return new q(t,e,n)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(E),j=Function.prototype.bind;function F(t,e){return j.call(t,e)}var M=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){z(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){z(t)}else z(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){z(t)}},t}(),q=function(t){function e(e,n,r){var i,o,u=t.call(this)||this;w(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:u&&C.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return u.unsubscribe()},i={next:e.next&&F(e.next,o),error:e.error&&F(e.error,o),complete:e.complete&&F(e.complete,o)}):i=e;return u.destination=new M(i),u}return n(e,t),e}(L);function z(t){N(t)}var R={closed:!0,next:P,error:function(t){throw t},complete:P},D="function"==typeof Symbol&&Symbol.observable||"@@observable";function U(t){return t}function V(t){return 0===t.length?U:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var W=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,o=(r=t)&&r instanceof L||function(t){return t&&w(t.next)&&w(t.error)&&w(t.complete)}(r)&&k(r)?t:new q(t,e,n);return I((function(){var t=i,e=t.operator,n=t.source;o.add(e?e.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=H(e))((function(e,r){var i=new q({next:function(e){try{t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[D]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return V(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=H(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function H(t){var e;return null!==(e=null!=t?t:C.Promise)&&void 0!==e?e:Promise}function Y(t){return w(null==t?void 0:t.lift)}function B(t){return function(e){if(Y(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function X(t,e,n,r,i){return new G(t,e,n,r,i)}var G=function(t){function e(e,n,r,i,o,u){var c=t.call(this,e)||this;return c.onFinalize=o,c.shouldUnsubscribe=u,c._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,c._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return n(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(L);!function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,Y(e)&&(r.lift=e.lift),r}n(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,null==t||t.unsubscribe()},e.prototype.connect=function(){var t=this,e=this._connection;if(!e){e=this._connection=new E;var n=this.getSubject();e.add(this.source.subscribe(X(n,void 0,(function(){t._teardown(),n.complete()}),(function(e){t._teardown(),n.error(e)}),(function(){return t._teardown()})))),e.closed&&(this._connection=null,e=E.EMPTY)}return e},e.prototype.refCount=function(){return B((function(t,e){var n=null;t._refCount++;var r=X(e,void 0,void 0,void 0,(function(){if(!t||t._refCount<=0||0<--t._refCount)n=null;else{var r=t._connection,i=n;n=null,!r||i&&r!==i||r.unsubscribe(),e.unsubscribe()}}));t.subscribe(r),r.closed||(n=t.connect())}))(this)}}(W);var J,Z={now:function(){return(Z.delegate||performance).now()},delegate:void 0},$={schedule:function(t){var e=requestAnimationFrame,n=cancelAnimationFrame,r=e((function(e){n=void 0,t(e)}));return new E((function(){return null==n?void 0:n(r)}))},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=$.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,l([],c(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,l([],c(t)))},delegate:void 0};new W((function(t){var e=J||Z,n=e.now(),r=0,i=function(){t.closed||(r=$.requestAnimationFrame((function(o){r=0;var u=e.now();t.next({timestamp:J?u:o,elapsed:u-n}),i()})))};return i(),function(){r&&$.cancelAnimationFrame(r)}}));var K=_((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Q=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return n(e,t),e.prototype.lift=function(t){var e=new tt(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new K},e.prototype.next=function(t){var e=this;I((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=u(e.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(t)}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},e.prototype.error=function(t){var e=this;I((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}}))},e.prototype.complete=function(){var t=this;I((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?S:(this.currentObservers=null,o.push(t),new E((function(){e.currentObservers=null,A(o,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new W;return t.source=this,t},e.create=function(t,e){return new tt(t,e)},e}(W),tt=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return n(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:S},e}(Q);!function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)}}(Q);var et={now:function(){return(et.delegate||Date).now()},delegate:void 0};!function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=et);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}n(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,u=n._timestampProvider,c=n._windowTime;r||(i.push(e),!o&&i.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var u=n.now(),c=0,l=1;l<r.length&&r[l]<=u;l+=2)c=l;c&&r.splice(0,c+1)}}}(Q),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._value=null,e._hasValue=!1,e._isComplete=!1,e}n(e,t),e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e._hasValue,i=e._value,o=e.thrownError,u=e.isStopped,c=e._isComplete;n?t.error(o):(u||c)&&(r&&t.next(i),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var e=this,n=e._hasValue,r=e._value;e._isComplete||(this._isComplete=!0,n&&t.prototype.next.call(this,r),t.prototype.complete.call(this))}}(Q);var nt,rt=function(t){function e(e,n){return t.call(this)||this}return n(e,t),e.prototype.schedule=function(t,e){return this},e}(E),it=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,l([t,e],c(n)))},ot=function(t){return clearInterval(t)},ut=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return n(e,t),e.prototype.schedule=function(t,e){var n;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,e)),this.pending=!0,this.delay=e,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),it(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;null!=e&&ot(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,A(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(rt),ct=1,lt={};function at(t){return t in lt&&(delete lt[t],!0)}var st=function(t){var e=ct++;return lt[e]=!0,nt||(nt=Promise.resolve()),nt.then((function(){return at(e)&&t()})),e},ft=function(t){at(t)},dt={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=dt.delegate;return((null==n?void 0:n.setImmediate)||st).apply(void 0,l([],c(t)))},clearImmediate:function(t){return ft(t)},delegate:void 0},ht=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=dt.setImmediate(e.flush.bind(e,void 0))))},e.prototype.recycleAsyncId=function(e,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);var o=e.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(dt.clearImmediate(n),e._scheduled===n&&(e._scheduled=void 0))},e}(ut),pt=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=et.now,t}(),vt=function(t){function e(e,n){void 0===n&&(n=pt.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return n(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(pt),yt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(vt);new yt(ht);var bt=new vt(ut),mt=bt,gt=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.flush(this),0)},e}(ut),wt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(vt);new wt(gt);var _t=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=$.requestAnimationFrame((function(){return e.flush(void 0)}))))},e.prototype.recycleAsyncId=function(e,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);var o=e.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&($.cancelAnimationFrame(n),e._scheduled=void 0)},e}(ut),xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(vt);new xt(_t),function(t){function e(e,n){void 0===e&&(e=At),void 0===n&&(n=1/0);var r=t.call(this,e,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}n(e,t),e.prototype.flush=function(){for(var t,e,n=this.actions,r=this.maxFrames;(e=n[0])&&e.delay<=r&&(n.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=n.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10}(vt);var At=function(t){function e(e,n,r){void 0===r&&(r=e.index+=1);var i=t.call(this,e,n)||this;return i.scheduler=e,i.work=n,i.index=r,i.active=!0,i.index=e.index=r,i}return n(e,t),e.prototype.schedule=function(n,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return t.prototype.schedule.call(this,n,r);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(n,r)}return E.EMPTY},e.prototype.requestAsyncId=function(t,n,r){void 0===r&&(r=0),this.delay=t.frame+r;var i=t.actions;return i.push(this),i.sort(e.sortActions),1},e.prototype.recycleAsyncId=function(t,e,n){},e.prototype._execute=function(e,n){if(!0===this.active)return t.prototype._execute.call(this,e,n)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(ut),Et=new W((function(t){return t.complete()}));function St(t){return t&&w(t.schedule)}function kt(t){return t[t.length-1]}function Tt(t){return St(kt(t))?t.pop():void 0}function Ct(t,e){return"number"==typeof kt(t)?t.pop():e}var Ot=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function Nt(t){return w(null==t?void 0:t.then)}function Pt(t){return w(t[D])}function It(t){return Symbol.asyncIterator&&w(null==t?void 0:t[Symbol.asyncIterator])}function Lt(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var jt,Ft="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Mt(t){return w(null==t?void 0:t[Ft])}function qt(t){return s(this,arguments,(function(){var e,n,r;return o(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,a(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,a(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,a(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}function zt(t){return w(null==t?void 0:t.getReader)}function Rt(t){if(t instanceof W)return t;if(null!=t){if(Pt(t))return i=t,new W((function(t){var e=i[D]();if(w(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Ot(t))return r=t,new W((function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()}));if(Nt(t))return n=t,new W((function(t){n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,N)}));if(It(t))return Dt(t);if(Mt(t))return e=t,new W((function(t){var n,r;try{for(var i=u(e),o=i.next();!o.done;o=i.next()){var c=o.value;if(t.next(c),t.closed)return}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()}));if(zt(t))return Dt(qt(t))}var e,n,r,i;throw Lt(t)}function Dt(t){return new W((function(e){(function(t,e){var n,r,u,c;return i(this,void 0,void 0,(function(){var i,l;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,11]),n=f(t),o.label=1;case 1:return[4,n.next()];case 2:if((r=o.sent()).done)return[3,4];if(i=r.value,e.next(i),e.closed)return[2];o.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=o.sent(),u={error:l},[3,11];case 6:return o.trys.push([6,,9,10]),r&&!r.done&&(c=n.return)?[4,c.call(n)]:[3,8];case 7:o.sent(),o.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))}))})(t,e).catch((function(t){return e.error(t)}))}))}function Ut(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=e.schedule((function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()}),r);if(t.add(o),!i)return o}function Vt(t,e){return void 0===e&&(e=0),B((function(n,r){n.subscribe(X(r,(function(n){return Ut(r,t,(function(){return r.next(n)}),e)}),(function(){return Ut(r,t,(function(){return r.complete()}),e)}),(function(n){return Ut(r,t,(function(){return r.error(n)}),e)})))}))}function Wt(t,e){return void 0===e&&(e=0),B((function(n,r){r.add(t.schedule((function(){return n.subscribe(r)}),e))}))}function Ht(t,e){if(!t)throw new Error("Iterable cannot be null");return new W((function(n){Ut(n,e,(function(){var r=t[Symbol.asyncIterator]();Ut(n,e,(function(){r.next().then((function(t){t.done?n.complete():n.next(t.value)}))}),0,!0)}))}))}function Yt(t,e){if(null!=t){if(Pt(t))return function(t,e){return Rt(t).pipe(Wt(e),Vt(e))}(t,e);if(Ot(t))return function(t,e){return new W((function(n){var r=0;return e.schedule((function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())}))}))}(t,e);if(Nt(t))return function(t,e){return Rt(t).pipe(Wt(e),Vt(e))}(t,e);if(It(t))return Ht(t,e);if(Mt(t))return function(t,e){return new W((function(n){var r;return Ut(n,e,(function(){r=t[Ft](),Ut(n,e,(function(){var t,e,i;try{e=(t=r.next()).value,i=t.done}catch(t){return void n.error(t)}i?n.complete():n.next(e)}),0,!0)})),function(){return w(null==r?void 0:r.return)&&r.return()}}))}(t,e);if(zt(t))return function(t,e){return Ht(qt(t),e)}(t,e)}throw Lt(t)}function Bt(t,e){return e?Yt(t,e):Rt(t)}function Xt(t){return t instanceof Date&&!isNaN(t)}!function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"}(jt||(jt={})),_((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}})),_((function(t){return function(){t(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),_((function(t){return function(e){t(this),this.name="NotFoundError",this.message=e}})),_((function(t){return function(e){t(this),this.name="SequenceError",this.message=e}}));var Gt=_((function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}}));function Jt(t){throw new Gt(t)}function Zt(t,e){return B((function(n,r){var i=0;n.subscribe(X(r,(function(n){r.next(t.call(e,n,i++))})))}))}var $t=Array.isArray;function Kt(t){return Zt((function(e){return function(t,e){return $t(e)?t.apply(void 0,l([],c(e))):t(e)}(t,e)}))}function Qt(t,e,n){return void 0===n&&(n=1/0),w(e)?Qt((function(n,r){return Zt((function(t,i){return e(n,t,r,i)}))(Rt(t(n,r)))}),n):("number"==typeof e&&(n=e),B((function(e,r){return function(t,e,n,r,i,o,u,c){var l=[],a=0,s=0,f=!1,d=function(){!f||l.length||a||e.complete()},h=function(t){return a<r?p(t):l.push(t)},p=function(t){o&&e.next(t),a++;var c=!1;Rt(n(t,s++)).subscribe(X(e,(function(t){null==i||i(t),o?h(t):e.next(t)}),(function(){c=!0}),void 0,(function(){if(c)try{a--;for(var t=function(){var t=l.shift();u?Ut(e,u,(function(){return p(t)})):p(t)};l.length&&a<r;)t();d()}catch(t){e.error(t)}})))};return t.subscribe(X(e,h,(function(){f=!0,d()}))),function(){null==c||c()}}(e,r,t,n)})))}function te(t){return void 0===t&&(t=1/0),Qt(U,t)}function ee(){return te(1)}var ne,re,ie=["addListener","removeListener"],oe=["addEventListener","removeEventListener"],ue=["on","off"];function ce(t,e,n,r){if(w(n)&&(r=n,n=void 0),r)return ce(t,e,n).pipe(Kt(r));var i=c(function(t){return w(t.addEventListener)&&w(t.removeEventListener)}(t)?oe.map((function(r){return function(i){return t[r](e,i,n)}})):function(t){return w(t.addListener)&&w(t.removeListener)}(t)?ie.map(le(t,e)):function(t){return w(t.on)&&w(t.off)}(t)?ue.map(le(t,e)):[],2),o=i[0],u=i[1];if(!o&&Ot(t))return Qt((function(t){return ce(t,e,n)}))(Rt(t));if(!o)throw new TypeError("Invalid event target");return new W((function(t){var e=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.next(1<e.length?e:e[0])};return o(e),function(){return u(e)}}))}function le(t,e){return function(n){return function(r){return t[n](e,r)}}}function ae(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Tt(t),r=Ct(t,1/0),i=t;return i.length?1===i.length?Rt(i[0]):te(r)(Bt(i,n)):Et}function se(t,e){return B((function(n,r){var i=0;n.subscribe(X(r,(function(n){return t.call(e,n,i++)&&r.next(n)})))}))}function fe(t){return t<=0?function(){return Et}:B((function(e,n){var r=0;e.subscribe(X(n,(function(e){++r<=t&&(n.next(e),t<=r&&n.complete())})))}))}function de(t,e){return e?function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ee()(Bt(t,Tt(t)))}(e.pipe(fe(1),B((function(t,e){t.subscribe(X(e,P))}))),n.pipe(de(t)))}:Qt((function(e,n){return Rt(t(e,n)).pipe(fe(1),function(t){return Zt((function(){return t}))}(e))}))}function he(t,e){void 0===e&&(e=bt);var n=function(t,e,n){void 0===t&&(t=0),void 0===n&&(n=mt);var r=-1;return null!=e&&(St(e)?n=e:r=e),new W((function(e){var i=Xt(t)?+t-n.now():t;i<0&&(i=0);var o=0;return n.schedule((function(){e.closed||(e.next(o++),0<=r?this.schedule(void 0,r):e.complete())}),i)}))}(t,e);return de((function(){return n}))}function pe(t,e){if(t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===t.tagName.toLowerCase())return"html";var n={root:document.body,idName:function(t){return!0},className:function(t){return!0},tagName:function(t){return!0},attr:function(t,e){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};ne=r(r({},n),e),re=function(t,e){if(t.nodeType===Node.DOCUMENT_NODE)return t;if(t===e.root)return t.ownerDocument;return t}(ne.root,n);var i=ve(t,"all",(function(){return ve(t,"two",(function(){return ve(t,"one",(function(){return ve(t,"none")}))}))}));if(i){var o=Se(ke(i,t));return o.length>0&&(i=o[0]),be(i)}throw new Error("Selector was not found.")}function ve(t,e,n){for(var r=null,i=[],o=t,a=0,s=function(){var t,s,f=xe(function(t){var e=t.getAttribute("id");if(e&&ne.idName(e))return{name:"#"+CSS.escape(e),penalty:0};return null}(o))||xe.apply(void 0,l([],c(function(t){var e=Array.from(t.attributes).filter((function(t){return ne.attr(t.name,t.value)}));return e.map((function(t){return{name:"[".concat(CSS.escape(t.name),'="').concat(CSS.escape(t.value),'"]'),penalty:.5}}))}(o)),!1))||xe.apply(void 0,l([],c(function(t){var e=Array.from(t.classList).filter(ne.className);return e.map((function(t){return{name:"."+CSS.escape(t),penalty:1}}))}(o)),!1))||xe(function(t){var e=t.tagName.toLowerCase();if(ne.tagName(e))return{name:e,penalty:2};return null}(o))||[{name:"*",penalty:3}],d=function(t){var e=t.parentNode;if(!e)return null;var n=e.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==t);)n=n.nextSibling;return r}(o);if("all"==e)d&&(f=f.concat(f.filter(_e).map((function(t){return we(t,d)}))));else if("two"==e)f=f.slice(0,1),d&&(f=f.concat(f.filter(_e).map((function(t){return we(t,d)}))));else if("one"==e){var h=c(f=f.slice(0,1),1)[0];d&&_e(h)&&(f=[we(h,d)])}else"none"==e&&(f=[{name:"*",penalty:3}],d&&(f=[we(f[0],d)]));try{for(var p=(t=void 0,u(f)),v=p.next();!v.done;v=p.next()){(h=v.value).level=a}}catch(e){t={error:e}}finally{try{v&&!v.done&&(s=p.return)&&s.call(p)}finally{if(t)throw t.error}}if(i.push(f),i.length>=ne.seedMinLength&&(r=ye(i,n)))return"break";o=o.parentElement,a++};o;){if("break"===s())break}return r||(r=ye(i,n)),!r&&n?n():r}function ye(t,e){var n,r,i=Se(Ee(t));if(i.length>ne.threshold)return e?e():null;try{for(var o=u(i),c=o.next();!c.done;c=o.next()){var l=c.value;if(ge(l))return l}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function be(t){for(var e=t[0],n=e.name,r=1;r<t.length;r++){var i=t[r].level||0;n=e.level===i-1?"".concat(t[r].name," > ").concat(n):"".concat(t[r].name," ").concat(n),e=t[r]}return n}function me(t){return t.map((function(t){return t.penalty})).reduce((function(t,e){return t+e}),0)}function ge(t){var e=be(t);switch(re.querySelectorAll(e).length){case 0:throw new Error("Can't select any node with this selector: ".concat(e));case 1:return!0;default:return!1}}function we(t,e){return{name:t.name+":nth-child(".concat(e,")"),penalty:t.penalty+1}}function _e(t){return"html"!==t.name&&!t.name.startsWith("#")}function xe(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.filter(Ae);return n.length>0?n:null}function Ae(t){return null!=t}function Ee(t,e){var n,r,i,c,l,a;return void 0===e&&(e=[]),o(this,(function(o){switch(o.label){case 0:if(!(t.length>0))return[3,9];o.label=1;case 1:o.trys.push([1,6,7,8]),n=u(t[0]),r=n.next(),o.label=2;case 2:return r.done?[3,5]:(i=r.value,[5,u(Ee(t.slice(1,t.length),e.concat(i)))]);case 3:o.sent(),o.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return c=o.sent(),l={error:c},[3,8];case 7:try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(l)throw l.error}return[7];case 8:return[3,11];case 9:return[4,e];case 10:o.sent(),o.label=11;case 11:return[2]}}))}function Se(t){return l([],c(t),!1).sort((function(t,e){return me(t)-me(e)}))}function ke(t,e,n){var r,i,a;return void 0===n&&(n={counter:0,visited:new Map}),o(this,(function(o){switch(o.label){case 0:if(!(t.length>2&&t.length>ne.optimizedMinLength))return[3,5];r=1,o.label=1;case 1:return r<t.length-1?n.counter>ne.maxNumberOfTries?[2]:(n.counter+=1,(i=l([],c(t),!1)).splice(r,1),a=be(i),n.visited.has(a)?[2]:ge(i)&&function(t,e){return re.querySelector(be(t))===e}(i,e)?[4,i]:[3,4]):[3,5];case 2:return o.sent(),n.visited.set(a,!0),[5,u(ke(i,e,n))];case 3:o.sent(),o.label=4;case 4:return r++,[3,1];case 5:return[2]}}))}new W(P);var Te=["input","select","textarea"],Ce=function(t,e){return function(n,r){var i,o,u,c=t.pageUrlAllowlist,l=t.shouldTrackEventResolver,a=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!a)return!1;if(l)return l(n,r);if(!Le(window.location.href,c))return!1;var s=(null==r?void 0:r.type)||"";if("string"==typeof s)switch(s.toLowerCase()){case"hidden":case"password":return!1}if(e){var f=e.some((function(t){var e;return!!(null===(e=null==r?void 0:r.matches)||void 0===e?void 0:e.call(r,t))}));if(!f)return!1}switch(a){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:var d=null===(u=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===u?void 0:u.call(window,r);return!(!d||"pointer"!==d.getPropertyValue("cursor")||"click"!==n)||"click"===n}}},Oe=function(t){if(null==t)return!1;if("string"==typeof t){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((t||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(t))return!1}return!0},Ne=function(t){var e,n,r,i=null===(n=null===(e=null==t?void 0:t.tagName)||void 0===e?void 0:e.toLowerCase)||void 0===n?void 0:n.call(e),o=t instanceof HTMLElement&&"true"===(null===(r=t.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!Te.includes(i)&&!o},Pe=function(t){var e="";return Ne(t)&&t.childNodes&&t.childNodes.length&&t.childNodes.forEach((function(t){var n,r="";(n=t)&&3===n.nodeType?t.textContent&&(r=t.textContent):r=Pe(t),e+=r.split(/(\s+)/).filter(Oe).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),e},Ie=function(t,e){var n,r,i="";try{return i=pe(t,{className:function(t){return t!==g}})}catch(t){if(e){var o=t;e.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(o.toString()))}}var u=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(u&&(i=u),t.id)i="#".concat(t.id);else if(t.className){var c=t.className.split(" ").filter((function(t){return t!==g})).join(".");c&&(i="".concat(i,".").concat(c))}return i},Le=function(t,e){return!e||!e.length||e.some((function(e){return"string"==typeof e?t===e:t.match(e)}))},je=function(t){return Object.keys(t).reduce((function(e,n){var r=t[n];return function(t){return null==t||"object"==typeof t&&0===Object.keys(t).length||"string"==typeof t&&0===t.trim().length}(r)||(e[n]=r),e}),{})},Fe=function(t){var e=t.parentElement;if(!e)return"";var n=e.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return Oe(r)?r:""}return Fe(e)},Me=function(t,e){return t?e.some((function(e){var n;return null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e)}))?t:Me(null==t?void 0:t.parentElement,e):null},qe=function(t,e){var n,r,i;if(!t)return{};var o=null===(i=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),u=Ie(t,e),c=((n={})[h]=o,n[p]=Pe(t),n[v]=u,n[y]=window.location.href.split("?")[0],n);return je(c)};var ze=function(t){return!(null===t.event.target||!t.closestTrackedAncestor)},Re=function(){function t(t){var e=(void 0===t?{}:t).origin,n=void 0===e?b:e,r=this;this.endpoint=b,this.requestCallbacks={},this.onSelect=function(t){r.notify({action:"element-selected",data:t})},this.onTrack=function(t,e){"selector-mode-changed"===t?r.notify({action:"track-selector-mode-changed",data:e}):"selector-moved"===t&&r.notify({action:"track-selector-moved",data:e})},this.endpoint=n}return t.prototype.notify=function(t){var e,n,r,i;null===(n=null===(e=this.logger)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"Message sent: ",JSON.stringify(t)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,t,this.endpoint)},t.prototype.sendRequest=function(t,e,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:t,args:e};return new Promise((function(e,u){r.requestCallbacks[i]={resolve:e,reject:u},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout((function(){u(new Error("".concat(t," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},t.prototype.handleResponse=function(t){var e;this.requestCallbacks[t.id]?(this.requestCallbacks[t.id].resolve(t.responseData),delete this.requestCallbacks[t.id]):null===(e=this.logger)||void 0===e||e.warn("No callback found for request id: ".concat(t.id))},t.prototype.setup=function(t){var e=this,n=void 0===t?{}:t,r=n.logger,i=n.endpoint,o=n.isElementSelectable,u=n.cssSelectorAllowlist,c=n.actionClickAllowlist;this.logger=r,i&&this.endpoint===b&&(this.endpoint=i);var l=null;window.addEventListener("message",(function(t){var n,r,i,a,s;if(null===(r=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(t)),e.endpoint===t.origin){var f,d=null==t?void 0:t.data,h=null==d?void 0:d.action;if(h)if("id"in d)null===(a=null===(i=e.logger)||void 0===i?void 0:i.debug)||void 0===a||a.call(i,"Received Response to previous request: ",JSON.stringify(t)),e.handleResponse(d);else if("ping"===h)e.notify({action:"pong"});else if("initialize-visual-tagging-selector"===h){var p=null==d?void 0:d.data;(f="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(t,e){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=f,r.addEventListener("load",(function(){t({status:!0})}),{once:!0}),r.addEventListener("error",(function(){e({status:!1,message:"Failed to load the script ".concat(f)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(t){e(t)}}))).then((function(){var t;l=null===(t=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===t?void 0:t.call(window,{getEventTagProps:qe,isElementSelectable:function(t){return!o||o((null==p?void 0:p.actionType)||"click",t)},onTrack:e.onTrack,onSelect:e.onSelect,visualHighlightClass:g,messenger:e,cssSelectorAllowlist:u,actionClickAllowlist:c}),e.notify({action:"selector-loaded"})})).catch((function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===h&&(null===(s=null==l?void 0:l.close)||void 0===s||s.call(l))}})),this.notify({action:"page-loaded"})},t}(),De=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],Ue=["type"],Ve=["svg","path","g"],We=["password","hidden"];var He=function(t){var e;return t?(e=function(t,e){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(null===i)n+=4;else{var o=Ye(i);n+=o?Array.from(o).length:4}if(n>e)return t.slice(0,r)}return t}(function(t){var e=[];if(!t)return e;e.push(t);for(var n=t.parentElement;n&&"HTML"!==n.tagName;)e.push(n),n=n.parentElement;return e}(t).map((function(t){return function(t){var e,n,r,i,o,c;if(null===t)return null;var l=t.tagName.toLowerCase(),a={tag:l},s=Array.from(null!==(i=null===(r=t.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);s.length&&(a.index=s.indexOf(t),a.indexOfType=s.filter((function(e){return e.tagName===t.tagName})).indexOf(t));var f=null===(c=null===(o=t.previousElementSibling)||void 0===o?void 0:o.tagName)||void 0===c?void 0:c.toLowerCase();f&&(a.prevSib=f);var d=t.id;d&&(a.id=d);var h=Array.from(t.classList);h.length&&(a.classes=h);var p={},v=Array.from(t.attributes).filter((function(t){return!De.includes(t.name)})),y=!Ne(t);if(!We.includes(t.type)&&!Ve.includes(l))try{for(var b=u(v),m=b.next();!m.done;m=b.next()){var g=m.value;y&&!Ue.includes(g.name)||(p[g.name]=String(g.value).substring(0,128))}}catch(t){e={error:t}}finally{try{m&&!m.done&&(n=b.return)&&n.call(b)}finally{if(e)throw e.error}}return Object.keys(p).length&&(a.attrs=p),a}(t)})),1024),e):[]};function Ye(t,e){void 0===e&&(e=!1);try{if(null==t)return e?"None":null;if("string"==typeof t)return e?(t=t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(t,"'"):t.includes("'")?'"'.concat(t.replace(/'/g,"\\'"),'"'):"'".concat(t,"'"):t;if("boolean"==typeof t)return t?"True":"False";if(Array.isArray(t)){var n=t.map((function(t){return Ye(t,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof t){var r=Object.entries(t).filter((function(t){return null!=c(t,1)[0]})).map((function(t){var e=c(t,2),n=e[0],r=e[1];return"".concat(String(Ye(n,!0)),": ").concat(String(Ye(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return t.toString()}catch(t){return null}}function Be(t){var e,n,r,i=t.amplitude,o=t.allObservables,l=t.options,a=t.shouldTrackEvent,s=o.clickObservable,f=s.pipe(B((function(t,e){var n,r=!1;t.subscribe(X(e,(function(t){var i=n;n=t,r&&e.next([i,t]),r=!0})))})),se((function(t){var e=c(t,2),n=e[0],r=e[1],i=n.event.target!==r.event.target,o=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return i&&!o}))),h=ae(f,s.pipe((e=l.debounceTime,void 0===n&&(n=bt),B((function(t,r){var i=null,o=null,u=null,c=function(){if(i){i.unsubscribe(),i=null;var t=o;o=null,r.next(t)}};function l(){var t=u+e,o=n.now();if(o<t)return i=this.schedule(void 0,t-o),void r.add(i);c()}t.subscribe(X(r,(function(t){o=t,u=n.now(),i||(i=n.schedule(l,e),r.add(i))}),(function(){c(),r.complete()}),void 0,(function(){o=i=null})))}))),Zt((function(){return"timeout"}))));return s.pipe(he(0),se(ze),se((function(t){return a("click",t.closestTrackedAncestor)})),(r=h,B((function(t,e){var n=[];return t.subscribe(X(e,(function(t){return n.push(t)}),(function(){e.next(n),e.complete()}))),Rt(r).subscribe(X(e,(function(){var t=n;n=[],e.next(t)}),P)),function(){n=null}})))).subscribe((function(t){var e,n,r=(t.length,d);try{for(var o=u(t),c=o.next();!c.done;c=o.next()){var l=c.value;null==i||i.track(r,l.targetElementProperties,{time:l.timestamp})}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}))}function Xe(t){var e=t.amplitude,n=t.allObservables,r=t.options,i=t.getEventProperties,o=t.shouldTrackEvent,u=t.shouldTrackActionClick,a=n.clickObservable,s=n.mutationObservable,f=n.navigateObservable,h=a.pipe(se((function(t){return!o("click",t.closestTrackedAncestor)})),Zt((function(t){var e=Me(t.event.target,r.actionClickAllowlist);return t.closestTrackedAncestor=e,null!==t.closestTrackedAncestor&&(t.targetElementProperties=i(t.type,t.closestTrackedAncestor)),t})),se(ze),se((function(t){return u("click",t.closestTrackedAncestor)}))),p=[s];f&&p.push(f);var v,y,b=ae.apply(void 0,l([],c(p),!1)),m=h.pipe((v=function(t){return b.pipe(function(t,e){var n=Xt(t)?{first:t}:"number"==typeof t?{each:t}:t,r=n.first,i=n.each,o=n.with,u=void 0===o?Jt:o,c=n.scheduler,l=void 0===c?null!=e?e:bt:c,a=n.meta,s=void 0===a?null:a;if(null==r&&null==i)throw new TypeError("No timeout provided.");return B((function(t,e){var n,o,c=null,a=0,f=function(t){o=Ut(e,l,(function(){try{n.unsubscribe(),Rt(u({meta:s,lastValue:c,seen:a})).subscribe(e)}catch(t){e.error(t)}}),t)};n=t.subscribe(X(e,(function(t){null==o||o.unsubscribe(),a++,e.next(c=t),i>0&&f(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),c=null}))),!a&&f(null!=r?"number"==typeof r?r:+r-l.now():i)}))}({first:500,with:function(){return Et}}),Zt((function(){return t})))},B((function(t,e){var n=null,r=0,i=!1,o=function(){return i&&!n&&e.complete()};t.subscribe(X(e,(function(t){null==n||n.unsubscribe();var i=0,u=r++;Rt(v(t,u)).subscribe(n=X(e,(function(n){return e.next(y?y(t,n,u,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return m.subscribe((function(t){null==e||e.track(d,i("click",t.closestTrackedAncestor))}))}var Ge,Je=["a","button","input","select","textarea","label","[data-amp-default-track]",".amp-default-track"],Ze=["div","span","h1","h2","h3","h4","h5","h6"],$e="data-amp-track-";!function(t){t.ClickObservable="clickObservable",t.ChangeObservable="changeObservable",t.NavigateObservable="navigateObservable",t.MutationObservable="mutationObservable"}(Ge||(Ge={}));var Ke=function(t){var e,n,a;void 0===t&&(t={});var s=t.dataAttributePrefix,f=void 0===s?$e:s,d=t.visualTaggingOptions,b=void 0===d?{enabled:!0,messenger:new Re}:d;t.cssSelectorAllowlist=null!==(e=t.cssSelectorAllowlist)&&void 0!==e?e:Je,t.actionClickAllowlist=null!==(n=t.actionClickAllowlist)&&void 0!==n?n:Ze,t.debounceTime=null!==(a=t.debounceTime)&&void 0!==a?a:1e3;var g="@amplitude/plugin-autocapture-browser",w=[],_=void 0,x=function(t,e){var n,r,i,o=null===(i=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),u="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{left:null,top:null},c=e.getAttribute("aria-label"),l=function(t,e){return t.getAttributeNames().reduce((function(n,r){if(r.startsWith(e)){var i=r.replace(e,""),o=t.getAttribute(r);i&&(n[i]=o||"")}return n}),{})}(e,f),a=Fe(e),s=Ie(e,_),d=((n={})["[Amplitude] Element ID"]=e.id,n["[Amplitude] Element Class"]=e.className,n["[Amplitude] Element Hierarchy"]=He(e),n[h]=o,n[p]=Pe(e),n["[Amplitude] Element Position Left"]=null==u.left?null:Math.round(u.left),n["[Amplitude] Element Position Top"]=null==u.top?null:Math.round(u.top),n["[Amplitude] Element Aria Label"]=c,n["[Amplitude] Element Attributes"]=l,n[v]=s,n["[Amplitude] Element Parent Label"]=a,n[y]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===o&&"click"===t&&e instanceof HTMLAnchorElement&&(d["[Amplitude] Element Href"]=e.href),je(d)},A=function(e,n){var r={event:e,timestamp:Date.now(),type:n};if(function(t){return"click"===t.type||"change"===t.type}(r)&&null!==r.event.target){var i=Me(r.event.target,t.cssSelectorAllowlist);return i&&(r.closestTrackedAncestor=i,r.targetElementProperties=x(r.type,i)),r}return r};return{name:g,type:"enrichment",setup:function(e,n){return i(void 0,void 0,void 0,(function(){var i,u,a,s,f,d,h,p,v,y,E;return o(this,(function(o){return n?(_=e.loggerProvider,"undefined"==typeof document||(i=Ce(t,t.cssSelectorAllowlist),u=Ce(t,t.actionClickAllowlist),a=function(){var t,e,n=ce(document,"click",{capture:!0}).pipe(Zt((function(t){return A(t,"click")}))),r=ce(document,"change",{capture:!0}).pipe(Zt((function(t){return A(t,"change")})));window.navigation&&(e=ce(window.navigation,"navigate").pipe(Zt((function(t){return A(t,"navigate")}))));var i=new W((function(t){var e=new MutationObserver((function(e){t.next(e)}));return e.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return e.disconnect()}})).pipe(Zt((function(t){return A(t,"mutation")})));return(t={})[Ge.ClickObservable]=n,t[Ge.ChangeObservable]=r,t[Ge.NavigateObservable]=e,t[Ge.MutationObservable]=i,t}(),s=Be({allObservables:a,options:t,amplitude:n,shouldTrackEvent:i}),w.push(s),f=function(t){var e=t.amplitude,n=t.allObservables,r=t.getEventProperties,i=t.shouldTrackEvent;return n.changeObservable.pipe(se(ze),se((function(t){return i("change",t.closestTrackedAncestor)}))).subscribe((function(t){null==e||e.track("[Amplitude] Element Changed",r("change",t.closestTrackedAncestor))}))}({allObservables:a,getEventProperties:x,amplitude:n,shouldTrackEvent:i}),w.push(f),d=Xe({allObservables:a,options:t,getEventProperties:x,amplitude:n,shouldTrackEvent:i,shouldTrackActionClick:u}),w.push(d),null===(y=null==e?void 0:e.loggerProvider)||void 0===y||y.log("".concat(g," has been successfully added.")),window.opener&&b.enabled&&(h=t.cssSelectorAllowlist,p=t.actionClickAllowlist,null===(E=b.messenger)||void 0===E||E.setup(r(r({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:m[e.serverZone]}),{isElementSelectable:Ce(t,l(l([],c(h),!1),c(p),!1)),cssSelectorAllowlist:h,actionClickAllowlist:p})))),[2]):(null===(v=null==e?void 0:e.loggerProvider)||void 0===v||v.warn("".concat(g," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[2])}))}))},execute:function(t){return i(void 0,void 0,void 0,(function(){return o(this,(function(e){return[2,t]}))}))},teardown:function(){return i(void 0,void 0,void 0,(function(){var t,e,n,r;return o(this,(function(i){try{for(t=u(w),e=t.next();!e.done;e=t.next())e.value.unsubscribe()}catch(t){n={error:t}}finally{try{e&&!e.done&&(r=t.return)&&r.call(t)}finally{if(n)throw n.error}}return[2]}))}))}}};t.DEFAULT_CSS_SELECTOR_ALLOWLIST=Je,t.DEFAULT_DATA_ATTRIBUTE_PREFIX=$e,t.WindowMessenger=Re,t.autocapturePlugin=Ke,t.plugin=Ke,Object.defineProperty(t,"__esModule",{value:!0})})); |
import { BrowserClient, BrowserConfig, EnrichmentPlugin } from '@amplitude/analytics-types'; | ||
import { Observable } from 'rxjs'; | ||
import { Messenger } from './libs/messenger'; | ||
import { ActionType } from './typings/autocapture'; | ||
import { HasEventTargetAddRemove } from 'rxjs/internal/observable/fromEvent'; | ||
declare global { | ||
interface Window { | ||
navigation: HasEventTargetAddRemove<Event>; | ||
} | ||
} | ||
interface NavigateEvent extends Event { | ||
readonly navigationType: 'reload' | 'push' | 'replace' | 'traverse'; | ||
readonly destination: { | ||
readonly url: string; | ||
readonly key: string | null; | ||
readonly id: string | null; | ||
readonly index: number; | ||
readonly sameDocument: boolean; | ||
getState(): any; | ||
}; | ||
readonly canIntercept: boolean; | ||
readonly userInitiated: boolean; | ||
readonly hashChange: boolean; | ||
readonly signal: AbortSignal; | ||
readonly formData: FormData | null; | ||
readonly downloadRequest: string | null; | ||
readonly info: any; | ||
readonly hasUAVisualTransition: boolean; | ||
/** @see https://github.com/WICG/navigation-api/pull/264 */ | ||
readonly sourceElement: Element | null; | ||
scroll(): void; | ||
} | ||
type BrowserEnrichmentPlugin = EnrichmentPlugin<BrowserClient, BrowserConfig>; | ||
export declare const DEFAULT_CSS_SELECTOR_ALLOWLIST: string[]; | ||
export declare const DEFAULT_ACTION_CLICK_ALLOWLIST: string[]; | ||
export declare const DEFAULT_DATA_ATTRIBUTE_PREFIX = "data-amp-track-"; | ||
@@ -41,5 +71,41 @@ export interface AutocaptureOptions { | ||
}; | ||
/** | ||
* Debounce time in milliseconds for tracking events. | ||
* This is used to detect rage clicks. | ||
*/ | ||
debounceTime?: number; | ||
/** | ||
* CSS selector allowlist for tracking clicks that result in a DOM change/navigation on elements not already allowed by the cssSelectorAllowlist | ||
*/ | ||
actionClickAllowlist?: string[]; | ||
} | ||
export type AutoCaptureOptionsWithDefaults = Required<Pick<AutocaptureOptions, 'debounceTime' | 'cssSelectorAllowlist' | 'actionClickAllowlist'>> & AutocaptureOptions; | ||
export declare enum ObservablesEnum { | ||
ClickObservable = "clickObservable", | ||
ChangeObservable = "changeObservable", | ||
NavigateObservable = "navigateObservable", | ||
MutationObservable = "mutationObservable" | ||
} | ||
type BaseTimestampedEvent<T> = { | ||
event: T; | ||
timestamp: number; | ||
type: 'rage' | 'click' | 'change' | 'error' | 'navigate' | 'mutation'; | ||
}; | ||
export type ElementBasedEvent = MouseEvent | Event; | ||
export type ElementBasedTimestampedEvent<T> = BaseTimestampedEvent<T> & { | ||
event: MouseEvent | Event; | ||
type: 'click' | 'change'; | ||
closestTrackedAncestor: Element; | ||
targetElementProperties: Record<string, any>; | ||
}; | ||
export type TimestampedEvent<T> = BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T>; | ||
export interface AllWindowObservables { | ||
[ObservablesEnum.ClickObservable]: Observable<ElementBasedTimestampedEvent<MouseEvent>>; | ||
[ObservablesEnum.ChangeObservable]: Observable<ElementBasedTimestampedEvent<Event>>; | ||
[ObservablesEnum.NavigateObservable]: Observable<TimestampedEvent<NavigateEvent>> | undefined; | ||
[ObservablesEnum.MutationObservable]: Observable<TimestampedEvent<MutationRecord[]>>; | ||
} | ||
export declare function isElementBasedEvent<T>(event: BaseTimestampedEvent<T>): event is ElementBasedTimestampedEvent<T>; | ||
export declare const autocapturePlugin: (options?: AutocaptureOptions) => BrowserEnrichmentPlugin; | ||
export {}; | ||
//# sourceMappingURL=autocapture-plugin.d.ts.map |
import { Logger } from '@amplitude/analytics-types'; | ||
import { AutocaptureOptions, ElementBasedEvent, ElementBasedTimestampedEvent } from './autocapture-plugin'; | ||
import { ActionType } from './typings/autocapture'; | ||
export type JSONValue = string | number | boolean | null | { | ||
[x: string]: JSONValue; | ||
} | Array<JSONValue>; | ||
export type shouldTrackEvent = (actionType: ActionType, element: Element) => boolean; | ||
export declare const createShouldTrackEvent: (autocaptureOptions: AutocaptureOptions, allowlist: string[]) => shouldTrackEvent; | ||
export declare const isNonSensitiveString: (text: string | null) => boolean; | ||
@@ -28,2 +32,3 @@ export declare const isTextNode: (node: Node) => boolean; | ||
export declare function generateUniqueId(): string; | ||
export declare const filterOutNonTrackableEvents: (event: ElementBasedTimestampedEvent<ElementBasedEvent>) => boolean; | ||
//# sourceMappingURL=helpers.d.ts.map |
@@ -59,6 +59,8 @@ import { Logger } from '@amplitude/analytics-types'; | ||
private handleResponse; | ||
setup({ logger, endpoint, isElementSelectable, }?: { | ||
setup({ logger, endpoint, isElementSelectable, cssSelectorAllowlist, actionClickAllowlist, }?: { | ||
logger?: Logger; | ||
endpoint?: string; | ||
isElementSelectable?: (action: InitializeVisualTaggingSelectorData['actionType'], element: Element) => boolean; | ||
cssSelectorAllowlist?: string[]; | ||
actionClickAllowlist?: string[]; | ||
}): void; | ||
@@ -65,0 +67,0 @@ private onSelect; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.0.0-beta.1"; | ||
export declare const VERSION = "1.0.0-beta.2"; | ||
//# sourceMappingURL=version.d.ts.map |
{ | ||
"name": "@amplitude/plugin-autocapture-browser", | ||
"version": "1.0.0-beta.2", | ||
"version": "1.0.0-beta.3", | ||
"description": "", | ||
@@ -44,2 +44,3 @@ "author": "Amplitude Inc", | ||
"@amplitude/analytics-types": ">=1 <3", | ||
"rxjs": "^7.8.1", | ||
"tslib": "^2.4.1" | ||
@@ -61,3 +62,3 @@ }, | ||
], | ||
"gitHead": "25e93059b952a89b450201683355aa3ebe1c6ffa" | ||
"gitHead": "8f38464162deb357c20d6612ea18a6328ceb2cc0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
550260
127
4042
4
+ Addedrxjs@^7.8.1
+ Addedrxjs@7.8.1(transitive)