web-push-notifications 3.67.0 → 3.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm.js +1 -1
- package/npm.js.map +1 -1
- package/package.json +2 -2
- package/service-worker.js +1 -1
- package/widget-inbox.js +1 -1
- package/widget-inbox.js.map +1 -1
- package/widget-subscribe-popup.js +1 -1
- package/widget-subscribe-popup.js.map +1 -1
- package/widget-subscription-button.js +1 -1
- package/widget-subscription-button.js.map +1 -1
- package/widget-subscription-prompt.js +1 -1
- package/widget-subscription-prompt.js.map +1 -1
- package/widget-web-popups.js +1 -1
- package/widget-web-popups.js.map +1 -1
- package/widgets/WebPopups/WebPopupsWidget.d.ts +1 -0
- package/widgets/WebPopups/renderer.d.ts +2 -2
- package/widgets/WebPopups/types.d.ts +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-subscription-prompt.js","mappings":"CAAA,SAAAA,EAAAC,GACA,oBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,SACA,sBAAAG,QAAAA,OAAAC,IACAD,OAAA,GAAAH,OACA,CACA,IAAAK,EAAAL,IACA,QAAAM,KAAAD,GAAA,iBAAAJ,QAAAA,QAAAF,GAAAO,GAAAD,EAAAC,EACA,CACC,CATD,CASCC,KAAA,uBCRD,MAAAC,EAAA,CCAAA,EAAA,CAAAP,EAAAQ,KACA,GAAAC,MAAAC,QAAAF,GAEA,IADA,IAAAH,EAAA,EACAA,EAAAG,EAAAG,QAAA,CACA,IAAAC,EAAAJ,EAAAH,KACAQ,EAAAL,EAAAH,KACAE,EAAAO,EAAAd,EAAAY,GAMK,IAAAC,GAAyBR,IAL9B,IAAAQ,EACAE,OAAAC,eAAAhB,EAAAY,EAAA,CAA2CK,YAAA,EAAAC,MAAAV,EAAAH,OAE3CU,OAAAC,eAAAhB,EAAAY,EAAA,CAA2CK,YAAA,EAAAE,IAAAN,GAG3C,MAEA,QAAAD,KAAAJ,EACAD,EAAAO,EAAAN,EAAAI,KAAAL,EAAAO,EAAAd,EAAAY,IACAG,OAAAC,eAAAhB,EAAAY,EAAA,CAA0CK,YAAA,EAAAE,IAAAX,EAAAI,MClB1CL,EAAA,CAAAa,EAAAC,IAAAN,OAAAO,UAAAC,eAAAC,KAAAJ,EAAAC,GCCAd,EAAAP,IACAyB,OAAAC,aACAX,OAAAC,eAAAhB,EAAAyB,OAAAC,YAAA,CAAuDR,MAAA,WAEvDH,OAAAC,eAAAhB,EAAA,cAAgDkB,OAAA,gECLzC,MAGMS,EAA4C,CACvDC,WAAY,wBACZC,gBAAiB,UACjBC,cAAe,iDACfC,mBAAoB,UACpBC,iBAAkB,QAClBC,sBAAuB,UACvBC,kBAAmB,MACnBC,4BAA6B,UAC7BC,wBAAyB,UACzBC,iBAAkB,OAClBC,sBAAuB,UACvBC,kBAAmB,MACnBC,4BAA6B,UAC7BC,wBAAyB,UACzBC,aAAc,EACdC,aAAc,MACdC,gBAAiB,WCpBNC,EAAuC,gCCO7C,MAAMC,EAGX,WAAAC,CAAYC,GACV1C,KAAK0C,GAAKA,CACZ,CAEO,SAAMC,GACX,MAAMD,GAAEA,GAAO1C,KAET4C,QAAiBF,EAAGG,KAAKC,cACzBC,ECdqB,CAACH,IAE9B,MAAMI,EAAgBJ,EAAqC,4BAAKA,EAAqC,2BAAEK,OAGjGC,EAA4D,CAChEd,aAAcf,EAA0Ce,aACxDC,aAAchB,EAA0CgB,gBACrDW,GAIL,OAAOA,EACHE,EACA7B,GDAmB8B,CAAgBP,GAC/BQ,OCE2BC,OAAON,EAA+CL,KACzF,MAAMY,GAAc,IAAIC,MAAOC,UACzBC,QAAqBf,EAAGG,KAAKa,wBAC7BC,QAAqBjB,EAAGG,KAAKe,wBAG7BR,EAAmBL,EAAaX,aAAeqB,EAG/CI,EAAoBP,EAAcK,EAAeZ,EAAaV,aAEpE,OAAOe,GAAoBS,GDbMC,CAAsBf,EAAcL,GACnE,IAAKU,EACH,OAGF,MAAMW,EAAuBnB,EAA8B,qBAAc,SAGnEoB,EF1B0C,YE0BvBD,EACnBE,EF5B0C,YE4BxBF,GAAiErB,EAAGwB,WAAWC,eAGnGH,GAAoBC,KACtBjE,KAAKoE,KAAKrB,GACV/C,KAAKqE,OACL3B,EAAG4B,eAAeC,mBAAqBvE,UCCVqD,OAAOX,IACxC,MAAMe,QAAqBf,EAAGG,KAAKa,wBAC7BJ,GAAc,IAAIC,MAAOC,gBAEzBd,EAAGG,KAAK2B,sBAAsBf,EAAe,SAC7Cf,EAAGG,KAAK4B,sBAAsBnB,IDL1BoB,CAAoBhC,GAE9B,CAEO,IAAA0B,CAAKnB,GAKV,IAJoBjD,KAAK2E,iBAIP,CAChB,MAAMC,EE1CW,CAAC3B,GACf,gBACIV,kBAAqDA,wBAChDA,gCACEA,wBACVU,EAAO3B,+CAEGiB,6BACVU,EAAOzB,kDAEGe,oDACgBA,qBAAwDA,cAAiDA,mCACjIU,EAAOlB,0EAEiBQ,oBAAuDA,cAAiDA,kCAChIU,EAAOvB,8EF2BAmD,CAAQ5B,GACf6B,EEpBa,CAAC7B,IACxB,MAAM6B,EAASC,SAASC,cAAc,SAiFtC,OA/EAF,EAAOG,UAAY,UACd1C,mEAIAA,sNAYAA,sDAIAA,2DAEmBU,EAAOX,gBAAkBW,EAAOX,gBAAkB,2KAMrEC,6BACQU,EAAO1B,0FAKfgB,kCACQU,EAAOxB,oHAMfc,mEAIAA,+IAOAA,iOAUAA,sCACQU,EAAOjB,mDACIiB,EAAOf,sDACVe,EAAOhB,2CACRgB,EAAOd,+CAGtBI,qCACQU,EAAOtB,mDACIsB,EAAOpB,sDACVoB,EAAOrB,2CACRqB,EAAOnB,iEAKpBgD,GF9DYI,CAAUjC,GAGzB8B,SAASI,KAAKC,mBAAmB,YAAaR,GAG9CG,SAASM,KAAKC,YAAYR,EAC5B,CAEA9E,KAAKuF,mBACP,CAEO,IAAAlB,GACL,MAAMmB,EAAcxF,KAAKyF,+BACzBzF,KAAK0C,GAAGgD,cAAc,2BAA4B,IAElDF,EAAYG,UAAUC,IAAI,GAAGrD,SAC/B,CAEO,IAAAsD,GACL,MAAML,EAAcxF,KAAKyF,+BAErBD,EAAYG,UAAUG,SAAS,GAAGvD,YACpCvC,KAAK0C,GAAGgD,cAAc,2BAA4B,IAClDF,EAAYG,UAAUI,OAAO,GAAGxD,UAEpC,CAEQ,cAAAoC,GACN,OAAOI,SAASiB,eAAe,GAAGzD,SACpC,CAEQ,4BAAAkD,GACN,MAAMQ,EAAUjG,KAAK2E,iBAErB,IAAKsB,EACH,MAAM,IAAIC,MAAM,6BAA6B3D,0CAG/C,OAAO0D,CACT,CAEQ,8BAAAE,GACN,MAAMF,EAAUlB,SAASiB,eAAe,GAAGzD,aAE3C,IAAK0D,EACH,MAAM,IAAIC,MAAM,6BAA6B3D,6CAG/C,OAAO0D,CACT,CAEQ,6BAAAG,GACN,MAAMH,EAAUlB,SAASiB,eAAe,GAAGzD,YAE3C,IAAK0D,EACH,MAAM,IAAIC,MAAM,6BAA6B3D,4CAG/C,OAAO0D,CACT,CAEQ,iBAAAV,GACN,MAAMC,EAAcxF,KAAKyF,+BACnBY,EAAiBrG,KAAKmG,iCACtBG,EAAgBtG,KAAKoG,gCAE3BrB,SAASwB,iBAAiB,QAAUC,IAC7BhB,EAAYM,SAAUU,EAAMC,SAC/BzG,KAAK6F,SAITQ,EAAeE,iBAAiB,QAAS,KACvCvG,KAAK6F,SAGPS,EAAcC,iBAAiB,QAAS,KACtCvG,KAAK6F,OACL7F,KAAK0C,GAAGgE,aAEZ","sources":["webpack://web-push-notifications/webpack/universalModuleDefinition","webpack://web-push-notifications/webpack/bootstrap","webpack://web-push-notifications/webpack/runtime/define property getters","webpack://web-push-notifications/webpack/runtime/hasOwnProperty shorthand","webpack://web-push-notifications/webpack/runtime/make namespace object","webpack://web-push-notifications/./src/widgets/SubscriptionPrompt/constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.ts","webpack://web-push-notifications/./src/widgets/SubscriptionPrompt/helpers.ts","webpack://web-push-notifications/./src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.helpers.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, () => {\nreturn ","// The require scope\nconst __webpack_require__ = {};\n\n","// define getter/value functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tif(Array.isArray(definition)) {\n\t\tvar i = 0;\n\t\twhile(i < definition.length) {\n\t\t\tvar key = definition[i++];\n\t\t\tvar binding = definition[i++];\n\t\t\tif(!__webpack_require__.o(exports, key)) {\n\t\t\t\tif(binding === 0) {\n\t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, value: definition[i++] });\n\t\t\t\t} else {\n\t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: binding });\n\t\t\t\t}\n\t\t\t} else if(binding === 0) { i++; }\n\t\t}\n\t} else {\n\t\tfor(var key in definition) {\n\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t\t}\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET = 'not-set';\nexport const SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT = 'default';\n\nexport const SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG = {\n headerText: 'Subscribe to our news',\n headerTextColor: '#000000',\n subheaderText: 'Don\\'t miss out on the latest news and updates!',\n subheaderTextColor: '#000000',\n buttonAcceptText: 'Agree',\n buttonAcceptTextColor: '#1A72E8',\n buttonAcceptRound: '4px',\n buttonAcceptBackgroundColor: '#FFFFFF',\n buttonAcceptBorderColor: '#E3E4E8',\n buttonCancelText: 'Deny',\n buttonCancelTextColor: '#1A72E8',\n buttonCancelRound: '4px',\n buttonCancelBackgroundColor: '#FFFFFF',\n buttonCancelBorderColor: '#E3E4E8',\n cappingCount: 3,\n cappingDelay: 1000 * 60 * 60 * 4, // time in ms\n backgroundColor: '#FFFFFF',\n};\n","export const SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE = 'pushwoosh-subscription-widget';\n","import { SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT, SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET } from './constants';\nimport { checkCanShowByCapping, getWidgetConfig, updateCappingParams } from './helpers';\nimport { SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE } from './SubscriptionPromptWidget.constants';\nimport { getHTML, getStyles } from './SubscriptionPromptWidget.helpers';\nimport { type ISubscriptionPromptWidgetParams } from './SubscriptionPromptWidget.types';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\n\nexport class PWSubscriptionPromptWidget {\n private readonly pw: Pushwoosh;\n\n constructor(pw: Pushwoosh) {\n this.pw = pw;\n };\n\n public async run(): Promise<void> {\n const { pw } = this;\n\n const features = await pw.data.getFeatures();\n const widgetConfig = getWidgetConfig(features);\n const canShowByCapping = await checkCanShowByCapping(widgetConfig, pw);\n if (!canShowByCapping) {\n return;\n }\n\n const currentPromptUseCase = features['subscription_prompt']?.['use_case'];\n\n // show subscription prompt widget\n const isDefaultUseCase = currentPromptUseCase === SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT;\n const isNotSetUseCase = currentPromptUseCase === SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET && pw.initParams.autoSubscribe;\n\n // show subscription prompt widget\n if (isDefaultUseCase || isNotSetUseCase) {\n this.init(widgetConfig);\n this.show();\n pw.moduleRegistry.subscriptionPrompt = this;\n await updateCappingParams(pw);\n }\n }\n\n public init(params: ISubscriptionPromptWidgetParams): void {\n const rootElement = this.getRootElement();\n\n // if root element not exist\n // create widget\n if (!rootElement) {\n const html = getHTML(params);\n const styles = getStyles(params);\n\n // append popup to body\n document.body.insertAdjacentHTML('beforeend', html);\n\n // append styles to head\n document.head.appendChild(styles);\n }\n\n this.addEventListeners();\n }\n\n public show(): void {\n const rootElement = this.getRootElementWithCheckExist();\n this.pw.dispatchEvent('show-subscription-widget', {});\n\n rootElement.classList.add(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}_show`);\n }\n\n public hide(): void {\n const rootElement = this.getRootElementWithCheckExist();\n\n if (rootElement.classList.contains(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}_show`)) {\n this.pw.dispatchEvent('hide-subscription-widget', {});\n rootElement.classList.remove(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}_show`);\n }\n }\n\n private getRootElement(): HTMLElement | null {\n return document.getElementById(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-root`);\n }\n\n private getRootElementWithCheckExist(): HTMLElement {\n const element = this.getRootElement();\n\n if (!element) {\n throw new Error(`Can't find element by id \"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-root\", please use method init first.`);\n }\n\n return element;\n }\n\n private getDeclineButtonWithCheckExist(): HTMLButtonElement {\n const element = document.getElementById(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-decline`) as HTMLButtonElement;\n\n if (!element) {\n throw new Error(`Can't find element by id \"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-decline\", please use method init first.`);\n }\n\n return element;\n }\n\n private getAcceptButtonWithCheckExist(): HTMLButtonElement {\n const element = document.getElementById(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-accept`) as HTMLButtonElement;\n\n if (!element) {\n throw new Error(`Can't find element by id \"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-accept\", please use method init first.`);\n }\n\n return element;\n }\n\n private addEventListeners(): void {\n const rootElement = this.getRootElementWithCheckExist();\n const declineElement = this.getDeclineButtonWithCheckExist();\n const acceptElement = this.getAcceptButtonWithCheckExist();\n\n document.addEventListener('click', (event) => {\n if (!rootElement.contains((event.target as HTMLElement))) {\n this.hide();\n }\n });\n\n declineElement.addEventListener('click', () => {\n this.hide();\n });\n\n acceptElement.addEventListener('click', () => {\n this.hide();\n this.pw.subscribe();\n });\n }\n}\n","import { SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG } from './constants';\nimport type { ISubscriptionPromptWidgetParams } from './SubscriptionPromptWidget.types';\nimport type { Pushwoosh } from '../../core/Pushwoosh';\n\nexport const getWidgetConfig = (features: any): ISubscriptionPromptWidgetParams => {\n // get config by features from get config method\n const currentConfig = features['subscription_prompt_widget'] && features['subscription_prompt_widget'].params;\n\n // merge current config with capping defaults\n const configWithDefaultCapping: ISubscriptionPromptWidgetParams = {\n cappingCount: SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingCount,\n cappingDelay: SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingDelay,\n ...currentConfig,\n };\n\n // if current config is not exist show with default values\n return currentConfig\n ? configWithDefaultCapping\n : SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG;\n};\n\nexport const checkCanShowByCapping = async (widgetConfig: ISubscriptionPromptWidgetParams, pw: Pushwoosh): Promise<boolean> => {\n const currentTime = new Date().getTime();\n const displayCount = await pw.data.getPromptDisplayCount();\n const lastSeenTime = await pw.data.getPromptLastSeenTime();\n\n // can show by max display count\n const canShowByCapping = widgetConfig.cappingCount > displayCount;\n\n // can show last seen time\n const canShowByLastTime = currentTime - lastSeenTime > widgetConfig.cappingDelay;\n\n return canShowByCapping && canShowByLastTime;\n};\n\nexport const updateCappingParams = async (pw: Pushwoosh): Promise<void> => {\n const displayCount = await pw.data.getPromptDisplayCount();\n const currentTime = new Date().getTime();\n\n await pw.data.setPromptDisplayCount(displayCount + 1);\n await pw.data.setPromptLastSeenTime(currentTime);\n};\n","import { SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE } from './SubscriptionPromptWidget.constants';\nimport { type ISubscriptionPromptWidgetParams } from './SubscriptionPromptWidget.types';\n\nexport const getHTML = (params: ISubscriptionPromptWidgetParams): string => {\n return `\n <div id=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-root\" class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}\">\n <div class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__body\">\n <div class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__header\">\n ${params.headerText}\n </div>\n <div class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__description\">\n ${params.subheaderText}\n </div>\n <div class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__controls\">\n <button type=\"button\" id=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-decline\" class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control ${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control_decline\">\n ${params.buttonCancelText}\n </button>\n <button type=\"button\" id=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-accept\" class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control ${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control_accept\">\n ${params.buttonAcceptText}\n </button>\n </div>\n </div>\n </div>\n `;\n};\n\nexport const getStyles = (params: ISubscriptionPromptWidgetParams) => {\n const styles = document.createElement('style');\n\n styles.innerHTML = `\n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE} * {\n box-sizing: border-box!important;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE} {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n margin: 0 auto;\n width: 320px;\n display: none;\n z-index: 2147483648;\n opacity: 0.99;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}_show {\n display: block;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__body {\n width: 320px;\n background-color: ${params.backgroundColor ? params.backgroundColor : '#FFFFFF'};\n box-shadow: 0 9px 15px rgba(0, 0, 0, 0.1), 0 0 6px rgba(0, 0, 0, 0.06);\n border-radius: 4px;\n padding: 20px 20px 12px;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__header {\n color: ${params.headerTextColor};\n font-size: 18px;\n font-weight: bold; \n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__description {\n color: ${params.subheaderTextColor};\n font-size: 14px;\n line-height: 1.5;\n margin-top: 14px;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__description:empty {\n display: none;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__controls {\n display: flex;\n flex-wrap: nowrap;\n justify-content: flex-end;\n margin: 20px 0 0;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control {\n -webkit-appearance: none;\n border: 1px solid transparent;\n font-size: 12px;\n font-weight: bold;\n padding: 0 20px;\n height: 32px;\n cursor: pointer;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control_decline {\n color: ${params.buttonCancelTextColor};\n background-color: ${params.buttonCancelBackgroundColor};\n border-radius: ${params.buttonCancelRound};\n border-color: ${params.buttonCancelBorderColor};\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control_accept {\n color: ${params.buttonAcceptTextColor};\n background-color: ${params.buttonAcceptBackgroundColor};\n border-radius: ${params.buttonAcceptRound};\n border-color: ${params.buttonAcceptBorderColor};\n margin: 0 0 0 12px;\n }\n `;\n\n return styles;\n};\n"],"names":["root","factory","exports","module","define","amd","a","i","this","__webpack_require__","definition","Array","isArray","length","key","binding","o","Object","defineProperty","enumerable","value","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG","headerText","headerTextColor","subheaderText","subheaderTextColor","buttonAcceptText","buttonAcceptTextColor","buttonAcceptRound","buttonAcceptBackgroundColor","buttonAcceptBorderColor","buttonCancelText","buttonCancelTextColor","buttonCancelRound","buttonCancelBackgroundColor","buttonCancelBorderColor","cappingCount","cappingDelay","backgroundColor","SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE","PWSubscriptionPromptWidget","constructor","pw","run","features","data","getFeatures","widgetConfig","currentConfig","params","configWithDefaultCapping","getWidgetConfig","canShowByCapping","async","currentTime","Date","getTime","displayCount","getPromptDisplayCount","lastSeenTime","getPromptLastSeenTime","canShowByLastTime","checkCanShowByCapping","currentPromptUseCase","isDefaultUseCase","isNotSetUseCase","initParams","autoSubscribe","init","show","moduleRegistry","subscriptionPrompt","setPromptDisplayCount","setPromptLastSeenTime","updateCappingParams","getRootElement","html","getHTML","styles","document","createElement","innerHTML","getStyles","body","insertAdjacentHTML","head","appendChild","addEventListeners","rootElement","getRootElementWithCheckExist","dispatchEvent","classList","add","hide","contains","remove","getElementById","element","Error","getDeclineButtonWithCheckExist","getAcceptButtonWithCheckExist","declineElement","acceptElement","addEventListener","event","target","subscribe"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"widget-subscription-prompt.js","mappings":"CAAA,SAAAA,EAAAC,GACA,oBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,SACA,sBAAAG,QAAAA,OAAAC,IACAD,OAAA,GAAAH,OACA,CACA,IAAAK,EAAAL,IACA,QAAAM,KAAAD,GAAA,iBAAAJ,QAAAA,QAAAF,GAAAO,GAAAD,EAAAC,EACA,CACC,CATD,CASCC,KAAA,uBCRD,MAAAC,EAAA,CCAAA,EAAA,CAAAP,EAAAQ,KACA,QAAAC,KAAAD,EACAD,EAAAG,EAAAF,EAAAC,KAAAF,EAAAG,EAAAV,EAAAS,IACAE,OAAAC,eAAAZ,EAAAS,EAAA,CAAyCI,YAAA,EAAAC,IAAAN,EAAAC,MCJzCF,EAAA,CAAAQ,EAAAC,IAAAL,OAAAM,UAAAC,eAAAC,KAAAJ,EAAAC,GCCAT,EAAAP,IACAW,OAAAC,eAAAZ,EAAAoB,OAAAC,YAAA,CAAsDC,MAAA,WACtDX,OAAAC,eAAAZ,EAAA,cAAgDsB,OAAA,gECHzC,MAGMC,EAA4C,CACvDC,WAAY,wBACZC,gBAAiB,UACjBC,cAAe,iDACfC,mBAAoB,UACpBC,iBAAkB,QAClBC,sBAAuB,UACvBC,kBAAmB,MACnBC,4BAA6B,UAC7BC,wBAAyB,UACzBC,iBAAkB,OAClBC,sBAAuB,UACvBC,kBAAmB,MACnBC,4BAA6B,UAC7BC,wBAAyB,UACzBC,aAAc,EACdC,aAAc,MACdC,gBAAiB,WCpBNC,EAAuC,gCCO7C,MAAMC,EAGX,WAAAC,CAAYC,GACVtC,KAAKsC,GAAKA,CACZ,CAEO,SAAMC,GACX,MAAMD,GAAEA,GAAOtC,KAETwC,QAAiBF,EAAGG,KAAKC,cACzBC,ECdqB,CAACH,IAE9B,MAAMI,EAAgBJ,EAAqC,4BAAKA,EAAqC,2BAAEK,OAGjGC,EAA4D,CAChEd,aAAcf,EAA0Ce,aACxDC,aAAchB,EAA0CgB,gBACrDW,GAIL,OAAOA,EACHE,EACA7B,GDAmB8B,CAAgBP,GAC/BQ,OCE2BC,OAAON,EAA+CL,KACzF,MAAMY,GAAc,IAAIC,MAAOC,UACzBC,QAAqBf,EAAGG,KAAKa,wBAC7BC,QAAqBjB,EAAGG,KAAKe,wBAG7BR,EAAmBL,EAAaX,aAAeqB,EAG/CI,EAAoBP,EAAcK,EAAeZ,EAAaV,aAEpE,OAAOe,GAAoBS,GDbMC,CAAsBf,EAAcL,GACnE,IAAKU,EACH,OAGF,MAAMW,EAAuBnB,EAA8B,qBAAc,SAGnEoB,EF1B0C,YE0BvBD,EACnBE,EF5B0C,YE4BxBF,GAAiErB,EAAGwB,WAAWC,eAGnGH,GAAoBC,KACtB7D,KAAKgE,KAAKrB,GACV3C,KAAKiE,OACL3B,EAAG4B,eAAeC,mBAAqBnE,UCCViD,OAAOX,IACxC,MAAMe,QAAqBf,EAAGG,KAAKa,wBAC7BJ,GAAc,IAAIC,MAAOC,gBAEzBd,EAAGG,KAAK2B,sBAAsBf,EAAe,SAC7Cf,EAAGG,KAAK4B,sBAAsBnB,IDL1BoB,CAAoBhC,GAE9B,CAEO,IAAA0B,CAAKnB,GAKV,IAJoB7C,KAAKuE,iBAIP,CAChB,MAAMC,EE1CW,CAAC3B,GACf,gBACIV,kBAAqDA,wBAChDA,gCACEA,wBACVU,EAAO3B,+CAEGiB,6BACVU,EAAOzB,kDAEGe,oDACgBA,qBAAwDA,cAAiDA,mCACjIU,EAAOlB,0EAEiBQ,oBAAuDA,cAAiDA,kCAChIU,EAAOvB,8EF2BAmD,CAAQ5B,GACf6B,EEpBa,CAAC7B,IACxB,MAAM6B,EAASC,SAASC,cAAc,SAiFtC,OA/EAF,EAAOG,UAAY,UACd1C,mEAIAA,sNAYAA,sDAIAA,2DAEmBU,EAAOX,gBAAkBW,EAAOX,gBAAkB,2KAMrEC,6BACQU,EAAO1B,0FAKfgB,kCACQU,EAAOxB,oHAMfc,mEAIAA,+IAOAA,iOAUAA,sCACQU,EAAOjB,mDACIiB,EAAOf,sDACVe,EAAOhB,2CACRgB,EAAOd,+CAGtBI,qCACQU,EAAOtB,mDACIsB,EAAOpB,sDACVoB,EAAOrB,2CACRqB,EAAOnB,iEAKpBgD,GF9DYI,CAAUjC,GAGzB8B,SAASI,KAAKC,mBAAmB,YAAaR,GAG9CG,SAASM,KAAKC,YAAYR,EAC5B,CAEA1E,KAAKmF,mBACP,CAEO,IAAAlB,GACL,MAAMmB,EAAcpF,KAAKqF,+BACzBrF,KAAKsC,GAAGgD,cAAc,2BAA4B,IAElDF,EAAYG,UAAUC,IAAI,GAAGrD,SAC/B,CAEO,IAAAsD,GACL,MAAML,EAAcpF,KAAKqF,+BAErBD,EAAYG,UAAUG,SAAS,GAAGvD,YACpCnC,KAAKsC,GAAGgD,cAAc,2BAA4B,IAClDF,EAAYG,UAAUI,OAAO,GAAGxD,UAEpC,CAEQ,cAAAoC,GACN,OAAOI,SAASiB,eAAe,GAAGzD,SACpC,CAEQ,4BAAAkD,GACN,MAAMQ,EAAU7F,KAAKuE,iBAErB,IAAKsB,EACH,MAAM,IAAIC,MAAM,6BAA6B3D,0CAG/C,OAAO0D,CACT,CAEQ,8BAAAE,GACN,MAAMF,EAAUlB,SAASiB,eAAe,GAAGzD,aAE3C,IAAK0D,EACH,MAAM,IAAIC,MAAM,6BAA6B3D,6CAG/C,OAAO0D,CACT,CAEQ,6BAAAG,GACN,MAAMH,EAAUlB,SAASiB,eAAe,GAAGzD,YAE3C,IAAK0D,EACH,MAAM,IAAIC,MAAM,6BAA6B3D,4CAG/C,OAAO0D,CACT,CAEQ,iBAAAV,GACN,MAAMC,EAAcpF,KAAKqF,+BACnBY,EAAiBjG,KAAK+F,iCACtBG,EAAgBlG,KAAKgG,gCAE3BrB,SAASwB,iBAAiB,QAAUC,IAC7BhB,EAAYM,SAAUU,EAAMC,SAC/BrG,KAAKyF,SAITQ,EAAeE,iBAAiB,QAAS,KACvCnG,KAAKyF,SAGPS,EAAcC,iBAAiB,QAAS,KACtCnG,KAAKyF,OACLzF,KAAKsC,GAAGgE,aAEZ","sources":["webpack://web-push-notifications/webpack/universalModuleDefinition","webpack://web-push-notifications/webpack/bootstrap","webpack://web-push-notifications/webpack/runtime/define property getters","webpack://web-push-notifications/webpack/runtime/hasOwnProperty shorthand","webpack://web-push-notifications/webpack/runtime/make namespace object","webpack://web-push-notifications/./src/widgets/SubscriptionPrompt/constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.ts","webpack://web-push-notifications/./src/widgets/SubscriptionPrompt/helpers.ts","webpack://web-push-notifications/./src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.helpers.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, () => {\nreturn ","// The require scope\nconst __webpack_require__ = {};\n\n","// define getter/value functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop));","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET = 'not-set';\nexport const SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT = 'default';\n\nexport const SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG = {\n headerText: 'Subscribe to our news',\n headerTextColor: '#000000',\n subheaderText: 'Don\\'t miss out on the latest news and updates!',\n subheaderTextColor: '#000000',\n buttonAcceptText: 'Agree',\n buttonAcceptTextColor: '#1A72E8',\n buttonAcceptRound: '4px',\n buttonAcceptBackgroundColor: '#FFFFFF',\n buttonAcceptBorderColor: '#E3E4E8',\n buttonCancelText: 'Deny',\n buttonCancelTextColor: '#1A72E8',\n buttonCancelRound: '4px',\n buttonCancelBackgroundColor: '#FFFFFF',\n buttonCancelBorderColor: '#E3E4E8',\n cappingCount: 3,\n cappingDelay: 1000 * 60 * 60 * 4, // time in ms\n backgroundColor: '#FFFFFF',\n};\n","export const SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE = 'pushwoosh-subscription-widget';\n","import { SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT, SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET } from './constants';\nimport { checkCanShowByCapping, getWidgetConfig, updateCappingParams } from './helpers';\nimport { SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE } from './SubscriptionPromptWidget.constants';\nimport { getHTML, getStyles } from './SubscriptionPromptWidget.helpers';\nimport { type ISubscriptionPromptWidgetParams } from './SubscriptionPromptWidget.types';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\n\nexport class PWSubscriptionPromptWidget {\n private readonly pw: Pushwoosh;\n\n constructor(pw: Pushwoosh) {\n this.pw = pw;\n };\n\n public async run(): Promise<void> {\n const { pw } = this;\n\n const features = await pw.data.getFeatures();\n const widgetConfig = getWidgetConfig(features);\n const canShowByCapping = await checkCanShowByCapping(widgetConfig, pw);\n if (!canShowByCapping) {\n return;\n }\n\n const currentPromptUseCase = features['subscription_prompt']?.['use_case'];\n\n // show subscription prompt widget\n const isDefaultUseCase = currentPromptUseCase === SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT;\n const isNotSetUseCase = currentPromptUseCase === SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET && pw.initParams.autoSubscribe;\n\n // show subscription prompt widget\n if (isDefaultUseCase || isNotSetUseCase) {\n this.init(widgetConfig);\n this.show();\n pw.moduleRegistry.subscriptionPrompt = this;\n await updateCappingParams(pw);\n }\n }\n\n public init(params: ISubscriptionPromptWidgetParams): void {\n const rootElement = this.getRootElement();\n\n // if root element not exist\n // create widget\n if (!rootElement) {\n const html = getHTML(params);\n const styles = getStyles(params);\n\n // append popup to body\n document.body.insertAdjacentHTML('beforeend', html);\n\n // append styles to head\n document.head.appendChild(styles);\n }\n\n this.addEventListeners();\n }\n\n public show(): void {\n const rootElement = this.getRootElementWithCheckExist();\n this.pw.dispatchEvent('show-subscription-widget', {});\n\n rootElement.classList.add(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}_show`);\n }\n\n public hide(): void {\n const rootElement = this.getRootElementWithCheckExist();\n\n if (rootElement.classList.contains(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}_show`)) {\n this.pw.dispatchEvent('hide-subscription-widget', {});\n rootElement.classList.remove(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}_show`);\n }\n }\n\n private getRootElement(): HTMLElement | null {\n return document.getElementById(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-root`);\n }\n\n private getRootElementWithCheckExist(): HTMLElement {\n const element = this.getRootElement();\n\n if (!element) {\n throw new Error(`Can't find element by id \"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-root\", please use method init first.`);\n }\n\n return element;\n }\n\n private getDeclineButtonWithCheckExist(): HTMLButtonElement {\n const element = document.getElementById(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-decline`) as HTMLButtonElement;\n\n if (!element) {\n throw new Error(`Can't find element by id \"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-decline\", please use method init first.`);\n }\n\n return element;\n }\n\n private getAcceptButtonWithCheckExist(): HTMLButtonElement {\n const element = document.getElementById(`${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-accept`) as HTMLButtonElement;\n\n if (!element) {\n throw new Error(`Can't find element by id \"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-accept\", please use method init first.`);\n }\n\n return element;\n }\n\n private addEventListeners(): void {\n const rootElement = this.getRootElementWithCheckExist();\n const declineElement = this.getDeclineButtonWithCheckExist();\n const acceptElement = this.getAcceptButtonWithCheckExist();\n\n document.addEventListener('click', (event) => {\n if (!rootElement.contains((event.target as HTMLElement))) {\n this.hide();\n }\n });\n\n declineElement.addEventListener('click', () => {\n this.hide();\n });\n\n acceptElement.addEventListener('click', () => {\n this.hide();\n this.pw.subscribe();\n });\n }\n}\n","import { SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG } from './constants';\nimport type { ISubscriptionPromptWidgetParams } from './SubscriptionPromptWidget.types';\nimport type { Pushwoosh } from '../../core/Pushwoosh';\n\nexport const getWidgetConfig = (features: any): ISubscriptionPromptWidgetParams => {\n // get config by features from get config method\n const currentConfig = features['subscription_prompt_widget'] && features['subscription_prompt_widget'].params;\n\n // merge current config with capping defaults\n const configWithDefaultCapping: ISubscriptionPromptWidgetParams = {\n cappingCount: SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingCount,\n cappingDelay: SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingDelay,\n ...currentConfig,\n };\n\n // if current config is not exist show with default values\n return currentConfig\n ? configWithDefaultCapping\n : SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG;\n};\n\nexport const checkCanShowByCapping = async (widgetConfig: ISubscriptionPromptWidgetParams, pw: Pushwoosh): Promise<boolean> => {\n const currentTime = new Date().getTime();\n const displayCount = await pw.data.getPromptDisplayCount();\n const lastSeenTime = await pw.data.getPromptLastSeenTime();\n\n // can show by max display count\n const canShowByCapping = widgetConfig.cappingCount > displayCount;\n\n // can show last seen time\n const canShowByLastTime = currentTime - lastSeenTime > widgetConfig.cappingDelay;\n\n return canShowByCapping && canShowByLastTime;\n};\n\nexport const updateCappingParams = async (pw: Pushwoosh): Promise<void> => {\n const displayCount = await pw.data.getPromptDisplayCount();\n const currentTime = new Date().getTime();\n\n await pw.data.setPromptDisplayCount(displayCount + 1);\n await pw.data.setPromptLastSeenTime(currentTime);\n};\n","import { SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE } from './SubscriptionPromptWidget.constants';\nimport { type ISubscriptionPromptWidgetParams } from './SubscriptionPromptWidget.types';\n\nexport const getHTML = (params: ISubscriptionPromptWidgetParams): string => {\n return `\n <div id=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-root\" class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}\">\n <div class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__body\">\n <div class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__header\">\n ${params.headerText}\n </div>\n <div class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__description\">\n ${params.subheaderText}\n </div>\n <div class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__controls\">\n <button type=\"button\" id=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-decline\" class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control ${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control_decline\">\n ${params.buttonCancelText}\n </button>\n <button type=\"button\" id=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}-accept\" class=\"${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control ${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control_accept\">\n ${params.buttonAcceptText}\n </button>\n </div>\n </div>\n </div>\n `;\n};\n\nexport const getStyles = (params: ISubscriptionPromptWidgetParams) => {\n const styles = document.createElement('style');\n\n styles.innerHTML = `\n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE} * {\n box-sizing: border-box!important;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE} {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n margin: 0 auto;\n width: 320px;\n display: none;\n z-index: 2147483648;\n opacity: 0.99;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}_show {\n display: block;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__body {\n width: 320px;\n background-color: ${params.backgroundColor ? params.backgroundColor : '#FFFFFF'};\n box-shadow: 0 9px 15px rgba(0, 0, 0, 0.1), 0 0 6px rgba(0, 0, 0, 0.06);\n border-radius: 4px;\n padding: 20px 20px 12px;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__header {\n color: ${params.headerTextColor};\n font-size: 18px;\n font-weight: bold; \n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__description {\n color: ${params.subheaderTextColor};\n font-size: 14px;\n line-height: 1.5;\n margin-top: 14px;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__description:empty {\n display: none;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__controls {\n display: flex;\n flex-wrap: nowrap;\n justify-content: flex-end;\n margin: 20px 0 0;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control {\n -webkit-appearance: none;\n border: 1px solid transparent;\n font-size: 12px;\n font-weight: bold;\n padding: 0 20px;\n height: 32px;\n cursor: pointer;\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control_decline {\n color: ${params.buttonCancelTextColor};\n background-color: ${params.buttonCancelBackgroundColor};\n border-radius: ${params.buttonCancelRound};\n border-color: ${params.buttonCancelBorderColor};\n }\n \n .${SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE}__control_accept {\n color: ${params.buttonAcceptTextColor};\n background-color: ${params.buttonAcceptBackgroundColor};\n border-radius: ${params.buttonAcceptRound};\n border-color: ${params.buttonAcceptBorderColor};\n margin: 0 0 0 12px;\n }\n `;\n\n return styles;\n};\n"],"names":["root","factory","exports","module","define","amd","a","i","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG","headerText","headerTextColor","subheaderText","subheaderTextColor","buttonAcceptText","buttonAcceptTextColor","buttonAcceptRound","buttonAcceptBackgroundColor","buttonAcceptBorderColor","buttonCancelText","buttonCancelTextColor","buttonCancelRound","buttonCancelBackgroundColor","buttonCancelBorderColor","cappingCount","cappingDelay","backgroundColor","SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE","PWSubscriptionPromptWidget","constructor","pw","run","features","data","getFeatures","widgetConfig","currentConfig","params","configWithDefaultCapping","getWidgetConfig","canShowByCapping","async","currentTime","Date","getTime","displayCount","getPromptDisplayCount","lastSeenTime","getPromptLastSeenTime","canShowByLastTime","checkCanShowByCapping","currentPromptUseCase","isDefaultUseCase","isNotSetUseCase","initParams","autoSubscribe","init","show","moduleRegistry","subscriptionPrompt","setPromptDisplayCount","setPromptLastSeenTime","updateCappingParams","getRootElement","html","getHTML","styles","document","createElement","innerHTML","getStyles","body","insertAdjacentHTML","head","appendChild","addEventListeners","rootElement","getRootElementWithCheckExist","dispatchEvent","classList","add","hide","contains","remove","getElementById","element","Error","getDeclineButtonWithCheckExist","getAcceptButtonWithCheckExist","declineElement","acceptElement","addEventListener","event","target","subscribe"],"sourceRoot":""}
|
package/widget-web-popups.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,()=>(()=>{"use strict";const e={d:(t,n)=>{if(Array.isArray(n))for(var o=0;o<n.length;){var r=n[o++],i=n[o++];e.o(t,r)?0===i&&o++:0===i?Object.defineProperty(t,r,{enumerable:!0,value:n[o++]}):Object.defineProperty(t,r,{enumerable:!0,get:i})}else for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{WebPopupsWidget:()=>ar});const n=/^(https?:|mailto:|tel:)/i,o="#101828",r="#FFFFFF",i="#2970FF",s=o,l="#667085",a="#FFFFFF",u={h1:{fontSize:24,fontWeight:600,lineHeight:1.25},h2:{fontSize:18,fontWeight:600,lineHeight:1.3},h3:{fontSize:16,fontWeight:600,lineHeight:1.35},body:{fontSize:14,fontWeight:"normal",lineHeight:1.5},caption:{fontSize:12,fontWeight:"normal",lineHeight:1.4},eyebrow:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",lineHeight:1.4},icon:{fontSize:24,lineHeight:1.2}},c={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function d(e,t,n){return n?function(e,t){if(t>=1)return e;const n=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(e)?.[1];if(!n)return e;const o=3===n.length?n.split("").map(e=>e+e).join(""):n,[r,i,s]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${r}, ${i}, ${s}, ${t})`}(t.textInverse,c[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const p=["h1","h2","h3","icon"];function f(e){return"glyph"===e.type?"heading":"text"!==e.type?"action":p.includes(e.variant)?"heading":"text"}const _="8px 0 4px";function h(e,t){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:6,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===e?{backgroundColor:"#FFFFFF",color:t,border:`1px solid ${t}`}:{backgroundColor:t,color:"#FFFFFF",border:"none"}}}const m="#D92D20";function y(e="#D0D5DD"){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 12px",borderRadius:6,fontSize:14,fontFamily:"inherit",lineHeight:1.5,backgroundColor:"#FFFFFF",color:o,border:`1px solid ${e}`,outline:"none"}}const g="Subscribe",v="Thanks for subscribing!",b="Please check your inbox and confirm your email.",k="Save",w="Thanks! Your choice is saved.",S="Send",C="Thanks for the feedback!";const x="Something went wrong. Please try again.",E="\n@keyframes pw-vpopup-fade { from { opacity: 0; } }\n@keyframes pw-vpopup-slide { from { opacity: 0; translate: 0 28px; } }\n@keyframes pw-vpopup-overlay { from { opacity: 0; } }\n@keyframes pw-vpopup-page { from { opacity: 0; } }\n",P={bell:"M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0",gift:"M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z",cart:"M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",chart:"M3 21h18M7 21V11M12 21V6M17 21v-8",lock:"M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3",calendar:"M4 6h16v15H4zM4 10h16M9 3v4M15 3v4",check:"M4 13l5 5L20 6",star:"M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z",clock:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2",tag:"M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0",mail:"M3 6h18v12H3zM3 7l9 6 9-6",phone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4",download:"M12 3v12M7 11l5 5 5-5M4 20h16",play:"M8 5l12 7-12 7z",shield:"M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z",sparkle:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z",percent:"M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0",truck:"M2 7h12v10H2zM14 10h4l3 3v4h-7M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",ticket:"M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12",user:"M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0"},M=Object.keys(P),F=[24,32,48],R=["Vertical","Horizontal","Columns","Rows"],$=["normal","reverse"],A=["start","center","end","stretch"],I=["start","center","end","space-between"],N=["left","center","right"],T=["default","inverse"],j=2e3,O={px:j,"%":100,em:125,rem:125},L=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,H={px:j,"%":100,fr:100},z=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,D=["auto","min-content","max-content"];function U(e,t){return t.includes(e)?e:void 0}function W(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),j);if("string"!=typeof e)return;const t=L.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),O[o])}${o}`}const q=["top","right","bottom","left"];function B(e){if(D.includes(e))return e;const t=z.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),H[o])}${o}`}function V(e){return"string"==typeof e&&e.length>0?e:void 0}function K(e){const t={},n=W(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=W(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of q){const o=W(e[t]);void 0!==o&&(n[t]=o)}return Object.keys(n).length>0?n:void 0}(e.padding);void 0!==o&&(t.padding=o);const r=U(e.alignItems,A);r&&(t.alignItems=r);const i=U(e.justifyContent,I);i&&(t.justifyContent=i);const s=U(e.alignContent,I);s&&(t.alignContent=s);const l=V(e.backgroundImage);l&&(t.backgroundImage=l);const a=function(e){if("number"==typeof e)return Number.isInteger(e)&&e>=1&&e<=12?e:void 0;if("string"!=typeof e)return;const t=e.trim().split(/\s+/);if(t.length<1||t.length>12)return;const n=t.map(B);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==a&&(t.sizes=a),t}function Z(e,t,n){if(t>10||n.nodes<=0)return null;if("object"!=typeof e||null===e)return null;n.nodes-=1;const o=e,r="object"==typeof o.props&&null!==o.props?o.props:{};if("Content"===o.type){const e=V(r.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=U(r.align,N);n&&(t.props.align=n);const o=U(r.tone,T);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=V(r.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const i=U(o.type,R)??"Vertical",s=[];for(const e of o.children){const o=Z(e,t+1,n);o&&s.push(o)}const l=K(r);return"reverse"===U(r.order,$)&&(s.reverse(),"string"==typeof l.sizes&&(l.sizes=l.sizes.split(" ").reverse().join(" "))),{type:i,props:l,children:s}}function J(e){return Z(e,0,{nodes:100})}const Y=/^[a-zA-Z][a-zA-Z0-9-]*$/,G=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function Q(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=G.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function X(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:te(e,t,0)}const ee=new Set(["content","image","backgroundImage"]);function te(e,t,n){if(n>10||"object"!=typeof e||null===e)return e;const o=e,r={...o};if("object"==typeof o.props&&null!==o.props){const e={...o.props};for(const[n,o]of Object.entries(e))if(!ee.has(n))if("string"==typeof o)e[n]=Q(o,t);else if("object"==typeof o&&null!==o&&!Array.isArray(o)){const r={...o};for(const[e,n]of Object.entries(r))"string"==typeof n&&(r[e]=Q(n,t));e[n]=r}r.props=e}return Array.isArray(o.children)&&(r.children=o.children.map(e=>te(e,t,n+1))),r}function ne(e){return"number"==typeof e?`${e}px`:e}function oe(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function re(e=0){if(!(e>0))return null;const t=`rgba(16, 24, 40, ${Math.min(e,1)})`;return`linear-gradient(${t}, ${t})`}function ie(e,t=0){const n=`url(${JSON.stringify(e)})`,o=re(t);return{backgroundImage:o?`${o}, ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function se(e,t,n=0){const o=e.props??{},r={display:"grid",minWidth:0};return"Horizontal"===e.type&&(r.gridAutoFlow="column"),"Columns"===e.type&&(r.gridTemplateColumns=oe(o.sizes,e.children.length)),"Rows"===e.type&&(r.gridTemplateRows=oe(o.sizes,e.children.length)),void 0!==o.gap&&(r.gap=ne(o.gap)),void 0!==o.padding&&(r.padding=function(e){if("number"==typeof e||"string"==typeof e)return ne(e);const t=e=>void 0===e?"0":ne(e);return`${t(e.top)} ${t(e.right)} ${t(e.bottom)} ${t(e.left)}`}(o.padding)),o.alignItems&&(r.alignItems=o.alignItems),o.justifyContent&&(r.justifyContent=o.justifyContent),o.alignContent&&(r.alignContent=o.alignContent),t&&Object.assign(r,ie(t,n)),r}const le=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/,ae=new Map;function ue(e){const t=ae.get(e);if(t)return t;try{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});return ae.set(e,t),t}catch{return null}}function ce(e){return!e||null!==ue(e)}function de(e,t){const n=t.formatToParts(new Date(e)),o=e=>Number(n.find(t=>t.type===e)?.value??"0");return Date.UTC(o("year"),o("month")-1,o("day"),o("hour")%24,o("minute"),o("second"))-e}const pe=864e5;const fe=new Map;function _e(e,t){const n=`${e}|${t}`,o=fe.get(n);if(void 0!==o)return o;const r=function(e,t){const n=le.exec((e||"").trim());if(!n)return null;const[,o,r,i,s,l,a]=n.map(Number),u=Number.isNaN(a)?0:a;if(r<1||r>12||i<1||i>31)return null;if(s>23||l>59||u>59)return null;const c=Date.UTC(o,r-1,i,s,l,u),d=new Date(c);if(d.getUTCMonth()!==r-1||d.getUTCDate()!==i)return null;if(!t)return c;const p=ue(t);if(!p)return null;const f=function(e,t){const n=[];for(const o of[e-pe,e,e+pe]){const e=de(o,t);n.includes(e)||n.push(e)}return n}(c,p),_=f.filter(e=>de(c-e,p)===e).map(e=>c-e);return _.length>0?Math.min(..._):c-Math.min(...f)}(e,t);return fe.size>100&&fe.clear(),fe.set(n,r),r}const he={en:{days:"Days",hours:"Hours",minutes:"Minutes",seconds:"Seconds"},ru:{days:"Дни",hours:"Часы",minutes:"Минуты",seconds:"Секунды"},de:{days:"Tage",hours:"Stunden",minutes:"Minuten",seconds:"Sekunden"},es:{days:"Días",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},fr:{days:"Jours",hours:"Heures",minutes:"Minutes",seconds:"Secondes"},pt:{days:"Dias",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},ja:{days:"日",hours:"時間",minutes:"分",seconds:"秒"},ko:{days:"일",hours:"시간",minutes:"분",seconds:"초"},zh:{days:"天",hours:"小时",minutes:"分",seconds:"秒"},hi:{days:"दिन",hours:"घंटे",minutes:"मिनट",seconds:"सेकंड"},bn:{days:"দিন",hours:"ঘণ্টা",minutes:"মিনিট",seconds:"সেকেন্ড"},ar:{days:"أيام",hours:"ساعات",minutes:"دقائق",seconds:"ثوان"},he:{days:"ימים",hours:"שעות",minutes:"דקות",seconds:"שניות"},th:{days:"วัน",hours:"ชั่วโมง",minutes:"นาที",seconds:"วินาที"}};function me(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||n.test(t)?t:void 0}function ye(e){return"_self"===e?{target:"_self"}:{target:"_blank",rel:"noreferrer"}}const ge=new Set(["STRONG","B","EM","I","U","BR","A"]);function ve(e,t,n){for(const o of Array.from(e.childNodes)){if(3===o.nodeType){t.appendChild(n.createTextNode(o.textContent??""));continue}if(1!==o.nodeType)continue;const e=o;if(!ge.has(e.tagName)){ve(e,t,n);continue}const r=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=me(e.getAttribute("href")??void 0);t&&r.setAttribute("href",t);const{target:n,rel:o}=ye(e.getAttribute("target"));r.setAttribute("target",n),o&&r.setAttribute("rel",o)}t.appendChild(r),ve(e,r,n)}}function be(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return ve(t.body,n,t),n.innerHTML}function ke(e){return"string"==typeof e&&e?e:void 0}function we(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:ke(t.background)??ke(e.background)??r,accent:ke(t.accent)??ke(e.accent)??i,text:ke(t.text)??s,textSecondary:ke(t.textSecondary)??l,textInverse:ke(t.textInverse)??a}}const Se=["cover","contain"];function Ce(e){if("object"!=typeof e||null===e)return;const t=e,n=me("string"==typeof t.src?t.src:void 0);return n?{src:n,...!0===t.controls?{controls:!0}:{},...!1===t.loop?{loop:!1}:{}}:void 0}function xe(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!n.key)continue;if("string"!=typeof n.src)continue;const e=Ce(n.video);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,...e?{video:e}:{},..."string"==typeof n.mediaId&&n.mediaId?{mediaId:n.mediaId}:{},...Se.includes(n.fit)?{fit:n.fit}:{},..."number"==typeof n.blur&&Number.isFinite(n.blur)&&n.blur>0?{blur:Math.min(n.blur,100)}:{},..."number"==typeof n.dim&&Number.isFinite(n.dim)&&n.dim>0?{dim:Math.min(n.dim,1)}:{}})}return t}const Ee=["px","%","em","rem","fr"];function Pe(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function Me(e){if("object"!=typeof e||null===e)return;const t=e;if("text"===t.kind)return{kind:"text"};if("length"===t.kind||"percent"===t.kind){const e=Pe(t.min),n=Pe(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>Ee.includes(e)):[],r="length"===t.kind?function(e){if("object"!=typeof e||null===e)return;const t={};for(const n of Ee){const o=e[n];if("object"!=typeof o||null===o)continue;const r=Pe(o.min),i=Pe(o.max);void 0===r&&void 0===i||(t[n]={...void 0!==r?{min:r}:{},...void 0!==i?{max:i}:{}})}return Object.keys(t).length>0?t:void 0}(t.ranges):void 0;return{kind:t.kind,...void 0!==e?{min:e}:{},...void 0!==n?{max:n}:{},...o.length>0?{units:o}:{},...r?{ranges:r}:{}}}if("select"===t.kind&&Array.isArray(t.options)){const e=[];for(const n of t.options){if(e.length>=20)break;"object"==typeof n&&null!==n&&("string"!=typeof n.value||n.value.length>64||e.push({value:n.value,label:"string"==typeof n.label?n.label:n.value}))}if(e.length>0)return{kind:"select",options:e}}}function Fe(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!Y.test(n.key))continue;if("string"!=typeof n.value||n.value.length>64||n.value.includes("$"))continue;if(t.some(e=>e.key===n.key))continue;const e=Me(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function Re(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}const $e=["email","firstName","lastName","phone","custom"],Ae=["primary","secondary"];function Ie(e){const t=[];if(Array.isArray(e))for(const n of e){if(t.length>=10)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&$e.includes(n.kind)&&(t.some(e=>e.key===n.key)||t.push({key:n.key,kind:n.kind,label:"string"==typeof n.label?n.label:"",placeholder:"string"==typeof n.placeholder?n.placeholder:"",required:"email"===n.kind||!0===n.required,..."custom"===n.kind&&"string"==typeof n.tag&&n.tag?{tag:n.tag}:{}})))}if(!t.some(e=>"email"===e.kind)){let e="field-email";for(;t.some(t=>t.key===e);)e=`${e}-1`;t.unshift({key:e,kind:"email",label:"Email",placeholder:"",required:!0})}return t.slice(0,10)}const Ne=["checkbox","chips"],Te=["nps","stars","thumbs"],je=["instant","button"],Oe=["keep","hide-popup","page"],Le=/^[a-z]{2}$/i,He=/^#[0-9a-fA-F]{6}$/;function ze(e,t=120){return"string"==typeof e?e.trim().slice(0,t):""}function De(e,t,n=120){return ze(e,n)||t}function Ue(e){const t=ze(e,8);return Le.test(t)?t.toLowerCase():""}function We(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=12)break;if("object"!=typeof n||null===n)continue;const e=ze(n.value);if(!e)continue;if(t.some(t=>t.value===e))continue;const o=ze(n.tagValue);t.push({value:e,label:De(n.label,e),...o?{tagValue:o}:{}})}return t}function qe(e,t){const n=e=>{const n=Pe(e);return void 0===n||n<=0?0:Math.min(Math.floor(n),t)},o=n(e.min),r=n(e.max);return{min:o,max:r>0?Math.max(o,r):0}}function Be(e){const t=[];for(const n of e){if(t.length>=50)break;if("object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key))if("text"!==n.type)if("button"!==n.type){if("timer"===n.type){const e=ze(n.timezone,64),o=ce(e)?e:"",r=ze(n.endTime,32);if(null===_e(r,o))continue;const i=ze(n.expirePage),s=Oe.includes(n.onExpire)?n.onExpire:"keep",l="page"!==s||i?s:"keep";t.push({type:"timer",key:n.key,endTime:r,timezone:o,language:Ue(n.language),showLabels:!1!==n.showLabels,onExpire:l,..."page"===l?{expirePage:i}:{}});continue}if("choice"===n.type){const e=We(n.options),{min:o,max:r}=qe(n,e.length);t.push({type:"choice",key:n.key,control:Ne.includes(n.control)?n.control:"checkbox",tagName:ze(n.tagName),options:e,min:o,max:r,submitLabel:De(n.submitLabel,k),submitVariant:Ae.includes(n.submitVariant)?n.submitVariant:"primary",successMessage:De(n.successMessage,w,500)});continue}if("rating"===n.type){const e="object"==typeof n.labels&&null!==n.labels?n.labels:{};t.push({type:"rating",key:n.key,scale:Te.includes(n.scale)?n.scale:"stars",labels:{low:ze(e.low),high:ze(e.high)},submitMode:je.includes(n.submitMode)?n.submitMode:"instant",submitLabel:De(n.submitLabel,S),eventName:ze(n.eventName),successMessage:De(n.successMessage,C,500)});continue}if("glyph"!==n.type)"email-subscription-form"===n.type&&t.push({type:"email-subscription-form",key:n.key,formCode:"string"==typeof n.formCode?n.formCode:"",fields:Ie(n.fields),submitLabel:"string"==typeof n.submitLabel&&n.submitLabel?n.submitLabel:g,submitVariant:Ae.includes(n.submitVariant)?n.submitVariant:"primary",..."object"==typeof n.privacy&&null!==n.privacy&&"string"==typeof n.privacy.checkboxLabel?{privacy:{checkboxLabel:n.privacy.checkboxLabel,url:"string"==typeof n.privacy.url?n.privacy.url:"",linkLabel:"string"==typeof n.privacy.linkLabel?n.privacy.linkLabel:""}}:{},successMessage:"string"==typeof n.successMessage&&n.successMessage?n.successMessage:v,confirmEmailMessage:"string"==typeof n.confirmEmailMessage&&n.confirmEmailMessage?n.confirmEmailMessage:b});else{if(!M.includes(n.name))continue;t.push({type:"glyph",key:n.key,name:n.name,size:F.includes(n.size)?n.size:F[0],color:"string"==typeof n.color&&He.test(n.color)?n.color:""})}}else"object"==typeof n.action&&null!==n.action&&"string"==typeof n.action.type&&t.push(n);else"string"==typeof n.html&&t.push(n)}return t}function Ve(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&Array.isArray(n.slots)&&t.push({key:n.key,label:"string"==typeof n.label?n.label:"",slots:Be(n.slots)}))}return t}function Ke(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function Ze(e,t,n){if(null===e)return;let o;return o="stretch"===e?"stretch":Ke(e)??("stretch"===t?"stretch":Ke(t)),"width"===n&&"stretch"===o?void 0:o}function Je(e){const t=[];for(const n of e.pages){const o=Fe(n.values),r=J(X(n.layout,Re(o)));if(!r)continue;const i=Ze(n.width,e.width,"width"),s=Ze(n.height,e.height,"height");t.push({key:n.key,layout:r,images:xe(n.images),contents:Ve(n.contents),...void 0!==i?{width:i}:{},...void 0!==s?{height:s}:{}})}return t}function Ye(e){return`calc(100% - ${2*e.offset}px)`}const Ge="pushwoosh-web-popups",Qe="[WebPopups]",Xe="keyValue",et="messages",tt="inboxMessages";function nt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const ot=[nt(Xe,function(e){e.createObjectStore(Xe,{keyPath:"key"})}),nt("log",function(e){const t=e.createObjectStore("log",{keyPath:"id",autoIncrement:!0});t.createIndex("environment","environment",{unique:!1}),t.createIndex("date","date",{unique:!1}),t.createIndex("type","type",{unique:!1})}),nt(et,function(e){e.createObjectStore(et,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),nt(tt,function(e){const t="status",n=e.createObjectStore(tt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class rt{get all(){return ot}}class it{constructor(e,t=new rt){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function st(e,t){console.info("onversionchange",t),e.close()}let lt;function at(e){return(lt||(lt=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=st.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=st.bind(null,n,t),new it(n).applyMigrations()}})),lt).then(t=>new Promise((n,o)=>e(t,n,o)))}class ut{_add(e){return at((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);r.onsuccess=()=>{n(e)},r.onerror=()=>{o(r.error)}}).then(e=>this.getAll().then(t=>{if(Array.isArray(t)){const n=t.map(e=>e.id).sort((e,t)=>e==t?0:e<t?1:-1);if(n.length>this.maxItems)return Promise.all(n.slice(this.maxItems).map(e=>this.delete(e))).then(()=>e)}return e}))}delete(e){return at((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);r.onsuccess=()=>{n(r.result)},r.onerror=()=>{o(r.error)}})}getAll(){return at((e,t,n)=>{const o=[],r=e.transaction(this.name).objectStore(this.name).openCursor();r.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},r.onerror=()=>{n(r.error)}})}}ct=Xe;var ct;const dt=new class extends ut{constructor(){super(...arguments),this.name="log",this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(e,t,n){const o={type:e,environment:this.environment,message:`${t}`,date:new Date};return t instanceof Error&&(o.stack=t.stack),n&&(o.additional=n),this._add(o)}},pt=(new class extends ut{constructor(){super(...arguments),this.name=et,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let ft=3;const _t={setLevel(e){pt[e]||(e="error"),ft=pt[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),dt.add(e,t,n)}};function ht(e){return async({slotKey:t,tagName:n,values:o})=>{try{await e.api.setTags({[n]:o})}catch(e){throw _t.error(e,`Failed to write web popup choice "${t}" to tag "${n}"`),e}}}function mt(e){return async({slotKey:t,eventName:n,score:o,scale:r})=>{try{await e.api.postEvent(n,{score:o,scale:r,slotKey:t})}catch(e){throw _t.error(e,`Failed to post web popup rating "${t}" as event "${n}"`),e}}}Object.keys(pt).forEach(e=>{const t=pt[e];_t[e]=(...n)=>{t<=ft&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});var yt,gt,vt,bt,kt,wt,St,Ct,xt,Et,Pt,Mt,Ft,Rt,$t,At={},It=[],Nt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Tt=Array.isArray;function jt(e,t){for(var n in t)e[n]=t[n];return e}function Ot(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Lt(e,t,n){var o,r,i,s={};for(i in t)"key"==i?o=t[i]:"ref"==i?r=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?yt.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return Ht(e,s,o,r,null)}function Ht(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++vt,__i:-1,__u:0};return null==r&&null!=gt.vnode&>.vnode(i),i}function zt(e){return e.children}function Dt(e,t){this.props=e,this.context=t}function Ut(e,t){if(null==t)return e.__?Ut(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Ut(e):null}function Wt(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=jt({},t);i.__v=t.__v+1,gt.vnode&>.vnode(i),tn(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??Ut(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,on(o,i,r),t.__e=t.__=null,i.__e!=n&&qt(i)}}function qt(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),qt(e)}function Bt(e){(!e.__d&&(e.__d=!0)&&bt.push(e)&&!Vt.__r++||kt!=gt.debounceRendering)&&((kt=gt.debounceRendering)||wt)(Vt)}function Vt(){try{for(var e,t=1;bt.length;)bt.length>t&&bt.sort(St),e=bt.shift(),t=bt.length,Wt(e)}finally{bt.length=Vt.__r=0}}function Kt(e,t,n,o,r,i,s,l,a,u,c){var d,p,f,_,h,m,y=o&&o.__k||It,g=t.length;for(a=Zt(n,t,y,a,g),d=0;d<g;d++)null!=(f=n.__k[d])&&(p=-1!=f.__i&&y[f.__i]||At,f.__i=d,m=tn(e,f,p,r,i,s,l,a,u,c),_=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&ln(p.ref,null,f),c.push(f.ref,f.__c||_,f)),null==h&&null!=_&&(h=_),4&f.__u?(a=Jt(f,a,e),p.__e&&(p.__e=null)):"function"==typeof f.type&&void 0!==m?a=m:_&&(a=_.nextSibling),f.__u&=-7);return n.__e=h,a}function Zt(e,t,n,o,r){var i,s,l,a,u,c=n.length,d=c,p=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.__k[i]=Ht(null,s,null,null,null):Tt(s)?s=e.__k[i]=Ht(zt,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?s=e.__k[i]=Ht(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,a=i+p,s.__=e,s.__b=e.__b+1,l=null,-1!=(u=s.__i=Gt(s,n,a,d))&&(d--,(l=n[u])&&(l.__u|=2)),null==l||null==l.__v?(-1==u&&(r>c?p--:r<c&&p++),"function"!=typeof s.type&&(s.__u|=4)):u!=a&&(u==a-1?p--:u==a+1?p++:(u>a?p--:p++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<c;i++)null!=(l=n[i])&&!(2&l.__u)&&(l.__e==o&&(o=Ut(l)),an(l,l));return o}function Jt(e,t,n){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=Jt(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Ut(e)),t=n.insertBefore(e.__e,t||null));do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Yt(e,t){return t=t||[],null==e||"boolean"==typeof e||(Tt(e)?e.some(function(e){Yt(e,t)}):t.push(e)),t}function Gt(e,t,n,o){var r,i,s,l=e.key,a=e.type,u=t[n],c=null!=u&&!(2&u.__u);if(null===u&&null==l||c&&l==u.key&&a==u.type)return n;if(o>(c?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(u=t[s=r>=0?r--:i++])&&!(2&u.__u)&&l==u.key&&a==u.type)return s;return-1}function Qt(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||Nt.test(t)?n:n+"px"}function Xt(e,t,n,o,r){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Qt(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Qt(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(Pt,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[Et]=o[Et]:(n[Et]=Mt,e.addEventListener(t,i?Rt:Ft,i)):e.removeEventListener(t,i?Rt:Ft,i);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=n??"";break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function en(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[xt])t[xt]=Mt++;else if(t[xt]<n[Et])return;return n(gt.event?gt.event(t):t)}}}function tn(e,t,n,o,r,i,s,l,a,u){var c,d,p,f,_,h,m,y,g,v,b,k,w,S,C,x,E=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(a=!!(32&n.__u),i=[l=t.__e=n.__e]),(c=gt.__b)&&c(t);e:if("function"==typeof E){d=s.length;try{if(g=t.props,v=E.prototype&&E.prototype.render,b=(c=E.contextType)&&o[c.__c],k=c?b?b.props.value:c.__:o,n.__c?y=(p=t.__c=n.__c).__=p.__E:(v?t.__c=p=new E(g,k):(t.__c=p=new Dt(g,k),p.constructor=E,p.render=un),b&&b.sub(p),p.state||(p.state={}),p.__n=o,f=p.__d=!0,p.__h=[],p._sb=[]),v&&null==p.__s&&(p.__s=p.state),v&&null!=E.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=jt({},p.__s)),jt(p.__s,E.getDerivedStateFromProps(g,p.__s))),_=p.props,h=p.state,p.__v=t,f)v&&null==E.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),v&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(v&&null==E.getDerivedStateFromProps&&g!==_&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(g,k),t.__v==n.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(g,p.__s,k)){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),It.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),l=Ut(n);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(g,p.__s,k),v&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(_,h,m)})}if(p.context=k,p.props=g,p.__P=e,p.__e=!1,w=gt.__r,S=0,v)p.state=p.__s,p.__d=!1,w&&w(t),c=p.render(p.props,p.state,p.context),It.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,w&&w(t),c=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++S<25);p.state=p.__s,null!=p.getChildContext&&(o=jt(jt({},o),p.getChildContext())),v&&!f&&null!=p.getSnapshotBeforeUpdate&&(m=p.getSnapshotBeforeUpdate(_,h)),C=null!=c&&c.type===zt&&null==c.key?rn(c.props.children):c,l=Kt(e,Tt(C)?C:[C],t,n,o,r,i,s,l,a,u),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),y&&(p.__E=p.__=null)}catch(e){if(s.length=d,t.__v=null,a||null!=i){if(e.then){for(t.__u|=a?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;null!=i&&(i[i.indexOf(l)]=null),t.__e=l}else if(null!=i)for(x=i.length;x--;)Ot(i[x])}else t.__e=n.__e;null==t.__k&&(t.__k=n.__k||[]),e.then||nn(t),gt.__e(e,t,n)}}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=sn(n.__e,t,n,o,r,i,s,a,u);return(c=gt.diffed)&&c(t),128&t.__u?void 0:l}function nn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(nn))}function on(e,t,n){for(var o=0;o<n.length;o++)ln(n[o],n[++o],n[++o]);gt.__c&>.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){gt.__e(e,t.__v)}})}function rn(e){return"object"!=typeof e||null==e||e.__b>0?e:Tt(e)?e.map(rn):void 0!==e.constructor?null:jt({},e)}function sn(e,t,n,o,r,i,s,l,a){var u,c,d,p,f,_,h,m=n.props||At,y=t.props,g=t.type;if("svg"==g?r="http://www.w3.org/2000/svg":"math"==g?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=i)for(u=0;u<i.length;u++)if((f=i[u])&&"setAttribute"in f==!!g&&(g?f.localName==g:3==f.nodeType)){e=f,i[u]=null;break}if(null==e){if(null==g)return document.createTextNode(y);e=document.createElementNS(r,g,y.is&&y),l&&(gt.__m&>.__m(t,i),l=!1),i=null}if(null==g)m===y||l&&e.data==y||(e.data=y);else{if(i="textarea"==g&&null!=y.defaultValue?null:i&&yt.call(e.childNodes),!l&&null!=i)for(m={},u=0;u<e.attributes.length;u++)m[(f=e.attributes[u]).name]=f.value;for(u in m)f=m[u],"dangerouslySetInnerHTML"==u?d=f:"children"==u||u in y||"value"==u&&"defaultValue"in y||"checked"==u&&"defaultChecked"in y||Xt(e,u,null,f,r);for(u in y)f=y[u],"children"==u?p=f:"dangerouslySetInnerHTML"==u?c=f:"value"==u?_=f:"checked"==u?h=f:l&&"function"!=typeof f||m[u]===f||Xt(e,u,f,m[u],r);if(c)l||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),Kt("template"==t.type?e.content:e,Tt(p)?p:[p],t,n,o,"foreignObject"==g?"http://www.w3.org/1999/xhtml":r,i,s,i?i[0]:n.__k&&Ut(n,0),l,a),null!=i)for(u=i.length;u--;)Ot(i[u]);l&&"textarea"!=g||(u="value","progress"==g&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[u]||"progress"==g&&!_||"option"==g&&_!=m[u])&&Xt(e,u,_,m[u],r),u="checked",null!=h&&h!=e[u]&&Xt(e,u,h,m[u],r))}return e}function ln(e,t,n){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){gt.__e(e,n)}}function an(e,t,n){var o,r;if(gt.unmount&>.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ln(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){gt.__e(e,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&an(o[r],t,n||"function"!=typeof e.type);n||Ot(e.__e),e.__c=e.__=e.__e=void 0}function un(e,t,n){return this.constructor(e,n)}function cn(e,t,n){var o,r,i,s;t==document&&(t=document.documentElement),gt.__&>.__(e,t),r=(o="function"==typeof n)?null:n&&n.__k||t.__k,i=[],s=[],tn(t,e=(!o&&n||t).__k=Lt(zt,null,[e]),r||At,At,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?yt.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,s),on(i,e,s),e.props.children=null}function dn(e,t){cn(e,t,dn)}function pn(e,t,n){var o,r,i,s,l=jt({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==i?o=t[i]:"ref"==i?r=t[i]:l[i]=void 0===t[i]&&null!=s?s[i]:t[i];return arguments.length>2&&(l.children=arguments.length>3?yt.call(arguments,2):n),Ht(e.type,l,o||e.key,r||e.ref,null)}yt=It.slice,gt={__e:function(e,t,n,o){for(var r,i,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},vt=0,Dt.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=jt({},this.state),"function"==typeof e&&(e=e(jt({},n),this.props)),e&&jt(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Bt(this))},Dt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Bt(this))},Dt.prototype.render=zt,bt=[],wt="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,St=function(e,t){return e.__v.__b-t.__v.__b},Vt.__r=0,Ct=Math.random().toString(8),xt="__d"+Ct,Et="__a"+Ct,Pt=/(PointerCapture)$|Capture$/i,Mt=0,Ft=en(!1),Rt=en(!0),$t=0;var fn=0;Array.isArray;function _n(e,t,n,o,r,i){t||(t={});var s,l,a=t;if("ref"in a)for(l in a={},t)"ref"==l?s=t[l]:a[l]=t[l];var u={type:e,props:a,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--fn,__i:-1,__u:0,__source:r,__self:i};if("function"==typeof e&&(s=e.defaultProps))for(l in s)void 0===a[l]&&(a[l]=s[l]);return gt.vnode&>.vnode(u),u}var hn,mn,yn,gn,vn=0,bn=[],kn=gt,wn=kn.__b,Sn=kn.__r,Cn=kn.diffed,xn=kn.__c,En=kn.unmount,Pn=kn.__;function Mn(e,t){kn.__h&&kn.__h(mn,e,vn||t),vn=0;var n=mn.__H||(mn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Fn(e){return vn=1,Rn(Vn,e)}function Rn(e,t,n){var o=Mn(hn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Vn(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=mn,!mn.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,s=o.__c.props!==e;if(o.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),i){var l=i.call(this,e,t,n);return r?l||s:l}return!r||s};mn.__f=!0;var i=mn.shouldComponentUpdate,s=mn.componentWillUpdate;mn.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}s&&s.call(this,e,t,n)},mn.shouldComponentUpdate=r}return o.__N||o.__}function $n(e,t){var n=Mn(hn++,3);!kn.__s&&Bn(n.__H,t)&&(n.__=e,n.u=t,mn.__H.__h.push(n))}function An(e,t){var n=Mn(hn++,4);!kn.__s&&Bn(n.__H,t)&&(n.__=e,n.u=t,mn.__h.push(n))}function In(e){return vn=5,Tn(function(){return{current:e}},[])}function Nn(e,t,n){vn=6,An(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}function Tn(e,t){var n=Mn(hn++,7);return Bn(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function jn(e,t){return vn=8,Tn(function(){return e},t)}function On(e){var t=mn.context[e.__c],n=Mn(hn++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(mn)),t.props.value):e.__}function Ln(e,t){kn.useDebugValue&&kn.useDebugValue(t?t(e):e)}function Hn(){var e=Mn(hn++,11);if(!e.__){for(var t=mn.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function zn(){for(var e;e=bn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Wn),t.__h.some(qn),t.__h=[]}catch(n){t.__h=[],kn.__e(n,e.__v)}}}kn.__b=function(e){mn=null,wn&&wn(e)},kn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Pn&&Pn(e,t)},kn.__r=function(e){Sn&&Sn(e),hn=0;var t=(mn=e.__c).__H;t&&(yn===mn?(t.__h=[],mn.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Wn),t.__h.some(qn),t.__h=[],hn=0)),yn=mn},kn.diffed=function(e){Cn&&Cn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==bn.push(t)&&gn===kn.requestAnimationFrame||((gn=kn.requestAnimationFrame)||Un)(zn)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),yn=mn=null},kn.__c=function(e,t){t.some(function(e){try{e.__h.some(Wn),e.__h=e.__h.filter(function(e){return!e.__||qn(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],kn.__e(n,e.__v)}}),xn&&xn(e,t)},kn.unmount=function(e){En&&En(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Wn(e)}catch(e){t=e}}),n.__H=void 0,t&&kn.__e(t,n.__v))};var Dn="function"==typeof requestAnimationFrame;function Un(e){var t,n=function(){clearTimeout(o),Dn&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Dn&&(t=requestAnimationFrame(n))}function Wn(e){var t=mn,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),mn=t}function qn(e){var t=mn;e.__c=e.__(),mn=t}function Bn(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Vn(e,t){return"function"==typeof t?t(e):t}function Kn(e,t){for(var n in t)e[n]=t[n];return e}function Zn(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function Jn(e,t){var n=t(),o=Fn({t:{__:n,u:t}}),r=o[0].t,i=o[1];return An(function(){r.__=n,r.u=t,Yn(r)&&i({t:r})},[e,n,t]),$n(function(){return Yn(r)&&i({t:r}),e(function(){Yn(r)&&i({t:r})})},[e]),n}function Yn(e){try{return!((t=e.__)===(n=e.u())&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}var t,n}function Gn(e){e()}function Qn(e){return e}function Xn(){return[!1,Gn]}var eo=An;function to(e,t){this.props=e,this.context=t}(to.prototype=new Dt).isPureReactComponent=!0,to.prototype.shouldComponentUpdate=function(e,t){return Zn(this.props,e)||Zn(this.state,t)};var no=gt.__b;gt.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),no&&no(e)};var oo="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var ro=function(e,t){return null==e?null:Yt(Yt(e).map(t))},io={map:ro,forEach:ro,count:function(e){return e?Yt(e).length:0},only:function(e){var t=Yt(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:Yt},so=gt.__e;gt.__e=function(e,t,n,o){if(e.then)for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t);so(e,t,n,o)};var lo=gt.unmount;function ao(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=Kn({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return ao(e,t,n)})),e}function uo(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return uo(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function co(){this.__u=0,this.o=null,this.__b=null}function po(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function fo(){this.i=null,this.l=null}gt.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),lo&&lo(e)},(co.prototype=new Dt).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=po(o.__v),i=!1,s=function(){i||o.__z||(i=!0,n.__R=null,r?r(a):a())};n.__R=s;var l=n.__P;n.__P=null;var a=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=uo(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=l,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},co.prototype.componentWillUnmount=function(){this.o=[]},co.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=ao(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Lt(zt,null,e.fallback);return r&&(r.__u&=-33),[Lt(zt,null,t.__a?null:e.children),r]};var _o=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function ho(e){return this.getChildContext=function(){return e.context},e.children}function mo(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){cn(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}cn(Lt(ho,{context:t.context},e.__v),t.v)}(fo.prototype=new Dt).__a=function(e){var t=this,n=po(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),_o(t,e,o)):r()};n?n(i):i()}},fo.prototype.render=function(e){this.i=null,this.l=new Map;var t=Yt(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},fo.prototype.componentDidUpdate=fo.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){_o(e,n,t)})};var yo="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,go=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,vo=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,bo=/[A-Z0-9]/g,ko="undefined"!=typeof document,wo=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};Dt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Dt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var So=gt.event;gt.event=function(e){return So&&(e=So(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Co,xo={configurable:!0,get:function(){return this.class}},Eo=gt.vnode;gt.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1==n.indexOf("-");for(var i in t){var s=t[i];if(!("value"===i&&"defaultValue"in t&&null==s||ko&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var l=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===s?s="":"translate"===l&&"no"===s?s=!1:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?i="ondblclick":"onchange"!==l||"input"!==n&&"textarea"!==n||wo(t.type)?"onfocus"===l?i="onfocusin":"onblur"===l?i="onfocusout":vo.test(i)&&(i=l):l=i="oninput":r&&go.test(i)?i=i.replace(bo,"-$&").toLowerCase():null===s&&(s=void 0),"oninput"===l&&o[i=l]&&(i="oninputCapture"),o[i]=s}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=Yt(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=Yt(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",xo)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=yo,Eo&&Eo(e)};var Po=gt.__r;gt.__r=function(e){Po&&Po(e),Co=e.__c};var Mo=gt.diffed;gt.diffed=function(e){Mo&&Mo(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),Co=null};var Fo={ReactCurrentDispatcher:{current:{readContext:function(e){return Co.__n[e.__c].props.value},useCallback:jn,useContext:On,useDebugValue:Ln,useDeferredValue:Qn,useEffect:$n,useId:Hn,useImperativeHandle:Nn,useInsertionEffect:eo,useLayoutEffect:An,useMemo:Tn,useReducer:Rn,useRef:In,useState:Fn,useSyncExternalStore:Jn,useTransition:Xn}}};function Ro(e){return!!e&&e.$$typeof===yo}var $o={useState:Fn,useId:Hn,useReducer:Rn,useEffect:$n,useLayoutEffect:An,useInsertionEffect:eo,useTransition:Xn,useDeferredValue:Qn,useSyncExternalStore:Jn,startTransition:Gn,useRef:In,useImperativeHandle:Nn,useMemo:Tn,useCallback:jn,useContext:On,useDebugValue:Ln,version:"18.3.1",Children:io,render:function(e,t,n){return null==t.__k&&(t.textContent=""),cn(e,t),"function"==typeof n&&n(),e?e.__c:null},hydrate:function(e,t,n){return dn(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&(cn(null,e),!0)},createPortal:function(e,t){var n=Lt(mo,{__v:e,h:t});return n.containerInfo=t,n},createElement:Lt,createContext:function(e){function t(e){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,Bt(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+$t++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createFactory:function(e){return Lt.bind(null,e)},cloneElement:function(e){return Ro(e)?pn.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:zt,isValidElement:Ro,isElement:Ro,isFragment:function(e){return Ro(e)&&e.type===zt},isMemo:function(e){return!!e&&"string"==typeof e.displayName&&0==e.displayName.indexOf("Memo(")},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:Dt,PureComponent:to,memo:function(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:Zn(this.props,e)}function o(t){return this.shouldComponentUpdate=n,Lt(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o},forwardRef:function(e){function t(t){var n=Kn({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=oo,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,t){var n,o=gt.debounceRendering;gt.debounceRendering=function(e){n=e};try{var r=e(t);return n&&n(),r}finally{gt.debounceRendering=o}},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:zt,Suspense:co,SuspenseList:fo,lazy:function(e){var t,n,o,r=null;function i(i){if(t||(t=e()).then(function(e){e&&(r=e.default||e),o=!0},function(e){n=e,o=!0}),n)throw n;if(!o)throw t;return r?Lt(r,i):null}return i.displayName="Lazy",i.__f=!0,i},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Fo};const Ao={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function Io({slot:e,align:t,inverse:n,colors:o}){const r={...u[e.variant],textAlign:e.align??t},i=d(e.variant,o,n);return i&&(r.color=i),$o.createElement("div",{style:r,dangerouslySetInnerHTML:{__html:be(e.html)}})}function No({slot:e,accent:t,onRequestClose:n,onPageChange:o}){const r=h(e.variant,t),i={};if("close"===e.action.type)return $o.createElement("div",{style:i},$o.createElement("button",{type:"button",style:r,onClick:n},e.label));if("page"===e.action.type){const t=e.action.page;return $o.createElement("div",{style:i},$o.createElement("button",{type:"button",style:r,onClick:()=>o(t)},e.label))}const s=me(e.action.url);return s?$o.createElement("div",{style:i},$o.createElement("a",{href:s,...ye(e.action.target),style:r},e.label)):$o.createElement("div",{style:i},$o.createElement("button",{type:"button",style:r},e.label))}function To({message:e,align:t,inverse:n,colors:o}){const r=d("body",o,n);return $o.createElement("div",{style:{...u.body,padding:"4px 0",textAlign:t,...r?{color:r}:{}}},e)}const jo=/^\S+@\S+\.\S+$/,Oo={email:"email",phone:"tel"},Lo={email:"email",firstName:"given-name",lastName:"family-name",phone:"tel"},Ho="__privacy";function zo({slot:e,align:t,inverse:n,colors:o,onSubmitForm:r}){const[i,s]=Fn({}),[l,a]=Fn(!1),[c,p]=Fn(null),[f,g]=Fn({}),[v,b]=Fn("idle"),k=d("caption",o,n),w={...u.caption,...k?{color:k}:{}},S={fontSize:12,lineHeight:1.4,color:m,paddingTop:2};if("success"===v||"confirm"===v)return $o.createElement(To,{message:"confirm"===v?e.confirmEmailMessage:e.successMessage,align:t,inverse:n,colors:o});const C="submitting"===v,E=e.privacy?me(e.privacy.url):void 0,P={...h(e.submitVariant,o.accent),...C?{opacity:.6,cursor:"default"}:{}};return $o.createElement("form",{noValidate:!0,style:{margin:0,textAlign:"left"},onSubmit:t=>{t.preventDefault(),(()=>{if(!r||!e.formCode||"submitting"===v)return;const t={};for(const n of e.fields){const e=(i[n.key]??"").trim();n.required&&!e?t[n.key]="Required":"email"===n.kind&&e&&!jo.test(e)&&(t[n.key]="Enter a valid email")}if(e.privacy&&!l&&(t[Ho]="Please accept the privacy policy"),g(t),Object.keys(t).length>0)return;const n={email:"",policyAccepted:!e.privacy||l},o={};for(const t of e.fields){const e=(i[t.key]??"").trim();e&&("email"===t.kind?n.email=n.email||e:"firstName"===t.kind?n.firstName=e:"lastName"===t.kind?n.lastName=e:"phone"===t.kind?n.phone=e:o[t.tag||t.key]=e)}Object.keys(o).length>0&&(n.customFields=o),b("submitting"),Promise.resolve().then(()=>r(e.formCode,n)).then(e=>b("confirm-email"===e?"confirm":"success"),()=>b("error"))})()}},e.fields.map(e=>{const t=f[e.key];let n;return t?n=m:c===e.key&&(n=o.accent),$o.createElement("div",{key:e.key,style:{padding:"4px 0"}},e.label&&$o.createElement("div",{style:{...w,paddingBottom:4}},e.label),$o.createElement("input",{type:Oo[e.kind]??"text",autoComplete:Lo[e.kind],placeholder:e.placeholder||void 0,value:i[e.key]??"",disabled:C,style:y(n),onFocus:()=>p(e.key),onBlur:()=>p(t=>t===e.key?null:t),onChange:t=>{return n=e.key,o=t.currentTarget.value,s(e=>({...e,[n]:o})),void g(e=>e[n]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==n)):e);var n,o}}),t&&$o.createElement("div",{style:S},t))}),e.privacy&&$o.createElement("div",{style:{padding:"4px 0"}},$o.createElement("label",{style:{...w,display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"}},$o.createElement("input",{type:"checkbox",checked:l,disabled:C,style:{margin:"2px 0 0",flexShrink:0},onChange:e=>{a(e.currentTarget.checked),g(e=>e[Ho]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==Ho)):e)}}),$o.createElement("span",null,e.privacy.checkboxLabel,E&&$o.createElement($o.Fragment,null," ",$o.createElement("a",{href:E,...ye(void 0),style:{color:o.accent}},e.privacy.linkLabel||e.privacy.url)))),f[Ho]&&$o.createElement("div",{style:S},f[Ho])),$o.createElement("div",{style:{padding:_}},$o.createElement("button",{type:"submit",disabled:C,style:P},e.submitLabel)),"error"===v&&$o.createElement("div",{style:{...S,textAlign:t}},x))}function Do({value:e,label:t,digitStyle:n,labelStyle:o}){return $o.createElement("div",{style:{minWidth:44}},$o.createElement("div",{style:n},String(e).padStart(2,"0")),t?$o.createElement("div",{style:o},t):null)}function Uo({slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:s}){const[l,a]=Fn(()=>Date.now()),c=function(e,t,n){const o=_e(e,t),r=null===o?0:Math.max(0,o-n),i=Math.floor(r/1e3);return{total:r,days:Math.floor(i/86400),hours:Math.floor(i/3600)%24,minutes:Math.floor(i/60)%60,seconds:i%60}}(e.endTime,e.timezone,l),p=0===c.total;$n(()=>{if("live"!==r||p)return;const e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[r,p,e.endTime,e.timezone]),$n(()=>{"live"===r&&p&&("hide-popup"===e.onExpire?i?.():"page"===e.onExpire&&e.expirePage&&s(e.expirePage))},[r,p,e.onExpire,e.expirePage,i,s]);const f=d("h2",o,n),_=d("caption",o,n),h={fontSize:28,fontWeight:700,lineHeight:1.2,fontVariantNumeric:"tabular-nums",...f?{color:f}:{}},m={...u.caption,..._?{color:_}:{}},y=(g=e.language,he[g]??he.en);var g;const v=[{value:c.days,label:y.days},{value:c.hours,label:y.hours},{value:c.minutes,label:y.minutes},{value:c.seconds,label:y.seconds}];return $o.createElement("div",{style:{padding:"4px 0",textAlign:t}},$o.createElement("div",{style:{display:"inline-flex",gap:12,textAlign:"center"}},v.map(t=>$o.createElement(Do,{key:t.label||t.value,value:t.value,label:e.showLabels?t.label:"",digitStyle:h,labelStyle:m}))))}function Wo({slot:e,align:t,inverse:n,colors:o,onSubmitChoice:r}){const[i,s]=Fn([]),[l,a]=Fn("idle"),[c,p]=Fn("");if("success"===l)return $o.createElement(To,{message:e.successMessage,align:t,inverse:n,colors:o});const f=t=>{p(""),s(n=>n.includes(t)?n.filter(e=>e!==t):e.max>0&&n.length>=e.max?(p(`Pick up to ${e.max}`),n):[...n,t])},y="submitting"===l,g=d("body",o,n),v={...u.body,...g?{color:g}:{}};return $o.createElement("div",{style:{padding:"4px 0"}},"chips"===e.control?$o.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"===t?"center":"flex-start"}},e.options.map(e=>{return $o.createElement("button",{key:e.value,type:"button","aria-pressed":i.includes(e.value),style:(t=i.includes(e.value),{padding:"6px 14px",borderRadius:999,border:`1px solid ${o.accent}`,backgroundColor:t?o.accent:"transparent",color:t?"#FFFFFF":o.accent,fontFamily:"inherit",fontSize:14,lineHeight:1.4,cursor:"pointer"}),onClick:()=>f(e.value)},e.label);var t})):$o.createElement("div",{style:{display:"grid",gap:6}},e.options.map(e=>$o.createElement("label",{key:e.value,style:{...v,display:"flex",alignItems:"center",gap:8,cursor:"pointer"}},$o.createElement("input",{type:"checkbox",checked:i.includes(e.value),onChange:()=>f(e.value),style:{accentColor:o.accent,width:16,height:16,margin:0}}),e.label))),c?$o.createElement("div",{style:{...u.caption,color:m,paddingTop:4}},c):null,"error"===l?$o.createElement("div",{style:{...u.caption,color:m,paddingTop:4}},x):null,$o.createElement("div",{style:{padding:_}},$o.createElement("button",{type:"button",style:{...h(e.submitVariant,o.accent),...y?{opacity:.7}:{}},onClick:()=>{if(!r||!e.tagName||"submitting"===l)return;const t=Math.max(e.min,1);if(i.length<t)return void p(1===t?"Pick at least one":`Pick at least ${t}`);const n=e.options.filter(e=>i.includes(e.value)).map(e=>e.tagValue||e.value);p(""),a("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,tagName:e.tagName,values:n})).then(()=>a("success"),()=>a("error"))}},e.submitLabel)))}function qo({score:e,scale:t,selected:n,accent:o,onPick:r}){const i={display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,border:`1px solid ${o}`,backgroundColor:n?o:"transparent",color:n?"#FFFFFF":o,fontFamily:"inherit",fontSize:14,lineHeight:1,cursor:"pointer"};if("nps"===t)return $o.createElement("button",{type:"button","aria-label":`Rate ${e}`,"aria-pressed":n,style:{...i,width:30,height:32,borderRadius:6},onClick:r},e);const s="thumbs"===t;let l=`Rate ${e}`;return s&&(l=1===e?"Thumbs up":"Thumbs down"),$o.createElement("button",{type:"button","aria-label":l,"aria-pressed":n,style:{...i,width:s?44:34,height:s?40:34,borderRadius:s?8:6},onClick:r},$o.createElement("svg",{width:s?22:20,height:s?22:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},$o.createElement("path",{d:s?"M8 21V10l3.5-7A2 2 0 0 1 14 5v5h4.5a2 2 0 0 1 2 2.4l-1.3 6A2 2 0 0 1 17.2 21zM8 10H3.5v11H8":P.star,...s&&0===e?{transform:"rotate(180 12 12)"}:{}})))}function Bo({slot:e,align:t,inverse:n,colors:o,onSubmitRating:r}){const[i,s]=Fn(null),[l,a]=Fn("idle");if("success"===l)return $o.createElement(To,{message:e.successMessage,align:t,inverse:n,colors:o});const c=t=>{r&&e.eventName&&"submitting"!==l&&(a("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,eventName:e.eventName,score:t,scale:e.scale})).then(()=>a("success"),()=>a("error")))},p="nps"===(f=e.scale)?[0,1,2,3,4,5,6,7,8,9,10]:"stars"===f?[1,2,3,4,5]:[0,1];var f;const y=d("caption",o,n),g={...u.caption,...y?{color:y}:{}},v=t=>"stars"===e.scale?null!==i&&t<=i:i===t;return $o.createElement("div",{style:{padding:"4px 0"}},$o.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:6,justifyContent:"center"===t?"center":"flex-start"}},p.map(t=>$o.createElement(qo,{key:t,score:t,scale:e.scale,selected:v(t),accent:o.accent,onPick:()=>(t=>{"submitting"!==l&&(s(t),"instant"===e.submitMode&&c(t))})(t)}))),e.labels.low||e.labels.high?$o.createElement("div",{style:{display:"flex",justifyContent:"space-between",gap:8,paddingTop:4}},$o.createElement("span",{style:g},e.labels.low),$o.createElement("span",{style:g},e.labels.high)):null,"error"===l?$o.createElement("div",{style:{...u.caption,color:m,paddingTop:4}},x):null,"button"===e.submitMode?$o.createElement("div",{style:{padding:_}},$o.createElement("button",{type:"button",style:{...h("primary",o.accent),..."submitting"===l?{opacity:.7}:{}},onClick:()=>null===i?void 0:c(i)},e.submitLabel)):null)}function Vo({slot:e,align:t,inverse:n,colors:o}){const r=e.color||(n?o.textInverse:o.accent);return $o.createElement("div",{style:{padding:"4px 0",textAlign:t,lineHeight:0}},$o.createElement("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"inline-block"}},$o.createElement("path",{d:P[e.name]})))}function Ko({slot:e,align:t,inverse:n,colors:o,mode:r="live",onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){const c=s??(()=>{});switch(e.type){case"text":return $o.createElement(Io,{slot:e,align:t,inverse:n,colors:o});case"button":return $o.createElement(No,{slot:e,accent:o.accent,onRequestClose:i,onPageChange:c});case"email-subscription-form":return $o.createElement(zo,{slot:e,align:t,inverse:n,colors:o,onSubmitForm:l});case"timer":return $o.createElement(Uo,{slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:c});case"choice":return $o.createElement(Wo,{slot:e,align:t,inverse:n,colors:o,onSubmitChoice:a});case"rating":return $o.createElement(Bo,{slot:e,align:t,inverse:n,colors:o,onSubmitRating:u});case"glyph":return $o.createElement(Vo,{slot:e,align:t,inverse:n,colors:o})}}function Zo({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){const c=t.contents.find(t=>t.key===e.props.content);if(!c)return null;if(r?.renderZone)return $o.createElement("div",{style:{minWidth:0}},r.renderZone(c,e));const d=e.props.align??"left",p="inverse"===e.props.tone;return $o.createElement("div",{style:{minWidth:0}},c.slots.map((e,t)=>{const r=c.slots[t-1],_=r?(h=f(r),"action"===(m=f(e))?"action"===h?6:16:"text"===m&&"heading"===h?4:8):0;var h,m;return $o.createElement("div",{key:e.key,style:_?{marginTop:_}:void 0},$o.createElement(Ko,{slot:e,align:d,inverse:p,colors:n,mode:o,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}))}))}function Jo(e){return e?.video?me(e.video.src):void 0}function Yo({image:e,src:t,style:n,mode:o}){return $o.createElement("video",{src:t,poster:e.src||void 0,style:n,autoPlay:"live"===o,muted:!0,playsInline:!0,preload:"metadata",loop:!1!==e.video?.loop,controls:!0===e.video?.controls})}function Go({node:e,page:t,leaf:n,mode:o}){const r=t.images.find(t=>t.key===e.props.image);if(!r)return null;if(n?.renderImage)return $o.createElement($o.Fragment,null,n.renderImage(r,e));const i=Jo(r);if(!r.src&&!i)return null;const s={display:"block",width:"100%",minWidth:0};return r.fit?(s.height="100%",s.objectFit=r.fit):s.height="auto",r.blur&&(s.filter=`blur(${r.blur}px)`),i?$o.createElement(Yo,{image:r,src:i,style:s,mode:o}):$o.createElement("img",{src:r.src,alt:"",style:s})}function Qo({style:e,outer:t,inner:n,layer:o,children:r}){const{backgroundColor:i,...s}=e;return $o.createElement("div",{style:{display:"grid",minWidth:0,backgroundColor:i,...t}},o,$o.createElement("div",{style:{...s,...n}},r))}function Xo({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){if("Content"===e.type)return $o.createElement(Zo,{node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u});if("Image"===e.type)return $o.createElement(Go,{node:e,page:t,leaf:r,mode:o});const c=e.props?.backgroundImage,d=c?t.images.find(e=>e.key===c):void 0,p=d?.blur??0,f=d?.dim??0,_=Jo(d),h=se(e,p>0||_?void 0:d?.src||void 0,f);c&&(h.backgroundColor="#1D2939");const m=e.children.map((e,c)=>$o.createElement(Xo,{key:c,node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}));if(_&&d){const e=re(f);return $o.createElement(Qo,{style:h,outer:{position:"relative",overflow:"hidden",...d.src?ie(d.src):{}},inner:{position:"relative",...e?{backgroundImage:e}:{}},layer:$o.createElement(Yo,{image:d,src:_,mode:o,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",...p>0?{filter:`blur(${p}px)`}:{}}})},m)}return p>0?$o.createElement(Qo,{style:h,outer:d?.src?ie(d.src,f):void 0,inner:{backdropFilter:`blur(${p}px)`,WebkitBackdropFilter:`blur(${p}px)`}},m):$o.createElement("div",{style:h},m)}function er({page:e,params:t,mode:n="live",leafRenderers:o,animatePage:r=!1,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){const c={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:t.colors.background,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:t.colors.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:t.boxShadow&&"none"!==t.boxShadow?t.boxShadow:void 0,transition:"height 300ms ease"};e.height&&(c.height="stretch"===e.height?"100%":e.height,c.overflowY="auto");const d={...r?{animation:"pw-vpopup-page 300ms ease-out backwards"}:{},..."stretch"===e.height?{display:"grid",minHeight:"100%"}:{}};return $o.createElement("div",{style:c},$o.createElement("div",{key:e.key,style:d},$o.createElement(Xo,{node:e.layout,page:e,colors:t.colors,mode:n,leaf:o,onRequestClose:i,onPageChange:s??(()=>{}),onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u})))}function tr({onRequestClose:e}){return $o.createElement("button",{type:"button","aria-label":"Close",onClick:e,style:{position:"absolute",top:10,right:10,width:24,height:24,padding:0,border:"none",borderRadius:"50%",background:"rgba(255, 255, 255, 0.92)",boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:"#667085",fontSize:13,lineHeight:1,cursor:"pointer"}},"✕")}function nr(e,t,n){const{placement:o}=e,r={position:"fixed",boxSizing:"border-box",maxWidth:Ye(o),maxHeight:Ye(o),pointerEvents:"auto"};if(t){r.width=t;const e=o.h;"left"===e?r.left=o.offset:"right"===e?r.right=o.offset:r.left="50%"}else r.left=o.offset,r.right=o.offset;"stretch"===n?(r.top=o.offset,r.bottom=o.offset):"top"===o.v?r.top=o.offset:"bottom"===o.v?r.bottom=o.offset:r.top="50%";const i=t&&"center"===o.h?"-50%":"0",s="middle"===o.v&&"stretch"!==n?"-50%":"0";"0"===i&&"0"===s||(r.transform=`translate(${i}, ${s})`);const l=Ao[e.animation];return l&&(r.animation=l),r.transition="width 300ms ease",r}function or({params:e,mode:t="live",onRequestClose:n,onSubmitForm:o,onSubmitChoice:r,onSubmitRating:i,leafRenderers:s}){const[l,a]=Fn(null);$n(()=>{Je(e).forEach(e=>e.images.forEach(({src:e})=>{e&&((new Image).src=e)}))},[e]);const u=Je(e);if(0===u.length)return null;const c=u.find(e=>e.key===l)??function(e,t){return t.find(t=>t.key===e.startPage)??t[0]}(e,u),d=null!==l;if("preview"===t)return $o.createElement("div",{style:{position:"relative",width:c.width??"100%",transition:"width 300ms ease"}},$o.createElement("style",null,E),$o.createElement(er,{page:c,params:e,mode:t,leafRenderers:s,animatePage:d,onRequestClose:n,onPageChange:a,onSubmitForm:o,onSubmitChoice:r,onSubmitRating:i}));const p=e.overlay;return $o.createElement($o.Fragment,null,$o.createElement("style",null,E),p&&$o.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:p.color,opacity:p.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:n}),$o.createElement("div",{style:nr(e,c.width,c.height)},$o.createElement(er,{page:c,params:e,mode:t,leafRenderers:s,animatePage:d,onRequestClose:n,onPageChange:a,onSubmitForm:o,onSubmitChoice:r,onSubmitRating:i}),$o.createElement(tr,{onRequestClose:n})))}const rr={SUBMIT_FORM_RESULT_SUBSCRIBED:"subscribed",SUBMIT_FORM_RESULT_CONFIRM_EMAIL:"confirm-email",SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED:"already-subscribed"},ir=(e,t)=>`https://subscription-form.svc-nue.pushwoosh.com/api/v1/forms/code/${encodeURIComponent(e)}${t}`,sr=async(e,t)=>{try{const n=await fetch(ir(e,"/submit"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,userId:t.email})});if(!n.ok)throw new Error(`Subscription form submit failed: HTTP ${n.status}`);const o=await n.json(),r=rr[o.result??""];if(!r)throw new Error(`Subscription form submit failed: unexpected result "${o.result}"`);return r}catch(t){throw _t.error(t,`Failed to submit subscription form "${e}"`),t}},lr=e=>{const t=function(e){let t;try{t=JSON.parse(e)}catch{return null}if("object"!=typeof t||null===t)return null;const n=t;if(2!==n.version)return null;const o=n.params;return"object"!=typeof o||null===o?null:Array.isArray(o.pages)&&0!==o.pages.length?{version:2,params:{...o,colors:we(o)}}:null}(e);return t?0===Je(t.params).length?null:t.params:null};class ar{constructor(e){this.isRecurringVisitor=!1,this.entries=new Map,this.queue=[],this.visible=null,this.drainTimeoutId=null,this.autoShowEnabled=!0,this.isNavigationSubscribed=!1,this.openPopupsCount=0,this.bodyOverflowBeforeLock=null,this.readyPromise=new Promise(e=>{this.readyResolve=e}),this.pw=e,this.submitHandlers={onSubmitChoice:ht(e),onSubmitRating:mt(e)},e.moduleRegistry.webPopups=this}async run(){const{pw:e}=this;try{this.autoShowEnabled=!1!==e.initParams.webPopups?.autoShow,await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const t=await e.api.getPopupForms();_t.debug(`${Qe} Received ${t.length} popup(s) from server:`,t.map(e=>e.code)),t.forEach((e,t)=>{this.entries.set(e.code,{popup:e,order:t,state:"idle",content:null,loading:null,passedStrongConditions:!1,timeoutId:null,visitRecorded:!1})}),await Promise.allSettled(Array.from(this.entries.values()).map(async e=>{e.passedStrongConditions=await this.checkStrongCondition(e.popup),e.passedStrongConditions&&await this.ensureContent(e)}));const n=this.loadedCodes();_t.debug(`${Qe} ${n.length} popup(s) passed strong conditions and loaded:`,n),this.subscribeToNavigation(),this.renderForCurrentPage(),await e.data.setIsRecurringVisitor(!0)}finally{this.readyResolve(),e.dispatchEvent("web-popups-ready",{})}}async show(e){await this.readyPromise;const t=this.entries.get(e);if(!t)return _t.error(new Error("Unknown web popup code"),`${Qe} show("${e}"): no such popup`),!1;if(this.visible?.code===e)return!0;return await this.ensureContent(t)?this.visible?.code===e||!!this.checkNotExpired(t)&&(this.visible&&(_t.debug(`${Qe} show("${e}") preempting "${this.visible.code}"`),this.visible.close("preempted")),this.detachFromAutoPipeline(t),this.present(t,"api"),!0):(_t.error(new Error("Web popup content unavailable"),`${Qe} show("${e}"): content unavailable`),!1)}hide(e){return!!this.visible&&((void 0===e||this.visible.code===e)&&(this.visible.close("api"),!0))}hideAll(){const e=this.hide();return this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||(this.detachFromAutoPipeline(e),e.state="done")}),this.cancelScheduledDrain(),e}isVisible(e){return!!this.visible&&(void 0===e||this.visible.code===e)}getVisibleCode(){return this.visible?.code??null}getAvailableCodes(){return Array.from(this.entries.keys())}getState(){const e=[];return this.entries.forEach((t,n)=>{"waiting"===t.state&&e.push(n)}),{visible:this.getVisibleCode(),queued:[...this.queue],waiting:e,available:this.getAvailableCodes()}}ensureContent(e){return e.content?Promise.resolve(e.content):(e.loading||(e.loading=this.loadContent(e.popup).then(t=>(e.content=t,t)).catch(t=>(_t.error(t,`${Qe} Failed to load web popup "${e.popup.code}"`),null)).finally(()=>{e.content||(e.loading=null)})),e.loading)}async loadContent(e){const t=await this.pw.api.getPopupFormContent(e.popup_form_content_code),n=lr(t.json);return n||(_t.error(new Error("Unsupported popup content format"),`${Qe} Web popup "${e.code}" content is not a supported {version, params} popup; skipping`),null)}loadedCodes(){const e=[];return this.entries.forEach((t,n)=>{t.content&&e.push(n)}),e}renderForCurrentPage(){this.releaseUnmatchedPending();const e=[];this.entries.forEach((t,n)=>{this.canAutoDisplay(t)&&(this.armDelay(t),e.push(n))}),_t.debug(`${Qe} ${e.length} popup(s) selected for display on "${window.location.pathname}":`,e),this.drain()}canAutoDisplay(e){return this.autoShowEnabled&&"idle"===e.state&&e.passedStrongConditions&&this.isAutoTrigger(e.popup)&&null!==e.content&&this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)}isAutoTrigger(e){const t=e.trigger_type;return!t||"PAGE_LOAD"===t}armDelay(e){const{popup:t}=e;_t.debug(`${Qe} Popup "${t.code}" armed for display in ${t.delay}s`),e.state="waiting",this.recordVisit(e),e.timeoutId=window.setTimeout(()=>{e.timeoutId=null,e.state="queued",this.insertIntoQueue(e),_t.debug(`${Qe} Popup "${t.code}" delay elapsed; queued at position ${this.queue.indexOf(t.code)+1} of ${this.queue.length}`),this.drain()},1e3*t.delay)}recordVisit(e){e.visitRecorded||(e.visitRecorded=!0,this.pw.api.recordPopupFormEvent(e.popup.code,1).catch(t=>{_t.error(t,`${Qe} Failed to record web popup visit event for "${e.popup.code}"`)}))}insertIntoQueue(e){const t=this.queue.findIndex(t=>{const n=this.entries.get(t);return!!n&&(n.popup.delay!==e.popup.delay?n.popup.delay>e.popup.delay:n.order>e.order)});-1!==t?this.queue.splice(t,0,e.popup.code):this.queue.push(e.popup.code)}releaseUnmatchedPending(){this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)||(this.detachFromAutoPipeline(e),e.state="idle",_t.debug(`${Qe} Released popup "${e.popup.code}": page no longer matches, or its countdown passed`))})}detachFromAutoPipeline(e){null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null);const t=this.queue.indexOf(e.popup.code);-1!==t&&this.queue.splice(t,1)}drain(){if(this.visible||null!==this.drainTimeoutId)return;const e=this.queue.shift();if(void 0===e)return;const t=this.entries.get(e);if(t&&"queued"===t.state){if(!this.checkSoftCondition(t.popup)||!this.checkNotExpired(t))return t.state="idle",void this.drain();if(!t.content)return t.state="done",void this.drain();_t.debug(`${Qe} Display slot free; showing "${e}"`),this.present(t,"auto")}else this.drain()}scheduleDrain(){null===this.drainTimeoutId&&(this.drainTimeoutId=window.setTimeout(()=>{this.drainTimeoutId=null,this.drain()},400))}cancelScheduledDrain(){null!==this.drainTimeoutId&&(window.clearTimeout(this.drainTimeoutId),this.drainTimeoutId=null)}present(e,t){this.cancelScheduledDrain();const{popup:n,content:o}=e;if(!o)return void(e.state="done");const r=document.createElement("div");r.id=`${Ge}-${n.code}`,r.style.position="fixed",r.style.inset="0",r.style.zIndex=String(2147483647),r.style.pointerEvents="none",document.body.appendChild(r);const i=r.attachShadow({mode:"open"}),s=document.createElement("div");i.appendChild(s);const l=!!o.overlay;l&&this.lockBodyScroll();let a=!1;const u=t=>{a||(a=!0,l&&this.unlockBodyScroll(),(e=>{cn(null,e)})(s),r.remove(),this.visible?.code===n.code&&(this.visible=null),e.state="done",this.pw.dispatchEvent("hide-web-popup",{code:n.code,reason:t}),this.scheduleDrain())};this.visible={code:n.code,host:r,modal:l,close:u},e.state="visible",((e,t,n,o)=>{cn(_n(or,{params:t,mode:"live",onRequestClose:n,onSubmitForm:sr,onSubmitChoice:o.onSubmitChoice,onSubmitRating:o.onSubmitRating}),e)})(s,o,()=>u("user"),this.submitHandlers);const c=function(e){const t=new Set;for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots)"object"==typeof n&&null!==n&&"email-subscription-form"===n.type&&"string"==typeof n.formCode&&n.formCode&&t.add(n.formCode);return[...t]}(o);c.length>0&&this.pw.data.getHwid().then(e=>c.forEach(t=>((e,t)=>{fetch(ir(e,"/view"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,userId:t,hwid:t})}).catch(t=>{_t.error(t,`Failed to record subscription form view for "${e}"`)})})(t,e))).catch(e=>{_t.error(e,`${Qe} Failed to record subscription form views for web popup "${n.code}"`)}),_t.debug(`${Qe} Popup "${n.code}" shown (trigger: ${t})`),this.recordVisit(e),this.markAsShown(n).catch(e=>{_t.error(e,`${Qe} Failed to mark web popup "${n.code}" as shown`)}),this.pw.dispatchEvent("show-web-popup",{code:n.code,trigger:t})}lockBodyScroll(){0===this.openPopupsCount&&(this.bodyOverflowBeforeLock=document.body.style.overflow,document.body.style.overflow="hidden"),this.openPopupsCount+=1}unlockBodyScroll(){this.openPopupsCount=Math.max(0,this.openPopupsCount-1),0===this.openPopupsCount&&null!==this.bodyOverflowBeforeLock&&(document.body.style.overflow=this.bodyOverflowBeforeLock,this.bodyOverflowBeforeLock=null)}subscribeToNavigation(){if(this.isNavigationSubscribed)return;this.isNavigationSubscribed=!0;const e=()=>this.renderForCurrentPage(),t=window.navigation;if(t&&"function"==typeof t.addEventListener)return void t.addEventListener("currententrychange",e);window.addEventListener("popstate",e),window.addEventListener("hashchange",e);let n=window.location.href;window.setInterval(()=>{window.location.href!==n&&(n=window.location.href,e())},500)}async checkStrongCondition(e){return(await Promise.all([this.checkCanBeShownByDeviceTypeCondition(e),this.checkCanBeShownByFrequencyCondition(e),this.checkCanBeShownByVisitorsTypeCondition(e)])).every(e=>e)}checkSoftCondition(e){return this.checkCanBeShownByMatchingPagesCondition(e)}checkNotExpired(e){return!e.content||(!function(e,t){for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots){if("object"!=typeof n||null===n)continue;if("timer"!==n.type||"hide-popup"!==n.onExpire)continue;if("string"!=typeof n.endTime)continue;const e="string"==typeof n.timezone?n.timezone:"",o=_e(n.endTime,e);if(null!==o&&o<=t)return!0}return!1}(e.content,Date.now())||(_t.debug(`${Qe} Popup "${e.popup.code}" not shown: its countdown has passed`),!1))}checkCanBeShownByDeviceTypeCondition(e){const{device_type:t}=e,n=this.pw.platformChecker.formFactor;return"ALL"===t||t===n}async checkCanBeShownByFrequencyCondition(e){const{frequency:t,code:n}=e;if("ONCE"===t){return!(await this.pw.data.getShownWebPopups()).includes(n)}return"ONCE_PER_SESSION"!==t||null===sessionStorage.getItem(this.getSessionStorageKey(n))}checkCanBeShownByMatchingPagesCondition(e){const{matching_pages:t,matching_page_rules:n,excluded_pages:o}=e,r=window.location.pathname;return n&&n.length>0?n.some(e=>this.matchPageRule(r,e)):t&&t.length>0?t.includes(r):!(o&&o.length>0)||!o.some(e=>this.matchPageRule(r,e))}matchPageRule(e,t){switch(t.operator){case"EQUALS":return e===t.path;case"STARTS_WITH":return e.startsWith(t.path);default:return!1}}checkCanBeShownByVisitorsTypeCondition(e){const{visitors_type:t}=e;return"NEW"===t?!this.isRecurringVisitor:"RECURRING"!==t||this.isRecurringVisitor}async markAsShown(e){this.pw.api.recordPopupFormEvent(e.code,2).catch(t=>{_t.error(t,`${Qe} Failed to record web popup shown event for "${e.code}"`)});const{frequency:t,code:n}=e;"ONCE"!==t?"ONCE_PER_SESSION"===t&&sessionStorage.setItem(this.getSessionStorageKey(n),"1"):await this.pw.data.addShownWebPopup(n)}getSessionStorageKey(e){return`${Ge}.shown.${e}`}}return t})());
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,()=>(()=>{"use strict";const e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{WebPopupsWidget:()=>xr});const n=/^(https?:|mailto:|tel:)/i,o="#101828",r="#667085",i="#FFFFFF",s="#FFFFFF",a="#2970FF",l=o,c=r,u="#FFFFFF",d={h1:{fontSize:24,fontWeight:600,lineHeight:1.25},h2:{fontSize:18,fontWeight:600,lineHeight:1.3},h3:{fontSize:16,fontWeight:600,lineHeight:1.35},body:{fontSize:14,fontWeight:"normal",lineHeight:1.5},caption:{fontSize:12,fontWeight:"normal",lineHeight:1.4},eyebrow:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",lineHeight:1.4},icon:{fontSize:24,lineHeight:1.2}},p={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function f(e,t,n){return n?function(e,t){if(t>=1)return e;const n=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(e)?.[1];if(!n)return e;const o=3===n.length?n.split("").map(e=>e+e).join(""):n,[r,i,s]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${r}, ${i}, ${s}, ${t})`}(t.textInverse,p[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const _=["h1","h2","h3","icon"];function h(e){return"glyph"===e.type?"heading":"text"!==e.type?"action":_.includes(e.variant)?"heading":"text"}const m="8px 0 4px";function y(e,t){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:6,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===e?{backgroundColor:t.surface,color:t.accent,border:`1px solid ${t.accent}`}:{backgroundColor:t.accent,color:t.onAccent,border:"none"}}}function g(e,t=e.border){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 12px",borderRadius:6,fontSize:14,fontFamily:"inherit",lineHeight:1.5,backgroundColor:e.surface,color:e.surfaceText,border:`1px solid ${t}`,outline:"none"}}const v="Subscribe",b="Thanks for subscribing!",k="Please check your inbox and confirm your email.",w="Save",S="Thanks! Your choice is saved.",x="Send",C="Thanks for the feedback!";const E="Something went wrong. Please try again.",M="\n@keyframes pw-vpopup-fade { from { opacity: 0; } }\n@keyframes pw-vpopup-slide { from { opacity: 0; translate: 0 28px; } }\n@keyframes pw-vpopup-overlay { from { opacity: 0; } }\n@keyframes pw-vpopup-page { from { opacity: 0; } }\n",P={bell:"M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0",gift:"M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z",cart:"M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",chart:"M3 21h18M7 21V11M12 21V6M17 21v-8",lock:"M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3",calendar:"M4 6h16v15H4zM4 10h16M9 3v4M15 3v4",check:"M4 13l5 5L20 6",star:"M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z",clock:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2",tag:"M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0",mail:"M3 6h18v12H3zM3 7l9 6 9-6",phone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4",download:"M12 3v12M7 11l5 5 5-5M4 20h16",play:"M8 5l12 7-12 7z",shield:"M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z",sparkle:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z",percent:"M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0",truck:"M2 7h12v10H2zM14 10h4l3 3v4h-7M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",ticket:"M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12",user:"M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0"},$=Object.keys(P),R=[24,32,48],A=["Vertical","Horizontal","Columns","Rows"],I=["normal","reverse"],F=["start","center","end","stretch"],N=["start","center","end","space-between"],T=["left","center","right"],j=["default","inverse"],O=2e3,L={px:O,"%":100,em:125,rem:125},H=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,z={px:O,"%":100,fr:100},D=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,U=["auto","min-content","max-content"];function W(e,t){return t.includes(e)?e:void 0}function q(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),O);if("string"!=typeof e)return;const t=H.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),L[o])}${o}`}const B=["top","right","bottom","left"];function V(e){if(U.includes(e))return e;const t=D.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),z[o])}${o}`}function K(e){return"string"==typeof e&&e.length>0?e:void 0}function Z(e){const t={},n=q(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=q(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of B){const o=q(e[t]);void 0!==o&&(n[t]=o)}return Object.keys(n).length>0?n:void 0}(e.padding);void 0!==o&&(t.padding=o);const r=W(e.alignItems,F);r&&(t.alignItems=r);const i=W(e.justifyContent,N);i&&(t.justifyContent=i);const s=W(e.alignContent,N);s&&(t.alignContent=s);const a=K(e.backgroundImage);a&&(t.backgroundImage=a);const l=function(e){if("number"==typeof e)return Number.isInteger(e)&&e>=1&&e<=12?e:void 0;if("string"!=typeof e)return;const t=e.trim().split(/\s+/);if(t.length<1||t.length>12)return;const n=t.map(V);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==l&&(t.sizes=l),t}function J(e,t,n){if(t>10||n.nodes<=0)return null;if("object"!=typeof e||null===e)return null;n.nodes-=1;const o=e,r="object"==typeof o.props&&null!==o.props?o.props:{};if("Content"===o.type){const e=K(r.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=W(r.align,T);n&&(t.props.align=n);const o=W(r.tone,j);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=K(r.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const i=W(o.type,A)??"Vertical",s=[];for(const e of o.children){const o=J(e,t+1,n);o&&s.push(o)}const a=Z(r);return"reverse"===W(r.order,I)&&(s.reverse(),"string"==typeof a.sizes&&(a.sizes=a.sizes.split(" ").reverse().join(" "))),{type:i,props:a,children:s}}function Y(e){return J(e,0,{nodes:100})}const G=/^[a-zA-Z][a-zA-Z0-9-]*$/,Q=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function X(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=Q.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function ee(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:ne(e,t,0)}const te=new Set(["content","image","backgroundImage"]);function ne(e,t,n){if(n>10||"object"!=typeof e||null===e)return e;const o=e,r={...o};if("object"==typeof o.props&&null!==o.props){const e={...o.props};for(const[n,o]of Object.entries(e))if(!te.has(n))if("string"==typeof o)e[n]=X(o,t);else if("object"==typeof o&&null!==o&&!Array.isArray(o)){const r={...o};for(const[e,n]of Object.entries(r))"string"==typeof n&&(r[e]=X(n,t));e[n]=r}r.props=e}return Array.isArray(o.children)&&(r.children=o.children.map(e=>ne(e,t,n+1))),r}function oe(e){return"number"==typeof e?`${e}px`:e}function re(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function ie(e=0){if(!(e>0))return null;const t=`rgba(16, 24, 40, ${Math.min(e,1)})`;return`linear-gradient(${t}, ${t})`}function se(e,t=0){const n=`url(${JSON.stringify(e)})`,o=ie(t);return{backgroundImage:o?`${o}, ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function ae(e,t,n=0){const o=e.props??{},r={display:"grid",minWidth:0};return"Horizontal"===e.type&&(r.gridAutoFlow="column"),"Columns"===e.type&&(r.gridTemplateColumns=re(o.sizes,e.children.length)),"Rows"===e.type&&(r.gridTemplateRows=re(o.sizes,e.children.length)),void 0!==o.gap&&(r.gap=oe(o.gap)),void 0!==o.padding&&(r.padding=function(e){if("number"==typeof e||"string"==typeof e)return oe(e);const t=e=>void 0===e?"0":oe(e);return`${t(e.top)} ${t(e.right)} ${t(e.bottom)} ${t(e.left)}`}(o.padding)),o.alignItems&&(r.alignItems=o.alignItems),o.justifyContent&&(r.justifyContent=o.justifyContent),o.alignContent&&(r.alignContent=o.alignContent),t&&Object.assign(r,se(t,n)),r}const le=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function ce(e){const t=le.exec(e.trim())?.[1];if(!t)return null;const n=3===t.length?t.split("").map(e=>e+e).join(""):t;return[0,2,4].map(e=>parseInt(n.slice(e,e+2),16))}function ue([e,t,n]){return`#${[e,t,n].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join("")}`}function de(e,t,n){let o=n;return o<0&&(o+=1),o>1&&(o-=1),o<1/6?e+6*(t-e)*o:o<.5?t:o<2/3?e+(t-e)*(2/3-o)*6:e}function pe(e){return e>.5?.07+.86*(1-e):e}function fe(e){return e<.5?.93-e*((.93-.5)/.5):e}function _e(e,t){const n=ce(e);if(!n)return e;const[o,r,i]=function([e,t,n]){const[o,r,i]=[e/255,t/255,n/255],s=Math.max(o,r,i),a=Math.min(o,r,i),l=(s+a)/2;if(s===a)return[0,0,l];const c=s-a;let u;return u=s===o?(r-i)/c+(r<i?6:0):s===r?(i-o)/c+2:(o-r)/c+4,[u/6,l>.5?c/(2-s-a):c/(s+a),l]}(n);return ue(function([e,t,n]){if(0===t){const e=255*n;return[e,e,e]}const o=n<.5?n*(1+t):n+t-n*t,r=2*n-o;return[255*de(r,o,e+1/3),255*de(r,o,e),255*de(r,o,e-1/3)]}([o,r,"fold"===t?pe(i):fe(i)]))}function he(e,t,n){const o=ce(e),r=ce(t);return o&&r?ue(o.map((e,t)=>e+(r[t]-e)*n)):e}function me(e,t){const n=ce(e);if(!n||t>=1)return e;const[o,r,i]=n;return`rgba(${o}, ${r}, ${i}, ${t})`}function ye(e){const t=ce(e);if(!t)return!1;const[n,o,r]=t;return(.299*n+.587*o+.114*r)/255>.6}function ge(e){return{background:_e(e.background,"fold"),accent:e.accent,text:_e(e.text,"lift"),textSecondary:_e(e.textSecondary,"lift"),textInverse:e.textInverse}}function ve(e,t){return"light"===t?{surface:s,surfaceText:o,border:"#D0D5DD",onAccent:i,error:"#D92D20",chromeIcon:r}:{surface:he(e.background,e.text,.08),surfaceText:e.text,border:he(e.background,e.text,.24),onAccent:ye(e.accent)?o:i,error:"#FDA29B",chromeIcon:e.textSecondary}}function be(e){return!0===e.dark?.enabled}function ke(e,t="light"){const n="dark"===t&&be(e)?"dark":"light",o="dark"===n?(r=e.colors,i=e.dark,{...ge(r),...i?.colors??{}}):e.colors;var r,i;return{...o,scheme:n,...ve(o,n)}}const we=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/,Se=new Map;function xe(e){const t=Se.get(e);if(t)return t;try{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});return Se.set(e,t),t}catch{return null}}function Ce(e){return!e||null!==xe(e)}function Ee(e,t){const n=t.formatToParts(new Date(e)),o=e=>Number(n.find(t=>t.type===e)?.value??"0");return Date.UTC(o("year"),o("month")-1,o("day"),o("hour")%24,o("minute"),o("second"))-e}const Me=864e5;const Pe=new Map;function $e(e,t){const n=`${e}|${t}`,o=Pe.get(n);if(void 0!==o)return o;const r=function(e,t){const n=we.exec((e||"").trim());if(!n)return null;const[,o,r,i,s,a,l]=n.map(Number),c=Number.isNaN(l)?0:l;if(r<1||r>12||i<1||i>31)return null;if(s>23||a>59||c>59)return null;const u=Date.UTC(o,r-1,i,s,a,c),d=new Date(u);if(d.getUTCMonth()!==r-1||d.getUTCDate()!==i)return null;if(!t)return u;const p=xe(t);if(!p)return null;const f=function(e,t){const n=[];for(const o of[e-Me,e,e+Me]){const e=Ee(o,t);n.includes(e)||n.push(e)}return n}(u,p),_=f.filter(e=>Ee(u-e,p)===e).map(e=>u-e);return _.length>0?Math.min(..._):u-Math.min(...f)}(e,t);return Pe.size>100&&Pe.clear(),Pe.set(n,r),r}const Re={en:{days:"Days",hours:"Hours",minutes:"Minutes",seconds:"Seconds"},ru:{days:"Дни",hours:"Часы",minutes:"Минуты",seconds:"Секунды"},de:{days:"Tage",hours:"Stunden",minutes:"Minuten",seconds:"Sekunden"},es:{days:"Días",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},fr:{days:"Jours",hours:"Heures",minutes:"Minutes",seconds:"Secondes"},pt:{days:"Dias",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},ja:{days:"日",hours:"時間",minutes:"分",seconds:"秒"},ko:{days:"일",hours:"시간",minutes:"분",seconds:"초"},zh:{days:"天",hours:"小时",minutes:"分",seconds:"秒"},hi:{days:"दिन",hours:"घंटे",minutes:"मिनट",seconds:"सेकंड"},bn:{days:"দিন",hours:"ঘণ্টা",minutes:"মিনিট",seconds:"সেকেন্ড"},ar:{days:"أيام",hours:"ساعات",minutes:"دقائق",seconds:"ثوان"},he:{days:"ימים",hours:"שעות",minutes:"דקות",seconds:"שניות"},th:{days:"วัน",hours:"ชั่วโมง",minutes:"นาที",seconds:"วินาที"}};function Ae(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||n.test(t)?t:void 0}function Ie(e){return"_self"===e?{target:"_self"}:{target:"_blank",rel:"noreferrer"}}const Fe=new Set(["STRONG","B","EM","I","U","BR","A"]);function Ne(e,t,n){for(const o of Array.from(e.childNodes)){if(3===o.nodeType){t.appendChild(n.createTextNode(o.textContent??""));continue}if(1!==o.nodeType)continue;const e=o;if(!Fe.has(e.tagName)){Ne(e,t,n);continue}const r=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=Ae(e.getAttribute("href")??void 0);t&&r.setAttribute("href",t);const{target:n,rel:o}=Ie(e.getAttribute("target"));r.setAttribute("target",n),o&&r.setAttribute("rel",o)}t.appendChild(r),Ne(e,r,n)}}function Te(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return Ne(t.body,n,t),n.innerHTML}function je(e){return"string"==typeof e&&e?e:void 0}function Oe(e){let t;try{t=JSON.parse(e)}catch{return null}if("object"!=typeof t||null===t)return null;const n=t;if(2!==n.version)return null;const o=n.params;if("object"!=typeof o||null===o)return null;if(!Array.isArray(o.pages)||0===o.pages.length)return null;const r=function(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:je(t.background)??je(e.background)??s,accent:je(t.accent)??je(e.accent)??a,text:je(t.text)??l,textSecondary:je(t.textSecondary)??c,textInverse:je(t.textInverse)??u}}(o),i=function(e,t){const n=e.dark;if("object"!=typeof n||null===n)return;const o=n,r="object"==typeof o.colors&&null!==o.colors?o.colors:{},i=ge(t);return{enabled:!0===o.enabled,colors:{background:je(r.background)??i.background,accent:je(r.accent)??i.accent,text:je(r.text)??i.text,textSecondary:je(r.textSecondary)??i.textSecondary,textInverse:je(r.textInverse)??i.textInverse}}}(o,r);return{version:2,params:{...o,colors:r,...i?{dark:i}:{}}}}const Le=["cover","contain"];function He(e){if("object"!=typeof e||null===e)return;const t=e,n=Ae("string"==typeof t.src?t.src:void 0);return n?{src:n,...!0===t.controls?{controls:!0}:{},...!1===t.loop?{loop:!1}:{}}:void 0}function ze(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!n.key)continue;if("string"!=typeof n.src)continue;const e=He(n.video);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,...e?{video:e}:{},..."string"==typeof n.mediaId&&n.mediaId?{mediaId:n.mediaId}:{},...Le.includes(n.fit)?{fit:n.fit}:{},..."number"==typeof n.blur&&Number.isFinite(n.blur)&&n.blur>0?{blur:Math.min(n.blur,100)}:{},..."number"==typeof n.dim&&Number.isFinite(n.dim)&&n.dim>0?{dim:Math.min(n.dim,1)}:{}})}return t}const De=["px","%","em","rem","fr"];function Ue(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function We(e){if("object"!=typeof e||null===e)return;const t=e;if("text"===t.kind)return{kind:"text"};if("length"===t.kind||"percent"===t.kind){const e=Ue(t.min),n=Ue(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>De.includes(e)):[],r="length"===t.kind?function(e){if("object"!=typeof e||null===e)return;const t={};for(const n of De){const o=e[n];if("object"!=typeof o||null===o)continue;const r=Ue(o.min),i=Ue(o.max);void 0===r&&void 0===i||(t[n]={...void 0!==r?{min:r}:{},...void 0!==i?{max:i}:{}})}return Object.keys(t).length>0?t:void 0}(t.ranges):void 0;return{kind:t.kind,...void 0!==e?{min:e}:{},...void 0!==n?{max:n}:{},...o.length>0?{units:o}:{},...r?{ranges:r}:{}}}if("select"===t.kind&&Array.isArray(t.options)){const e=[];for(const n of t.options){if(e.length>=20)break;"object"==typeof n&&null!==n&&("string"!=typeof n.value||n.value.length>64||e.push({value:n.value,label:"string"==typeof n.label?n.label:n.value}))}if(e.length>0)return{kind:"select",options:e}}}function qe(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!G.test(n.key))continue;if("string"!=typeof n.value||n.value.length>64||n.value.includes("$"))continue;if(t.some(e=>e.key===n.key))continue;const e=We(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function Be(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}const Ve=["email","firstName","lastName","phone","custom"],Ke=["primary","secondary"];function Ze(e){const t=[];if(Array.isArray(e))for(const n of e){if(t.length>=10)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&Ve.includes(n.kind)&&(t.some(e=>e.key===n.key)||t.push({key:n.key,kind:n.kind,label:"string"==typeof n.label?n.label:"",placeholder:"string"==typeof n.placeholder?n.placeholder:"",required:"email"===n.kind||!0===n.required,..."custom"===n.kind&&"string"==typeof n.tag&&n.tag?{tag:n.tag}:{}})))}if(!t.some(e=>"email"===e.kind)){let e="field-email";for(;t.some(t=>t.key===e);)e=`${e}-1`;t.unshift({key:e,kind:"email",label:"Email",placeholder:"",required:!0})}return t.slice(0,10)}const Je=["checkbox","chips"],Ye=["nps","stars","thumbs"],Ge=["instant","button"],Qe=["keep","hide-popup","page"],Xe=/^[a-z]{2}$/i,et=/^#[0-9a-fA-F]{6}$/;function tt(e,t=120){return"string"==typeof e?e.trim().slice(0,t):""}function nt(e,t,n=120){return tt(e,n)||t}function ot(e){const t=tt(e,8);return Xe.test(t)?t.toLowerCase():""}function rt(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=12)break;if("object"!=typeof n||null===n)continue;const e=tt(n.value);if(!e)continue;if(t.some(t=>t.value===e))continue;const o=tt(n.tagValue);t.push({value:e,label:nt(n.label,e),...o?{tagValue:o}:{}})}return t}function it(e,t){const n=e=>{const n=Ue(e);return void 0===n||n<=0?0:Math.min(Math.floor(n),t)},o=n(e.min),r=n(e.max);return{min:o,max:r>0?Math.max(o,r):0}}function st(e){const t=[];for(const n of e){if(t.length>=50)break;if("object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key))if("text"!==n.type)if("button"!==n.type){if("timer"===n.type){const e=tt(n.timezone,64),o=Ce(e)?e:"",r=tt(n.endTime,32);if(null===$e(r,o))continue;const i=tt(n.expirePage),s=Qe.includes(n.onExpire)?n.onExpire:"keep",a="page"!==s||i?s:"keep";t.push({type:"timer",key:n.key,endTime:r,timezone:o,language:ot(n.language),showLabels:!1!==n.showLabels,onExpire:a,..."page"===a?{expirePage:i}:{}});continue}if("choice"===n.type){const e=rt(n.options),{min:o,max:r}=it(n,e.length);t.push({type:"choice",key:n.key,control:Je.includes(n.control)?n.control:"checkbox",tagName:tt(n.tagName),options:e,min:o,max:r,submitLabel:nt(n.submitLabel,w),submitVariant:Ke.includes(n.submitVariant)?n.submitVariant:"primary",successMessage:nt(n.successMessage,S,500)});continue}if("rating"===n.type){const e="object"==typeof n.labels&&null!==n.labels?n.labels:{};t.push({type:"rating",key:n.key,scale:Ye.includes(n.scale)?n.scale:"stars",labels:{low:tt(e.low),high:tt(e.high)},submitMode:Ge.includes(n.submitMode)?n.submitMode:"instant",submitLabel:nt(n.submitLabel,x),eventName:tt(n.eventName),successMessage:nt(n.successMessage,C,500)});continue}if("glyph"!==n.type)"email-subscription-form"===n.type&&t.push({type:"email-subscription-form",key:n.key,formCode:"string"==typeof n.formCode?n.formCode:"",fields:Ze(n.fields),submitLabel:"string"==typeof n.submitLabel&&n.submitLabel?n.submitLabel:v,submitVariant:Ke.includes(n.submitVariant)?n.submitVariant:"primary",..."object"==typeof n.privacy&&null!==n.privacy&&"string"==typeof n.privacy.checkboxLabel?{privacy:{checkboxLabel:n.privacy.checkboxLabel,url:"string"==typeof n.privacy.url?n.privacy.url:"",linkLabel:"string"==typeof n.privacy.linkLabel?n.privacy.linkLabel:""}}:{},successMessage:"string"==typeof n.successMessage&&n.successMessage?n.successMessage:b,confirmEmailMessage:"string"==typeof n.confirmEmailMessage&&n.confirmEmailMessage?n.confirmEmailMessage:k});else{if(!$.includes(n.name))continue;t.push({type:"glyph",key:n.key,name:n.name,size:R.includes(n.size)?n.size:R[0],color:"string"==typeof n.color&&et.test(n.color)?n.color:""})}}else"object"==typeof n.action&&null!==n.action&&"string"==typeof n.action.type&&t.push(n);else"string"==typeof n.html&&t.push(n)}return t}function at(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&Array.isArray(n.slots)&&t.push({key:n.key,label:"string"==typeof n.label?n.label:"",slots:st(n.slots)}))}return t}function lt(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function ct(e,t,n){if(null===e)return;let o;return o="stretch"===e?"stretch":lt(e)??("stretch"===t?"stretch":lt(t)),"width"===n&&"stretch"===o?void 0:o}function ut(e){const t=[];for(const n of e.pages){const o=qe(n.values),r=Y(ee(n.layout,Be(o)));if(!r)continue;const i=ct(n.width,e.width,"width"),s=ct(n.height,e.height,"height");t.push({key:n.key,layout:r,images:ze(n.images),contents:at(n.contents),...void 0!==i?{width:i}:{},...void 0!==s?{height:s}:{}})}return t}function dt(e){return`calc(100% - ${2*e.offset}px)`}const pt="pushwoosh-web-popups",ft="[WebPopups]",_t="keyValue",ht="messages",mt="inboxMessages";function yt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const gt=[yt(_t,function(e){e.createObjectStore(_t,{keyPath:"key"})}),yt("log",function(e){const t=e.createObjectStore("log",{keyPath:"id",autoIncrement:!0});t.createIndex("environment","environment",{unique:!1}),t.createIndex("date","date",{unique:!1}),t.createIndex("type","type",{unique:!1})}),yt(ht,function(e){e.createObjectStore(ht,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),yt(mt,function(e){const t="status",n=e.createObjectStore(mt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class vt{get all(){return gt}}class bt{constructor(e,t=new vt){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function kt(e,t){console.info("onversionchange",t),e.close()}let wt;function St(e){return(wt||(wt=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=kt.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=kt.bind(null,n,t),new bt(n).applyMigrations()}})),wt).then(t=>new Promise((n,o)=>e(t,n,o)))}class xt{_add(e){return St((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);r.onsuccess=()=>{n(e)},r.onerror=()=>{o(r.error)}}).then(e=>this.getAll().then(t=>{if(Array.isArray(t)){const n=t.map(e=>e.id).sort((e,t)=>e==t?0:e<t?1:-1);if(n.length>this.maxItems)return Promise.all(n.slice(this.maxItems).map(e=>this.delete(e))).then(()=>e)}return e}))}delete(e){return St((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);r.onsuccess=()=>{n(r.result)},r.onerror=()=>{o(r.error)}})}getAll(){return St((e,t,n)=>{const o=[],r=e.transaction(this.name).objectStore(this.name).openCursor();r.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},r.onerror=()=>{n(r.error)}})}}Ct=_t;var Ct;const Et=new class extends xt{constructor(){super(...arguments),this.name="log",this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(e,t,n){const o={type:e,environment:this.environment,message:`${t}`,date:new Date};return t instanceof Error&&(o.stack=t.stack),n&&(o.additional=n),this._add(o)}},Mt=(new class extends xt{constructor(){super(...arguments),this.name=ht,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let Pt=3;const $t={setLevel(e){Mt[e]||(e="error"),Pt=Mt[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),Et.add(e,t,n)}};function Rt(e){return async({slotKey:t,tagName:n,values:o})=>{try{await e.api.setTags({[n]:{operation:"append",value:o}})}catch(e){throw $t.error(e,`Failed to write web popup choice "${t}" to tag "${n}"`),e}}}function At(e){return async({slotKey:t,eventName:n,score:o,scale:r})=>{try{await e.api.postEvent(n,{score:o,scale:r,slotKey:t})}catch(e){throw $t.error(e,`Failed to post web popup rating "${t}" as event "${n}"`),e}}}Object.keys(Mt).forEach(e=>{const t=Mt[e];$t[e]=(...n)=>{t<=Pt&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});var It,Ft,Nt,Tt,jt,Ot,Lt,Ht,zt,Dt,Ut,Wt,qt,Bt,Vt,Kt={},Zt=[],Jt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Yt=Array.isArray;function Gt(e,t){for(var n in t)e[n]=t[n];return e}function Qt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Xt(e,t,n){var o,r,i,s={};for(i in t)"key"==i?o=t[i]:"ref"==i?r=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?It.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return en(e,s,o,r,null)}function en(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Nt,__i:-1,__u:0};return null==r&&null!=Ft.vnode&&Ft.vnode(i),i}function tn(e){return e.children}function nn(e,t){this.props=e,this.context=t}function on(e,t){if(null==t)return e.__?on(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?on(e):null}function rn(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=Gt({},t);i.__v=t.__v+1,Ft.vnode&&Ft.vnode(i),yn(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??on(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,vn(o,i,r),t.__e=t.__=null,i.__e!=n&&sn(i)}}function sn(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),sn(e)}function an(e){(!e.__d&&(e.__d=!0)&&Tt.push(e)&&!ln.__r++||jt!=Ft.debounceRendering)&&((jt=Ft.debounceRendering)||Ot)(ln)}function ln(){try{for(var e,t=1;Tt.length;)Tt.length>t&&Tt.sort(Lt),e=Tt.shift(),t=Tt.length,rn(e)}finally{Tt.length=ln.__r=0}}function cn(e,t,n,o,r,i,s,a,l,c,u){var d,p,f,_,h,m,y=o&&o.__k||Zt,g=t.length;for(l=un(n,t,y,l,g),d=0;d<g;d++)null!=(f=n.__k[d])&&(p=-1!=f.__i&&y[f.__i]||Kt,f.__i=d,m=yn(e,f,p,r,i,s,a,l,c,u),_=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&wn(p.ref,null,f),u.push(f.ref,f.__c||_,f)),null==h&&null!=_&&(h=_),4&f.__u?(l=dn(f,l,e),p.__e&&(p.__e=null)):"function"==typeof f.type&&void 0!==m?l=m:_&&(l=_.nextSibling),f.__u&=-7);return n.__e=h,l}function un(e,t,n,o,r){var i,s,a,l,c,u=n.length,d=u,p=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.__k[i]=en(null,s,null,null,null):Yt(s)?s=e.__k[i]=en(tn,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?s=e.__k[i]=en(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,l=i+p,s.__=e,s.__b=e.__b+1,a=null,-1!=(c=s.__i=fn(s,n,l,d))&&(d--,(a=n[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(r>u?p--:r<u&&p++),"function"!=typeof s.type&&(s.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<u;i++)null!=(a=n[i])&&!(2&a.__u)&&(a.__e==o&&(o=on(a)),Sn(a,a));return o}function dn(e,t,n){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=dn(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=on(e)),t=n.insertBefore(e.__e,t||null));do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function pn(e,t){return t=t||[],null==e||"boolean"==typeof e||(Yt(e)?e.some(function(e){pn(e,t)}):t.push(e)),t}function fn(e,t,n,o){var r,i,s,a=e.key,l=e.type,c=t[n],u=null!=c&&!(2&c.__u);if(null===c&&null==a||u&&a==c.key&&l==c.type)return n;if(o>(u?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(c=t[s=r>=0?r--:i++])&&!(2&c.__u)&&a==c.key&&l==c.type)return s;return-1}function _n(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||Jt.test(t)?n:n+"px"}function hn(e,t,n,o,r){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||_n(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||_n(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(Ut,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[Dt]=o[Dt]:(n[Dt]=Wt,e.addEventListener(t,i?Bt:qt,i)):e.removeEventListener(t,i?Bt:qt,i);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=n??"";break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function mn(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[zt])t[zt]=Wt++;else if(t[zt]<n[Dt])return;return n(Ft.event?Ft.event(t):t)}}}function yn(e,t,n,o,r,i,s,a,l,c){var u,d,p,f,_,h,m,y,g,v,b,k,w,S,x,C,E=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),i=[a=t.__e=n.__e]),(u=Ft.__b)&&u(t);e:if("function"==typeof E){d=s.length;try{if(g=t.props,v=E.prototype&&E.prototype.render,b=(u=E.contextType)&&o[u.__c],k=u?b?b.props.value:u.__:o,n.__c?y=(p=t.__c=n.__c).__=p.__E:(v?t.__c=p=new E(g,k):(t.__c=p=new nn(g,k),p.constructor=E,p.render=xn),b&&b.sub(p),p.state||(p.state={}),p.__n=o,f=p.__d=!0,p.__h=[],p._sb=[]),v&&null==p.__s&&(p.__s=p.state),v&&null!=E.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=Gt({},p.__s)),Gt(p.__s,E.getDerivedStateFromProps(g,p.__s))),_=p.props,h=p.state,p.__v=t,f)v&&null==E.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),v&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(v&&null==E.getDerivedStateFromProps&&g!==_&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(g,k),t.__v==n.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(g,p.__s,k)){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),Zt.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),a=on(n);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(g,p.__s,k),v&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(_,h,m)})}if(p.context=k,p.props=g,p.__P=e,p.__e=!1,w=Ft.__r,S=0,v)p.state=p.__s,p.__d=!1,w&&w(t),u=p.render(p.props,p.state,p.context),Zt.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,w&&w(t),u=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++S<25);p.state=p.__s,null!=p.getChildContext&&(o=Gt(Gt({},o),p.getChildContext())),v&&!f&&null!=p.getSnapshotBeforeUpdate&&(m=p.getSnapshotBeforeUpdate(_,h)),x=null!=u&&u.type===tn&&null==u.key?bn(u.props.children):u,a=cn(e,Yt(x)?x:[x],t,n,o,r,i,s,a,l,c),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),y&&(p.__E=p.__=null)}catch(e){if(s.length=d,t.__v=null,l||null!=i){if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=i&&(i[i.indexOf(a)]=null),t.__e=a}else if(null!=i)for(C=i.length;C--;)Qt(i[C])}else t.__e=n.__e;null==t.__k&&(t.__k=n.__k||[]),e.then||gn(t),Ft.__e(e,t,n)}}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=kn(n.__e,t,n,o,r,i,s,l,c);return(u=Ft.diffed)&&u(t),128&t.__u?void 0:a}function gn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(gn))}function vn(e,t,n){for(var o=0;o<n.length;o++)wn(n[o],n[++o],n[++o]);Ft.__c&&Ft.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Ft.__e(e,t.__v)}})}function bn(e){return"object"!=typeof e||null==e||e.__b>0?e:Yt(e)?e.map(bn):void 0!==e.constructor?null:Gt({},e)}function kn(e,t,n,o,r,i,s,a,l){var c,u,d,p,f,_,h,m=n.props||Kt,y=t.props,g=t.type;if("svg"==g?r="http://www.w3.org/2000/svg":"math"==g?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=i)for(c=0;c<i.length;c++)if((f=i[c])&&"setAttribute"in f==!!g&&(g?f.localName==g:3==f.nodeType)){e=f,i[c]=null;break}if(null==e){if(null==g)return document.createTextNode(y);e=document.createElementNS(r,g,y.is&&y),a&&(Ft.__m&&Ft.__m(t,i),a=!1),i=null}if(null==g)m===y||a&&e.data==y||(e.data=y);else{if(i="textarea"==g&&null!=y.defaultValue?null:i&&It.call(e.childNodes),!a&&null!=i)for(m={},c=0;c<e.attributes.length;c++)m[(f=e.attributes[c]).name]=f.value;for(c in m)f=m[c],"dangerouslySetInnerHTML"==c?d=f:"children"==c||c in y||"value"==c&&"defaultValue"in y||"checked"==c&&"defaultChecked"in y||hn(e,c,null,f,r);for(c in y)f=y[c],"children"==c?p=f:"dangerouslySetInnerHTML"==c?u=f:"value"==c?_=f:"checked"==c?h=f:a&&"function"!=typeof f||m[c]===f||hn(e,c,f,m[c],r);if(u)a||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),cn("template"==t.type?e.content:e,Yt(p)?p:[p],t,n,o,"foreignObject"==g?"http://www.w3.org/1999/xhtml":r,i,s,i?i[0]:n.__k&&on(n,0),a,l),null!=i)for(c=i.length;c--;)Qt(i[c]);a&&"textarea"!=g||(c="value","progress"==g&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[c]||"progress"==g&&!_||"option"==g&&_!=m[c])&&hn(e,c,_,m[c],r),c="checked",null!=h&&h!=e[c]&&hn(e,c,h,m[c],r))}return e}function wn(e,t,n){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){Ft.__e(e,n)}}function Sn(e,t,n){var o,r;if(Ft.unmount&&Ft.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||wn(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){Ft.__e(e,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&Sn(o[r],t,n||"function"!=typeof e.type);n||Qt(e.__e),e.__c=e.__=e.__e=void 0}function xn(e,t,n){return this.constructor(e,n)}function Cn(e,t,n){var o,r,i,s;t==document&&(t=document.documentElement),Ft.__&&Ft.__(e,t),r=(o="function"==typeof n)?null:n&&n.__k||t.__k,i=[],s=[],yn(t,e=(!o&&n||t).__k=Xt(tn,null,[e]),r||Kt,Kt,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?It.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,s),vn(i,e,s),e.props.children=null}function En(e,t){Cn(e,t,En)}function Mn(e,t,n){var o,r,i,s,a=Gt({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==i?o=t[i]:"ref"==i?r=t[i]:a[i]=void 0===t[i]&&null!=s?s[i]:t[i];return arguments.length>2&&(a.children=arguments.length>3?It.call(arguments,2):n),en(e.type,a,o||e.key,r||e.ref,null)}It=Zt.slice,Ft={__e:function(e,t,n,o){for(var r,i,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},Nt=0,nn.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Gt({},this.state),"function"==typeof e&&(e=e(Gt({},n),this.props)),e&&Gt(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),an(this))},nn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),an(this))},nn.prototype.render=tn,Tt=[],Ot="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Lt=function(e,t){return e.__v.__b-t.__v.__b},ln.__r=0,Ht=Math.random().toString(8),zt="__d"+Ht,Dt="__a"+Ht,Ut=/(PointerCapture)$|Capture$/i,Wt=0,qt=mn(!1),Bt=mn(!0),Vt=0;var Pn=0;Array.isArray;function $n(e,t,n,o,r,i){t||(t={});var s,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Pn,__i:-1,__u:0,__source:r,__self:i};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return Ft.vnode&&Ft.vnode(c),c}var Rn,An,In,Fn,Nn=0,Tn=[],jn=Ft,On=jn.__b,Ln=jn.__r,Hn=jn.diffed,zn=jn.__c,Dn=jn.unmount,Un=jn.__;function Wn(e,t){jn.__h&&jn.__h(An,e,Nn||t),Nn=0;var n=An.__H||(An.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function qn(e){return Nn=1,Bn(ao,e)}function Bn(e,t,n){var o=Wn(Rn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):ao(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=An,!An.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,s=o.__c.props!==e;if(o.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),i){var a=i.call(this,e,t,n);return r?a||s:a}return!r||s};An.__f=!0;var i=An.shouldComponentUpdate,s=An.componentWillUpdate;An.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}s&&s.call(this,e,t,n)},An.shouldComponentUpdate=r}return o.__N||o.__}function Vn(e,t){var n=Wn(Rn++,3);!jn.__s&&so(n.__H,t)&&(n.__=e,n.u=t,An.__H.__h.push(n))}function Kn(e,t){var n=Wn(Rn++,4);!jn.__s&&so(n.__H,t)&&(n.__=e,n.u=t,An.__h.push(n))}function Zn(e){return Nn=5,Yn(function(){return{current:e}},[])}function Jn(e,t,n){Nn=6,Kn(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}function Yn(e,t){var n=Wn(Rn++,7);return so(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Gn(e,t){return Nn=8,Yn(function(){return e},t)}function Qn(e){var t=An.context[e.__c],n=Wn(Rn++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(An)),t.props.value):e.__}function Xn(e,t){jn.useDebugValue&&jn.useDebugValue(t?t(e):e)}function eo(){var e=Wn(Rn++,11);if(!e.__){for(var t=An.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function to(){for(var e;e=Tn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ro),t.__h.some(io),t.__h=[]}catch(n){t.__h=[],jn.__e(n,e.__v)}}}jn.__b=function(e){An=null,On&&On(e)},jn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Un&&Un(e,t)},jn.__r=function(e){Ln&&Ln(e),Rn=0;var t=(An=e.__c).__H;t&&(In===An?(t.__h=[],An.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(ro),t.__h.some(io),t.__h=[],Rn=0)),In=An},jn.diffed=function(e){Hn&&Hn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Tn.push(t)&&Fn===jn.requestAnimationFrame||((Fn=jn.requestAnimationFrame)||oo)(to)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),In=An=null},jn.__c=function(e,t){t.some(function(e){try{e.__h.some(ro),e.__h=e.__h.filter(function(e){return!e.__||io(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],jn.__e(n,e.__v)}}),zn&&zn(e,t)},jn.unmount=function(e){Dn&&Dn(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{ro(e)}catch(e){t=e}}),n.__H=void 0,t&&jn.__e(t,n.__v))};var no="function"==typeof requestAnimationFrame;function oo(e){var t,n=function(){clearTimeout(o),no&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);no&&(t=requestAnimationFrame(n))}function ro(e){var t=An,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),An=t}function io(e){var t=An;e.__c=e.__(),An=t}function so(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ao(e,t){return"function"==typeof t?t(e):t}function lo(e,t){for(var n in t)e[n]=t[n];return e}function co(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function uo(e,t){var n=t(),o=qn({t:{__:n,u:t}}),r=o[0].t,i=o[1];return Kn(function(){r.__=n,r.u=t,po(r)&&i({t:r})},[e,n,t]),Vn(function(){return po(r)&&i({t:r}),e(function(){po(r)&&i({t:r})})},[e]),n}function po(e){try{return!((t=e.__)===(n=e.u())&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}var t,n}function fo(e){e()}function _o(e){return e}function ho(){return[!1,fo]}var mo=Kn;function yo(e,t){this.props=e,this.context=t}(yo.prototype=new nn).isPureReactComponent=!0,yo.prototype.shouldComponentUpdate=function(e,t){return co(this.props,e)||co(this.state,t)};var go=Ft.__b;Ft.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),go&&go(e)};var vo="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var bo=function(e,t){return null==e?null:pn(pn(e).map(t))},ko={map:bo,forEach:bo,count:function(e){return e?pn(e).length:0},only:function(e){var t=pn(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:pn},wo=Ft.__e;Ft.__e=function(e,t,n,o){if(e.then)for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t);wo(e,t,n,o)};var So=Ft.unmount;function xo(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=lo({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return xo(e,t,n)})),e}function Co(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Co(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Eo(){this.__u=0,this.o=null,this.__b=null}function Mo(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Po(){this.i=null,this.l=null}Ft.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),So&&So(e)},(Eo.prototype=new nn).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=Mo(o.__v),i=!1,s=function(){i||o.__z||(i=!0,n.__R=null,r?r(l):l())};n.__R=s;var a=n.__P;n.__P=null;var l=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=Co(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=a,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},Eo.prototype.componentWillUnmount=function(){this.o=[]},Eo.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=xo(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Xt(tn,null,e.fallback);return r&&(r.__u&=-33),[Xt(tn,null,t.__a?null:e.children),r]};var $o=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function Ro(e){return this.getChildContext=function(){return e.context},e.children}function Ao(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){Cn(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}Cn(Xt(Ro,{context:t.context},e.__v),t.v)}(Po.prototype=new nn).__a=function(e){var t=this,n=Mo(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),$o(t,e,o)):r()};n?n(i):i()}},Po.prototype.render=function(e){this.i=null,this.l=new Map;var t=pn(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Po.prototype.componentDidUpdate=Po.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){$o(e,n,t)})};var Io="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Fo=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,No=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,To=/[A-Z0-9]/g,jo="undefined"!=typeof document,Oo=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};nn.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(nn.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Lo=Ft.event;Ft.event=function(e){return Lo&&(e=Lo(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Ho,zo={configurable:!0,get:function(){return this.class}},Do=Ft.vnode;Ft.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1==n.indexOf("-");for(var i in t){var s=t[i];if(!("value"===i&&"defaultValue"in t&&null==s||jo&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var a=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===s?s="":"translate"===a&&"no"===s?s=!1:"o"===a[0]&&"n"===a[1]?"ondoubleclick"===a?i="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||Oo(t.type)?"onfocus"===a?i="onfocusin":"onblur"===a?i="onfocusout":No.test(i)&&(i=a):a=i="oninput":r&&Fo.test(i)?i=i.replace(To,"-$&").toLowerCase():null===s&&(s=void 0),"oninput"===a&&o[i=a]&&(i="oninputCapture"),o[i]=s}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=pn(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=pn(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",zo)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=Io,Do&&Do(e)};var Uo=Ft.__r;Ft.__r=function(e){Uo&&Uo(e),Ho=e.__c};var Wo=Ft.diffed;Ft.diffed=function(e){Wo&&Wo(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),Ho=null};var qo={ReactCurrentDispatcher:{current:{readContext:function(e){return Ho.__n[e.__c].props.value},useCallback:Gn,useContext:Qn,useDebugValue:Xn,useDeferredValue:_o,useEffect:Vn,useId:eo,useImperativeHandle:Jn,useInsertionEffect:mo,useLayoutEffect:Kn,useMemo:Yn,useReducer:Bn,useRef:Zn,useState:qn,useSyncExternalStore:uo,useTransition:ho}}};function Bo(e){return!!e&&e.$$typeof===Io}var Vo={useState:qn,useId:eo,useReducer:Bn,useEffect:Vn,useLayoutEffect:Kn,useInsertionEffect:mo,useTransition:ho,useDeferredValue:_o,useSyncExternalStore:uo,startTransition:fo,useRef:Zn,useImperativeHandle:Jn,useMemo:Yn,useCallback:Gn,useContext:Qn,useDebugValue:Xn,version:"18.3.1",Children:ko,render:function(e,t,n){return null==t.__k&&(t.textContent=""),Cn(e,t),"function"==typeof n&&n(),e?e.__c:null},hydrate:function(e,t,n){return En(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&(Cn(null,e),!0)},createPortal:function(e,t){var n=Xt(Ao,{__v:e,h:t});return n.containerInfo=t,n},createElement:Xt,createContext:function(e){function t(e){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,an(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+Vt++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createFactory:function(e){return Xt.bind(null,e)},cloneElement:function(e){return Bo(e)?Mn.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:tn,isValidElement:Bo,isElement:Bo,isFragment:function(e){return Bo(e)&&e.type===tn},isMemo:function(e){return!!e&&"string"==typeof e.displayName&&0==e.displayName.indexOf("Memo(")},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:nn,PureComponent:yo,memo:function(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:co(this.props,e)}function o(t){return this.shouldComponentUpdate=n,Xt(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o},forwardRef:function(e){function t(t){var n=lo({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=vo,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,t){var n,o=Ft.debounceRendering;Ft.debounceRendering=function(e){n=e};try{var r=e(t);return n&&n(),r}finally{Ft.debounceRendering=o}},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:tn,Suspense:Eo,SuspenseList:Po,lazy:function(e){var t,n,o,r=null;function i(i){if(t||(t=e()).then(function(e){e&&(r=e.default||e),o=!0},function(e){n=e,o=!0}),n)throw n;if(!o)throw t;return r?Xt(r,i):null}return i.displayName="Lazy",i.__f=!0,i},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:qo};const Ko={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function Zo({slot:e,align:t,inverse:n,colors:o}){const r={...d[e.variant],textAlign:e.align??t},i=f(e.variant,o,n);return i&&(r.color=i),Vo.createElement("div",{style:r,dangerouslySetInnerHTML:{__html:Te(e.html)}})}function Jo({slot:e,colors:t,onRequestClose:n,onPageChange:o}){const r=y(e.variant,t),i={};if("close"===e.action.type)return Vo.createElement("div",{style:i},Vo.createElement("button",{type:"button",style:r,onClick:n},e.label));if("page"===e.action.type){const t=e.action.page;return Vo.createElement("div",{style:i},Vo.createElement("button",{type:"button",style:r,onClick:()=>o(t)},e.label))}const s=Ae(e.action.url);return s?Vo.createElement("div",{style:i},Vo.createElement("a",{href:s,...Ie(e.action.target),style:r},e.label)):Vo.createElement("div",{style:i},Vo.createElement("button",{type:"button",style:r},e.label))}function Yo({message:e,align:t,inverse:n,colors:o}){const r=f("body",o,n);return Vo.createElement("div",{style:{...d.body,padding:"4px 0",textAlign:t,...r?{color:r}:{}}},e)}const Go=/^\S+@\S+\.\S+$/,Qo={email:"email",phone:"tel"},Xo={email:"email",firstName:"given-name",lastName:"family-name",phone:"tel"},er="__privacy";function tr({slot:e,align:t,inverse:n,colors:o,onSubmitForm:r}){const[i,s]=qn({}),[a,l]=qn(!1),[c,u]=qn(null),[p,_]=qn({}),[h,v]=qn("idle"),b=f("caption",o,n),k={...d.caption,...b?{color:b}:{}},w={fontSize:12,lineHeight:1.4,color:o.error,paddingTop:2};if("success"===h||"confirm"===h)return Vo.createElement(Yo,{message:"confirm"===h?e.confirmEmailMessage:e.successMessage,align:t,inverse:n,colors:o});const S="submitting"===h,x=e.privacy?Ae(e.privacy.url):void 0,C={...y(e.submitVariant,o),...S?{opacity:.6,cursor:"default"}:{}};return Vo.createElement("form",{noValidate:!0,style:{margin:0,textAlign:"left"},onSubmit:t=>{t.preventDefault(),(()=>{if(!r||!e.formCode||"submitting"===h)return;const t={};for(const n of e.fields){const e=(i[n.key]??"").trim();n.required&&!e?t[n.key]="Required":"email"===n.kind&&e&&!Go.test(e)&&(t[n.key]="Enter a valid email")}if(e.privacy&&!a&&(t[er]="Please accept the privacy policy"),_(t),Object.keys(t).length>0)return;const n={email:"",policyAccepted:!e.privacy||a},o={};for(const t of e.fields){const e=(i[t.key]??"").trim();e&&("email"===t.kind?n.email=n.email||e:"firstName"===t.kind?n.firstName=e:"lastName"===t.kind?n.lastName=e:"phone"===t.kind?n.phone=e:o[t.tag||t.key]=e)}Object.keys(o).length>0&&(n.customFields=o),v("submitting"),Promise.resolve().then(()=>r(e.formCode,n)).then(e=>v("confirm-email"===e?"confirm":"success"),()=>v("error"))})()}},e.fields.map(e=>{const t=p[e.key];let n;return t?n=o.error:c===e.key&&(n=o.accent),Vo.createElement("div",{key:e.key,style:{padding:"4px 0"}},e.label&&Vo.createElement("div",{style:{...k,paddingBottom:4}},e.label),Vo.createElement("input",{type:Qo[e.kind]??"text",autoComplete:Xo[e.kind],placeholder:e.placeholder||void 0,value:i[e.key]??"",disabled:S,style:g(o,n),onFocus:()=>u(e.key),onBlur:()=>u(t=>t===e.key?null:t),onChange:t=>{return n=e.key,o=t.currentTarget.value,s(e=>({...e,[n]:o})),void _(e=>e[n]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==n)):e);var n,o}}),t&&Vo.createElement("div",{style:w},t))}),e.privacy&&Vo.createElement("div",{style:{padding:"4px 0"}},Vo.createElement("label",{style:{...k,display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"}},Vo.createElement("input",{type:"checkbox",checked:a,disabled:S,style:{margin:"2px 0 0",flexShrink:0},onChange:e=>{l(e.currentTarget.checked),_(e=>e[er]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==er)):e)}}),Vo.createElement("span",null,e.privacy.checkboxLabel,x&&Vo.createElement(Vo.Fragment,null," ",Vo.createElement("a",{href:x,...Ie(void 0),style:{color:o.accent}},e.privacy.linkLabel||e.privacy.url)))),p[er]&&Vo.createElement("div",{style:w},p[er])),Vo.createElement("div",{style:{padding:m}},Vo.createElement("button",{type:"submit",disabled:S,style:C},e.submitLabel)),"error"===h&&Vo.createElement("div",{style:{...w,textAlign:t}},E))}function nr({value:e,label:t,digitStyle:n,labelStyle:o}){return Vo.createElement("div",{style:{minWidth:44}},Vo.createElement("div",{style:n},String(e).padStart(2,"0")),t?Vo.createElement("div",{style:o},t):null)}function or({slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:s}){const[a,l]=qn(()=>Date.now()),c=function(e,t,n){const o=$e(e,t),r=null===o?0:Math.max(0,o-n),i=Math.floor(r/1e3);return{total:r,days:Math.floor(i/86400),hours:Math.floor(i/3600)%24,minutes:Math.floor(i/60)%60,seconds:i%60}}(e.endTime,e.timezone,a),u=0===c.total;Vn(()=>{if("live"!==r||u)return;const e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[r,u,e.endTime,e.timezone]),Vn(()=>{"live"===r&&u&&("hide-popup"===e.onExpire?i?.():"page"===e.onExpire&&e.expirePage&&s(e.expirePage))},[r,u,e.onExpire,e.expirePage,i,s]);const p=f("h2",o,n),_=f("caption",o,n),h={fontSize:28,fontWeight:700,lineHeight:1.2,fontVariantNumeric:"tabular-nums",...p?{color:p}:{}},m={...d.caption,..._?{color:_}:{}},y=(g=e.language,Re[g]??Re.en);var g;const v=[{value:c.days,label:y.days},{value:c.hours,label:y.hours},{value:c.minutes,label:y.minutes},{value:c.seconds,label:y.seconds}];return Vo.createElement("div",{style:{padding:"4px 0",textAlign:t}},Vo.createElement("div",{style:{display:"inline-flex",gap:12,textAlign:"center"}},v.map(t=>Vo.createElement(nr,{key:t.label||t.value,value:t.value,label:e.showLabels?t.label:"",digitStyle:h,labelStyle:m}))))}function rr({slot:e,align:t,inverse:n,colors:o,onSubmitChoice:r}){const[i,s]=qn([]),[a,l]=qn("idle"),[c,u]=qn("");if("success"===a)return Vo.createElement(Yo,{message:e.successMessage,align:t,inverse:n,colors:o});const p=t=>{u(""),s(n=>n.includes(t)?n.filter(e=>e!==t):e.max>0&&n.length>=e.max?(u(`Pick up to ${e.max}`),n):[...n,t])},_="submitting"===a,h=f("body",o,n),g={...d.body,...h?{color:h}:{}};return Vo.createElement("div",{style:{padding:"4px 0"}},"chips"===e.control?Vo.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"===t?"center":"flex-start"}},e.options.map(e=>{return Vo.createElement("button",{key:e.value,type:"button","aria-pressed":i.includes(e.value),style:(t=i.includes(e.value),{padding:"6px 14px",borderRadius:999,border:`1px solid ${o.accent}`,backgroundColor:t?o.accent:"transparent",color:t?o.onAccent:o.accent,fontFamily:"inherit",fontSize:14,lineHeight:1.4,cursor:"pointer"}),onClick:()=>p(e.value)},e.label);var t})):Vo.createElement("div",{style:{display:"grid",gap:6}},e.options.map(e=>Vo.createElement("label",{key:e.value,style:{...g,display:"flex",alignItems:"center",gap:8,cursor:"pointer"}},Vo.createElement("input",{type:"checkbox",checked:i.includes(e.value),onChange:()=>p(e.value),style:{accentColor:o.accent,width:16,height:16,margin:0}}),e.label))),c?Vo.createElement("div",{style:{...d.caption,color:o.error,paddingTop:4}},c):null,"error"===a?Vo.createElement("div",{style:{...d.caption,color:o.error,paddingTop:4}},E):null,Vo.createElement("div",{style:{padding:m}},Vo.createElement("button",{type:"button",style:{...y(e.submitVariant,o),..._?{opacity:.7}:{}},onClick:()=>{if(!r||!e.tagName||"submitting"===a)return;const t=Math.max(e.min,1);if(i.length<t)return void u(1===t?"Pick at least one":`Pick at least ${t}`);const n=e.options.filter(e=>i.includes(e.value)).map(e=>e.tagValue||e.value);u(""),l("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,tagName:e.tagName,values:n})).then(()=>l("success"),()=>l("error"))}},e.submitLabel)))}function ir({score:e,scale:t,selected:n,colors:o,onPick:r}){const i={display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,border:`1px solid ${o.accent}`,backgroundColor:n?o.accent:"transparent",color:n?o.onAccent:o.accent,fontFamily:"inherit",fontSize:14,lineHeight:1,cursor:"pointer"};if("nps"===t)return Vo.createElement("button",{type:"button","aria-label":`Rate ${e}`,"aria-pressed":n,style:{...i,width:30,height:32,borderRadius:6},onClick:r},e);const s="thumbs"===t;let a=`Rate ${e}`;return s&&(a=1===e?"Thumbs up":"Thumbs down"),Vo.createElement("button",{type:"button","aria-label":a,"aria-pressed":n,style:{...i,width:s?44:34,height:s?40:34,borderRadius:s?8:6},onClick:r},Vo.createElement("svg",{width:s?22:20,height:s?22:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},Vo.createElement("path",{d:s?"M8 21V10l3.5-7A2 2 0 0 1 14 5v5h4.5a2 2 0 0 1 2 2.4l-1.3 6A2 2 0 0 1 17.2 21zM8 10H3.5v11H8":P.star,...s&&0===e?{transform:"rotate(180 12 12)"}:{}})))}function sr({slot:e,align:t,inverse:n,colors:o,onSubmitRating:r}){const[i,s]=qn(null),[a,l]=qn("idle");if("success"===a)return Vo.createElement(Yo,{message:e.successMessage,align:t,inverse:n,colors:o});const c=t=>{r&&e.eventName&&"submitting"!==a&&(l("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,eventName:e.eventName,score:t,scale:e.scale})).then(()=>l("success"),()=>l("error")))},u="nps"===(p=e.scale)?[0,1,2,3,4,5,6,7,8,9,10]:"stars"===p?[1,2,3,4,5]:[0,1];var p;const _=f("caption",o,n),h={...d.caption,..._?{color:_}:{}},g=t=>"stars"===e.scale?null!==i&&t<=i:i===t;return Vo.createElement("div",{style:{padding:"4px 0"}},Vo.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:6,justifyContent:"center"===t?"center":"flex-start"}},u.map(t=>Vo.createElement(ir,{key:t,score:t,scale:e.scale,selected:g(t),colors:o,onPick:()=>(t=>{"submitting"!==a&&(s(t),"instant"===e.submitMode&&c(t))})(t)}))),e.labels.low||e.labels.high?Vo.createElement("div",{style:{display:"flex",justifyContent:"space-between",gap:8,paddingTop:4}},Vo.createElement("span",{style:h},e.labels.low),Vo.createElement("span",{style:h},e.labels.high)):null,"error"===a?Vo.createElement("div",{style:{...d.caption,color:o.error,paddingTop:4}},E):null,"button"===e.submitMode?Vo.createElement("div",{style:{padding:m}},Vo.createElement("button",{type:"button",style:{...y("primary",o),..."submitting"===a?{opacity:.7}:{}},onClick:()=>null===i?void 0:c(i)},e.submitLabel)):null)}function ar({slot:e,align:t,inverse:n,colors:o}){const r=e.color||(n?o.textInverse:o.accent);return Vo.createElement("div",{style:{padding:"4px 0",textAlign:t,lineHeight:0}},Vo.createElement("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"inline-block"}},Vo.createElement("path",{d:P[e.name]})))}function lr({slot:e,align:t,inverse:n,colors:o,mode:r="live",onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}){const u=s??(()=>{});switch(e.type){case"text":return Vo.createElement(Zo,{slot:e,align:t,inverse:n,colors:o});case"button":return Vo.createElement(Jo,{slot:e,colors:o,onRequestClose:i,onPageChange:u});case"email-subscription-form":return Vo.createElement(tr,{slot:e,align:t,inverse:n,colors:o,onSubmitForm:a});case"timer":return Vo.createElement(or,{slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:u});case"choice":return Vo.createElement(rr,{slot:e,align:t,inverse:n,colors:o,onSubmitChoice:l});case"rating":return Vo.createElement(sr,{slot:e,align:t,inverse:n,colors:o,onSubmitRating:c});case"glyph":return Vo.createElement(ar,{slot:e,align:t,inverse:n,colors:o})}}function cr({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}){const u=t.contents.find(t=>t.key===e.props.content);if(!u)return null;if(r?.renderZone)return Vo.createElement("div",{style:{minWidth:0}},r.renderZone(u,e));const d=e.props.align??"left",p="inverse"===e.props.tone;return Vo.createElement("div",{style:{minWidth:0}},u.slots.map((e,t)=>{const r=u.slots[t-1],f=r?(_=h(r),"action"===(m=h(e))?"action"===_?6:16:"text"===m&&"heading"===_?4:8):0;var _,m;return Vo.createElement("div",{key:e.key,style:f?{marginTop:f}:void 0},Vo.createElement(lr,{slot:e,align:d,inverse:p,colors:n,mode:o,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}))}))}function ur(e){return e?.video?Ae(e.video.src):void 0}function dr({image:e,src:t,style:n,mode:o}){return Vo.createElement("video",{src:t,poster:e.src||void 0,style:n,autoPlay:"live"===o,muted:!0,playsInline:!0,preload:"metadata",loop:!1!==e.video?.loop,controls:!0===e.video?.controls})}function pr({node:e,page:t,leaf:n,mode:o}){const r=t.images.find(t=>t.key===e.props.image);if(!r)return null;if(n?.renderImage)return Vo.createElement(Vo.Fragment,null,n.renderImage(r,e));const i=ur(r);if(!r.src&&!i)return null;const s={display:"block",width:"100%",minWidth:0};return r.fit?(s.height="100%",s.objectFit=r.fit):s.height="auto",r.blur&&(s.filter=`blur(${r.blur}px)`),i?Vo.createElement(dr,{image:r,src:i,style:s,mode:o}):Vo.createElement("img",{src:r.src,alt:"",style:s})}function fr({style:e,outer:t,inner:n,layer:o,children:r}){const{backgroundColor:i,...s}=e;return Vo.createElement("div",{style:{display:"grid",minWidth:0,backgroundColor:i,...t}},o,Vo.createElement("div",{style:{...s,...n}},r))}function _r({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}){if("Content"===e.type)return Vo.createElement(cr,{node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c});if("Image"===e.type)return Vo.createElement(pr,{node:e,page:t,leaf:r,mode:o});const u=e.props?.backgroundImage,d=u?t.images.find(e=>e.key===u):void 0,p=d?.blur??0,f=d?.dim??0,_=ur(d),h=ae(e,p>0||_?void 0:d?.src||void 0,f);u&&(h.backgroundColor="#1D2939");const m=e.children.map((e,u)=>Vo.createElement(_r,{key:u,node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}));if(_&&d){const e=ie(f);return Vo.createElement(fr,{style:h,outer:{position:"relative",overflow:"hidden",...d.src?se(d.src):{}},inner:{position:"relative",...e?{backgroundImage:e}:{}},layer:Vo.createElement(dr,{image:d,src:_,mode:o,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",...p>0?{filter:`blur(${p}px)`}:{}}})},m)}return p>0?Vo.createElement(fr,{style:h,outer:d?.src?se(d.src,f):void 0,inner:{backdropFilter:`blur(${p}px)`,WebkitBackdropFilter:`blur(${p}px)`}},m):Vo.createElement("div",{style:h},m)}function hr({page:e,params:t,mode:n="live",colorScheme:o="light",leafRenderers:r,animatePage:i=!1,onRequestClose:s,onPageChange:a,onSubmitForm:l,onSubmitChoice:c,onSubmitRating:u}){const d=ke(t,o),p={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:d.background,colorScheme:d.scheme,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:d.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:t.boxShadow&&"none"!==t.boxShadow?t.boxShadow:void 0,transition:"height 300ms ease"};e.height&&(p.height="stretch"===e.height?"100%":e.height,p.overflowY="auto");const f={...i?{animation:"pw-vpopup-page 300ms ease-out backwards"}:{},..."stretch"===e.height?{display:"grid",minHeight:"100%"}:{}};return Vo.createElement("div",{style:p},Vo.createElement("div",{key:e.key,style:f},Vo.createElement(_r,{node:e.layout,page:e,colors:d,mode:n,leaf:r,onRequestClose:s,onPageChange:a??(()=>{}),onSubmitForm:l,onSubmitChoice:c,onSubmitRating:u})))}function mr({colors:e,onRequestClose:t}){return Vo.createElement("button",{type:"button","aria-label":"Close",onClick:t,style:{position:"absolute",top:10,right:10,width:24,height:24,padding:0,border:"none",borderRadius:"50%",background:me(e.surface,.92),boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:e.chromeIcon,fontSize:13,lineHeight:1,cursor:"pointer"}},"✕")}function yr(e,t,n){const{placement:o}=e,r={position:"fixed",boxSizing:"border-box",maxWidth:dt(o),maxHeight:dt(o),pointerEvents:"auto"};if(t){r.width=t;const e=o.h;"left"===e?r.left=o.offset:"right"===e?r.right=o.offset:r.left="50%"}else r.left=o.offset,r.right=o.offset;"stretch"===n?(r.top=o.offset,r.bottom=o.offset):"top"===o.v?r.top=o.offset:"bottom"===o.v?r.bottom=o.offset:r.top="50%";const i=t&&"center"===o.h?"-50%":"0",s="middle"===o.v&&"stretch"!==n?"-50%":"0";"0"===i&&"0"===s||(r.transform=`translate(${i}, ${s})`);const a=Ko[e.animation];return a&&(r.animation=a),r.transition="width 300ms ease",r}const gr="(prefers-color-scheme: dark)";function vr(e,t){const[n,o]=qn(()=>"auto"===e&&t&&"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(gr).matches);return Vn(()=>{if("auto"!==e||!t||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(gr),r=e=>o(e.matches);return o(n.matches),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e,t]),"auto"!==e?e:n?"dark":"light"}function br({params:e,mode:t="live",colorScheme:n="auto",onRequestClose:o,onSubmitForm:r,onSubmitChoice:i,onSubmitRating:s,leafRenderers:a}){const[l,c]=qn(null);Vn(()=>{ut(e).forEach(e=>e.images.forEach(({src:e})=>{e&&((new Image).src=e)}))},[e]);const u=vr(n,be(e)),d=ut(e);if(0===d.length)return null;const p=d.find(e=>e.key===l)??function(e,t){return t.find(t=>t.key===e.startPage)??t[0]}(e,d),f=null!==l;if("preview"===t)return Vo.createElement("div",{style:{position:"relative",width:p.width??"100%",transition:"width 300ms ease"}},Vo.createElement("style",null,M),Vo.createElement(hr,{page:p,params:e,mode:t,colorScheme:u,leafRenderers:a,animatePage:f,onRequestClose:o,onPageChange:c,onSubmitForm:r,onSubmitChoice:i,onSubmitRating:s}));const _=e.overlay;return Vo.createElement(Vo.Fragment,null,Vo.createElement("style",null,M),_&&Vo.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:_.color,opacity:_.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:o}),Vo.createElement("div",{style:yr(e,p.width,p.height)},Vo.createElement(hr,{page:p,params:e,mode:t,colorScheme:u,leafRenderers:a,animatePage:f,onRequestClose:o,onPageChange:c,onSubmitForm:r,onSubmitChoice:i,onSubmitRating:s}),Vo.createElement(mr,{colors:ke(e,u),onRequestClose:o})))}const kr={SUBMIT_FORM_RESULT_SUBSCRIBED:"subscribed",SUBMIT_FORM_RESULT_CONFIRM_EMAIL:"confirm-email",SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED:"already-subscribed"},wr=(e,t)=>`https://subscription-form.svc-nue.pushwoosh.com/api/v1/forms/code/${encodeURIComponent(e)}${t}`,Sr=async(e,t)=>{try{const n=await fetch(wr(e,"/submit"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,userId:t.email})});if(!n.ok)throw new Error(`Subscription form submit failed: HTTP ${n.status}`);const o=await n.json(),r=kr[o.result??""];if(!r)throw new Error(`Subscription form submit failed: unexpected result "${o.result}"`);return r}catch(t){throw $t.error(t,`Failed to submit subscription form "${e}"`),t}};class xr{constructor(e){this.isRecurringVisitor=!1,this.entries=new Map,this.queue=[],this.visible=null,this.drainTimeoutId=null,this.autoShowEnabled=!0,this.colorScheme="auto",this.isNavigationSubscribed=!1,this.openPopupsCount=0,this.bodyOverflowBeforeLock=null,this.readyPromise=new Promise(e=>{this.readyResolve=e}),this.pw=e,this.submitHandlers={onSubmitChoice:Rt(e),onSubmitRating:At(e)},e.moduleRegistry.webPopups=this}async run(){const{pw:e}=this;try{this.autoShowEnabled=!1!==e.initParams.webPopups?.autoShow,this.colorScheme=e.initParams.webPopups?.colorScheme??"auto",await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const t=await e.api.getPopupForms();$t.debug(`${ft} Received ${t.length} popup(s) from server:`,t.map(e=>e.code)),t.forEach((e,t)=>{this.entries.set(e.code,{popup:e,order:t,state:"idle",content:null,loading:null,passedStrongConditions:!1,timeoutId:null,visitRecorded:!1})}),await Promise.allSettled(Array.from(this.entries.values()).map(async e=>{e.passedStrongConditions=await this.checkStrongCondition(e.popup),e.passedStrongConditions&&await this.ensureContent(e)}));const n=this.loadedCodes();$t.debug(`${ft} ${n.length} popup(s) passed strong conditions and loaded:`,n),this.subscribeToNavigation(),this.renderForCurrentPage(),await e.data.setIsRecurringVisitor(!0)}finally{this.readyResolve(),e.dispatchEvent("web-popups-ready",{})}}async show(e){await this.readyPromise;const t=this.entries.get(e);if(!t)return $t.error(new Error("Unknown web popup code"),`${ft} show("${e}"): no such popup`),!1;if(this.visible?.code===e)return!0;return await this.ensureContent(t)?this.visible?.code===e||!!this.checkNotExpired(t)&&(this.visible&&($t.debug(`${ft} show("${e}") preempting "${this.visible.code}"`),this.visible.close("preempted")),this.detachFromAutoPipeline(t),this.present(t,"api"),!0):($t.error(new Error("Web popup content unavailable"),`${ft} show("${e}"): content unavailable`),!1)}hide(e){return!!this.visible&&((void 0===e||this.visible.code===e)&&(this.visible.close("api"),!0))}hideAll(){const e=this.hide();return this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||(this.detachFromAutoPipeline(e),e.state="done")}),this.cancelScheduledDrain(),e}isVisible(e){return!!this.visible&&(void 0===e||this.visible.code===e)}getVisibleCode(){return this.visible?.code??null}getAvailableCodes(){return Array.from(this.entries.keys())}getState(){const e=[];return this.entries.forEach((t,n)=>{"waiting"===t.state&&e.push(n)}),{visible:this.getVisibleCode(),queued:[...this.queue],waiting:e,available:this.getAvailableCodes()}}ensureContent(e){return e.content?Promise.resolve(e.content):(e.loading||(e.loading=this.loadContent(e.popup).then(t=>(e.content=t,t)).catch(t=>($t.error(t,`${ft} Failed to load web popup "${e.popup.code}"`),null)).finally(()=>{e.content||(e.loading=null)})),e.loading)}async loadContent(e){const t=(e=>{const t=Oe(e);return t?0===ut(t.params).length?null:t.params:null})((await this.pw.api.getPopupFormContent(e.popup_form_content_code)).json);return t||($t.error(new Error("Unsupported popup content format"),`${ft} Web popup "${e.code}" content is not a supported {version, params} popup; skipping`),null)}loadedCodes(){const e=[];return this.entries.forEach((t,n)=>{t.content&&e.push(n)}),e}renderForCurrentPage(){this.releaseUnmatchedPending();const e=[];this.entries.forEach((t,n)=>{this.canAutoDisplay(t)&&(this.armDelay(t),e.push(n))}),$t.debug(`${ft} ${e.length} popup(s) selected for display on "${window.location.pathname}":`,e),this.drain()}canAutoDisplay(e){return this.autoShowEnabled&&"idle"===e.state&&e.passedStrongConditions&&this.isAutoTrigger(e.popup)&&null!==e.content&&this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)}isAutoTrigger(e){const t=e.trigger_type;return!t||"PAGE_LOAD"===t}armDelay(e){const{popup:t}=e;$t.debug(`${ft} Popup "${t.code}" armed for display in ${t.delay}s`),e.state="waiting",this.recordVisit(e),e.timeoutId=window.setTimeout(()=>{e.timeoutId=null,e.state="queued",this.insertIntoQueue(e),$t.debug(`${ft} Popup "${t.code}" delay elapsed; queued at position ${this.queue.indexOf(t.code)+1} of ${this.queue.length}`),this.drain()},1e3*t.delay)}recordVisit(e){e.visitRecorded||(e.visitRecorded=!0,this.pw.api.recordPopupFormEvent(e.popup.code,1).catch(t=>{$t.error(t,`${ft} Failed to record web popup visit event for "${e.popup.code}"`)}))}insertIntoQueue(e){const t=this.queue.findIndex(t=>{const n=this.entries.get(t);return!!n&&(n.popup.delay!==e.popup.delay?n.popup.delay>e.popup.delay:n.order>e.order)});-1!==t?this.queue.splice(t,0,e.popup.code):this.queue.push(e.popup.code)}releaseUnmatchedPending(){this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)||(this.detachFromAutoPipeline(e),e.state="idle",$t.debug(`${ft} Released popup "${e.popup.code}": page no longer matches, or its countdown passed`))})}detachFromAutoPipeline(e){null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null);const t=this.queue.indexOf(e.popup.code);-1!==t&&this.queue.splice(t,1)}drain(){if(this.visible||null!==this.drainTimeoutId)return;const e=this.queue.shift();if(void 0===e)return;const t=this.entries.get(e);if(t&&"queued"===t.state){if(!this.checkSoftCondition(t.popup)||!this.checkNotExpired(t))return t.state="idle",void this.drain();if(!t.content)return t.state="done",void this.drain();$t.debug(`${ft} Display slot free; showing "${e}"`),this.present(t,"auto")}else this.drain()}scheduleDrain(){null===this.drainTimeoutId&&(this.drainTimeoutId=window.setTimeout(()=>{this.drainTimeoutId=null,this.drain()},400))}cancelScheduledDrain(){null!==this.drainTimeoutId&&(window.clearTimeout(this.drainTimeoutId),this.drainTimeoutId=null)}present(e,t){this.cancelScheduledDrain();const{popup:n,content:o}=e;if(!o)return void(e.state="done");const r=document.createElement("div");r.id=`${pt}-${n.code}`,r.style.position="fixed",r.style.inset="0",r.style.zIndex=String(2147483647),r.style.pointerEvents="none",document.body.appendChild(r);const i=r.attachShadow({mode:"open"}),s=document.createElement("div");i.appendChild(s);const a=!!o.overlay;a&&this.lockBodyScroll();let l=!1;const c=t=>{l||(l=!0,a&&this.unlockBodyScroll(),(e=>{Cn(null,e)})(s),r.remove(),this.visible?.code===n.code&&(this.visible=null),e.state="done",this.pw.dispatchEvent("hide-web-popup",{code:n.code,reason:t}),this.scheduleDrain())};this.visible={code:n.code,host:r,modal:a,close:c},e.state="visible",((e,t,n,o,r="auto")=>{Cn($n(br,{params:t,mode:"live",colorScheme:r,onRequestClose:n,onSubmitForm:Sr,onSubmitChoice:o.onSubmitChoice,onSubmitRating:o.onSubmitRating}),e)})(s,o,()=>c("user"),this.submitHandlers,this.colorScheme);const u=function(e){const t=new Set;for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots)"object"==typeof n&&null!==n&&"email-subscription-form"===n.type&&"string"==typeof n.formCode&&n.formCode&&t.add(n.formCode);return[...t]}(o);u.length>0&&this.pw.data.getHwid().then(e=>u.forEach(t=>((e,t)=>{fetch(wr(e,"/view"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,userId:t,hwid:t})}).catch(t=>{$t.error(t,`Failed to record subscription form view for "${e}"`)})})(t,e))).catch(e=>{$t.error(e,`${ft} Failed to record subscription form views for web popup "${n.code}"`)}),$t.debug(`${ft} Popup "${n.code}" shown (trigger: ${t})`),this.recordVisit(e),this.markAsShown(n).catch(e=>{$t.error(e,`${ft} Failed to mark web popup "${n.code}" as shown`)}),this.pw.dispatchEvent("show-web-popup",{code:n.code,trigger:t})}lockBodyScroll(){0===this.openPopupsCount&&(this.bodyOverflowBeforeLock=document.body.style.overflow,document.body.style.overflow="hidden"),this.openPopupsCount+=1}unlockBodyScroll(){this.openPopupsCount=Math.max(0,this.openPopupsCount-1),0===this.openPopupsCount&&null!==this.bodyOverflowBeforeLock&&(document.body.style.overflow=this.bodyOverflowBeforeLock,this.bodyOverflowBeforeLock=null)}subscribeToNavigation(){if(this.isNavigationSubscribed)return;this.isNavigationSubscribed=!0;const e=()=>this.renderForCurrentPage(),t=window.navigation;if(t&&"function"==typeof t.addEventListener)return void t.addEventListener("currententrychange",e);window.addEventListener("popstate",e),window.addEventListener("hashchange",e);let n=window.location.href;window.setInterval(()=>{window.location.href!==n&&(n=window.location.href,e())},500)}async checkStrongCondition(e){return(await Promise.all([this.checkCanBeShownByDeviceTypeCondition(e),this.checkCanBeShownByFrequencyCondition(e),this.checkCanBeShownByVisitorsTypeCondition(e)])).every(e=>e)}checkSoftCondition(e){return this.checkCanBeShownByMatchingPagesCondition(e)}checkNotExpired(e){return!e.content||(!function(e,t){for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots){if("object"!=typeof n||null===n)continue;if("timer"!==n.type||"hide-popup"!==n.onExpire)continue;if("string"!=typeof n.endTime)continue;const e="string"==typeof n.timezone?n.timezone:"",o=$e(n.endTime,e);if(null!==o&&o<=t)return!0}return!1}(e.content,Date.now())||($t.debug(`${ft} Popup "${e.popup.code}" not shown: its countdown has passed`),!1))}checkCanBeShownByDeviceTypeCondition(e){const{device_type:t}=e,n=this.pw.platformChecker.formFactor;return"ALL"===t||t===n}async checkCanBeShownByFrequencyCondition(e){const{frequency:t,code:n}=e;if("ONCE"===t){return!(await this.pw.data.getShownWebPopups()).includes(n)}return"ONCE_PER_SESSION"!==t||null===sessionStorage.getItem(this.getSessionStorageKey(n))}checkCanBeShownByMatchingPagesCondition(e){const{matching_pages:t,matching_page_rules:n,excluded_pages:o}=e,r=window.location.pathname;return n&&n.length>0?n.some(e=>this.matchPageRule(r,e)):t&&t.length>0?t.includes(r):!(o&&o.length>0)||!o.some(e=>this.matchPageRule(r,e))}matchPageRule(e,t){switch(t.operator){case"EQUALS":return e===t.path;case"STARTS_WITH":return e.startsWith(t.path);default:return!1}}checkCanBeShownByVisitorsTypeCondition(e){const{visitors_type:t}=e;return"NEW"===t?!this.isRecurringVisitor:"RECURRING"!==t||this.isRecurringVisitor}async markAsShown(e){this.pw.api.recordPopupFormEvent(e.code,2).catch(t=>{$t.error(t,`${ft} Failed to record web popup shown event for "${e.code}"`)});const{frequency:t,code:n}=e;"ONCE"!==t?"ONCE_PER_SESSION"===t&&sessionStorage.setItem(this.getSessionStorageKey(n),"1"):await this.pw.data.addShownWebPopup(n)}getSessionStorageKey(e){return`${pt}.shown.${e}`}}return t})());
|
|
2
2
|
//# sourceMappingURL=widget-web-popups.js.map
|