web-push-notifications 3.92.0 → 3.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/core/Pushwoosh.d.ts +13 -0
  3. package/core/__tests__/loadWebPopupsWidget.test.d.ts +1 -0
  4. package/core/__tests__/reportPushPermissionChange.test.d.ts +1 -0
  5. package/core/__tests__/settlesWithin.test.d.ts +1 -0
  6. package/core/constants.d.ts +3 -0
  7. package/core/events.types.d.ts +3 -0
  8. package/core/functions.d.ts +2 -0
  9. package/core/resolveInitParams.d.ts +7 -0
  10. package/modules/Api/Api.d.ts +10 -1
  11. package/modules/ApiClient/ApiClient.types.d.ts +8 -2
  12. package/modules/Data/Data.d.ts +5 -0
  13. package/modules/FeatureFlags/FeatureFlag.d.ts +12 -0
  14. package/modules/FeatureFlags/FeatureFlags.d.ts +57 -0
  15. package/modules/FeatureFlags/FeatureFlags.types.d.ts +19 -0
  16. package/modules/FeatureFlags/__tests__/FeatureFlags.test.d.ts +1 -0
  17. package/modules/FeatureFlags/featureFlagsUrl.d.ts +1 -0
  18. package/modules/InboxMessagesPublic.d.ts +3 -1
  19. package/npm.js +1 -1
  20. package/npm.js.map +1 -1
  21. package/package.json +1 -1
  22. package/service-worker.js +1 -1
  23. package/service-worker.js.map +1 -1
  24. package/services/PushService/__tests__/pushPermissionStatus.test.d.ts +1 -0
  25. package/services/PushService/pushPermissionStatus.d.ts +3 -0
  26. package/widget-inbox.js +1 -1
  27. package/widget-inbox.js.map +1 -1
  28. package/widget-subscription-button.js.map +1 -1
  29. package/widget-web-popups.js +1 -1
  30. package/widget-web-popups.js.map +1 -1
  31. package/widgets/WebPopups/WebPopupsWidget.d.ts +6 -2
  32. package/widgets/WebPopups/__tests__/WebPopupsWidget.test.d.ts +1 -0
  33. package/widgets/WebPopups/types.d.ts +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"widget-subscription-button.js","mappings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ifications/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/core/constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/positioning.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/index.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/bell.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 DEFAULT_SERVICE_WORKER_URL = '/pushwoosh-service-worker.js';\nexport const DEFAULT_API_URL = 'https://api.pushwoosh.com/json/1.3/';\n\nexport const PERIOD_SEND_APP_OPEN = 3600000;\nexport const PERIOD_GOAL_EVENT = 86400000;\n\nexport const DEFAULT_NOTIFICATION_TITLE = 'Pushwoosh notification';\nexport const DEFAULT_NOTIFICATION_IMAGE = 'https://cp.pushwoosh.com/img/logo-medium.png';\n\n// Keys\nexport const KEY_SHOW_SUBSCRIBE_WIDGET = 'WIDGET_SHOWED';\nexport const KEY_CLICK_SUBSCRIBE_WIDGET = 'WIDGET_CLICKED';\n\n// Local storage keys\nexport const KEY_DEVICE_REGISTRATION_STATUS: string = 'deviceRegistrationStatus';\nexport const KEY_SAFARI_PREVIOUS_PERMISSION = 'safariPreviousPermission';\nexport const MANUAL_SET_LOGGER_LEVEL = 'PW_SET_LOGGER_LEVEL';\n\n// Device registration status\nexport const DEVICE_REGISTRATION_STATUS_REGISTERED: string = 'registered';\nexport const DEVICE_REGISTRATION_STATUS_UNREGISTERED: string = 'unregistered';\n\n// Permissions\nexport const PERMISSION_DENIED = 'denied';\nexport const PERMISSION_GRANTED = 'granted';\nexport const PERMISSION_PROMPT = 'default';\n\n// Events\nexport const LEGACY_EVENT_ON_LOAD = 'onLoad';\nexport const LEGACY_EVENT_ON_READY = 'onReady';\nexport const LEGACY_EVENT_ON_SUBSCRIBE = 'onSubscribe';\nexport const LEGACY_EVENT_ON_UNSUBSCRIBE = 'onUnsubscribe';\nexport const LEGACY_EVENT_ON_REGISTER = 'onRegister';\nexport const LEGACY_EVENT_ON_PERMISSION_PROMPT = 'onPermissionPrompt';\nexport const LEGACY_EVENT_ON_PERMISSION_DENIED = 'onPermissionDenied';\nexport const LEGACY_EVENT_ON_PERMISSION_GRANTED = 'onPermissionGranted';\nexport const LEGACY_EVENT_ON_SW_INIT_ERROR = 'onSWInitError';\nexport const LEGACY_EVENT_ON_PUSH_DELIVERY = 'onPushDelivery';\nexport const LEGACY_EVENT_ON_NOTIFICATION_CLICK = 'onNotificationClick';\nexport const LEGACY_EVENT_ON_NOTIFICATION_CLOSE = 'onNotificationClose';\nexport const LEGACY_EVENT_ON_CHANGE_COMMUNICATION_ENABLED = 'onChangeCommunicationEnabled';\nexport const LEGACY_EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE = 'onPutNewMessageToInboxStore';\nexport const LEGACY_EVENT_ON_UPDATE_INBOX_MESSAGES = 'onUpdateInboxMessages';\nexport const LEGACY_EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG = 'onShowNotificationPermissionDialog';\nexport const LEGACY_EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG = 'onHideNotificationPermissionDialog';\n\nexport const LEGACY_EVENT_ON_SHOW_SUBSCRIPTION_WIDGET = 'onShowSubscriptionWidget';\nexport const LEGACY_EVENT_ON_HIDE_SUBSCRIPTION_WIDGET = 'onHideSubscriptionWidget';\n\n// Post Events\nexport const EVENT_SHOW_SUBSCRIBE_BUTTON = 'showSubscribeButton';\nexport const EVENT_CLICK_SUBSCRIBE_BUTTON = 'clickSubscribeButton';\nexport const EVENT_GDPR_CONSENT = 'GDPRConsent';\nexport const EVENT_GDPR_DELETE = 'GDPRDelete';\nexport const EVENT_PW_SITE_OPENED = 'PW_SiteOpened'; // for default events\n\n// Storage that keeps no hwid (in-app webview, private window, insecure context)\n// leaves the device unidentifiable, and the backend rejects such requests.\nexport const HWID_UNAVAILABLE_MESSAGE = 'Pushwoosh: the SDK storage does not keep the hwid in this browser '\n + '(in-app webview, private window or insecure context), so this device cannot be identified. '\n + 'Requests that need an hwid are not sent.';\n\nexport const IDENTITY_UNAVAILABLE_MESSAGE = 'Pushwoosh: neither a userId nor an hwid is available, '\n + 'so there is nothing to register the email, SMS or WhatsApp channel to. '\n + 'Pass a userId in the init params.';\n\n// A rejected application code is a configuration error, not a failure: no\n// request of the SDK can succeed after it, so init stops instead of retrying.\nexport const API_STATUS_CODE_INVALID_APPLICATION = 210;\nexport const FATAL_API_STATUS_CODES: number[] = [API_STATUS_CODE_INVALID_APPLICATION];\n","// Bell\nimport { type TBellConfig } from './subscribe_widget.types';\n\nexport const BELL_POSITION_BOTTOM_RIGHT = 'bottomRight';\nexport const BELL_POSITION_BOTTOM_LEFT = 'bottomLeft';\nexport const BELL_POSITION_TOP_RIGHT = 'topRight';\nexport const BELL_POSITION_TOP_LEFT = 'topLeft';\n\n// Common\nexport const WIDGET_CONTAINER_ID = 'pushwooshBellWidget';\n\nexport const SUBSCRIBE_WIDGET_DEFAULT_CONFIG: TBellConfig = {\n position: BELL_POSITION_BOTTOM_LEFT,\n bgColor: '#12AE7E',\n bellColor: 'white',\n bellStrokeColor: '#08754f',\n bellButtonBorder: '1px solid #379676',\n shadow: '0px 0px 6px rgba(0, 0, 0, 0.75)',\n size: '48px',\n indent: '20px',\n zIndex: '999999',\n tooltipText: {\n successSubscribe: 'You are successfully subscribed!',\n needSubscribe: 'Get notifications about important news!',\n blockSubscribe: 'Click to see how to get notifications',\n alreadySubscribed: 'You are already subscribed',\n },\n};\n","import {\n BELL_POSITION_TOP_RIGHT,\n BELL_POSITION_TOP_LEFT,\n BELL_POSITION_BOTTOM_LEFT,\n BELL_POSITION_BOTTOM_RIGHT,\n} from './constants';\nimport { type TBellPosition, type TPositionStyles } from './subscribe_widget.types';\n\nexport default class Positioning {\n public static getBellPosition(position: TBellPosition, indent: string): TPositionStyles {\n let positionStyles: TPositionStyles;\n\n switch (position) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = {\n top: 'auto',\n left: 'auto',\n bottom: indent,\n right: indent,\n };\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = {\n top: 'auto',\n left: indent,\n bottom: indent,\n right: 'auto',\n };\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = {\n top: indent,\n left: indent,\n bottom: 'auto',\n right: 'auto',\n };\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = {\n top: indent,\n left: 'auto',\n bottom: 'auto',\n right: indent,\n };\n break;\n default:\n positionStyles = {\n top: 'auto',\n left: 'auto',\n bottom: indent,\n right: indent,\n };\n }\n\n return positionStyles;\n }\n\n public static getTooltipPosition(bellPosition: TBellPosition, bellSize: string): [{ left: string } | { right: string }, string] {\n let positionStyles;\n let tooltipModification;\n const increaseIndent = (parseInt(bellSize) + 12) + 'px';\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = { left: increaseIndent };\n tooltipModification = 'left';\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = { left: increaseIndent };\n tooltipModification = 'left';\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n break;\n default:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n }\n\n return [positionStyles, tooltipModification];\n }\n\n public static getPopoverPosition(bellPosition: TBellPosition, bellSize: string): [TPositionStyles, string] {\n let positionStyles;\n let popoverModification;\n const increaseIndent = (parseInt(bellSize) + 15) + 'px';\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = {\n bottom: increaseIndent,\n right: '0',\n left: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = {\n bottom: increaseIndent,\n left: '0',\n right: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = {\n top: increaseIndent,\n left: '0',\n right: 'auto',\n bottom: 'auto',\n };\n popoverModification = 'top';\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = {\n top: increaseIndent,\n right: '0',\n left: 'auto',\n bottom: 'auto',\n };\n popoverModification = 'top';\n break;\n default:\n positionStyles = {\n bottom: increaseIndent,\n right: '0',\n left: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n }\n\n return [positionStyles, popoverModification];\n }\n\n public static getPopoverArrowPosition(bellPosition: TBellPosition, bellSize: string) {\n let arrowAdditionalStyles;\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {right: auto; left: ${(parseInt(bellSize) / 2 - 12) + 'px'}`;\n break;\n case BELL_POSITION_TOP_LEFT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__top:after {right: auto; left: ${(parseInt(bellSize) / 2 - 12) + 'px'}`;\n break;\n case BELL_POSITION_TOP_RIGHT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__top:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n break;\n default:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n }\n\n return arrowAdditionalStyles;\n }\n}\n","import {\n PERMISSION_GRANTED,\n PERMISSION_DENIED,\n PERMISSION_PROMPT,\n} from '../../core/constants';\nimport mainCss from './assets/css/main.css';\nimport bellSVG from './bell';\nimport {\n SUBSCRIBE_WIDGET_DEFAULT_CONFIG,\n WIDGET_CONTAINER_ID,\n} from './constants';\nimport Positioning from './positioning';\nimport { type TBellConfig, type TCSSStylesObject, type TStyleKeys } from './subscribe_widget.types';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\nimport {\n type TPlatformChrome,\n type TPlatformEdge,\n type TPlatformFirefox,\n type TPlatformSafari,\n} from '../../modules/PlatformChecker/PlatformChecker.types';\n\nexport class PWSubscriptionButtonWidget {\n widget: HTMLElement;\n tooltip: HTMLElement;\n popover: HTMLElement;\n style: HTMLElement;\n pw: Pushwoosh;\n config: TBellConfig;\n\n constructor(pw: Pushwoosh) {\n // Set Pushwoosh object\n this.pw = pw;\n if (!pw.platformChecker.isAvailableNotifications) {\n console.warn('Browser does not support push notifications');\n return;\n }\n\n // Bindings\n this.clickBell = this.clickBell.bind(this);\n this.onSubscribeEvent = this.onSubscribeEvent.bind(this);\n this.onUnsubscribeEvent = this.onUnsubscribeEvent.bind(this);\n this.onPermissionDeniedEvent = this.onPermissionDeniedEvent.bind(this);\n this.clickOutOfPopover = this.clickOutOfPopover.bind(this);\n\n // Config\n const tooltipText = Object.assign(SUBSCRIBE_WIDGET_DEFAULT_CONFIG.tooltipText, pw.initParams.subscribeWidget!.tooltipText);\n this.config = Object.assign({}, SUBSCRIBE_WIDGET_DEFAULT_CONFIG, pw.initParams.subscribeWidget);\n this.config.tooltipText = tooltipText;\n }\n\n public async run() {\n // Nothing to subscribe to when push is unavailable, and the constructor\n // leaves the config unset in that case — so keep this before any render.\n if (!this.pw.isPushAvailable()) {\n return;\n }\n\n const isSubscribed = await this.pw.isSubscribed();\n if (!isSubscribed) {\n await this.render();\n }\n }\n\n /**\n * Apply styles to element\n * @param styles\n * @param {HTMLElement} element\n */\n private addStylesToElement(styles: TCSSStylesObject, element: HTMLElement) {\n Object.keys(styles).forEach((st: TStyleKeys) => {\n element.style[st] = styles[st];\n });\n }\n\n /**\n * Create container element\n * @returns {HTMLElement}\n */\n private createContainer(): HTMLElement {\n const container = document.createElement('div');\n container.id = WIDGET_CONTAINER_ID;\n container.className = 'pushwoosh-subscribe-widget';\n const position = Positioning.getBellPosition(this.config.position, this.config.indent);\n const styles = Object.assign({\n zIndex: this.config.zIndex,\n }, position);\n this.addStylesToElement(styles, container);\n return container;\n }\n\n /**\n * Create styles element\n * @returns {HTMLElement}\n */\n private createStyle(): HTMLElement {\n const styleNode = document.createElement('style');\n styleNode.innerHTML = mainCss;\n return styleNode;\n }\n\n /**\n * Create cell button element\n * @returns {HTMLElement}\n */\n private createBell(): HTMLElement {\n const { config } = this;\n let bell;\n if (config.buttonImage) {\n bell = document.createElement('img') as HTMLImageElement;\n bell.src = config.buttonImage;\n } else {\n bell = document.createElement('div');\n this.addStylesToElement({\n backgroundColor: config.bgColor,\n boxShadow: config.shadow,\n lineHeight: config.size,\n border: config.bellButtonBorder,\n }, bell);\n\n bell.innerHTML = bellSVG(config.bellColor, config.bellStrokeColor);\n }\n this.addStylesToElement({\n width: config.size,\n height: config.size,\n }, bell);\n bell.className = 'pushwoosh-subscribe-widget__bell-button';\n return bell;\n }\n\n /**\n * Create tooltip element\n * @returns {Promise<HTMLElement>}\n */\n private async createTooltip(): Promise<HTMLElement> {\n const tooltip = document.createElement('div');\n const [position, modification] = Positioning.getTooltipPosition(this.config.position, this.config.size);\n tooltip.className = `pushwoosh-subscribe-widget__tooltip pushwoosh-subscribe-widget__tooltip__${modification}`;\n this.addStylesToElement(position, tooltip);\n\n tooltip.appendChild(await this.createTooltipContent());\n return tooltip;\n }\n\n /**\n * Create tooltip content element\n * @returns {Promise<HTMLElement>}\n */\n private async createTooltipContent(): Promise<HTMLElement> {\n const tooltipContent = document.createElement('div');\n tooltipContent.innerText = await this.tooltipTextFactory();\n tooltipContent.className = 'pushwoosh-subscribe-widget__tooltip-content';\n return tooltipContent;\n }\n\n /**\n * Tooltip text content depending of the permissions\n * @returns {Promise<string>}\n */\n private async tooltipTextFactory(): Promise<string> {\n const permission = this.pw.driver?.getPermission();\n const { tooltipText } = this.config;\n const isManuallyUnsubscribed = await this.pw.data.getStatusManualUnsubscribed();\n\n switch (permission) {\n case PERMISSION_GRANTED:\n return isManuallyUnsubscribed ? tooltipText.needSubscribe : tooltipText.alreadySubscribed;\n case PERMISSION_PROMPT:\n return tooltipText.needSubscribe;\n case PERMISSION_DENIED:\n return tooltipText.blockSubscribe;\n default:\n return tooltipText.needSubscribe;\n }\n }\n\n /**\n * Create permission denied popover element\n * @returns {HTMLElement}\n */\n private createPopover(): HTMLElement {\n const popoverContentWrapper = document.createElement('div');\n const popover = document.createElement('div');\n const [position, modification] = Positioning.getPopoverPosition(this.config.position, this.config.size);\n popover.className = `pushwoosh-subscribe-widget__popover pushwoosh-subscribe-widget__popover__${modification}`;\n popoverContentWrapper.className = 'pushwoosh-subscribe-widget__popover-content-wrapper';\n\n this.style.innerHTML += Positioning.getPopoverArrowPosition(this.config.position, this.config.size);\n\n const styles = Object.assign({\n maxWidth: `calc(100vw - ${this.config.indent} - ${this.config.indent})`,\n }, position);\n this.addStylesToElement(styles, popover);\n\n popoverContentWrapper.appendChild(this.createPopoverContent());\n popover.appendChild(popoverContentWrapper);\n return popover;\n }\n\n private getBrowserName() {\n const platformChecker = this.pw.platformChecker;\n let browser;\n if (platformChecker.isOpera) {\n browser = 'opera';\n } else if (<TPlatformChrome>platformChecker.platform === 11 && navigator.userAgent.match(/Android/i)) {\n browser = 'mobileChrome';\n } else if (<TPlatformFirefox>platformChecker.platform === 12) {\n browser = 'firefox';\n } else if (<TPlatformSafari>platformChecker.platform === 10) {\n browser = 'safari';\n } else if (<TPlatformEdge>platformChecker.platform === 150) {\n browser = 'edge';\n } else {\n browser = 'chrome';\n }\n return browser;\n }\n\n /**\n * Create permission denied popover content element\n * @returns {HTMLElement}\n */\n private createPopoverContent(): HTMLElement {\n const { config } = this;\n const popoverContent = document.createElement('div');\n popoverContent.className = 'pushwoosh-subscribe-widget__popover-content';\n\n const browser = this.getBrowserName();\n\n const userImageSrc = config.contentImages && config.contentImages[browser];\n if (userImageSrc) {\n const image = document.createElement('img') as HTMLImageElement;\n image.src = userImageSrc;\n popoverContent.appendChild(image);\n } else {\n const standardImagesMap: Record<string, string> = {\n opera: 'opera',\n mobileChrome: 'mobile_chrome',\n firefox: 'FF',\n safari: 'safari',\n };\n const standardImage = standardImagesMap[browser] || 'chrome';\n [{\n src: this.getImageSrc(standardImage),\n width: 500,\n height: 130,\n }, {\n src: this.getImageSrc(`${standardImage}_unlock`),\n width: 500,\n height: 230,\n }].forEach((imageAttrs) => {\n const image = document.createElement('img');\n Object.assign(image, imageAttrs);\n popoverContent.appendChild(image);\n });\n }\n\n return popoverContent;\n }\n\n /**\n * Return source of help images depending of the browser\n * @returns {string}\n */\n getImageSrc(img: string): string {\n return `https://cdn.pushwoosh.com/webpush/img/${img}.jpg`;\n }\n\n private async render() {\n this.widget = this.createContainer();\n this.style = this.createStyle();\n const bell = this.createBell();\n this.tooltip = await this.createTooltip();\n this.popover = await this.createPopover();\n\n this.widget.appendChild(this.style);\n this.widget.appendChild(bell);\n this.widget.appendChild(this.tooltip);\n this.widget.appendChild(this.popover);\n\n document.body.appendChild(this.widget);\n\n this.pw.push(['onSubscribe', this.onSubscribeEvent]);\n this.pw.push(['onUnsubscribe', this.onUnsubscribeEvent]);\n this.pw.push(['onPermissionDenied', this.onPermissionDeniedEvent]);\n\n this.addEventListeners();\n }\n\n addEventListeners() {\n this.widget.addEventListener('click', this.clickBell);\n window.addEventListener('click', this.clickOutOfPopover);\n }\n\n /**\n * Toggle visibility of popover\n */\n toggleHelpPopover() {\n this.popover.classList.toggle('pushwoosh-subscribe-widget__popover__visible');\n }\n\n /**\n * Click bell button event callback\n * @returns {Promise<void>}\n */\n private async clickBell() {\n const permission = this.pw.driver?.getPermission();\n\n switch (permission) {\n case PERMISSION_GRANTED:\n await this.pw.subscribe();\n\n break;\n case PERMISSION_PROMPT:\n await this.pw.subscribe();\n\n break;\n case PERMISSION_DENIED:\n this.toggleHelpPopover();\n\n break;\n default:\n console.warn('Unknown browser notification permission');\n }\n }\n\n /**\n * On subscribe event callback\n * @returns {Promise<void>}\n */\n private async onSubscribeEvent() {\n const tooltipContent = this.tooltip.querySelector('div');\n\n if (tooltipContent === null) {\n return;\n }\n\n tooltipContent.innerText = this.config.tooltipText.successSubscribe;\n this.tooltip.classList.add('pushwoosh-subscribe-widget__tooltip__visible');\n\n setTimeout(async () => {\n this.tooltip.classList.remove('pushwoosh-subscribe-widget__tooltip__visible');\n tooltipContent.innerText = await this.tooltipTextFactory();\n\n this.widget.classList.add('pushwoosh-subscribe-widget__subscribed');\n }, 2000);\n }\n\n /**\n * On permission denied event\n * @returns {Promise<void>}\n */\n private async onPermissionDeniedEvent(): Promise<void> {\n this.addEventListeners();\n\n const tooltipContent = this.tooltip.querySelector('div');\n if (tooltipContent === null) return;\n tooltipContent.innerText = await this.tooltipTextFactory();\n }\n\n /**\n * Out of popover click event\n * @param {MessageEvent} ev\n */\n clickOutOfPopover(ev: MessageEvent) {\n const closeRule = this.popover.classList.contains('pushwoosh-subscribe-widget__popover__visible')\n && !(ev.target as any).classList.contains('pushwoosh-subscribe-widget__popover')\n && (ev.target as any).closest('.pushwoosh-subscribe-widget__popover') === null\n && !(ev.target as any).classList.contains('pushwoosh-subscribe-widget__bell-button')\n && (ev.target as any).closest('.pushwoosh-subscribe-widget__bell-button') === null;\n\n if (closeRule) this.popover.classList.remove('pushwoosh-subscribe-widget__popover__visible');\n }\n\n private async onUnsubscribeEvent() {\n const tooltipContent = this.tooltip.querySelector('div');\n\n if (tooltipContent === null) {\n return;\n }\n\n tooltipContent.innerText = await this.tooltipTextFactory();\n }\n}\n","export default (fillColor: string, strokeColor: string) => {\n return '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\\n'\n + '<svg\\n'\n + ' xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\\n'\n + ' xmlns:cc=\"http://creativecommons.org/ns#\"\\n'\n + ' xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\\n'\n + ' xmlns:svg=\"http://www.w3.org/2000/svg\"\\n'\n + ' xmlns=\"http://www.w3.org/2000/svg\"\\n'\n + ' xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\\n'\n + ' xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\\n'\n + ' version=\"1.1\"\\n'\n + ' id=\"Capa_1\"\\n'\n + ' x=\"0px\"\\n'\n + ' y=\"0px\"\\n'\n + ' viewBox=\"0 0 346.013 346.013\"\\n'\n + ' style=\"enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;\"\\n'\n + ' xml:space=\"preserve\"\\n'\n + ' inkscape:version=\"0.91 r13725\"\\n'\n + ' sodipodi:docname=\"alarm_white.svg\"><metadata\\n'\n + ' id=\"metadata51\"><rdf:RDF><cc:Work\\n'\n + ' rdf:about=\"\"><dc:format>image/svg+xml</dc:format><dc:type\\n'\n + ' rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\\n'\n + ' id=\"defs49\" /><sodipodi:namedview\\n'\n + ' borderopacity=\"1\"\\n'\n + ' objecttolerance=\"10\"\\n'\n + ' gridtolerance=\"10\"\\n'\n + ' guidetolerance=\"10\"\\n'\n + ' inkscape:pageopacity=\"0\"\\n'\n + ' inkscape:pageshadow=\"2\"\\n'\n + ' inkscape:window-width=\"1618\"\\n'\n + ' inkscape:window-height=\"828\"\\n'\n + ' id=\"namedview47\"\\n'\n + ' showgrid=\"false\"\\n'\n + ' inkscape:zoom=\"0.6820553\"\\n'\n + ' inkscape:cx=\"173.0065\"\\n'\n + ' inkscape:cy=\"173.0065\"\\n'\n + ' inkscape:window-x=\"0\"\\n'\n + ' inkscape:window-y=\"0\"\\n'\n + ' inkscape:window-maximized=\"0\"\\n'\n + ' inkscape:current-layer=\"g3\" /><g\\n'\n + ' id=\"g3\"><path\\n'\n + ' d=\"m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z\"\\n'\n + ' id=\"path5\"\\n'\n + ' inkscape:connector-curvature=\"0\"\\n'\n + ' vector-effect=\"non-scaling-stroke\"\\n'\n + ` style=\"fill:${fillColor}; stroke: ${strokeColor}; stroke-width: 1; \" /><path\\n`\n + ' vector-effect=\"non-scaling-stroke\"\\n'\n + ' d=\"m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z\"\\n'\n + ' id=\"path7\"\\n'\n + ' inkscape:connector-curvature=\"0\"\\n'\n + ` style=\"fill:${fillColor}; stroke: ${strokeColor}; stroke-width: 1;\" /></g><g\\n`\n + ' id=\"g17\" /><g\\n'\n + ' id=\"g19\" /><g\\n'\n + ' id=\"g21\" /><g\\n'\n + ' id=\"g23\" /><g\\n'\n + ' id=\"g25\" /><g\\n'\n + ' id=\"g27\" /><g\\n'\n + ' id=\"g29\" /><g\\n'\n + ' id=\"g31\" /><g\\n'\n + ' id=\"g33\" /><g\\n'\n + ' id=\"g35\" /><g\\n'\n + ' id=\"g37\" /><g\\n'\n + ' id=\"g39\" /><g\\n'\n + ' id=\"g41\" /><g\\n'\n + ' id=\"g43\" /><g\\n'\n + ' id=\"g45\" /></svg>';\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","PERMISSION_GRANTED","PERMISSION_PROMPT","BELL_POSITION_BOTTOM_RIGHT","BELL_POSITION_BOTTOM_LEFT","BELL_POSITION_TOP_RIGHT","BELL_POSITION_TOP_LEFT","SUBSCRIBE_WIDGET_DEFAULT_CONFIG","position","bgColor","bellColor","bellStrokeColor","bellButtonBorder","shadow","size","indent","zIndex","tooltipText","successSubscribe","needSubscribe","blockSubscribe","alreadySubscribed","Positioning","getBellPosition","positionStyles","top","left","bottom","right","getTooltipPosition","bellPosition","bellSize","tooltipModification","increaseIndent","parseInt","getPopoverPosition","popoverModification","getPopoverArrowPosition","arrowAdditionalStyles","PWSubscriptionButtonWidget","constructor","pw","platformChecker","isAvailableNotifications","console","warn","clickBell","bind","onSubscribeEvent","onUnsubscribeEvent","onPermissionDeniedEvent","clickOutOfPopover","assign","initParams","subscribeWidget","config","run","isPushAvailable","isSubscribed","render","addStylesToElement","styles","element","keys","forEach","st","style","createContainer","container","document","createElement","id","className","createStyle","styleNode","innerHTML","createBell","bell","fillColor","strokeColor","buttonImage","src","backgroundColor","boxShadow","lineHeight","border","width","height","createTooltip","tooltip","modification","appendChild","createTooltipContent","tooltipContent","innerText","tooltipTextFactory","permission","driver","getPermission","isManuallyUnsubscribed","data","getStatusManualUnsubscribed","createPopover","popoverContentWrapper","popover","maxWidth","createPopoverContent","getBrowserName","browser","isOpera","platform","navigator","userAgent","match","popoverContent","userImageSrc","contentImages","image","standardImage","opera","mobileChrome","firefox","safari","getImageSrc","imageAttrs","img","widget","body","push","addEventListeners","addEventListener","window","toggleHelpPopover","classList","toggle","subscribe","querySelector","add","setTimeout","async","remove","ev","contains","target","closest"],"sourceRoot":""}
