@prodantix/sdk 0.7.0-beta.437 → 0.7.0-beta.440
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/dist/chat.cjs +5 -103
- package/dist/chat.d.cts +93 -8
- package/dist/chat.d.ts +93 -8
- package/dist/chat.js +5 -103
- package/dist/chunk-L4P6GMBC.js +2 -0
- package/dist/client-Cz7M6XJC.d.ts +477 -0
- package/dist/client-vogZuHfD.d.cts +477 -0
- package/dist/{config-6ulvfBFp.d.ts → config-Dmk59mPh.d.ts} +41 -2
- package/dist/{config-g14Jiv1t.d.cts → config-Dxf1vAMu.d.cts} +41 -2
- package/dist/consent.iife.js +20 -0
- package/dist/ctas.iife.js +37 -0
- package/dist/forms.iife.js +16 -0
- package/dist/guides.iife.js +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -1
- package/dist/messenger-help.iife.js +1 -1
- package/dist/messenger-tickets.iife.js +3 -0
- package/dist/messenger.cjs +1 -1
- package/dist/messenger.d.cts +1 -1
- package/dist/messenger.d.ts +1 -1
- package/dist/messenger.iife.js +5 -103
- package/dist/messenger.js +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.d.cts +3 -2
- package/dist/node.d.ts +3 -2
- package/dist/node.js +1 -1
- package/dist/pages.iife.js +2 -0
- package/dist/prodantix-push-sw.js +3 -0
- package/dist/surveys.iife.js +2 -0
- package/dist/{transport-DKFvkfX4.d.ts → transport-C4mkCaix.d.ts} +1 -1
- package/dist/{transport-DN9pXyrX.d.cts → transport-C9C4hqlF.d.cts} +1 -1
- package/dist/{types-Q2VNlJbG.d.cts → types-BUXFV_aE.d.cts} +11 -0
- package/dist/{types-Q2VNlJbG.d.ts → types-BUXFV_aE.d.ts} +11 -0
- package/dist/web.cjs +36 -1
- package/dist/web.d.cts +185 -4
- package/dist/web.d.ts +185 -4
- package/dist/web.js +36 -1
- package/package.json +1 -1
- package/dist/chunk-D6PMLUYA.js +0 -2
- package/dist/client-CL6Xvhay.d.cts +0 -135
- package/dist/client-QyKW0LFW.d.ts +0 -135
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
(function(){'use strict';var gt=Object.defineProperty;var mt=(t,e,n)=>e in t?gt(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var b=(t,e,n)=>mt(t,typeof e!="symbol"?e+"":e,n);var L=class extends Error{constructor(n,r,o){super(r,o);b(this,"code");this.code=n,this.name="ProdantixError";}};var C=class extends L{constructor(n,r,o){super("transport",n,o);b(this,"status");this.status=r,this.name="TransportError";}};function U(t){let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}var E=class{constructor(){b(this,"store",new Map);}getItem(e){var n;return (n=this.store.get(e))!=null?n:null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}};function M(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch(t){return new E}return new E}function yt(){return globalThis.crypto}function ht(t){t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e=[];for(let n=0;n<16;n+=1)e.push(t[n].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function ft(){let t=yt();if(t!=null&&t.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t!=null&&t.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return ht(e)}var J={uuid:ft};function V(t){return t.slice(0,16)}function F(t,e){return `pdx.${t}.${e}`}var z="consent",xt=["identityLink","analytics","marketing","functional"];function N(t){if(typeof t!="string")return null;try{let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,r={};for(let o of xt){let i=n[o];typeof i=="boolean"&&(r[o]=i);}return typeof n.version=="number"&&Number.isInteger(n.version)&&(r.version=n.version),Array.isArray(n.categories)&&n.categories.every(o=>typeof o=="string")&&(r.categories=n.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var P=t=>F(t,"anonymous_id");function R(t,e){return N(t.getItem(F(e,z)))}function W(t,e,n){var s;let r=F(e,z),o=N(JSON.stringify(n)),i=o===null?null:N(JSON.stringify({...(s=R(t,e))!=null?s:{},...o}));if(i===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(i));}var k=["analytics","marketing","functional"],G="prodantix:consent-ready",q="prodantix:consent",Y="__prodantixConsent",X=(t,e)=>{var r;if(t===null||t.version===void 0)return true;let n=(r=t.categories)!=null?r:[];return e.categories.some(o=>!n.includes(o))},Q=(t,e)=>({analytics:t.categories.includes("analytics")&&e.has("analytics"),categories:[...t.categories],functional:t.categories.includes("functional")&&e.has("functional"),marketing:t.categories.includes("marketing")&&e.has("marketing"),version:t.version}),B=t=>new Set(k.filter(e=>(t==null?void 0:t[e])===true));var Z="prodantix-consent-style",bt=`
|
|
2
|
+
.pdx-consent{position:fixed;z-index:2147483000;left:0;right:0;box-sizing:border-box;padding:16px;font:14px/1.5 system-ui,sans-serif;color:var(--pdx-consent-text);background:var(--pdx-consent-background);box-shadow:0 -2px 12px rgba(0,0,0,.15)}
|
|
3
|
+
.pdx-consent[data-layout="bar_bottom"]{bottom:0}
|
|
4
|
+
.pdx-consent[data-layout="bar_top"]{top:0}
|
|
5
|
+
.pdx-consent[data-layout="box"]{left:16px;right:auto;bottom:16px;max-width:360px;border-radius:var(--pdx-consent-radius)}
|
|
6
|
+
.pdx-consent h2{margin:0 0 4px;font-size:16px}
|
|
7
|
+
.pdx-consent p{margin:0 0 12px}
|
|
8
|
+
.pdx-consent-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
|
|
9
|
+
.pdx-consent-choice{min-width:120px;min-height:44px;padding:0 16px;font:inherit;font-weight:600;color:var(--pdx-consent-button-text);background:var(--pdx-consent-button);border:0;border-radius:var(--pdx-consent-radius);cursor:pointer}
|
|
10
|
+
.pdx-consent-link{min-height:44px;padding:0 8px;font:inherit;color:inherit;text-decoration:underline;background:none;border:0;cursor:pointer}
|
|
11
|
+
.pdx-consent-choice:focus-visible,.pdx-consent-link:focus-visible,.pdx-consent input:focus-visible{outline:2px solid currentColor;outline-offset:2px}
|
|
12
|
+
.pdx-consent-dialog{position:fixed;inset:0;z-index:2147483001;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(0,0,0,.4)}
|
|
13
|
+
.pdx-consent-panel{box-sizing:border-box;width:100%;max-width:480px;max-height:100%;overflow:auto;padding:20px;font:14px/1.5 system-ui,sans-serif;color:var(--pdx-consent-text);background:var(--pdx-consent-background);border-radius:var(--pdx-consent-radius)}
|
|
14
|
+
.pdx-consent-panel h2{margin:0 0 12px;font-size:16px}
|
|
15
|
+
.pdx-consent-category{display:flex;gap:12px;align-items:flex-start;padding:8px 0;border-top:1px solid currentColor}
|
|
16
|
+
.pdx-consent-category input{width:20px;height:20px;margin:2px 0 0}
|
|
17
|
+
.pdx-consent-meta{margin:12px 0 0;font-size:12px;opacity:.8}
|
|
18
|
+
`,kt=t=>{if(t.getElementById(Z))return;let e=t.createElement("style");e.id=Z,e.textContent=bt,t.head.append(e);},tt=(t,e)=>{t.style.setProperty("--pdx-consent-background",e.style.background),t.style.setProperty("--pdx-consent-text",e.style.text),t.style.setProperty("--pdx-consent-button",e.style.button),t.style.setProperty("--pdx-consent-button-text",e.style.buttonText),t.style.setProperty("--pdx-consent-radius",`${e.style.radius}px`);},v=(t,e,n,r,o)=>{let i=t.createElement("button");return i.type="button",i.className=n==="choice"?"pdx-consent-choice":"pdx-consent-link",i.textContent=e,i.dataset.testid=r,i.addEventListener("click",o),i},et=(t,e,n,r)=>{kt(t);let o=e.texts,i=k.filter(d=>e.categories.includes(d)),s=null,g=null,y=null,h=()=>{g==null||g.remove(),g=null,y==null||y.focus();},p=d=>{h(),s==null||s.remove(),s=null,n.onAnswer(d);},l=d=>{var j;if(g)return;y=t.activeElement instanceof HTMLElement?t.activeElement:null;let u=t.createElement("div");u.className="pdx-consent-dialog";let a=t.createElement("div");a.className="pdx-consent-panel",a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true"),a.setAttribute("aria-labelledby","pdx-consent-settings-title"),a.dataset.testid="prodantix-consent-settings",tt(a,e);let c=t.createElement("h2");c.id="pdx-consent-settings-title",c.textContent=o.settings,a.append(c);let S=new Map,H=(m,w,pt,ut)=>{let $=t.createElement("label");$.className="pdx-consent-category";let x=t.createElement("input");x.type="checkbox",x.checked=pt,x.disabled=ut,x.dataset.testid=`prodantix-consent-category-${m}`;let K=t.createElement("span");return K.textContent=w,$.append(x,K),a.append($),x};H("necessary",o.necessary,true,true);for(let m of i)S.set(m,H(m,o[m],d.has(m),false));let T=t.createElement("div");T.className="pdx-consent-actions",T.append(v(t,o.save,"choice","prodantix-consent-save",()=>p(new Set(i.filter(m=>{var w;return ((w=S.get(m))==null?void 0:w.checked)===true})))),v(t,o.acceptAll,"choice","prodantix-consent-settings-accept",()=>p(new Set(i))),v(t,o.rejectAll,"choice","prodantix-consent-settings-reject",()=>p(new Set))),a.append(T),u.append(a),u.addEventListener("keydown",m=>{m.key==="Escape"&&h();}),t.body.append(u),g=u,(j=a.querySelector("input:not([disabled])"))==null||j.focus();};if(r){s=t.createElement("section"),s.className="pdx-consent",s.dataset.layout=e.layout,s.dataset.testid="prodantix-consent-banner",s.setAttribute("aria-label",o.title),tt(s,e);let d=t.createElement("h2");d.textContent=o.title;let u=t.createElement("p");u.textContent=o.body,s.append(d,u);let a=t.createElement("div");if(a.className="pdx-consent-actions",a.append(v(t,o.acceptAll,"choice","prodantix-consent-accept",()=>p(new Set(i))),v(t,o.rejectAll,"choice","prodantix-consent-reject",()=>p(new Set)),v(t,o.settings,"link","prodantix-consent-open-settings",()=>l(new Set))),e.policyUrl.startsWith("https://")){let c=t.createElement("a");c.className="pdx-consent-link",c.href=e.policyUrl,c.rel="noopener",c.target="_blank",c.textContent=o.policyLabel||e.policyUrl,a.append(c);}if(s.append(a),e.poweredBy){let c=t.createElement("p");c.className="pdx-consent-meta",c.textContent=e.poweredByText,s.append(c);}t.body.append(s);}return {openSettings:l,remove:()=>{h(),s==null||s.remove(),s=null;}}};var vt='script[type="text/plain"][data-prodantix-consent]',A=(t,e)=>{let n=0;for(let r of Array.from(t.querySelectorAll(vt))){let o=r.dataset.prodantixConsent;if(o===void 0||!e.has(o))continue;let i=t.createElement("script");for(let s of Array.from(r.attributes))s.name!=="type"&&s.name!=="data-prodantix-consent"&&i.setAttribute(s.name,s.value);i.text=r.text,r.replaceWith(i),n+=1;}return n};var nt=(t,e,n)=>{t.win.dispatchEvent(new CustomEvent(e,{detail:n}));},ot=async t=>{let e=await t.fetch(`${t.edge}/v1/consent?language=${encodeURIComponent(t.language)}`,{headers:{authorization:`Bearer ${t.apiKey}`},method:"GET"});if(!e.ok)throw new C("the consent banner could not be read",e.status);let n=JSON.parse(await e.text()),r=R(t.shared,t.namespace),o=n.banner,i=o!==null&&r!==null&&!X(r,o)?r:null,s={anonymousId:n.anonymousId,consent:i,rule:n.rule};if(t.win[Y]=s,nt(t,G,s),o===null)return A(t.doc,new Set(k)),{openSettings:()=>{}};A(t.doc,i!==null?B(i):n.rule==="notice"?new Set(k):new Set);let g=p=>{var u,a,c;let l=Q(o,p),d=n.anonymousId;l.analytics===true&&(d=(u=t.shared.getItem(P(t.namespace)))!=null?u:t.ids.uuid(),t.shared.setItem(P(t.namespace),d)),W(t.shared,t.namespace,l),s.consent=l,nt(t,q,l),A(t.doc,p),t.fetch(`${t.edge}/v1/consent`,{body:JSON.stringify({analytics:l.analytics===true,distinctId:d,functional:l.functional===true,marketing:l.marketing===true,pageUrl:(c=(a=t.doc.location)==null?void 0:a.href)!=null?c:"",version:o.version}),headers:{authorization:`Bearer ${t.apiKey}`,"content-type":"application/json"},method:"POST"}).then(S=>{S.ok||t.onError(new C("the consent answer could not be kept",S.status));}).catch(t.onError);},y=et(t.doc,o,{onAnswer:g},i===null),h=()=>y.openSettings(B(s.consent));return t.doc.addEventListener("click",p=>{var d,u;(u=(d=p.target)==null?void 0:d.closest)!=null&&u.call(d,"[data-prodantix-consent-settings]")&&(p.preventDefault(),h());}),{openSettings:h}};var St=/^\d{1,3}(\.\d{1,3}){3}$/,Ct=/^[a-z0-9.-]+$/i;function rt(){return Math.random().toString(36).slice(2,12)}function _(t,e){let n=`${e}=`,r=[];for(let o of t.cookie.split(";")){let i=o.trim();i.startsWith(n)&&r.push(i.slice(n.length));}return r}function I(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function st(t,e,n,r){try{let o=`pdx_probe_${r()}`,i=r();t.cookie=`${o}=${i}; ${I(e,60,n)}`;let s=_(t,o).includes(i);t.cookie=`${o}=; ${I(e,0,n)}`;let g=_(t,o).includes(i);return s&&!g}catch(o){return false}}function It(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||St.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let o=n.length-2;o>=0;o-=1)r.push(n.slice(o).join("."));return r}function wt(t,e,n,r=rt){for(let o of It(t))if(st(e,o,n,r))return o}function Et(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,o]of Object.entries(n))typeof o=="string"&&e.set(r,o);return e}var D=class{constructor(e,n,r,o){this.jar=e;this.name=n;this.domain=r;this.secure=o;}getItem(e){var n;return (n=this.read().get(e))!=null?n:null}setItem(e,n){let r=this.read();r.set(e,n),this.write(r);}removeItem(e){let n=this.read();n.delete(e)&&this.write(n);}read(){try{let e=_(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${I(void 0,0,this.secure)}`,e=_(this.jar,this.name));let n=e[0];return n?Et(n):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${I(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${I(this.domain,31536e3,this.secure)}`;}catch(n){return}}};function At(){return globalThis.document}function _t(){var t,e;return (e=(t=globalThis.location)==null?void 0:t.hostname)!=null?e:""}function Tt(){var t;return ((t=globalThis.location)==null?void 0:t.protocol)==="https:"}function $t(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return Ct.test(e)?e.toLowerCase():void 0}function it(t){var s,g,y,h,p;let e="jar"in t?t.jar:At();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(g=t.random)!=null?g:rt,o=(y=t.secure)!=null?y:Tt(),i=(h=t.hostname)!=null?h:_t();try{let l=(p=$t(t.domain))!=null?p:wt(i,e,o,r);return st(e,l,o,r)?new D(e,t.name,l,o):null}catch(l){return null}}var f=document.currentScript,O=f==null?void 0:f.dataset.key,at=U(),dt,ct,lt;if(f&&O&&at){let t=V(O),e=M();try{e=(dt=it({name:`pdx_${t}`}))!=null?dt:e;}catch(n){e=M();}ot({apiKey:O,doc:document,edge:(ct=f.dataset.edge)!=null?ct:new URL(f.src,window.location.href).origin,fetch:at,ids:J,language:(lt=f.dataset.language)!=null?lt:document.documentElement.lang,namespace:t,onError:n=>console.error("[prodantix] the consent answer could not be kept",n),shared:e,win:window}).then(n=>{window.prodantixConsent=n;}).catch(n=>console.error("[prodantix] the consent banner could not be read",n));}
|
|
19
|
+
})();//# sourceMappingURL=consent.iife.js.map
|
|
20
|
+
//# sourceMappingURL=consent.iife.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
(function(){'use strict';var zt=Object.defineProperty;var Jt=(t,e,n)=>e in t?zt(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var d=(t,e,n)=>Jt(t,typeof e!="symbol"?e+"":e,n);var O=class extends Error{constructor(n,r,i){super(r,i);d(this,"code");this.code=n,this.name="ProdantixError";}},V=class extends O{constructor(e){super("config",e),this.name="ConfigError";}},B=class extends O{constructor(n,r){super("validation",r);d(this,"field");this.field=n,this.name="ValidationError";}},h=class extends O{constructor(n,r,i){super("transport",n,i);d(this,"status");this.status=r,this.name="TransportError";}};function T(t){if(t)return t;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function w(){let t=globalThis.AbortController;return t?new t:void 0}var Ke=t=>new Promise(e=>{setTimeout(e,t);});function E(t){return t.replace(/\/+$/,"")}var q=class{constructor(){d(this,"store",new Map);}getItem(e){var n;return (n=this.store.get(e))!=null?n:null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}},U=class{constructor(e,n=()=>false){this.real=e;this.passes=n;d(this,"held",new q);d(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,n){this.target(e).setItem(e,n);}};function Be(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch(t){return new q}return new q}var je={now:()=>new Date};function Q(t){return t.toISOString()}function He(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof t=="string"&&t!==""?t:null}function Wt(){return globalThis.crypto}function Yt(t){t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e=[];for(let n=0;n<16;n+=1)e.push(t[n].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Qt(){let t=Wt();if(t!=null&&t.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t!=null&&t.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return Yt(e)}var Ge={uuid:Qt};var Xt=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Zt=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ve(t){let e=0;for(let n of t)e+=1;return e}function Ue(t){return Xt.test(t)}function en(t){return Zt.test(t)}function ze(t){let e=Ve(t);if(e<1||e>200)throw new B("distinct_id","distinct_id must be between 1 and 200 characters")}function Je(t){let e=Ve(t);if(e<1||e>200)throw new B("event_name","event_name must be between 1 and 200 characters");if(!en(t))throw new B("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var We="prodantix-js",Ye="0.7.0";var tn=t=>{};function Qe(t){var i,o,s,a,c,u,p,l,I,A,f,C,F,W,R;if(!t.apiKey||!Ue(t.apiKey))throw new V("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!t.host)throw new V("host is required (the ingest base URL)");let e=E(t.host),n=t.defaultProperties,r=(i=t.storage)!=null?i:new q;return {apiKey:t.apiKey,autocapture:(o=t.autocapture)!=null?o:false,clock:(s=t.clock)!=null?s:je,consent:t.consent,consentMode:t.consentMode,defaultProperties:typeof n=="function"?n:()=>n!=null?n:{},describeElement:t.describeElement,flagsHost:t.flagsHost?E(t.flagsHost):e,flushAt:(a=t.flushAt)!=null?a:20,flushIntervalMs:(c=t.flushIntervalMs)!=null?c:1e4,host:e,ids:(u=t.ids)!=null?u:Ge,locale:t.locale,maxQueueSize:(p=t.maxQueueSize)!=null?p:1e3,maxRetries:(l=t.maxRetries)!=null?l:3,namespace:be(t.apiKey),onError:(I=t.onError)!=null?I:tn,os:t.os,requestTimeoutMs:(A=t.requestTimeoutMs)!=null?A:1e4,sdkName:(f=t.sdkName)!=null?f:We,sdkVersion:(C=t.sdkVersion)!=null?C:Ye,sessionTracking:(F=t.sessionTracking)!=null?F:false,sharedStorage:(W=t.sharedStorage)!=null?W:r,socketFactory:t.socketFactory,storage:r,streamFlags:(R=t.streamFlags)!=null?R:false,transport:t.transport}}function be(t){return t.slice(0,16)}var Xe="$cta_viewed",Ze="$cta_clicked",xe="$cta_dismissed",et=(t,e)=>{let n={$cta_id:t.id,$cta_kind:t.kind,$cta_variant:t.variant.key,$cta_version:t.version},r=e===void 0?void 0:t.variant.content.buttons[e];return r&&e!==void 0&&(n.$cta_button=e,n.$cta_button_label=r.label,r.action.kind==="form"&&(n.$cta_form_id=r.action.value)),n},X=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async ctas(e){let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new h(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function tt(t,e,n){var i,o,s;Je(t.eventName),ze(t.distinctId);let r={distinct_id:t.distinctId,event_id:(i=t.eventId)!=null?i:n.uuid(),event_name:t.eventName,properties:(o=t.properties)!=null?o:{},schema_version:1,timestamp:Q((s=t.timestamp)!=null?s:e.now())};return t.context&&(r.context=t.context),t.sessionId&&(r.session_id=t.sessionId),r}var K=Symbol("absent");function nn(t,e){var i,o;if(t==="distinct_id")return e.distinctId;let n=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,t)?r[t]:K}function D(t){return t===K?"undefined":String(t)}function nt(t){return t===K?Number.NaN:Number(t)}function rt(t){return t!==K&&t!==null&&t!==""}function it(t,e){if(!Array.isArray(e))return false;let n=D(t);return e.map(r=>String(r)).includes(n)}function st(t,e){var i,o;let n=nn(t.attribute,e),r=t.value;switch(t.op){case "is_set":return rt(n);case "is_not_set":return !rt(n);case "eq":return D(n)===D(r===void 0?K:r);case "neq":return D(n)!==D(r===void 0?K:r);case "contains":return D(n).includes(D(r===void 0?K:r));case "in":return it(n,r);case "not_in":return Array.isArray(r)?!it(n,r):false;case "gt":return Z(n,r,(s,a)=>s>a);case "gte":return Z(n,r,(s,a)=>s>=a);case "lt":return Z(n,r,(s,a)=>s<a);case "lte":return Z(n,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function Z(t,e,n){let r=nt(t),i=e===void 0?Number.NaN:nt(e);return Number.isNaN(r)||Number.isNaN(i)?false:n(r,i)}function ot(t,e){let n=`${t}:${e}`,r=2166136261;for(let i=0;i<n.length;i++)r^=n.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function ke(t,e){return t.targeting.length===0||t.targeting.every(n=>st(n,e))}function at(t,e){var o;let n=ot(t.key,e.distinctId),r=(o=t.variations)!=null?o:[];if(r.length===0)return t.rolloutPercentage>=100||n<t.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,n<i)return r[s].key;return r[0].key}function Se(t,e,n,r){var i;for(let o of (i=t.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(c=>c.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=Se(s,e,n,r)&&ke(s,n)&&at(s,n)===o.variationKey;if(r.pop(),!a)return false}return true}function ee(t,e,n){return t.enabled?Se(t,e,n,[t.key])?ke(t,n)?t.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:ot(t.key,n.distinctId)<t.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function dt(t,e){let n={};for(let r of t)n[r.key]=ee(r,t,e).enabled;return n}function we(t,e,n){var s,a;let r=(s=t.variations)!=null?s:[],i=r[0];if(!i)return null;if(!t.enabled||!Se(t,e,n,[t.key])||!ke(t,n))return i;let o=at(t,n);return (a=r.find(c=>c.key===o))!=null?a:i}function ct(t){return t.some(e=>e.targeting.some(n=>n.op==="in_cohort"||n.op==="not_in_cohort"))}function lt(t){return `40${JSON.stringify(t)}`}function ut(){return "3"}function pt(t){let e=t.charAt(0),n=t.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=Ce(n);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=n.charAt(0),i=n.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=Ce(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=Ce(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function Ce(t){try{return JSON.parse(t)}catch(e){return null}}var rn="/socket.io/?EIO=4&transport=websocket",sn=250,te=class{constructor(e){this.options=e;d(this,"socket",null);d(this,"heartbeat",null);d(this,"pending",null);d(this,"lastKey","");d(this,"ready",false);d(this,"closed",false);d(this,"heartbeatWindow",45e3);d(this,"factory");d(this,"setTimer");d(this,"clearTimer");var n,r,i;this.factory=(n=e.socketFactory)!=null?n:on,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${rn}`,n;try{n=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=n,n.onmessage=r=>this.receive(String(r.data)),n.onerror=()=>n.close(),n.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let n=pt(e);if(n.kind==="open"){this.armHeartbeat(n.pingInterval+n.pingTimeout),(r=this.socket)==null||r.send(lt({projectKey:this.options.projectKey}));return}if(n.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(ut());return}if(n.kind==="connectError"||n.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(n.kind==="event"){if(n.name==="ready"){this.ready=true;return}if(n.name==="flagChange"){let a=(s=n.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},sn));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var n;return (n=this.socket)==null?void 0:n.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function on(t){let e=globalThis.WebSocket;if(!e)throw new h("no WebSocket");return new e(t)}var ne=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let c=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!c.ok)throw new h(`flags request failed with status ${c.status}`,c.status);let u=JSON.parse(await c.text());return {flags:(s=u.flags)!=null?s:{},variants:(a=u.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new h("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/snapshot`,r=w(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new h(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),c={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(c.socketUrl=a.socketUrl),c}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new h(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var mt="$form_viewed",gt="$form_started",z=class extends Error{constructor(n,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=n,this.fields=r;}},re=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async request(e,n){let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:s,method:n.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,n){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(n)}`,{method:"GET"});if(r<200||r>=300)throw new h(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,n){var a,c,u,p;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(n),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let l=JSON.parse(i);o=(c=(a=l.error)==null?void 0:a.fields)!=null?c:[],s=(p=(u=l.error)==null?void 0:u.message)!=null?p:s;}catch(l){o=[];}throw new z(r,o,s)}};var ht="$survey_shown",ft="$survey_dismissed",yt="$survey_sent",ie=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async surveys(e,n){var s;let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${n?`&lang=${encodeURIComponent(n)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new h(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function se(t,e){let n={$survey_id:t.id,$survey_iteration:t.iteration,$survey_name:t.name};for(let[r,i]of Object.entries(e))n[`$survey_response_${r}`]=i;return n}var oe=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async guides(e){var o;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=w(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new h(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function vt(t,e){let n={$guide_id:t.id,$guide_iteration:t.iteration,$guide_name:t.name};return e!==void 0&&(n.$guide_step_id=e),n}function Ee(t){if(typeof t!="string")return;let e=Array.from(t).length;return e>=1&&e<=200?t:void 0}function Fe(t,e){return `pdx.${t}.${e}`}var _e="consent",an=["identityLink","analytics","marketing","functional"];function Te(t){if(typeof t!="string")return null;try{let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,r={};for(let i of an){let o=n[i];typeof o=="boolean"&&(r[i]=o);}return typeof n.version=="number"&&Number.isInteger(n.version)&&(r.version=n.version),Array.isArray(n.categories)&&n.categories.every(i=>typeof i=="string")&&(r.categories=n.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var bt=t=>t.endsWith(`.${_e}`);function de(t,e){return Te(t.getItem(Fe(e,_e)))}function dn(t,e,n){var s;let r=Fe(e,_e),i=Te(JSON.stringify(n)),o=i===null?null:Te(JSON.stringify({...(s=de(t,e))!=null?s:{},...i}));if(o===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(o));}var ae=class{constructor(e,n,r,i){this.storage=e;this.shared=n;this.ids=r;this.namespace=i;d(this,"anonymousId");d(this,"distinctId");d(this,"identified");this.refresh();}refresh(){let e=Ee(this.shared.getItem(this.key("anonymous_id"))),n=Ee(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,n!==e&&this.storage.setItem(this.key("anonymous_id"),e)):n?(this.anonymousId=n,this.shared.setItem(this.key("anonymous_id"),n)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=Ee(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return de(this.shared,this.namespace)}setConsent(e){dn(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let n=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=n||r!==this.anonymousId;return this.distinctId=e,this.identified=true,n&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:n}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:n})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return Fe(this.namespace,e)}};var ce=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async inbox(e){var s;let n=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(n,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new h(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,n){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:n,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new h(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new h("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,n,r){let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var le=class{constructor(e,n){this.maxSize=e;this.onOverflow=n;d(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let n=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,n)}snapshot(){return [...this.events]}enforceCap(){var n;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(n=this.onOverflow)==null||n.call(this,{dropped:e});}};var cn={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function ln(t){return `pdx.${t}.session`}var ue=class{constructor(e,n,r,i,o=cn){this.storage=e;this.ids=n;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),n=this.live(this.read(),e);if(n===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-n.lastActivityAt<=this.options.throttleMs)return n;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==n.id?r:n;return this.write({...i,lastActivityAt:e})}live(e,n){if(e!==void 0&&!(n-e.lastActivityAt>this.options.idleMs||n-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let n=JSON.parse(e);return typeof n.id=="string"&&typeof n.startedAt=="number"&&typeof n.lastActivityAt=="number"?{id:n.id,lastActivityAt:n.lastActivityAt,startedAt:n.startedAt}:void 0}catch(n){return}}key(){return ln(this.namespace)}};var S={createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",set:"$set"};function xt(t){return t>=400&&t<500&&t!==429}var j=class{constructor(e={}){d(this,"fetch");d(this,"maxRetries");d(this,"requestTimeoutMs");d(this,"baseDelayMs");d(this,"maxDelayMs");d(this,"sleep");d(this,"random");var n,r,i,o,s,a;this.fetch=T(e.fetch),this.maxRetries=(n=e.maxRetries)!=null?n:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:Ke,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(n,e,r);if(s.ok)return;if(xt(s.status))throw new h(`ingest rejected batch with status ${s.status}`,s.status);i=new h(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof h&&s.status!==void 0&&xt(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new h("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,n,r){let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n.url,{body:r,headers:{authorization:`Bearer ${n.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var un="queue",pn=1e3,kt=3e4,Ie=t=>{let e={};return t.avatar!==void 0&&(e.$avatar=t.avatar),t.email!==void 0&&(e.$email=t.email),t.name!==void 0&&(e.$name=t.name),t.phone!==void 0&&(e.$phone=t.phone),e},pe=class{constructor(e){d(this,"config");d(this,"identity");d(this,"session");d(this,"queue");d(this,"transport");d(this,"flagsClient");d(this,"messagesClient");d(this,"surveysClient");d(this,"guidesClient");d(this,"captureListeners",new Set);d(this,"formsClient");d(this,"ctasClient");d(this,"context");d(this,"flushTimer");d(this,"flushing",false);d(this,"cachedFlags");d(this,"cachedSnapshot");d(this,"membershipCache");d(this,"stream");d(this,"shutDown",false);d(this,"exposures",new Set);d(this,"gates");d(this,"cookielessId");d(this,"storageListeners",new Set);var s,a,c;let n=Qe(e),r=(a=(s=de(n.sharedStorage,n.namespace))!=null?s:n.consent)!=null?a:null;if(this.gates=[new U(n.storage),new U(n.sharedStorage,bt)],n.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let u of this.gates)u.open();let[i,o]=this.gates;this.config={...n,sharedStorage:o,storage:i},this.identity=new ae(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new ue(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new le(this.config.maxQueueSize,({dropped:u})=>{this.config.onError(new O("queue_overflow",`event queue overflow: dropped ${u.length} oldest event(s)`));}),this.transport=(c=this.config.transport)!=null?c:new j({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new ne({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new ce({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new ie({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new oe({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new re({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new X({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,n={}){var r,i,o,s,a,c,u;try{this.identity.refresh();let p={...this.config.defaultProperties(),...n.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,n.element))!=null?o:{},...(s=n.properties)!=null?s:{}},l=tt({context:this.context,distinctId:(a=n.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:p,sessionId:(u=n.sessionId)!=null?u:(c=this.session)==null?void 0:c.current(),timestamp:n.timestamp},this.config.clock,this.config.ids);this.enqueue(l);}catch(p){this.config.onError(p);}for(let p of this.captureListeners)try{p(e);}catch(l){this.config.onError(l);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,n={}){var a,c;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=He(),s={...o===null?{}:{$timezone:o},...Ie((a=n.traits)!=null?a:{}),...(c=n.set)!=null?c:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(S.identify,{properties:i});}link(e,n,r){if(this.isCookieless())return;let i={$anon_distinct_id:n},o=Ie(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(S.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(S.createAlias,{properties:{alias:e}});}group(e,n,r){let i={$group_key:n,$group_type:e};r&&(i.$set=r),this.capture(S.group,{properties:i});}setPersonProperties(e,n){if(this.isCookieless())return;let r={};e&&(r.$set=e),n&&(r.$set_once=n),this.capture(S.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let n=Ie(e);Object.keys(n).length!==0&&this.capture(S.set,{properties:{$set:n}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),n=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:n.flags,variants:(r=n.variants)!=null?r:{}},n.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let n=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=n[e])!=null?s:false)),r}async getVariantLocal(e,n={}){var c;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(n,r.flags),s=i?we(i,r.flags,o):null,a=i?ee(i,r.flags,o).enabled:false;return this.recordExposure(e,(c=s==null?void 0:s.key)!=null?c:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,n){let r=`${this.identity.getDistinctId()} ${e} ${n}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(S.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:n}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let n=await this.flagSnapshot();return dt(n.flags,await this.localContext(e,n.flags))}async isFeatureEnabledLocal(e,n={}){var a,c;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(n,r.flags),s=i?ee(i,r.flags,o).enabled:false;return this.recordExposure(e,(c=i?(a=we(i,r.flags,o))==null?void 0:a.key:void 0)!=null?c:String(s)),s}async localContext(e,n){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&ct(n)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<kt?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<kt)return this.cachedSnapshot.snapshot;let n=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:n},this.maybeStream(n),n}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let n=new te({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=n,n.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(ht,{properties:se(e,{})});}captureSurveyDismissed(e){this.capture(ft,{properties:se(e,{})});}captureSurveySent(e,n){this.capture(yt,{properties:se(e,n)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,n,r){this.capture(e,{properties:vt(n,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,n,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:n,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,n,r){this.capture(e,{properties:et(n,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(pn);try{await this.transport.send({body:{events:e,sent_at:Q(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(n){this.queue.requeue(e),this.persistQueue(),this.config.onError(n);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let n=JSON.parse(e);Array.isArray(n)&&this.queue.restore(n);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),n=e;typeof n.unref=="function"&&n.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${un}`}};function mn(){let t=globalThis.document;return (t==null?void 0:t.visibilityState)==="hidden"}function gn(t){let e=globalThis.navigator,n=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!n)return false;let r=JSON.stringify({...t.body,api_key:t.projectKey});try{let i=new n([r],{type:"application/json"});return e.sendBeacon(t.url,i)}catch(i){return false}}var me=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new j(e);}async send(e){mn()&&gn(e)||await this.fetchTransport.send(e);}};var $e="prodantix:consent-ready",Ae="prodantix:consent",St="__prodantixConsent";var wt=(t,e)=>{t.takeCookielessId(e.anonymousId),e.consent!==null?t.setConsent(e.consent):e.rule==="notice"&&t.allowStorage();},Ct=(t,e)=>{let n=e[St];n&&wt(t,n);let r=o=>{let s=o.detail;s&&wt(t,s);},i=o=>{let s=o.detail;s&&t.setConsent(s);};return e.addEventListener($e,r),e.addEventListener(Ae,i),()=>{e.removeEventListener($e,r),e.removeEventListener(Ae,i);}};var hn=/^\d{1,3}(\.\d{1,3}){3}$/,fn=/^[a-z0-9.-]+$/i;function Et(){return Math.random().toString(36).slice(2,12)}function ge(t,e){let n=`${e}=`,r=[];for(let i of t.cookie.split(";")){let o=i.trim();o.startsWith(n)&&r.push(o.slice(n.length));}return r}function J(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function Tt(t,e,n,r){try{let i=`pdx_probe_${r()}`,o=r();t.cookie=`${i}=${o}; ${J(e,60,n)}`;let s=ge(t,i).includes(o);t.cookie=`${i}=; ${J(e,0,n)}`;let a=ge(t,i).includes(o);return s&&!a}catch(i){return false}}function yn(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||hn.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let i=n.length-2;i>=0;i-=1)r.push(n.slice(i).join("."));return r}function vn(t,e,n,r=Et){for(let i of yn(t))if(Tt(e,i,n,r))return i}function bn(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,i]of Object.entries(n))typeof i=="string"&&e.set(r,i);return e}var Pe=class{constructor(e,n,r,i){this.jar=e;this.name=n;this.domain=r;this.secure=i;}getItem(e){var n;return (n=this.read().get(e))!=null?n:null}setItem(e,n){let r=this.read();r.set(e,n),this.write(r);}removeItem(e){let n=this.read();n.delete(e)&&this.write(n);}read(){try{let e=ge(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${J(void 0,0,this.secure)}`,e=ge(this.jar,this.name));let n=e[0];return n?bn(n):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${J(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${J(this.domain,31536e3,this.secure)}`;}catch(n){return}}};function xn(){return globalThis.document}function kn(){var t,e;return (e=(t=globalThis.location)==null?void 0:t.hostname)!=null?e:""}function Sn(){var t;return ((t=globalThis.location)==null?void 0:t.protocol)==="https:"}function wn(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return fn.test(e)?e.toLowerCase():void 0}function Ft(t){var s,a,c,u,p;let e="jar"in t?t.jar:xn();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=t.random)!=null?a:Et,i=(c=t.secure)!=null?c:Sn(),o=(u=t.hostname)!=null?u:kn();try{let l=(p=wn(t.domain))!=null?p:vn(o,e,i,r);return Tt(e,l,i,r)?new Pe(e,t.name,l,i):null}catch(l){return null}}var he=t=>`prodantix-cta:${t}`,_t=t=>{try{let e=window.localStorage.getItem(he(t));return e===null?null:Number(e)}catch(e){return null}},It=t=>{try{return window.sessionStorage.getItem(he(t))!==null}catch(e){return false}},$t=(t,e)=>{try{window.localStorage.setItem(he(t),String(e)),window.sessionStorage.setItem(he(t),String(e));}catch(n){return}},At=(t,e,n,r)=>e===null?true:t.kind==="once"?false:t.kind==="session"?!n:r-e>=t.value*864e5;var N={am:{back:"\u1270\u1218\u1208\u1235",close:"\u12DD\u130B",closed:"\u12ED\u1205 \u1245\u133D \u12A0\u1201\u1295 \u121D\u120B\u123E\u127D\u1295 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",failed:"\u1218\u120B\u12AD \u12A0\u120D\u1270\u127B\u1208\u121D\u1362 \u12A5\u1295\u12F0\u1308\u1293 \u12ED\u121E\u12AD\u1229\u1362",invalid:"\u12ED\u1205 \u1218\u120D\u1235 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",next:"\u1240\u1323\u12ED",poweredBy:"\u1260Prodantix \u12E8\u1270\u1230\u122B",required:"\u12ED\u1205 \u12EB\u1235\u1348\u120D\u130B\u120D\u1362",sending:"\u1260\u1218\u120B\u12AD \u120B\u12ED\u2026",step:"\u12F0\u1228\u1303 {step} \u12A8{total}",submit:"\u120B\u12AD",thanks:"\u12A5\u1293\u1218\u1230\u130D\u1293\u1208\u1295\u1362"},ar:{back:"\u0631\u062C\u0648\u0639",close:"\u0625\u063A\u0644\u0627\u0642",closed:"\u0644\u0627 \u064A\u0642\u0628\u0644 \u0647\u0630\u0627 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0631\u062F\u0648\u062F\u064B\u0627 \u0627\u0644\u0622\u0646.",failed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",invalid:"\u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629.",next:"\u0627\u0644\u062A\u0627\u0644\u064A",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Prodantix",required:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628.",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",step:"\u0627\u0644\u062E\u0637\u0648\u0629 {step} \u0645\u0646 {total}",submit:"\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643."},bn:{back:"\u09AA\u09C7\u099B\u09A8\u09C7",close:"\u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8",closed:"\u098F\u0987 \u09AB\u09B0\u09CD\u09AE\u099F\u09BF \u098F\u0996\u09A8 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A8\u09BF\u099A\u09CD\u099B\u09C7 \u09A8\u09BE\u0964",failed:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09AF\u09BE\u09AF\u09BC\u09A8\u09BF\u0964 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09C1\u09A8\u0964",invalid:"\u098F\u0987 \u0989\u09A4\u09CD\u09A4\u09B0\u099F\u09BF \u0997\u09CD\u09B0\u09B9\u09A3\u09AF\u09CB\u0997\u09CD\u09AF \u09A8\u09AF\u09BC\u0964",next:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",poweredBy:"Prodantix \u09A6\u09CD\u09AC\u09BE\u09B0\u09BE \u099A\u09BE\u09B2\u09BF\u09A4",required:"\u098F\u099F\u09BF \u0986\u09AC\u09B6\u09CD\u09AF\u0995\u0964",sending:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09B9\u099A\u09CD\u099B\u09C7\u2026",step:"\u09A7\u09BE\u09AA {step} / {total}",submit:"\u099C\u09AE\u09BE \u09A6\u09BF\u09A8",thanks:"\u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6\u0964"},de:{back:"Zur\xFCck",close:"Schlie\xDFen",closed:"Dieses Formular nimmt gerade keine Antworten an.",failed:"Senden fehlgeschlagen. Bitte erneut versuchen.",invalid:"Diese Antwort wird nicht angenommen.",next:"Weiter",poweredBy:"Bereitgestellt von Prodantix",required:"Dieses Feld ist erforderlich.",sending:"Wird gesendet\u2026",step:"Schritt {step} von {total}",submit:"Absenden",thanks:"Vielen Dank."},en:{back:"Back",close:"Close",closed:"This form is not accepting responses right now.",failed:"This could not be sent. Try again.",invalid:"This answer is not accepted.",next:"Next",poweredBy:"Powered by Prodantix",required:"This is required.",sending:"Sending\u2026",step:"Step {step} of {total}",submit:"Submit",thanks:"Thank you."},es:{back:"Atr\xE1s",close:"Cerrar",closed:"Este formulario no acepta respuestas ahora.",failed:"No se pudo enviar. Int\xE9ntalo de nuevo.",invalid:"Esta respuesta no se acepta.",next:"Siguiente",poweredBy:"Con la tecnolog\xEDa de Prodantix",required:"Este campo es obligatorio.",sending:"Enviando\u2026",step:"Paso {step} de {total}",submit:"Enviar",thanks:"Gracias."},et:{back:"Tagasi",close:"Sulge",closed:"See vorm ei v\xF5ta praegu vastuseid vastu.",failed:"Saatmine eba\xF5nnestus. Proovi uuesti.",invalid:"Seda vastust ei v\xF5eta vastu.",next:"Edasi",poweredBy:"Toetab Prodantix",required:"See on kohustuslik.",sending:"Saatmine\u2026",step:"Samm {step}/{total}",submit:"Saada",thanks:"Ait\xE4h."},fil:{back:"Bumalik",close:"Isara",closed:"Hindi tumatanggap ng sagot ang form na ito ngayon.",failed:"Hindi naipadala. Subukan ulit.",invalid:"Hindi tinatanggap ang sagot na ito.",next:"Susunod",poweredBy:"Pinapagana ng Prodantix",required:"Kailangan ito.",sending:"Ipinapadala\u2026",step:"Hakbang {step} sa {total}",submit:"Ipadala",thanks:"Salamat."},fr:{back:"Retour",close:"Fermer",closed:"Ce formulaire n\u2019accepte plus de r\xE9ponses pour le moment.",failed:"L\u2019envoi a \xE9chou\xE9. R\xE9essayez.",invalid:"Cette r\xE9ponse n\u2019est pas accept\xE9e.",next:"Suivant",poweredBy:"Propuls\xE9 par Prodantix",required:"Ce champ est obligatoire.",sending:"Envoi\u2026",step:"\xC9tape {step} sur {total}",submit:"Envoyer",thanks:"Merci."},hi:{back:"\u092A\u0940\u091B\u0947",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",closed:"\u092F\u0939 \u092B\u093C\u0949\u0930\u094D\u092E \u0905\u092D\u0940 \u091C\u0935\u093E\u092C \u0928\u0939\u0940\u0902 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948\u0964",failed:"\u092D\u0947\u091C\u093E \u0928\u0939\u0940\u0902 \u091C\u093E \u0938\u0915\u093E\u0964 \u092B\u093F\u0930 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",invalid:"\u092F\u0939 \u091C\u0935\u093E\u092C \u0938\u094D\u0935\u0940\u0915\u093E\u0930 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",next:"\u0906\u0917\u0947",poweredBy:"Prodantix \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",required:"\u092F\u0939 \u091C\u093C\u0930\u0942\u0930\u0940 \u0939\u0948\u0964",sending:"\u092D\u0947\u091C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",step:"\u091A\u0930\u0923 {step} / {total}",submit:"\u092D\u0947\u091C\u0947\u0902",thanks:"\u0927\u0928\u094D\u092F\u0935\u093E\u0926\u0964"},id:{back:"Kembali",close:"Tutup",closed:"Formulir ini sedang tidak menerima tanggapan.",failed:"Gagal mengirim. Coba lagi.",invalid:"Jawaban ini tidak diterima.",next:"Berikutnya",poweredBy:"Didukung oleh Prodantix",required:"Wajib diisi.",sending:"Mengirim\u2026",step:"Langkah {step} dari {total}",submit:"Kirim",thanks:"Terima kasih."},ja:{back:"\u623B\u308B",close:"\u9589\u3058\u308B",closed:"\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306F\u73FE\u5728\u56DE\u7B54\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u305B\u3093\u3002",failed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",invalid:"\u3053\u306E\u56DE\u7B54\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3002",next:"\u6B21\u3078",poweredBy:"Powered by Prodantix",required:"\u5FC5\u9808\u9805\u76EE\u3067\u3059\u3002",sending:"\u9001\u4FE1\u4E2D\u2026",step:"\u30B9\u30C6\u30C3\u30D7 {step}/{total}",submit:"\u9001\u4FE1",thanks:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3057\u305F\u3002"},ko:{back:"\uC774\uC804",close:"\uB2EB\uAE30",closed:"\uC774 \uC591\uC2DD\uC740 \uC9C0\uAE08 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",failed:"\uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",invalid:"\uC774 \uB2F5\uBCC0\uC740 \uBC1B\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",next:"\uB2E4\uC74C",poweredBy:"Prodantix \uC81C\uACF5",required:"\uD544\uC218 \uD56D\uBAA9\uC785\uB2C8\uB2E4.",sending:"\uBCF4\uB0B4\uB294 \uC911\u2026",step:"{total}\uB2E8\uACC4 \uC911 {step}\uB2E8\uACC4",submit:"\uC81C\uCD9C",thanks:"\uAC10\uC0AC\uD569\uB2C8\uB2E4."},pt:{back:"Voltar",close:"Fechar",closed:"Este formul\xE1rio n\xE3o est\xE1 a aceitar respostas neste momento.",failed:"N\xE3o foi poss\xEDvel enviar. Tente novamente.",invalid:"Esta resposta n\xE3o \xE9 aceite.",next:"Seguinte",poweredBy:"Com tecnologia Prodantix",required:"Este campo \xE9 obrigat\xF3rio.",sending:"A enviar\u2026",step:"Passo {step} de {total}",submit:"Enviar",thanks:"Obrigado."},ru:{back:"\u041D\u0430\u0437\u0430\u0434",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",closed:"\u042D\u0442\u0430 \u0444\u043E\u0440\u043C\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u043E\u0442\u0432\u0435\u0442\u044B.",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",invalid:"\u042D\u0442\u043E\u0442 \u043E\u0442\u0432\u0435\u0442 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0441\u044F.",next:"\u0414\u0430\u043B\u0435\u0435",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Prodantix",required:"\u042D\u0442\u043E \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435.",sending:"\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430\u2026",step:"\u0428\u0430\u0433 {step} \u0438\u0437 {total}",submit:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",thanks:"\u0421\u043F\u0430\u0441\u0438\u0431\u043E."},sw:{back:"Rudi",close:"Funga",closed:"Fomu hii haipokei majibu kwa sasa.",failed:"Imeshindwa kutuma. Jaribu tena.",invalid:"Jibu hili halikubaliki.",next:"Endelea",poweredBy:"Inaendeshwa na Prodantix",required:"Hii inahitajika.",sending:"Inatuma\u2026",step:"Hatua {step} kati ya {total}",submit:"Tuma",thanks:"Asante."},vi:{back:"Quay l\u1EA1i",close:"\u0110\xF3ng",closed:"Bi\u1EC3u m\u1EABu n\xE0y hi\u1EC7n kh\xF4ng nh\u1EADn c\xE2u tr\u1EA3 l\u1EDDi.",failed:"Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c. H\xE3y th\u1EED l\u1EA1i.",invalid:"C\xE2u tr\u1EA3 l\u1EDDi n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn.",next:"Ti\u1EBFp",poweredBy:"\u0110\u01B0\u1EE3c h\u1ED7 tr\u1EE3 b\u1EDFi Prodantix",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c.",sending:"\u0110ang g\u1EEDi\u2026",step:"B\u01B0\u1EDBc {step}/{total}",submit:"G\u1EEDi",thanks:"C\u1EA3m \u01A1n b\u1EA1n."},zh:{back:"\u4E0A\u4E00\u6B65",close:"\u5173\u95ED",closed:"\u6B64\u8868\u5355\u76EE\u524D\u4E0D\u63A5\u53D7\u56DE\u590D\u3002",failed:"\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",invalid:"\u6B64\u56DE\u7B54\u65E0\u6548\u3002",next:"\u4E0B\u4E00\u6B65",poweredBy:"\u7531 Prodantix \u63D0\u4F9B\u652F\u6301",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879\u3002",sending:"\u6B63\u5728\u53D1\u9001\u2026",step:"\u7B2C {step} \u6B65\uFF0C\u5171 {total} \u6B65",submit:"\u63D0\u4EA4",thanks:"\u8C22\u8C22\u3002"}},Pt=t=>{var n;let e=(n=(t!=null?t:"").toLowerCase().split("-")[0])!=null?n:"";return e in N?e:"en"};var v="prodantix-cta",Rt="prodantix-cta-style",Cn=`.${v}{font-family:system-ui,sans-serif;color:var(--pdx-text);background:var(--pdx-background);border-radius:var(--pdx-radius);box-sizing:border-box;padding:16px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}
|
|
2
|
+
.${v} *{box-sizing:border-box}
|
|
3
|
+
.${v} h2{font-size:18px;line-height:1.3;margin:0;font-weight:700}
|
|
4
|
+
.${v} p{margin:0;font-size:15px;line-height:1.5}
|
|
5
|
+
.${v} img{max-width:100%;height:auto;border-radius:var(--pdx-radius)}
|
|
6
|
+
.${v} .pdx-text{display:flex;flex-direction:column;gap:6px;flex:1 1 240px;min-width:0}
|
|
7
|
+
.${v} .pdx-actions{display:flex;gap:8px;flex-wrap:wrap}
|
|
8
|
+
.${v} button{font:inherit;min-height:44px;padding:0 18px;border:0;border-radius:var(--pdx-radius);background:var(--pdx-button);color:var(--pdx-button-text);cursor:pointer}
|
|
9
|
+
.${v} button[data-secondary]{background:transparent;color:inherit;border:1px solid currentColor}
|
|
10
|
+
.${v} .pdx-close{min-width:44px;padding:0;background:transparent;color:inherit;font-size:22px;line-height:1}
|
|
11
|
+
.${v} .pdx-meta{font-size:12px;opacity:.85;flex-basis:100%}
|
|
12
|
+
.${v} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}
|
|
13
|
+
.${v}[data-kind=banner]{position:fixed;left:0;right:0;z-index:2147483000;border-radius:0}
|
|
14
|
+
.${v}[data-kind=banner][data-placement=top]{top:0}
|
|
15
|
+
.${v}[data-kind=banner][data-placement=bottom]{bottom:0}
|
|
16
|
+
.${v}[data-kind=slide_in]{position:fixed;bottom:16px;z-index:2147483000;width:min(360px,calc(100vw - 32px));box-shadow:0 8px 32px rgba(0,0,0,.18)}
|
|
17
|
+
.${v}[data-kind=slide_in][data-placement=bottom_left]{left:16px}
|
|
18
|
+
.${v}[data-kind=slide_in][data-placement=bottom_right]{right:16px}
|
|
19
|
+
dialog.${v}{border:0;max-width:min(480px,calc(100vw - 32px));box-shadow:0 16px 48px rgba(0,0,0,.24)}
|
|
20
|
+
dialog.${v}::backdrop{background:rgba(0,0,0,.45)}
|
|
21
|
+
@media (prefers-reduced-motion:no-preference){.${v}[data-kind=slide_in],.${v}[data-kind=banner],dialog.${v}{animation:pdx-cta-in .2s ease-out}}
|
|
22
|
+
@keyframes pdx-cta-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}`,En=()=>{if(document.getElementById(Rt))return;let t=document.createElement("style");t.id=Rt,t.textContent=Cn,document.head.append(t);},Tn=(t,e)=>{let n=e.variant.style;for(let[r,i]of [["--pdx-background",n.background],["--pdx-text",n.text],["--pdx-button",n.button],["--pdx-button-text",n.buttonText],["--pdx-radius",`${n.radius}px`]])t.style.setProperty(r,i);},Re=(t,e,n,r)=>{let i=e.variant.content,o=N[n.language];if(t.className=v,t.dataset.kind=e.kind,t.dataset.placement=e.placement,t.dataset.ctaId=e.id,Tn(t,e),i.image){let a=document.createElement("img");a.src=i.image,a.alt=i.imageAlt,a.loading="lazy",t.append(a);}let s=document.createElement("div");if(s.className="pdx-text",i.heading){let a=document.createElement("h2");a.textContent=i.heading,s.append(a);}if(i.body){let a=document.createElement("p");a.textContent=i.body,s.append(a);}if(t.append(s),i.buttons.length>0){let a=document.createElement("div");a.className="pdx-actions",i.buttons.forEach((c,u)=>{let p=document.createElement("button");p.type="button",p.textContent=c.label,p.dataset.action=`button-${u}`,u>0&&(p.dataset.secondary=""),p.addEventListener("click",()=>n.onButton(u)),a.append(p);}),t.append(a);}if(r){let a=document.createElement("button");a.type="button",a.className="pdx-close",a.dataset.action="close",a.textContent="\xD7",a.setAttribute("aria-label",o.close),a.title=o.close,a.addEventListener("click",r),t.append(a);}if(e.poweredBy){let a=document.createElement("p");a.className="pdx-meta",a.textContent=o.poweredBy,t.append(a);}},Mt=(t,e)=>{En();let n=t.variant.content.heading||t.variant.content.body;if(t.kind==="embedded"){let s=[...document.querySelectorAll("[data-prodantix-cta]")].filter(a=>a.dataset.prodantixCta===t.id).map(a=>{let c=document.createElement("section");return c.setAttribute("aria-label",n),Re(c,t,e,null),a.replaceChildren(c),c});return {destroy:()=>s.forEach(a=>a.remove()),elements:s}}if(t.kind==="popup"){let o=document.activeElement instanceof HTMLElement?document.activeElement:null,s=document.createElement("dialog");s.setAttribute("aria-label",n);let a=false,c=()=>{a||(a=true,s.open&&s.close(),s.remove(),o==null||o.focus());},u=()=>{c(),e.onDismiss();};return Re(s,t,e,u),s.addEventListener("cancel",p=>{p.preventDefault(),u();}),document.body.append(s),s.showModal(),{destroy:c,elements:[s]}}let r=document.createElement("section");r.setAttribute("aria-label",n),t.kind==="slide_in"&&(r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"));let i=()=>r.remove();return Re(r,t,e,()=>{i(),e.onDismiss();}),document.body.append(r),{destroy:i,elements:[r]}};var Nt=(t,e)=>{let n=false,r=[],i=()=>{n=true;for(let s of r.splice(0))s();},o=()=>{n||(i(),e());};if(t.kind==="load")queueMicrotask(o);else if(t.kind==="delay"){let s=setTimeout(o,t.value*1e3);r.push(()=>clearTimeout(s));}else if(t.kind==="scroll"){let s=()=>{let a=document.documentElement.scrollHeight-window.innerHeight;(a<=0||window.scrollY/a*100>=t.value)&&o();};window.addEventListener("scroll",s,{passive:true}),r.push(()=>window.removeEventListener("scroll",s)),s();}else if(t.kind==="exit"){let s=a=>{a.relatedTarget===null&&a.clientY<=0&&o();};document.addEventListener("mouseout",s),r.push(()=>document.removeEventListener("mouseout",s));}else {let s=t.value,a=u=>{try{return u.closest(s)!==null}catch(p){return false}},c=u=>{let p=u.target;p instanceof Element&&a(p)&&o();};document.addEventListener("click",c,true),r.push(()=>document.removeEventListener("click",c,true));}return i};var Fn=t=>{let e=0;for(let n of t){if(n!==0)return e+Math.clz32(n)-24;e+=8;}return e},_n=async t=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))),Lt=async t=>{for(let e=0;;e+=1){let n=e.toString(36);if(Fn(await _n(`${t.nonce}:${n}`))>=t.difficulty)return n}};var k="prodantix-form",In=`.${k}{font-family:var(--pdx-font);color:var(--pdx-text);background:var(--pdx-background);max-width:var(--pdx-width);box-sizing:border-box;padding:16px;border-radius:var(--pdx-radius)}
|
|
23
|
+
.${k} *{box-sizing:border-box}
|
|
24
|
+
.${k} .pdx-field{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
|
|
25
|
+
.${k} .pdx-field[hidden]{display:none}
|
|
26
|
+
.${k} label,.${k} legend{font-weight:600;font-size:14px}
|
|
27
|
+
.${k} input:not([type=checkbox]):not([type=radio]),.${k} select,.${k} textarea{font:inherit;color:var(--pdx-field-text);background:var(--pdx-field-background);border:1px solid currentColor;border-radius:var(--pdx-radius);padding:10px;min-height:44px;width:100%}
|
|
28
|
+
.${k} .pdx-choice{display:flex;align-items:center;gap:8px;min-height:44px}
|
|
29
|
+
.${k} .pdx-help,.${k} .pdx-meta{font-size:12px;opacity:.85}
|
|
30
|
+
.${k} .pdx-error{font-size:12px;font-weight:600}
|
|
31
|
+
.${k} button{font:inherit;min-height:44px;padding:0 18px;border:0;border-radius:var(--pdx-radius);background:var(--pdx-button);color:var(--pdx-button-text);cursor:pointer}
|
|
32
|
+
.${k} button[data-variant=back]{background:transparent;color:inherit;border:1px solid currentColor}
|
|
33
|
+
.${k} .pdx-actions{display:flex;gap:8px;justify-content:flex-end}
|
|
34
|
+
.${k} .pdx-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
|
|
35
|
+
.${k} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,Ot=t=>t==null||t===false||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0,$n=(t,e)=>{let n=t.condition;if(!n)return true;let r=e[n.field];return Ot(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(o=>typeof o=="string"&&n.values.includes(o))},An=t=>{let e=`${encodeURIComponent(t)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(e));return n?decodeURIComponent(n.slice(e.length)):""},Pn=t=>{var n;let e=t.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?(n=new URLSearchParams(window.location.search).get(e.value))!=null?n:"":An(e.value):""},m=(t,e={},n=[])=>{let r=Object.assign(document.createElement(t),e);return r.append(...n),r},Rn=(t,e,n)=>{var p;let r=m("p",{className:"pdx-error",id:`${e}-error`}),i=t.help?m("p",{className:"pdx-help",id:`${e}-help`},[t.help]):null,o=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),s=m("div",{className:"pdx-field"});if(s.dataset.field=t.key,t.kind==="rich_text")return s.append(m("p",{},[t.label])),{error:r,field:t,focus:()=>{},read:()=>{},root:s};if(t.kind==="hidden")return s.hidden=true,{error:r,field:t,focus:()=>{},read:()=>Pn(t),root:s};if(t.kind==="radio"||t.kind==="checkboxes"){let l=m("fieldset",{});l.setAttribute("aria-describedby",o),t.required&&l.setAttribute("aria-required","true"),l.append(m("legend",{},[t.label]));let I=t.options.filter(f=>!f.archived).map((f,C)=>{let F=m("input",{id:`${e}-${C}`,name:e,type:t.kind==="radio"?"radio":"checkbox",value:f.value});return F.addEventListener("change",n),l.append(m("div",{className:"pdx-choice"},[F,m("label",{htmlFor:`${e}-${C}`},[f.label])])),F});return s.append(l,...i?[i]:[],r),{error:r,field:t,focus:()=>{var f;return (f=I[0])==null?void 0:f.focus()},read:()=>{var C;let f=I.filter(F=>F.checked).map(F=>F.value);return t.kind==="radio"?(C=f[0])!=null?C:"":f},root:s}}let a=m("label",{htmlFor:e},[t.label]),c;if(t.kind==="textarea")c=m("textarea",{id:e,placeholder:t.placeholder,rows:4});else if(t.kind==="dropdown")c=m("select",{id:e},[m("option",{value:""},[""]),...t.options.filter(l=>!l.archived).map(l=>m("option",{value:l.value},[l.label]))]);else if(t.kind==="checkbox")c=m("input",{id:e,type:"checkbox"});else {let l={date:"date",email:"email",file:"file",number:"number",phone:"tel"};c=m("input",{id:e,placeholder:t.placeholder,type:(p=l[t.kind])!=null?p:"text"}),t.kind==="email"&&(c.autocomplete="email");}return c.setAttribute("aria-describedby",o),t.required&&c.setAttribute("aria-required","true"),c.addEventListener("input",n),c.addEventListener("change",n),t.kind==="checkbox"?s.append(m("div",{className:"pdx-choice"},[c,a]),...i?[i]:[],r):s.append(a,...i?[i]:[],c,r),{error:r,field:t,focus:()=>c.focus(),read:()=>c instanceof HTMLInputElement&&c.type==="checkbox"?c.checked:t.kind==="number"?c.value===""?"":Number(c.value):c.value,root:s}},Mn=(t,e)=>{let n=e.style,r={"--pdx-background":n.background,"--pdx-button":n.button,"--pdx-button-text":n.buttonText,"--pdx-field-background":n.fieldBackground,"--pdx-field-text":n.fieldText,"--pdx-font":n.font,"--pdx-radius":`${n.radius}px`,"--pdx-text":n.text,"--pdx-width":`${n.width}px`};for(let[i,o]of Object.entries(r))t.style.setProperty(i,o);},Nn=()=>{document.getElementById("prodantix-form-style")||document.head.append(m("style",{id:"prodantix-form-style",textContent:In}));},qt=(t,e)=>{let{formId:n,host:r,language:i}=e,o=N[i],s=l=>o[l],a=m("form",{className:k,noValidate:true});a.dataset.prodantixForm=n;let c=m("p",{className:"pdx-meta"});c.setAttribute("aria-live","polite"),c.setAttribute("role","status");let u=false,p=r.form(n).then(l=>{if(u)return;if(!l.accepting){a.replaceChildren(m("p",{className:"pdx-meta"},[s("closed")]));return}Nn(),Mn(a,l);let I=l.challenge?Lt(l.challenge):null,A=false,f=[],C=()=>{let g={};for(let y of f.flat())if(!y.root.hidden||y.field.kind==="hidden"){let x=y.read();x!==void 0&&(g[y.field.key]=x);}return g},F=()=>{let g=C();for(let y of f.flat())y.field.kind!=="hidden"&&(y.root.hidden=!$n(y.field,g));},W=()=>{A||(A=true,r.capture(gt,{$form_id:l.id,$form_version:l.version})),F();},R=l.steps.map((g,y)=>{let x=m("div",{});x.dataset.step=String(y),g.title&&x.append(m("p",{className:"pdx-meta"},[g.title]));let b=g.fields.map(_=>Rn(_,`pdx-${n}-${_.key}`,W));return f.push(b),x.append(...b.map(_=>_.root)),x}),Ne=m("input",{autocomplete:"off",name:l.honeypot,tabIndex:-1,type:"text"}),Le=m("div",{className:"pdx-hp"},[Ne]);Le.setAttribute("aria-hidden","true");let fe=[],H=m("div",{});if(l.consent.processing){let g=m("input",{id:`pdx-${n}-consent`,type:"checkbox"});g.setAttribute("aria-required","true"),fe.push({input:g,key:"$consent_processing"}),H.append(m("div",{className:"pdx-choice"},[g,m("label",{htmlFor:g.id},[l.consent.processing])]));}for(let g of l.consent.purposes){let y=m("input",{id:`pdx-${n}-consent-${g.key}`,type:"checkbox"});fe.push({input:y,key:`$consent_${g.key}`}),H.append(m("div",{className:"pdx-choice"},[y,m("label",{htmlFor:y.id},[g.label])])),g.notice&&H.append(m("p",{className:"pdx-help"},[g.notice]));}let ye=m("p",{className:"pdx-meta"}),G=m("button",{type:"button"},[s("back")]);G.dataset.variant="back";let Y=m("button",{type:"button"},[s("next")]),L=m("button",{type:"submit"},[s("submit")]);G.dataset.action="back",Y.dataset.action="next",L.dataset.action="submit";let Gt=m("div",{className:"pdx-actions"},[G,Y,L]),P=0,ve=()=>{R.forEach((y,x)=>{y.hidden=x!==P;});let g=P===R.length-1;G.hidden=P===0,Y.hidden=g,L.hidden=!g,H.hidden=!g,ye.hidden=R.length<2,ye.textContent=s("step").replace("{step}",String(P+1)).replace("{total}",String(R.length));},Vt=()=>{var g;for(let y of f.flat())y.error.textContent="",(g=y.root.querySelector("[aria-invalid]"))==null||g.removeAttribute("aria-invalid");},Oe=(g,y)=>{var x;g.error.textContent=y,(x=g.root.querySelector("input,select,textarea,fieldset"))==null||x.setAttribute("aria-invalid","true");},qe=g=>{var b,_;Vt();let y=C(),x=((b=f[g])!=null?b:[]).filter(M=>!M.root.hidden&&M.field.required&&Ot(y[M.field.key]));for(let M of x)Oe(M,s("required"));return x.length>0?(c.textContent=s("required"),(_=x[0])==null||_.focus(),false):true};G.addEventListener("click",()=>{P=Math.max(0,P-1),ve();}),Y.addEventListener("click",()=>{qe(P)&&(P+=1,ve());}),a.addEventListener("submit",g=>{if(g.preventDefault(),!qe(P))return;let y={...C(),[l.honeypot]:Ne.value};for(let b of fe)y[b.key]=b.input.checked;L.disabled=true,L.textContent=s("sending");let x=l.challenge;if(!x||!I){c.textContent=s("closed");return}I.then(b=>r.submit(n,y,x,b)).then(b=>{if(b.kind==="redirect"&&b.value.startsWith("https://")){window.location.assign(b.value);return}let _=m("p",{},[b.kind==="message"&&b.value?b.value:s("thanks")]);_.setAttribute("role","status"),a.replaceChildren(_);}).catch(b=>{L.disabled=false,L.textContent=s("submit");let _=b instanceof z?b.fields:[];for(let M of _){let De=f.flat().find(Ut=>Ut.field.key===M.field);De&&Oe(De,M.rule==="required"?s("required"):s("invalid"));}c.textContent=_.length>0?s("invalid"):s("failed");});}),a.append(ye,...R,Le,H,Gt,c),l.poweredBy&&e.poweredBy!==false&&a.append(m("p",{className:"pdx-meta"},[s("poweredBy")])),ve(),F(),r.capture(mt,{$form_id:l.id,$form_version:l.version});}).catch(()=>{u||a.replaceChildren(m("p",{className:"pdx-meta"},[s("closed")]));});return t.append(a),{destroy:()=>{u=true,a.remove();},ready:p}};var Dt=t=>({capture:(e,n)=>t.capture(e,{properties:n}),form:e=>t.getForm(e),submit:(e,n,r,i)=>t.submitForm(e,n,r,i)});var Ln=t=>({capture:(e,n,r)=>t.captureCta(e,n,r),ctas:e=>t.getCtas(e),forms:Dt(t),isEnabled:e=>t.isFeatureEnabled(e),variant:async e=>{var n,r;return (r=(n=await t.getVariant(e))==null?void 0:n.key)!=null?r:null}}),On=t=>t<768?"mobile":t<1024?"tablet":"desktop",qn=async(t,e)=>{let n=e.flag;return n?n.variant?await t.variant(n.key)===n.variant:t.isEnabled(n.key):true},Dn=(t,e,n)=>{let r=document.createElement("dialog");r.className="prodantix-form-popup";let i=document.createElement("button");i.type="button",i.textContent="\xD7",i.setAttribute("aria-label",N[n].close),i.title=N[n].close,i.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(i),document.body.append(r),qt(r,{formId:t,host:e,language:n}),r.showModal();},Kn=()=>{let t=window.prodantix;typeof t=="function"&&t("open");},Bn=async(t,e)=>{var u,p;let n=(u=e.now)!=null?u:Date.now,r=(p=e.open)!=null?p:(l=>window.location.assign(l)),i=[],o=[],s=false,a=()=>{s=true;for(let l of i.splice(0))l();for(let l of o.splice(0))l.destroy();},c=await t.ctas({device:On(window.innerWidth),language:document.documentElement.lang||e.language,url:window.location.href});for(let l of c)s||!At(l.frequency,_t(l.id),It(l.id),n())||!await qn(t,l)||i.push(Nt(l.trigger,()=>{if(s)return;let I=Mt(l,{language:e.language,onButton:A=>{var C;t.capture(Ze,l,A);let f=(C=l.variant.content.buttons[A])==null?void 0:C.action;f&&((f.kind!=="url"||l.kind!=="embedded")&&I.destroy(),f.kind==="url"?r(f.value):f.kind==="form"?Dn(f.value,t.forms,e.language):f.kind==="messenger"?Kn():t.capture(xe,l));},onDismiss:()=>t.capture(xe,l)});I.elements.length!==0&&(o.push(I),$t(l.id,n()),t.capture(Xe,l));}));return a},jn=()=>{},Kt=(t,e)=>{let n=Ln(t),r=Pt(e!=null?e:document.documentElement.lang),i=()=>Bn(n,{language:r}).catch(p=>(console.error("[prodantix] the CTAs for this page could not be read",p),jn)),o=i(),s=window.location.href,a=()=>{if(window.location.href===s)return;s=window.location.href,o=o.then(l=>(l(),i()));},c=history.pushState.bind(history),u=history.replaceState.bind(history);return history.pushState=(...p)=>{c(...p),a();},history.replaceState=(...p)=>{u(...p),a();},window.addEventListener("popstate",a),()=>{history.pushState=c,history.replaceState=u,window.removeEventListener("popstate",a),o.then(p=>p());}};var Bt=(t,e)=>({...t.page?{$page_id:t.page}:{},...t.page&&e?{$page_view_id:e}:{},...t.variant?{$page_variant:t.variant}:{}});var Hn=(t,e)=>{var n;try{return (n=Ft({name:`pdx_${be(t)}`}))!=null?n:e}catch(r){return e}},$=document.currentScript,Me=$==null?void 0:$.dataset.key,jt,Ht;if($&&Me){let t=new URL($.src,window.location.href).origin,e=Be(),n=$.dataset.consent==="banner",r=new pe({apiKey:Me,...n?{consentMode:"banner"}:{},defaultProperties:Bt($.dataset),flagsHost:(jt=$.dataset.edge)!=null?jt:t,host:(Ht=$.dataset.host)!=null?Ht:t,sessionTracking:false,sharedStorage:Hn(Me,e),storage:e,transport:new me({})});n&&Ct(r,window),Kt(r,$.dataset.language);}
|
|
36
|
+
})();//# sourceMappingURL=ctas.iife.js.map
|
|
37
|
+
//# sourceMappingURL=ctas.iife.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
(function(){'use strict';var Bt=Object.defineProperty;var jt=(n,e,t)=>e in n?Bt(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var d=(n,e,t)=>jt(n,typeof e!="symbol"?e+"":e,t);var M=class extends Error{constructor(t,r,i){super(r,i);d(this,"code");this.code=t,this.name="ProdantixError";}},V=class extends M{constructor(e){super("config",e),this.name="ConfigError";}},D=class extends M{constructor(t,r){super("validation",r);d(this,"field");this.field=t,this.name="ValidationError";}},m=class extends M{constructor(t,r,i){super("transport",t,i);d(this,"status");this.status=r,this.name="TransportError";}};function C(n){if(n)return n;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function S(){let n=globalThis.AbortController;return n?new n:void 0}var Be=n=>new Promise(e=>{setTimeout(e,n);});function E(n){return n.replace(/\/+$/,"")}var N=class{constructor(){d(this,"store",new Map);}getItem(e){var t;return (t=this.store.get(e))!=null?t:null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},H=class{constructor(e,t=()=>false){this.real=e;this.passes=t;d(this,"held",new N);d(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,t){this.target(e).setItem(e,t);}};function je(){try{let n=globalThis.localStorage;if(n){let e="__pdx_probe__";return n.setItem(e,"1"),n.removeItem(e),n}}catch(n){return new N}return new N}var Ge={now:()=>new Date};function Y(n){return n.toISOString()}function Ve(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let n=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof n=="string"&&n!==""?n:null}function Gt(){return globalThis.crypto}function Vt(n){n[6]=n[6]&15|64,n[8]=n[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(n[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Ht(){let n=Gt();if(n!=null&&n.randomUUID)return n.randomUUID();let e=new Uint8Array(16);if(n!=null&&n.getRandomValues)n.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return Vt(e)}var He={uuid:Ht};var Ut=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Jt=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ue(n){let e=0;for(let t of n)e+=1;return e}function Je(n){return Ut.test(n)}function zt(n){return Jt.test(n)}function ze(n){let e=Ue(n);if(e<1||e>200)throw new D("distinct_id","distinct_id must be between 1 and 200 characters")}function We(n){let e=Ue(n);if(e<1||e>200)throw new D("event_name","event_name must be between 1 and 200 characters");if(!zt(n))throw new D("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Ye="prodantix-js",Qe="0.7.0";var Wt=n=>{};function Xe(n){var i,o,s,a,l,g,v,c,$,L,f,_,T,z,A;if(!n.apiKey||!Je(n.apiKey))throw new V("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!n.host)throw new V("host is required (the ingest base URL)");let e=E(n.host),t=n.defaultProperties,r=(i=n.storage)!=null?i:new N;return {apiKey:n.apiKey,autocapture:(o=n.autocapture)!=null?o:false,clock:(s=n.clock)!=null?s:Ge,consent:n.consent,consentMode:n.consentMode,defaultProperties:typeof t=="function"?t:()=>t!=null?t:{},describeElement:n.describeElement,flagsHost:n.flagsHost?E(n.flagsHost):e,flushAt:(a=n.flushAt)!=null?a:20,flushIntervalMs:(l=n.flushIntervalMs)!=null?l:1e4,host:e,ids:(g=n.ids)!=null?g:He,locale:n.locale,maxQueueSize:(v=n.maxQueueSize)!=null?v:1e3,maxRetries:(c=n.maxRetries)!=null?c:3,namespace:be(n.apiKey),onError:($=n.onError)!=null?$:Wt,os:n.os,requestTimeoutMs:(L=n.requestTimeoutMs)!=null?L:1e4,sdkName:(f=n.sdkName)!=null?f:Ye,sdkVersion:(_=n.sdkVersion)!=null?_:Qe,sessionTracking:(T=n.sessionTracking)!=null?T:false,sharedStorage:(z=n.sharedStorage)!=null?z:r,socketFactory:n.socketFactory,storage:r,streamFlags:(A=n.streamFlags)!=null?A:false,transport:n.transport}}function be(n){return n.slice(0,16)}var Ze=(n,e)=>{let t={$cta_id:n.id,$cta_kind:n.kind,$cta_variant:n.variant.key,$cta_version:n.version},r=e===void 0?void 0:n.variant.content.buttons[e];return r&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=r.label,r.action.kind==="form"&&(t.$cta_form_id=r.action.value)),t},Q=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async ctas(e){let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new m(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function et(n,e,t){var i,o,s;We(n.eventName),ze(n.distinctId);let r={distinct_id:n.distinctId,event_id:(i=n.eventId)!=null?i:t.uuid(),event_name:n.eventName,properties:(o=n.properties)!=null?o:{},schema_version:1,timestamp:Y((s=n.timestamp)!=null?s:e.now())};return n.context&&(r.context=n.context),n.sessionId&&(r.session_id=n.sessionId),r}var q=Symbol("absent");function Yt(n,e){var i,o;if(n==="distinct_id")return e.distinctId;let t=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(t,n))return t[n];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,n)?r[n]:q}function O(n){return n===q?"undefined":String(n)}function tt(n){return n===q?Number.NaN:Number(n)}function nt(n){return n!==q&&n!==null&&n!==""}function rt(n,e){if(!Array.isArray(e))return false;let t=O(n);return e.map(r=>String(r)).includes(t)}function it(n,e){var i,o;let t=Yt(n.attribute,e),r=n.value;switch(n.op){case "is_set":return nt(t);case "is_not_set":return !nt(t);case "eq":return O(t)===O(r===void 0?q:r);case "neq":return O(t)!==O(r===void 0?q:r);case "contains":return O(t).includes(O(r===void 0?q:r));case "in":return rt(t,r);case "not_in":return Array.isArray(r)?!rt(t,r):false;case "gt":return X(t,r,(s,a)=>s>a);case "gte":return X(t,r,(s,a)=>s>=a);case "lt":return X(t,r,(s,a)=>s<a);case "lte":return X(t,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function X(n,e,t){let r=tt(n),i=e===void 0?Number.NaN:tt(e);return Number.isNaN(r)||Number.isNaN(i)?false:t(r,i)}function st(n,e){let t=`${n}:${e}`,r=2166136261;for(let i=0;i<t.length;i++)r^=t.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function xe(n,e){return n.targeting.length===0||n.targeting.every(t=>it(t,e))}function ot(n,e){var o;let t=st(n.key,e.distinctId),r=(o=n.variations)!=null?o:[];if(r.length===0)return n.rolloutPercentage>=100||t<n.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,t<i)return r[s].key;return r[0].key}function ke(n,e,t,r){var i;for(let o of (i=n.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(l=>l.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=ke(s,e,t,r)&&xe(s,t)&&ot(s,t)===o.variationKey;if(r.pop(),!a)return false}return true}function Z(n,e,t){return n.enabled?ke(n,e,t,[n.key])?xe(n,t)?n.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:st(n.key,t.distinctId)<n.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function at(n,e){let t={};for(let r of n)t[r.key]=Z(r,n,e).enabled;return t}function Se(n,e,t){var s,a;let r=(s=n.variations)!=null?s:[],i=r[0];if(!i)return null;if(!n.enabled||!ke(n,e,t,[n.key])||!xe(n,t))return i;let o=ot(n,t);return (a=r.find(l=>l.key===o))!=null?a:i}function dt(n){return n.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}function lt(n){return `40${JSON.stringify(n)}`}function ct(){return "3"}function ut(n){let e=n.charAt(0),t=n.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=we(t);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=t.charAt(0),i=t.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=we(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=we(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function we(n){try{return JSON.parse(n)}catch(e){return null}}var Qt="/socket.io/?EIO=4&transport=websocket",Xt=250,ee=class{constructor(e){this.options=e;d(this,"socket",null);d(this,"heartbeat",null);d(this,"pending",null);d(this,"lastKey","");d(this,"ready",false);d(this,"closed",false);d(this,"heartbeatWindow",45e3);d(this,"factory");d(this,"setTimer");d(this,"clearTimer");var t,r,i;this.factory=(t=e.socketFactory)!=null?t:Zt,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Qt}`,t;try{t=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=t,t.onmessage=r=>this.receive(String(r.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let t=ut(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),(r=this.socket)==null||r.send(lt({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(ct());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let a=(s=t.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Xt));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var t;return (t=this.socket)==null?void 0:t.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Zt(n){let e=globalThis.WebSocket;if(!e)throw new m("no WebSocket");return new e(n)}var te=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let l=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!l.ok)throw new m(`flags request failed with status ${l.status}`,l.status);let g=JSON.parse(await l.text());return {flags:(s=g.flags)!=null?s:{},variants:(a=g.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new m("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,r=S(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new m(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),l={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(l.socketUrl=a.socketUrl),l}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new m(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var pt="$form_viewed",mt="$form_started",U=class extends Error{constructor(t,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=t,this.fields=r;}},ne=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async request(e,t){let r=this.fetch;if(!r)throw new m("no fetch implementation available in this runtime");let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:t.body,headers:s,method:t.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,t){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(r<200||r>=300)throw new m(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,t){var a,l,g,v;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let c=JSON.parse(i);o=(l=(a=c.error)==null?void 0:a.fields)!=null?l:[],s=(v=(g=c.error)==null?void 0:g.message)!=null?v:s;}catch(c){o=[];}throw new U(r,o,s)}};var gt="$survey_shown",ht="$survey_dismissed",ft="$survey_sent",re=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async surveys(e,t){var s;let r=this.fetch;if(!r)throw new m("no fetch implementation available in this runtime");let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new m(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function ie(n,e){let t={$survey_id:n.id,$survey_iteration:n.iteration,$survey_name:n.name};for(let[r,i]of Object.entries(e))t[`$survey_response_${r}`]=i;return t}var se=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async guides(e){var o;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=S(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new m(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function yt(n,e){let t={$guide_id:n.id,$guide_iteration:n.iteration,$guide_name:n.name};return e!==void 0&&(t.$guide_step_id=e),t}function Ee(n){if(typeof n!="string")return;let e=Array.from(n).length;return e>=1&&e<=200?n:void 0}function Te(n,e){return `pdx.${n}.${e}`}var Fe="consent",en=["identityLink","analytics","marketing","functional"];function Ce(n){if(typeof n!="string")return null;try{let e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let i of en){let o=t[i];typeof o=="boolean"&&(r[i]=o);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(r.version=t.version),Array.isArray(t.categories)&&t.categories.every(i=>typeof i=="string")&&(r.categories=t.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var vt=n=>n.endsWith(`.${Fe}`);function ae(n,e){return Ce(n.getItem(Te(e,Fe)))}function tn(n,e,t){var s;let r=Te(e,Fe),i=Ce(JSON.stringify(t)),o=i===null?null:Ce(JSON.stringify({...(s=ae(n,e))!=null?s:{},...i}));if(o===null){n.removeItem(r);return}n.setItem(r,JSON.stringify(o));}var oe=class{constructor(e,t,r,i){this.storage=e;this.shared=t;this.ids=r;this.namespace=i;d(this,"anonymousId");d(this,"distinctId");d(this,"identified");this.refresh();}refresh(){let e=Ee(this.shared.getItem(this.key("anonymous_id"))),t=Ee(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=Ee(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return ae(this.shared,this.namespace)}setConsent(e){tn(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let t=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=t||r!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return Te(this.namespace,e)}};var de=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async inbox(e){var s;let t=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(t,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new m(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,t){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new m(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new m("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,r){let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var le=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;d(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){var t;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(t=this.onOverflow)==null||t.call(this,{dropped:e});}};var nn={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function rn(n){return `pdx.${n}.session`}var ce=class{constructor(e,t,r,i,o=nn){this.storage=e;this.ids=t;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==t.id?r:t;return this.write({...i,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch(t){return}}key(){return rn(this.namespace)}};var k={createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",set:"$set"};function bt(n){return n>=400&&n<500&&n!==429}var K=class{constructor(e={}){d(this,"fetch");d(this,"maxRetries");d(this,"requestTimeoutMs");d(this,"baseDelayMs");d(this,"maxDelayMs");d(this,"sleep");d(this,"random");var t,r,i,o,s,a;this.fetch=C(e.fetch),this.maxRetries=(t=e.maxRetries)!=null?t:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:Be,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(t,e,r);if(s.ok)return;if(bt(s.status))throw new m(`ingest rejected batch with status ${s.status}`,s.status);i=new m(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof m&&s.status!==void 0&&bt(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new m("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,t,r){let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:r,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var sn="queue",on=1e3,xt=3e4,_e=n=>{let e={};return n.avatar!==void 0&&(e.$avatar=n.avatar),n.email!==void 0&&(e.$email=n.email),n.name!==void 0&&(e.$name=n.name),n.phone!==void 0&&(e.$phone=n.phone),e},ue=class{constructor(e){d(this,"config");d(this,"identity");d(this,"session");d(this,"queue");d(this,"transport");d(this,"flagsClient");d(this,"messagesClient");d(this,"surveysClient");d(this,"guidesClient");d(this,"captureListeners",new Set);d(this,"formsClient");d(this,"ctasClient");d(this,"context");d(this,"flushTimer");d(this,"flushing",false);d(this,"cachedFlags");d(this,"cachedSnapshot");d(this,"membershipCache");d(this,"stream");d(this,"shutDown",false);d(this,"exposures",new Set);d(this,"gates");d(this,"cookielessId");d(this,"storageListeners",new Set);var s,a,l;let t=Xe(e),r=(a=(s=ae(t.sharedStorage,t.namespace))!=null?s:t.consent)!=null?a:null;if(this.gates=[new H(t.storage),new H(t.sharedStorage,vt)],t.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let g of this.gates)g.open();let[i,o]=this.gates;this.config={...t,sharedStorage:o,storage:i},this.identity=new oe(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new ce(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new le(this.config.maxQueueSize,({dropped:g})=>{this.config.onError(new M("queue_overflow",`event queue overflow: dropped ${g.length} oldest event(s)`));}),this.transport=(l=this.config.transport)!=null?l:new K({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new te({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new de({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new re({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new se({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new ne({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new Q({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,t={}){var r,i,o,s,a,l,g;try{this.identity.refresh();let v={...this.config.defaultProperties(),...t.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,t.element))!=null?o:{},...(s=t.properties)!=null?s:{}},c=et({context:this.context,distinctId:(a=t.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:v,sessionId:(g=t.sessionId)!=null?g:(l=this.session)==null?void 0:l.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(c);}catch(v){this.config.onError(v);}for(let v of this.captureListeners)try{v(e);}catch(c){this.config.onError(c);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){var a,l;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=Ve(),s={...o===null?{}:{$timezone:o},..._e((a=t.traits)!=null?a:{}),...(l=t.set)!=null?l:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(k.identify,{properties:i});}link(e,t,r){if(this.isCookieless())return;let i={$anon_distinct_id:t},o=_e(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(k.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(k.createAlias,{properties:{alias:e}});}group(e,t,r){let i={$group_key:t,$group_type:e};r&&(i.$set=r),this.capture(k.group,{properties:i});}setPersonProperties(e,t){if(this.isCookieless())return;let r={};e&&(r.$set=e),t&&(r.$set_once=t),this.capture(k.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let t=_e(e);Object.keys(t).length!==0&&this.capture(k.set,{properties:{$set:t}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:(r=t.variants)!=null?r:{}},t.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let t=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=t[e])!=null?s:false)),r}async getVariantLocal(e,t={}){var l;let r=await this.flagSnapshot(),i=r.flags.find(g=>g.key===e),o=await this.localContext(t,r.flags),s=i?Se(i,r.flags,o):null,a=i?Z(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=s==null?void 0:s.key)!=null?l:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,t){let r=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(k.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return at(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){var a,l;let r=await this.flagSnapshot(),i=r.flags.find(g=>g.key===e),o=await this.localContext(t,r.flags),s=i?Z(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=i?(a=Se(i,r.flags,o))==null?void 0:a.key:void 0)!=null?l:String(s)),s}async localContext(e,t){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&dt(t)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<xt?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<xt)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new ee({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(gt,{properties:ie(e,{})});}captureSurveyDismissed(e){this.capture(ht,{properties:ie(e,{})});}captureSurveySent(e,t){this.capture(ft,{properties:ie(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,r){this.capture(e,{properties:yt(t,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,r){this.capture(e,{properties:Ze(t,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(on);try{await this.transport.send({body:{events:e,sent_at:Y(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${sn}`}};function an(){let n=globalThis.document;return (n==null?void 0:n.visibilityState)==="hidden"}function dn(n){let e=globalThis.navigator,t=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!t)return false;let r=JSON.stringify({...n.body,api_key:n.projectKey});try{let i=new t([r],{type:"application/json"});return e.sendBeacon(n.url,i)}catch(i){return false}}var pe=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new K(e);}async send(e){an()&&dn(e)||await this.fetchTransport.send(e);}};var Ie="prodantix:consent-ready",$e="prodantix:consent",kt="__prodantixConsent";var St=(n,e)=>{n.takeCookielessId(e.anonymousId),e.consent!==null?n.setConsent(e.consent):e.rule==="notice"&&n.allowStorage();},wt=(n,e)=>{let t=e[kt];t&&St(n,t);let r=o=>{let s=o.detail;s&&St(n,s);},i=o=>{let s=o.detail;s&&n.setConsent(s);};return e.addEventListener(Ie,r),e.addEventListener($e,i),()=>{e.removeEventListener(Ie,r),e.removeEventListener($e,i);}};var ln=/^\d{1,3}(\.\d{1,3}){3}$/,cn=/^[a-z0-9.-]+$/i;function Et(){return Math.random().toString(36).slice(2,12)}function me(n,e){let t=`${e}=`,r=[];for(let i of n.cookie.split(";")){let o=i.trim();o.startsWith(t)&&r.push(o.slice(t.length));}return r}function J(n,e,t){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return n&&r.push(`Domain=${n}`),t&&r.push("Secure"),r.join("; ")}function Ct(n,e,t,r){try{let i=`pdx_probe_${r()}`,o=r();n.cookie=`${i}=${o}; ${J(e,60,t)}`;let s=me(n,i).includes(o);n.cookie=`${i}=; ${J(e,0,t)}`;let a=me(n,i).includes(o);return s&&!a}catch(i){return false}}function un(n){let e=n.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||ln.test(e)||!e.includes("."))return [];let t=e.split("."),r=[];for(let i=t.length-2;i>=0;i-=1)r.push(t.slice(i).join("."));return r}function pn(n,e,t,r=Et){for(let i of un(n))if(Ct(e,i,t,r))return i}function mn(n){let e=new Map,t=JSON.parse(decodeURIComponent(n));if(t===null||typeof t!="object"||Array.isArray(t))return e;for(let[r,i]of Object.entries(t))typeof i=="string"&&e.set(r,i);return e}var Ae=class{constructor(e,t,r,i){this.jar=e;this.name=t;this.domain=r;this.secure=i;}getItem(e){var t;return (t=this.read().get(e))!=null?t:null}setItem(e,t){let r=this.read();r.set(e,t),this.write(r);}removeItem(e){let t=this.read();t.delete(e)&&this.write(t);}read(){try{let e=me(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${J(void 0,0,this.secure)}`,e=me(this.jar,this.name));let t=e[0];return t?mn(t):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${J(this.domain,0,this.secure)}`;return}let t=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${t}; ${J(this.domain,31536e3,this.secure)}`;}catch(t){return}}};function gn(){return globalThis.document}function hn(){var n,e;return (e=(n=globalThis.location)==null?void 0:n.hostname)!=null?e:""}function fn(){var n;return ((n=globalThis.location)==null?void 0:n.protocol)==="https:"}function yn(n){if(n===void 0)return;let e=n.startsWith(".")?n.slice(1):n;return cn.test(e)?e.toLowerCase():void 0}function Tt(n){var s,a,l,g,v;let e="jar"in n?n.jar:gn();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=n.random)!=null?a:Et,i=(l=n.secure)!=null?l:fn(),o=(g=n.hostname)!=null?g:hn();try{let c=(v=yn(n.domain))!=null?v:pn(o,e,i,r);return Ct(e,c,i,r)?new Ae(e,n.name,c,i):null}catch(c){return null}}var Ft=n=>`prodantix-form-popup:${n}`,vn=n=>{try{let e=window.localStorage.getItem(Ft(n));return e===null?null:Number(e)}catch(e){return null}},bn=(n,e)=>{try{window.localStorage.setItem(Ft(n),String(e));}catch(t){return}},_t=(n,e,t)=>t===null||e-t>=n.periodDays*864e5,Pe=(n,e,t=Date.now)=>{if(!_t(n,t(),vn(n.formId)))return ()=>{};let r=false,i=[],o=()=>{if(!r){r=true;for(let a of i)a();bn(n.formId,t()),e();}},s=n.trigger;if(s.kind==="delay"){let a=setTimeout(o,s.seconds*1e3);i.push(()=>clearTimeout(a));}else if(s.kind==="scroll"){let a=()=>{let l=document.documentElement.scrollHeight-window.innerHeight;(l<=0||window.scrollY/l*100>=s.percent)&&o();};window.addEventListener("scroll",a,{passive:true}),i.push(()=>window.removeEventListener("scroll",a));}else {let a=l=>{l.relatedTarget===null&&l.clientY<=0&&o();};document.addEventListener("mouseout",a),i.push(()=>document.removeEventListener("mouseout",a));}return ()=>{r=true;for(let a of i)a();}},Re=n=>{if(!n)return null;if(n==="exit")return {kind:"exit"};let[e,t]=n.split(":"),r=Number(t);return !Number.isFinite(r)||r<0?null:e==="delay"?{kind:"delay",seconds:r}:e==="scroll"?{kind:"scroll",percent:Math.min(100,r)}:null};var xn=n=>{let e=0;for(let t of n){if(t!==0)return e+Math.clz32(t)-24;e+=8;}return e},kn=async n=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n))),It=async n=>{for(let e=0;;e+=1){let t=e.toString(36);if(xn(await kn(`${n.nonce}:${t}`))>=n.difficulty)return t}};var B={am:{back:"\u1270\u1218\u1208\u1235",close:"\u12DD\u130B",closed:"\u12ED\u1205 \u1245\u133D \u12A0\u1201\u1295 \u121D\u120B\u123E\u127D\u1295 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",failed:"\u1218\u120B\u12AD \u12A0\u120D\u1270\u127B\u1208\u121D\u1362 \u12A5\u1295\u12F0\u1308\u1293 \u12ED\u121E\u12AD\u1229\u1362",invalid:"\u12ED\u1205 \u1218\u120D\u1235 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",next:"\u1240\u1323\u12ED",poweredBy:"\u1260Prodantix \u12E8\u1270\u1230\u122B",required:"\u12ED\u1205 \u12EB\u1235\u1348\u120D\u130B\u120D\u1362",sending:"\u1260\u1218\u120B\u12AD \u120B\u12ED\u2026",step:"\u12F0\u1228\u1303 {step} \u12A8{total}",submit:"\u120B\u12AD",thanks:"\u12A5\u1293\u1218\u1230\u130D\u1293\u1208\u1295\u1362"},ar:{back:"\u0631\u062C\u0648\u0639",close:"\u0625\u063A\u0644\u0627\u0642",closed:"\u0644\u0627 \u064A\u0642\u0628\u0644 \u0647\u0630\u0627 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0631\u062F\u0648\u062F\u064B\u0627 \u0627\u0644\u0622\u0646.",failed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",invalid:"\u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629.",next:"\u0627\u0644\u062A\u0627\u0644\u064A",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Prodantix",required:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628.",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",step:"\u0627\u0644\u062E\u0637\u0648\u0629 {step} \u0645\u0646 {total}",submit:"\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643."},bn:{back:"\u09AA\u09C7\u099B\u09A8\u09C7",close:"\u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8",closed:"\u098F\u0987 \u09AB\u09B0\u09CD\u09AE\u099F\u09BF \u098F\u0996\u09A8 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A8\u09BF\u099A\u09CD\u099B\u09C7 \u09A8\u09BE\u0964",failed:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09AF\u09BE\u09AF\u09BC\u09A8\u09BF\u0964 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09C1\u09A8\u0964",invalid:"\u098F\u0987 \u0989\u09A4\u09CD\u09A4\u09B0\u099F\u09BF \u0997\u09CD\u09B0\u09B9\u09A3\u09AF\u09CB\u0997\u09CD\u09AF \u09A8\u09AF\u09BC\u0964",next:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",poweredBy:"Prodantix \u09A6\u09CD\u09AC\u09BE\u09B0\u09BE \u099A\u09BE\u09B2\u09BF\u09A4",required:"\u098F\u099F\u09BF \u0986\u09AC\u09B6\u09CD\u09AF\u0995\u0964",sending:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09B9\u099A\u09CD\u099B\u09C7\u2026",step:"\u09A7\u09BE\u09AA {step} / {total}",submit:"\u099C\u09AE\u09BE \u09A6\u09BF\u09A8",thanks:"\u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6\u0964"},de:{back:"Zur\xFCck",close:"Schlie\xDFen",closed:"Dieses Formular nimmt gerade keine Antworten an.",failed:"Senden fehlgeschlagen. Bitte erneut versuchen.",invalid:"Diese Antwort wird nicht angenommen.",next:"Weiter",poweredBy:"Bereitgestellt von Prodantix",required:"Dieses Feld ist erforderlich.",sending:"Wird gesendet\u2026",step:"Schritt {step} von {total}",submit:"Absenden",thanks:"Vielen Dank."},en:{back:"Back",close:"Close",closed:"This form is not accepting responses right now.",failed:"This could not be sent. Try again.",invalid:"This answer is not accepted.",next:"Next",poweredBy:"Powered by Prodantix",required:"This is required.",sending:"Sending\u2026",step:"Step {step} of {total}",submit:"Submit",thanks:"Thank you."},es:{back:"Atr\xE1s",close:"Cerrar",closed:"Este formulario no acepta respuestas ahora.",failed:"No se pudo enviar. Int\xE9ntalo de nuevo.",invalid:"Esta respuesta no se acepta.",next:"Siguiente",poweredBy:"Con la tecnolog\xEDa de Prodantix",required:"Este campo es obligatorio.",sending:"Enviando\u2026",step:"Paso {step} de {total}",submit:"Enviar",thanks:"Gracias."},et:{back:"Tagasi",close:"Sulge",closed:"See vorm ei v\xF5ta praegu vastuseid vastu.",failed:"Saatmine eba\xF5nnestus. Proovi uuesti.",invalid:"Seda vastust ei v\xF5eta vastu.",next:"Edasi",poweredBy:"Toetab Prodantix",required:"See on kohustuslik.",sending:"Saatmine\u2026",step:"Samm {step}/{total}",submit:"Saada",thanks:"Ait\xE4h."},fil:{back:"Bumalik",close:"Isara",closed:"Hindi tumatanggap ng sagot ang form na ito ngayon.",failed:"Hindi naipadala. Subukan ulit.",invalid:"Hindi tinatanggap ang sagot na ito.",next:"Susunod",poweredBy:"Pinapagana ng Prodantix",required:"Kailangan ito.",sending:"Ipinapadala\u2026",step:"Hakbang {step} sa {total}",submit:"Ipadala",thanks:"Salamat."},fr:{back:"Retour",close:"Fermer",closed:"Ce formulaire n\u2019accepte plus de r\xE9ponses pour le moment.",failed:"L\u2019envoi a \xE9chou\xE9. R\xE9essayez.",invalid:"Cette r\xE9ponse n\u2019est pas accept\xE9e.",next:"Suivant",poweredBy:"Propuls\xE9 par Prodantix",required:"Ce champ est obligatoire.",sending:"Envoi\u2026",step:"\xC9tape {step} sur {total}",submit:"Envoyer",thanks:"Merci."},hi:{back:"\u092A\u0940\u091B\u0947",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",closed:"\u092F\u0939 \u092B\u093C\u0949\u0930\u094D\u092E \u0905\u092D\u0940 \u091C\u0935\u093E\u092C \u0928\u0939\u0940\u0902 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948\u0964",failed:"\u092D\u0947\u091C\u093E \u0928\u0939\u0940\u0902 \u091C\u093E \u0938\u0915\u093E\u0964 \u092B\u093F\u0930 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",invalid:"\u092F\u0939 \u091C\u0935\u093E\u092C \u0938\u094D\u0935\u0940\u0915\u093E\u0930 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",next:"\u0906\u0917\u0947",poweredBy:"Prodantix \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",required:"\u092F\u0939 \u091C\u093C\u0930\u0942\u0930\u0940 \u0939\u0948\u0964",sending:"\u092D\u0947\u091C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",step:"\u091A\u0930\u0923 {step} / {total}",submit:"\u092D\u0947\u091C\u0947\u0902",thanks:"\u0927\u0928\u094D\u092F\u0935\u093E\u0926\u0964"},id:{back:"Kembali",close:"Tutup",closed:"Formulir ini sedang tidak menerima tanggapan.",failed:"Gagal mengirim. Coba lagi.",invalid:"Jawaban ini tidak diterima.",next:"Berikutnya",poweredBy:"Didukung oleh Prodantix",required:"Wajib diisi.",sending:"Mengirim\u2026",step:"Langkah {step} dari {total}",submit:"Kirim",thanks:"Terima kasih."},ja:{back:"\u623B\u308B",close:"\u9589\u3058\u308B",closed:"\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306F\u73FE\u5728\u56DE\u7B54\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u305B\u3093\u3002",failed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",invalid:"\u3053\u306E\u56DE\u7B54\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3002",next:"\u6B21\u3078",poweredBy:"Powered by Prodantix",required:"\u5FC5\u9808\u9805\u76EE\u3067\u3059\u3002",sending:"\u9001\u4FE1\u4E2D\u2026",step:"\u30B9\u30C6\u30C3\u30D7 {step}/{total}",submit:"\u9001\u4FE1",thanks:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3057\u305F\u3002"},ko:{back:"\uC774\uC804",close:"\uB2EB\uAE30",closed:"\uC774 \uC591\uC2DD\uC740 \uC9C0\uAE08 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",failed:"\uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",invalid:"\uC774 \uB2F5\uBCC0\uC740 \uBC1B\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",next:"\uB2E4\uC74C",poweredBy:"Prodantix \uC81C\uACF5",required:"\uD544\uC218 \uD56D\uBAA9\uC785\uB2C8\uB2E4.",sending:"\uBCF4\uB0B4\uB294 \uC911\u2026",step:"{total}\uB2E8\uACC4 \uC911 {step}\uB2E8\uACC4",submit:"\uC81C\uCD9C",thanks:"\uAC10\uC0AC\uD569\uB2C8\uB2E4."},pt:{back:"Voltar",close:"Fechar",closed:"Este formul\xE1rio n\xE3o est\xE1 a aceitar respostas neste momento.",failed:"N\xE3o foi poss\xEDvel enviar. Tente novamente.",invalid:"Esta resposta n\xE3o \xE9 aceite.",next:"Seguinte",poweredBy:"Com tecnologia Prodantix",required:"Este campo \xE9 obrigat\xF3rio.",sending:"A enviar\u2026",step:"Passo {step} de {total}",submit:"Enviar",thanks:"Obrigado."},ru:{back:"\u041D\u0430\u0437\u0430\u0434",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",closed:"\u042D\u0442\u0430 \u0444\u043E\u0440\u043C\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u043E\u0442\u0432\u0435\u0442\u044B.",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",invalid:"\u042D\u0442\u043E\u0442 \u043E\u0442\u0432\u0435\u0442 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0441\u044F.",next:"\u0414\u0430\u043B\u0435\u0435",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Prodantix",required:"\u042D\u0442\u043E \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435.",sending:"\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430\u2026",step:"\u0428\u0430\u0433 {step} \u0438\u0437 {total}",submit:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",thanks:"\u0421\u043F\u0430\u0441\u0438\u0431\u043E."},sw:{back:"Rudi",close:"Funga",closed:"Fomu hii haipokei majibu kwa sasa.",failed:"Imeshindwa kutuma. Jaribu tena.",invalid:"Jibu hili halikubaliki.",next:"Endelea",poweredBy:"Inaendeshwa na Prodantix",required:"Hii inahitajika.",sending:"Inatuma\u2026",step:"Hatua {step} kati ya {total}",submit:"Tuma",thanks:"Asante."},vi:{back:"Quay l\u1EA1i",close:"\u0110\xF3ng",closed:"Bi\u1EC3u m\u1EABu n\xE0y hi\u1EC7n kh\xF4ng nh\u1EADn c\xE2u tr\u1EA3 l\u1EDDi.",failed:"Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c. H\xE3y th\u1EED l\u1EA1i.",invalid:"C\xE2u tr\u1EA3 l\u1EDDi n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn.",next:"Ti\u1EBFp",poweredBy:"\u0110\u01B0\u1EE3c h\u1ED7 tr\u1EE3 b\u1EDFi Prodantix",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c.",sending:"\u0110ang g\u1EEDi\u2026",step:"B\u01B0\u1EDBc {step}/{total}",submit:"G\u1EEDi",thanks:"C\u1EA3m \u01A1n b\u1EA1n."},zh:{back:"\u4E0A\u4E00\u6B65",close:"\u5173\u95ED",closed:"\u6B64\u8868\u5355\u76EE\u524D\u4E0D\u63A5\u53D7\u56DE\u590D\u3002",failed:"\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",invalid:"\u6B64\u56DE\u7B54\u65E0\u6548\u3002",next:"\u4E0B\u4E00\u6B65",poweredBy:"\u7531 Prodantix \u63D0\u4F9B\u652F\u6301",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879\u3002",sending:"\u6B63\u5728\u53D1\u9001\u2026",step:"\u7B2C {step} \u6B65\uFF0C\u5171 {total} \u6B65",submit:"\u63D0\u4EA4",thanks:"\u8C22\u8C22\u3002"}},Me=n=>{var t;let e=(t=(n!=null?n:"").toLowerCase().split("-")[0])!=null?t:"";return e in B?e:"en"};var x="prodantix-form",Sn=`.${x}{font-family:var(--pdx-font);color:var(--pdx-text);background:var(--pdx-background);max-width:var(--pdx-width);box-sizing:border-box;padding:16px;border-radius:var(--pdx-radius)}
|
|
2
|
+
.${x} *{box-sizing:border-box}
|
|
3
|
+
.${x} .pdx-field{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
|
|
4
|
+
.${x} .pdx-field[hidden]{display:none}
|
|
5
|
+
.${x} label,.${x} legend{font-weight:600;font-size:14px}
|
|
6
|
+
.${x} input:not([type=checkbox]):not([type=radio]),.${x} select,.${x} textarea{font:inherit;color:var(--pdx-field-text);background:var(--pdx-field-background);border:1px solid currentColor;border-radius:var(--pdx-radius);padding:10px;min-height:44px;width:100%}
|
|
7
|
+
.${x} .pdx-choice{display:flex;align-items:center;gap:8px;min-height:44px}
|
|
8
|
+
.${x} .pdx-help,.${x} .pdx-meta{font-size:12px;opacity:.85}
|
|
9
|
+
.${x} .pdx-error{font-size:12px;font-weight:600}
|
|
10
|
+
.${x} button{font:inherit;min-height:44px;padding:0 18px;border:0;border-radius:var(--pdx-radius);background:var(--pdx-button);color:var(--pdx-button-text);cursor:pointer}
|
|
11
|
+
.${x} button[data-variant=back]{background:transparent;color:inherit;border:1px solid currentColor}
|
|
12
|
+
.${x} .pdx-actions{display:flex;gap:8px;justify-content:flex-end}
|
|
13
|
+
.${x} .pdx-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
|
|
14
|
+
.${x} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,$t=n=>n==null||n===false||typeof n=="string"&&n.trim()===""||Array.isArray(n)&&n.length===0,At=(n,e)=>{let t=n.condition;if(!t)return true;let r=e[t.field];return $t(r)?false:t.op==="is_set"?true:t.op==="equals"?typeof r=="string"&&r===t.values[0]:(Array.isArray(r)?r:[r]).some(o=>typeof o=="string"&&t.values.includes(o))},wn=n=>{let e=`${encodeURIComponent(n)}=`,t=document.cookie.split("; ").find(r=>r.startsWith(e));return t?decodeURIComponent(t.slice(e.length)):""},En=n=>{var t;let e=n.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?(t=new URLSearchParams(window.location.search).get(e.value))!=null?t:"":wn(e.value):""},u=(n,e={},t=[])=>{let r=Object.assign(document.createElement(n),e);return r.append(...t),r},Cn=(n,e,t)=>{var v;let r=u("p",{className:"pdx-error",id:`${e}-error`}),i=n.help?u("p",{className:"pdx-help",id:`${e}-help`},[n.help]):null,o=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),s=u("div",{className:"pdx-field"});if(s.dataset.field=n.key,n.kind==="rich_text")return s.append(u("p",{},[n.label])),{error:r,field:n,focus:()=>{},read:()=>{},root:s};if(n.kind==="hidden")return s.hidden=true,{error:r,field:n,focus:()=>{},read:()=>En(n),root:s};if(n.kind==="radio"||n.kind==="checkboxes"){let c=u("fieldset",{});c.setAttribute("aria-describedby",o),n.required&&c.setAttribute("aria-required","true"),c.append(u("legend",{},[n.label]));let $=n.options.filter(f=>!f.archived).map((f,_)=>{let T=u("input",{id:`${e}-${_}`,name:e,type:n.kind==="radio"?"radio":"checkbox",value:f.value});return T.addEventListener("change",t),c.append(u("div",{className:"pdx-choice"},[T,u("label",{htmlFor:`${e}-${_}`},[f.label])])),T});return s.append(c,...i?[i]:[],r),{error:r,field:n,focus:()=>{var f;return (f=$[0])==null?void 0:f.focus()},read:()=>{var _;let f=$.filter(T=>T.checked).map(T=>T.value);return n.kind==="radio"?(_=f[0])!=null?_:"":f},root:s}}let a=u("label",{htmlFor:e},[n.label]),l;if(n.kind==="textarea")l=u("textarea",{id:e,placeholder:n.placeholder,rows:4});else if(n.kind==="dropdown")l=u("select",{id:e},[u("option",{value:""},[""]),...n.options.filter(c=>!c.archived).map(c=>u("option",{value:c.value},[c.label]))]);else if(n.kind==="checkbox")l=u("input",{id:e,type:"checkbox"});else {let c={date:"date",email:"email",file:"file",number:"number",phone:"tel"};l=u("input",{id:e,placeholder:n.placeholder,type:(v=c[n.kind])!=null?v:"text"}),n.kind==="email"&&(l.autocomplete="email");}return l.setAttribute("aria-describedby",o),n.required&&l.setAttribute("aria-required","true"),l.addEventListener("input",t),l.addEventListener("change",t),n.kind==="checkbox"?s.append(u("div",{className:"pdx-choice"},[l,a]),...i?[i]:[],r):s.append(a,...i?[i]:[],l,r),{error:r,field:n,focus:()=>l.focus(),read:()=>l instanceof HTMLInputElement&&l.type==="checkbox"?l.checked:n.kind==="number"?l.value===""?"":Number(l.value):l.value,root:s}},Tn=(n,e)=>{let t=e.style,r={"--pdx-background":t.background,"--pdx-button":t.button,"--pdx-button-text":t.buttonText,"--pdx-field-background":t.fieldBackground,"--pdx-field-text":t.fieldText,"--pdx-font":t.font,"--pdx-radius":`${t.radius}px`,"--pdx-text":t.text,"--pdx-width":`${t.width}px`};for(let[i,o]of Object.entries(r))n.style.setProperty(i,o);},Fn=()=>{document.getElementById("prodantix-form-style")||document.head.append(u("style",{id:"prodantix-form-style",textContent:Sn}));},ge=(n,e)=>{let{formId:t,host:r,language:i}=e,o=B[i],s=c=>o[c],a=u("form",{className:x,noValidate:true});a.dataset.prodantixForm=t;let l=u("p",{className:"pdx-meta"});l.setAttribute("aria-live","polite"),l.setAttribute("role","status");let g=false,v=r.form(t).then(c=>{if(g)return;if(!c.accepting){a.replaceChildren(u("p",{className:"pdx-meta"},[s("closed")]));return}Fn(),Tn(a,c);let $=c.challenge?It(c.challenge):null,L=false,f=[],_=()=>{let p={};for(let h of f.flat())if(!h.root.hidden||h.field.kind==="hidden"){let b=h.read();b!==void 0&&(p[h.field.key]=b);}return p},T=()=>{let p=_();for(let h of f.flat())h.field.kind!=="hidden"&&(h.root.hidden=!At(h.field,p));},z=()=>{L||(L=true,r.capture(mt,{$form_id:c.id,$form_version:c.version})),T();},A=c.steps.map((p,h)=>{let b=u("div",{});b.dataset.step=String(h),p.title&&b.append(u("p",{className:"pdx-meta"},[p.title]));let y=p.fields.map(F=>Cn(F,`pdx-${t}-${F.key}`,z));return f.push(y),b.append(...y.map(F=>F.root)),b}),Oe=u("input",{autocomplete:"off",name:c.honeypot,tabIndex:-1,type:"text"}),qe=u("div",{className:"pdx-hp"},[Oe]);qe.setAttribute("aria-hidden","true");let fe=[],j=u("div",{});if(c.consent.processing){let p=u("input",{id:`pdx-${t}-consent`,type:"checkbox"});p.setAttribute("aria-required","true"),fe.push({input:p,key:"$consent_processing"}),j.append(u("div",{className:"pdx-choice"},[p,u("label",{htmlFor:p.id},[c.consent.processing])]));}for(let p of c.consent.purposes){let h=u("input",{id:`pdx-${t}-consent-${p.key}`,type:"checkbox"});fe.push({input:h,key:`$consent_${p.key}`}),j.append(u("div",{className:"pdx-choice"},[h,u("label",{htmlFor:h.id},[p.label])])),p.notice&&j.append(u("p",{className:"pdx-help"},[p.notice]));}let ye=u("p",{className:"pdx-meta"}),G=u("button",{type:"button"},[s("back")]);G.dataset.variant="back";let W=u("button",{type:"button"},[s("next")]),R=u("button",{type:"submit"},[s("submit")]);G.dataset.action="back",W.dataset.action="next",R.dataset.action="submit";let Lt=u("div",{className:"pdx-actions"},[G,W,R]),I=0,ve=()=>{A.forEach((h,b)=>{h.hidden=b!==I;});let p=I===A.length-1;G.hidden=I===0,W.hidden=p,R.hidden=!p,j.hidden=!p,ye.hidden=A.length<2,ye.textContent=s("step").replace("{step}",String(I+1)).replace("{total}",String(A.length));},Dt=()=>{var p;for(let h of f.flat())h.error.textContent="",(p=h.root.querySelector("[aria-invalid]"))==null||p.removeAttribute("aria-invalid");},Le=(p,h)=>{var b;p.error.textContent=h,(b=p.root.querySelector("input,select,textarea,fieldset"))==null||b.setAttribute("aria-invalid","true");},De=p=>{var y,F;Dt();let h=_(),b=((y=f[p])!=null?y:[]).filter(P=>!P.root.hidden&&P.field.required&&$t(h[P.field.key]));for(let P of b)Le(P,s("required"));return b.length>0?(l.textContent=s("required"),(F=b[0])==null||F.focus(),false):true};G.addEventListener("click",()=>{I=Math.max(0,I-1),ve();}),W.addEventListener("click",()=>{De(I)&&(I+=1,ve());}),a.addEventListener("submit",p=>{if(p.preventDefault(),!De(I))return;let h={..._(),[c.honeypot]:Oe.value};for(let y of fe)h[y.key]=y.input.checked;R.disabled=true,R.textContent=s("sending");let b=c.challenge;if(!b||!$){l.textContent=s("closed");return}$.then(y=>r.submit(t,h,b,y)).then(y=>{if(y.kind==="redirect"&&y.value.startsWith("https://")){window.location.assign(y.value);return}let F=u("p",{},[y.kind==="message"&&y.value?y.value:s("thanks")]);F.setAttribute("role","status"),a.replaceChildren(F);}).catch(y=>{R.disabled=false,R.textContent=s("submit");let F=y instanceof U?y.fields:[];for(let P of F){let Ke=f.flat().find(Kt=>Kt.field.key===P.field);Ke&&Le(Ke,P.rule==="required"?s("required"):s("invalid"));}l.textContent=F.length>0?s("invalid"):s("failed");});}),a.append(ye,...A,qe,j,Lt,l),c.poweredBy&&e.poweredBy!==false&&a.append(u("p",{className:"pdx-meta"},[s("poweredBy")])),ve(),T(),r.capture(pt,{$form_id:c.id,$form_version:c.version});}).catch(()=>{g||a.replaceChildren(u("p",{className:"pdx-meta"},[s("closed")]));});return n.append(a),{destroy:()=>{g=true,a.remove();},ready:v}};var Pt=n=>({capture:(e,t)=>n.capture(e,{properties:t}),form:e=>n.getForm(e),submit:(e,t,r,i)=>n.submitForm(e,t,r,i)});var Rt=(n,e)=>({...n.page?{$page_id:n.page}:{},...n.page&&e?{$page_view_id:e}:{},...n.variant?{$page_variant:n.variant}:{}});var _n=(n,e)=>{var t;try{return (t=Tt({name:`pdx_${be(n)}`}))!=null?t:e}catch(r){return e}},w=document.currentScript,he=w==null?void 0:w.dataset.form,Ne=w==null?void 0:w.dataset.key,Mt,Nt,Ot,qt;if(w&&he&&Ne){let n=new URL(w.src,window.location.href).origin,e=je(),t=w.dataset.consent==="banner",r=new ue({apiKey:Ne,...t?{consentMode:"banner"}:{},defaultProperties:Rt(w.dataset),flagsHost:(Mt=w.dataset.edge)!=null?Mt:n,host:(Nt=w.dataset.host)!=null?Nt:n,sessionTracking:false,sharedStorage:_n(Ne,e),storage:e,transport:new pe({})});t&&wt(r,window);let i=Pt(r),o=Me((Ot=w.dataset.language)!=null?Ot:document.documentElement.lang),s=Re(w.dataset.popup);if(s)Pe({formId:he,periodDays:Number((qt=w.dataset.periodDays)!=null?qt:7),trigger:s},()=>{let a=document.createElement("dialog");a.className="prodantix-form-popup";let l=document.createElement("button");l.type="button",l.textContent="\xD7",l.setAttribute("aria-label",B[o].close),l.title=B[o].close,l.addEventListener("click",()=>a.close()),a.append(l),document.body.append(a),ge(a,{formId:he,host:i,language:o}),a.showModal();});else {let a=document.createElement("div");w.after(a),ge(a,{formId:he,host:i,language:o});}}
|
|
15
|
+
})();//# sourceMappingURL=forms.iife.js.map
|
|
16
|
+
//# sourceMappingURL=forms.iife.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(function(){'use strict';var C={am:{close:"\u12DD\u130B",done:"\u1270\u1320\u1293\u124B\u120D",next:"\u1240\u1323\u12ED",open:"\u12AD\u1348\u1275",poweredBy:"\u1260 Prodantix \u12E8\u1240\u1228\u1260",required:"\u12ED\u1205 \u12EB\u1235\u1348\u120D\u130B\u120D\u1362",send:"\u120B\u12AD",step:"{n} \u12A8 {total}",tasks:"\u1270\u130D\u1263\u122B\u1275",thanks:"\u12A5\u1293\u1218\u1230\u130D\u1293\u1208\u1295\u1362"},ar:{close:"\u0625\u063A\u0644\u0627\u0642",done:"\u062A\u0645",next:"\u0627\u0644\u062A\u0627\u0644\u064A",open:"\u0627\u0641\u062A\u062D",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Prodantix",required:"\u0647\u0630\u0627 \u0645\u0637\u0644\u0648\u0628.",send:"\u0625\u0631\u0633\u0627\u0644",step:"{n} \u0645\u0646 {total}",tasks:"\u0627\u0644\u0645\u0647\u0627\u0645",thanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643."},bn:{close:"\u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8",done:"\u09B8\u09AE\u09CD\u09AA\u09A8\u09CD\u09A8",next:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",open:"\u0996\u09C1\u09B2\u09C1\u09A8",poweredBy:"Prodantix \u09A6\u09CD\u09AC\u09BE\u09B0\u09BE \u099A\u09BE\u09B2\u09BF\u09A4",required:"\u098F\u099F\u09BF \u09AA\u09CD\u09B0\u09AF\u09BC\u09CB\u099C\u09A8\u0964",send:"\u09AA\u09BE\u09A0\u09BE\u09A8",step:"{total}\u099F\u09BF\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7 {n}",tasks:"\u0995\u09BE\u099C",thanks:"\u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6\u0964"},de:{close:"Schlie\xDFen",done:"Fertig",next:"Weiter",open:"\xD6ffnen",poweredBy:"Bereitgestellt von Prodantix",required:"Bitte beantworten.",send:"Senden",step:"{n} von {total}",tasks:"Aufgaben",thanks:"Danke!"},en:{close:"Close",done:"Done",next:"Next",open:"Open",poweredBy:"Powered by Prodantix",required:"This one needs an answer.",send:"Send",step:"{n} of {total}",tasks:"Tasks",thanks:"Thank you."},es:{close:"Cerrar",done:"Listo",next:"Siguiente",open:"Abrir",poweredBy:"Con la tecnolog\xEDa de Prodantix",required:"Esta necesita una respuesta.",send:"Enviar",step:"{n} de {total}",tasks:"Tareas",thanks:"Gracias."},et:{close:"Sulge",done:"Valmis",next:"Edasi",open:"Ava",poweredBy:"Toetab Prodantix",required:"See vajab vastust.",send:"Saada",step:"{n} / {total}",tasks:"\xDClesanded",thanks:"Ait\xE4h."},fil:{close:"Isara",done:"Tapos",next:"Susunod",open:"Buksan",poweredBy:"Pinapagana ng Prodantix",required:"Kailangan itong sagutin.",send:"Ipadala",step:"{n} sa {total}",tasks:"Mga gawain",thanks:"Salamat."},fr:{close:"Fermer",done:"Termin\xE9",next:"Suivant",open:"Ouvrir",poweredBy:"Propuls\xE9 par Prodantix",required:"Cette question demande une r\xE9ponse.",send:"Envoyer",step:"{n} sur {total}",tasks:"T\xE2ches",thanks:"Merci."},hi:{close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",done:"\u092A\u0942\u0930\u093E",next:"\u0905\u0917\u0932\u093E",open:"\u0916\u094B\u0932\u0947\u0902",poweredBy:"Prodantix \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",required:"\u0907\u0938\u0915\u093E \u091C\u0935\u093E\u092C \u091A\u093E\u0939\u093F\u090F\u0964",send:"\u092D\u0947\u091C\u0947\u0902",step:"{total} \u092E\u0947\u0902 \u0938\u0947 {n}",tasks:"\u0915\u093E\u092E",thanks:"\u0927\u0928\u094D\u092F\u0935\u093E\u0926\u0964"},id:{close:"Tutup",done:"Selesai",next:"Berikutnya",open:"Buka",poweredBy:"Didukung oleh Prodantix",required:"Pertanyaan ini perlu dijawab.",send:"Kirim",step:"{n} dari {total}",tasks:"Tugas",thanks:"Terima kasih."},ja:{close:"\u9589\u3058\u308B",done:"\u5B8C\u4E86",next:"\u6B21\u3078",open:"\u958B\u304F",poweredBy:"Powered by Prodantix",required:"\u3053\u306E\u8CEA\u554F\u306B\u306F\u56DE\u7B54\u304C\u5FC5\u8981\u3067\u3059\u3002",send:"\u9001\u4FE1",step:"{n} / {total}",tasks:"\u30BF\u30B9\u30AF",thanks:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3057\u305F\u3002"},ko:{close:"\uB2EB\uAE30",done:"\uC644\uB8CC",next:"\uB2E4\uC74C",open:"\uC5F4\uAE30",poweredBy:"Prodantix \uC81C\uACF5",required:"\uC774 \uC9C8\uBB38\uC5D0 \uB2F5\uD574 \uC8FC\uC138\uC694.",send:"\uBCF4\uB0B4\uAE30",step:"{n} / {total}",tasks:"\uC791\uC5C5",thanks:"\uAC10\uC0AC\uD569\uB2C8\uB2E4."},pt:{close:"Fechar",done:"Concluir",next:"Avan\xE7ar",open:"Abrir",poweredBy:"Com tecnologia Prodantix",required:"Esta precisa de uma resposta.",send:"Enviar",step:"{n} de {total}",tasks:"Tarefas",thanks:"Obrigado."},ru:{close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",done:"\u0413\u043E\u0442\u043E\u0432\u043E",next:"\u0414\u0430\u043B\u0435\u0435",open:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Prodantix",required:"\u0417\u0434\u0435\u0441\u044C \u043D\u0443\u0436\u0435\u043D \u043E\u0442\u0432\u0435\u0442.",send:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",step:"{n} \u0438\u0437 {total}",tasks:"\u0417\u0430\u0434\u0430\u0447\u0438",thanks:"\u0421\u043F\u0430\u0441\u0438\u0431\u043E."},sw:{close:"Funga",done:"Imekamilika",next:"Endelea",open:"Fungua",poweredBy:"Inaendeshwa na Prodantix",required:"Hili linahitaji jibu.",send:"Tuma",step:"{n} kati ya {total}",tasks:"Kazi",thanks:"Asante."},vi:{close:"\u0110\xF3ng",done:"Xong",next:"Ti\u1EBFp",open:"M\u1EDF",poweredBy:"Cung c\u1EA5p b\u1EDFi Prodantix",required:"C\xE2u n\xE0y c\u1EA7n \u0111\u01B0\u1EE3c tr\u1EA3 l\u1EDDi.",send:"G\u1EEDi",step:"{n} tr\xEAn {total}",tasks:"Vi\u1EC7c",thanks:"C\u1EA3m \u01A1n b\u1EA1n."},zh:{close:"\u5173\u95ED",done:"\u5B8C\u6210",next:"\u4E0B\u4E00\u6B65",open:"\u6253\u5F00",poweredBy:"\u7531 Prodantix \u63D0\u4F9B\u652F\u6301",required:"\u6B64\u9898\u9700\u8981\u56DE\u7B54\u3002",send:"\u53D1\u9001",step:"{n} / {total}",tasks:"\u4EFB\u52A1",thanks:"\u8C22\u8C22\u3002"}};var q=[':host{all:initial;--pdx-accent:#4f46e5;--pdx-ink:#1d1d1f;--pdx-ink-2:#5f6368;--pdx-paper:#fff;--pdx-line:#e3e3e8;font:14px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--pdx-ink)}',"@media (prefers-color-scheme:dark){:host{--pdx-ink:#f2f2f7;--pdx-ink-2:#a1a1aa;--pdx-paper:#1c1c1f;--pdx-line:#3a3a40}}",".card{position:fixed;z-index:2147483000;bottom:20px;box-sizing:border-box;width:min(340px,calc(100vw - 32px));padding:16px;background:var(--pdx-paper);border:1px solid var(--pdx-line);border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,.18)}",'.card[data-placement="bottom_right"]{right:20px}.card[data-placement="bottom_left"]{left:20px}.card[data-placement="bottom_center"]{left:50%;transform:translateX(-50%)}',".close{position:absolute;top:6px;right:6px;display:grid;place-items:center;width:44px;height:44px;padding:0;font:inherit;font-size:20px;color:var(--pdx-ink-2);cursor:pointer;background:none;border:0;border-radius:8px}",".close:focus-visible,.point:focus-visible,.primary:focus-visible,.choice input:focus-visible,.text:focus-visible,.beacon:focus-visible,.pill:focus-visible{outline:2px solid var(--pdx-accent);outline-offset:2px}",".prompt{margin:0 40px 8px 0;font-size:15px;font-weight:600}.description{margin:0 0 10px;color:var(--pdx-ink-2)}",".scale{display:flex;flex-wrap:wrap;gap:4px}.point{flex:1;min-width:28px;min-height:44px;padding:0;font:inherit;color:var(--pdx-ink);cursor:pointer;background:none;border:1px solid var(--pdx-line);border-radius:8px}",'.point[aria-pressed="true"]{color:#fff;background:var(--pdx-accent);border-color:var(--pdx-accent)}',".ends{display:flex;justify-content:space-between;margin-top:4px;font-size:12px;color:var(--pdx-ink-2)}",".choices{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;border:0}.hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}",".choice{display:flex;gap:8px;align-items:center;min-height:44px;padding:0 10px;cursor:pointer;border:1px solid var(--pdx-line);border-radius:8px}.choice input{accent-color:var(--pdx-accent)}",".text{box-sizing:border-box;width:100%;padding:8px;font:inherit;color:var(--pdx-ink);background:var(--pdx-paper);border:1px solid var(--pdx-line);border-radius:8px;resize:vertical}",".problem{margin:6px 0 0;font-size:12.5px;color:#c5221f}.problem:empty{display:none}",".foot{display:flex;gap:10px;align-items:center;justify-content:space-between;margin-top:12px}.step{font-size:12px;color:var(--pdx-ink-2)}",".primary{display:inline-grid;place-items:center;min-height:44px;padding:0 16px;font:inherit;font-weight:600;color:#fff;text-decoration:none;cursor:pointer;background:var(--pdx-accent);border:0;border-radius:8px}",".secondary{min-height:44px;padding:0 12px;font:inherit;color:var(--pdx-ink-2);cursor:pointer;background:none;border:0;border-radius:8px}",".powered{margin:10px 0 0;font-size:11px;color:var(--pdx-ink-2);text-align:center}.thanks{margin:8px 40px 4px 0;font-weight:600}",".tour{position:absolute;z-index:2147483000;box-sizing:border-box;width:min(300px,calc(100vw - 32px));padding:16px;background:var(--pdx-paper);border:1px solid var(--pdx-line);border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,.18)}",".tour[data-centred]{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}",".tour img{display:block;width:100%;height:auto;margin-bottom:10px;border-radius:8px}.title{margin:0 40px 6px 0;font-size:15px;font-weight:600}.body{margin:0;color:var(--pdx-ink-2)}",".arrow{position:absolute;width:12px;height:12px;background:var(--pdx-paper);border:1px solid var(--pdx-line);transform:rotate(45deg)}",'.tour[data-side="bottom"] .arrow{top:-7px;border-right:0;border-bottom:0}.tour[data-side="top"] .arrow{bottom:-7px;border-top:0;border-left:0}',".beacon{position:absolute;z-index:2147483000;width:44px;height:44px;padding:0;cursor:pointer;background:none;border:0;transform:translate(-50%,-50%)}",'.beacon::before,.beacon::after{position:absolute;top:50%;left:50%;width:14px;height:14px;content:"";border-radius:50%;transform:translate(-50%,-50%)}',".beacon::before{background:var(--pdx-accent)}.beacon::after{border:2px solid var(--pdx-accent);animation:pdx-pulse 1.6s ease-out infinite}","@keyframes pdx-pulse{from{opacity:.8;transform:translate(-50%,-50%) scale(1)}to{opacity:0;transform:translate(-50%,-50%) scale(2.6)}}","@media (prefers-reduced-motion:reduce){.beacon::after{animation:none}}",'.launcher{position:fixed;z-index:2147483000;bottom:20px;display:flex;flex-direction:column;gap:10px}.launcher[data-side="bottom_right"]{right:20px;align-items:flex-end}.launcher[data-side="bottom_left"]{left:20px;align-items:flex-start}',".pill{display:inline-flex;gap:8px;align-items:center;min-height:44px;padding:0 16px 0 8px;font:inherit;font-weight:600;color:#fff;cursor:pointer;background:var(--pdx-accent);border:0;border-radius:999px;box-shadow:0 8px 20px rgba(0,0,0,.18)}",".ring{width:28px;height:28px;transform:rotate(-90deg)}.ring circle{fill:none;stroke-width:3}.ring .track{stroke:rgba(255,255,255,.35)}.ring .done{stroke:#fff}",".list{box-sizing:border-box;width:min(320px,calc(100vw - 32px));padding:14px;background:var(--pdx-paper);border:1px solid var(--pdx-line);border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,.18)}",".list h2{margin:0 0 8px;font-size:15px}.list ol{display:flex;flex-direction:column;gap:4px;margin:0;padding:0;list-style:none}",".task{display:flex;gap:10px;align-items:center;min-height:44px}.task a{color:var(--pdx-ink)}.mark{flex:none;width:18px;height:18px;box-sizing:border-box;border:2px solid var(--pdx-line);border-radius:50%}",".task[data-done] .mark{background:var(--pdx-accent);border-color:var(--pdx-accent)}.task[data-done] span,.task[data-done] a{color:var(--pdx-ink-2);text-decoration:line-through}"].join("");var j=/^#[0-9a-fA-F]{6}$/,G=12,M=2*Math.PI*11;function i(e,t,r,n){let o=e.createElement(t);return r&&(o.className=r),n!==void 0&&(o.textContent=n),o}function L(e,t){if(t.anchor){let r=e.querySelector(`[data-prodantix-anchor="${t.anchor.replace(/["\\]/g,"\\$&")}"]`);if(r)return r}if(!t.selector)return null;try{return e.querySelector(t.selector)}catch(r){return null}}var B=e=>e.placement==="center"||!e.anchor&&!e.selector;function R(e,t,r,n){return e.placement==="top"?"top":e.placement==="bottom"||r-t.bottom>=n+G||t.top<n+G?"bottom":"top"}function P(e,t){let r=i(e,"div");r.dataset.prodantixGuide=t.id;let n=r.attachShadow({mode:"closed"}),o=i(e,"style");o.textContent=q,n.append(o);let a=t.appearance.accent;return a&&j.test(a)&&r.style.setProperty("--pdx-accent",a),e.body.append(r),{host:r,root:n}}function z(e,t,r){let n=i(e,"button","close","\xD7");return n.type="button",n.setAttribute("aria-label",t),n.title=t,n.addEventListener("click",r),n}function D(e,t,r,n){var a,c;let o=i(e,"section","tour");if(o.setAttribute("role","dialog"),o.setAttribute("aria-label",t.title),o.append(z(e,(a=r.close)!=null?a:"",n)),(c=t.image)!=null&&c.startsWith("https://")){let s=i(e,"img");s.src=t.image,s.alt="",o.append(s);}return o.append(i(e,"h2","title",t.title)),t.body&&o.append(i(e,"p","body",t.body)),o}function H(e,t,r,n){let o=e.defaultView;if(!n||!o||B(r)){t.dataset.centred="";return}let a=n.getBoundingClientRect(),c=t.offsetHeight||160,s=t.offsetWidth||300,b=R(r,a,o.innerHeight,c);t.dataset.side=b;let x=b==="bottom"?a.bottom+G:a.top-c-G,d=Math.max(16,Math.min(a.left+a.width/2-s/2,o.innerWidth-s-16));t.style.top=`${x+o.scrollY}px`,t.style.left=`${d+o.scrollX}px`;let l=t.querySelector(".arrow");l&&(l.style.left=`${Math.max(16,Math.min(a.left+a.width/2-d-6,s-28))}px`);}var _=e=>{var t,r,n;return (n=(r=(t=e.defaultView)==null?void 0:t.matchMedia)==null?void 0:r.call(t,"(prefers-reduced-motion: reduce)").matches)!=null?n:false};function N(e,t,r,n){let o=C[r],{host:a,root:c}=P(e,t),s=0,b=false,x=false,d=()=>{x||(x=true,e.removeEventListener("keydown",y),a.remove());},l=()=>{b||n.onDismissed(),d();},y=f=>{f.key==="Escape"&&l();},u=()=>{var S,v,E;for(;s<t.steps.length;){let A=t.steps[s];if(!A)break;let T=B(A)?null:L(e,A);if(B(A)||T)break;n.onMissed(A.id),s+=1;}let f=t.steps[s];if(!f){b=true,n.onCompleted(),d();return}let g=B(f)?null:L(e,f);g&&"scrollIntoView"in g&&g.scrollIntoView({behavior:_(e)?"auto":"smooth",block:"center"});let m=D(e,f,o,l);g&&m.prepend(i(e,"span","arrow"));let h=i(e,"div","foot"),k=t.steps.length;h.append(i(e,"span","step",k>1?o.step.replace("{n}",String(s+1)).replace("{total}",String(k)):""));let w=s===k-1,p=i(e,"button","primary",w?(S=t.appearance.doneLabel)!=null?S:o.done:(v=t.appearance.nextLabel)!=null?v:o.next);p.type="button",p.addEventListener("click",()=>{s+=1,u();}),h.append(p),m.append(h),(E=c.querySelector(".tour"))==null||E.remove(),c.append(m),H(e,m,f,g),n.onStep(f.id),p.focus();};return e.addEventListener("keydown",y),n.onShown(),u(),d}function I(e,t,r,n){var g,m;let o=C[r],a=t.steps[0],c=a?L(e,a):null;if(!a||!c)return a&&n.onMissed(a.id),()=>{};let{host:s,root:b}=P(e,t),x=e.defaultView,d=c.getBoundingClientRect(),l=i(e,"button","beacon");l.type="button",l.setAttribute("aria-label",a.title),l.setAttribute("aria-expanded","false"),l.style.top=`${d.top+((g=x==null?void 0:x.scrollY)!=null?g:0)}px`,l.style.left=`${d.right+((m=x==null?void 0:x.scrollX)!=null?m:0)}px`;let y=false,u=()=>{y||(y=true,s.remove());},f=()=>{n.onCompleted(),u();};return l.addEventListener("click",()=>{var p;if(b.querySelector(".tour"))return;l.setAttribute("aria-expanded","true");let h=D(e,a,o,()=>{n.onDismissed(),u();});h.prepend(i(e,"span","arrow"));let k=i(e,"div","foot");k.append(i(e,"span","step",""));let w=i(e,"button","primary",(p=t.appearance.doneLabel)!=null?p:o.done);w.type="button",w.addEventListener("click",f),k.append(w),h.append(k),b.append(h),H(e,h,a,c),n.onStep(a.id),w.focus();}),b.append(l),n.onShown(),u}function $(e,t,r,n,o){let a=C[r],{host:c,root:s}=P(e,t),b=new Set(n),x=i(e,"div","launcher");x.dataset.side=t.appearance.launcher;let d=i(e,"section","list");d.id="pdx-checklist",d.hidden=true,d.setAttribute("aria-label",t.name);let l=i(e,"h2",void 0,t.name),y=i(e,"ol");d.append(z(e,a.close,()=>{o.onDismissed(),c.remove();}),l,y);let u=i(e,"button","pill");u.type="button",u.setAttribute("aria-controls",d.id),u.setAttribute("aria-expanded","false");let f="http://www.w3.org/2000/svg",g=e.createElementNS(f,"svg");g.setAttribute("class","ring"),g.setAttribute("viewBox","0 0 28 28"),g.setAttribute("aria-hidden","true");let m=e.createElementNS(f,"circle"),h=e.createElementNS(f,"circle");for(let[p,S]of [[m,"track"],[h,"done"]])p.setAttribute("class",S),p.setAttribute("cx","14"),p.setAttribute("cy","14"),p.setAttribute("r","11");g.append(m,h);let k=i(e,"span");u.append(g,k);let w=()=>{let p=t.steps.length,S=t.steps.filter(v=>b.has(v.id)).length;h.setAttribute("stroke-dasharray",`${M*S/Math.max(p,1)} ${M}`),k.textContent=`${S}/${p}`,u.setAttribute("aria-label",`${t.name}: ${a.step.replace("{n}",String(S)).replace("{total}",String(p))}`),y.replaceChildren(...t.steps.map(v=>{var A;let E=i(e,"li","task");if(b.has(v.id)&&(E.dataset.done=""),E.append(i(e,"span","mark")),(A=v.link)!=null&&A.startsWith("https://")){let T=i(e,"a",void 0,v.title);T.href=v.link,E.append(T);}else E.append(i(e,"span",void 0,v.title));return E}));};return u.addEventListener("click",()=>{d.hidden=!d.hidden,u.setAttribute("aria-expanded",String(!d.hidden));}),x.append(d,u),s.append(x),w(),o.onShown(),{close:()=>c.remove(),markDone:p=>{b.add(p),w();}}}window.prodantixGuides={showChecklist:$,showTooltip:I,showTour:N};
|
|
2
|
+
})();//# sourceMappingURL=guides.iife.js.map
|
|
3
|
+
//# sourceMappingURL=guides.iife.js.map
|