web-push-notifications 3.67.0 → 3.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm.js +1 -1
- package/package.json +1 -1
- package/service-worker.js +1 -1
- package/widget-web-popups.js +1 -1
- package/widget-web-popups.js.map +1 -1
package/widget-web-popups.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,()=>(()=>{"use strict";const e={d:(t,n)=>{if(Array.isArray(n))for(var o=0;o<n.length;){var r=n[o++],i=n[o++];e.o(t,r)?0===i&&o++:0===i?Object.defineProperty(t,r,{enumerable:!0,value:n[o++]}):Object.defineProperty(t,r,{enumerable:!0,get:i})}else for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{WebPopupsWidget:()=>ar});const n=/^(https?:|mailto:|tel:)/i,o="#101828",r="#FFFFFF",i="#2970FF",s=o,l="#667085",a="#FFFFFF",u={h1:{fontSize:24,fontWeight:600,lineHeight:1.25},h2:{fontSize:18,fontWeight:600,lineHeight:1.3},h3:{fontSize:16,fontWeight:600,lineHeight:1.35},body:{fontSize:14,fontWeight:"normal",lineHeight:1.5},caption:{fontSize:12,fontWeight:"normal",lineHeight:1.4},eyebrow:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",lineHeight:1.4},icon:{fontSize:24,lineHeight:1.2}},c={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function d(e,t,n){return n?function(e,t){if(t>=1)return e;const n=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(e)?.[1];if(!n)return e;const o=3===n.length?n.split("").map(e=>e+e).join(""):n,[r,i,s]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${r}, ${i}, ${s}, ${t})`}(t.textInverse,c[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const p=["h1","h2","h3","icon"];function f(e){return"glyph"===e.type?"heading":"text"!==e.type?"action":p.includes(e.variant)?"heading":"text"}const _="8px 0 4px";function h(e,t){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:6,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===e?{backgroundColor:"#FFFFFF",color:t,border:`1px solid ${t}`}:{backgroundColor:t,color:"#FFFFFF",border:"none"}}}const m="#D92D20";function y(e="#D0D5DD"){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 12px",borderRadius:6,fontSize:14,fontFamily:"inherit",lineHeight:1.5,backgroundColor:"#FFFFFF",color:o,border:`1px solid ${e}`,outline:"none"}}const g="Subscribe",v="Thanks for subscribing!",b="Please check your inbox and confirm your email.",k="Save",w="Thanks! Your choice is saved.",S="Send",C="Thanks for the feedback!";const x="Something went wrong. Please try again.",E="\n@keyframes pw-vpopup-fade { from { opacity: 0; } }\n@keyframes pw-vpopup-slide { from { opacity: 0; translate: 0 28px; } }\n@keyframes pw-vpopup-overlay { from { opacity: 0; } }\n@keyframes pw-vpopup-page { from { opacity: 0; } }\n",P={bell:"M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0",gift:"M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z",cart:"M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",chart:"M3 21h18M7 21V11M12 21V6M17 21v-8",lock:"M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3",calendar:"M4 6h16v15H4zM4 10h16M9 3v4M15 3v4",check:"M4 13l5 5L20 6",star:"M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z",clock:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2",tag:"M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0",mail:"M3 6h18v12H3zM3 7l9 6 9-6",phone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4",download:"M12 3v12M7 11l5 5 5-5M4 20h16",play:"M8 5l12 7-12 7z",shield:"M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z",sparkle:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z",percent:"M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0",truck:"M2 7h12v10H2zM14 10h4l3 3v4h-7M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",ticket:"M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12",user:"M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0"},M=Object.keys(P),F=[24,32,48],R=["Vertical","Horizontal","Columns","Rows"],$=["normal","reverse"],A=["start","center","end","stretch"],I=["start","center","end","space-between"],N=["left","center","right"],T=["default","inverse"],j=2e3,O={px:j,"%":100,em:125,rem:125},L=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,H={px:j,"%":100,fr:100},z=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,D=["auto","min-content","max-content"];function U(e,t){return t.includes(e)?e:void 0}function W(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),j);if("string"!=typeof e)return;const t=L.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),O[o])}${o}`}const q=["top","right","bottom","left"];function B(e){if(D.includes(e))return e;const t=z.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),H[o])}${o}`}function V(e){return"string"==typeof e&&e.length>0?e:void 0}function K(e){const t={},n=W(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=W(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of q){const o=W(e[t]);void 0!==o&&(n[t]=o)}return Object.keys(n).length>0?n:void 0}(e.padding);void 0!==o&&(t.padding=o);const r=U(e.alignItems,A);r&&(t.alignItems=r);const i=U(e.justifyContent,I);i&&(t.justifyContent=i);const s=U(e.alignContent,I);s&&(t.alignContent=s);const l=V(e.backgroundImage);l&&(t.backgroundImage=l);const a=function(e){if("number"==typeof e)return Number.isInteger(e)&&e>=1&&e<=12?e:void 0;if("string"!=typeof e)return;const t=e.trim().split(/\s+/);if(t.length<1||t.length>12)return;const n=t.map(B);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==a&&(t.sizes=a),t}function Z(e,t,n){if(t>10||n.nodes<=0)return null;if("object"!=typeof e||null===e)return null;n.nodes-=1;const o=e,r="object"==typeof o.props&&null!==o.props?o.props:{};if("Content"===o.type){const e=V(r.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=U(r.align,N);n&&(t.props.align=n);const o=U(r.tone,T);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=V(r.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const i=U(o.type,R)??"Vertical",s=[];for(const e of o.children){const o=Z(e,t+1,n);o&&s.push(o)}const l=K(r);return"reverse"===U(r.order,$)&&(s.reverse(),"string"==typeof l.sizes&&(l.sizes=l.sizes.split(" ").reverse().join(" "))),{type:i,props:l,children:s}}function J(e){return Z(e,0,{nodes:100})}const Y=/^[a-zA-Z][a-zA-Z0-9-]*$/,G=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function Q(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=G.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function X(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:te(e,t,0)}const ee=new Set(["content","image","backgroundImage"]);function te(e,t,n){if(n>10||"object"!=typeof e||null===e)return e;const o=e,r={...o};if("object"==typeof o.props&&null!==o.props){const e={...o.props};for(const[n,o]of Object.entries(e))if(!ee.has(n))if("string"==typeof o)e[n]=Q(o,t);else if("object"==typeof o&&null!==o&&!Array.isArray(o)){const r={...o};for(const[e,n]of Object.entries(r))"string"==typeof n&&(r[e]=Q(n,t));e[n]=r}r.props=e}return Array.isArray(o.children)&&(r.children=o.children.map(e=>te(e,t,n+1))),r}function ne(e){return"number"==typeof e?`${e}px`:e}function oe(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function re(e=0){if(!(e>0))return null;const t=`rgba(16, 24, 40, ${Math.min(e,1)})`;return`linear-gradient(${t}, ${t})`}function ie(e,t=0){const n=`url(${JSON.stringify(e)})`,o=re(t);return{backgroundImage:o?`${o}, ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function se(e,t,n=0){const o=e.props??{},r={display:"grid",minWidth:0};return"Horizontal"===e.type&&(r.gridAutoFlow="column"),"Columns"===e.type&&(r.gridTemplateColumns=oe(o.sizes,e.children.length)),"Rows"===e.type&&(r.gridTemplateRows=oe(o.sizes,e.children.length)),void 0!==o.gap&&(r.gap=ne(o.gap)),void 0!==o.padding&&(r.padding=function(e){if("number"==typeof e||"string"==typeof e)return ne(e);const t=e=>void 0===e?"0":ne(e);return`${t(e.top)} ${t(e.right)} ${t(e.bottom)} ${t(e.left)}`}(o.padding)),o.alignItems&&(r.alignItems=o.alignItems),o.justifyContent&&(r.justifyContent=o.justifyContent),o.alignContent&&(r.alignContent=o.alignContent),t&&Object.assign(r,ie(t,n)),r}const le=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/,ae=new Map;function ue(e){const t=ae.get(e);if(t)return t;try{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});return ae.set(e,t),t}catch{return null}}function ce(e){return!e||null!==ue(e)}function de(e,t){const n=t.formatToParts(new Date(e)),o=e=>Number(n.find(t=>t.type===e)?.value??"0");return Date.UTC(o("year"),o("month")-1,o("day"),o("hour")%24,o("minute"),o("second"))-e}const pe=864e5;const fe=new Map;function _e(e,t){const n=`${e}|${t}`,o=fe.get(n);if(void 0!==o)return o;const r=function(e,t){const n=le.exec((e||"").trim());if(!n)return null;const[,o,r,i,s,l,a]=n.map(Number),u=Number.isNaN(a)?0:a;if(r<1||r>12||i<1||i>31)return null;if(s>23||l>59||u>59)return null;const c=Date.UTC(o,r-1,i,s,l,u),d=new Date(c);if(d.getUTCMonth()!==r-1||d.getUTCDate()!==i)return null;if(!t)return c;const p=ue(t);if(!p)return null;const f=function(e,t){const n=[];for(const o of[e-pe,e,e+pe]){const e=de(o,t);n.includes(e)||n.push(e)}return n}(c,p),_=f.filter(e=>de(c-e,p)===e).map(e=>c-e);return _.length>0?Math.min(..._):c-Math.min(...f)}(e,t);return fe.size>100&&fe.clear(),fe.set(n,r),r}const he={en:{days:"Days",hours:"Hours",minutes:"Minutes",seconds:"Seconds"},ru:{days:"Дни",hours:"Часы",minutes:"Минуты",seconds:"Секунды"},de:{days:"Tage",hours:"Stunden",minutes:"Minuten",seconds:"Sekunden"},es:{days:"Días",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},fr:{days:"Jours",hours:"Heures",minutes:"Minutes",seconds:"Secondes"},pt:{days:"Dias",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},ja:{days:"日",hours:"時間",minutes:"分",seconds:"秒"},ko:{days:"일",hours:"시간",minutes:"분",seconds:"초"},zh:{days:"天",hours:"小时",minutes:"分",seconds:"秒"},hi:{days:"दिन",hours:"घंटे",minutes:"मिनट",seconds:"सेकंड"},bn:{days:"দিন",hours:"ঘণ্টা",minutes:"মিনিট",seconds:"সেকেন্ড"},ar:{days:"أيام",hours:"ساعات",minutes:"دقائق",seconds:"ثوان"},he:{days:"ימים",hours:"שעות",minutes:"דקות",seconds:"שניות"},th:{days:"วัน",hours:"ชั่วโมง",minutes:"นาที",seconds:"วินาที"}};function me(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||n.test(t)?t:void 0}function ye(e){return"_self"===e?{target:"_self"}:{target:"_blank",rel:"noreferrer"}}const ge=new Set(["STRONG","B","EM","I","U","BR","A"]);function ve(e,t,n){for(const o of Array.from(e.childNodes)){if(3===o.nodeType){t.appendChild(n.createTextNode(o.textContent??""));continue}if(1!==o.nodeType)continue;const e=o;if(!ge.has(e.tagName)){ve(e,t,n);continue}const r=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=me(e.getAttribute("href")??void 0);t&&r.setAttribute("href",t);const{target:n,rel:o}=ye(e.getAttribute("target"));r.setAttribute("target",n),o&&r.setAttribute("rel",o)}t.appendChild(r),ve(e,r,n)}}function be(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return ve(t.body,n,t),n.innerHTML}function ke(e){return"string"==typeof e&&e?e:void 0}function we(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:ke(t.background)??ke(e.background)??r,accent:ke(t.accent)??ke(e.accent)??i,text:ke(t.text)??s,textSecondary:ke(t.textSecondary)??l,textInverse:ke(t.textInverse)??a}}const Se=["cover","contain"];function Ce(e){if("object"!=typeof e||null===e)return;const t=e,n=me("string"==typeof t.src?t.src:void 0);return n?{src:n,...!0===t.controls?{controls:!0}:{},...!1===t.loop?{loop:!1}:{}}:void 0}function xe(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!n.key)continue;if("string"!=typeof n.src)continue;const e=Ce(n.video);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,...e?{video:e}:{},..."string"==typeof n.mediaId&&n.mediaId?{mediaId:n.mediaId}:{},...Se.includes(n.fit)?{fit:n.fit}:{},..."number"==typeof n.blur&&Number.isFinite(n.blur)&&n.blur>0?{blur:Math.min(n.blur,100)}:{},..."number"==typeof n.dim&&Number.isFinite(n.dim)&&n.dim>0?{dim:Math.min(n.dim,1)}:{}})}return t}const Ee=["px","%","em","rem","fr"];function Pe(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function Me(e){if("object"!=typeof e||null===e)return;const t=e;if("text"===t.kind)return{kind:"text"};if("length"===t.kind||"percent"===t.kind){const e=Pe(t.min),n=Pe(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>Ee.includes(e)):[],r="length"===t.kind?function(e){if("object"!=typeof e||null===e)return;const t={};for(const n of Ee){const o=e[n];if("object"!=typeof o||null===o)continue;const r=Pe(o.min),i=Pe(o.max);void 0===r&&void 0===i||(t[n]={...void 0!==r?{min:r}:{},...void 0!==i?{max:i}:{}})}return Object.keys(t).length>0?t:void 0}(t.ranges):void 0;return{kind:t.kind,...void 0!==e?{min:e}:{},...void 0!==n?{max:n}:{},...o.length>0?{units:o}:{},...r?{ranges:r}:{}}}if("select"===t.kind&&Array.isArray(t.options)){const e=[];for(const n of t.options){if(e.length>=20)break;"object"==typeof n&&null!==n&&("string"!=typeof n.value||n.value.length>64||e.push({value:n.value,label:"string"==typeof n.label?n.label:n.value}))}if(e.length>0)return{kind:"select",options:e}}}function Fe(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!Y.test(n.key))continue;if("string"!=typeof n.value||n.value.length>64||n.value.includes("$"))continue;if(t.some(e=>e.key===n.key))continue;const e=Me(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function Re(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}const $e=["email","firstName","lastName","phone","custom"],Ae=["primary","secondary"];function Ie(e){const t=[];if(Array.isArray(e))for(const n of e){if(t.length>=10)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&$e.includes(n.kind)&&(t.some(e=>e.key===n.key)||t.push({key:n.key,kind:n.kind,label:"string"==typeof n.label?n.label:"",placeholder:"string"==typeof n.placeholder?n.placeholder:"",required:"email"===n.kind||!0===n.required,..."custom"===n.kind&&"string"==typeof n.tag&&n.tag?{tag:n.tag}:{}})))}if(!t.some(e=>"email"===e.kind)){let e="field-email";for(;t.some(t=>t.key===e);)e=`${e}-1`;t.unshift({key:e,kind:"email",label:"Email",placeholder:"",required:!0})}return t.slice(0,10)}const Ne=["checkbox","chips"],Te=["nps","stars","thumbs"],je=["instant","button"],Oe=["keep","hide-popup","page"],Le=/^[a-z]{2}$/i,He=/^#[0-9a-fA-F]{6}$/;function ze(e,t=120){return"string"==typeof e?e.trim().slice(0,t):""}function De(e,t,n=120){return ze(e,n)||t}function Ue(e){const t=ze(e,8);return Le.test(t)?t.toLowerCase():""}function We(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=12)break;if("object"!=typeof n||null===n)continue;const e=ze(n.value);if(!e)continue;if(t.some(t=>t.value===e))continue;const o=ze(n.tagValue);t.push({value:e,label:De(n.label,e),...o?{tagValue:o}:{}})}return t}function qe(e,t){const n=e=>{const n=Pe(e);return void 0===n||n<=0?0:Math.min(Math.floor(n),t)},o=n(e.min),r=n(e.max);return{min:o,max:r>0?Math.max(o,r):0}}function Be(e){const t=[];for(const n of e){if(t.length>=50)break;if("object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key))if("text"!==n.type)if("button"!==n.type){if("timer"===n.type){const e=ze(n.timezone,64),o=ce(e)?e:"",r=ze(n.endTime,32);if(null===_e(r,o))continue;const i=ze(n.expirePage),s=Oe.includes(n.onExpire)?n.onExpire:"keep",l="page"!==s||i?s:"keep";t.push({type:"timer",key:n.key,endTime:r,timezone:o,language:Ue(n.language),showLabels:!1!==n.showLabels,onExpire:l,..."page"===l?{expirePage:i}:{}});continue}if("choice"===n.type){const e=We(n.options),{min:o,max:r}=qe(n,e.length);t.push({type:"choice",key:n.key,control:Ne.includes(n.control)?n.control:"checkbox",tagName:ze(n.tagName),options:e,min:o,max:r,submitLabel:De(n.submitLabel,k),submitVariant:Ae.includes(n.submitVariant)?n.submitVariant:"primary",successMessage:De(n.successMessage,w,500)});continue}if("rating"===n.type){const e="object"==typeof n.labels&&null!==n.labels?n.labels:{};t.push({type:"rating",key:n.key,scale:Te.includes(n.scale)?n.scale:"stars",labels:{low:ze(e.low),high:ze(e.high)},submitMode:je.includes(n.submitMode)?n.submitMode:"instant",submitLabel:De(n.submitLabel,S),eventName:ze(n.eventName),successMessage:De(n.successMessage,C,500)});continue}if("glyph"!==n.type)"email-subscription-form"===n.type&&t.push({type:"email-subscription-form",key:n.key,formCode:"string"==typeof n.formCode?n.formCode:"",fields:Ie(n.fields),submitLabel:"string"==typeof n.submitLabel&&n.submitLabel?n.submitLabel:g,submitVariant:Ae.includes(n.submitVariant)?n.submitVariant:"primary",..."object"==typeof n.privacy&&null!==n.privacy&&"string"==typeof n.privacy.checkboxLabel?{privacy:{checkboxLabel:n.privacy.checkboxLabel,url:"string"==typeof n.privacy.url?n.privacy.url:"",linkLabel:"string"==typeof n.privacy.linkLabel?n.privacy.linkLabel:""}}:{},successMessage:"string"==typeof n.successMessage&&n.successMessage?n.successMessage:v,confirmEmailMessage:"string"==typeof n.confirmEmailMessage&&n.confirmEmailMessage?n.confirmEmailMessage:b});else{if(!M.includes(n.name))continue;t.push({type:"glyph",key:n.key,name:n.name,size:F.includes(n.size)?n.size:F[0],color:"string"==typeof n.color&&He.test(n.color)?n.color:""})}}else"object"==typeof n.action&&null!==n.action&&"string"==typeof n.action.type&&t.push(n);else"string"==typeof n.html&&t.push(n)}return t}function Ve(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&Array.isArray(n.slots)&&t.push({key:n.key,label:"string"==typeof n.label?n.label:"",slots:Be(n.slots)}))}return t}function Ke(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function Ze(e,t,n){if(null===e)return;let o;return o="stretch"===e?"stretch":Ke(e)??("stretch"===t?"stretch":Ke(t)),"width"===n&&"stretch"===o?void 0:o}function Je(e){const t=[];for(const n of e.pages){const o=Fe(n.values),r=J(X(n.layout,Re(o)));if(!r)continue;const i=Ze(n.width,e.width,"width"),s=Ze(n.height,e.height,"height");t.push({key:n.key,layout:r,images:xe(n.images),contents:Ve(n.contents),...void 0!==i?{width:i}:{},...void 0!==s?{height:s}:{}})}return t}function Ye(e){return`calc(100% - ${2*e.offset}px)`}const Ge="pushwoosh-web-popups",Qe="[WebPopups]",Xe="keyValue",et="messages",tt="inboxMessages";function nt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const ot=[nt(Xe,function(e){e.createObjectStore(Xe,{keyPath:"key"})}),nt("log",function(e){const t=e.createObjectStore("log",{keyPath:"id",autoIncrement:!0});t.createIndex("environment","environment",{unique:!1}),t.createIndex("date","date",{unique:!1}),t.createIndex("type","type",{unique:!1})}),nt(et,function(e){e.createObjectStore(et,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),nt(tt,function(e){const t="status",n=e.createObjectStore(tt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class rt{get all(){return ot}}class it{constructor(e,t=new rt){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function st(e,t){console.info("onversionchange",t),e.close()}let lt;function at(e){return(lt||(lt=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=st.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=st.bind(null,n,t),new it(n).applyMigrations()}})),lt).then(t=>new Promise((n,o)=>e(t,n,o)))}class ut{_add(e){return at((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);r.onsuccess=()=>{n(e)},r.onerror=()=>{o(r.error)}}).then(e=>this.getAll().then(t=>{if(Array.isArray(t)){const n=t.map(e=>e.id).sort((e,t)=>e==t?0:e<t?1:-1);if(n.length>this.maxItems)return Promise.all(n.slice(this.maxItems).map(e=>this.delete(e))).then(()=>e)}return e}))}delete(e){return at((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);r.onsuccess=()=>{n(r.result)},r.onerror=()=>{o(r.error)}})}getAll(){return at((e,t,n)=>{const o=[],r=e.transaction(this.name).objectStore(this.name).openCursor();r.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},r.onerror=()=>{n(r.error)}})}}ct=Xe;var ct;const dt=new class extends ut{constructor(){super(...arguments),this.name="log",this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(e,t,n){const o={type:e,environment:this.environment,message:`${t}`,date:new Date};return t instanceof Error&&(o.stack=t.stack),n&&(o.additional=n),this._add(o)}},pt=(new class extends ut{constructor(){super(...arguments),this.name=et,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let ft=3;const _t={setLevel(e){pt[e]||(e="error"),ft=pt[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),dt.add(e,t,n)}};function ht(e){return async({slotKey:t,tagName:n,values:o})=>{try{await e.api.setTags({[n]:o})}catch(e){throw _t.error(e,`Failed to write web popup choice "${t}" to tag "${n}"`),e}}}function mt(e){return async({slotKey:t,eventName:n,score:o,scale:r})=>{try{await e.api.postEvent(n,{score:o,scale:r,slotKey:t})}catch(e){throw _t.error(e,`Failed to post web popup rating "${t}" as event "${n}"`),e}}}Object.keys(pt).forEach(e=>{const t=pt[e];_t[e]=(...n)=>{t<=ft&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});var yt,gt,vt,bt,kt,wt,St,Ct,xt,Et,Pt,Mt,Ft,Rt,$t,At={},It=[],Nt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Tt=Array.isArray;function jt(e,t){for(var n in t)e[n]=t[n];return e}function Ot(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Lt(e,t,n){var o,r,i,s={};for(i in t)"key"==i?o=t[i]:"ref"==i?r=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?yt.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return Ht(e,s,o,r,null)}function Ht(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++vt,__i:-1,__u:0};return null==r&&null!=gt.vnode&>.vnode(i),i}function zt(e){return e.children}function Dt(e,t){this.props=e,this.context=t}function Ut(e,t){if(null==t)return e.__?Ut(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Ut(e):null}function Wt(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=jt({},t);i.__v=t.__v+1,gt.vnode&>.vnode(i),tn(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??Ut(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,on(o,i,r),t.__e=t.__=null,i.__e!=n&&qt(i)}}function qt(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),qt(e)}function Bt(e){(!e.__d&&(e.__d=!0)&&bt.push(e)&&!Vt.__r++||kt!=gt.debounceRendering)&&((kt=gt.debounceRendering)||wt)(Vt)}function Vt(){try{for(var e,t=1;bt.length;)bt.length>t&&bt.sort(St),e=bt.shift(),t=bt.length,Wt(e)}finally{bt.length=Vt.__r=0}}function Kt(e,t,n,o,r,i,s,l,a,u,c){var d,p,f,_,h,m,y=o&&o.__k||It,g=t.length;for(a=Zt(n,t,y,a,g),d=0;d<g;d++)null!=(f=n.__k[d])&&(p=-1!=f.__i&&y[f.__i]||At,f.__i=d,m=tn(e,f,p,r,i,s,l,a,u,c),_=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&ln(p.ref,null,f),c.push(f.ref,f.__c||_,f)),null==h&&null!=_&&(h=_),4&f.__u?(a=Jt(f,a,e),p.__e&&(p.__e=null)):"function"==typeof f.type&&void 0!==m?a=m:_&&(a=_.nextSibling),f.__u&=-7);return n.__e=h,a}function Zt(e,t,n,o,r){var i,s,l,a,u,c=n.length,d=c,p=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.__k[i]=Ht(null,s,null,null,null):Tt(s)?s=e.__k[i]=Ht(zt,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?s=e.__k[i]=Ht(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,a=i+p,s.__=e,s.__b=e.__b+1,l=null,-1!=(u=s.__i=Gt(s,n,a,d))&&(d--,(l=n[u])&&(l.__u|=2)),null==l||null==l.__v?(-1==u&&(r>c?p--:r<c&&p++),"function"!=typeof s.type&&(s.__u|=4)):u!=a&&(u==a-1?p--:u==a+1?p++:(u>a?p--:p++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<c;i++)null!=(l=n[i])&&!(2&l.__u)&&(l.__e==o&&(o=Ut(l)),an(l,l));return o}function Jt(e,t,n){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=Jt(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Ut(e)),t=n.insertBefore(e.__e,t||null));do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Yt(e,t){return t=t||[],null==e||"boolean"==typeof e||(Tt(e)?e.some(function(e){Yt(e,t)}):t.push(e)),t}function Gt(e,t,n,o){var r,i,s,l=e.key,a=e.type,u=t[n],c=null!=u&&!(2&u.__u);if(null===u&&null==l||c&&l==u.key&&a==u.type)return n;if(o>(c?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(u=t[s=r>=0?r--:i++])&&!(2&u.__u)&&l==u.key&&a==u.type)return s;return-1}function Qt(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||Nt.test(t)?n:n+"px"}function Xt(e,t,n,o,r){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Qt(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Qt(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(Pt,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[Et]=o[Et]:(n[Et]=Mt,e.addEventListener(t,i?Rt:Ft,i)):e.removeEventListener(t,i?Rt:Ft,i);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=n??"";break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function en(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[xt])t[xt]=Mt++;else if(t[xt]<n[Et])return;return n(gt.event?gt.event(t):t)}}}function tn(e,t,n,o,r,i,s,l,a,u){var c,d,p,f,_,h,m,y,g,v,b,k,w,S,C,x,E=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(a=!!(32&n.__u),i=[l=t.__e=n.__e]),(c=gt.__b)&&c(t);e:if("function"==typeof E){d=s.length;try{if(g=t.props,v=E.prototype&&E.prototype.render,b=(c=E.contextType)&&o[c.__c],k=c?b?b.props.value:c.__:o,n.__c?y=(p=t.__c=n.__c).__=p.__E:(v?t.__c=p=new E(g,k):(t.__c=p=new Dt(g,k),p.constructor=E,p.render=un),b&&b.sub(p),p.state||(p.state={}),p.__n=o,f=p.__d=!0,p.__h=[],p._sb=[]),v&&null==p.__s&&(p.__s=p.state),v&&null!=E.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=jt({},p.__s)),jt(p.__s,E.getDerivedStateFromProps(g,p.__s))),_=p.props,h=p.state,p.__v=t,f)v&&null==E.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),v&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(v&&null==E.getDerivedStateFromProps&&g!==_&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(g,k),t.__v==n.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(g,p.__s,k)){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),It.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),l=Ut(n);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(g,p.__s,k),v&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(_,h,m)})}if(p.context=k,p.props=g,p.__P=e,p.__e=!1,w=gt.__r,S=0,v)p.state=p.__s,p.__d=!1,w&&w(t),c=p.render(p.props,p.state,p.context),It.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,w&&w(t),c=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++S<25);p.state=p.__s,null!=p.getChildContext&&(o=jt(jt({},o),p.getChildContext())),v&&!f&&null!=p.getSnapshotBeforeUpdate&&(m=p.getSnapshotBeforeUpdate(_,h)),C=null!=c&&c.type===zt&&null==c.key?rn(c.props.children):c,l=Kt(e,Tt(C)?C:[C],t,n,o,r,i,s,l,a,u),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),y&&(p.__E=p.__=null)}catch(e){if(s.length=d,t.__v=null,a||null!=i){if(e.then){for(t.__u|=a?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;null!=i&&(i[i.indexOf(l)]=null),t.__e=l}else if(null!=i)for(x=i.length;x--;)Ot(i[x])}else t.__e=n.__e;null==t.__k&&(t.__k=n.__k||[]),e.then||nn(t),gt.__e(e,t,n)}}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=sn(n.__e,t,n,o,r,i,s,a,u);return(c=gt.diffed)&&c(t),128&t.__u?void 0:l}function nn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(nn))}function on(e,t,n){for(var o=0;o<n.length;o++)ln(n[o],n[++o],n[++o]);gt.__c&>.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){gt.__e(e,t.__v)}})}function rn(e){return"object"!=typeof e||null==e||e.__b>0?e:Tt(e)?e.map(rn):void 0!==e.constructor?null:jt({},e)}function sn(e,t,n,o,r,i,s,l,a){var u,c,d,p,f,_,h,m=n.props||At,y=t.props,g=t.type;if("svg"==g?r="http://www.w3.org/2000/svg":"math"==g?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=i)for(u=0;u<i.length;u++)if((f=i[u])&&"setAttribute"in f==!!g&&(g?f.localName==g:3==f.nodeType)){e=f,i[u]=null;break}if(null==e){if(null==g)return document.createTextNode(y);e=document.createElementNS(r,g,y.is&&y),l&&(gt.__m&>.__m(t,i),l=!1),i=null}if(null==g)m===y||l&&e.data==y||(e.data=y);else{if(i="textarea"==g&&null!=y.defaultValue?null:i&&yt.call(e.childNodes),!l&&null!=i)for(m={},u=0;u<e.attributes.length;u++)m[(f=e.attributes[u]).name]=f.value;for(u in m)f=m[u],"dangerouslySetInnerHTML"==u?d=f:"children"==u||u in y||"value"==u&&"defaultValue"in y||"checked"==u&&"defaultChecked"in y||Xt(e,u,null,f,r);for(u in y)f=y[u],"children"==u?p=f:"dangerouslySetInnerHTML"==u?c=f:"value"==u?_=f:"checked"==u?h=f:l&&"function"!=typeof f||m[u]===f||Xt(e,u,f,m[u],r);if(c)l||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),Kt("template"==t.type?e.content:e,Tt(p)?p:[p],t,n,o,"foreignObject"==g?"http://www.w3.org/1999/xhtml":r,i,s,i?i[0]:n.__k&&Ut(n,0),l,a),null!=i)for(u=i.length;u--;)Ot(i[u]);l&&"textarea"!=g||(u="value","progress"==g&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[u]||"progress"==g&&!_||"option"==g&&_!=m[u])&&Xt(e,u,_,m[u],r),u="checked",null!=h&&h!=e[u]&&Xt(e,u,h,m[u],r))}return e}function ln(e,t,n){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){gt.__e(e,n)}}function an(e,t,n){var o,r;if(gt.unmount&>.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ln(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){gt.__e(e,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&an(o[r],t,n||"function"!=typeof e.type);n||Ot(e.__e),e.__c=e.__=e.__e=void 0}function un(e,t,n){return this.constructor(e,n)}function cn(e,t,n){var o,r,i,s;t==document&&(t=document.documentElement),gt.__&>.__(e,t),r=(o="function"==typeof n)?null:n&&n.__k||t.__k,i=[],s=[],tn(t,e=(!o&&n||t).__k=Lt(zt,null,[e]),r||At,At,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?yt.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,s),on(i,e,s),e.props.children=null}function dn(e,t){cn(e,t,dn)}function pn(e,t,n){var o,r,i,s,l=jt({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==i?o=t[i]:"ref"==i?r=t[i]:l[i]=void 0===t[i]&&null!=s?s[i]:t[i];return arguments.length>2&&(l.children=arguments.length>3?yt.call(arguments,2):n),Ht(e.type,l,o||e.key,r||e.ref,null)}yt=It.slice,gt={__e:function(e,t,n,o){for(var r,i,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},vt=0,Dt.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=jt({},this.state),"function"==typeof e&&(e=e(jt({},n),this.props)),e&&jt(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Bt(this))},Dt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Bt(this))},Dt.prototype.render=zt,bt=[],wt="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,St=function(e,t){return e.__v.__b-t.__v.__b},Vt.__r=0,Ct=Math.random().toString(8),xt="__d"+Ct,Et="__a"+Ct,Pt=/(PointerCapture)$|Capture$/i,Mt=0,Ft=en(!1),Rt=en(!0),$t=0;var fn=0;Array.isArray;function _n(e,t,n,o,r,i){t||(t={});var s,l,a=t;if("ref"in a)for(l in a={},t)"ref"==l?s=t[l]:a[l]=t[l];var u={type:e,props:a,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--fn,__i:-1,__u:0,__source:r,__self:i};if("function"==typeof e&&(s=e.defaultProps))for(l in s)void 0===a[l]&&(a[l]=s[l]);return gt.vnode&>.vnode(u),u}var hn,mn,yn,gn,vn=0,bn=[],kn=gt,wn=kn.__b,Sn=kn.__r,Cn=kn.diffed,xn=kn.__c,En=kn.unmount,Pn=kn.__;function Mn(e,t){kn.__h&&kn.__h(mn,e,vn||t),vn=0;var n=mn.__H||(mn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Fn(e){return vn=1,Rn(Vn,e)}function Rn(e,t,n){var o=Mn(hn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Vn(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=mn,!mn.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,s=o.__c.props!==e;if(o.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),i){var l=i.call(this,e,t,n);return r?l||s:l}return!r||s};mn.__f=!0;var i=mn.shouldComponentUpdate,s=mn.componentWillUpdate;mn.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}s&&s.call(this,e,t,n)},mn.shouldComponentUpdate=r}return o.__N||o.__}function $n(e,t){var n=Mn(hn++,3);!kn.__s&&Bn(n.__H,t)&&(n.__=e,n.u=t,mn.__H.__h.push(n))}function An(e,t){var n=Mn(hn++,4);!kn.__s&&Bn(n.__H,t)&&(n.__=e,n.u=t,mn.__h.push(n))}function In(e){return vn=5,Tn(function(){return{current:e}},[])}function Nn(e,t,n){vn=6,An(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}function Tn(e,t){var n=Mn(hn++,7);return Bn(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function jn(e,t){return vn=8,Tn(function(){return e},t)}function On(e){var t=mn.context[e.__c],n=Mn(hn++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(mn)),t.props.value):e.__}function Ln(e,t){kn.useDebugValue&&kn.useDebugValue(t?t(e):e)}function Hn(){var e=Mn(hn++,11);if(!e.__){for(var t=mn.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function zn(){for(var e;e=bn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Wn),t.__h.some(qn),t.__h=[]}catch(n){t.__h=[],kn.__e(n,e.__v)}}}kn.__b=function(e){mn=null,wn&&wn(e)},kn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Pn&&Pn(e,t)},kn.__r=function(e){Sn&&Sn(e),hn=0;var t=(mn=e.__c).__H;t&&(yn===mn?(t.__h=[],mn.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Wn),t.__h.some(qn),t.__h=[],hn=0)),yn=mn},kn.diffed=function(e){Cn&&Cn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==bn.push(t)&&gn===kn.requestAnimationFrame||((gn=kn.requestAnimationFrame)||Un)(zn)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),yn=mn=null},kn.__c=function(e,t){t.some(function(e){try{e.__h.some(Wn),e.__h=e.__h.filter(function(e){return!e.__||qn(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],kn.__e(n,e.__v)}}),xn&&xn(e,t)},kn.unmount=function(e){En&&En(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Wn(e)}catch(e){t=e}}),n.__H=void 0,t&&kn.__e(t,n.__v))};var Dn="function"==typeof requestAnimationFrame;function Un(e){var t,n=function(){clearTimeout(o),Dn&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Dn&&(t=requestAnimationFrame(n))}function Wn(e){var t=mn,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),mn=t}function qn(e){var t=mn;e.__c=e.__(),mn=t}function Bn(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Vn(e,t){return"function"==typeof t?t(e):t}function Kn(e,t){for(var n in t)e[n]=t[n];return e}function Zn(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function Jn(e,t){var n=t(),o=Fn({t:{__:n,u:t}}),r=o[0].t,i=o[1];return An(function(){r.__=n,r.u=t,Yn(r)&&i({t:r})},[e,n,t]),$n(function(){return Yn(r)&&i({t:r}),e(function(){Yn(r)&&i({t:r})})},[e]),n}function Yn(e){try{return!((t=e.__)===(n=e.u())&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}var t,n}function Gn(e){e()}function Qn(e){return e}function Xn(){return[!1,Gn]}var eo=An;function to(e,t){this.props=e,this.context=t}(to.prototype=new Dt).isPureReactComponent=!0,to.prototype.shouldComponentUpdate=function(e,t){return Zn(this.props,e)||Zn(this.state,t)};var no=gt.__b;gt.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),no&&no(e)};var oo="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var ro=function(e,t){return null==e?null:Yt(Yt(e).map(t))},io={map:ro,forEach:ro,count:function(e){return e?Yt(e).length:0},only:function(e){var t=Yt(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:Yt},so=gt.__e;gt.__e=function(e,t,n,o){if(e.then)for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t);so(e,t,n,o)};var lo=gt.unmount;function ao(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=Kn({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return ao(e,t,n)})),e}function uo(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return uo(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function co(){this.__u=0,this.o=null,this.__b=null}function po(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function fo(){this.i=null,this.l=null}gt.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),lo&&lo(e)},(co.prototype=new Dt).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=po(o.__v),i=!1,s=function(){i||o.__z||(i=!0,n.__R=null,r?r(a):a())};n.__R=s;var l=n.__P;n.__P=null;var a=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=uo(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=l,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},co.prototype.componentWillUnmount=function(){this.o=[]},co.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=ao(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Lt(zt,null,e.fallback);return r&&(r.__u&=-33),[Lt(zt,null,t.__a?null:e.children),r]};var _o=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function ho(e){return this.getChildContext=function(){return e.context},e.children}function mo(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){cn(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}cn(Lt(ho,{context:t.context},e.__v),t.v)}(fo.prototype=new Dt).__a=function(e){var t=this,n=po(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),_o(t,e,o)):r()};n?n(i):i()}},fo.prototype.render=function(e){this.i=null,this.l=new Map;var t=Yt(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},fo.prototype.componentDidUpdate=fo.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){_o(e,n,t)})};var yo="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,go=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,vo=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,bo=/[A-Z0-9]/g,ko="undefined"!=typeof document,wo=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};Dt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Dt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var So=gt.event;gt.event=function(e){return So&&(e=So(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Co,xo={configurable:!0,get:function(){return this.class}},Eo=gt.vnode;gt.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1==n.indexOf("-");for(var i in t){var s=t[i];if(!("value"===i&&"defaultValue"in t&&null==s||ko&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var l=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===s?s="":"translate"===l&&"no"===s?s=!1:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?i="ondblclick":"onchange"!==l||"input"!==n&&"textarea"!==n||wo(t.type)?"onfocus"===l?i="onfocusin":"onblur"===l?i="onfocusout":vo.test(i)&&(i=l):l=i="oninput":r&&go.test(i)?i=i.replace(bo,"-$&").toLowerCase():null===s&&(s=void 0),"oninput"===l&&o[i=l]&&(i="oninputCapture"),o[i]=s}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=Yt(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=Yt(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",xo)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=yo,Eo&&Eo(e)};var Po=gt.__r;gt.__r=function(e){Po&&Po(e),Co=e.__c};var Mo=gt.diffed;gt.diffed=function(e){Mo&&Mo(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),Co=null};var Fo={ReactCurrentDispatcher:{current:{readContext:function(e){return Co.__n[e.__c].props.value},useCallback:jn,useContext:On,useDebugValue:Ln,useDeferredValue:Qn,useEffect:$n,useId:Hn,useImperativeHandle:Nn,useInsertionEffect:eo,useLayoutEffect:An,useMemo:Tn,useReducer:Rn,useRef:In,useState:Fn,useSyncExternalStore:Jn,useTransition:Xn}}};function Ro(e){return!!e&&e.$$typeof===yo}var $o={useState:Fn,useId:Hn,useReducer:Rn,useEffect:$n,useLayoutEffect:An,useInsertionEffect:eo,useTransition:Xn,useDeferredValue:Qn,useSyncExternalStore:Jn,startTransition:Gn,useRef:In,useImperativeHandle:Nn,useMemo:Tn,useCallback:jn,useContext:On,useDebugValue:Ln,version:"18.3.1",Children:io,render:function(e,t,n){return null==t.__k&&(t.textContent=""),cn(e,t),"function"==typeof n&&n(),e?e.__c:null},hydrate:function(e,t,n){return dn(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&(cn(null,e),!0)},createPortal:function(e,t){var n=Lt(mo,{__v:e,h:t});return n.containerInfo=t,n},createElement:Lt,createContext:function(e){function t(e){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,Bt(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+$t++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createFactory:function(e){return Lt.bind(null,e)},cloneElement:function(e){return Ro(e)?pn.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:zt,isValidElement:Ro,isElement:Ro,isFragment:function(e){return Ro(e)&&e.type===zt},isMemo:function(e){return!!e&&"string"==typeof e.displayName&&0==e.displayName.indexOf("Memo(")},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:Dt,PureComponent:to,memo:function(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:Zn(this.props,e)}function o(t){return this.shouldComponentUpdate=n,Lt(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o},forwardRef:function(e){function t(t){var n=Kn({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=oo,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,t){var n,o=gt.debounceRendering;gt.debounceRendering=function(e){n=e};try{var r=e(t);return n&&n(),r}finally{gt.debounceRendering=o}},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:zt,Suspense:co,SuspenseList:fo,lazy:function(e){var t,n,o,r=null;function i(i){if(t||(t=e()).then(function(e){e&&(r=e.default||e),o=!0},function(e){n=e,o=!0}),n)throw n;if(!o)throw t;return r?Lt(r,i):null}return i.displayName="Lazy",i.__f=!0,i},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Fo};const Ao={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function Io({slot:e,align:t,inverse:n,colors:o}){const r={...u[e.variant],textAlign:e.align??t},i=d(e.variant,o,n);return i&&(r.color=i),$o.createElement("div",{style:r,dangerouslySetInnerHTML:{__html:be(e.html)}})}function No({slot:e,accent:t,onRequestClose:n,onPageChange:o}){const r=h(e.variant,t),i={};if("close"===e.action.type)return $o.createElement("div",{style:i},$o.createElement("button",{type:"button",style:r,onClick:n},e.label));if("page"===e.action.type){const t=e.action.page;return $o.createElement("div",{style:i},$o.createElement("button",{type:"button",style:r,onClick:()=>o(t)},e.label))}const s=me(e.action.url);return s?$o.createElement("div",{style:i},$o.createElement("a",{href:s,...ye(e.action.target),style:r},e.label)):$o.createElement("div",{style:i},$o.createElement("button",{type:"button",style:r},e.label))}function To({message:e,align:t,inverse:n,colors:o}){const r=d("body",o,n);return $o.createElement("div",{style:{...u.body,padding:"4px 0",textAlign:t,...r?{color:r}:{}}},e)}const jo=/^\S+@\S+\.\S+$/,Oo={email:"email",phone:"tel"},Lo={email:"email",firstName:"given-name",lastName:"family-name",phone:"tel"},Ho="__privacy";function zo({slot:e,align:t,inverse:n,colors:o,onSubmitForm:r}){const[i,s]=Fn({}),[l,a]=Fn(!1),[c,p]=Fn(null),[f,g]=Fn({}),[v,b]=Fn("idle"),k=d("caption",o,n),w={...u.caption,...k?{color:k}:{}},S={fontSize:12,lineHeight:1.4,color:m,paddingTop:2};if("success"===v||"confirm"===v)return $o.createElement(To,{message:"confirm"===v?e.confirmEmailMessage:e.successMessage,align:t,inverse:n,colors:o});const C="submitting"===v,E=e.privacy?me(e.privacy.url):void 0,P={...h(e.submitVariant,o.accent),...C?{opacity:.6,cursor:"default"}:{}};return $o.createElement("form",{noValidate:!0,style:{margin:0,textAlign:"left"},onSubmit:t=>{t.preventDefault(),(()=>{if(!r||!e.formCode||"submitting"===v)return;const t={};for(const n of e.fields){const e=(i[n.key]??"").trim();n.required&&!e?t[n.key]="Required":"email"===n.kind&&e&&!jo.test(e)&&(t[n.key]="Enter a valid email")}if(e.privacy&&!l&&(t[Ho]="Please accept the privacy policy"),g(t),Object.keys(t).length>0)return;const n={email:"",policyAccepted:!e.privacy||l},o={};for(const t of e.fields){const e=(i[t.key]??"").trim();e&&("email"===t.kind?n.email=n.email||e:"firstName"===t.kind?n.firstName=e:"lastName"===t.kind?n.lastName=e:"phone"===t.kind?n.phone=e:o[t.tag||t.key]=e)}Object.keys(o).length>0&&(n.customFields=o),b("submitting"),Promise.resolve().then(()=>r(e.formCode,n)).then(e=>b("confirm-email"===e?"confirm":"success"),()=>b("error"))})()}},e.fields.map(e=>{const t=f[e.key];let n;return t?n=m:c===e.key&&(n=o.accent),$o.createElement("div",{key:e.key,style:{padding:"4px 0"}},e.label&&$o.createElement("div",{style:{...w,paddingBottom:4}},e.label),$o.createElement("input",{type:Oo[e.kind]??"text",autoComplete:Lo[e.kind],placeholder:e.placeholder||void 0,value:i[e.key]??"",disabled:C,style:y(n),onFocus:()=>p(e.key),onBlur:()=>p(t=>t===e.key?null:t),onChange:t=>{return n=e.key,o=t.currentTarget.value,s(e=>({...e,[n]:o})),void g(e=>e[n]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==n)):e);var n,o}}),t&&$o.createElement("div",{style:S},t))}),e.privacy&&$o.createElement("div",{style:{padding:"4px 0"}},$o.createElement("label",{style:{...w,display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"}},$o.createElement("input",{type:"checkbox",checked:l,disabled:C,style:{margin:"2px 0 0",flexShrink:0},onChange:e=>{a(e.currentTarget.checked),g(e=>e[Ho]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==Ho)):e)}}),$o.createElement("span",null,e.privacy.checkboxLabel,E&&$o.createElement($o.Fragment,null," ",$o.createElement("a",{href:E,...ye(void 0),style:{color:o.accent}},e.privacy.linkLabel||e.privacy.url)))),f[Ho]&&$o.createElement("div",{style:S},f[Ho])),$o.createElement("div",{style:{padding:_}},$o.createElement("button",{type:"submit",disabled:C,style:P},e.submitLabel)),"error"===v&&$o.createElement("div",{style:{...S,textAlign:t}},x))}function Do({value:e,label:t,digitStyle:n,labelStyle:o}){return $o.createElement("div",{style:{minWidth:44}},$o.createElement("div",{style:n},String(e).padStart(2,"0")),t?$o.createElement("div",{style:o},t):null)}function Uo({slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:s}){const[l,a]=Fn(()=>Date.now()),c=function(e,t,n){const o=_e(e,t),r=null===o?0:Math.max(0,o-n),i=Math.floor(r/1e3);return{total:r,days:Math.floor(i/86400),hours:Math.floor(i/3600)%24,minutes:Math.floor(i/60)%60,seconds:i%60}}(e.endTime,e.timezone,l),p=0===c.total;$n(()=>{if("live"!==r||p)return;const e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[r,p,e.endTime,e.timezone]),$n(()=>{"live"===r&&p&&("hide-popup"===e.onExpire?i?.():"page"===e.onExpire&&e.expirePage&&s(e.expirePage))},[r,p,e.onExpire,e.expirePage,i,s]);const f=d("h2",o,n),_=d("caption",o,n),h={fontSize:28,fontWeight:700,lineHeight:1.2,fontVariantNumeric:"tabular-nums",...f?{color:f}:{}},m={...u.caption,..._?{color:_}:{}},y=(g=e.language,he[g]??he.en);var g;const v=[{value:c.days,label:y.days},{value:c.hours,label:y.hours},{value:c.minutes,label:y.minutes},{value:c.seconds,label:y.seconds}];return $o.createElement("div",{style:{padding:"4px 0",textAlign:t}},$o.createElement("div",{style:{display:"inline-flex",gap:12,textAlign:"center"}},v.map(t=>$o.createElement(Do,{key:t.label||t.value,value:t.value,label:e.showLabels?t.label:"",digitStyle:h,labelStyle:m}))))}function Wo({slot:e,align:t,inverse:n,colors:o,onSubmitChoice:r}){const[i,s]=Fn([]),[l,a]=Fn("idle"),[c,p]=Fn("");if("success"===l)return $o.createElement(To,{message:e.successMessage,align:t,inverse:n,colors:o});const f=t=>{p(""),s(n=>n.includes(t)?n.filter(e=>e!==t):e.max>0&&n.length>=e.max?(p(`Pick up to ${e.max}`),n):[...n,t])},y="submitting"===l,g=d("body",o,n),v={...u.body,...g?{color:g}:{}};return $o.createElement("div",{style:{padding:"4px 0"}},"chips"===e.control?$o.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"===t?"center":"flex-start"}},e.options.map(e=>{return $o.createElement("button",{key:e.value,type:"button","aria-pressed":i.includes(e.value),style:(t=i.includes(e.value),{padding:"6px 14px",borderRadius:999,border:`1px solid ${o.accent}`,backgroundColor:t?o.accent:"transparent",color:t?"#FFFFFF":o.accent,fontFamily:"inherit",fontSize:14,lineHeight:1.4,cursor:"pointer"}),onClick:()=>f(e.value)},e.label);var t})):$o.createElement("div",{style:{display:"grid",gap:6}},e.options.map(e=>$o.createElement("label",{key:e.value,style:{...v,display:"flex",alignItems:"center",gap:8,cursor:"pointer"}},$o.createElement("input",{type:"checkbox",checked:i.includes(e.value),onChange:()=>f(e.value),style:{accentColor:o.accent,width:16,height:16,margin:0}}),e.label))),c?$o.createElement("div",{style:{...u.caption,color:m,paddingTop:4}},c):null,"error"===l?$o.createElement("div",{style:{...u.caption,color:m,paddingTop:4}},x):null,$o.createElement("div",{style:{padding:_}},$o.createElement("button",{type:"button",style:{...h(e.submitVariant,o.accent),...y?{opacity:.7}:{}},onClick:()=>{if(!r||!e.tagName||"submitting"===l)return;const t=Math.max(e.min,1);if(i.length<t)return void p(1===t?"Pick at least one":`Pick at least ${t}`);const n=e.options.filter(e=>i.includes(e.value)).map(e=>e.tagValue||e.value);p(""),a("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,tagName:e.tagName,values:n})).then(()=>a("success"),()=>a("error"))}},e.submitLabel)))}function qo({score:e,scale:t,selected:n,accent:o,onPick:r}){const i={display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,border:`1px solid ${o}`,backgroundColor:n?o:"transparent",color:n?"#FFFFFF":o,fontFamily:"inherit",fontSize:14,lineHeight:1,cursor:"pointer"};if("nps"===t)return $o.createElement("button",{type:"button","aria-label":`Rate ${e}`,"aria-pressed":n,style:{...i,width:30,height:32,borderRadius:6},onClick:r},e);const s="thumbs"===t;let l=`Rate ${e}`;return s&&(l=1===e?"Thumbs up":"Thumbs down"),$o.createElement("button",{type:"button","aria-label":l,"aria-pressed":n,style:{...i,width:s?44:34,height:s?40:34,borderRadius:s?8:6},onClick:r},$o.createElement("svg",{width:s?22:20,height:s?22:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},$o.createElement("path",{d:s?"M8 21V10l3.5-7A2 2 0 0 1 14 5v5h4.5a2 2 0 0 1 2 2.4l-1.3 6A2 2 0 0 1 17.2 21zM8 10H3.5v11H8":P.star,...s&&0===e?{transform:"rotate(180 12 12)"}:{}})))}function Bo({slot:e,align:t,inverse:n,colors:o,onSubmitRating:r}){const[i,s]=Fn(null),[l,a]=Fn("idle");if("success"===l)return $o.createElement(To,{message:e.successMessage,align:t,inverse:n,colors:o});const c=t=>{r&&e.eventName&&"submitting"!==l&&(a("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,eventName:e.eventName,score:t,scale:e.scale})).then(()=>a("success"),()=>a("error")))},p="nps"===(f=e.scale)?[0,1,2,3,4,5,6,7,8,9,10]:"stars"===f?[1,2,3,4,5]:[0,1];var f;const y=d("caption",o,n),g={...u.caption,...y?{color:y}:{}},v=t=>"stars"===e.scale?null!==i&&t<=i:i===t;return $o.createElement("div",{style:{padding:"4px 0"}},$o.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:6,justifyContent:"center"===t?"center":"flex-start"}},p.map(t=>$o.createElement(qo,{key:t,score:t,scale:e.scale,selected:v(t),accent:o.accent,onPick:()=>(t=>{"submitting"!==l&&(s(t),"instant"===e.submitMode&&c(t))})(t)}))),e.labels.low||e.labels.high?$o.createElement("div",{style:{display:"flex",justifyContent:"space-between",gap:8,paddingTop:4}},$o.createElement("span",{style:g},e.labels.low),$o.createElement("span",{style:g},e.labels.high)):null,"error"===l?$o.createElement("div",{style:{...u.caption,color:m,paddingTop:4}},x):null,"button"===e.submitMode?$o.createElement("div",{style:{padding:_}},$o.createElement("button",{type:"button",style:{...h("primary",o.accent),..."submitting"===l?{opacity:.7}:{}},onClick:()=>null===i?void 0:c(i)},e.submitLabel)):null)}function Vo({slot:e,align:t,inverse:n,colors:o}){const r=e.color||(n?o.textInverse:o.accent);return $o.createElement("div",{style:{padding:"4px 0",textAlign:t,lineHeight:0}},$o.createElement("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"inline-block"}},$o.createElement("path",{d:P[e.name]})))}function Ko({slot:e,align:t,inverse:n,colors:o,mode:r="live",onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){const c=s??(()=>{});switch(e.type){case"text":return $o.createElement(Io,{slot:e,align:t,inverse:n,colors:o});case"button":return $o.createElement(No,{slot:e,accent:o.accent,onRequestClose:i,onPageChange:c});case"email-subscription-form":return $o.createElement(zo,{slot:e,align:t,inverse:n,colors:o,onSubmitForm:l});case"timer":return $o.createElement(Uo,{slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:c});case"choice":return $o.createElement(Wo,{slot:e,align:t,inverse:n,colors:o,onSubmitChoice:a});case"rating":return $o.createElement(Bo,{slot:e,align:t,inverse:n,colors:o,onSubmitRating:u});case"glyph":return $o.createElement(Vo,{slot:e,align:t,inverse:n,colors:o})}}function Zo({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){const c=t.contents.find(t=>t.key===e.props.content);if(!c)return null;if(r?.renderZone)return $o.createElement("div",{style:{minWidth:0}},r.renderZone(c,e));const d=e.props.align??"left",p="inverse"===e.props.tone;return $o.createElement("div",{style:{minWidth:0}},c.slots.map((e,t)=>{const r=c.slots[t-1],_=r?(h=f(r),"action"===(m=f(e))?"action"===h?6:16:"text"===m&&"heading"===h?4:8):0;var h,m;return $o.createElement("div",{key:e.key,style:_?{marginTop:_}:void 0},$o.createElement(Ko,{slot:e,align:d,inverse:p,colors:n,mode:o,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}))}))}function Jo(e){return e?.video?me(e.video.src):void 0}function Yo({image:e,src:t,style:n,mode:o}){return $o.createElement("video",{src:t,poster:e.src||void 0,style:n,autoPlay:"live"===o,muted:!0,playsInline:!0,preload:"metadata",loop:!1!==e.video?.loop,controls:!0===e.video?.controls})}function Go({node:e,page:t,leaf:n,mode:o}){const r=t.images.find(t=>t.key===e.props.image);if(!r)return null;if(n?.renderImage)return $o.createElement($o.Fragment,null,n.renderImage(r,e));const i=Jo(r);if(!r.src&&!i)return null;const s={display:"block",width:"100%",minWidth:0};return r.fit?(s.height="100%",s.objectFit=r.fit):s.height="auto",r.blur&&(s.filter=`blur(${r.blur}px)`),i?$o.createElement(Yo,{image:r,src:i,style:s,mode:o}):$o.createElement("img",{src:r.src,alt:"",style:s})}function Qo({style:e,outer:t,inner:n,layer:o,children:r}){const{backgroundColor:i,...s}=e;return $o.createElement("div",{style:{display:"grid",minWidth:0,backgroundColor:i,...t}},o,$o.createElement("div",{style:{...s,...n}},r))}function Xo({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){if("Content"===e.type)return $o.createElement(Zo,{node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u});if("Image"===e.type)return $o.createElement(Go,{node:e,page:t,leaf:r,mode:o});const c=e.props?.backgroundImage,d=c?t.images.find(e=>e.key===c):void 0,p=d?.blur??0,f=d?.dim??0,_=Jo(d),h=se(e,p>0||_?void 0:d?.src||void 0,f);c&&(h.backgroundColor="#1D2939");const m=e.children.map((e,c)=>$o.createElement(Xo,{key:c,node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}));if(_&&d){const e=re(f);return $o.createElement(Qo,{style:h,outer:{position:"relative",overflow:"hidden",...d.src?ie(d.src):{}},inner:{position:"relative",...e?{backgroundImage:e}:{}},layer:$o.createElement(Yo,{image:d,src:_,mode:o,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",...p>0?{filter:`blur(${p}px)`}:{}}})},m)}return p>0?$o.createElement(Qo,{style:h,outer:d?.src?ie(d.src,f):void 0,inner:{backdropFilter:`blur(${p}px)`,WebkitBackdropFilter:`blur(${p}px)`}},m):$o.createElement("div",{style:h},m)}function er({page:e,params:t,mode:n="live",leafRenderers:o,animatePage:r=!1,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){const c={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:t.colors.background,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:t.colors.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:t.boxShadow&&"none"!==t.boxShadow?t.boxShadow:void 0,transition:"height 300ms ease"};e.height&&(c.height="stretch"===e.height?"100%":e.height,c.overflowY="auto");const d={...r?{animation:"pw-vpopup-page 300ms ease-out backwards"}:{},..."stretch"===e.height?{display:"grid",minHeight:"100%"}:{}};return $o.createElement("div",{style:c},$o.createElement("div",{key:e.key,style:d},$o.createElement(Xo,{node:e.layout,page:e,colors:t.colors,mode:n,leaf:o,onRequestClose:i,onPageChange:s??(()=>{}),onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u})))}function tr({onRequestClose:e}){return $o.createElement("button",{type:"button","aria-label":"Close",onClick:e,style:{position:"absolute",top:10,right:10,width:24,height:24,padding:0,border:"none",borderRadius:"50%",background:"rgba(255, 255, 255, 0.92)",boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:"#667085",fontSize:13,lineHeight:1,cursor:"pointer"}},"✕")}function nr(e,t,n){const{placement:o}=e,r={position:"fixed",boxSizing:"border-box",maxWidth:Ye(o),maxHeight:Ye(o),pointerEvents:"auto"};if(t){r.width=t;const e=o.h;"left"===e?r.left=o.offset:"right"===e?r.right=o.offset:r.left="50%"}else r.left=o.offset,r.right=o.offset;"stretch"===n?(r.top=o.offset,r.bottom=o.offset):"top"===o.v?r.top=o.offset:"bottom"===o.v?r.bottom=o.offset:r.top="50%";const i=t&&"center"===o.h?"-50%":"0",s="middle"===o.v&&"stretch"!==n?"-50%":"0";"0"===i&&"0"===s||(r.transform=`translate(${i}, ${s})`);const l=Ao[e.animation];return l&&(r.animation=l),r.transition="width 300ms ease",r}function or({params:e,mode:t="live",onRequestClose:n,onSubmitForm:o,onSubmitChoice:r,onSubmitRating:i,leafRenderers:s}){const[l,a]=Fn(null);$n(()=>{Je(e).forEach(e=>e.images.forEach(({src:e})=>{e&&((new Image).src=e)}))},[e]);const u=Je(e);if(0===u.length)return null;const c=u.find(e=>e.key===l)??function(e,t){return t.find(t=>t.key===e.startPage)??t[0]}(e,u),d=null!==l;if("preview"===t)return $o.createElement("div",{style:{position:"relative",width:c.width??"100%",transition:"width 300ms ease"}},$o.createElement("style",null,E),$o.createElement(er,{page:c,params:e,mode:t,leafRenderers:s,animatePage:d,onRequestClose:n,onPageChange:a,onSubmitForm:o,onSubmitChoice:r,onSubmitRating:i}));const p=e.overlay;return $o.createElement($o.Fragment,null,$o.createElement("style",null,E),p&&$o.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:p.color,opacity:p.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:n}),$o.createElement("div",{style:nr(e,c.width,c.height)},$o.createElement(er,{page:c,params:e,mode:t,leafRenderers:s,animatePage:d,onRequestClose:n,onPageChange:a,onSubmitForm:o,onSubmitChoice:r,onSubmitRating:i}),$o.createElement(tr,{onRequestClose:n})))}const rr={SUBMIT_FORM_RESULT_SUBSCRIBED:"subscribed",SUBMIT_FORM_RESULT_CONFIRM_EMAIL:"confirm-email",SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED:"already-subscribed"},ir=(e,t)=>`https://subscription-form.svc-nue.pushwoosh.com/api/v1/forms/code/${encodeURIComponent(e)}${t}`,sr=async(e,t)=>{try{const n=await fetch(ir(e,"/submit"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,userId:t.email})});if(!n.ok)throw new Error(`Subscription form submit failed: HTTP ${n.status}`);const o=await n.json(),r=rr[o.result??""];if(!r)throw new Error(`Subscription form submit failed: unexpected result "${o.result}"`);return r}catch(t){throw _t.error(t,`Failed to submit subscription form "${e}"`),t}},lr=e=>{const t=function(e){let t;try{t=JSON.parse(e)}catch{return null}if("object"!=typeof t||null===t)return null;const n=t;if(2!==n.version)return null;const o=n.params;return"object"!=typeof o||null===o?null:Array.isArray(o.pages)&&0!==o.pages.length?{version:2,params:{...o,colors:we(o)}}:null}(e);return t?0===Je(t.params).length?null:t.params:null};class ar{constructor(e){this.isRecurringVisitor=!1,this.entries=new Map,this.queue=[],this.visible=null,this.drainTimeoutId=null,this.autoShowEnabled=!0,this.isNavigationSubscribed=!1,this.openPopupsCount=0,this.bodyOverflowBeforeLock=null,this.readyPromise=new Promise(e=>{this.readyResolve=e}),this.pw=e,this.submitHandlers={onSubmitChoice:ht(e),onSubmitRating:mt(e)},e.moduleRegistry.webPopups=this}async run(){const{pw:e}=this;try{this.autoShowEnabled=!1!==e.initParams.webPopups?.autoShow,await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const t=await e.api.getPopupForms();_t.debug(`${Qe} Received ${t.length} popup(s) from server:`,t.map(e=>e.code)),t.forEach((e,t)=>{this.entries.set(e.code,{popup:e,order:t,state:"idle",content:null,loading:null,passedStrongConditions:!1,timeoutId:null,visitRecorded:!1})}),await Promise.allSettled(Array.from(this.entries.values()).map(async e=>{e.passedStrongConditions=await this.checkStrongCondition(e.popup),e.passedStrongConditions&&await this.ensureContent(e)}));const n=this.loadedCodes();_t.debug(`${Qe} ${n.length} popup(s) passed strong conditions and loaded:`,n),this.subscribeToNavigation(),this.renderForCurrentPage(),await e.data.setIsRecurringVisitor(!0)}finally{this.readyResolve(),e.dispatchEvent("web-popups-ready",{})}}async show(e){await this.readyPromise;const t=this.entries.get(e);if(!t)return _t.error(new Error("Unknown web popup code"),`${Qe} show("${e}"): no such popup`),!1;if(this.visible?.code===e)return!0;return await this.ensureContent(t)?this.visible?.code===e||!!this.checkNotExpired(t)&&(this.visible&&(_t.debug(`${Qe} show("${e}") preempting "${this.visible.code}"`),this.visible.close("preempted")),this.detachFromAutoPipeline(t),this.present(t,"api"),!0):(_t.error(new Error("Web popup content unavailable"),`${Qe} show("${e}"): content unavailable`),!1)}hide(e){return!!this.visible&&((void 0===e||this.visible.code===e)&&(this.visible.close("api"),!0))}hideAll(){const e=this.hide();return this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||(this.detachFromAutoPipeline(e),e.state="done")}),this.cancelScheduledDrain(),e}isVisible(e){return!!this.visible&&(void 0===e||this.visible.code===e)}getVisibleCode(){return this.visible?.code??null}getAvailableCodes(){return Array.from(this.entries.keys())}getState(){const e=[];return this.entries.forEach((t,n)=>{"waiting"===t.state&&e.push(n)}),{visible:this.getVisibleCode(),queued:[...this.queue],waiting:e,available:this.getAvailableCodes()}}ensureContent(e){return e.content?Promise.resolve(e.content):(e.loading||(e.loading=this.loadContent(e.popup).then(t=>(e.content=t,t)).catch(t=>(_t.error(t,`${Qe} Failed to load web popup "${e.popup.code}"`),null)).finally(()=>{e.content||(e.loading=null)})),e.loading)}async loadContent(e){const t=await this.pw.api.getPopupFormContent(e.popup_form_content_code),n=lr(t.json);return n||(_t.error(new Error("Unsupported popup content format"),`${Qe} Web popup "${e.code}" content is not a supported {version, params} popup; skipping`),null)}loadedCodes(){const e=[];return this.entries.forEach((t,n)=>{t.content&&e.push(n)}),e}renderForCurrentPage(){this.releaseUnmatchedPending();const e=[];this.entries.forEach((t,n)=>{this.canAutoDisplay(t)&&(this.armDelay(t),e.push(n))}),_t.debug(`${Qe} ${e.length} popup(s) selected for display on "${window.location.pathname}":`,e),this.drain()}canAutoDisplay(e){return this.autoShowEnabled&&"idle"===e.state&&e.passedStrongConditions&&this.isAutoTrigger(e.popup)&&null!==e.content&&this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)}isAutoTrigger(e){const t=e.trigger_type;return!t||"PAGE_LOAD"===t}armDelay(e){const{popup:t}=e;_t.debug(`${Qe} Popup "${t.code}" armed for display in ${t.delay}s`),e.state="waiting",this.recordVisit(e),e.timeoutId=window.setTimeout(()=>{e.timeoutId=null,e.state="queued",this.insertIntoQueue(e),_t.debug(`${Qe} Popup "${t.code}" delay elapsed; queued at position ${this.queue.indexOf(t.code)+1} of ${this.queue.length}`),this.drain()},1e3*t.delay)}recordVisit(e){e.visitRecorded||(e.visitRecorded=!0,this.pw.api.recordPopupFormEvent(e.popup.code,1).catch(t=>{_t.error(t,`${Qe} Failed to record web popup visit event for "${e.popup.code}"`)}))}insertIntoQueue(e){const t=this.queue.findIndex(t=>{const n=this.entries.get(t);return!!n&&(n.popup.delay!==e.popup.delay?n.popup.delay>e.popup.delay:n.order>e.order)});-1!==t?this.queue.splice(t,0,e.popup.code):this.queue.push(e.popup.code)}releaseUnmatchedPending(){this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)||(this.detachFromAutoPipeline(e),e.state="idle",_t.debug(`${Qe} Released popup "${e.popup.code}": page no longer matches, or its countdown passed`))})}detachFromAutoPipeline(e){null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null);const t=this.queue.indexOf(e.popup.code);-1!==t&&this.queue.splice(t,1)}drain(){if(this.visible||null!==this.drainTimeoutId)return;const e=this.queue.shift();if(void 0===e)return;const t=this.entries.get(e);if(t&&"queued"===t.state){if(!this.checkSoftCondition(t.popup)||!this.checkNotExpired(t))return t.state="idle",void this.drain();if(!t.content)return t.state="done",void this.drain();_t.debug(`${Qe} Display slot free; showing "${e}"`),this.present(t,"auto")}else this.drain()}scheduleDrain(){null===this.drainTimeoutId&&(this.drainTimeoutId=window.setTimeout(()=>{this.drainTimeoutId=null,this.drain()},400))}cancelScheduledDrain(){null!==this.drainTimeoutId&&(window.clearTimeout(this.drainTimeoutId),this.drainTimeoutId=null)}present(e,t){this.cancelScheduledDrain();const{popup:n,content:o}=e;if(!o)return void(e.state="done");const r=document.createElement("div");r.id=`${Ge}-${n.code}`,r.style.position="fixed",r.style.inset="0",r.style.zIndex=String(2147483647),r.style.pointerEvents="none",document.body.appendChild(r);const i=r.attachShadow({mode:"open"}),s=document.createElement("div");i.appendChild(s);const l=!!o.overlay;l&&this.lockBodyScroll();let a=!1;const u=t=>{a||(a=!0,l&&this.unlockBodyScroll(),(e=>{cn(null,e)})(s),r.remove(),this.visible?.code===n.code&&(this.visible=null),e.state="done",this.pw.dispatchEvent("hide-web-popup",{code:n.code,reason:t}),this.scheduleDrain())};this.visible={code:n.code,host:r,modal:l,close:u},e.state="visible",((e,t,n,o)=>{cn(_n(or,{params:t,mode:"live",onRequestClose:n,onSubmitForm:sr,onSubmitChoice:o.onSubmitChoice,onSubmitRating:o.onSubmitRating}),e)})(s,o,()=>u("user"),this.submitHandlers);const c=function(e){const t=new Set;for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots)"object"==typeof n&&null!==n&&"email-subscription-form"===n.type&&"string"==typeof n.formCode&&n.formCode&&t.add(n.formCode);return[...t]}(o);c.length>0&&this.pw.data.getHwid().then(e=>c.forEach(t=>((e,t)=>{fetch(ir(e,"/view"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,userId:t,hwid:t})}).catch(t=>{_t.error(t,`Failed to record subscription form view for "${e}"`)})})(t,e))).catch(e=>{_t.error(e,`${Qe} Failed to record subscription form views for web popup "${n.code}"`)}),_t.debug(`${Qe} Popup "${n.code}" shown (trigger: ${t})`),this.recordVisit(e),this.markAsShown(n).catch(e=>{_t.error(e,`${Qe} Failed to mark web popup "${n.code}" as shown`)}),this.pw.dispatchEvent("show-web-popup",{code:n.code,trigger:t})}lockBodyScroll(){0===this.openPopupsCount&&(this.bodyOverflowBeforeLock=document.body.style.overflow,document.body.style.overflow="hidden"),this.openPopupsCount+=1}unlockBodyScroll(){this.openPopupsCount=Math.max(0,this.openPopupsCount-1),0===this.openPopupsCount&&null!==this.bodyOverflowBeforeLock&&(document.body.style.overflow=this.bodyOverflowBeforeLock,this.bodyOverflowBeforeLock=null)}subscribeToNavigation(){if(this.isNavigationSubscribed)return;this.isNavigationSubscribed=!0;const e=()=>this.renderForCurrentPage(),t=window.navigation;if(t&&"function"==typeof t.addEventListener)return void t.addEventListener("currententrychange",e);window.addEventListener("popstate",e),window.addEventListener("hashchange",e);let n=window.location.href;window.setInterval(()=>{window.location.href!==n&&(n=window.location.href,e())},500)}async checkStrongCondition(e){return(await Promise.all([this.checkCanBeShownByDeviceTypeCondition(e),this.checkCanBeShownByFrequencyCondition(e),this.checkCanBeShownByVisitorsTypeCondition(e)])).every(e=>e)}checkSoftCondition(e){return this.checkCanBeShownByMatchingPagesCondition(e)}checkNotExpired(e){return!e.content||(!function(e,t){for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots){if("object"!=typeof n||null===n)continue;if("timer"!==n.type||"hide-popup"!==n.onExpire)continue;if("string"!=typeof n.endTime)continue;const e="string"==typeof n.timezone?n.timezone:"",o=_e(n.endTime,e);if(null!==o&&o<=t)return!0}return!1}(e.content,Date.now())||(_t.debug(`${Qe} Popup "${e.popup.code}" not shown: its countdown has passed`),!1))}checkCanBeShownByDeviceTypeCondition(e){const{device_type:t}=e,n=this.pw.platformChecker.formFactor;return"ALL"===t||t===n}async checkCanBeShownByFrequencyCondition(e){const{frequency:t,code:n}=e;if("ONCE"===t){return!(await this.pw.data.getShownWebPopups()).includes(n)}return"ONCE_PER_SESSION"!==t||null===sessionStorage.getItem(this.getSessionStorageKey(n))}checkCanBeShownByMatchingPagesCondition(e){const{matching_pages:t,matching_page_rules:n,excluded_pages:o}=e,r=window.location.pathname;return n&&n.length>0?n.some(e=>this.matchPageRule(r,e)):t&&t.length>0?t.includes(r):!(o&&o.length>0)||!o.some(e=>this.matchPageRule(r,e))}matchPageRule(e,t){switch(t.operator){case"EQUALS":return e===t.path;case"STARTS_WITH":return e.startsWith(t.path);default:return!1}}checkCanBeShownByVisitorsTypeCondition(e){const{visitors_type:t}=e;return"NEW"===t?!this.isRecurringVisitor:"RECURRING"!==t||this.isRecurringVisitor}async markAsShown(e){this.pw.api.recordPopupFormEvent(e.code,2).catch(t=>{_t.error(t,`${Qe} Failed to record web popup shown event for "${e.code}"`)});const{frequency:t,code:n}=e;"ONCE"!==t?"ONCE_PER_SESSION"===t&&sessionStorage.setItem(this.getSessionStorageKey(n),"1"):await this.pw.data.addShownWebPopup(n)}getSessionStorageKey(e){return`${Ge}.shown.${e}`}}return t})());
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,()=>(()=>{"use strict";const e={d:(t,n)=>{if(Array.isArray(n))for(var o=0;o<n.length;){var r=n[o++],i=n[o++];e.o(t,r)?0===i&&o++:0===i?Object.defineProperty(t,r,{enumerable:!0,value:n[o++]}):Object.defineProperty(t,r,{enumerable:!0,get:i})}else for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{WebPopupsWidget:()=>ar});const n=/^(https?:|mailto:|tel:)/i,o="#101828",r="#FFFFFF",i="#2970FF",s=o,l="#667085",a="#FFFFFF",u={h1:{fontSize:24,fontWeight:600,lineHeight:1.25},h2:{fontSize:18,fontWeight:600,lineHeight:1.3},h3:{fontSize:16,fontWeight:600,lineHeight:1.35},body:{fontSize:14,fontWeight:"normal",lineHeight:1.5},caption:{fontSize:12,fontWeight:"normal",lineHeight:1.4},eyebrow:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",lineHeight:1.4},icon:{fontSize:24,lineHeight:1.2}},c={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function d(e,t,n){return n?function(e,t){if(t>=1)return e;const n=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(e)?.[1];if(!n)return e;const o=3===n.length?n.split("").map(e=>e+e).join(""):n,[r,i,s]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${r}, ${i}, ${s}, ${t})`}(t.textInverse,c[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const p=["h1","h2","h3","icon"];function f(e){return"glyph"===e.type?"heading":"text"!==e.type?"action":p.includes(e.variant)?"heading":"text"}const _="8px 0 4px";function h(e,t){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:6,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===e?{backgroundColor:"#FFFFFF",color:t,border:`1px solid ${t}`}:{backgroundColor:t,color:"#FFFFFF",border:"none"}}}const m="#D92D20";function y(e="#D0D5DD"){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 12px",borderRadius:6,fontSize:14,fontFamily:"inherit",lineHeight:1.5,backgroundColor:"#FFFFFF",color:o,border:`1px solid ${e}`,outline:"none"}}const g="Subscribe",v="Thanks for subscribing!",b="Please check your inbox and confirm your email.",k="Save",w="Thanks! Your choice is saved.",S="Send",C="Thanks for the feedback!";const x="Something went wrong. Please try again.",E="\n@keyframes pw-vpopup-fade { from { opacity: 0; } }\n@keyframes pw-vpopup-slide { from { opacity: 0; translate: 0 28px; } }\n@keyframes pw-vpopup-overlay { from { opacity: 0; } }\n@keyframes pw-vpopup-page { from { opacity: 0; } }\n",P={bell:"M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0",gift:"M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z",cart:"M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",chart:"M3 21h18M7 21V11M12 21V6M17 21v-8",lock:"M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3",calendar:"M4 6h16v15H4zM4 10h16M9 3v4M15 3v4",check:"M4 13l5 5L20 6",star:"M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z",clock:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2",tag:"M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0",mail:"M3 6h18v12H3zM3 7l9 6 9-6",phone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4",download:"M12 3v12M7 11l5 5 5-5M4 20h16",play:"M8 5l12 7-12 7z",shield:"M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z",sparkle:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z",percent:"M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0",truck:"M2 7h12v10H2zM14 10h4l3 3v4h-7M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",ticket:"M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12",user:"M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0"},M=Object.keys(P),F=[24,32,48],R=["Vertical","Horizontal","Columns","Rows"],$=["normal","reverse"],A=["start","center","end","stretch"],I=["start","center","end","space-between"],N=["left","center","right"],T=["default","inverse"],j=2e3,O={px:j,"%":100,em:125,rem:125},L=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,H={px:j,"%":100,fr:100},z=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,D=["auto","min-content","max-content"];function U(e,t){return t.includes(e)?e:void 0}function W(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),j);if("string"!=typeof e)return;const t=L.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),O[o])}${o}`}const q=["top","right","bottom","left"];function B(e){if(D.includes(e))return e;const t=z.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),H[o])}${o}`}function V(e){return"string"==typeof e&&e.length>0?e:void 0}function K(e){const t={},n=W(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=W(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of q){const o=W(e[t]);void 0!==o&&(n[t]=o)}return Object.keys(n).length>0?n:void 0}(e.padding);void 0!==o&&(t.padding=o);const r=U(e.alignItems,A);r&&(t.alignItems=r);const i=U(e.justifyContent,I);i&&(t.justifyContent=i);const s=U(e.alignContent,I);s&&(t.alignContent=s);const l=V(e.backgroundImage);l&&(t.backgroundImage=l);const a=function(e){if("number"==typeof e)return Number.isInteger(e)&&e>=1&&e<=12?e:void 0;if("string"!=typeof e)return;const t=e.trim().split(/\s+/);if(t.length<1||t.length>12)return;const n=t.map(B);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==a&&(t.sizes=a),t}function Z(e,t,n){if(t>10||n.nodes<=0)return null;if("object"!=typeof e||null===e)return null;n.nodes-=1;const o=e,r="object"==typeof o.props&&null!==o.props?o.props:{};if("Content"===o.type){const e=V(r.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=U(r.align,N);n&&(t.props.align=n);const o=U(r.tone,T);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=V(r.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const i=U(o.type,R)??"Vertical",s=[];for(const e of o.children){const o=Z(e,t+1,n);o&&s.push(o)}const l=K(r);return"reverse"===U(r.order,$)&&(s.reverse(),"string"==typeof l.sizes&&(l.sizes=l.sizes.split(" ").reverse().join(" "))),{type:i,props:l,children:s}}function J(e){return Z(e,0,{nodes:100})}const Y=/^[a-zA-Z][a-zA-Z0-9-]*$/,G=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function Q(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=G.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function X(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:te(e,t,0)}const ee=new Set(["content","image","backgroundImage"]);function te(e,t,n){if(n>10||"object"!=typeof e||null===e)return e;const o=e,r={...o};if("object"==typeof o.props&&null!==o.props){const e={...o.props};for(const[n,o]of Object.entries(e))if(!ee.has(n))if("string"==typeof o)e[n]=Q(o,t);else if("object"==typeof o&&null!==o&&!Array.isArray(o)){const r={...o};for(const[e,n]of Object.entries(r))"string"==typeof n&&(r[e]=Q(n,t));e[n]=r}r.props=e}return Array.isArray(o.children)&&(r.children=o.children.map(e=>te(e,t,n+1))),r}function ne(e){return"number"==typeof e?`${e}px`:e}function oe(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function re(e=0){if(!(e>0))return null;const t=`rgba(16, 24, 40, ${Math.min(e,1)})`;return`linear-gradient(${t}, ${t})`}function ie(e,t=0){const n=`url(${JSON.stringify(e)})`,o=re(t);return{backgroundImage:o?`${o}, ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function se(e,t,n=0){const o=e.props??{},r={display:"grid",minWidth:0};return"Horizontal"===e.type&&(r.gridAutoFlow="column"),"Columns"===e.type&&(r.gridTemplateColumns=oe(o.sizes,e.children.length)),"Rows"===e.type&&(r.gridTemplateRows=oe(o.sizes,e.children.length)),void 0!==o.gap&&(r.gap=ne(o.gap)),void 0!==o.padding&&(r.padding=function(e){if("number"==typeof e||"string"==typeof e)return ne(e);const t=e=>void 0===e?"0":ne(e);return`${t(e.top)} ${t(e.right)} ${t(e.bottom)} ${t(e.left)}`}(o.padding)),o.alignItems&&(r.alignItems=o.alignItems),o.justifyContent&&(r.justifyContent=o.justifyContent),o.alignContent&&(r.alignContent=o.alignContent),t&&Object.assign(r,ie(t,n)),r}const le=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/,ae=new Map;function ue(e){const t=ae.get(e);if(t)return t;try{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});return ae.set(e,t),t}catch{return null}}function ce(e){return!e||null!==ue(e)}function de(e,t){const n=t.formatToParts(new Date(e)),o=e=>Number(n.find(t=>t.type===e)?.value??"0");return Date.UTC(o("year"),o("month")-1,o("day"),o("hour")%24,o("minute"),o("second"))-e}const pe=864e5;const fe=new Map;function _e(e,t){const n=`${e}|${t}`,o=fe.get(n);if(void 0!==o)return o;const r=function(e,t){const n=le.exec((e||"").trim());if(!n)return null;const[,o,r,i,s,l,a]=n.map(Number),u=Number.isNaN(a)?0:a;if(r<1||r>12||i<1||i>31)return null;if(s>23||l>59||u>59)return null;const c=Date.UTC(o,r-1,i,s,l,u),d=new Date(c);if(d.getUTCMonth()!==r-1||d.getUTCDate()!==i)return null;if(!t)return c;const p=ue(t);if(!p)return null;const f=function(e,t){const n=[];for(const o of[e-pe,e,e+pe]){const e=de(o,t);n.includes(e)||n.push(e)}return n}(c,p),_=f.filter(e=>de(c-e,p)===e).map(e=>c-e);return _.length>0?Math.min(..._):c-Math.min(...f)}(e,t);return fe.size>100&&fe.clear(),fe.set(n,r),r}const he={en:{days:"Days",hours:"Hours",minutes:"Minutes",seconds:"Seconds"},ru:{days:"Дни",hours:"Часы",minutes:"Минуты",seconds:"Секунды"},de:{days:"Tage",hours:"Stunden",minutes:"Minuten",seconds:"Sekunden"},es:{days:"Días",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},fr:{days:"Jours",hours:"Heures",minutes:"Minutes",seconds:"Secondes"},pt:{days:"Dias",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},ja:{days:"日",hours:"時間",minutes:"分",seconds:"秒"},ko:{days:"일",hours:"시간",minutes:"분",seconds:"초"},zh:{days:"天",hours:"小时",minutes:"分",seconds:"秒"},hi:{days:"दिन",hours:"घंटे",minutes:"मिनट",seconds:"सेकंड"},bn:{days:"দিন",hours:"ঘণ্টা",minutes:"মিনিট",seconds:"সেকেন্ড"},ar:{days:"أيام",hours:"ساعات",minutes:"دقائق",seconds:"ثوان"},he:{days:"ימים",hours:"שעות",minutes:"דקות",seconds:"שניות"},th:{days:"วัน",hours:"ชั่วโมง",minutes:"นาที",seconds:"วินาที"}};function me(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||n.test(t)?t:void 0}function ye(e){return"_self"===e?{target:"_self"}:{target:"_blank",rel:"noreferrer"}}const ge=new Set(["STRONG","B","EM","I","U","BR","A"]);function ve(e,t,n){for(const o of Array.from(e.childNodes)){if(3===o.nodeType){t.appendChild(n.createTextNode(o.textContent??""));continue}if(1!==o.nodeType)continue;const e=o;if(!ge.has(e.tagName)){ve(e,t,n);continue}const r=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=me(e.getAttribute("href")??void 0);t&&r.setAttribute("href",t);const{target:n,rel:o}=ye(e.getAttribute("target"));r.setAttribute("target",n),o&&r.setAttribute("rel",o)}t.appendChild(r),ve(e,r,n)}}function be(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return ve(t.body,n,t),n.innerHTML}function ke(e){return"string"==typeof e&&e?e:void 0}function we(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:ke(t.background)??ke(e.background)??r,accent:ke(t.accent)??ke(e.accent)??i,text:ke(t.text)??s,textSecondary:ke(t.textSecondary)??l,textInverse:ke(t.textInverse)??a}}const Se=["cover","contain"];function Ce(e){if("object"!=typeof e||null===e)return;const t=e,n=me("string"==typeof t.src?t.src:void 0);return n?{src:n,...!0===t.controls?{controls:!0}:{},...!1===t.loop?{loop:!1}:{}}:void 0}function xe(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!n.key)continue;if("string"!=typeof n.src)continue;const e=Ce(n.video);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,...e?{video:e}:{},..."string"==typeof n.mediaId&&n.mediaId?{mediaId:n.mediaId}:{},...Se.includes(n.fit)?{fit:n.fit}:{},..."number"==typeof n.blur&&Number.isFinite(n.blur)&&n.blur>0?{blur:Math.min(n.blur,100)}:{},..."number"==typeof n.dim&&Number.isFinite(n.dim)&&n.dim>0?{dim:Math.min(n.dim,1)}:{}})}return t}const Ee=["px","%","em","rem","fr"];function Pe(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function Me(e){if("object"!=typeof e||null===e)return;const t=e;if("text"===t.kind)return{kind:"text"};if("length"===t.kind||"percent"===t.kind){const e=Pe(t.min),n=Pe(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>Ee.includes(e)):[],r="length"===t.kind?function(e){if("object"!=typeof e||null===e)return;const t={};for(const n of Ee){const o=e[n];if("object"!=typeof o||null===o)continue;const r=Pe(o.min),i=Pe(o.max);void 0===r&&void 0===i||(t[n]={...void 0!==r?{min:r}:{},...void 0!==i?{max:i}:{}})}return Object.keys(t).length>0?t:void 0}(t.ranges):void 0;return{kind:t.kind,...void 0!==e?{min:e}:{},...void 0!==n?{max:n}:{},...o.length>0?{units:o}:{},...r?{ranges:r}:{}}}if("select"===t.kind&&Array.isArray(t.options)){const e=[];for(const n of t.options){if(e.length>=20)break;"object"==typeof n&&null!==n&&("string"!=typeof n.value||n.value.length>64||e.push({value:n.value,label:"string"==typeof n.label?n.label:n.value}))}if(e.length>0)return{kind:"select",options:e}}}function Fe(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!Y.test(n.key))continue;if("string"!=typeof n.value||n.value.length>64||n.value.includes("$"))continue;if(t.some(e=>e.key===n.key))continue;const e=Me(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function Re(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}const $e=["email","firstName","lastName","phone","custom"],Ae=["primary","secondary"];function Ie(e){const t=[];if(Array.isArray(e))for(const n of e){if(t.length>=10)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&$e.includes(n.kind)&&(t.some(e=>e.key===n.key)||t.push({key:n.key,kind:n.kind,label:"string"==typeof n.label?n.label:"",placeholder:"string"==typeof n.placeholder?n.placeholder:"",required:"email"===n.kind||!0===n.required,..."custom"===n.kind&&"string"==typeof n.tag&&n.tag?{tag:n.tag}:{}})))}if(!t.some(e=>"email"===e.kind)){let e="field-email";for(;t.some(t=>t.key===e);)e=`${e}-1`;t.unshift({key:e,kind:"email",label:"Email",placeholder:"",required:!0})}return t.slice(0,10)}const Ne=["checkbox","chips"],Te=["nps","stars","thumbs"],je=["instant","button"],Oe=["keep","hide-popup","page"],Le=/^[a-z]{2}$/i,He=/^#[0-9a-fA-F]{6}$/;function ze(e,t=120){return"string"==typeof e?e.trim().slice(0,t):""}function De(e,t,n=120){return ze(e,n)||t}function Ue(e){const t=ze(e,8);return Le.test(t)?t.toLowerCase():""}function We(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=12)break;if("object"!=typeof n||null===n)continue;const e=ze(n.value);if(!e)continue;if(t.some(t=>t.value===e))continue;const o=ze(n.tagValue);t.push({value:e,label:De(n.label,e),...o?{tagValue:o}:{}})}return t}function qe(e,t){const n=e=>{const n=Pe(e);return void 0===n||n<=0?0:Math.min(Math.floor(n),t)},o=n(e.min),r=n(e.max);return{min:o,max:r>0?Math.max(o,r):0}}function Be(e){const t=[];for(const n of e){if(t.length>=50)break;if("object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key))if("text"!==n.type)if("button"!==n.type){if("timer"===n.type){const e=ze(n.timezone,64),o=ce(e)?e:"",r=ze(n.endTime,32);if(null===_e(r,o))continue;const i=ze(n.expirePage),s=Oe.includes(n.onExpire)?n.onExpire:"keep",l="page"!==s||i?s:"keep";t.push({type:"timer",key:n.key,endTime:r,timezone:o,language:Ue(n.language),showLabels:!1!==n.showLabels,onExpire:l,..."page"===l?{expirePage:i}:{}});continue}if("choice"===n.type){const e=We(n.options),{min:o,max:r}=qe(n,e.length);t.push({type:"choice",key:n.key,control:Ne.includes(n.control)?n.control:"checkbox",tagName:ze(n.tagName),options:e,min:o,max:r,submitLabel:De(n.submitLabel,k),submitVariant:Ae.includes(n.submitVariant)?n.submitVariant:"primary",successMessage:De(n.successMessage,w,500)});continue}if("rating"===n.type){const e="object"==typeof n.labels&&null!==n.labels?n.labels:{};t.push({type:"rating",key:n.key,scale:Te.includes(n.scale)?n.scale:"stars",labels:{low:ze(e.low),high:ze(e.high)},submitMode:je.includes(n.submitMode)?n.submitMode:"instant",submitLabel:De(n.submitLabel,S),eventName:ze(n.eventName),successMessage:De(n.successMessage,C,500)});continue}if("glyph"!==n.type)"email-subscription-form"===n.type&&t.push({type:"email-subscription-form",key:n.key,formCode:"string"==typeof n.formCode?n.formCode:"",fields:Ie(n.fields),submitLabel:"string"==typeof n.submitLabel&&n.submitLabel?n.submitLabel:g,submitVariant:Ae.includes(n.submitVariant)?n.submitVariant:"primary",..."object"==typeof n.privacy&&null!==n.privacy&&"string"==typeof n.privacy.checkboxLabel?{privacy:{checkboxLabel:n.privacy.checkboxLabel,url:"string"==typeof n.privacy.url?n.privacy.url:"",linkLabel:"string"==typeof n.privacy.linkLabel?n.privacy.linkLabel:""}}:{},successMessage:"string"==typeof n.successMessage&&n.successMessage?n.successMessage:v,confirmEmailMessage:"string"==typeof n.confirmEmailMessage&&n.confirmEmailMessage?n.confirmEmailMessage:b});else{if(!M.includes(n.name))continue;t.push({type:"glyph",key:n.key,name:n.name,size:F.includes(n.size)?n.size:F[0],color:"string"==typeof n.color&&He.test(n.color)?n.color:""})}}else"object"==typeof n.action&&null!==n.action&&"string"==typeof n.action.type&&t.push(n);else"string"==typeof n.html&&t.push(n)}return t}function Ve(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&Array.isArray(n.slots)&&t.push({key:n.key,label:"string"==typeof n.label?n.label:"",slots:Be(n.slots)}))}return t}function Ke(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function Ze(e,t,n){if(null===e)return;let o;return o="stretch"===e?"stretch":Ke(e)??("stretch"===t?"stretch":Ke(t)),"width"===n&&"stretch"===o?void 0:o}function Je(e){const t=[];for(const n of e.pages){const o=Fe(n.values),r=J(X(n.layout,Re(o)));if(!r)continue;const i=Ze(n.width,e.width,"width"),s=Ze(n.height,e.height,"height");t.push({key:n.key,layout:r,images:xe(n.images),contents:Ve(n.contents),...void 0!==i?{width:i}:{},...void 0!==s?{height:s}:{}})}return t}function Ye(e){return`calc(100% - ${2*e.offset}px)`}const Ge="pushwoosh-web-popups",Qe="[WebPopups]",Xe="keyValue",et="messages",tt="inboxMessages";function nt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const ot=[nt(Xe,function(e){e.createObjectStore(Xe,{keyPath:"key"})}),nt("log",function(e){const t=e.createObjectStore("log",{keyPath:"id",autoIncrement:!0});t.createIndex("environment","environment",{unique:!1}),t.createIndex("date","date",{unique:!1}),t.createIndex("type","type",{unique:!1})}),nt(et,function(e){e.createObjectStore(et,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),nt(tt,function(e){const t="status",n=e.createObjectStore(tt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class rt{get all(){return ot}}class it{constructor(e,t=new rt){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function st(e,t){console.info("onversionchange",t),e.close()}let lt;function at(e){return(lt||(lt=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=st.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=st.bind(null,n,t),new it(n).applyMigrations()}})),lt).then(t=>new Promise((n,o)=>e(t,n,o)))}class ut{_add(e){return at((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);r.onsuccess=()=>{n(e)},r.onerror=()=>{o(r.error)}}).then(e=>this.getAll().then(t=>{if(Array.isArray(t)){const n=t.map(e=>e.id).sort((e,t)=>e==t?0:e<t?1:-1);if(n.length>this.maxItems)return Promise.all(n.slice(this.maxItems).map(e=>this.delete(e))).then(()=>e)}return e}))}delete(e){return at((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);r.onsuccess=()=>{n(r.result)},r.onerror=()=>{o(r.error)}})}getAll(){return at((e,t,n)=>{const o=[],r=e.transaction(this.name).objectStore(this.name).openCursor();r.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},r.onerror=()=>{n(r.error)}})}}ct=Xe;var ct;const dt=new class extends ut{constructor(){super(...arguments),this.name="log",this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(e,t,n){const o={type:e,environment:this.environment,message:`${t}`,date:new Date};return t instanceof Error&&(o.stack=t.stack),n&&(o.additional=n),this._add(o)}},pt=(new class extends ut{constructor(){super(...arguments),this.name=et,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let ft=3;const _t={setLevel(e){pt[e]||(e="error"),ft=pt[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),dt.add(e,t,n)}};function ht(e){return async({slotKey:t,tagName:n,values:o})=>{try{await e.api.setTags({[n]:{operation:"append",value:o}})}catch(e){throw _t.error(e,`Failed to write web popup choice "${t}" to tag "${n}"`),e}}}function mt(e){return async({slotKey:t,eventName:n,score:o,scale:r})=>{try{await e.api.postEvent(n,{score:o,scale:r,slotKey:t})}catch(e){throw _t.error(e,`Failed to post web popup rating "${t}" as event "${n}"`),e}}}Object.keys(pt).forEach(e=>{const t=pt[e];_t[e]=(...n)=>{t<=ft&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});var yt,gt,vt,bt,kt,wt,St,Ct,xt,Et,Pt,Mt,Ft,Rt,$t,At={},It=[],Nt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Tt=Array.isArray;function jt(e,t){for(var n in t)e[n]=t[n];return e}function Ot(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Lt(e,t,n){var o,r,i,s={};for(i in t)"key"==i?o=t[i]:"ref"==i?r=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?yt.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return Ht(e,s,o,r,null)}function Ht(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++vt,__i:-1,__u:0};return null==r&&null!=gt.vnode&>.vnode(i),i}function zt(e){return e.children}function Dt(e,t){this.props=e,this.context=t}function Ut(e,t){if(null==t)return e.__?Ut(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Ut(e):null}function Wt(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=jt({},t);i.__v=t.__v+1,gt.vnode&>.vnode(i),tn(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??Ut(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,on(o,i,r),t.__e=t.__=null,i.__e!=n&&qt(i)}}function qt(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),qt(e)}function Bt(e){(!e.__d&&(e.__d=!0)&&bt.push(e)&&!Vt.__r++||kt!=gt.debounceRendering)&&((kt=gt.debounceRendering)||wt)(Vt)}function Vt(){try{for(var e,t=1;bt.length;)bt.length>t&&bt.sort(St),e=bt.shift(),t=bt.length,Wt(e)}finally{bt.length=Vt.__r=0}}function Kt(e,t,n,o,r,i,s,l,a,u,c){var d,p,f,_,h,m,y=o&&o.__k||It,g=t.length;for(a=Zt(n,t,y,a,g),d=0;d<g;d++)null!=(f=n.__k[d])&&(p=-1!=f.__i&&y[f.__i]||At,f.__i=d,m=tn(e,f,p,r,i,s,l,a,u,c),_=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&ln(p.ref,null,f),c.push(f.ref,f.__c||_,f)),null==h&&null!=_&&(h=_),4&f.__u?(a=Jt(f,a,e),p.__e&&(p.__e=null)):"function"==typeof f.type&&void 0!==m?a=m:_&&(a=_.nextSibling),f.__u&=-7);return n.__e=h,a}function Zt(e,t,n,o,r){var i,s,l,a,u,c=n.length,d=c,p=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.__k[i]=Ht(null,s,null,null,null):Tt(s)?s=e.__k[i]=Ht(zt,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?s=e.__k[i]=Ht(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,a=i+p,s.__=e,s.__b=e.__b+1,l=null,-1!=(u=s.__i=Gt(s,n,a,d))&&(d--,(l=n[u])&&(l.__u|=2)),null==l||null==l.__v?(-1==u&&(r>c?p--:r<c&&p++),"function"!=typeof s.type&&(s.__u|=4)):u!=a&&(u==a-1?p--:u==a+1?p++:(u>a?p--:p++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<c;i++)null!=(l=n[i])&&!(2&l.__u)&&(l.__e==o&&(o=Ut(l)),an(l,l));return o}function Jt(e,t,n){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=Jt(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Ut(e)),t=n.insertBefore(e.__e,t||null));do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Yt(e,t){return t=t||[],null==e||"boolean"==typeof e||(Tt(e)?e.some(function(e){Yt(e,t)}):t.push(e)),t}function Gt(e,t,n,o){var r,i,s,l=e.key,a=e.type,u=t[n],c=null!=u&&!(2&u.__u);if(null===u&&null==l||c&&l==u.key&&a==u.type)return n;if(o>(c?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(u=t[s=r>=0?r--:i++])&&!(2&u.__u)&&l==u.key&&a==u.type)return s;return-1}function Qt(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||Nt.test(t)?n:n+"px"}function Xt(e,t,n,o,r){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Qt(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Qt(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(Pt,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[Et]=o[Et]:(n[Et]=Mt,e.addEventListener(t,i?Rt:Ft,i)):e.removeEventListener(t,i?Rt:Ft,i);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=n??"";break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function en(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[xt])t[xt]=Mt++;else if(t[xt]<n[Et])return;return n(gt.event?gt.event(t):t)}}}function tn(e,t,n,o,r,i,s,l,a,u){var c,d,p,f,_,h,m,y,g,v,b,k,w,S,C,x,E=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(a=!!(32&n.__u),i=[l=t.__e=n.__e]),(c=gt.__b)&&c(t);e:if("function"==typeof E){d=s.length;try{if(g=t.props,v=E.prototype&&E.prototype.render,b=(c=E.contextType)&&o[c.__c],k=c?b?b.props.value:c.__:o,n.__c?y=(p=t.__c=n.__c).__=p.__E:(v?t.__c=p=new E(g,k):(t.__c=p=new Dt(g,k),p.constructor=E,p.render=un),b&&b.sub(p),p.state||(p.state={}),p.__n=o,f=p.__d=!0,p.__h=[],p._sb=[]),v&&null==p.__s&&(p.__s=p.state),v&&null!=E.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=jt({},p.__s)),jt(p.__s,E.getDerivedStateFromProps(g,p.__s))),_=p.props,h=p.state,p.__v=t,f)v&&null==E.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),v&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(v&&null==E.getDerivedStateFromProps&&g!==_&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(g,k),t.__v==n.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(g,p.__s,k)){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),It.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),l=Ut(n);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(g,p.__s,k),v&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(_,h,m)})}if(p.context=k,p.props=g,p.__P=e,p.__e=!1,w=gt.__r,S=0,v)p.state=p.__s,p.__d=!1,w&&w(t),c=p.render(p.props,p.state,p.context),It.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,w&&w(t),c=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++S<25);p.state=p.__s,null!=p.getChildContext&&(o=jt(jt({},o),p.getChildContext())),v&&!f&&null!=p.getSnapshotBeforeUpdate&&(m=p.getSnapshotBeforeUpdate(_,h)),C=null!=c&&c.type===zt&&null==c.key?rn(c.props.children):c,l=Kt(e,Tt(C)?C:[C],t,n,o,r,i,s,l,a,u),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),y&&(p.__E=p.__=null)}catch(e){if(s.length=d,t.__v=null,a||null!=i){if(e.then){for(t.__u|=a?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;null!=i&&(i[i.indexOf(l)]=null),t.__e=l}else if(null!=i)for(x=i.length;x--;)Ot(i[x])}else t.__e=n.__e;null==t.__k&&(t.__k=n.__k||[]),e.then||nn(t),gt.__e(e,t,n)}}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=sn(n.__e,t,n,o,r,i,s,a,u);return(c=gt.diffed)&&c(t),128&t.__u?void 0:l}function nn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(nn))}function on(e,t,n){for(var o=0;o<n.length;o++)ln(n[o],n[++o],n[++o]);gt.__c&>.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){gt.__e(e,t.__v)}})}function rn(e){return"object"!=typeof e||null==e||e.__b>0?e:Tt(e)?e.map(rn):void 0!==e.constructor?null:jt({},e)}function sn(e,t,n,o,r,i,s,l,a){var u,c,d,p,f,_,h,m=n.props||At,y=t.props,g=t.type;if("svg"==g?r="http://www.w3.org/2000/svg":"math"==g?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=i)for(u=0;u<i.length;u++)if((f=i[u])&&"setAttribute"in f==!!g&&(g?f.localName==g:3==f.nodeType)){e=f,i[u]=null;break}if(null==e){if(null==g)return document.createTextNode(y);e=document.createElementNS(r,g,y.is&&y),l&&(gt.__m&>.__m(t,i),l=!1),i=null}if(null==g)m===y||l&&e.data==y||(e.data=y);else{if(i="textarea"==g&&null!=y.defaultValue?null:i&&yt.call(e.childNodes),!l&&null!=i)for(m={},u=0;u<e.attributes.length;u++)m[(f=e.attributes[u]).name]=f.value;for(u in m)f=m[u],"dangerouslySetInnerHTML"==u?d=f:"children"==u||u in y||"value"==u&&"defaultValue"in y||"checked"==u&&"defaultChecked"in y||Xt(e,u,null,f,r);for(u in y)f=y[u],"children"==u?p=f:"dangerouslySetInnerHTML"==u?c=f:"value"==u?_=f:"checked"==u?h=f:l&&"function"!=typeof f||m[u]===f||Xt(e,u,f,m[u],r);if(c)l||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),Kt("template"==t.type?e.content:e,Tt(p)?p:[p],t,n,o,"foreignObject"==g?"http://www.w3.org/1999/xhtml":r,i,s,i?i[0]:n.__k&&Ut(n,0),l,a),null!=i)for(u=i.length;u--;)Ot(i[u]);l&&"textarea"!=g||(u="value","progress"==g&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[u]||"progress"==g&&!_||"option"==g&&_!=m[u])&&Xt(e,u,_,m[u],r),u="checked",null!=h&&h!=e[u]&&Xt(e,u,h,m[u],r))}return e}function ln(e,t,n){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){gt.__e(e,n)}}function an(e,t,n){var o,r;if(gt.unmount&>.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ln(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){gt.__e(e,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&an(o[r],t,n||"function"!=typeof e.type);n||Ot(e.__e),e.__c=e.__=e.__e=void 0}function un(e,t,n){return this.constructor(e,n)}function cn(e,t,n){var o,r,i,s;t==document&&(t=document.documentElement),gt.__&>.__(e,t),r=(o="function"==typeof n)?null:n&&n.__k||t.__k,i=[],s=[],tn(t,e=(!o&&n||t).__k=Lt(zt,null,[e]),r||At,At,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?yt.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,s),on(i,e,s),e.props.children=null}function dn(e,t){cn(e,t,dn)}function pn(e,t,n){var o,r,i,s,l=jt({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==i?o=t[i]:"ref"==i?r=t[i]:l[i]=void 0===t[i]&&null!=s?s[i]:t[i];return arguments.length>2&&(l.children=arguments.length>3?yt.call(arguments,2):n),Ht(e.type,l,o||e.key,r||e.ref,null)}yt=It.slice,gt={__e:function(e,t,n,o){for(var r,i,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},vt=0,Dt.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=jt({},this.state),"function"==typeof e&&(e=e(jt({},n),this.props)),e&&jt(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Bt(this))},Dt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Bt(this))},Dt.prototype.render=zt,bt=[],wt="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,St=function(e,t){return e.__v.__b-t.__v.__b},Vt.__r=0,Ct=Math.random().toString(8),xt="__d"+Ct,Et="__a"+Ct,Pt=/(PointerCapture)$|Capture$/i,Mt=0,Ft=en(!1),Rt=en(!0),$t=0;var fn=0;Array.isArray;function _n(e,t,n,o,r,i){t||(t={});var s,l,a=t;if("ref"in a)for(l in a={},t)"ref"==l?s=t[l]:a[l]=t[l];var u={type:e,props:a,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--fn,__i:-1,__u:0,__source:r,__self:i};if("function"==typeof e&&(s=e.defaultProps))for(l in s)void 0===a[l]&&(a[l]=s[l]);return gt.vnode&>.vnode(u),u}var hn,mn,yn,gn,vn=0,bn=[],kn=gt,wn=kn.__b,Sn=kn.__r,Cn=kn.diffed,xn=kn.__c,En=kn.unmount,Pn=kn.__;function Mn(e,t){kn.__h&&kn.__h(mn,e,vn||t),vn=0;var n=mn.__H||(mn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Fn(e){return vn=1,Rn(Vn,e)}function Rn(e,t,n){var o=Mn(hn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Vn(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=mn,!mn.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,s=o.__c.props!==e;if(o.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),i){var l=i.call(this,e,t,n);return r?l||s:l}return!r||s};mn.__f=!0;var i=mn.shouldComponentUpdate,s=mn.componentWillUpdate;mn.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}s&&s.call(this,e,t,n)},mn.shouldComponentUpdate=r}return o.__N||o.__}function $n(e,t){var n=Mn(hn++,3);!kn.__s&&Bn(n.__H,t)&&(n.__=e,n.u=t,mn.__H.__h.push(n))}function An(e,t){var n=Mn(hn++,4);!kn.__s&&Bn(n.__H,t)&&(n.__=e,n.u=t,mn.__h.push(n))}function In(e){return vn=5,Tn(function(){return{current:e}},[])}function Nn(e,t,n){vn=6,An(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}function Tn(e,t){var n=Mn(hn++,7);return Bn(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function jn(e,t){return vn=8,Tn(function(){return e},t)}function On(e){var t=mn.context[e.__c],n=Mn(hn++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(mn)),t.props.value):e.__}function Ln(e,t){kn.useDebugValue&&kn.useDebugValue(t?t(e):e)}function Hn(){var e=Mn(hn++,11);if(!e.__){for(var t=mn.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function zn(){for(var e;e=bn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Wn),t.__h.some(qn),t.__h=[]}catch(n){t.__h=[],kn.__e(n,e.__v)}}}kn.__b=function(e){mn=null,wn&&wn(e)},kn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Pn&&Pn(e,t)},kn.__r=function(e){Sn&&Sn(e),hn=0;var t=(mn=e.__c).__H;t&&(yn===mn?(t.__h=[],mn.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Wn),t.__h.some(qn),t.__h=[],hn=0)),yn=mn},kn.diffed=function(e){Cn&&Cn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==bn.push(t)&&gn===kn.requestAnimationFrame||((gn=kn.requestAnimationFrame)||Un)(zn)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),yn=mn=null},kn.__c=function(e,t){t.some(function(e){try{e.__h.some(Wn),e.__h=e.__h.filter(function(e){return!e.__||qn(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],kn.__e(n,e.__v)}}),xn&&xn(e,t)},kn.unmount=function(e){En&&En(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Wn(e)}catch(e){t=e}}),n.__H=void 0,t&&kn.__e(t,n.__v))};var Dn="function"==typeof requestAnimationFrame;function Un(e){var t,n=function(){clearTimeout(o),Dn&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Dn&&(t=requestAnimationFrame(n))}function Wn(e){var t=mn,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),mn=t}function qn(e){var t=mn;e.__c=e.__(),mn=t}function Bn(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Vn(e,t){return"function"==typeof t?t(e):t}function Kn(e,t){for(var n in t)e[n]=t[n];return e}function Zn(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function Jn(e,t){var n=t(),o=Fn({t:{__:n,u:t}}),r=o[0].t,i=o[1];return An(function(){r.__=n,r.u=t,Yn(r)&&i({t:r})},[e,n,t]),$n(function(){return Yn(r)&&i({t:r}),e(function(){Yn(r)&&i({t:r})})},[e]),n}function Yn(e){try{return!((t=e.__)===(n=e.u())&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}var t,n}function Gn(e){e()}function Qn(e){return e}function Xn(){return[!1,Gn]}var eo=An;function to(e,t){this.props=e,this.context=t}(to.prototype=new Dt).isPureReactComponent=!0,to.prototype.shouldComponentUpdate=function(e,t){return Zn(this.props,e)||Zn(this.state,t)};var no=gt.__b;gt.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),no&&no(e)};var oo="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var ro=function(e,t){return null==e?null:Yt(Yt(e).map(t))},io={map:ro,forEach:ro,count:function(e){return e?Yt(e).length:0},only:function(e){var t=Yt(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:Yt},so=gt.__e;gt.__e=function(e,t,n,o){if(e.then)for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t);so(e,t,n,o)};var lo=gt.unmount;function ao(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=Kn({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return ao(e,t,n)})),e}function uo(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return uo(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function co(){this.__u=0,this.o=null,this.__b=null}function po(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function fo(){this.i=null,this.l=null}gt.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),lo&&lo(e)},(co.prototype=new Dt).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=po(o.__v),i=!1,s=function(){i||o.__z||(i=!0,n.__R=null,r?r(a):a())};n.__R=s;var l=n.__P;n.__P=null;var a=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=uo(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=l,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},co.prototype.componentWillUnmount=function(){this.o=[]},co.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=ao(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Lt(zt,null,e.fallback);return r&&(r.__u&=-33),[Lt(zt,null,t.__a?null:e.children),r]};var _o=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function ho(e){return this.getChildContext=function(){return e.context},e.children}function mo(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){cn(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}cn(Lt(ho,{context:t.context},e.__v),t.v)}(fo.prototype=new Dt).__a=function(e){var t=this,n=po(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),_o(t,e,o)):r()};n?n(i):i()}},fo.prototype.render=function(e){this.i=null,this.l=new Map;var t=Yt(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},fo.prototype.componentDidUpdate=fo.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){_o(e,n,t)})};var yo="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,go=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,vo=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,bo=/[A-Z0-9]/g,ko="undefined"!=typeof document,wo=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};Dt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Dt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var So=gt.event;gt.event=function(e){return So&&(e=So(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Co,xo={configurable:!0,get:function(){return this.class}},Eo=gt.vnode;gt.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1==n.indexOf("-");for(var i in t){var s=t[i];if(!("value"===i&&"defaultValue"in t&&null==s||ko&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var l=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===s?s="":"translate"===l&&"no"===s?s=!1:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?i="ondblclick":"onchange"!==l||"input"!==n&&"textarea"!==n||wo(t.type)?"onfocus"===l?i="onfocusin":"onblur"===l?i="onfocusout":vo.test(i)&&(i=l):l=i="oninput":r&&go.test(i)?i=i.replace(bo,"-$&").toLowerCase():null===s&&(s=void 0),"oninput"===l&&o[i=l]&&(i="oninputCapture"),o[i]=s}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=Yt(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=Yt(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",xo)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=yo,Eo&&Eo(e)};var Po=gt.__r;gt.__r=function(e){Po&&Po(e),Co=e.__c};var Mo=gt.diffed;gt.diffed=function(e){Mo&&Mo(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),Co=null};var Fo={ReactCurrentDispatcher:{current:{readContext:function(e){return Co.__n[e.__c].props.value},useCallback:jn,useContext:On,useDebugValue:Ln,useDeferredValue:Qn,useEffect:$n,useId:Hn,useImperativeHandle:Nn,useInsertionEffect:eo,useLayoutEffect:An,useMemo:Tn,useReducer:Rn,useRef:In,useState:Fn,useSyncExternalStore:Jn,useTransition:Xn}}};function Ro(e){return!!e&&e.$$typeof===yo}var $o={useState:Fn,useId:Hn,useReducer:Rn,useEffect:$n,useLayoutEffect:An,useInsertionEffect:eo,useTransition:Xn,useDeferredValue:Qn,useSyncExternalStore:Jn,startTransition:Gn,useRef:In,useImperativeHandle:Nn,useMemo:Tn,useCallback:jn,useContext:On,useDebugValue:Ln,version:"18.3.1",Children:io,render:function(e,t,n){return null==t.__k&&(t.textContent=""),cn(e,t),"function"==typeof n&&n(),e?e.__c:null},hydrate:function(e,t,n){return dn(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&(cn(null,e),!0)},createPortal:function(e,t){var n=Lt(mo,{__v:e,h:t});return n.containerInfo=t,n},createElement:Lt,createContext:function(e){function t(e){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,Bt(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+$t++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createFactory:function(e){return Lt.bind(null,e)},cloneElement:function(e){return Ro(e)?pn.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:zt,isValidElement:Ro,isElement:Ro,isFragment:function(e){return Ro(e)&&e.type===zt},isMemo:function(e){return!!e&&"string"==typeof e.displayName&&0==e.displayName.indexOf("Memo(")},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:Dt,PureComponent:to,memo:function(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:Zn(this.props,e)}function o(t){return this.shouldComponentUpdate=n,Lt(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o},forwardRef:function(e){function t(t){var n=Kn({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=oo,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,t){var n,o=gt.debounceRendering;gt.debounceRendering=function(e){n=e};try{var r=e(t);return n&&n(),r}finally{gt.debounceRendering=o}},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:zt,Suspense:co,SuspenseList:fo,lazy:function(e){var t,n,o,r=null;function i(i){if(t||(t=e()).then(function(e){e&&(r=e.default||e),o=!0},function(e){n=e,o=!0}),n)throw n;if(!o)throw t;return r?Lt(r,i):null}return i.displayName="Lazy",i.__f=!0,i},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Fo};const Ao={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function Io({slot:e,align:t,inverse:n,colors:o}){const r={...u[e.variant],textAlign:e.align??t},i=d(e.variant,o,n);return i&&(r.color=i),$o.createElement("div",{style:r,dangerouslySetInnerHTML:{__html:be(e.html)}})}function No({slot:e,accent:t,onRequestClose:n,onPageChange:o}){const r=h(e.variant,t),i={};if("close"===e.action.type)return $o.createElement("div",{style:i},$o.createElement("button",{type:"button",style:r,onClick:n},e.label));if("page"===e.action.type){const t=e.action.page;return $o.createElement("div",{style:i},$o.createElement("button",{type:"button",style:r,onClick:()=>o(t)},e.label))}const s=me(e.action.url);return s?$o.createElement("div",{style:i},$o.createElement("a",{href:s,...ye(e.action.target),style:r},e.label)):$o.createElement("div",{style:i},$o.createElement("button",{type:"button",style:r},e.label))}function To({message:e,align:t,inverse:n,colors:o}){const r=d("body",o,n);return $o.createElement("div",{style:{...u.body,padding:"4px 0",textAlign:t,...r?{color:r}:{}}},e)}const jo=/^\S+@\S+\.\S+$/,Oo={email:"email",phone:"tel"},Lo={email:"email",firstName:"given-name",lastName:"family-name",phone:"tel"},Ho="__privacy";function zo({slot:e,align:t,inverse:n,colors:o,onSubmitForm:r}){const[i,s]=Fn({}),[l,a]=Fn(!1),[c,p]=Fn(null),[f,g]=Fn({}),[v,b]=Fn("idle"),k=d("caption",o,n),w={...u.caption,...k?{color:k}:{}},S={fontSize:12,lineHeight:1.4,color:m,paddingTop:2};if("success"===v||"confirm"===v)return $o.createElement(To,{message:"confirm"===v?e.confirmEmailMessage:e.successMessage,align:t,inverse:n,colors:o});const C="submitting"===v,E=e.privacy?me(e.privacy.url):void 0,P={...h(e.submitVariant,o.accent),...C?{opacity:.6,cursor:"default"}:{}};return $o.createElement("form",{noValidate:!0,style:{margin:0,textAlign:"left"},onSubmit:t=>{t.preventDefault(),(()=>{if(!r||!e.formCode||"submitting"===v)return;const t={};for(const n of e.fields){const e=(i[n.key]??"").trim();n.required&&!e?t[n.key]="Required":"email"===n.kind&&e&&!jo.test(e)&&(t[n.key]="Enter a valid email")}if(e.privacy&&!l&&(t[Ho]="Please accept the privacy policy"),g(t),Object.keys(t).length>0)return;const n={email:"",policyAccepted:!e.privacy||l},o={};for(const t of e.fields){const e=(i[t.key]??"").trim();e&&("email"===t.kind?n.email=n.email||e:"firstName"===t.kind?n.firstName=e:"lastName"===t.kind?n.lastName=e:"phone"===t.kind?n.phone=e:o[t.tag||t.key]=e)}Object.keys(o).length>0&&(n.customFields=o),b("submitting"),Promise.resolve().then(()=>r(e.formCode,n)).then(e=>b("confirm-email"===e?"confirm":"success"),()=>b("error"))})()}},e.fields.map(e=>{const t=f[e.key];let n;return t?n=m:c===e.key&&(n=o.accent),$o.createElement("div",{key:e.key,style:{padding:"4px 0"}},e.label&&$o.createElement("div",{style:{...w,paddingBottom:4}},e.label),$o.createElement("input",{type:Oo[e.kind]??"text",autoComplete:Lo[e.kind],placeholder:e.placeholder||void 0,value:i[e.key]??"",disabled:C,style:y(n),onFocus:()=>p(e.key),onBlur:()=>p(t=>t===e.key?null:t),onChange:t=>{return n=e.key,o=t.currentTarget.value,s(e=>({...e,[n]:o})),void g(e=>e[n]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==n)):e);var n,o}}),t&&$o.createElement("div",{style:S},t))}),e.privacy&&$o.createElement("div",{style:{padding:"4px 0"}},$o.createElement("label",{style:{...w,display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"}},$o.createElement("input",{type:"checkbox",checked:l,disabled:C,style:{margin:"2px 0 0",flexShrink:0},onChange:e=>{a(e.currentTarget.checked),g(e=>e[Ho]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==Ho)):e)}}),$o.createElement("span",null,e.privacy.checkboxLabel,E&&$o.createElement($o.Fragment,null," ",$o.createElement("a",{href:E,...ye(void 0),style:{color:o.accent}},e.privacy.linkLabel||e.privacy.url)))),f[Ho]&&$o.createElement("div",{style:S},f[Ho])),$o.createElement("div",{style:{padding:_}},$o.createElement("button",{type:"submit",disabled:C,style:P},e.submitLabel)),"error"===v&&$o.createElement("div",{style:{...S,textAlign:t}},x))}function Do({value:e,label:t,digitStyle:n,labelStyle:o}){return $o.createElement("div",{style:{minWidth:44}},$o.createElement("div",{style:n},String(e).padStart(2,"0")),t?$o.createElement("div",{style:o},t):null)}function Uo({slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:s}){const[l,a]=Fn(()=>Date.now()),c=function(e,t,n){const o=_e(e,t),r=null===o?0:Math.max(0,o-n),i=Math.floor(r/1e3);return{total:r,days:Math.floor(i/86400),hours:Math.floor(i/3600)%24,minutes:Math.floor(i/60)%60,seconds:i%60}}(e.endTime,e.timezone,l),p=0===c.total;$n(()=>{if("live"!==r||p)return;const e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[r,p,e.endTime,e.timezone]),$n(()=>{"live"===r&&p&&("hide-popup"===e.onExpire?i?.():"page"===e.onExpire&&e.expirePage&&s(e.expirePage))},[r,p,e.onExpire,e.expirePage,i,s]);const f=d("h2",o,n),_=d("caption",o,n),h={fontSize:28,fontWeight:700,lineHeight:1.2,fontVariantNumeric:"tabular-nums",...f?{color:f}:{}},m={...u.caption,..._?{color:_}:{}},y=(g=e.language,he[g]??he.en);var g;const v=[{value:c.days,label:y.days},{value:c.hours,label:y.hours},{value:c.minutes,label:y.minutes},{value:c.seconds,label:y.seconds}];return $o.createElement("div",{style:{padding:"4px 0",textAlign:t}},$o.createElement("div",{style:{display:"inline-flex",gap:12,textAlign:"center"}},v.map(t=>$o.createElement(Do,{key:t.label||t.value,value:t.value,label:e.showLabels?t.label:"",digitStyle:h,labelStyle:m}))))}function Wo({slot:e,align:t,inverse:n,colors:o,onSubmitChoice:r}){const[i,s]=Fn([]),[l,a]=Fn("idle"),[c,p]=Fn("");if("success"===l)return $o.createElement(To,{message:e.successMessage,align:t,inverse:n,colors:o});const f=t=>{p(""),s(n=>n.includes(t)?n.filter(e=>e!==t):e.max>0&&n.length>=e.max?(p(`Pick up to ${e.max}`),n):[...n,t])},y="submitting"===l,g=d("body",o,n),v={...u.body,...g?{color:g}:{}};return $o.createElement("div",{style:{padding:"4px 0"}},"chips"===e.control?$o.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"===t?"center":"flex-start"}},e.options.map(e=>{return $o.createElement("button",{key:e.value,type:"button","aria-pressed":i.includes(e.value),style:(t=i.includes(e.value),{padding:"6px 14px",borderRadius:999,border:`1px solid ${o.accent}`,backgroundColor:t?o.accent:"transparent",color:t?"#FFFFFF":o.accent,fontFamily:"inherit",fontSize:14,lineHeight:1.4,cursor:"pointer"}),onClick:()=>f(e.value)},e.label);var t})):$o.createElement("div",{style:{display:"grid",gap:6}},e.options.map(e=>$o.createElement("label",{key:e.value,style:{...v,display:"flex",alignItems:"center",gap:8,cursor:"pointer"}},$o.createElement("input",{type:"checkbox",checked:i.includes(e.value),onChange:()=>f(e.value),style:{accentColor:o.accent,width:16,height:16,margin:0}}),e.label))),c?$o.createElement("div",{style:{...u.caption,color:m,paddingTop:4}},c):null,"error"===l?$o.createElement("div",{style:{...u.caption,color:m,paddingTop:4}},x):null,$o.createElement("div",{style:{padding:_}},$o.createElement("button",{type:"button",style:{...h(e.submitVariant,o.accent),...y?{opacity:.7}:{}},onClick:()=>{if(!r||!e.tagName||"submitting"===l)return;const t=Math.max(e.min,1);if(i.length<t)return void p(1===t?"Pick at least one":`Pick at least ${t}`);const n=e.options.filter(e=>i.includes(e.value)).map(e=>e.tagValue||e.value);p(""),a("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,tagName:e.tagName,values:n})).then(()=>a("success"),()=>a("error"))}},e.submitLabel)))}function qo({score:e,scale:t,selected:n,accent:o,onPick:r}){const i={display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,border:`1px solid ${o}`,backgroundColor:n?o:"transparent",color:n?"#FFFFFF":o,fontFamily:"inherit",fontSize:14,lineHeight:1,cursor:"pointer"};if("nps"===t)return $o.createElement("button",{type:"button","aria-label":`Rate ${e}`,"aria-pressed":n,style:{...i,width:30,height:32,borderRadius:6},onClick:r},e);const s="thumbs"===t;let l=`Rate ${e}`;return s&&(l=1===e?"Thumbs up":"Thumbs down"),$o.createElement("button",{type:"button","aria-label":l,"aria-pressed":n,style:{...i,width:s?44:34,height:s?40:34,borderRadius:s?8:6},onClick:r},$o.createElement("svg",{width:s?22:20,height:s?22:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},$o.createElement("path",{d:s?"M8 21V10l3.5-7A2 2 0 0 1 14 5v5h4.5a2 2 0 0 1 2 2.4l-1.3 6A2 2 0 0 1 17.2 21zM8 10H3.5v11H8":P.star,...s&&0===e?{transform:"rotate(180 12 12)"}:{}})))}function Bo({slot:e,align:t,inverse:n,colors:o,onSubmitRating:r}){const[i,s]=Fn(null),[l,a]=Fn("idle");if("success"===l)return $o.createElement(To,{message:e.successMessage,align:t,inverse:n,colors:o});const c=t=>{r&&e.eventName&&"submitting"!==l&&(a("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,eventName:e.eventName,score:t,scale:e.scale})).then(()=>a("success"),()=>a("error")))},p="nps"===(f=e.scale)?[0,1,2,3,4,5,6,7,8,9,10]:"stars"===f?[1,2,3,4,5]:[0,1];var f;const y=d("caption",o,n),g={...u.caption,...y?{color:y}:{}},v=t=>"stars"===e.scale?null!==i&&t<=i:i===t;return $o.createElement("div",{style:{padding:"4px 0"}},$o.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:6,justifyContent:"center"===t?"center":"flex-start"}},p.map(t=>$o.createElement(qo,{key:t,score:t,scale:e.scale,selected:v(t),accent:o.accent,onPick:()=>(t=>{"submitting"!==l&&(s(t),"instant"===e.submitMode&&c(t))})(t)}))),e.labels.low||e.labels.high?$o.createElement("div",{style:{display:"flex",justifyContent:"space-between",gap:8,paddingTop:4}},$o.createElement("span",{style:g},e.labels.low),$o.createElement("span",{style:g},e.labels.high)):null,"error"===l?$o.createElement("div",{style:{...u.caption,color:m,paddingTop:4}},x):null,"button"===e.submitMode?$o.createElement("div",{style:{padding:_}},$o.createElement("button",{type:"button",style:{...h("primary",o.accent),..."submitting"===l?{opacity:.7}:{}},onClick:()=>null===i?void 0:c(i)},e.submitLabel)):null)}function Vo({slot:e,align:t,inverse:n,colors:o}){const r=e.color||(n?o.textInverse:o.accent);return $o.createElement("div",{style:{padding:"4px 0",textAlign:t,lineHeight:0}},$o.createElement("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"inline-block"}},$o.createElement("path",{d:P[e.name]})))}function Ko({slot:e,align:t,inverse:n,colors:o,mode:r="live",onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){const c=s??(()=>{});switch(e.type){case"text":return $o.createElement(Io,{slot:e,align:t,inverse:n,colors:o});case"button":return $o.createElement(No,{slot:e,accent:o.accent,onRequestClose:i,onPageChange:c});case"email-subscription-form":return $o.createElement(zo,{slot:e,align:t,inverse:n,colors:o,onSubmitForm:l});case"timer":return $o.createElement(Uo,{slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:c});case"choice":return $o.createElement(Wo,{slot:e,align:t,inverse:n,colors:o,onSubmitChoice:a});case"rating":return $o.createElement(Bo,{slot:e,align:t,inverse:n,colors:o,onSubmitRating:u});case"glyph":return $o.createElement(Vo,{slot:e,align:t,inverse:n,colors:o})}}function Zo({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){const c=t.contents.find(t=>t.key===e.props.content);if(!c)return null;if(r?.renderZone)return $o.createElement("div",{style:{minWidth:0}},r.renderZone(c,e));const d=e.props.align??"left",p="inverse"===e.props.tone;return $o.createElement("div",{style:{minWidth:0}},c.slots.map((e,t)=>{const r=c.slots[t-1],_=r?(h=f(r),"action"===(m=f(e))?"action"===h?6:16:"text"===m&&"heading"===h?4:8):0;var h,m;return $o.createElement("div",{key:e.key,style:_?{marginTop:_}:void 0},$o.createElement(Ko,{slot:e,align:d,inverse:p,colors:n,mode:o,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}))}))}function Jo(e){return e?.video?me(e.video.src):void 0}function Yo({image:e,src:t,style:n,mode:o}){return $o.createElement("video",{src:t,poster:e.src||void 0,style:n,autoPlay:"live"===o,muted:!0,playsInline:!0,preload:"metadata",loop:!1!==e.video?.loop,controls:!0===e.video?.controls})}function Go({node:e,page:t,leaf:n,mode:o}){const r=t.images.find(t=>t.key===e.props.image);if(!r)return null;if(n?.renderImage)return $o.createElement($o.Fragment,null,n.renderImage(r,e));const i=Jo(r);if(!r.src&&!i)return null;const s={display:"block",width:"100%",minWidth:0};return r.fit?(s.height="100%",s.objectFit=r.fit):s.height="auto",r.blur&&(s.filter=`blur(${r.blur}px)`),i?$o.createElement(Yo,{image:r,src:i,style:s,mode:o}):$o.createElement("img",{src:r.src,alt:"",style:s})}function Qo({style:e,outer:t,inner:n,layer:o,children:r}){const{backgroundColor:i,...s}=e;return $o.createElement("div",{style:{display:"grid",minWidth:0,backgroundColor:i,...t}},o,$o.createElement("div",{style:{...s,...n}},r))}function Xo({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){if("Content"===e.type)return $o.createElement(Zo,{node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u});if("Image"===e.type)return $o.createElement(Go,{node:e,page:t,leaf:r,mode:o});const c=e.props?.backgroundImage,d=c?t.images.find(e=>e.key===c):void 0,p=d?.blur??0,f=d?.dim??0,_=Jo(d),h=se(e,p>0||_?void 0:d?.src||void 0,f);c&&(h.backgroundColor="#1D2939");const m=e.children.map((e,c)=>$o.createElement(Xo,{key:c,node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}));if(_&&d){const e=re(f);return $o.createElement(Qo,{style:h,outer:{position:"relative",overflow:"hidden",...d.src?ie(d.src):{}},inner:{position:"relative",...e?{backgroundImage:e}:{}},layer:$o.createElement(Yo,{image:d,src:_,mode:o,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",...p>0?{filter:`blur(${p}px)`}:{}}})},m)}return p>0?$o.createElement(Qo,{style:h,outer:d?.src?ie(d.src,f):void 0,inner:{backdropFilter:`blur(${p}px)`,WebkitBackdropFilter:`blur(${p}px)`}},m):$o.createElement("div",{style:h},m)}function er({page:e,params:t,mode:n="live",leafRenderers:o,animatePage:r=!1,onRequestClose:i,onPageChange:s,onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u}){const c={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:t.colors.background,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:t.colors.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:t.boxShadow&&"none"!==t.boxShadow?t.boxShadow:void 0,transition:"height 300ms ease"};e.height&&(c.height="stretch"===e.height?"100%":e.height,c.overflowY="auto");const d={...r?{animation:"pw-vpopup-page 300ms ease-out backwards"}:{},..."stretch"===e.height?{display:"grid",minHeight:"100%"}:{}};return $o.createElement("div",{style:c},$o.createElement("div",{key:e.key,style:d},$o.createElement(Xo,{node:e.layout,page:e,colors:t.colors,mode:n,leaf:o,onRequestClose:i,onPageChange:s??(()=>{}),onSubmitForm:l,onSubmitChoice:a,onSubmitRating:u})))}function tr({onRequestClose:e}){return $o.createElement("button",{type:"button","aria-label":"Close",onClick:e,style:{position:"absolute",top:10,right:10,width:24,height:24,padding:0,border:"none",borderRadius:"50%",background:"rgba(255, 255, 255, 0.92)",boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:"#667085",fontSize:13,lineHeight:1,cursor:"pointer"}},"✕")}function nr(e,t,n){const{placement:o}=e,r={position:"fixed",boxSizing:"border-box",maxWidth:Ye(o),maxHeight:Ye(o),pointerEvents:"auto"};if(t){r.width=t;const e=o.h;"left"===e?r.left=o.offset:"right"===e?r.right=o.offset:r.left="50%"}else r.left=o.offset,r.right=o.offset;"stretch"===n?(r.top=o.offset,r.bottom=o.offset):"top"===o.v?r.top=o.offset:"bottom"===o.v?r.bottom=o.offset:r.top="50%";const i=t&&"center"===o.h?"-50%":"0",s="middle"===o.v&&"stretch"!==n?"-50%":"0";"0"===i&&"0"===s||(r.transform=`translate(${i}, ${s})`);const l=Ao[e.animation];return l&&(r.animation=l),r.transition="width 300ms ease",r}function or({params:e,mode:t="live",onRequestClose:n,onSubmitForm:o,onSubmitChoice:r,onSubmitRating:i,leafRenderers:s}){const[l,a]=Fn(null);$n(()=>{Je(e).forEach(e=>e.images.forEach(({src:e})=>{e&&((new Image).src=e)}))},[e]);const u=Je(e);if(0===u.length)return null;const c=u.find(e=>e.key===l)??function(e,t){return t.find(t=>t.key===e.startPage)??t[0]}(e,u),d=null!==l;if("preview"===t)return $o.createElement("div",{style:{position:"relative",width:c.width??"100%",transition:"width 300ms ease"}},$o.createElement("style",null,E),$o.createElement(er,{page:c,params:e,mode:t,leafRenderers:s,animatePage:d,onRequestClose:n,onPageChange:a,onSubmitForm:o,onSubmitChoice:r,onSubmitRating:i}));const p=e.overlay;return $o.createElement($o.Fragment,null,$o.createElement("style",null,E),p&&$o.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:p.color,opacity:p.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:n}),$o.createElement("div",{style:nr(e,c.width,c.height)},$o.createElement(er,{page:c,params:e,mode:t,leafRenderers:s,animatePage:d,onRequestClose:n,onPageChange:a,onSubmitForm:o,onSubmitChoice:r,onSubmitRating:i}),$o.createElement(tr,{onRequestClose:n})))}const rr={SUBMIT_FORM_RESULT_SUBSCRIBED:"subscribed",SUBMIT_FORM_RESULT_CONFIRM_EMAIL:"confirm-email",SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED:"already-subscribed"},ir=(e,t)=>`https://subscription-form.svc-nue.pushwoosh.com/api/v1/forms/code/${encodeURIComponent(e)}${t}`,sr=async(e,t)=>{try{const n=await fetch(ir(e,"/submit"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,userId:t.email})});if(!n.ok)throw new Error(`Subscription form submit failed: HTTP ${n.status}`);const o=await n.json(),r=rr[o.result??""];if(!r)throw new Error(`Subscription form submit failed: unexpected result "${o.result}"`);return r}catch(t){throw _t.error(t,`Failed to submit subscription form "${e}"`),t}},lr=e=>{const t=function(e){let t;try{t=JSON.parse(e)}catch{return null}if("object"!=typeof t||null===t)return null;const n=t;if(2!==n.version)return null;const o=n.params;return"object"!=typeof o||null===o?null:Array.isArray(o.pages)&&0!==o.pages.length?{version:2,params:{...o,colors:we(o)}}:null}(e);return t?0===Je(t.params).length?null:t.params:null};class ar{constructor(e){this.isRecurringVisitor=!1,this.entries=new Map,this.queue=[],this.visible=null,this.drainTimeoutId=null,this.autoShowEnabled=!0,this.isNavigationSubscribed=!1,this.openPopupsCount=0,this.bodyOverflowBeforeLock=null,this.readyPromise=new Promise(e=>{this.readyResolve=e}),this.pw=e,this.submitHandlers={onSubmitChoice:ht(e),onSubmitRating:mt(e)},e.moduleRegistry.webPopups=this}async run(){const{pw:e}=this;try{this.autoShowEnabled=!1!==e.initParams.webPopups?.autoShow,await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const t=await e.api.getPopupForms();_t.debug(`${Qe} Received ${t.length} popup(s) from server:`,t.map(e=>e.code)),t.forEach((e,t)=>{this.entries.set(e.code,{popup:e,order:t,state:"idle",content:null,loading:null,passedStrongConditions:!1,timeoutId:null,visitRecorded:!1})}),await Promise.allSettled(Array.from(this.entries.values()).map(async e=>{e.passedStrongConditions=await this.checkStrongCondition(e.popup),e.passedStrongConditions&&await this.ensureContent(e)}));const n=this.loadedCodes();_t.debug(`${Qe} ${n.length} popup(s) passed strong conditions and loaded:`,n),this.subscribeToNavigation(),this.renderForCurrentPage(),await e.data.setIsRecurringVisitor(!0)}finally{this.readyResolve(),e.dispatchEvent("web-popups-ready",{})}}async show(e){await this.readyPromise;const t=this.entries.get(e);if(!t)return _t.error(new Error("Unknown web popup code"),`${Qe} show("${e}"): no such popup`),!1;if(this.visible?.code===e)return!0;return await this.ensureContent(t)?this.visible?.code===e||!!this.checkNotExpired(t)&&(this.visible&&(_t.debug(`${Qe} show("${e}") preempting "${this.visible.code}"`),this.visible.close("preempted")),this.detachFromAutoPipeline(t),this.present(t,"api"),!0):(_t.error(new Error("Web popup content unavailable"),`${Qe} show("${e}"): content unavailable`),!1)}hide(e){return!!this.visible&&((void 0===e||this.visible.code===e)&&(this.visible.close("api"),!0))}hideAll(){const e=this.hide();return this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||(this.detachFromAutoPipeline(e),e.state="done")}),this.cancelScheduledDrain(),e}isVisible(e){return!!this.visible&&(void 0===e||this.visible.code===e)}getVisibleCode(){return this.visible?.code??null}getAvailableCodes(){return Array.from(this.entries.keys())}getState(){const e=[];return this.entries.forEach((t,n)=>{"waiting"===t.state&&e.push(n)}),{visible:this.getVisibleCode(),queued:[...this.queue],waiting:e,available:this.getAvailableCodes()}}ensureContent(e){return e.content?Promise.resolve(e.content):(e.loading||(e.loading=this.loadContent(e.popup).then(t=>(e.content=t,t)).catch(t=>(_t.error(t,`${Qe} Failed to load web popup "${e.popup.code}"`),null)).finally(()=>{e.content||(e.loading=null)})),e.loading)}async loadContent(e){const t=await this.pw.api.getPopupFormContent(e.popup_form_content_code),n=lr(t.json);return n||(_t.error(new Error("Unsupported popup content format"),`${Qe} Web popup "${e.code}" content is not a supported {version, params} popup; skipping`),null)}loadedCodes(){const e=[];return this.entries.forEach((t,n)=>{t.content&&e.push(n)}),e}renderForCurrentPage(){this.releaseUnmatchedPending();const e=[];this.entries.forEach((t,n)=>{this.canAutoDisplay(t)&&(this.armDelay(t),e.push(n))}),_t.debug(`${Qe} ${e.length} popup(s) selected for display on "${window.location.pathname}":`,e),this.drain()}canAutoDisplay(e){return this.autoShowEnabled&&"idle"===e.state&&e.passedStrongConditions&&this.isAutoTrigger(e.popup)&&null!==e.content&&this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)}isAutoTrigger(e){const t=e.trigger_type;return!t||"PAGE_LOAD"===t}armDelay(e){const{popup:t}=e;_t.debug(`${Qe} Popup "${t.code}" armed for display in ${t.delay}s`),e.state="waiting",this.recordVisit(e),e.timeoutId=window.setTimeout(()=>{e.timeoutId=null,e.state="queued",this.insertIntoQueue(e),_t.debug(`${Qe} Popup "${t.code}" delay elapsed; queued at position ${this.queue.indexOf(t.code)+1} of ${this.queue.length}`),this.drain()},1e3*t.delay)}recordVisit(e){e.visitRecorded||(e.visitRecorded=!0,this.pw.api.recordPopupFormEvent(e.popup.code,1).catch(t=>{_t.error(t,`${Qe} Failed to record web popup visit event for "${e.popup.code}"`)}))}insertIntoQueue(e){const t=this.queue.findIndex(t=>{const n=this.entries.get(t);return!!n&&(n.popup.delay!==e.popup.delay?n.popup.delay>e.popup.delay:n.order>e.order)});-1!==t?this.queue.splice(t,0,e.popup.code):this.queue.push(e.popup.code)}releaseUnmatchedPending(){this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)||(this.detachFromAutoPipeline(e),e.state="idle",_t.debug(`${Qe} Released popup "${e.popup.code}": page no longer matches, or its countdown passed`))})}detachFromAutoPipeline(e){null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null);const t=this.queue.indexOf(e.popup.code);-1!==t&&this.queue.splice(t,1)}drain(){if(this.visible||null!==this.drainTimeoutId)return;const e=this.queue.shift();if(void 0===e)return;const t=this.entries.get(e);if(t&&"queued"===t.state){if(!this.checkSoftCondition(t.popup)||!this.checkNotExpired(t))return t.state="idle",void this.drain();if(!t.content)return t.state="done",void this.drain();_t.debug(`${Qe} Display slot free; showing "${e}"`),this.present(t,"auto")}else this.drain()}scheduleDrain(){null===this.drainTimeoutId&&(this.drainTimeoutId=window.setTimeout(()=>{this.drainTimeoutId=null,this.drain()},400))}cancelScheduledDrain(){null!==this.drainTimeoutId&&(window.clearTimeout(this.drainTimeoutId),this.drainTimeoutId=null)}present(e,t){this.cancelScheduledDrain();const{popup:n,content:o}=e;if(!o)return void(e.state="done");const r=document.createElement("div");r.id=`${Ge}-${n.code}`,r.style.position="fixed",r.style.inset="0",r.style.zIndex=String(2147483647),r.style.pointerEvents="none",document.body.appendChild(r);const i=r.attachShadow({mode:"open"}),s=document.createElement("div");i.appendChild(s);const l=!!o.overlay;l&&this.lockBodyScroll();let a=!1;const u=t=>{a||(a=!0,l&&this.unlockBodyScroll(),(e=>{cn(null,e)})(s),r.remove(),this.visible?.code===n.code&&(this.visible=null),e.state="done",this.pw.dispatchEvent("hide-web-popup",{code:n.code,reason:t}),this.scheduleDrain())};this.visible={code:n.code,host:r,modal:l,close:u},e.state="visible",((e,t,n,o)=>{cn(_n(or,{params:t,mode:"live",onRequestClose:n,onSubmitForm:sr,onSubmitChoice:o.onSubmitChoice,onSubmitRating:o.onSubmitRating}),e)})(s,o,()=>u("user"),this.submitHandlers);const c=function(e){const t=new Set;for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots)"object"==typeof n&&null!==n&&"email-subscription-form"===n.type&&"string"==typeof n.formCode&&n.formCode&&t.add(n.formCode);return[...t]}(o);c.length>0&&this.pw.data.getHwid().then(e=>c.forEach(t=>((e,t)=>{fetch(ir(e,"/view"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,userId:t,hwid:t})}).catch(t=>{_t.error(t,`Failed to record subscription form view for "${e}"`)})})(t,e))).catch(e=>{_t.error(e,`${Qe} Failed to record subscription form views for web popup "${n.code}"`)}),_t.debug(`${Qe} Popup "${n.code}" shown (trigger: ${t})`),this.recordVisit(e),this.markAsShown(n).catch(e=>{_t.error(e,`${Qe} Failed to mark web popup "${n.code}" as shown`)}),this.pw.dispatchEvent("show-web-popup",{code:n.code,trigger:t})}lockBodyScroll(){0===this.openPopupsCount&&(this.bodyOverflowBeforeLock=document.body.style.overflow,document.body.style.overflow="hidden"),this.openPopupsCount+=1}unlockBodyScroll(){this.openPopupsCount=Math.max(0,this.openPopupsCount-1),0===this.openPopupsCount&&null!==this.bodyOverflowBeforeLock&&(document.body.style.overflow=this.bodyOverflowBeforeLock,this.bodyOverflowBeforeLock=null)}subscribeToNavigation(){if(this.isNavigationSubscribed)return;this.isNavigationSubscribed=!0;const e=()=>this.renderForCurrentPage(),t=window.navigation;if(t&&"function"==typeof t.addEventListener)return void t.addEventListener("currententrychange",e);window.addEventListener("popstate",e),window.addEventListener("hashchange",e);let n=window.location.href;window.setInterval(()=>{window.location.href!==n&&(n=window.location.href,e())},500)}async checkStrongCondition(e){return(await Promise.all([this.checkCanBeShownByDeviceTypeCondition(e),this.checkCanBeShownByFrequencyCondition(e),this.checkCanBeShownByVisitorsTypeCondition(e)])).every(e=>e)}checkSoftCondition(e){return this.checkCanBeShownByMatchingPagesCondition(e)}checkNotExpired(e){return!e.content||(!function(e,t){for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots){if("object"!=typeof n||null===n)continue;if("timer"!==n.type||"hide-popup"!==n.onExpire)continue;if("string"!=typeof n.endTime)continue;const e="string"==typeof n.timezone?n.timezone:"",o=_e(n.endTime,e);if(null!==o&&o<=t)return!0}return!1}(e.content,Date.now())||(_t.debug(`${Qe} Popup "${e.popup.code}" not shown: its countdown has passed`),!1))}checkCanBeShownByDeviceTypeCondition(e){const{device_type:t}=e,n=this.pw.platformChecker.formFactor;return"ALL"===t||t===n}async checkCanBeShownByFrequencyCondition(e){const{frequency:t,code:n}=e;if("ONCE"===t){return!(await this.pw.data.getShownWebPopups()).includes(n)}return"ONCE_PER_SESSION"!==t||null===sessionStorage.getItem(this.getSessionStorageKey(n))}checkCanBeShownByMatchingPagesCondition(e){const{matching_pages:t,matching_page_rules:n,excluded_pages:o}=e,r=window.location.pathname;return n&&n.length>0?n.some(e=>this.matchPageRule(r,e)):t&&t.length>0?t.includes(r):!(o&&o.length>0)||!o.some(e=>this.matchPageRule(r,e))}matchPageRule(e,t){switch(t.operator){case"EQUALS":return e===t.path;case"STARTS_WITH":return e.startsWith(t.path);default:return!1}}checkCanBeShownByVisitorsTypeCondition(e){const{visitors_type:t}=e;return"NEW"===t?!this.isRecurringVisitor:"RECURRING"!==t||this.isRecurringVisitor}async markAsShown(e){this.pw.api.recordPopupFormEvent(e.code,2).catch(t=>{_t.error(t,`${Qe} Failed to record web popup shown event for "${e.code}"`)});const{frequency:t,code:n}=e;"ONCE"!==t?"ONCE_PER_SESSION"===t&&sessionStorage.setItem(this.getSessionStorageKey(n),"1"):await this.pw.data.addShownWebPopup(n)}getSessionStorageKey(e){return`${Ge}.shown.${e}`}}return t})());
|
|
2
2
|
//# sourceMappingURL=widget-web-popups.js.map
|