@amplitude/plugin-autocapture-browser 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/autocapture/track-action-click.d.ts +1 -2
- package/lib/cjs/autocapture/track-action-click.d.ts.map +1 -1
- package/lib/cjs/autocapture/track-action-click.js.map +1 -1
- package/lib/cjs/autocapture/track-change.d.ts +1 -2
- package/lib/cjs/autocapture/track-change.d.ts.map +1 -1
- package/lib/cjs/autocapture/track-change.js.map +1 -1
- package/lib/cjs/autocapture-plugin.d.ts +3 -52
- package/lib/cjs/autocapture-plugin.d.ts.map +1 -1
- package/lib/cjs/autocapture-plugin.js +12 -30
- package/lib/cjs/autocapture-plugin.js.map +1 -1
- package/lib/cjs/helpers.d.ts +3 -4
- package/lib/cjs/helpers.d.ts.map +1 -1
- package/lib/cjs/helpers.js +15 -6
- package/lib/cjs/helpers.js.map +1 -1
- package/lib/cjs/hierarchy.js +6 -6
- package/lib/cjs/hierarchy.js.map +1 -1
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +1 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/libs/finder.js +4 -2
- package/lib/cjs/libs/finder.js.map +1 -1
- package/lib/cjs/libs/messenger.d.ts +1 -6
- package/lib/cjs/libs/messenger.d.ts.map +1 -1
- package/lib/cjs/libs/messenger.js.map +1 -1
- package/lib/cjs/typings/autocapture.d.ts +0 -1
- package/lib/cjs/typings/autocapture.d.ts.map +1 -1
- package/lib/cjs/typings/autocapture.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.d.ts.map +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/autocapture/track-action-click.d.ts +1 -2
- package/lib/esm/autocapture/track-action-click.d.ts.map +1 -1
- package/lib/esm/autocapture/track-action-click.js.map +1 -1
- package/lib/esm/autocapture/track-change.d.ts +1 -2
- package/lib/esm/autocapture/track-change.d.ts.map +1 -1
- package/lib/esm/autocapture/track-change.js.map +1 -1
- package/lib/esm/autocapture-plugin.d.ts +3 -52
- package/lib/esm/autocapture-plugin.d.ts.map +1 -1
- package/lib/esm/autocapture-plugin.js +8 -26
- package/lib/esm/autocapture-plugin.js.map +1 -1
- package/lib/esm/helpers.d.ts +3 -4
- package/lib/esm/helpers.d.ts.map +1 -1
- package/lib/esm/helpers.js +15 -6
- package/lib/esm/helpers.js.map +1 -1
- package/lib/esm/hierarchy.js +6 -6
- package/lib/esm/hierarchy.js.map +1 -1
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/libs/finder.js +4 -2
- package/lib/esm/libs/finder.js.map +1 -1
- package/lib/esm/libs/messenger.d.ts +1 -6
- package/lib/esm/libs/messenger.d.ts.map +1 -1
- package/lib/esm/libs/messenger.js.map +1 -1
- package/lib/esm/typings/autocapture.d.ts +0 -1
- package/lib/esm/typings/autocapture.d.ts.map +1 -1
- package/lib/esm/typings/autocapture.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.d.ts.map +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/scripts/amplitude-min.js +1 -1
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/autocapture/track-action-click.d.ts +1 -2
- package/lib/scripts/autocapture/track-action-click.d.ts.map +1 -1
- package/lib/scripts/autocapture/track-change.d.ts +1 -2
- package/lib/scripts/autocapture/track-change.d.ts.map +1 -1
- package/lib/scripts/autocapture-plugin.d.ts +3 -52
- package/lib/scripts/autocapture-plugin.d.ts.map +1 -1
- package/lib/scripts/helpers.d.ts +3 -4
- package/lib/scripts/helpers.d.ts.map +1 -1
- package/lib/scripts/index.d.ts +2 -2
- package/lib/scripts/index.d.ts.map +1 -1
- package/lib/scripts/libs/messenger.d.ts +1 -6
- package/lib/scripts/libs/messenger.d.ts.map +1 -1
- package/lib/scripts/typings/autocapture.d.ts +0 -1
- package/lib/scripts/typings/autocapture.d.ts.map +1 -1
- package/lib/scripts/version.d.ts +1 -1
- package/lib/scripts/version.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messenger.js","sourceRoot":"","sources":["../../../src/libs/messenger.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,0CAA0C;AAC1C,OAAO,EACL,gBAAgB,EAChB,4CAA4C,EAC5C,wCAAwC,GACzC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAwEjF,yDAAyD;AACzD;IAUE,yBAAY,EAAuD;YAAvD,qBAAqD,EAAE,KAAA,EAArD,cAAyB,EAAzB,MAAM,mBAAG,gBAAgB,KAAA;QAAvC,iBAEC;QAXD,aAAQ,GAAG,gBAAgB,CAAC;QAE5B,qBAAgB,GAKZ,EAAE,CAAC;QAqIC,aAAQ,GAAG,UAAC,IAAyB;YAC3C,KAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACpD,CAAC,CAAC;QAEM,YAAO,GAAG,UAAC,IAAY,EAAE,UAA4C;YAC3E,IAAI,IAAI,KAAK,uBAAuB,EAAE;gBACpC,KAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,6BAA6B,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;aAC1E;iBAAM,IAAI,IAAI,KAAK,gBAAgB,EAAE;gBACpC,KAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;aACnE;QACH,CAAC,CAAC;QA5IA,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;IACzB,CAAC;IAEO,gCAAM,GAAd,UAAe,OAAyC;;QACtD,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,KAAK,mDAAG,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAChE,MAAA,MAAC,MAAM,CAAC,MAAsB,0CAAE,WAAW,mDAAG,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;IAED,6CAA6C;IACtC,qCAAW,GAAlB,UAAmB,MAAc,EAAE,IAAyB,EAAE,OAA6B;QAA3F,iBA0BC;QA1B6D,wBAAA,EAAA,YAAY,OAAO,EAAE,KAAM,EAAE;QACzF,oBAAoB;QACpB,IAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;QAC9B,IAAM,OAAO,GAAG;YACd,EAAE,IAAA;YACF,MAAM,QAAA;YACN,IAAI,MAAA;SACL,CAAC;QAEF,uEAAuE;QACvE,IAAM,OAAO,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAC1C,KAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,SAAA,EAAE,MAAM,QAAA,EAAE,CAAC;YAEhD,mBAAmB;YACnB,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAErB,0BAA0B;YAC1B,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,IAAG,CAAC,EAAE;gBACxB,UAAU,CAAC;oBACT,MAAM,CAAC,IAAI,KAAK,CAAC,UAAG,MAAM,6BAAmB,EAAE,MAAG,CAAC,CAAC,CAAC;oBACrD,OAAO,KAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;gBACnC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,yCAAyC;IACjC,wCAAc,GAAtB,UAAuB,QAAyB;;QAC9C,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;YACvC,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,CAAC,4CAAqC,QAAQ,CAAC,EAAE,CAAE,CAAC,CAAC;YACtE,OAAO;SACR;QAED,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,+BAAK,GAAL,UAAM,EAYA;QAZN,iBAgFC;YAhFK,qBAYF,EAAE,KAAA,EAXJ,MAAM,YAAA,EACN,QAAQ,cAAA,EACR,mBAAmB,yBAAA,EACnB,oBAAoB,0BAAA,EACpB,oBAAoB,0BAAA;QAQpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,gDAAgD;QAChD,IAAI,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,gBAAgB,EAAE;YAClD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;QACD,IAAI,sCAAsC,GAAQ,IAAI,CAAC;QAEvD,sEAAsE;QACtE,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAC,KAAK;;YACvC,MAAA,MAAA,KAAI,CAAC,MAAM,0CAAE,KAAK,mDAAG,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;YAElE,iDAAiD;YACjD,IAAI,KAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,MAAM,EAAE;gBAClC,OAAO;aACR;YAED,IAAM,SAAS,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAyC,CAAC;YACnE,IAAM,MAAM,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,CAAC;YAEjC,iCAAiC;YACjC,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO;aACR;YAED,sDAAsD;YACtD,IAAI,IAAI,IAAI,SAAS,EAAE;gBACrB,MAAA,MAAA,KAAI,CAAC,MAAM,0CAAE,KAAK,mDAAG,yCAAyC,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;gBACvF,KAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;gBAE/B,8DAA8D;aAC/D;iBAAM;gBACL,IAAI,MAAM,KAAK,MAAM,EAAE;oBACrB,KAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;iBACjC;qBAAM,IAAI,MAAM,KAAK,oCAAoC,EAAE;oBAC1D,IAAM,YAAU,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAA2C,CAAC;oBAC1E,eAAe,CAAC,4CAA4C,CAAC;yBAC1D,IAAI,CAAC;;wBACJ,2BAA2B;wBAC3B,sCAAsC,GAAG,MAAC,MAAc,aAAd,MAAM,uBAAN,MAAM,CAAU,8BAA8B,uDAAG;4BACzF,gBAAgB,kBAAA;4BAChB,mBAAmB,EAAE,UAAC,OAAgB;gCACpC,IAAI,mBAAmB,EAAE;oCACvB,OAAO,mBAAmB,CAAC,CAAA,YAAU,aAAV,YAAU,uBAAV,YAAU,CAAE,UAAU,KAAI,OAAO,EAAE,OAAO,CAAC,CAAC;iCACxE;gCACD,OAAO,IAAI,CAAC;4BACd,CAAC;4BACD,OAAO,EAAE,KAAI,CAAC,OAAO;4BACrB,QAAQ,EAAE,KAAI,CAAC,QAAQ;4BACvB,oBAAoB,EAAE,wCAAwC;4BAC9D,SAAS,EAAE,KAAI;4BACf,oBAAoB,sBAAA;4BACpB,oBAAoB,sBAAA;yBACrB,CAAC,CAAC;wBACH,KAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;oBAC7C,CAAC,CAAC;yBACD,KAAK,CAAC;;wBACL,MAAA,KAAI,CAAC,MAAM,0CAAE,IAAI,CAAC,8CAA8C,CAAC,CAAC;oBACpE,CAAC,CAAC,CAAC;iBACN;qBAAM,IAAI,MAAM,KAAK,+BAA+B,EAAE;oBACrD,2BAA2B;oBAC3B,MAAA,sCAAsC,aAAtC,sCAAsC,uBAAtC,sCAAsC,CAAE,KAAK,sFAAI,CAAC;iBACnD;aACF;QACH,CAAC,CAAC,CAAC;QAEH,oDAAoD;QACpD,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IACzC,CAAC;IAaH,sBAAC;AAAD,CAAC,AAxJD,IAwJC","sourcesContent":["/* istanbul ignore file */\n/* eslint-disable no-restricted-globals */\nimport {\n AMPLITUDE_ORIGIN,\n AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL,\n AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS,\n} from '../constants';\nimport { asyncLoadScript, generateUniqueId, getEventTagProps } from '../helpers';\nimport { Logger } from '@amplitude/analytics-types';\nimport { ActionType } from '../typings/autocapture';\n\nexport interface Messenger {\n logger?: Logger;\n setup: () => void;\n}\n\nexport type Action =\n | 'ping'\n | 'pong'\n | 'page-loaded'\n | 'selector-loaded'\n | 'initialize-visual-tagging-selector'\n | 'close-visual-tagging-selector'\n | 'element-selected'\n | 'track-selector-mode-changed'\n | 'track-selector-moved';\n\ninterface InitializeVisualTaggingSelectorData {\n actionType: ActionType;\n}\n\ninterface ElementSelectedData {\n '[Amplitude] Element Hierarchy'?: string;\n '[Amplitude] Element Tag'?: string;\n '[Amplitude] Element Text'?: string;\n '[Amplitude] Element Selector'?: string;\n '[Amplitude] Page URL'?: string;\n elementScreenshot?: Blob;\n}\n\ninterface TrackSelectorModeChangedData {\n newMode: string;\n pageUrl?: string;\n}\n\ninterface TrackSelectorMovedData {\n newEditorLocation: string;\n pageUrl?: string;\n}\n\nexport type ActionData = {\n ping: null | undefined;\n pong: null | undefined;\n 'page-loaded': null | undefined;\n 'selector-loaded': null | undefined;\n 'initialize-visual-tagging-selector': InitializeVisualTaggingSelectorData | null | undefined;\n 'close-visual-tagging-selector': null | undefined;\n 'element-selected': ElementSelectedData;\n 'track-selector-mode-changed': TrackSelectorModeChangedData;\n 'track-selector-moved': TrackSelectorMovedData;\n};\n\nexport interface Message<A extends Action> {\n action: A;\n data?: ActionData[A];\n}\n\ntype MessageRequest = {\n id: string;\n action: string;\n args: Record<string, any>;\n};\n\ntype MessageResponse = {\n id: string;\n action: string;\n responseData: any;\n};\n\n// TODO: use MessageChannel instead of window.postMessage\nexport class WindowMessenger implements Messenger {\n endpoint = AMPLITUDE_ORIGIN;\n logger?: Logger;\n requestCallbacks: {\n [id: string]: {\n resolve: (data: any) => void;\n reject: (data: any) => void;\n };\n } = {};\n\n constructor({ origin = AMPLITUDE_ORIGIN }: { origin?: string } = {}) {\n this.endpoint = origin;\n }\n\n private notify(message: Message<Action> | MessageRequest) {\n this.logger?.debug?.('Message sent: ', JSON.stringify(message));\n (window.opener as WindowProxy)?.postMessage?.(message, this.endpoint);\n }\n\n // Send an async request to the parent window\n public sendRequest(action: string, args: Record<string, any>, options = { timeout: 15_000 }): Promise<any> {\n // Create Request ID\n const id = generateUniqueId();\n const request = {\n id,\n action,\n args,\n };\n\n // Create a Promise that will be resolved when the response is received\n const promise = new Promise((resolve, reject) => {\n this.requestCallbacks[id] = { resolve, reject };\n\n // Send the request\n this.notify(request);\n\n // Handle request timeouts\n if (options?.timeout > 0) {\n setTimeout(() => {\n reject(new Error(`${action} timed out (id: ${id})`));\n delete this.requestCallbacks[id];\n }, options.timeout);\n }\n });\n\n return promise;\n }\n\n // Handle messages from the parent window\n private handleResponse(response: MessageResponse) {\n if (!this.requestCallbacks[response.id]) {\n this.logger?.warn(`No callback found for request id: ${response.id}`);\n return;\n }\n\n this.requestCallbacks[response.id].resolve(response.responseData);\n delete this.requestCallbacks[response.id];\n }\n\n setup({\n logger,\n endpoint,\n isElementSelectable,\n cssSelectorAllowlist,\n actionClickAllowlist,\n }: {\n logger?: Logger;\n endpoint?: string;\n isElementSelectable?: (action: InitializeVisualTaggingSelectorData['actionType'], element: Element) => boolean;\n cssSelectorAllowlist?: string[];\n actionClickAllowlist?: string[];\n } = {}) {\n this.logger = logger;\n // If endpoint is customized, don't override it.\n if (endpoint && this.endpoint === AMPLITUDE_ORIGIN) {\n this.endpoint = endpoint;\n }\n let amplitudeVisualTaggingSelectorInstance: any = null;\n\n // Attach Event Listener to listen for messages from the parent window\n window.addEventListener('message', (event) => {\n this.logger?.debug?.('Message received: ', JSON.stringify(event));\n\n // Only accept messages from the specified origin\n if (this.endpoint !== event.origin) {\n return;\n }\n\n const eventData = event?.data as Message<Action> | MessageResponse;\n const action = eventData?.action;\n\n // Ignore messages without action\n if (!action) {\n return;\n }\n\n // If id exists, handle responses to previous requests\n if ('id' in eventData) {\n this.logger?.debug?.('Received Response to previous request: ', JSON.stringify(event));\n this.handleResponse(eventData);\n\n // If action exists, handle the action using existing handlers\n } else {\n if (action === 'ping') {\n this.notify({ action: 'pong' });\n } else if (action === 'initialize-visual-tagging-selector') {\n const actionData = eventData?.data as InitializeVisualTaggingSelectorData;\n asyncLoadScript(AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL)\n .then(() => {\n // eslint-disable-next-line\n amplitudeVisualTaggingSelectorInstance = (window as any)?.amplitudeVisualTaggingSelector?.({\n getEventTagProps,\n isElementSelectable: (element: Element) => {\n if (isElementSelectable) {\n return isElementSelectable(actionData?.actionType || 'click', element);\n }\n return true;\n },\n onTrack: this.onTrack,\n onSelect: this.onSelect,\n visualHighlightClass: AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS,\n messenger: this,\n cssSelectorAllowlist,\n actionClickAllowlist,\n });\n this.notify({ action: 'selector-loaded' });\n })\n .catch(() => {\n this.logger?.warn('Failed to initialize visual tagging selector');\n });\n } else if (action === 'close-visual-tagging-selector') {\n // eslint-disable-next-line\n amplitudeVisualTaggingSelectorInstance?.close?.();\n }\n }\n });\n\n // Notify the parent window that the page has loaded\n this.notify({ action: 'page-loaded' });\n }\n\n private onSelect = (data: ElementSelectedData) => {\n this.notify({ action: 'element-selected', data });\n };\n\n private onTrack = (type: string, properties: { [key: string]: string | null }) => {\n if (type === 'selector-mode-changed') {\n this.notify({ action: 'track-selector-mode-changed', data: properties });\n } else if (type === 'selector-moved') {\n this.notify({ action: 'track-selector-moved', data: properties });\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"messenger.js","sourceRoot":"","sources":["../../../src/libs/messenger.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,0CAA0C;AAC1C,OAAO,EACL,gBAAgB,EAChB,4CAA4C,EAC5C,wCAAwC,GACzC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAkEjF,yDAAyD;AACzD;IAUE,yBAAY,EAAuD;YAAvD,qBAAqD,EAAE,KAAA,EAArD,cAAyB,EAAzB,MAAM,mBAAG,gBAAgB,KAAA;QAAvC,iBAEC;QAXD,aAAQ,GAAG,gBAAgB,CAAC;QAE5B,qBAAgB,GAKZ,EAAE,CAAC;QAqIC,aAAQ,GAAG,UAAC,IAAyB;YAC3C,KAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACpD,CAAC,CAAC;QAEM,YAAO,GAAG,UAAC,IAAY,EAAE,UAA4C;YAC3E,IAAI,IAAI,KAAK,uBAAuB,EAAE;gBACpC,KAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,6BAA6B,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;aAC1E;iBAAM,IAAI,IAAI,KAAK,gBAAgB,EAAE;gBACpC,KAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;aACnE;QACH,CAAC,CAAC;QA5IA,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;IACzB,CAAC;IAEO,gCAAM,GAAd,UAAe,OAAyC;;QACtD,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,KAAK,mDAAG,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAChE,MAAA,MAAC,MAAM,CAAC,MAAsB,0CAAE,WAAW,mDAAG,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;IAED,6CAA6C;IACtC,qCAAW,GAAlB,UAAmB,MAAc,EAAE,IAAyB,EAAE,OAA6B;QAA3F,iBA0BC;QA1B6D,wBAAA,EAAA,YAAY,OAAO,EAAE,KAAM,EAAE;QACzF,oBAAoB;QACpB,IAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;QAC9B,IAAM,OAAO,GAAG;YACd,EAAE,IAAA;YACF,MAAM,QAAA;YACN,IAAI,MAAA;SACL,CAAC;QAEF,uEAAuE;QACvE,IAAM,OAAO,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAC1C,KAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,SAAA,EAAE,MAAM,QAAA,EAAE,CAAC;YAEhD,mBAAmB;YACnB,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAErB,0BAA0B;YAC1B,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,IAAG,CAAC,EAAE;gBACxB,UAAU,CAAC;oBACT,MAAM,CAAC,IAAI,KAAK,CAAC,UAAG,MAAM,6BAAmB,EAAE,MAAG,CAAC,CAAC,CAAC;oBACrD,OAAO,KAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;gBACnC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,yCAAyC;IACjC,wCAAc,GAAtB,UAAuB,QAAyB;;QAC9C,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;YACvC,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,CAAC,4CAAqC,QAAQ,CAAC,EAAE,CAAE,CAAC,CAAC;YACtE,OAAO;SACR;QAED,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,+BAAK,GAAL,UAAM,EAYA;QAZN,iBAgFC;YAhFK,qBAYF,EAAE,KAAA,EAXJ,MAAM,YAAA,EACN,QAAQ,cAAA,EACR,mBAAmB,yBAAA,EACnB,oBAAoB,0BAAA,EACpB,oBAAoB,0BAAA;QAQpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,gDAAgD;QAChD,IAAI,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,gBAAgB,EAAE;YAClD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;QACD,IAAI,sCAAsC,GAAQ,IAAI,CAAC;QAEvD,sEAAsE;QACtE,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAC,KAAK;;YACvC,MAAA,MAAA,KAAI,CAAC,MAAM,0CAAE,KAAK,mDAAG,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;YAElE,iDAAiD;YACjD,IAAI,KAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,MAAM,EAAE;gBAClC,OAAO;aACR;YAED,IAAM,SAAS,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAyC,CAAC;YACnE,IAAM,MAAM,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,CAAC;YAEjC,iCAAiC;YACjC,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO;aACR;YAED,sDAAsD;YACtD,IAAI,IAAI,IAAI,SAAS,EAAE;gBACrB,MAAA,MAAA,KAAI,CAAC,MAAM,0CAAE,KAAK,mDAAG,yCAAyC,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;gBACvF,KAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;gBAE/B,8DAA8D;aAC/D;iBAAM;gBACL,IAAI,MAAM,KAAK,MAAM,EAAE;oBACrB,KAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;iBACjC;qBAAM,IAAI,MAAM,KAAK,oCAAoC,EAAE;oBAC1D,IAAM,YAAU,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAA2C,CAAC;oBAC1E,eAAe,CAAC,4CAA4C,CAAC;yBAC1D,IAAI,CAAC;;wBACJ,2BAA2B;wBAC3B,sCAAsC,GAAG,MAAC,MAAc,aAAd,MAAM,uBAAN,MAAM,CAAU,8BAA8B,uDAAG;4BACzF,gBAAgB,kBAAA;4BAChB,mBAAmB,EAAE,UAAC,OAAgB;gCACpC,IAAI,mBAAmB,EAAE;oCACvB,OAAO,mBAAmB,CAAC,CAAA,YAAU,aAAV,YAAU,uBAAV,YAAU,CAAE,UAAU,KAAI,OAAO,EAAE,OAAO,CAAC,CAAC;iCACxE;gCACD,OAAO,IAAI,CAAC;4BACd,CAAC;4BACD,OAAO,EAAE,KAAI,CAAC,OAAO;4BACrB,QAAQ,EAAE,KAAI,CAAC,QAAQ;4BACvB,oBAAoB,EAAE,wCAAwC;4BAC9D,SAAS,EAAE,KAAI;4BACf,oBAAoB,sBAAA;4BACpB,oBAAoB,sBAAA;yBACrB,CAAC,CAAC;wBACH,KAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;oBAC7C,CAAC,CAAC;yBACD,KAAK,CAAC;;wBACL,MAAA,KAAI,CAAC,MAAM,0CAAE,IAAI,CAAC,8CAA8C,CAAC,CAAC;oBACpE,CAAC,CAAC,CAAC;iBACN;qBAAM,IAAI,MAAM,KAAK,+BAA+B,EAAE;oBACrD,2BAA2B;oBAC3B,MAAA,sCAAsC,aAAtC,sCAAsC,uBAAtC,sCAAsC,CAAE,KAAK,sFAAI,CAAC;iBACnD;aACF;QACH,CAAC,CAAC,CAAC;QAEH,oDAAoD;QACpD,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IACzC,CAAC;IAaH,sBAAC;AAAD,CAAC,AAxJD,IAwJC","sourcesContent":["/* istanbul ignore file */\n/* eslint-disable no-restricted-globals */\nimport {\n AMPLITUDE_ORIGIN,\n AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL,\n AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS,\n} from '../constants';\nimport { asyncLoadScript, generateUniqueId, getEventTagProps } from '../helpers';\nimport { Logger, Messenger, ActionType } from '@amplitude/analytics-types';\n\nexport type Action =\n | 'ping'\n | 'pong'\n | 'page-loaded'\n | 'selector-loaded'\n | 'initialize-visual-tagging-selector'\n | 'close-visual-tagging-selector'\n | 'element-selected'\n | 'track-selector-mode-changed'\n | 'track-selector-moved';\n\ninterface InitializeVisualTaggingSelectorData {\n actionType: ActionType;\n}\n\ninterface ElementSelectedData {\n '[Amplitude] Element Hierarchy'?: string;\n '[Amplitude] Element Tag'?: string;\n '[Amplitude] Element Text'?: string;\n '[Amplitude] Element Selector'?: string;\n '[Amplitude] Page URL'?: string;\n elementScreenshot?: Blob;\n}\n\ninterface TrackSelectorModeChangedData {\n newMode: string;\n pageUrl?: string;\n}\n\ninterface TrackSelectorMovedData {\n newEditorLocation: string;\n pageUrl?: string;\n}\n\nexport type ActionData = {\n ping: null | undefined;\n pong: null | undefined;\n 'page-loaded': null | undefined;\n 'selector-loaded': null | undefined;\n 'initialize-visual-tagging-selector': InitializeVisualTaggingSelectorData | null | undefined;\n 'close-visual-tagging-selector': null | undefined;\n 'element-selected': ElementSelectedData;\n 'track-selector-mode-changed': TrackSelectorModeChangedData;\n 'track-selector-moved': TrackSelectorMovedData;\n};\n\nexport interface Message<A extends Action> {\n action: A;\n data?: ActionData[A];\n}\n\ntype MessageRequest = {\n id: string;\n action: string;\n args: Record<string, any>;\n};\n\ntype MessageResponse = {\n id: string;\n action: string;\n responseData: any;\n};\n\n// TODO: use MessageChannel instead of window.postMessage\nexport class WindowMessenger implements Messenger {\n endpoint = AMPLITUDE_ORIGIN;\n logger?: Logger;\n requestCallbacks: {\n [id: string]: {\n resolve: (data: any) => void;\n reject: (data: any) => void;\n };\n } = {};\n\n constructor({ origin = AMPLITUDE_ORIGIN }: { origin?: string } = {}) {\n this.endpoint = origin;\n }\n\n private notify(message: Message<Action> | MessageRequest) {\n this.logger?.debug?.('Message sent: ', JSON.stringify(message));\n (window.opener as WindowProxy)?.postMessage?.(message, this.endpoint);\n }\n\n // Send an async request to the parent window\n public sendRequest(action: string, args: Record<string, any>, options = { timeout: 15_000 }): Promise<any> {\n // Create Request ID\n const id = generateUniqueId();\n const request = {\n id,\n action,\n args,\n };\n\n // Create a Promise that will be resolved when the response is received\n const promise = new Promise((resolve, reject) => {\n this.requestCallbacks[id] = { resolve, reject };\n\n // Send the request\n this.notify(request);\n\n // Handle request timeouts\n if (options?.timeout > 0) {\n setTimeout(() => {\n reject(new Error(`${action} timed out (id: ${id})`));\n delete this.requestCallbacks[id];\n }, options.timeout);\n }\n });\n\n return promise;\n }\n\n // Handle messages from the parent window\n private handleResponse(response: MessageResponse) {\n if (!this.requestCallbacks[response.id]) {\n this.logger?.warn(`No callback found for request id: ${response.id}`);\n return;\n }\n\n this.requestCallbacks[response.id].resolve(response.responseData);\n delete this.requestCallbacks[response.id];\n }\n\n setup({\n logger,\n endpoint,\n isElementSelectable,\n cssSelectorAllowlist,\n actionClickAllowlist,\n }: {\n logger?: Logger;\n endpoint?: string;\n isElementSelectable?: (action: InitializeVisualTaggingSelectorData['actionType'], element: Element) => boolean;\n cssSelectorAllowlist?: string[];\n actionClickAllowlist?: string[];\n } = {}) {\n this.logger = logger;\n // If endpoint is customized, don't override it.\n if (endpoint && this.endpoint === AMPLITUDE_ORIGIN) {\n this.endpoint = endpoint;\n }\n let amplitudeVisualTaggingSelectorInstance: any = null;\n\n // Attach Event Listener to listen for messages from the parent window\n window.addEventListener('message', (event) => {\n this.logger?.debug?.('Message received: ', JSON.stringify(event));\n\n // Only accept messages from the specified origin\n if (this.endpoint !== event.origin) {\n return;\n }\n\n const eventData = event?.data as Message<Action> | MessageResponse;\n const action = eventData?.action;\n\n // Ignore messages without action\n if (!action) {\n return;\n }\n\n // If id exists, handle responses to previous requests\n if ('id' in eventData) {\n this.logger?.debug?.('Received Response to previous request: ', JSON.stringify(event));\n this.handleResponse(eventData);\n\n // If action exists, handle the action using existing handlers\n } else {\n if (action === 'ping') {\n this.notify({ action: 'pong' });\n } else if (action === 'initialize-visual-tagging-selector') {\n const actionData = eventData?.data as InitializeVisualTaggingSelectorData;\n asyncLoadScript(AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL)\n .then(() => {\n // eslint-disable-next-line\n amplitudeVisualTaggingSelectorInstance = (window as any)?.amplitudeVisualTaggingSelector?.({\n getEventTagProps,\n isElementSelectable: (element: Element) => {\n if (isElementSelectable) {\n return isElementSelectable(actionData?.actionType || 'click', element);\n }\n return true;\n },\n onTrack: this.onTrack,\n onSelect: this.onSelect,\n visualHighlightClass: AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS,\n messenger: this,\n cssSelectorAllowlist,\n actionClickAllowlist,\n });\n this.notify({ action: 'selector-loaded' });\n })\n .catch(() => {\n this.logger?.warn('Failed to initialize visual tagging selector');\n });\n } else if (action === 'close-visual-tagging-selector') {\n // eslint-disable-next-line\n amplitudeVisualTaggingSelectorInstance?.close?.();\n }\n }\n });\n\n // Notify the parent window that the page has loaded\n this.notify({ action: 'page-loaded' });\n }\n\n private onSelect = (data: ElementSelectedData) => {\n this.notify({ action: 'element-selected', data });\n };\n\n private onTrack = (type: string, properties: { [key: string]: string | null }) => {\n if (type === 'selector-mode-changed') {\n this.notify({ action: 'track-selector-mode-changed', data: properties });\n } else if (type === 'selector-moved') {\n this.notify({ action: 'track-selector-moved', data: properties });\n }\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocapture.d.ts","sourceRoot":"","sources":["../../../src/typings/autocapture.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"autocapture.d.ts","sourceRoot":"","sources":["../../../src/typings/autocapture.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocapture.js","sourceRoot":"","sources":["../../../src/typings/autocapture.ts"],"names":[],"mappings":"","sourcesContent":["export type
|
|
1
|
+
{"version":3,"file":"autocapture.js","sourceRoot":"","sources":["../../../src/typings/autocapture.ts"],"names":[],"mappings":"","sourcesContent":["export type HierarchyNode = {\n tag: string;\n id?: string;\n classes?: string[];\n attrs?: { [key: string]: string };\n index?: number;\n indexOfType?: number;\n prevSib?: string;\n};\n\nexport type Hierarchy = (HierarchyNode | null)[];\n"]}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.0.
|
|
1
|
+
export declare const VERSION = "1.0.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/esm/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var VERSION = '1.0.
|
|
1
|
+
export var VERSION = '1.0.1';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/lib/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.0.1';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var amplitudeAutocapturePlugin=function(t){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function i(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{l(r.next(t))}catch(t){o(t)}}function c(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}l((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,i,o,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(fe(1),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),{time:t.timestamp})}))}var Ge,Je=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[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:0;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
|
+
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=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],h=["div","span","h1","h2","h3","h4","h5","h6"],p="[Amplitude] Element Clicked",v="[Amplitude] Element Tag",b="[Amplitude] Element Text",y="[Amplitude] Element Selector",m="[Amplitude] Page URL",g="https://app.amplitude.com",w={US:g,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},_="amp-visual-tagging-selector-highlight";function x(t){return"function"==typeof t}function A(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 S=A((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 E(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var k=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(x(f))try{f()}catch(t){i=t instanceof S?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{O(v)}catch(t){i=null!=i?i:[],t instanceof S?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 S(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)O(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)&&E(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&E(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),T=k.EMPTY;function C(t){return t instanceof k||t&&"closed"in t&&x(t.remove)&&x(t.add)&&x(t.unsubscribe)}function O(t){x(t)?t():t.unsubscribe()}var N={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},P=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 I(t){P((function(){throw t}))}function j(){}function L(t){t()}var M=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,C(e)&&e.add(n)):n.destination=U,n}return n(e,t),e.create=function(t,e,n){return new R(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}(k),q=Function.prototype.bind;function F(t,e){return q.call(t,e)}var z=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){D(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){D(t)}else D(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){D(t)}},t}(),R=function(t){function e(e,n,r){var i,o,u=t.call(this)||this;x(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:u&&N.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 z(i),u}return n(e,t),e}(M);function D(t){I(t)}var U={closed:!0,next:j,error:function(t){throw t},complete:j},V="function"==typeof Symbol&&Symbol.observable||"@@observable";function W(t){return t}function H(t){return 0===t.length?W:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var Y=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 M||function(t){return t&&x(t.next)&&x(t.error)&&x(t.complete)}(r)&&C(r)?t:new R(t,e,n);return L((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=B(e))((function(e,r){var i=new R({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[V]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return H(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=B(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 B(t){var e;return null!==(e=null!=t?t:N.Promise)&&void 0!==e?e:Promise}function G(t){return x(null==t?void 0:t.lift)}function J(t){return function(e){if(G(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 Z(t,e,n,r,i)}var Z=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}(M);!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,G(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 k;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=k.EMPTY)}return e},e.prototype.refCount=function(){return J((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)}}(Y);var $,K={now:function(){return(K.delegate||performance).now()},delegate:void 0},Q={schedule:function(t){var e=requestAnimationFrame,n=cancelAnimationFrame,r=e((function(e){n=void 0,t(e)}));return new k((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=Q.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 Y((function(t){var e=$||K,n=e.now(),r=0,i=function(){t.closed||(r=Q.requestAnimationFrame((function(o){r=0;var u=e.now();t.next({timestamp:$?u:o,elapsed:u-n}),i()})))};return i(),function(){r&&Q.cancelAnimationFrame(r)}}));var tt=A((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),et=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 nt(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new tt},e.prototype.next=function(t){var e=this;L((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;L((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;L((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?T:(this.currentObservers=null,o.push(t),new k((function(){e.currentObservers=null,E(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 Y;return t.source=this,t},e.create=function(t,e){return new nt(t,e)},e}(Y),nt=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:T},e}(et);!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)}}(et);var rt={now:function(){return(rt.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=rt);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)}}}(et),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))}}(et);var it,ot=function(t){function e(e,n){return t.call(this)||this}return n(e,t),e.prototype.schedule=function(t,e){return this},e}(k),ut=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)))},ct=function(t){return clearInterval(t)},lt=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),ut(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&&ct(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,E(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(ot),at=1,st={};function ft(t){return t in st&&(delete st[t],!0)}var dt=function(t){var e=at++;return st[e]=!0,it||(it=Promise.resolve()),it.then((function(){return ft(e)&&t()})),e},ht=function(t){ft(t)},pt={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=pt.delegate;return((null==n?void 0:n.setImmediate)||dt).apply(void 0,l([],c(t)))},clearImmediate:function(t){return ht(t)},delegate:void 0},vt=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=pt.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&&(pt.clearImmediate(n),e._scheduled===n&&(e._scheduled=void 0))},e}(lt),bt=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=rt.now,t}(),yt=function(t){function e(e,n){void 0===n&&(n=bt.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}(bt),mt=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}(yt);new mt(vt);var gt=new yt(lt),wt=gt,_t=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.flush(this),0)},e}(lt),xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(yt);new xt(_t);var At=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=Q.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&&(Q.cancelAnimationFrame(n),e._scheduled=void 0)},e}(lt),St=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}(yt);new St(At),function(t){function e(e,n){void 0===e&&(e=Et),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}(yt);var Et=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 k.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}(lt),kt=new Y((function(t){return t.complete()}));function Tt(t){return t&&x(t.schedule)}function Ct(t){return t[t.length-1]}function Ot(t){return Tt(Ct(t))?t.pop():void 0}function Nt(t,e){return"number"==typeof Ct(t)?t.pop():e}var Pt=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function It(t){return x(null==t?void 0:t.then)}function jt(t){return x(t[V])}function Lt(t){return Symbol.asyncIterator&&x(null==t?void 0:t[Symbol.asyncIterator])}function Mt(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 qt,Ft="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function zt(t){return x(null==t?void 0:t[Ft])}function Rt(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 Dt(t){return x(null==t?void 0:t.getReader)}function Ut(t){if(t instanceof Y)return t;if(null!=t){if(jt(t))return i=t,new Y((function(t){var e=i[V]();if(x(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Pt(t))return r=t,new Y((function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()}));if(It(t))return n=t,new Y((function(t){n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,I)}));if(Lt(t))return Vt(t);if(zt(t))return e=t,new Y((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(Dt(t))return Vt(Rt(t))}var e,n,r,i;throw Mt(t)}function Vt(t){return new Y((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 Wt(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 Ht(t,e){return void 0===e&&(e=0),J((function(n,r){n.subscribe(X(r,(function(n){return Wt(r,t,(function(){return r.next(n)}),e)}),(function(){return Wt(r,t,(function(){return r.complete()}),e)}),(function(n){return Wt(r,t,(function(){return r.error(n)}),e)})))}))}function Yt(t,e){return void 0===e&&(e=0),J((function(n,r){r.add(t.schedule((function(){return n.subscribe(r)}),e))}))}function Bt(t,e){if(!t)throw new Error("Iterable cannot be null");return new Y((function(n){Wt(n,e,(function(){var r=t[Symbol.asyncIterator]();Wt(n,e,(function(){r.next().then((function(t){t.done?n.complete():n.next(t.value)}))}),0,!0)}))}))}function Gt(t,e){if(null!=t){if(jt(t))return function(t,e){return Ut(t).pipe(Yt(e),Ht(e))}(t,e);if(Pt(t))return function(t,e){return new Y((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(It(t))return function(t,e){return Ut(t).pipe(Yt(e),Ht(e))}(t,e);if(Lt(t))return Bt(t,e);if(zt(t))return function(t,e){return new Y((function(n){var r;return Wt(n,e,(function(){r=t[Ft](),Wt(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 x(null==r?void 0:r.return)&&r.return()}}))}(t,e);if(Dt(t))return function(t,e){return Bt(Rt(t),e)}(t,e)}throw Mt(t)}function Jt(t,e){return e?Gt(t,e):Ut(t)}function Xt(t){return t instanceof Date&&!isNaN(t)}!function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"}(qt||(qt={})),A((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}})),A((function(t){return function(){t(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),A((function(t){return function(e){t(this),this.name="NotFoundError",this.message=e}})),A((function(t){return function(e){t(this),this.name="SequenceError",this.message=e}}));var Zt=A((function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}}));function $t(t){throw new Zt(t)}function Kt(t,e){return J((function(n,r){var i=0;n.subscribe(X(r,(function(n){r.next(t.call(e,n,i++))})))}))}var Qt=Array.isArray;function te(t){return Kt((function(e){return function(t,e){return Qt(e)?t.apply(void 0,l([],c(e))):t(e)}(t,e)}))}function ee(t,e,n){return void 0===n&&(n=1/0),x(e)?ee((function(n,r){return Kt((function(t,i){return e(n,t,r,i)}))(Ut(t(n,r)))}),n):("number"==typeof e&&(n=e),J((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;Ut(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?Wt(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 ne(t){return void 0===t&&(t=1/0),ee(W,t)}function re(){return ne(1)}var ie,oe,ue=["addListener","removeListener"],ce=["addEventListener","removeEventListener"],le=["on","off"];function ae(t,e,n,r){if(x(n)&&(r=n,n=void 0),r)return ae(t,e,n).pipe(te(r));var i=c(function(t){return x(t.addEventListener)&&x(t.removeEventListener)}(t)?ce.map((function(r){return function(i){return t[r](e,i,n)}})):function(t){return x(t.addListener)&&x(t.removeListener)}(t)?ue.map(se(t,e)):function(t){return x(t.on)&&x(t.off)}(t)?le.map(se(t,e)):[],2),o=i[0],u=i[1];if(!o&&Pt(t))return ee((function(t){return ae(t,e,n)}))(Ut(t));if(!o)throw new TypeError("Invalid event target");return new Y((function(t){var e=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.next(1<e.length?e:e[0])};return o(e),function(){return u(e)}}))}function se(t,e){return function(n){return function(r){return t[n](e,r)}}}function fe(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Ot(t),r=Nt(t,1/0),i=t;return i.length?1===i.length?Ut(i[0]):ne(r)(Jt(i,n)):kt}function de(t,e){return J((function(n,r){var i=0;n.subscribe(X(r,(function(n){return t.call(e,n,i++)&&r.next(n)})))}))}function he(t){return t<=0?function(){return kt}:J((function(e,n){var r=0;e.subscribe(X(n,(function(e){++r<=t&&(n.next(e),t<=r&&n.complete())})))}))}function pe(t,e){return e?function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return re()(Jt(t,Ot(t)))}(e.pipe(he(1),J((function(t,e){t.subscribe(X(e,j))}))),n.pipe(pe(t)))}:ee((function(e,n){return Ut(t(e,n)).pipe(he(1),function(t){return Kt((function(){return t}))}(e))}))}function ve(t,e){void 0===e&&(e=gt);var n=function(t,e,n){void 0===t&&(t=0),void 0===n&&(n=wt);var r=-1;return null!=e&&(Tt(e)?n=e:r=e),new Y((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 pe((function(){return n}))}function be(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};ie=r(r({},n),e),oe=function(t,e){if(t.nodeType===Node.DOCUMENT_NODE)return t;if(t===e.root)return t.ownerDocument;return t}(ie.root,n);var i=ye(t,"all",(function(){return ye(t,"two",(function(){return ye(t,"one",(function(){return ye(t,"none")}))}))}));if(i){var o=Te(Ce(i,t));return o.length>0&&(i=o[0]),ge(i)}throw new Error("Selector was not found.")}function ye(t,e,n){for(var r=null,i=[],o=t,a=0,s=function(){var t,s,f=Se(function(t){var e=t.getAttribute("id");if(e&&ie.idName(e))return{name:"#"+CSS.escape(e),penalty:0};return null}(o))||Se.apply(void 0,l([],c(function(t){var e=Array.from(t.attributes).filter((function(t){return ie.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))||Se.apply(void 0,l([],c(function(t){var e=Array.from(t.classList).filter(ie.className);return e.map((function(t){return{name:"."+CSS.escape(t),penalty:1}}))}(o)),!1))||Se(function(t){var e=t.tagName.toLowerCase();if(ie.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(Ae).map((function(t){return xe(t,d)}))));else if("two"==e)f=f.slice(0,1),d&&(f=f.concat(f.filter(Ae).map((function(t){return xe(t,d)}))));else if("one"==e){var h=c(f=f.slice(0,1),1)[0];d&&Ae(h)&&(f=[xe(h,d)])}else"none"==e&&(f=[{name:"*",penalty:3}],d&&(f=[xe(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>=ie.seedMinLength&&(r=me(i,n)))return"break";o=o.parentElement,a++};o;){if("break"===s())break}return r||(r=me(i,n)),!r&&n?n():r}function me(t,e){var n,r;if(t.reduce((function(t,e){return t*e.length}),1)>ie.threshold)return e?e():null;var i=Te(ke(t));try{for(var o=u(i),c=o.next();!c.done;c=o.next()){var l=c.value;if(_e(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 ge(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 we(t){return t.map((function(t){return t.penalty})).reduce((function(t,e){return t+e}),0)}function _e(t){var e=ge(t);switch(oe.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 xe(t,e){return{name:t.name+":nth-child(".concat(e,")"),penalty:t.penalty+1}}function Ae(t){return"html"!==t.name&&!t.name.startsWith("#")}function Se(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.filter(Ee);return n.length>0?n:null}function Ee(t){return null!=t}function ke(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(ke(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 Te(t){return l([],c(t),!1).sort((function(t,e){return we(t)-we(e)}))}function Ce(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>ie.optimizedMinLength))return[3,5];r=1,o.label=1;case 1:return r<t.length-1?n.counter>ie.maxNumberOfTries?[2]:(n.counter+=1,(i=l([],c(t),!1)).splice(r,1),a=ge(i),n.visited.has(a)?[2]:_e(i)&&function(t,e){return oe.querySelector(ge(t))===e}(i,e)?[4,i]:[3,4]):[3,5];case 2:return o.sent(),n.visited.set(a,!0),[5,u(Ce(i,e,n))];case 3:o.sent(),o.label=4;case 4:return r++,[3,1];case 5:return[2]}}))}new Y(j);var Oe=["input","select","textarea"],Ne=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(!Me(window.location.href,c))return!1;var s=String(null==r?void 0:r.getAttribute("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}}},Pe=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},Ie=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!Oe.includes(i)&&!o},je=function(t){var e="";return Ie(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=je(t),e+=r.split(/(\s+)/).filter(Pe).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),e},Le=function(t,e){var n,r,i="";try{return i=be(t,{className:function(t){return t!==_},maxNumberOfTries:1e3})}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);u&&(i=u);var c=t.getAttribute("id"),l=t.getAttribute("class");if(c)i="#".concat(c);else if(l){var a=l.split(" ").filter((function(t){return t!==_})).join(".");a&&(i="".concat(i,".").concat(a))}return i},Me=function(t,e){return!e||!e.length||e.some((function(e){return"string"==typeof e?t===e:t.match(e)}))},qe=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,n=t.parentElement;if(!n)return"";try{e=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(t){e=null}if(e){var r=e.textContent||"";return Pe(r)?r:""}return Fe(n)},ze=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:ze(null==t?void 0:t.parentElement,e):null},Re=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=Le(t,e),c=((n={})[v]=o,n[b]=je(t),n[y]=u,n[m]=window.location.href.split("?")[0],n);return qe(c)};var De=function(t){return!(null===t.event.target||!t.closestTrackedAncestor)},Ue=function(){function t(t){var e=(void 0===t?{}:t).origin,n=void 0===e?g:e,r=this;this.endpoint=g,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===g&&(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:Re,isElementSelectable:function(t){return!o||o((null==p?void 0:p.actionType)||"click",t)},onTrack:e.onTrack,onSelect:e.onSelect,visualHighlightClass:_,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}(),Ve=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],We=["type"],He=["svg","path","g"],Ye=["password","hidden"];var Be=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=Ge(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=String(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=String(f));var d=t.getAttribute("id");d&&(a.id=String(d));var h=Array.from(t.classList);h.length&&(a.classes=h);var p={},v=Array.from(t.attributes).filter((function(t){return!Ve.includes(t.name)})),b=!Ie(t);if(!Ye.includes(String(t.getAttribute("type")))&&!He.includes(l))try{for(var y=u(v),m=y.next();!m.done;m=y.next()){var g=m.value;b&&!We.includes(g.name)||(p[g.name]=String(g.value).substring(0,128))}}catch(t){e={error:t}}finally{try{m&&!m.done&&(n=y.return)&&n.call(y)}finally{if(e)throw e.error}}return Object.keys(p).length&&(a.attrs=p),a}(t)})),1024),e):[]};function Ge(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 Ge(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(Ge(n,!0)),": ").concat(String(Ge(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return t.toString()}catch(t){return null}}var Je;function Xe(t){var e,n,r,i=t.amplitude,o=t.allObservables,l=t.options,a=t.shouldTrackEvent,s=o.clickObservable,f=s.pipe(J((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})))})),de((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}))),d=fe(f,s.pipe((e=l.debounceTime,void 0===n&&(n=gt),J((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})))}))),Kt((function(){return"timeout"}))));return s.pipe(ve(0),de(De),de((function(t){return a("click",t.closestTrackedAncestor)})),(r=d,J((function(t,e){var n=[];return t.subscribe(X(e,(function(t){return n.push(t)}),(function(){e.next(n),e.complete()}))),Ut(r).subscribe(X(e,(function(){var t=n;n=[],e.next(t)}),j)),function(){n=null}})))).subscribe((function(t){var e,n,r=(t.length,p);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 Ze(t){var e=t.amplitude,n=t.allObservables,r=t.options,i=t.getEventProperties,o=t.shouldTrackEvent,u=t.shouldTrackActionClick,a=n.clickObservable,s=n.mutationObservable,f=n.navigateObservable,d=a.pipe(de((function(t){return!o("click",t.closestTrackedAncestor)})),Kt((function(t){var e=ze(t.event.target,r.actionClickAllowlist);return t.closestTrackedAncestor=e,null!==t.closestTrackedAncestor&&(t.targetElementProperties=i(t.type,t.closestTrackedAncestor)),t})),de(De),de((function(t){return u("click",t.closestTrackedAncestor)}))),h=[s];f&&h.push(f);var v,b,y=fe.apply(void 0,l([],c(h),!1)),m=d.pipe((v=function(t){return y.pipe(he(1),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?$t:o,c=n.scheduler,l=void 0===c?null!=e?e:gt:c,a=n.meta,s=void 0===a?null:a;if(null==r&&null==i)throw new TypeError("No timeout provided.");return J((function(t,e){var n,o,c=null,a=0,f=function(t){o=Wt(e,l,(function(){try{n.unsubscribe(),Ut(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 kt}}),Kt((function(){return t})))},J((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++;Ut(v(t,u)).subscribe(n=X(e,(function(n){return e.next(b?b(t,n,u,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return m.subscribe((function(t){null==e||e.track(p,i("click",t.closestTrackedAncestor),{time:t.timestamp})}))}!function(t){t.ClickObservable="clickObservable",t.ChangeObservable="changeObservable",t.NavigateObservable="navigateObservable",t.MutationObservable="mutationObservable"}(Je||(Je={}));var $e=function(t){var e,n,a;void 0===t&&(t={});var s=t.dataAttributePrefix,f=void 0===s?"data-amp-track-":s,p=t.visualTaggingOptions,g=void 0===p?{enabled:!0,messenger:new Ue}:p;t.cssSelectorAllowlist=null!==(e=t.cssSelectorAllowlist)&&void 0!==e?e:d,t.actionClickAllowlist=null!==(n=t.actionClickAllowlist)&&void 0!==n?n:h,t.debounceTime=null!==(a=t.debounceTime)&&void 0!==a?a:0;var _="@amplitude/plugin-autocapture-browser",x=[],A=void 0,S=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=Le(e,A),d=((n={})["[Amplitude] Element ID"]=e.getAttribute("id")||"",n["[Amplitude] Element Class"]=e.getAttribute("class"),n["[Amplitude] Element Hierarchy"]=Be(e),n[v]=o,n[b]=je(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[y]=s,n["[Amplitude] Element Parent Label"]=a,n[m]=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),qe(d)},E=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=ze(r.event.target,t.cssSelectorAllowlist);return i&&(r.closestTrackedAncestor=i,r.targetElementProperties=S(r.type,i)),r}return r};return{name:_,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,b;return o(this,(function(o){return A=e.loggerProvider,"undefined"==typeof document||(i=Ne(t,t.cssSelectorAllowlist),u=Ne(t,t.actionClickAllowlist),a=function(){var t,e,n=ae(document,"click",{capture:!0}).pipe(Kt((function(t){return E(t,"click")}))),r=ae(document,"change",{capture:!0}).pipe(Kt((function(t){return E(t,"change")})));window.navigation&&(e=ae(window.navigation,"navigate").pipe(Kt((function(t){return E(t,"navigate")}))));var i=new Y((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(Kt((function(t){return E(t,"mutation")})));return(t={})[Je.ClickObservable]=n,t[Je.ChangeObservable]=r,t[Je.NavigateObservable]=e,t[Je.MutationObservable]=i,t}(),s=Xe({allObservables:a,options:t,amplitude:n,shouldTrackEvent:i}),x.push(s),f=function(t){var e=t.amplitude,n=t.allObservables,r=t.getEventProperties,i=t.shouldTrackEvent;return n.changeObservable.pipe(de(De),de((function(t){return i("change",t.closestTrackedAncestor)}))).subscribe((function(t){null==e||e.track("[Amplitude] Element Changed",r("change",t.closestTrackedAncestor))}))}({allObservables:a,getEventProperties:S,amplitude:n,shouldTrackEvent:i}),x.push(f),d=Ze({allObservables:a,options:t,getEventProperties:S,amplitude:n,shouldTrackEvent:i,shouldTrackActionClick:u}),x.push(d),null===(v=null==e?void 0:e.loggerProvider)||void 0===v||v.log("".concat(_," has been successfully added.")),window.opener&&g.enabled&&(h=t.cssSelectorAllowlist,p=t.actionClickAllowlist,null===(b=g.messenger)||void 0===b||b.setup(r(r({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:w[e.serverZone]}),{isElementSelectable:Ne(t,l(l([],c(h),!1),c(p),!1)),cssSelectorAllowlist:h,actionClickAllowlist:p})))),[2]}))}))},execute:function(t){return i(void 0,void 0,void 0,(function(){return o(this,(function(e){return[2,t]}))}))},teardown:function(){return i(void 0,void 0,void 0,(function(){var t,e,n,r;return o(this,(function(i){try{for(t=u(x),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.WindowMessenger=Ue,t.autocapturePlugin=$e,t.plugin=$e,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
|
Binary file
|