1
+ {"version":3,"file":"widget-subscription-button.js","mappings":"CAAA,SAAAA,EAAAC,GACA,oBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,SACA,sBAAAG,QAAAA,OAAAC,IACAD,OAAA,GAAAH,OACA,CACA,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eAAMxF,GACZ,MAAMkD,EAAahH,KAAKyD,GAAGwD,QAAQC,gBAEnC,OAAQF,GACN,KAAK/F,EAIL,KAAKC,QACGlB,KAAKyD,GAAG8F,YAEd,MACF,IAAK,SACHvJ,KAAKoJ,oBAEL,MACF,QACExF,QAAQC,KAAK,2CAEnB,CAMQ,sBAAMG,GACZ,MAAM6C,EAAiB7G,KAAKyG,QAAQ+C,cAAc,OAE3B,OAAnB3C,IAIJA,EAAeC,UAAY9G,KAAKuE,OAAOtC,YAAYC,iBACnDlC,KAAKyG,QAAQ4C,UAAUI,IAAI,gDAE3BC,WAAWC,UACT3J,KAAKyG,QAAQ4C,UAAUO,OAAO,gDAC9B/C,EAAeC,gBAAkB9G,KAAK+G,qBAEtC/G,KAAK8I,OAAOO,UAAUI,IAAI,2CACzB,KACL,CAMQ,6BAAMvF,GACZlE,KAAKiJ,oBAEL,MAAMpC,EAAiB7G,KAAKyG,QAAQ+C,cAAc,OAC3B,OAAnB3C,IACJA,EAAeC,gBAAkB9G,KAAK+G,qBACxC,CAMA,iBAAA5C,CAAkB0F,GACE7J,KAAKwH,QAAQ6B,UAAUS,SAAS,kDAC3CD,EAAGE,OAAeV,UAAUS,SAAS,wCACgC,OAAtED,EAAGE,OAAeC,QAAQ,0CACzBH,EAAGE,OAAeV,UAAUS,SAAS,4CACoC,OAA1ED,EAAGE,OAAeC,QAAQ,6CAEjBhK,KAAKwH,QAAQ6B,UAAUO,OAAO,+CAC/C,CAEQ,wBAAM3F,GACZ,MAAM4C,EAAiB7G,KAAKyG,QAAQ+C,cAAc,OAE3B,OAAnB3C,IAIJA,EAAeC,gBAAkB9G,KAAK+G,qBACxC","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/core/constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/positioning.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/index.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/bell.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 DEFAULT_SERVICE_WORKER_URL = '/pushwoosh-service-worker.js';\nexport const DEFAULT_API_URL = 'https://api.pushwoosh.com/json/1.3/';\n\nexport const PERIOD_SEND_APP_OPEN = 3600000;\nexport const PERIOD_GOAL_EVENT = 86400000;\n\nexport const DEFAULT_NOTIFICATION_TITLE = 'Pushwoosh notification';\nexport const DEFAULT_NOTIFICATION_IMAGE = 'https://cp.pushwoosh.com/img/logo-medium.png';\n\n// Keys\nexport const KEY_SHOW_SUBSCRIBE_WIDGET = 'WIDGET_SHOWED';\nexport const KEY_CLICK_SUBSCRIBE_WIDGET = 'WIDGET_CLICKED';\n\n// Local storage keys\nexport const KEY_DEVICE_REGISTRATION_STATUS: string = 'deviceRegistrationStatus';\nexport const KEY_REPORTED_PUSH_PERMISSION_STATUS: string = 'reportedPushPermissionStatus';\nexport const KEY_SAFARI_PREVIOUS_PERMISSION = 'safariPreviousPermission';\nexport const MANUAL_SET_LOGGER_LEVEL = 'PW_SET_LOGGER_LEVEL';\n\n// Device registration status\nexport const DEVICE_REGISTRATION_STATUS_REGISTERED: string = 'registered';\nexport const DEVICE_REGISTRATION_STATUS_UNREGISTERED: string = 'unregistered';\n\n// Permissions\nexport const PERMISSION_DENIED = 'denied';\nexport const PERMISSION_GRANTED = 'granted';\nexport const PERMISSION_PROMPT = 'default';\n\n// Events\nexport const LEGACY_EVENT_ON_LOAD = 'onLoad';\nexport const LEGACY_EVENT_ON_READY = 'onReady';\nexport const LEGACY_EVENT_ON_SUBSCRIBE = 'onSubscribe';\nexport const LEGACY_EVENT_ON_UNSUBSCRIBE = 'onUnsubscribe';\nexport const LEGACY_EVENT_ON_REGISTER = 'onRegister';\nexport const LEGACY_EVENT_ON_PERMISSION_PROMPT = 'onPermissionPrompt';\nexport const LEGACY_EVENT_ON_PERMISSION_DENIED = 'onPermissionDenied';\nexport const LEGACY_EVENT_ON_PERMISSION_GRANTED = 'onPermissionGranted';\nexport const LEGACY_EVENT_ON_SW_INIT_ERROR = 'onSWInitError';\nexport const LEGACY_EVENT_ON_PUSH_DELIVERY = 'onPushDelivery';\nexport const LEGACY_EVENT_ON_NOTIFICATION_CLICK = 'onNotificationClick';\nexport const LEGACY_EVENT_ON_NOTIFICATION_CLOSE = 'onNotificationClose';\nexport const LEGACY_EVENT_ON_CHANGE_COMMUNICATION_ENABLED = 'onChangeCommunicationEnabled';\nexport const LEGACY_EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE = 'onPutNewMessageToInboxStore';\nexport const LEGACY_EVENT_ON_UPDATE_INBOX_MESSAGES = 'onUpdateInboxMessages';\nexport const LEGACY_EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG = 'onShowNotificationPermissionDialog';\nexport const LEGACY_EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG = 'onHideNotificationPermissionDialog';\n\nexport const LEGACY_EVENT_ON_SHOW_SUBSCRIPTION_WIDGET = 'onShowSubscriptionWidget';\nexport const LEGACY_EVENT_ON_HIDE_SUBSCRIPTION_WIDGET = 'onHideSubscriptionWidget';\n\n// Post Events\nexport const EVENT_SHOW_SUBSCRIBE_BUTTON = 'showSubscribeButton';\nexport const EVENT_CLICK_SUBSCRIBE_BUTTON = 'clickSubscribeButton';\nexport const EVENT_GDPR_CONSENT = 'GDPRConsent';\nexport const EVENT_GDPR_DELETE = 'GDPRDelete';\nexport const EVENT_PW_SITE_OPENED = 'PW_SiteOpened'; // for default events\n\n// Storage that keeps no hwid (in-app webview, private window, insecure context)\n// leaves the device unidentifiable, and the backend rejects such requests.\nexport const HWID_UNAVAILABLE_MESSAGE = 'Pushwoosh: the SDK storage does not keep the hwid in this browser '\n + '(in-app webview, private window or insecure context), so this device cannot be identified. '\n + 'Requests that need an hwid are not sent.';\n\nexport const IDENTITY_UNAVAILABLE_MESSAGE = 'Pushwoosh: neither a userId nor an hwid is available, '\n + 'so there is nothing to register the email, SMS or WhatsApp channel to. '\n + 'Pass a userId in the init params.';\n\n// A rejected application code is a configuration error, not a failure: no\n// request of the SDK can succeed after it, so init stops instead of retrying.\nexport const API_STATUS_CODE_INVALID_APPLICATION = 210;\nexport const FATAL_API_STATUS_CODES: number[] = [API_STATUS_CODE_INVALID_APPLICATION];\n\n// How long an inbox tap waits for a widget bundle before falling back to the message link.\nexport const WIDGET_LOAD_TIMEOUT_MS = 10000;\n\n// A browser subscription can hang; the permission-change report stops waiting for it after this.\nexport const SUBSCRIPTION_WAIT_TIMEOUT_MS: number = 10000;\n","// Bell\nimport { type TBellConfig } from './subscribe_widget.types';\n\nexport const BELL_POSITION_BOTTOM_RIGHT = 'bottomRight';\nexport const BELL_POSITION_BOTTOM_LEFT = 'bottomLeft';\nexport const BELL_POSITION_TOP_RIGHT = 'topRight';\nexport const BELL_POSITION_TOP_LEFT = 'topLeft';\n\n// Common\nexport const WIDGET_CONTAINER_ID = 'pushwooshBellWidget';\n\nexport const SUBSCRIBE_WIDGET_DEFAULT_CONFIG: TBellConfig = {\n position: BELL_POSITION_BOTTOM_LEFT,\n bgColor: '#12AE7E',\n bellColor: 'white',\n bellStrokeColor: '#08754f',\n bellButtonBorder: '1px solid #379676',\n shadow: '0px 0px 6px rgba(0, 0, 0, 0.75)',\n size: '48px',\n indent: '20px',\n zIndex: '999999',\n tooltipText: {\n successSubscribe: 'You are successfully subscribed!',\n needSubscribe: 'Get notifications about important news!',\n blockSubscribe: 'Click to see how to get notifications',\n alreadySubscribed: 'You are already subscribed',\n },\n};\n","import {\n BELL_POSITION_TOP_RIGHT,\n BELL_POSITION_TOP_LEFT,\n BELL_POSITION_BOTTOM_LEFT,\n BELL_POSITION_BOTTOM_RIGHT,\n} from './constants';\nimport { type TBellPosition, type TPositionStyles } from './subscribe_widget.types';\n\nexport default class Positioning {\n public static getBellPosition(position: TBellPosition, indent: string): TPositionStyles {\n let positionStyles: TPositionStyles;\n\n switch (position) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = {\n top: 'auto',\n left: 'auto',\n bottom: indent,\n right: indent,\n };\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = {\n top: 'auto',\n left: indent,\n bottom: indent,\n right: 'auto',\n };\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = {\n top: indent,\n left: indent,\n bottom: 'auto',\n right: 'auto',\n };\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = {\n top: indent,\n left: 'auto',\n bottom: 'auto',\n right: indent,\n };\n break;\n default:\n positionStyles = {\n top: 'auto',\n left: 'auto',\n bottom: indent,\n right: indent,\n };\n }\n\n return positionStyles;\n }\n\n public static getTooltipPosition(bellPosition: TBellPosition, bellSize: string): [{ left: string } | { right: string }, string] {\n let positionStyles;\n let tooltipModification;\n const increaseIndent = (parseInt(bellSize) + 12) + 'px';\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = { left: increaseIndent };\n tooltipModification = 'left';\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = { left: increaseIndent };\n tooltipModification = 'left';\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n break;\n default:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n }\n\n return [positionStyles, tooltipModification];\n }\n\n public static getPopoverPosition(bellPosition: TBellPosition, bellSize: string): [TPositionStyles, string] {\n let positionStyles;\n let popoverModification;\n const increaseIndent = (parseInt(bellSize) + 15) + 'px';\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = {\n bottom: increaseIndent,\n right: '0',\n left: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = {\n bottom: increaseIndent,\n left: '0',\n right: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = {\n top: increaseIndent,\n left: '0',\n right: 'auto',\n bottom: 'auto',\n };\n popoverModification = 'top';\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = {\n top: increaseIndent,\n right: '0',\n left: 'auto',\n bottom: 'auto',\n };\n popoverModification = 'top';\n break;\n default:\n positionStyles = {\n bottom: increaseIndent,\n right: '0',\n left: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n }\n\n return [positionStyles, popoverModification];\n }\n\n public static getPopoverArrowPosition(bellPosition: TBellPosition, bellSize: string) {\n let arrowAdditionalStyles;\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {right: auto; left: ${(parseInt(bellSize) / 2 - 12) + 'px'}`;\n break;\n case BELL_POSITION_TOP_LEFT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__top:after {right: auto; left: ${(parseInt(bellSize) / 2 - 12) + 'px'}`;\n break;\n case BELL_POSITION_TOP_RIGHT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__top:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n break;\n default:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n }\n\n return arrowAdditionalStyles;\n }\n}\n","import {\n PERMISSION_GRANTED,\n PERMISSION_DENIED,\n PERMISSION_PROMPT,\n} from '../../core/constants';\nimport mainCss from './assets/css/main.css';\nimport bellSVG from './bell';\nimport {\n SUBSCRIBE_WIDGET_DEFAULT_CONFIG,\n WIDGET_CONTAINER_ID,\n} from './constants';\nimport Positioning from './positioning';\nimport { type TBellConfig, type TCSSStylesObject, type TStyleKeys } from './subscribe_widget.types';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\nimport {\n type TPlatformChrome,\n type TPlatformEdge,\n type TPlatformFirefox,\n type TPlatformSafari,\n} from '../../modules/PlatformChecker/PlatformChecker.types';\n\nexport class PWSubscriptionButtonWidget {\n widget: HTMLElement;\n tooltip: HTMLElement;\n popover: HTMLElement;\n style: HTMLElement;\n pw: Pushwoosh;\n config: TBellConfig;\n\n constructor(pw: Pushwoosh) {\n // Set Pushwoosh object\n this.pw = pw;\n if (!pw.platformChecker.isAvailableNotifications) {\n console.warn('Browser does not support push notifications');\n return;\n }\n\n // Bindings\n this.clickBell = this.clickBell.bind(this);\n this.onSubscribeEvent = this.onSubscribeEvent.bind(this);\n this.onUnsubscribeEvent = this.onUnsubscribeEvent.bind(this);\n this.onPermissionDeniedEvent = this.onPermissionDeniedEvent.bind(this);\n this.clickOutOfPopover = this.clickOutOfPopover.bind(this);\n\n // Config\n const tooltipText = Object.assign(SUBSCRIBE_WIDGET_DEFAULT_CONFIG.tooltipText, pw.initParams.subscribeWidget!.tooltipText);\n this.config = Object.assign({}, SUBSCRIBE_WIDGET_DEFAULT_CONFIG, pw.initParams.subscribeWidget);\n this.config.tooltipText = tooltipText;\n }\n\n public async run() {\n // Nothing to subscribe to when push is unavailable, and the constructor\n // leaves the config unset in that case — so keep this before any render.\n if (!this.pw.isPushAvailable()) {\n return;\n }\n\n const isSubscribed = await this.pw.isSubscribed();\n if (!isSubscribed) {\n await this.render();\n }\n }\n\n /**\n * Apply styles to element\n * @param styles\n * @param {HTMLElement} element\n */\n private addStylesToElement(styles: TCSSStylesObject, element: HTMLElement) {\n Object.keys(styles).forEach((st: TStyleKeys) => {\n element.style[st] = styles[st];\n });\n }\n\n /**\n * Create container element\n * @returns {HTMLElement}\n */\n private createContainer(): HTMLElement {\n const container = document.createElement('div');\n container.id = WIDGET_CONTAINER_ID;\n container.className = 'pushwoosh-subscribe-widget';\n const position = Positioning.getBellPosition(this.config.position, this.config.indent);\n const styles = Object.assign({\n zIndex: this.config.zIndex,\n }, position);\n this.addStylesToElement(styles, container);\n return container;\n }\n\n /**\n * Create styles element\n * @returns {HTMLElement}\n */\n private createStyle(): HTMLElement {\n const styleNode = document.createElement('style');\n styleNode.innerHTML = mainCss;\n return styleNode;\n }\n\n /**\n * Create cell button element\n * @returns {HTMLElement}\n */\n private createBell(): HTMLElement {\n const { config } = this;\n let bell;\n if (config.buttonImage) {\n bell = document.createElement('img') as HTMLImageElement;\n bell.src = config.buttonImage;\n } else {\n bell = document.createElement('div');\n this.addStylesToElement({\n backgroundColor: config.bgColor,\n boxShadow: config.shadow,\n lineHeight: config.size,\n border: config.bellButtonBorder,\n }, bell);\n\n bell.innerHTML = bellSVG(config.bellColor, config.bellStrokeColor);\n }\n this.addStylesToElement({\n width: config.size,\n height: config.size,\n }, bell);\n bell.className = 'pushwoosh-subscribe-widget__bell-button';\n return bell;\n }\n\n /**\n * Create tooltip element\n * @returns {Promise<HTMLElement>}\n */\n private async createTooltip(): Promise<HTMLElement> {\n const tooltip = document.createElement('div');\n const [position, modification] = Positioning.getTooltipPosition(this.config.position, this.config.size);\n tooltip.className = `pushwoosh-subscribe-widget__tooltip pushwoosh-subscribe-widget__tooltip__${modification}`;\n this.addStylesToElement(position, tooltip);\n\n tooltip.appendChild(await this.createTooltipContent());\n return tooltip;\n }\n\n /**\n * Create tooltip content element\n * @returns {Promise<HTMLElement>}\n */\n private async createTooltipContent(): Promise<HTMLElement> {\n const tooltipContent = document.createElement('div');\n tooltipContent.innerText = await this.tooltipTextFactory();\n tooltipContent.className = 'pushwoosh-subscribe-widget__tooltip-content';\n return tooltipContent;\n }\n\n /**\n * Tooltip text content depending of the permissions\n * @returns {Promise<string>}\n */\n private async tooltipTextFactory(): Promise<string> {\n const permission = this.pw.driver?.getPermission();\n const { tooltipText } = this.config;\n const isManuallyUnsubscribed = await this.pw.data.getStatusManualUnsubscribed();\n\n switch (permission) {\n case PERMISSION_GRANTED:\n return isManuallyUnsubscribed ? tooltipText.needSubscribe : tooltipText.alreadySubscribed;\n case PERMISSION_PROMPT:\n return tooltipText.needSubscribe;\n case PERMISSION_DENIED:\n return tooltipText.blockSubscribe;\n default:\n return tooltipText.needSubscribe;\n }\n }\n\n /**\n * Create permission denied popover element\n * @returns {HTMLElement}\n */\n private createPopover(): HTMLElement {\n const popoverContentWrapper = document.createElement('div');\n const popover = document.createElement('div');\n const [position, modification] = Positioning.getPopoverPosition(this.config.position, this.config.size);\n popover.className = `pushwoosh-subscribe-widget__popover pushwoosh-subscribe-widget__popover__${modification}`;\n popoverContentWrapper.className = 'pushwoosh-subscribe-widget__popover-content-wrapper';\n\n this.style.innerHTML += Positioning.getPopoverArrowPosition(this.config.position, this.config.size);\n\n const styles = Object.assign({\n maxWidth: `calc(100vw - ${this.config.indent} - ${this.config.indent})`,\n }, position);\n this.addStylesToElement(styles, popover);\n\n popoverContentWrapper.appendChild(this.createPopoverContent());\n popover.appendChild(popoverContentWrapper);\n return popover;\n }\n\n private getBrowserName() {\n const platformChecker = this.pw.platformChecker;\n let browser;\n if (platformChecker.isOpera) {\n browser = 'opera';\n } else if (<TPlatformChrome>platformChecker.platform === 11 && navigator.userAgent.match(/Android/i)) {\n browser = 'mobileChrome';\n } else if (<TPlatformFirefox>platformChecker.platform === 12) {\n browser = 'firefox';\n } else if (<TPlatformSafari>platformChecker.platform === 10) {\n browser = 'safari';\n } else if (<TPlatformEdge>platformChecker.platform === 150) {\n browser = 'edge';\n } else {\n browser = 'chrome';\n }\n return browser;\n }\n\n /**\n * Create permission denied popover content element\n * @returns {HTMLElement}\n */\n private createPopoverContent(): HTMLElement {\n const { config } = this;\n const popoverContent = document.createElement('div');\n popoverContent.className = 'pushwoosh-subscribe-widget__popover-content';\n\n const browser = this.getBrowserName();\n\n const userImageSrc = config.contentImages && config.contentImages[browser];\n if (userImageSrc) {\n const image = document.createElement('img') as HTMLImageElement;\n image.src = userImageSrc;\n popoverContent.appendChild(image);\n } else {\n const standardImagesMap: Record<string, string> = {\n opera: 'opera',\n mobileChrome: 'mobile_chrome',\n firefox: 'FF',\n safari: 'safari',\n };\n const standardImage = standardImagesMap[browser] || 'chrome';\n [{\n src: this.getImageSrc(standardImage),\n width: 500,\n height: 130,\n }, {\n src: this.getImageSrc(`${standardImage}_unlock`),\n width: 500,\n height: 230,\n }].forEach((imageAttrs) => {\n const image = document.createElement('img');\n Object.assign(image, imageAttrs);\n popoverContent.appendChild(image);\n });\n }\n\n return popoverContent;\n }\n\n /**\n * Return source of help images depending of the browser\n * @returns {string}\n */\n getImageSrc(img: string): string {\n return `https://cdn.pushwoosh.com/webpush/img/${img}.jpg`;\n }\n\n private async render() {\n this.widget = this.createContainer();\n this.style = this.createStyle();\n const bell = this.createBell();\n this.tooltip = await this.createTooltip();\n this.popover = await this.createPopover();\n\n this.widget.appendChild(this.style);\n this.widget.appendChild(bell);\n this.widget.appendChild(this.tooltip);\n this.widget.appendChild(this.popover);\n\n document.body.appendChild(this.widget);\n\n this.pw.push(['onSubscribe', this.onSubscribeEvent]);\n this.pw.push(['onUnsubscribe', this.onUnsubscribeEvent]);\n this.pw.push(['onPermissionDenied', this.onPermissionDeniedEvent]);\n\n this.addEventListeners();\n }\n\n addEventListeners() {\n this.widget.addEventListener('click', this.clickBell);\n window.addEventListener('click', this.clickOutOfPopover);\n }\n\n /**\n * Toggle visibility of popover\n */\n toggleHelpPopover() {\n this.popover.classList.toggle('pushwoosh-subscribe-widget__popover__visible');\n }\n\n /**\n * Click bell button event callback\n * @returns {Promise<void>}\n */\n private async clickBell() {\n const permission = this.pw.driver?.getPermission();\n\n switch (permission) {\n case PERMISSION_GRANTED:\n await this.pw.subscribe();\n\n break;\n case PERMISSION_PROMPT:\n await this.pw.subscribe();\n\n break;\n case PERMISSION_DENIED:\n this.toggleHelpPopover();\n\n break;\n default:\n console.warn('Unknown browser notification permission');\n }\n }\n\n /**\n * On subscribe event callback\n * @returns {Promise<void>}\n */\n private async onSubscribeEvent() {\n const tooltipContent = this.tooltip.querySelector('div');\n\n if (tooltipContent === null) {\n return;\n }\n\n tooltipContent.innerText = this.config.tooltipText.successSubscribe;\n this.tooltip.classList.add('pushwoosh-subscribe-widget__tooltip__visible');\n\n setTimeout(async () => {\n this.tooltip.classList.remove('pushwoosh-subscribe-widget__tooltip__visible');\n tooltipContent.innerText = await this.tooltipTextFactory();\n\n this.widget.classList.add('pushwoosh-subscribe-widget__subscribed');\n }, 2000);\n }\n\n /**\n * On permission denied event\n * @returns {Promise<void>}\n */\n private async onPermissionDeniedEvent(): Promise<void> {\n this.addEventListeners();\n\n const tooltipContent = this.tooltip.querySelector('div');\n if (tooltipContent === null) return;\n tooltipContent.innerText = await this.tooltipTextFactory();\n }\n\n /**\n * Out of popover click event\n * @param {MessageEvent} ev\n */\n clickOutOfPopover(ev: MessageEvent) {\n const closeRule = this.popover.classList.contains('pushwoosh-subscribe-widget__popover__visible')\n && !(ev.target as any).classList.contains('pushwoosh-subscribe-widget__popover')\n && (ev.target as any).closest('.pushwoosh-subscribe-widget__popover') === null\n && !(ev.target as any).classList.contains('pushwoosh-subscribe-widget__bell-button')\n && (ev.target as any).closest('.pushwoosh-subscribe-widget__bell-button') === null;\n\n if (closeRule) this.popover.classList.remove('pushwoosh-subscribe-widget__popover__visible');\n }\n\n private async onUnsubscribeEvent() {\n const tooltipContent = this.tooltip.querySelector('div');\n\n if (tooltipContent === null) {\n return;\n }\n\n tooltipContent.innerText = await this.tooltipTextFactory();\n }\n}\n","export default (fillColor: string, strokeColor: string) => {\n return '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\\n'\n + '<svg\\n'\n + ' xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\\n'\n + ' xmlns:cc=\"http://creativecommons.org/ns#\"\\n'\n + ' xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\\n'\n + ' xmlns:svg=\"http://www.w3.org/2000/svg\"\\n'\n + ' xmlns=\"http://www.w3.org/2000/svg\"\\n'\n + ' xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\\n'\n + ' xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\\n'\n + ' version=\"1.1\"\\n'\n + ' id=\"Capa_1\"\\n'\n + ' x=\"0px\"\\n'\n + ' y=\"0px\"\\n'\n + ' viewBox=\"0 0 346.013 346.013\"\\n'\n + ' style=\"enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;\"\\n'\n + ' xml:space=\"preserve\"\\n'\n + ' inkscape:version=\"0.91 r13725\"\\n'\n + ' sodipodi:docname=\"alarm_white.svg\"><metadata\\n'\n + ' id=\"metadata51\"><rdf:RDF><cc:Work\\n'\n + ' rdf:about=\"\"><dc:format>image/svg+xml</dc:format><dc:type\\n'\n + ' rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\\n'\n + ' id=\"defs49\" /><sodipodi:namedview\\n'\n + ' borderopacity=\"1\"\\n'\n + ' objecttolerance=\"10\"\\n'\n + ' gridtolerance=\"10\"\\n'\n + ' guidetolerance=\"10\"\\n'\n + ' inkscape:pageopacity=\"0\"\\n'\n + ' inkscape:pageshadow=\"2\"\\n'\n + ' inkscape:window-width=\"1618\"\\n'\n + ' inkscape:window-height=\"828\"\\n'\n + ' id=\"namedview47\"\\n'\n + ' showgrid=\"false\"\\n'\n + ' inkscape:zoom=\"0.6820553\"\\n'\n + ' inkscape:cx=\"173.0065\"\\n'\n + ' inkscape:cy=\"173.0065\"\\n'\n + ' inkscape:window-x=\"0\"\\n'\n + ' inkscape:window-y=\"0\"\\n'\n + ' inkscape:window-maximized=\"0\"\\n'\n + ' inkscape:current-layer=\"g3\" /><g\\n'\n + ' id=\"g3\"><path\\n'\n + ' d=\"m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z\"\\n'\n + ' id=\"path5\"\\n'\n + ' inkscape:connector-curvature=\"0\"\\n'\n + ' vector-effect=\"non-scaling-stroke\"\\n'\n + ` style=\"fill:${fillColor}; stroke: ${strokeColor}; stroke-width: 1; \" /><path\\n`\n + ' vector-effect=\"non-scaling-stroke\"\\n'\n + ' d=\"m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z\"\\n'\n + ' id=\"path7\"\\n'\n + ' inkscape:connector-curvature=\"0\"\\n'\n + ` style=\"fill:${fillColor}; stroke: ${strokeColor}; stroke-width: 1;\" /></g><g\\n`\n + ' id=\"g17\" /><g\\n'\n + ' id=\"g19\" /><g\\n'\n + ' id=\"g21\" /><g\\n'\n + ' id=\"g23\" /><g\\n'\n + ' id=\"g25\" /><g\\n'\n + ' id=\"g27\" /><g\\n'\n + ' id=\"g29\" /><g\\n'\n + ' id=\"g31\" /><g\\n'\n + ' id=\"g33\" /><g\\n'\n + ' id=\"g35\" /><g\\n'\n + ' id=\"g37\" /><g\\n'\n + ' id=\"g39\" /><g\\n'\n + ' id=\"g41\" /><g\\n'\n + ' id=\"g43\" /><g\\n'\n + ' id=\"g45\" /></svg>';\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","PERMISSION_GRANTED","PERMISSION_PROMPT","BELL_POSITION_BOTTOM_RIGHT","BELL_POSITION_BOTTOM_LEFT","BELL_POSITION_TOP_RIGHT","BELL_POSITION_TOP_LEFT","SUBSCRIBE_WIDGET_DEFAULT_CONFIG","position","bgColor","bellColor","bellStrokeColor","bellButtonBorder","shadow","size","indent","zIndex","tooltipText","successSubscribe","needSubscribe","blockSubscribe","alreadySubscribed","Positioning","getBellPosition","positionStyles","top","left","bottom","right","getTooltipPosition","bellPosition","bellSize","tooltipModification","increaseIndent","parseInt","getPopoverPosition","popoverModification","getPopoverArrowPosition","arrowAdditionalStyles","PWSubscriptionButtonWidget","constructor","pw","platformChecker","isAvailableNotifications","console","warn","clickBell","bind","onSubscribeEvent","onUnsubscribeEvent","onPermissionDeniedEvent","clickOutOfPopover","assign","initParams","subscribeWidget","config","run","isPushAvailable","isSubscribed","render","addStylesToElement","styles","element","keys","forEach","st","style","createContainer","container","document","createElement","id","className","createStyle","styleNode","innerHTML","createBell","bell","fillColor","strokeColor","buttonImage","src","backgroundColor","boxShadow","lineHeight","border","width","height","createTooltip","tooltip","modification","appendChild","createTooltipContent","tooltipContent","innerText","tooltipTextFactory","permission","driver","getPermission","isManuallyUnsubscribed","data","getStatusManualUnsubscribed","createPopover","popoverContentWrapper","popover","maxWidth","createPopoverContent","getBrowserName","browser","isOpera","platform","navigator","userAgent","match","popoverContent","userImageSrc","contentImages","image","standardImage","opera","mobileChrome","firefox","safari","getImageSrc","imageAttrs","img","widget","body","push","addEventListeners","addEventListener","window","toggleHelpPopover","classList","toggle","subscribe","querySelector","add","setTimeout","async","remove","ev","contains","target","closest"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("preact"),require("preact/compat"),require("preact/jsx-runtime"));else if("function"==typeof define&&define.amd)define(["preact","preact/compat","preact/jsx-runtime"],t);else{var n="object"==typeof exports?t(require("preact"),require("preact/compat"),require("preact/jsx-runtime")):t(e.preact,e.preactCompat,e.jsxRuntime);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,(e,t,n)=>(()=>{"use strict";var o={524(t){t.exports=e},873(e){e.exports=t},247(e){e.exports=n}};const i={};function r(e){const t=i[e];if(void 0!==t)return t.exports;const n=i[e]={exports:{}};return o[e](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};let s={};r.r(s),r.d(s,{WebPopupsWidget:()=>Sn});const a=/^(https?:|mailto:|tel:)/i,c="#101828",l="#667085",u="#FFFFFF",d="#FFFFFF",p="#2970FF",h=c,f=l,m="#FFFFFF",g={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}},y={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function b(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,[i,r,s]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${i}, ${r}, ${s}, ${t})`}(t.textInverse,y[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const v=["h1","h2","h3","icon"];function x(e){return"glyph"===e.type?"heading":"text"!==e.type?"action":v.includes(e.variant)?"heading":"text"}const k="8px 0 4px";function w(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 S(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 j="Subscribe",C="Thanks for subscribing!",M="Please check your inbox and confirm your email.",$="Save",R="Thanks! Your choice is saved.",P="Send",I="Thanks for the feedback!";const A="Something went wrong. Please try again.",F="\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",E={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"},T=Object.keys(E),q=[24,32,48],N=["Vertical","Horizontal","Columns","Rows"],z=["normal","reverse"],L=["start","center","end","stretch"],D=["start","center","end","space-between"],O=["left","center","right"],B=["default","inverse"],H=2e3,_={px:H,"%":100,em:125,rem:125},V=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,W={px:H,"%":100,fr:100},U=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,K=["auto","min-content","max-content"];function Z(e,t){return t.includes(e)?e:void 0}function J(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),H);if("string"!=typeof e)return;const t=V.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),_[o])}${o}`}const G=["top","right","bottom","left"];function Q(e){if(K.includes(e))return e;const t=U.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),W[o])}${o}`}function Y(e){return"string"==typeof e&&e.length>0?e:void 0}function X(e){const t={},n=J(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=J(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of G){const o=J(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 i=Z(e.alignItems,L);i&&(t.alignItems=i);const r=Z(e.justifyContent,D);r&&(t.justifyContent=r);const s=Z(e.alignContent,D);s&&(t.alignContent=s);const a=Y(e.backgroundImage);a&&(t.backgroundImage=a);const c=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(Q);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==c&&(t.sizes=c),t}function ee(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,i="object"==typeof o.props&&null!==o.props?o.props:{};if("Content"===o.type){const e=Y(i.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=Z(i.align,O);n&&(t.props.align=n);const o=Z(i.tone,B);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=Y(i.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const r=Z(o.type,N)??"Vertical",s=[];for(const e of o.children){const o=ee(e,t+1,n);o&&s.push(o)}const a=X(i);return"reverse"===Z(i.order,z)&&(s.reverse(),"string"==typeof a.sizes&&(a.sizes=a.sizes.split(" ").reverse().join(" "))),{type:r,props:a,children:s}}function te(e){return ee(e,0,{nodes:100})}const ne=/^[a-zA-Z][a-zA-Z0-9-]*$/,oe=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function ie(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=oe.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function re(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:ae(e,t,0)}const se=new Set(["content","image","backgroundImage"]);function ae(e,t,n){if(n>10||"object"!=typeof e||null===e)return e;const o=e,i={...o};if("object"==typeof o.props&&null!==o.props){const e={...o.props};for(const[n,o]of Object.entries(e))if(!se.has(n))if("string"==typeof o)e[n]=ie(o,t);else if("object"==typeof o&&null!==o&&!Array.isArray(o)){const i={...o};for(const[e,n]of Object.entries(i))"string"==typeof n&&(i[e]=ie(n,t));e[n]=i}i.props=e}return Array.isArray(o.children)&&(i.children=o.children.map(e=>ae(e,t,n+1))),i}function ce(e){return"number"==typeof e?`${e}px`:e}function le(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function ue(e=0){if(!(e>0))return null;const t=`rgba(16, 24, 40, ${Math.min(e,1)})`;return`linear-gradient(${t}, ${t})`}function de(e,t=0){const n=`url(${JSON.stringify(e)})`,o=ue(t);return{backgroundImage:o?`${o}, ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function pe(e,t,n=0){const o=e.props??{},i={display:"grid",minWidth:0};return"Horizontal"===e.type&&(i.gridAutoFlow="column"),"Columns"===e.type&&(i.gridTemplateColumns=le(o.sizes,e.children.length)),"Rows"===e.type&&(i.gridTemplateRows=le(o.sizes,e.children.length)),void 0!==o.gap&&(i.gap=ce(o.gap)),void 0!==o.padding&&(i.padding=function(e){if("number"==typeof e||"string"==typeof e)return ce(e);const t=e=>void 0===e?"0":ce(e);return`${t(e.top)} ${t(e.right)} ${t(e.bottom)} ${t(e.left)}`}(o.padding)),o.alignItems&&(i.alignItems=o.alignItems),o.justifyContent&&(i.justifyContent=o.justifyContent),o.alignContent&&(i.alignContent=o.alignContent),t&&Object.assign(i,de(t,n)),i}const he=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function fe(e){const t=he.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 me([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 ge(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 ye(e){return e>.5?.07+.86*(1-e):e}function be(e){return e<.5?.93-e*((.93-.5)/.5):e}function ve(e,t){const n=fe(e);if(!n)return e;const[o,i,r]=function([e,t,n]){const[o,i,r]=[e/255,t/255,n/255],s=Math.max(o,i,r),a=Math.min(o,i,r),c=(s+a)/2;if(s===a)return[0,0,c];const l=s-a;let u;return u=s===o?(i-r)/l+(i<r?6:0):s===i?(r-o)/l+2:(o-i)/l+4,[u/6,c>.5?l/(2-s-a):l/(s+a),c]}(n);return me(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,i=2*n-o;return[255*ge(i,o,e+1/3),255*ge(i,o,e),255*ge(i,o,e-1/3)]}([o,i,"fold"===t?ye(r):be(r)]))}function xe(e,t,n){const o=fe(e),i=fe(t);return o&&i?me(o.map((e,t)=>e+(i[t]-e)*n)):e}function ke(e,t){const n=fe(e);if(!n||t>=1)return e;const[o,i,r]=n;return`rgba(${o}, ${i}, ${r}, ${t})`}function we(e){const t=fe(e);if(!t)return!1;const[n,o,i]=t;return(.299*n+.587*o+.114*i)/255>.6}function Se(e){return{background:ve(e.background,"fold"),accent:e.accent,text:ve(e.text,"lift"),textSecondary:ve(e.textSecondary,"lift"),textInverse:e.textInverse}}function je(e,t){return"light"===t?{surface:d,surfaceText:c,border:"#D0D5DD",onAccent:u,error:"#D92D20",chromeIcon:l}:{surface:xe(e.background,e.text,.08),surfaceText:e.text,border:xe(e.background,e.text,.24),onAccent:we(e.accent)?c:u,error:"#FDA29B",chromeIcon:e.textSecondary}}function Ce(e){return!0===e.dark?.enabled}function Me(e,t="light"){return"dark"===t&&Ce(e)?"dark":"light"}function $e(e,t="light"){const n=Me(e,t),o="dark"===n?(i=e.colors,r=e.dark,{...Se(i),...r?.colors??{}}):e.colors;var i,r;return{...o,scheme:n,...je(o,n)}}function Re(e,t="light"){return"dark"===t&&e.srcDark?e.srcDark:e.src}function Pe(e,t="light"){return"light"===Me(e,t)?{overlay:e.overlay,boxShadow:e.boxShadow}:{overlay:e.dark?.overlay??e.overlay,boxShadow:e.dark?.boxShadow??e.boxShadow}}const Ie=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/,Ae=new Map;function Fe(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 Ee(e){return!e||null!==Fe(e)}function Te(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 qe=864e5;const Ne=new Map;function ze(e,t){const n=`${e}|${t}`,o=Ne.get(n);if(void 0!==o)return o;const i=function(e,t){const n=Ie.exec((e||"").trim());if(!n)return null;const[,o,i,r,s,a,c]=n.map(Number),l=Number.isNaN(c)?0:c;if(i<1||i>12||r<1||r>31)return null;if(s>23||a>59||l>59)return null;const u=Date.UTC(o,i-1,r,s,a,l),d=new Date(u);if(d.getUTCMonth()!==i-1||d.getUTCDate()!==r)return null;if(!t)return u;const p=Fe(t);if(!p)return null;const h=function(e,t){const n=[];for(const o of[e-qe,e,e+qe]){const e=Te(o,t);n.includes(e)||n.push(e)}return n}(u,p),f=h.filter(e=>Te(u-e,p)===e).map(e=>u-e);return f.length>0?Math.min(...f):u-Math.min(...h)}(e,t);return Ne.size>100&&Ne.clear(),Ne.set(n,i),i}const Le={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 De(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||a.test(t)?t:void 0}function Oe(e){return"_self"===e?{target:"_self"}:{target:"_blank",rel:"noreferrer"}}const Be=new Set(["STRONG","B","EM","I","U","BR","A"]);function He(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(!Be.has(e.tagName)){He(e,t,n);continue}const i=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=De(e.getAttribute("href")??void 0);t&&i.setAttribute("href",t);const{target:n,rel:o}=Oe(e.getAttribute("target"));i.setAttribute("target",n),o&&i.setAttribute("rel",o)}t.appendChild(i),He(e,i,n)}}function _e(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return He(t.body,n,t),n.innerHTML}function Ve(e){return"string"==typeof e&&e?e:void 0}function We(e,t){const n=e.dark;if("object"!=typeof n||null===n)return;const o=n,i="object"==typeof o.colors&&null!==o.colors?o.colors:{},r=Se(t),s=function(e){if("object"!=typeof e||null===e)return;const t=e,n=Ve(t.color);if(!n)return;return{color:n,opacity:"number"==typeof t.opacity&&Number.isFinite(t.opacity)?Math.max(0,Math.min(1,t.opacity)):1}}(o.overlay);return{enabled:!0===o.enabled,colors:{background:Ve(i.background)??r.background,accent:Ve(i.accent)??r.accent,text:Ve(i.text)??r.text,textSecondary:Ve(i.textSecondary)??r.textSecondary,textInverse:Ve(i.textInverse)??r.textInverse},...s?{overlay:s}:{},...Ve(o.boxShadow)?{boxShadow:o.boxShadow}:{}}}function Ue(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 i=function(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:Ve(t.background)??Ve(e.background)??d,accent:Ve(t.accent)??Ve(e.accent)??p,text:Ve(t.text)??h,textSecondary:Ve(t.textSecondary)??f,textInverse:Ve(t.textInverse)??m}}(o),r=We(o,i);return{version:2,params:{...o,colors:i,...r?{dark:r}:{}}}}const Ke=["cover","contain"];function Ze(e){if("object"!=typeof e||null===e)return;const t=e,n=De("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 Je(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=Ze(n.video);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,..."string"==typeof n.srcDark&&n.srcDark?{srcDark:n.srcDark}:{},...e?{video:e}:{},..."string"==typeof n.mediaId&&n.mediaId?{mediaId:n.mediaId}:{},..."string"==typeof n.mediaIdDark&&n.mediaIdDark?{mediaIdDark:n.mediaIdDark}:{},...Ke.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 Ge=["px","%","em","rem","fr"];function Qe(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function Ye(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=Qe(t.min),n=Qe(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>Ge.includes(e)):[],i="length"===t.kind?function(e){if("object"!=typeof e||null===e)return;const t={};for(const n of Ge){const o=e[n];if("object"!=typeof o||null===o)continue;const i=Qe(o.min),r=Qe(o.max);void 0===i&&void 0===r||(t[n]={...void 0!==i?{min:i}:{},...void 0!==r?{max:r}:{}})}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}:{},...i?{ranges:i}:{}}}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 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||!ne.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=Ye(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function et(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}const tt=["email","firstName","lastName","phone","custom"],nt=["primary","secondary"];function ot(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&&tt.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 it=["checkbox","chips"],rt=["nps","stars","thumbs"],st=["instant","button"],at=["keep","hide-popup","page"],ct=/^[a-z]{2}$/i,lt=/^#[0-9a-fA-F]{6}$/;function ut(e,t=120){return"string"==typeof e?e.trim().slice(0,t):""}function dt(e,t,n=120){return ut(e,n)||t}function pt(e){const t=ut(e,8);return ct.test(t)?t.toLowerCase():""}function ht(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=ut(n.value);if(!e)continue;if(t.some(t=>t.value===e))continue;const o=ut(n.tagValue);t.push({value:e,label:dt(n.label,e),...o?{tagValue:o}:{}})}return t}function ft(e,t){const n=e=>{const n=Qe(e);return void 0===n||n<=0?0:Math.min(Math.floor(n),t)},o=n(e.min),i=n(e.max);return{min:o,max:i>0?Math.max(o,i):0}}function mt(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=ut(n.timezone,64),o=Ee(e)?e:"",i=ut(n.endTime,32);if(null===ze(i,o))continue;const r=ut(n.expirePage),s=at.includes(n.onExpire)?n.onExpire:"keep",a="page"!==s||r?s:"keep";t.push({type:"timer",key:n.key,endTime:i,timezone:o,language:pt(n.language),showLabels:!1!==n.showLabels,onExpire:a,..."page"===a?{expirePage:r}:{}});continue}if("choice"===n.type){const e=ht(n.options),{min:o,max:i}=ft(n,e.length);t.push({type:"choice",key:n.key,control:it.includes(n.control)?n.control:"checkbox",tagName:ut(n.tagName),options:e,min:o,max:i,submitLabel:dt(n.submitLabel,$),submitVariant:nt.includes(n.submitVariant)?n.submitVariant:"primary",successMessage:dt(n.successMessage,R,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:rt.includes(n.scale)?n.scale:"stars",labels:{low:ut(e.low),high:ut(e.high)},submitMode:st.includes(n.submitMode)?n.submitMode:"instant",submitLabel:dt(n.submitLabel,P),eventName:ut(n.eventName),successMessage:dt(n.successMessage,I,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:ot(n.fields),submitLabel:"string"==typeof n.submitLabel&&n.submitLabel?n.submitLabel:j,submitVariant:nt.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:C,confirmEmailMessage:"string"==typeof n.confirmEmailMessage&&n.confirmEmailMessage?n.confirmEmailMessage:M});else{if(!T.includes(n.name))continue;t.push({type:"glyph",key:n.key,name:n.name,size:q.includes(n.size)?n.size:q[0],color:"string"==typeof n.color&&lt.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 gt(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:mt(n.slots)}))}return t}function yt(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function bt(e,t,n){if(null===e)return;let o;return o="stretch"===e?"stretch":yt(e)??("stretch"===t?"stretch":yt(t)),"width"===n&&"stretch"===o?void 0:o}function vt(e){const t=[];for(const n of e.pages){const o=Xe(n.values),i=te(re(n.layout,et(o)));if(!i)continue;const r=bt(n.width,e.width,"width"),s=bt(n.height,e.height,"height");t.push({key:n.key,layout:i,images:Je(n.images),contents:gt(n.contents),...void 0!==r?{width:r}:{},...void 0!==s?{height:s}:{}})}return t}function xt(e){return`calc(100% - ${2*e.offset}px)`}const kt="pushwoosh-web-popups",wt="[WebPopups]",St="keyValue",jt="messages",Ct="inboxMessages";function Mt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const $t=[Mt(St,function(e){e.createObjectStore(St,{keyPath:"key"})}),Mt("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})}),Mt(jt,function(e){e.createObjectStore(jt,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),Mt(Ct,function(e){const t="status",n=e.createObjectStore(Ct,{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 $t}}class Pt{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 It(e,t){console.info("onversionchange",t),e.close()}let At;function Ft(e){return(At||(At=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=It.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=It.bind(null,n,t),new Pt(n).applyMigrations()}})),At).then(t=>new Promise((n,o)=>e(t,n,o)))}class Et{_add(e){return Ft((t,n,o)=>{const i=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);i.onsuccess=()=>{n(e)},i.onerror=()=>{o(i.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 Ft((t,n,o)=>{const i=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);i.onsuccess=()=>{n(i.result)},i.onerror=()=>{o(i.error)}})}getAll(){return Ft((e,t,n)=>{const o=[],i=e.transaction(this.name).objectStore(this.name).openCursor();i.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},i.onerror=()=>{n(i.error)}})}}Tt=St;var Tt;const qt=new class extends Et{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)}},Nt=(new class extends Et{constructor(){super(...arguments),this.name=jt,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let zt=3;const Lt={setLevel(e){Nt[e]||(e="error"),zt=Nt[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),qt.add(e,t,n)}};function Dt(e){return async({slotKey:t,tagName:n,values:o})=>{try{await e.api.setTags({[n]:{operation:"append",value:o}})}catch(e){throw Lt.error(e,`Failed to write web popup choice "${t}" to tag "${n}"`),e}}}function Ot(e){return async({slotKey:t,eventName:n,score:o,scale:i})=>{try{await e.api.postEvent(n,{score:o,scale:i,slotKey:t})}catch(e){throw Lt.error(e,`Failed to post web popup rating "${t}" as event "${n}"`),e}}}function Bt(e){return async()=>{try{await e.subscribe()}catch(e){Lt.error(e,"Failed to subscribe from a web popup")}return e.driver?.getPermission()??"default"}}Object.keys(Nt).forEach(e=>{const t=Nt[e];Lt[e]=(...n)=>{t<=zt&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});var Ht=r(247),_t=r(524),Vt=r(873);const Wt="(prefers-color-scheme: dark)";function Ut(e,t){const[n,o]=(0,Vt.useState)(()=>"auto"===e&&t&&"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(Wt).matches);return(0,Vt.useEffect)(()=>{if("auto"!==e||!t||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(Wt),i=e=>o(e.matches);return o(n.matches),n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[e,t]),"auto"!==e?e:n?"dark":"light"}const Kt={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function Zt({slot:e,align:t,inverse:n,colors:o}){const i={...g[e.variant],textAlign:e.align??t},r=b(e.variant,o,n);return r&&(i.color=r),(0,Ht.jsx)("div",{style:i,dangerouslySetInnerHTML:{__html:_e(e.html)}})}function Jt({slot:e,colors:t,onRequestClose:n,onPageChange:o,onRequestSubscribe:i}){const[r,s]=(0,Vt.useState)("idle"),a=w(e.variant,t),c={};if("close"===e.action.type)return(0,Ht.jsx)("div",{style:c,children:(0,Ht.jsx)("button",{type:"button",style:a,onClick:n,children:e.label})});if("page"===e.action.type){const t=e.action.page;return(0,Ht.jsx)("div",{style:c,children:(0,Ht.jsx)("button",{type:"button",style:a,onClick:()=>o(t),children:e.label})})}if("subscribe"===e.action.type){const t="idle"!==r,o=()=>{i&&!t&&(s("asking"),i().then(e=>{"granted"!==e?s("denied"===e?"denied":"idle"):n?.()}).catch(()=>s("idle")))};return(0,Ht.jsx)("div",{style:c,children:(0,Ht.jsx)("button",{type:"button",disabled:t,style:{...a,...t?{opacity:.7}:{}},onClick:o,children:e.label})})}const l=De(e.action.url);return l?(0,Ht.jsx)("div",{style:c,children:(0,Ht.jsx)("a",{href:l,...Oe(e.action.target),style:a,children:e.label})}):(0,Ht.jsx)("div",{style:c,children:(0,Ht.jsx)("button",{type:"button",style:a,children:e.label})})}function Gt({message:e,align:t,inverse:n,colors:o}){const i=b("body",o,n);return(0,Ht.jsx)("div",{style:{...g.body,padding:"4px 0",textAlign:t,...i?{color:i}:{}},children:e})}const Qt=/^\S+@\S+\.\S+$/,Yt={email:"email",phone:"tel"},Xt={email:"email",firstName:"given-name",lastName:"family-name",phone:"tel"},en="__privacy";function tn({slot:e,align:t,inverse:n,colors:o,onSubmitForm:i}){const[r,s]=(0,Vt.useState)({}),[a,c]=(0,Vt.useState)(!1),[l,u]=(0,Vt.useState)(null),[d,p]=(0,Vt.useState)({}),[h,f]=(0,Vt.useState)("idle"),m=b("caption",o,n),y={...g.caption,...m?{color:m}:{}},v={fontSize:12,lineHeight:1.4,color:o.error,paddingTop:2};if("success"===h||"confirm"===h)return(0,Ht.jsx)(Gt,{message:"confirm"===h?e.confirmEmailMessage:e.successMessage,align:t,inverse:n,colors:o});const x="submitting"===h,j=e.privacy?De(e.privacy.url):void 0,C={...w(e.submitVariant,o),...x?{opacity:.6,cursor:"default"}:{}};return(0,Ht.jsxs)("form",{noValidate:!0,style:{margin:0,textAlign:"left"},onSubmit:t=>{t.preventDefault(),(()=>{if(!i||!e.formCode||"submitting"===h)return;const t={};for(const n of e.fields){const e=(r[n.key]??"").trim();n.required&&!e?t[n.key]="Required":"email"===n.kind&&e&&!Qt.test(e)&&(t[n.key]="Enter a valid email")}if(e.privacy&&!a&&(t[en]="Please accept the privacy policy"),p(t),Object.keys(t).length>0)return;const n={email:"",policyAccepted:!e.privacy||a},o={};for(const t of e.fields){const e=(r[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),f("submitting"),Promise.resolve().then(()=>i(e.formCode,n)).then(e=>f("confirm-email"===e?"confirm":"success"),()=>f("error"))})()},children:[e.fields.map(e=>{const t=d[e.key];let n;return t?n=o.error:l===e.key&&(n=o.accent),(0,Ht.jsxs)("div",{style:{padding:"4px 0"},children:[e.label&&(0,Ht.jsx)("div",{style:{...y,paddingBottom:4},children:e.label}),(0,Ht.jsx)("input",{type:Yt[e.kind]??"text",autoComplete:Xt[e.kind],placeholder:e.placeholder||void 0,value:r[e.key]??"",disabled:x,style:S(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 p(e=>e[n]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==n)):e);var n,o}}),t&&(0,Ht.jsx)("div",{style:v,children:t})]},e.key)}),e.privacy&&(0,Ht.jsxs)("div",{style:{padding:"4px 0"},children:[(0,Ht.jsxs)("label",{style:{...y,display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"},children:[(0,Ht.jsx)("input",{type:"checkbox",checked:a,disabled:x,style:{margin:"2px 0 0",flexShrink:0},onChange:e=>{c(e.currentTarget.checked),p(e=>e[en]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==en)):e)}}),(0,Ht.jsxs)("span",{children:[e.privacy.checkboxLabel,j&&(0,Ht.jsxs)(Ht.Fragment,{children:[" ",(0,Ht.jsx)("a",{href:j,...Oe(void 0),style:{color:o.accent},children:e.privacy.linkLabel||e.privacy.url})]})]})]}),d[en]&&(0,Ht.jsx)("div",{style:v,children:d[en]})]}),(0,Ht.jsx)("div",{style:{padding:k},children:(0,Ht.jsx)("button",{type:"submit",disabled:x,style:C,children:e.submitLabel})}),"error"===h&&(0,Ht.jsx)("div",{style:{...v,textAlign:t},children:A})]})}function nn({value:e,label:t,digitStyle:n,labelStyle:o}){return(0,Ht.jsxs)("div",{style:{minWidth:44},children:[(0,Ht.jsx)("div",{style:n,children:String(e).padStart(2,"0")}),t?(0,Ht.jsx)("div",{style:o,children:t}):null]})}function on({slot:e,align:t,inverse:n,colors:o,mode:i,onRequestClose:r,onPageChange:s}){const[a,c]=(0,Vt.useState)(()=>Date.now()),l=function(e,t,n){const o=ze(e,t),i=null===o?0:Math.max(0,o-n),r=Math.floor(i/1e3);return{total:i,days:Math.floor(r/86400),hours:Math.floor(r/3600)%24,minutes:Math.floor(r/60)%60,seconds:r%60}}(e.endTime,e.timezone,a),u=0===l.total;(0,Vt.useEffect)(()=>{if("live"!==i||u)return;const e=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(e)},[i,u,e.endTime,e.timezone]),(0,Vt.useEffect)(()=>{"live"===i&&u&&("hide-popup"===e.onExpire?r?.():"page"===e.onExpire&&e.expirePage&&s(e.expirePage))},[i,u,e.onExpire,e.expirePage,r,s]);const d=b("h2",o,n),p=b("caption",o,n),h={fontSize:28,fontWeight:700,lineHeight:1.2,fontVariantNumeric:"tabular-nums",...d?{color:d}:{}},f={...g.caption,...p?{color:p}:{}},m=(y=e.language,Le[y]??Le.en);var y;const v=[{value:l.days,label:m.days},{value:l.hours,label:m.hours},{value:l.minutes,label:m.minutes},{value:l.seconds,label:m.seconds}];return(0,Ht.jsx)("div",{style:{padding:"4px 0",textAlign:t},children:(0,Ht.jsx)("div",{style:{display:"inline-flex",gap:12,textAlign:"center"},children:v.map(t=>(0,Ht.jsx)(nn,{value:t.value,label:e.showLabels?t.label:"",digitStyle:h,labelStyle:f},t.label||t.value))})})}function rn({slot:e,align:t,inverse:n,colors:o,onSubmitChoice:i}){const[r,s]=(0,Vt.useState)([]),[a,c]=(0,Vt.useState)("idle"),[l,u]=(0,Vt.useState)("");if("success"===a)return(0,Ht.jsx)(Gt,{message:e.successMessage,align:t,inverse:n,colors:o});const d=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])},p="submitting"===a,h=b("body",o,n),f={...g.body,...h?{color:h}:{}};return(0,Ht.jsxs)("div",{style:{padding:"4px 0"},children:["chips"===e.control?(0,Ht.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"===t?"center":"flex-start"},children:e.options.map(e=>{return(0,Ht.jsx)("button",{type:"button","aria-pressed":r.includes(e.value),style:(t=r.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:()=>d(e.value),children:e.label},e.value);var t})}):(0,Ht.jsx)("div",{style:{display:"grid",gap:6},children:e.options.map(e=>(0,Ht.jsxs)("label",{style:{...f,display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[(0,Ht.jsx)("input",{type:"checkbox",checked:r.includes(e.value),onChange:()=>d(e.value),style:{accentColor:o.accent,width:16,height:16,margin:0}}),e.label]},e.value))}),l?(0,Ht.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:l}):null,"error"===a?(0,Ht.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:A}):null,(0,Ht.jsx)("div",{style:{padding:k},children:(0,Ht.jsx)("button",{type:"button",style:{...w(e.submitVariant,o),...p?{opacity:.7}:{}},onClick:()=>{if(!i||!e.tagName||"submitting"===a)return;const t=Math.max(e.min,1);if(r.length<t)return void u(1===t?"Pick at least one":`Pick at least ${t}`);const n=e.options.filter(e=>r.includes(e.value)).map(e=>e.tagValue||e.value);u(""),c("submitting"),Promise.resolve().then(()=>i({slotKey:e.key,tagName:e.tagName,values:n})).then(()=>c("success"),()=>c("error"))},children:e.submitLabel})})]})}function sn({score:e,scale:t,selected:n,colors:o,onPick:i}){const r={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(0,Ht.jsx)("button",{type:"button","aria-label":`Rate ${e}`,"aria-pressed":n,style:{...r,width:30,height:32,borderRadius:6},onClick:i,children:e});const s="thumbs"===t;let a=`Rate ${e}`;return s&&(a=1===e?"Thumbs up":"Thumbs down"),(0,Ht.jsx)("button",{type:"button","aria-label":a,"aria-pressed":n,style:{...r,width:s?44:34,height:s?40:34,borderRadius:s?8:6},onClick:i,children:(0,Ht.jsx)("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",children:(0,Ht.jsx)("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":E.star,...s&&0===e?{transform:"rotate(180 12 12)"}:{}})})})}function an({slot:e,align:t,inverse:n,colors:o,onSubmitRating:i}){const[r,s]=(0,Vt.useState)(null),[a,c]=(0,Vt.useState)("idle");if("success"===a)return(0,Ht.jsx)(Gt,{message:e.successMessage,align:t,inverse:n,colors:o});const l=t=>{i&&e.eventName&&"submitting"!==a&&(c("submitting"),Promise.resolve().then(()=>i({slotKey:e.key,eventName:e.eventName,score:t,scale:e.scale})).then(()=>c("success"),()=>c("error")))},u="nps"===(d=e.scale)?[0,1,2,3,4,5,6,7,8,9,10]:"stars"===d?[1,2,3,4,5]:[0,1];var d;const p=b("caption",o,n),h={...g.caption,...p?{color:p}:{}},f=t=>"stars"===e.scale?null!==r&&t<=r:r===t;return(0,Ht.jsxs)("div",{style:{padding:"4px 0"},children:[(0,Ht.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6,justifyContent:"center"===t?"center":"flex-start"},children:u.map(t=>(0,Ht.jsx)(sn,{score:t,scale:e.scale,selected:f(t),colors:o,onPick:()=>(t=>{"submitting"!==a&&(s(t),"instant"===e.submitMode&&l(t))})(t)},t))}),e.labels.low||e.labels.high?(0,Ht.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,paddingTop:4},children:[(0,Ht.jsx)("span",{style:h,children:e.labels.low}),(0,Ht.jsx)("span",{style:h,children:e.labels.high})]}):null,"error"===a?(0,Ht.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:A}):null,"button"===e.submitMode?(0,Ht.jsx)("div",{style:{padding:k},children:(0,Ht.jsx)("button",{type:"button",style:{...w("primary",o),..."submitting"===a?{opacity:.7}:{}},onClick:()=>null===r?void 0:l(r),children:e.submitLabel})}):null]})}function cn({slot:e,align:t,inverse:n,colors:o}){const i=e.color||(n?o.textInverse:o.accent);return(0,Ht.jsx)("div",{style:{padding:"4px 0",textAlign:t,lineHeight:0},children:(0,Ht.jsx)("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"inline-block"},children:(0,Ht.jsx)("path",{d:E[e.name]})})})}function ln({slot:e,align:t,inverse:n,colors:o,mode:i="live",onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u}){const d=s??(()=>{});switch(e.type){case"text":return(0,Ht.jsx)(Zt,{slot:e,align:t,inverse:n,colors:o});case"button":return(0,Ht.jsx)(Jt,{slot:e,colors:o,onRequestClose:r,onPageChange:d,onRequestSubscribe:u});case"email-subscription-form":return(0,Ht.jsx)(tn,{slot:e,align:t,inverse:n,colors:o,onSubmitForm:a});case"timer":return(0,Ht.jsx)(on,{slot:e,align:t,inverse:n,colors:o,mode:i,onRequestClose:r,onPageChange:d});case"choice":return(0,Ht.jsx)(rn,{slot:e,align:t,inverse:n,colors:o,onSubmitChoice:c});case"rating":return(0,Ht.jsx)(an,{slot:e,align:t,inverse:n,colors:o,onSubmitRating:l});case"glyph":return(0,Ht.jsx)(cn,{slot:e,align:t,inverse:n,colors:o})}}function un({node:e,page:t,colors:n,mode:o,leaf:i,onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u}){const d=t.contents.find(t=>t.key===e.props.content);if(!d)return null;if(i?.renderZone)return(0,Ht.jsx)("div",{style:{minWidth:0},children:i.renderZone(d,e)});const p=e.props.align??"left",h="inverse"===e.props.tone;return(0,Ht.jsx)("div",{style:{minWidth:0},children:d.slots.map((e,t)=>{const i=d.slots[t-1],f=i?(m=x(i),"action"===(g=x(e))?"action"===m?6:16:"text"===g&&"heading"===m?4:8):0;var m,g;return(0,Ht.jsx)("div",{style:f?{marginTop:f}:void 0,children:(0,Ht.jsx)(ln,{slot:e,align:p,inverse:h,colors:n,mode:o,onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u})},e.key)})})}function dn(e){return e?.video?De(e.video.src):void 0}function pn({image:e,poster:t,src:n,style:o,mode:i}){return(0,Ht.jsx)("video",{src:n,poster:t||void 0,style:o,autoPlay:"live"===i,muted:!0,playsInline:!0,preload:"metadata",loop:!1!==e.video?.loop,controls:!0===e.video?.controls})}function hn({node:e,page:t,leaf:n,mode:o,scheme:i}){const r=t.images.find(t=>t.key===e.props.image);if(!r)return null;if(n?.renderImage)return(0,Ht.jsx)(Ht.Fragment,{children:n.renderImage(r,e)});const s=dn(r),a=Re(r,i);if(!a&&!s)return null;const c={display:"block",width:"100%",minWidth:0};return r.fit?(c.height="100%",c.objectFit=r.fit):c.height="auto",r.blur&&(c.filter=`blur(${r.blur}px)`),s?(0,Ht.jsx)(pn,{image:r,poster:a,src:s,style:c,mode:o}):(0,Ht.jsx)("img",{src:a,alt:"",style:c})}function fn({style:e,outer:t,inner:n,layer:o,children:i}){const{backgroundColor:r,...s}=e;return(0,Ht.jsxs)("div",{style:{display:"grid",minWidth:0,backgroundColor:r,...t},children:[o,(0,Ht.jsx)("div",{style:{...s,...n},children:i})]})}function mn({node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d}){if("Content"===e.type)return(0,Ht.jsx)(un,{node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d});if("Image"===e.type)return(0,Ht.jsx)(hn,{node:e,page:t,leaf:r,mode:o,scheme:i});const p=e.props?.backgroundImage,h=p?t.images.find(e=>e.key===p):void 0,f=h?.blur??0,m=h?.dim??0,g=dn(h),y=h?Re(h,i):void 0,b=pe(e,f>0||g?void 0:y||void 0,m);p&&(b.backgroundColor="#1D2939");const v=e.children.map((e,p)=>(0,Ht.jsx)(mn,{node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d},p));if(g&&h){const e=ue(m);return(0,Ht.jsx)(fn,{style:b,outer:{position:"relative",overflow:"hidden",...y?de(y):{}},inner:{position:"relative",...e?{backgroundImage:e}:{}},layer:(0,Ht.jsx)(pn,{image:h,poster:y??"",src:g,mode:o,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",...f>0?{filter:`blur(${f}px)`}:{}}}),children:v})}return f>0?(0,Ht.jsx)(fn,{style:b,outer:y?de(y,m):void 0,inner:{backdropFilter:`blur(${f}px)`,WebkitBackdropFilter:`blur(${f}px)`},children:v}):(0,Ht.jsx)("div",{style:b,children:v})}function gn({page:e,params:t,mode:n="live",colorScheme:o="light",leafRenderers:i,animatePage:r=!1,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d}){const p=$e(t,o),h=Pe(t,o),f={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:p.background,colorScheme:p.scheme,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:p.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:h.boxShadow&&"none"!==h.boxShadow?h.boxShadow:void 0,transition:"height 300ms ease"};e.height&&(f.height="stretch"===e.height?"100%":e.height,f.overflowY="auto");const m={...r?{animation:"pw-vpopup-page 300ms ease-out backwards"}:{},..."stretch"===e.height?{display:"grid",minHeight:"100%"}:{}};return(0,Ht.jsx)("div",{style:f,children:(0,Ht.jsx)("div",{style:m,children:(0,Ht.jsx)(mn,{node:e.layout,page:e,colors:p,mode:n,scheme:p.scheme,leaf:i,onRequestClose:s,onPageChange:a??(()=>{}),onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d})},e.key)})}function yn({colors:e,onRequestClose:t}){return(0,Ht.jsx)("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:ke(e.surface,.92),boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:e.chromeIcon,fontSize:13,lineHeight:1,cursor:"pointer"},children:"✕"})}function bn(e,t,n){const{placement:o}=e,i={position:"fixed",boxSizing:"border-box",maxWidth:xt(o),maxHeight:xt(o),pointerEvents:"auto"};if(t){i.width=t;const e=o.h;"left"===e?i.left=o.offset:"right"===e?i.right=o.offset:i.left="50%"}else i.left=o.offset,i.right=o.offset;"stretch"===n?(i.top=o.offset,i.bottom=o.offset):"top"===o.v?i.top=o.offset:"bottom"===o.v?i.bottom=o.offset:i.top="50%";const r=t&&"center"===o.h?"-50%":"0",s="middle"===o.v&&"stretch"!==n?"-50%":"0";"0"===r&&"0"===s||(i.transform=`translate(${r}, ${s})`);const a=Kt[e.animation];return a&&(i.animation=a),i.transition="width 300ms ease",i}function vn({params:e,mode:t="live",colorScheme:n="auto",onRequestClose:o,onSubmitForm:i,onSubmitChoice:r,onSubmitRating:s,onRequestSubscribe:a,leafRenderers:c}){const[l,u]=(0,Vt.useState)(null);(0,Vt.useEffect)(()=>{vt(e).forEach(e=>e.images.forEach(({src:e,srcDark:t})=>{[e,t].forEach(e=>{e&&((new Image).src=e)})}))},[e]);const d=Ut(n,Ce(e)),p=vt(e);if(0===p.length)return null;const h=p.find(e=>e.key===l)??function(e,t){return t.find(t=>t.key===e.startPage)??t[0]}(e,p),f=null!==l;if("preview"===t)return(0,Ht.jsxs)("div",{style:{position:"relative",width:h.width??"100%",transition:"width 300ms ease"},children:[(0,Ht.jsx)("style",{children:F}),(0,Ht.jsx)(gn,{page:h,params:e,mode:t,colorScheme:d,leafRenderers:c,animatePage:f,onRequestClose:o,onPageChange:u,onSubmitForm:i,onSubmitChoice:r,onSubmitRating:s,onRequestSubscribe:a})]});const{overlay:m}=Pe(e,d);return(0,Ht.jsxs)(Ht.Fragment,{children:[(0,Ht.jsx)("style",{children:F}),m&&(0,Ht.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:m.color,opacity:m.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:o}),(0,Ht.jsxs)("div",{style:bn(e,h.width,h.height),children:[(0,Ht.jsx)(gn,{page:h,params:e,mode:t,colorScheme:d,leafRenderers:c,animatePage:f,onRequestClose:o,onPageChange:u,onSubmitForm:i,onSubmitChoice:r,onSubmitRating:s,onRequestSubscribe:a}),(0,Ht.jsx)(yn,{colors:$e(e,d),onRequestClose:o})]})]})}const xn={SUBMIT_FORM_RESULT_SUBSCRIBED:"subscribed",SUBMIT_FORM_RESULT_CONFIRM_EMAIL:"confirm-email",SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED:"already-subscribed"},kn=(e,t)=>`https://subscription-form.svc-nue.pushwoosh.com/api/v1/forms/code/${encodeURIComponent(e)}${t}`,wn=async(e,t)=>{try{const n=await fetch(kn(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(),i=xn[o.result??""];if(!i)throw new Error(`Subscription form submit failed: unexpected result "${o.result}"`);return i}catch(t){throw Lt.error(t,`Failed to submit subscription form "${e}"`),t}};class Sn{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:Dt(e),onSubmitRating:Ot(e),onRequestSubscribe:Bt(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";const t=await e.data.getFeatures();if(!1===t?.popup_forms?.enabled)return void Lt.debug(`${wt} application has no active popup forms, skipping`);await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const n=await e.api.getPopupForms();Lt.debug(`${wt} Received ${n.length} popup(s) from server:`,n.map(e=>e.code)),n.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 o=this.loadedCodes();Lt.debug(`${wt} ${o.length} popup(s) passed strong conditions and loaded:`,o),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 Lt.error(new Error("Unknown web popup code"),`${wt} 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&&(Lt.debug(`${wt} show("${e}") preempting "${this.visible.code}"`),this.visible.close("preempted")),this.detachFromAutoPipeline(t),this.present(t,"api"),!0):(Lt.error(new Error("Web popup content unavailable"),`${wt} 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=>(Lt.error(t,`${wt} 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=Ue(e);return t?0===vt(t.params).length?null:t.params:null})((await this.pw.api.getPopupFormContent(e.popup_form_content_code)).json);return t||(Lt.error(new Error("Unsupported popup content format"),`${wt} 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))}),Lt.debug(`${wt} ${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;Lt.debug(`${wt} 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),Lt.debug(`${wt} 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=>{Lt.error(t,`${wt} 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",Lt.debug(`${wt} 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();Lt.debug(`${wt} 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 i=document.createElement("div");i.id=`${kt}-${n.code}`,i.style.position="fixed",i.style.inset="0",i.style.zIndex=String(2147483647),i.style.pointerEvents="none",document.body.appendChild(i);const r=i.attachShadow({mode:"open"}),s=document.createElement("div");r.appendChild(s);const a=!!o.overlay;a&&this.lockBodyScroll();let c=!1;const l=t=>{c||(c=!0,a&&this.unlockBodyScroll(),(e=>{(0,_t.render)(null,e)})(s),i.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:i,modal:a,close:l},e.state="visible",((e,t,n,o,i="auto")=>{(0,_t.render)((0,Ht.jsx)(vn,{params:t,mode:"live",colorScheme:i,onRequestClose:n,onSubmitForm:wn,onSubmitChoice:o.onSubmitChoice,onSubmitRating:o.onSubmitRating,onRequestSubscribe:o.onRequestSubscribe}),e)})(s,o,()=>l("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(kn(e,"/view"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,userId:t,hwid:t})}).catch(t=>{Lt.error(t,`Failed to record subscription form view for "${e}"`)})})(t,e))).catch(e=>{Lt.error(e,`${wt} Failed to record subscription form views for web popup "${n.code}"`)}),Lt.debug(`${wt} Popup "${n.code}" shown (trigger: ${t})`),this.recordVisit(e),this.markAsShown(n).catch(e=>{Lt.error(e,`${wt} 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=ze(n.endTime,e);if(null!==o&&o<=t)return!0}return!1}(e.content,Date.now())||(Lt.debug(`${wt} 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,i=window.location.pathname;return n&&n.length>0?n.some(e=>this.matchPageRule(i,e)):t&&t.length>0?t.includes(i):!(o&&o.length>0)||!o.some(e=>this.matchPageRule(i,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=>{Lt.error(t,`${wt} 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`${kt}.shown.${e}`}}return s})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("preact"),require("preact/compat"),require("preact/jsx-runtime"));else if("function"==typeof define&&define.amd)define(["preact","preact/compat","preact/jsx-runtime"],t);else{var n="object"==typeof exports?t(require("preact"),require("preact/compat"),require("preact/jsx-runtime")):t(e.preact,e.preactCompat,e.jsxRuntime);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,(e,t,n)=>(()=>{"use strict";var o={524(t){t.exports=e},873(e){e.exports=t},247(e){e.exports=n}};const i={};function r(e){const t=i[e];if(void 0!==t)return t.exports;const n=i[e]={exports:{}};return o[e](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};let s={};r.r(s),r.d(s,{WebPopupsWidget:()=>Sn});const a=/^(https?:|mailto:|tel:)/i,c="#101828",l="#667085",u="#FFFFFF",d="#FFFFFF",p="#2970FF",h=c,f=l,m="#FFFFFF",g={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}},y={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function b(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,[i,r,s]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${i}, ${r}, ${s}, ${t})`}(t.textInverse,y[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const v=["h1","h2","h3","icon"];function x(e){return"glyph"===e.type?"heading":"text"!==e.type?"action":v.includes(e.variant)?"heading":"text"}const k="8px 0 4px";function w(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 S(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 j="Subscribe",C="Thanks for subscribing!",M="Please check your inbox and confirm your email.",$="Save",R="Thanks! Your choice is saved.",P="Send",I="Thanks for the feedback!";const A="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",F={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"},T=Object.keys(F),q=[24,32,48],N=["Vertical","Horizontal","Columns","Rows"],z=["normal","reverse"],L=["start","center","end","stretch"],D=["start","center","end","space-between"],O=["left","center","right"],_=["default","inverse"],B=2e3,H={px:B,"%":100,em:125,rem:125},V=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,W={px:B,"%":100,fr:100},U=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,K=["auto","min-content","max-content"];function Z(e,t){return t.includes(e)?e:void 0}function J(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),B);if("string"!=typeof e)return;const t=V.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),H[o])}${o}`}const Y=["top","right","bottom","left"];function G(e){if(K.includes(e))return e;const t=U.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),W[o])}${o}`}function Q(e){return"string"==typeof e&&e.length>0?e:void 0}function X(e){const t={},n=J(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=J(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of Y){const o=J(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 i=Z(e.alignItems,L);i&&(t.alignItems=i);const r=Z(e.justifyContent,D);r&&(t.justifyContent=r);const s=Z(e.alignContent,D);s&&(t.alignContent=s);const a=Q(e.backgroundImage);a&&(t.backgroundImage=a);const c=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(G);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==c&&(t.sizes=c),t}function ee(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,i="object"==typeof o.props&&null!==o.props?o.props:{};if("Content"===o.type){const e=Q(i.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=Z(i.align,O);n&&(t.props.align=n);const o=Z(i.tone,_);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=Q(i.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const r=Z(o.type,N)??"Vertical",s=[];for(const e of o.children){const o=ee(e,t+1,n);o&&s.push(o)}const a=X(i);return"reverse"===Z(i.order,z)&&(s.reverse(),"string"==typeof a.sizes&&(a.sizes=a.sizes.split(" ").reverse().join(" "))),{type:r,props:a,children:s}}function te(e){return ee(e,0,{nodes:100})}const ne=/^[a-zA-Z][a-zA-Z0-9-]*$/,oe=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function ie(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=oe.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function re(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:ae(e,t,0)}const se=new Set(["content","image","backgroundImage"]);function ae(e,t,n){if(n>10||"object"!=typeof e||null===e)return e;const o=e,i={...o};if("object"==typeof o.props&&null!==o.props){const e={...o.props};for(const[n,o]of Object.entries(e))if(!se.has(n))if("string"==typeof o)e[n]=ie(o,t);else if("object"==typeof o&&null!==o&&!Array.isArray(o)){const i={...o};for(const[e,n]of Object.entries(i))"string"==typeof n&&(i[e]=ie(n,t));e[n]=i}i.props=e}return Array.isArray(o.children)&&(i.children=o.children.map(e=>ae(e,t,n+1))),i}function ce(e){return"number"==typeof e?`${e}px`:e}function le(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function ue(e=0){if(!(e>0))return null;const t=`rgba(16, 24, 40, ${Math.min(e,1)})`;return`linear-gradient(${t}, ${t})`}function de(e,t=0){const n=`url(${JSON.stringify(e)})`,o=ue(t);return{backgroundImage:o?`${o}, ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function pe(e,t,n=0){const o=e.props??{},i={display:"grid",minWidth:0};return"Horizontal"===e.type&&(i.gridAutoFlow="column"),"Columns"===e.type&&(i.gridTemplateColumns=le(o.sizes,e.children.length)),"Rows"===e.type&&(i.gridTemplateRows=le(o.sizes,e.children.length)),void 0!==o.gap&&(i.gap=ce(o.gap)),void 0!==o.padding&&(i.padding=function(e){if("number"==typeof e||"string"==typeof e)return ce(e);const t=e=>void 0===e?"0":ce(e);return`${t(e.top)} ${t(e.right)} ${t(e.bottom)} ${t(e.left)}`}(o.padding)),o.alignItems&&(i.alignItems=o.alignItems),o.justifyContent&&(i.justifyContent=o.justifyContent),o.alignContent&&(i.alignContent=o.alignContent),t&&Object.assign(i,de(t,n)),i}const he=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function fe(e){const t=he.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 me([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 ge(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 ye(e){return e>.5?.07+.86*(1-e):e}function be(e){return e<.5?.93-e*((.93-.5)/.5):e}function ve(e,t){const n=fe(e);if(!n)return e;const[o,i,r]=function([e,t,n]){const[o,i,r]=[e/255,t/255,n/255],s=Math.max(o,i,r),a=Math.min(o,i,r),c=(s+a)/2;if(s===a)return[0,0,c];const l=s-a;let u;return u=s===o?(i-r)/l+(i<r?6:0):s===i?(r-o)/l+2:(o-i)/l+4,[u/6,c>.5?l/(2-s-a):l/(s+a),c]}(n);return me(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,i=2*n-o;return[255*ge(i,o,e+1/3),255*ge(i,o,e),255*ge(i,o,e-1/3)]}([o,i,"fold"===t?ye(r):be(r)]))}function xe(e,t,n){const o=fe(e),i=fe(t);return o&&i?me(o.map((e,t)=>e+(i[t]-e)*n)):e}function ke(e,t){const n=fe(e);if(!n||t>=1)return e;const[o,i,r]=n;return`rgba(${o}, ${i}, ${r}, ${t})`}function we(e){const t=fe(e);if(!t)return!1;const[n,o,i]=t;return(.299*n+.587*o+.114*i)/255>.6}function Se(e){return{background:ve(e.background,"fold"),accent:e.accent,text:ve(e.text,"lift"),textSecondary:ve(e.textSecondary,"lift"),textInverse:e.textInverse}}function je(e,t){return"light"===t?{surface:d,surfaceText:c,border:"#D0D5DD",onAccent:u,error:"#D92D20",chromeIcon:l}:{surface:xe(e.background,e.text,.08),surfaceText:e.text,border:xe(e.background,e.text,.24),onAccent:we(e.accent)?c:u,error:"#FDA29B",chromeIcon:e.textSecondary}}function Ce(e){return!0===e.dark?.enabled}function Me(e,t="light"){return"dark"===t&&Ce(e)?"dark":"light"}function $e(e,t="light"){const n=Me(e,t),o="dark"===n?(i=e.colors,r=e.dark,{...Se(i),...r?.colors??{}}):e.colors;var i,r;return{...o,scheme:n,...je(o,n)}}function Re(e,t="light"){return"dark"===t&&e.srcDark?e.srcDark:e.src}function Pe(e,t="light"){return"light"===Me(e,t)?{overlay:e.overlay,boxShadow:e.boxShadow}:{overlay:e.dark?.overlay??e.overlay,boxShadow:e.dark?.boxShadow??e.boxShadow}}const Ie=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/,Ae=new Map;function Ee(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 Fe(e){return!e||null!==Ee(e)}function Te(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 qe=864e5;const Ne=new Map;function ze(e,t){const n=`${e}|${t}`,o=Ne.get(n);if(void 0!==o)return o;const i=function(e,t){const n=Ie.exec((e||"").trim());if(!n)return null;const[,o,i,r,s,a,c]=n.map(Number),l=Number.isNaN(c)?0:c;if(i<1||i>12||r<1||r>31)return null;if(s>23||a>59||l>59)return null;const u=Date.UTC(o,i-1,r,s,a,l),d=new Date(u);if(d.getUTCMonth()!==i-1||d.getUTCDate()!==r)return null;if(!t)return u;const p=Ee(t);if(!p)return null;const h=function(e,t){const n=[];for(const o of[e-qe,e,e+qe]){const e=Te(o,t);n.includes(e)||n.push(e)}return n}(u,p),f=h.filter(e=>Te(u-e,p)===e).map(e=>u-e);return f.length>0?Math.min(...f):u-Math.min(...h)}(e,t);return Ne.size>100&&Ne.clear(),Ne.set(n,i),i}const Le={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 De(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||a.test(t)?t:void 0}function Oe(e){return"_self"===e?{target:"_self"}:{target:"_blank",rel:"noreferrer"}}const _e=new Set(["STRONG","B","EM","I","U","BR","A"]);function Be(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(!_e.has(e.tagName)){Be(e,t,n);continue}const i=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=De(e.getAttribute("href")??void 0);t&&i.setAttribute("href",t);const{target:n,rel:o}=Oe(e.getAttribute("target"));i.setAttribute("target",n),o&&i.setAttribute("rel",o)}t.appendChild(i),Be(e,i,n)}}function He(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return Be(t.body,n,t),n.innerHTML}function Ve(e){return"string"==typeof e&&e?e:void 0}function We(e,t){const n=e.dark;if("object"!=typeof n||null===n)return;const o=n,i="object"==typeof o.colors&&null!==o.colors?o.colors:{},r=Se(t),s=function(e){if("object"!=typeof e||null===e)return;const t=e,n=Ve(t.color);if(!n)return;return{color:n,opacity:"number"==typeof t.opacity&&Number.isFinite(t.opacity)?Math.max(0,Math.min(1,t.opacity)):1}}(o.overlay);return{enabled:!0===o.enabled,colors:{background:Ve(i.background)??r.background,accent:Ve(i.accent)??r.accent,text:Ve(i.text)??r.text,textSecondary:Ve(i.textSecondary)??r.textSecondary,textInverse:Ve(i.textInverse)??r.textInverse},...s?{overlay:s}:{},...Ve(o.boxShadow)?{boxShadow:o.boxShadow}:{}}}function Ue(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 i=function(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:Ve(t.background)??Ve(e.background)??d,accent:Ve(t.accent)??Ve(e.accent)??p,text:Ve(t.text)??h,textSecondary:Ve(t.textSecondary)??f,textInverse:Ve(t.textInverse)??m}}(o),r=We(o,i);return{version:2,params:{...o,colors:i,...r?{dark:r}:{}}}}const Ke=["cover","contain"];function Ze(e){if("object"!=typeof e||null===e)return;const t=e,n=De("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 Je(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=Ze(n.video);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,..."string"==typeof n.srcDark&&n.srcDark?{srcDark:n.srcDark}:{},...e?{video:e}:{},..."string"==typeof n.mediaId&&n.mediaId?{mediaId:n.mediaId}:{},..."string"==typeof n.mediaIdDark&&n.mediaIdDark?{mediaIdDark:n.mediaIdDark}:{},...Ke.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 Ye=["px","%","em","rem","fr"];function Ge(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function Qe(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=Ge(t.min),n=Ge(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>Ye.includes(e)):[],i="length"===t.kind?function(e){if("object"!=typeof e||null===e)return;const t={};for(const n of Ye){const o=e[n];if("object"!=typeof o||null===o)continue;const i=Ge(o.min),r=Ge(o.max);void 0===i&&void 0===r||(t[n]={...void 0!==i?{min:i}:{},...void 0!==r?{max:r}:{}})}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}:{},...i?{ranges:i}:{}}}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 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||!ne.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=Qe(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function et(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}const tt=["email","firstName","lastName","phone","custom"],nt=["primary","secondary"];function ot(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&&tt.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 it=["checkbox","chips"],rt=["nps","stars","thumbs"],st=["instant","button"],at=["keep","hide-popup","page"],ct=/^[a-z]{2}$/i,lt=/^#[0-9a-fA-F]{6}$/;function ut(e,t=120){return"string"==typeof e?e.trim().slice(0,t):""}function dt(e,t,n=120){return ut(e,n)||t}function pt(e){const t=ut(e,8);return ct.test(t)?t.toLowerCase():""}function ht(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=ut(n.value);if(!e)continue;if(t.some(t=>t.value===e))continue;const o=ut(n.tagValue);t.push({value:e,label:dt(n.label,e),...o?{tagValue:o}:{}})}return t}function ft(e,t){const n=e=>{const n=Ge(e);return void 0===n||n<=0?0:Math.min(Math.floor(n),t)},o=n(e.min),i=n(e.max);return{min:o,max:i>0?Math.max(o,i):0}}function mt(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=ut(n.timezone,64),o=Fe(e)?e:"",i=ut(n.endTime,32);if(null===ze(i,o))continue;const r=ut(n.expirePage),s=at.includes(n.onExpire)?n.onExpire:"keep",a="page"!==s||r?s:"keep";t.push({type:"timer",key:n.key,endTime:i,timezone:o,language:pt(n.language),showLabels:!1!==n.showLabels,onExpire:a,..."page"===a?{expirePage:r}:{}});continue}if("choice"===n.type){const e=ht(n.options),{min:o,max:i}=ft(n,e.length);t.push({type:"choice",key:n.key,control:it.includes(n.control)?n.control:"checkbox",tagName:ut(n.tagName),options:e,min:o,max:i,submitLabel:dt(n.submitLabel,$),submitVariant:nt.includes(n.submitVariant)?n.submitVariant:"primary",successMessage:dt(n.successMessage,R,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:rt.includes(n.scale)?n.scale:"stars",labels:{low:ut(e.low),high:ut(e.high)},submitMode:st.includes(n.submitMode)?n.submitMode:"instant",submitLabel:dt(n.submitLabel,P),eventName:ut(n.eventName),successMessage:dt(n.successMessage,I,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:ot(n.fields),submitLabel:"string"==typeof n.submitLabel&&n.submitLabel?n.submitLabel:j,submitVariant:nt.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:C,confirmEmailMessage:"string"==typeof n.confirmEmailMessage&&n.confirmEmailMessage?n.confirmEmailMessage:M});else{if(!T.includes(n.name))continue;t.push({type:"glyph",key:n.key,name:n.name,size:q.includes(n.size)?n.size:q[0],color:"string"==typeof n.color&&lt.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 gt(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:mt(n.slots)}))}return t}function yt(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function bt(e,t,n){if(null===e)return;let o;return o="stretch"===e?"stretch":yt(e)??("stretch"===t?"stretch":yt(t)),"width"===n&&"stretch"===o?void 0:o}function vt(e){const t=[];for(const n of e.pages){const o=Xe(n.values),i=te(re(n.layout,et(o)));if(!i)continue;const r=bt(n.width,e.width,"width"),s=bt(n.height,e.height,"height");t.push({key:n.key,layout:i,images:Je(n.images),contents:gt(n.contents),...void 0!==r?{width:r}:{},...void 0!==s?{height:s}:{}})}return t}function xt(e){return`calc(100% - ${2*e.offset}px)`}const kt="pushwoosh-web-popups",wt="[WebPopups]",St="keyValue",jt="messages",Ct="inboxMessages";function Mt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const $t=[Mt(St,function(e){e.createObjectStore(St,{keyPath:"key"})}),Mt("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})}),Mt(jt,function(e){e.createObjectStore(jt,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),Mt(Ct,function(e){const t="status",n=e.createObjectStore(Ct,{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 $t}}class Pt{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 It(e,t){console.info("onversionchange",t),e.close()}let At;function Et(e){return(At||(At=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=It.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=It.bind(null,n,t),new Pt(n).applyMigrations()}})),At).then(t=>new Promise((n,o)=>e(t,n,o)))}class Ft{_add(e){return Et((t,n,o)=>{const i=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);i.onsuccess=()=>{n(e)},i.onerror=()=>{o(i.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 Et((t,n,o)=>{const i=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);i.onsuccess=()=>{n(i.result)},i.onerror=()=>{o(i.error)}})}getAll(){return Et((e,t,n)=>{const o=[],i=e.transaction(this.name).objectStore(this.name).openCursor();i.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},i.onerror=()=>{n(i.error)}})}}Tt=St;var Tt;const qt=new class extends Ft{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)}},Nt=(new class extends Ft{constructor(){super(...arguments),this.name=jt,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let zt=3;const Lt={setLevel(e){Nt[e]||(e="error"),zt=Nt[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),qt.add(e,t,n)}};function Dt(e){return async({slotKey:t,tagName:n,values:o})=>{try{await e.api.setTags({[n]:{operation:"append",value:o}})}catch(e){throw Lt.error(e,`Failed to write web popup choice "${t}" to tag "${n}"`),e}}}function Ot(e){return async({slotKey:t,eventName:n,score:o,scale:i})=>{try{await e.api.postEvent(n,{score:o,scale:i,slotKey:t})}catch(e){throw Lt.error(e,`Failed to post web popup rating "${t}" as event "${n}"`),e}}}function _t(e){return async()=>{try{await e.subscribe()}catch(e){Lt.error(e,"Failed to subscribe from a web popup")}return e.driver?.getPermission()??"default"}}Object.keys(Nt).forEach(e=>{const t=Nt[e];Lt[e]=(...n)=>{t<=zt&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});var Bt=r(247),Ht=r(524),Vt=r(873);const Wt="(prefers-color-scheme: dark)";function Ut(e,t){const[n,o]=(0,Vt.useState)(()=>"auto"===e&&t&&"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(Wt).matches);return(0,Vt.useEffect)(()=>{if("auto"!==e||!t||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(Wt),i=e=>o(e.matches);return o(n.matches),n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[e,t]),"auto"!==e?e:n?"dark":"light"}const Kt={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function Zt({slot:e,align:t,inverse:n,colors:o}){const i={...g[e.variant],textAlign:e.align??t},r=b(e.variant,o,n);return r&&(i.color=r),(0,Bt.jsx)("div",{style:i,dangerouslySetInnerHTML:{__html:He(e.html)}})}function Jt({slot:e,colors:t,onRequestClose:n,onPageChange:o,onRequestSubscribe:i}){const[r,s]=(0,Vt.useState)("idle"),a=w(e.variant,t),c={};if("close"===e.action.type)return(0,Bt.jsx)("div",{style:c,children:(0,Bt.jsx)("button",{type:"button",style:a,onClick:n,children:e.label})});if("page"===e.action.type){const t=e.action.page;return(0,Bt.jsx)("div",{style:c,children:(0,Bt.jsx)("button",{type:"button",style:a,onClick:()=>o(t),children:e.label})})}if("subscribe"===e.action.type){const t="idle"!==r,o=()=>{i&&!t&&(s("asking"),i().then(e=>{"granted"!==e?s("denied"===e?"denied":"idle"):n?.()}).catch(()=>s("idle")))};return(0,Bt.jsx)("div",{style:c,children:(0,Bt.jsx)("button",{type:"button",disabled:t,style:{...a,...t?{opacity:.7}:{}},onClick:o,children:e.label})})}const l=De(e.action.url);return l?(0,Bt.jsx)("div",{style:c,children:(0,Bt.jsx)("a",{href:l,...Oe(e.action.target),style:a,children:e.label})}):(0,Bt.jsx)("div",{style:c,children:(0,Bt.jsx)("button",{type:"button",style:a,children:e.label})})}function Yt({message:e,align:t,inverse:n,colors:o}){const i=b("body",o,n);return(0,Bt.jsx)("div",{style:{...g.body,padding:"4px 0",textAlign:t,...i?{color:i}:{}},children:e})}const Gt=/^\S+@\S+\.\S+$/,Qt={email:"email",phone:"tel"},Xt={email:"email",firstName:"given-name",lastName:"family-name",phone:"tel"},en="__privacy";function tn({slot:e,align:t,inverse:n,colors:o,onSubmitForm:i}){const[r,s]=(0,Vt.useState)({}),[a,c]=(0,Vt.useState)(!1),[l,u]=(0,Vt.useState)(null),[d,p]=(0,Vt.useState)({}),[h,f]=(0,Vt.useState)("idle"),m=b("caption",o,n),y={...g.caption,...m?{color:m}:{}},v={fontSize:12,lineHeight:1.4,color:o.error,paddingTop:2};if("success"===h||"confirm"===h)return(0,Bt.jsx)(Yt,{message:"confirm"===h?e.confirmEmailMessage:e.successMessage,align:t,inverse:n,colors:o});const x="submitting"===h,j=e.privacy?De(e.privacy.url):void 0,C={...w(e.submitVariant,o),...x?{opacity:.6,cursor:"default"}:{}};return(0,Bt.jsxs)("form",{noValidate:!0,style:{margin:0,textAlign:"left"},onSubmit:t=>{t.preventDefault(),(()=>{if(!i||!e.formCode||"submitting"===h)return;const t={};for(const n of e.fields){const e=(r[n.key]??"").trim();n.required&&!e?t[n.key]="Required":"email"===n.kind&&e&&!Gt.test(e)&&(t[n.key]="Enter a valid email")}if(e.privacy&&!a&&(t[en]="Please accept the privacy policy"),p(t),Object.keys(t).length>0)return;const n={email:"",policyAccepted:!e.privacy||a},o={};for(const t of e.fields){const e=(r[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),f("submitting"),Promise.resolve().then(()=>i(e.formCode,n)).then(e=>f("confirm-email"===e?"confirm":"success"),()=>f("error"))})()},children:[e.fields.map(e=>{const t=d[e.key];let n;return t?n=o.error:l===e.key&&(n=o.accent),(0,Bt.jsxs)("div",{style:{padding:"4px 0"},children:[e.label&&(0,Bt.jsx)("div",{style:{...y,paddingBottom:4},children:e.label}),(0,Bt.jsx)("input",{type:Qt[e.kind]??"text",autoComplete:Xt[e.kind],placeholder:e.placeholder||void 0,value:r[e.key]??"",disabled:x,style:S(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 p(e=>e[n]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==n)):e);var n,o}}),t&&(0,Bt.jsx)("div",{style:v,children:t})]},e.key)}),e.privacy&&(0,Bt.jsxs)("div",{style:{padding:"4px 0"},children:[(0,Bt.jsxs)("label",{style:{...y,display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"},children:[(0,Bt.jsx)("input",{type:"checkbox",checked:a,disabled:x,style:{margin:"2px 0 0",flexShrink:0},onChange:e=>{c(e.currentTarget.checked),p(e=>e[en]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==en)):e)}}),(0,Bt.jsxs)("span",{children:[e.privacy.checkboxLabel,j&&(0,Bt.jsxs)(Bt.Fragment,{children:[" ",(0,Bt.jsx)("a",{href:j,...Oe(void 0),style:{color:o.accent},children:e.privacy.linkLabel||e.privacy.url})]})]})]}),d[en]&&(0,Bt.jsx)("div",{style:v,children:d[en]})]}),(0,Bt.jsx)("div",{style:{padding:k},children:(0,Bt.jsx)("button",{type:"submit",disabled:x,style:C,children:e.submitLabel})}),"error"===h&&(0,Bt.jsx)("div",{style:{...v,textAlign:t},children:A})]})}function nn({value:e,label:t,digitStyle:n,labelStyle:o}){return(0,Bt.jsxs)("div",{style:{minWidth:44},children:[(0,Bt.jsx)("div",{style:n,children:String(e).padStart(2,"0")}),t?(0,Bt.jsx)("div",{style:o,children:t}):null]})}function on({slot:e,align:t,inverse:n,colors:o,mode:i,onRequestClose:r,onPageChange:s}){const[a,c]=(0,Vt.useState)(()=>Date.now()),l=function(e,t,n){const o=ze(e,t),i=null===o?0:Math.max(0,o-n),r=Math.floor(i/1e3);return{total:i,days:Math.floor(r/86400),hours:Math.floor(r/3600)%24,minutes:Math.floor(r/60)%60,seconds:r%60}}(e.endTime,e.timezone,a),u=0===l.total;(0,Vt.useEffect)(()=>{if("live"!==i||u)return;const e=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(e)},[i,u,e.endTime,e.timezone]),(0,Vt.useEffect)(()=>{"live"===i&&u&&("hide-popup"===e.onExpire?r?.():"page"===e.onExpire&&e.expirePage&&s(e.expirePage))},[i,u,e.onExpire,e.expirePage,r,s]);const d=b("h2",o,n),p=b("caption",o,n),h={fontSize:28,fontWeight:700,lineHeight:1.2,fontVariantNumeric:"tabular-nums",...d?{color:d}:{}},f={...g.caption,...p?{color:p}:{}},m=(y=e.language,Le[y]??Le.en);var y;const v=[{value:l.days,label:m.days},{value:l.hours,label:m.hours},{value:l.minutes,label:m.minutes},{value:l.seconds,label:m.seconds}];return(0,Bt.jsx)("div",{style:{padding:"4px 0",textAlign:t},children:(0,Bt.jsx)("div",{style:{display:"inline-flex",gap:12,textAlign:"center"},children:v.map(t=>(0,Bt.jsx)(nn,{value:t.value,label:e.showLabels?t.label:"",digitStyle:h,labelStyle:f},t.label||t.value))})})}function rn({slot:e,align:t,inverse:n,colors:o,onSubmitChoice:i}){const[r,s]=(0,Vt.useState)([]),[a,c]=(0,Vt.useState)("idle"),[l,u]=(0,Vt.useState)("");if("success"===a)return(0,Bt.jsx)(Yt,{message:e.successMessage,align:t,inverse:n,colors:o});const d=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])},p="submitting"===a,h=b("body",o,n),f={...g.body,...h?{color:h}:{}};return(0,Bt.jsxs)("div",{style:{padding:"4px 0"},children:["chips"===e.control?(0,Bt.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"===t?"center":"flex-start"},children:e.options.map(e=>{return(0,Bt.jsx)("button",{type:"button","aria-pressed":r.includes(e.value),style:(t=r.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:()=>d(e.value),children:e.label},e.value);var t})}):(0,Bt.jsx)("div",{style:{display:"grid",gap:6},children:e.options.map(e=>(0,Bt.jsxs)("label",{style:{...f,display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[(0,Bt.jsx)("input",{type:"checkbox",checked:r.includes(e.value),onChange:()=>d(e.value),style:{accentColor:o.accent,width:16,height:16,margin:0}}),e.label]},e.value))}),l?(0,Bt.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:l}):null,"error"===a?(0,Bt.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:A}):null,(0,Bt.jsx)("div",{style:{padding:k},children:(0,Bt.jsx)("button",{type:"button",style:{...w(e.submitVariant,o),...p?{opacity:.7}:{}},onClick:()=>{if(!i||!e.tagName||"submitting"===a)return;const t=Math.max(e.min,1);if(r.length<t)return void u(1===t?"Pick at least one":`Pick at least ${t}`);const n=e.options.filter(e=>r.includes(e.value)).map(e=>e.tagValue||e.value);u(""),c("submitting"),Promise.resolve().then(()=>i({slotKey:e.key,tagName:e.tagName,values:n})).then(()=>c("success"),()=>c("error"))},children:e.submitLabel})})]})}function sn({score:e,scale:t,selected:n,colors:o,onPick:i}){const r={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(0,Bt.jsx)("button",{type:"button","aria-label":`Rate ${e}`,"aria-pressed":n,style:{...r,width:30,height:32,borderRadius:6},onClick:i,children:e});const s="thumbs"===t;let a=`Rate ${e}`;return s&&(a=1===e?"Thumbs up":"Thumbs down"),(0,Bt.jsx)("button",{type:"button","aria-label":a,"aria-pressed":n,style:{...r,width:s?44:34,height:s?40:34,borderRadius:s?8:6},onClick:i,children:(0,Bt.jsx)("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",children:(0,Bt.jsx)("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":F.star,...s&&0===e?{transform:"rotate(180 12 12)"}:{}})})})}function an({slot:e,align:t,inverse:n,colors:o,onSubmitRating:i}){const[r,s]=(0,Vt.useState)(null),[a,c]=(0,Vt.useState)("idle");if("success"===a)return(0,Bt.jsx)(Yt,{message:e.successMessage,align:t,inverse:n,colors:o});const l=t=>{i&&e.eventName&&"submitting"!==a&&(c("submitting"),Promise.resolve().then(()=>i({slotKey:e.key,eventName:e.eventName,score:t,scale:e.scale})).then(()=>c("success"),()=>c("error")))},u="nps"===(d=e.scale)?[0,1,2,3,4,5,6,7,8,9,10]:"stars"===d?[1,2,3,4,5]:[0,1];var d;const p=b("caption",o,n),h={...g.caption,...p?{color:p}:{}},f=t=>"stars"===e.scale?null!==r&&t<=r:r===t;return(0,Bt.jsxs)("div",{style:{padding:"4px 0"},children:[(0,Bt.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6,justifyContent:"center"===t?"center":"flex-start"},children:u.map(t=>(0,Bt.jsx)(sn,{score:t,scale:e.scale,selected:f(t),colors:o,onPick:()=>(t=>{"submitting"!==a&&(s(t),"instant"===e.submitMode&&l(t))})(t)},t))}),e.labels.low||e.labels.high?(0,Bt.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,paddingTop:4},children:[(0,Bt.jsx)("span",{style:h,children:e.labels.low}),(0,Bt.jsx)("span",{style:h,children:e.labels.high})]}):null,"error"===a?(0,Bt.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:A}):null,"button"===e.submitMode?(0,Bt.jsx)("div",{style:{padding:k},children:(0,Bt.jsx)("button",{type:"button",style:{...w("primary",o),..."submitting"===a?{opacity:.7}:{}},onClick:()=>null===r?void 0:l(r),children:e.submitLabel})}):null]})}function cn({slot:e,align:t,inverse:n,colors:o}){const i=e.color||(n?o.textInverse:o.accent);return(0,Bt.jsx)("div",{style:{padding:"4px 0",textAlign:t,lineHeight:0},children:(0,Bt.jsx)("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"inline-block"},children:(0,Bt.jsx)("path",{d:F[e.name]})})})}function ln({slot:e,align:t,inverse:n,colors:o,mode:i="live",onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u}){const d=s??(()=>{});switch(e.type){case"text":return(0,Bt.jsx)(Zt,{slot:e,align:t,inverse:n,colors:o});case"button":return(0,Bt.jsx)(Jt,{slot:e,colors:o,onRequestClose:r,onPageChange:d,onRequestSubscribe:u});case"email-subscription-form":return(0,Bt.jsx)(tn,{slot:e,align:t,inverse:n,colors:o,onSubmitForm:a});case"timer":return(0,Bt.jsx)(on,{slot:e,align:t,inverse:n,colors:o,mode:i,onRequestClose:r,onPageChange:d});case"choice":return(0,Bt.jsx)(rn,{slot:e,align:t,inverse:n,colors:o,onSubmitChoice:c});case"rating":return(0,Bt.jsx)(an,{slot:e,align:t,inverse:n,colors:o,onSubmitRating:l});case"glyph":return(0,Bt.jsx)(cn,{slot:e,align:t,inverse:n,colors:o})}}function un({node:e,page:t,colors:n,mode:o,leaf:i,onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u}){const d=t.contents.find(t=>t.key===e.props.content);if(!d)return null;if(i?.renderZone)return(0,Bt.jsx)("div",{style:{minWidth:0},children:i.renderZone(d,e)});const p=e.props.align??"left",h="inverse"===e.props.tone;return(0,Bt.jsx)("div",{style:{minWidth:0},children:d.slots.map((e,t)=>{const i=d.slots[t-1],f=i?(m=x(i),"action"===(g=x(e))?"action"===m?6:16:"text"===g&&"heading"===m?4:8):0;var m,g;return(0,Bt.jsx)("div",{style:f?{marginTop:f}:void 0,children:(0,Bt.jsx)(ln,{slot:e,align:p,inverse:h,colors:n,mode:o,onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u})},e.key)})})}function dn(e){return e?.video?De(e.video.src):void 0}function pn({image:e,poster:t,src:n,style:o,mode:i}){return(0,Bt.jsx)("video",{src:n,poster:t||void 0,style:o,autoPlay:"live"===i,muted:!0,playsInline:!0,preload:"metadata",loop:!1!==e.video?.loop,controls:!0===e.video?.controls})}function hn({node:e,page:t,leaf:n,mode:o,scheme:i}){const r=t.images.find(t=>t.key===e.props.image);if(!r)return null;if(n?.renderImage)return(0,Bt.jsx)(Bt.Fragment,{children:n.renderImage(r,e)});const s=dn(r),a=Re(r,i);if(!a&&!s)return null;const c={display:"block",width:"100%",minWidth:0};return r.fit?(c.height="100%",c.objectFit=r.fit):c.height="auto",r.blur&&(c.filter=`blur(${r.blur}px)`),s?(0,Bt.jsx)(pn,{image:r,poster:a,src:s,style:c,mode:o}):(0,Bt.jsx)("img",{src:a,alt:"",style:c})}function fn({style:e,outer:t,inner:n,layer:o,children:i}){const{backgroundColor:r,...s}=e;return(0,Bt.jsxs)("div",{style:{display:"grid",minWidth:0,backgroundColor:r,...t},children:[o,(0,Bt.jsx)("div",{style:{...s,...n},children:i})]})}function mn({node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d}){if("Content"===e.type)return(0,Bt.jsx)(un,{node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d});if("Image"===e.type)return(0,Bt.jsx)(hn,{node:e,page:t,leaf:r,mode:o,scheme:i});const p=e.props?.backgroundImage,h=p?t.images.find(e=>e.key===p):void 0,f=h?.blur??0,m=h?.dim??0,g=dn(h),y=h?Re(h,i):void 0,b=pe(e,f>0||g?void 0:y||void 0,m);p&&(b.backgroundColor="#1D2939");const v=e.children.map((e,p)=>(0,Bt.jsx)(mn,{node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d},p));if(g&&h){const e=ue(m);return(0,Bt.jsx)(fn,{style:b,outer:{position:"relative",overflow:"hidden",...y?de(y):{}},inner:{position:"relative",...e?{backgroundImage:e}:{}},layer:(0,Bt.jsx)(pn,{image:h,poster:y??"",src:g,mode:o,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",...f>0?{filter:`blur(${f}px)`}:{}}}),children:v})}return f>0?(0,Bt.jsx)(fn,{style:b,outer:y?de(y,m):void 0,inner:{backdropFilter:`blur(${f}px)`,WebkitBackdropFilter:`blur(${f}px)`},children:v}):(0,Bt.jsx)("div",{style:b,children:v})}function gn({page:e,params:t,mode:n="live",colorScheme:o="light",leafRenderers:i,animatePage:r=!1,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d}){const p=$e(t,o),h=Pe(t,o),f={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:p.background,colorScheme:p.scheme,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:p.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:h.boxShadow&&"none"!==h.boxShadow?h.boxShadow:void 0,transition:"height 300ms ease"};e.height&&(f.height="stretch"===e.height?"100%":e.height,f.overflowY="auto");const m={...r?{animation:"pw-vpopup-page 300ms ease-out backwards"}:{},..."stretch"===e.height?{display:"grid",minHeight:"100%"}:{}};return(0,Bt.jsx)("div",{style:f,children:(0,Bt.jsx)("div",{style:m,children:(0,Bt.jsx)(mn,{node:e.layout,page:e,colors:p,mode:n,scheme:p.scheme,leaf:i,onRequestClose:s,onPageChange:a??(()=>{}),onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d})},e.key)})}function yn({colors:e,onRequestClose:t}){return(0,Bt.jsx)("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:ke(e.surface,.92),boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:e.chromeIcon,fontSize:13,lineHeight:1,cursor:"pointer"},children:"✕"})}function bn(e,t,n){const{placement:o}=e,i={position:"fixed",boxSizing:"border-box",maxWidth:xt(o),maxHeight:xt(o),pointerEvents:"auto"};if(t){i.width=t;const e=o.h;"left"===e?i.left=o.offset:"right"===e?i.right=o.offset:i.left="50%"}else i.left=o.offset,i.right=o.offset;"stretch"===n?(i.top=o.offset,i.bottom=o.offset):"top"===o.v?i.top=o.offset:"bottom"===o.v?i.bottom=o.offset:i.top="50%";const r=t&&"center"===o.h?"-50%":"0",s="middle"===o.v&&"stretch"!==n?"-50%":"0";"0"===r&&"0"===s||(i.transform=`translate(${r}, ${s})`);const a=Kt[e.animation];return a&&(i.animation=a),i.transition="width 300ms ease",i}function vn({params:e,mode:t="live",colorScheme:n="auto",onRequestClose:o,onSubmitForm:i,onSubmitChoice:r,onSubmitRating:s,onRequestSubscribe:a,leafRenderers:c}){const[l,u]=(0,Vt.useState)(null);(0,Vt.useEffect)(()=>{vt(e).forEach(e=>e.images.forEach(({src:e,srcDark:t})=>{[e,t].forEach(e=>{e&&((new Image).src=e)})}))},[e]);const d=Ut(n,Ce(e)),p=vt(e);if(0===p.length)return null;const h=p.find(e=>e.key===l)??function(e,t){return t.find(t=>t.key===e.startPage)??t[0]}(e,p),f=null!==l;if("preview"===t)return(0,Bt.jsxs)("div",{style:{position:"relative",width:h.width??"100%",transition:"width 300ms ease"},children:[(0,Bt.jsx)("style",{children:E}),(0,Bt.jsx)(gn,{page:h,params:e,mode:t,colorScheme:d,leafRenderers:c,animatePage:f,onRequestClose:o,onPageChange:u,onSubmitForm:i,onSubmitChoice:r,onSubmitRating:s,onRequestSubscribe:a})]});const{overlay:m}=Pe(e,d);return(0,Bt.jsxs)(Bt.Fragment,{children:[(0,Bt.jsx)("style",{children:E}),m&&(0,Bt.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:m.color,opacity:m.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:o}),(0,Bt.jsxs)("div",{style:bn(e,h.width,h.height),children:[(0,Bt.jsx)(gn,{page:h,params:e,mode:t,colorScheme:d,leafRenderers:c,animatePage:f,onRequestClose:o,onPageChange:u,onSubmitForm:i,onSubmitChoice:r,onSubmitRating:s,onRequestSubscribe:a}),(0,Bt.jsx)(yn,{colors:$e(e,d),onRequestClose:o})]})]})}const xn={SUBMIT_FORM_RESULT_SUBSCRIBED:"subscribed",SUBMIT_FORM_RESULT_CONFIRM_EMAIL:"confirm-email",SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED:"already-subscribed"},kn=(e,t)=>`https://subscription-form.svc-nue.pushwoosh.com/api/v1/forms/code/${encodeURIComponent(e)}${t}`,wn=async(e,t)=>{try{const n=await fetch(kn(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(),i=xn[o.result??""];if(!i)throw new Error(`Subscription form submit failed: unexpected result "${o.result}"`);return i}catch(t){throw Lt.error(t,`Failed to submit subscription form "${e}"`),t}};class Sn{constructor(e){this.isRecurringVisitor=!1,this.entries=new Map,this.contentEntries=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:Dt(e),onSubmitRating:Ot(e),onRequestSubscribe:_t(e)},e.moduleRegistry.webPopups=this}async run(){const{pw:e}=this;try{if(!1===e.initParams.webPopups?.enable)return void Lt.info(`${wt} switched off by webPopups.enable, skipping`);this.autoShowEnabled=!1!==e.initParams.webPopups?.autoShow,this.colorScheme=e.initParams.webPopups?.colorScheme??"auto";const t=await e.data.getFeatures();if(!1===t?.popup_forms?.enabled)return void Lt.debug(`${wt} application has no active popup forms, skipping automatic display`);await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const n=await e.api.getPopupForms();Lt.debug(`${wt} Received ${n.length} popup(s) from server:`,n.map(e=>e.code)),n.forEach((e,t)=>{this.entries.set(e.code,this.createEntry("campaign",e,t))}),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 o=this.loadedCodes();Lt.debug(`${wt} ${o.length} popup(s) passed strong conditions and loaded:`,o),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)??this.getContentEntry(e);if(this.visible?.code===e)return!0;return await this.ensureContent(t)?this.visible?.code===e||!!this.checkNotExpired(t)&&(this.visible&&(Lt.debug(`${wt} show("${e}") preempting "${this.visible.code}"`),this.visible.close("preempted")),this.detachFromAutoPipeline(t),this.present(t,"api"),!0):(Lt.error(new Error("Web popup content unavailable"),`${wt} 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()}}createEntry(e,t,n){return{kind:e,popup:t,order:n,state:"idle",content:null,loading:null,passedStrongConditions:!1,timeoutId:null,visitRecorded:!1}}getContentEntry(e){let t=this.contentEntries.get(e);return t||(t=this.createEntry("content",{code:e,popup_form_content_code:e,device_type:"ALL",visitors_type:"ALL",matching_pages:[],delay:0,frequency:"EVERY_VISIT",trigger_type:"API"},-1),this.contentEntries.set(e,t)),t}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=>(Lt.error(t,`${wt} 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=Ue(e);return t?0===vt(t.params).length?null:t.params:null})((await this.pw.api.getPopupFormContent(e.popup_form_content_code)).json);return t||(Lt.error(new Error("Unsupported popup content format"),`${wt} 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))}),Lt.debug(`${wt} ${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;Lt.debug(`${wt} 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),Lt.debug(`${wt} 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=>{Lt.error(t,`${wt} 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",Lt.debug(`${wt} 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();Lt.debug(`${wt} 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 i=document.createElement("div");i.id=`${kt}-${n.code}`,i.style.position="fixed",i.style.inset="0",i.style.zIndex=String(2147483647),i.style.pointerEvents="none",document.body.appendChild(i);const r=i.attachShadow({mode:"open"}),s=document.createElement("div");r.appendChild(s);const a=!!o.overlay;a&&this.lockBodyScroll();let c=!1;const l=t=>{c||(c=!0,a&&this.unlockBodyScroll(),(e=>{(0,Ht.render)(null,e)})(s),i.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:i,modal:a,close:l},e.state="visible",((e,t,n,o,i="auto")=>{(0,Ht.render)((0,Bt.jsx)(vn,{params:t,mode:"live",colorScheme:i,onRequestClose:n,onSubmitForm:wn,onSubmitChoice:o.onSubmitChoice,onSubmitRating:o.onSubmitRating,onRequestSubscribe:o.onRequestSubscribe}),e)})(s,o,()=>l("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(kn(e,"/view"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,userId:t,hwid:t})}).catch(t=>{Lt.error(t,`Failed to record subscription form view for "${e}"`)})})(t,e))).catch(e=>{Lt.error(e,`${wt} Failed to record subscription form views for web popup "${n.code}"`)}),Lt.debug(`${wt} Popup "${n.code}" shown (trigger: ${t})`),"campaign"===e.kind&&(this.recordVisit(e),this.markAsShown(n).catch(e=>{Lt.error(e,`${wt} 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=ze(n.endTime,e);if(null!==o&&o<=t)return!0}return!1}(e.content,Date.now())||(Lt.debug(`${wt} 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,i=window.location.pathname;return n&&n.length>0?n.some(e=>this.matchPageRule(i,e)):t&&t.length>0?t.includes(i):!(o&&o.length>0)||!o.some(e=>this.matchPageRule(i,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=>{Lt.error(t,`${wt} 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`${kt}.shown.${e}`}}return s})());
2
2
  //# sourceMappingURL=widget-web-popups.js.map