@prodantix/sdk 0.7.0-beta.441 → 0.7.0-beta.468

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/web.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var yr=Object.defineProperty;var vr=(t,e,n)=>e in t?yr(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var d=(t,e,n)=>vr(t,typeof e!="symbol"?e+"":e,n);var D=class extends Error{constructor(n,r,i){super(r,i);d(this,"code");this.code=n,this.name="ProdantixError";}},X=class extends D{constructor(e){super("config",e),this.name="ConfigError";}},z=class extends D{constructor(n,r){super("validation",r);d(this,"field");this.field=n,this.name="ValidationError";}},g=class extends D{constructor(n,r,i){super("transport",n,i);d(this,"status");this.status=r,this.name="TransportError";}};function _(t){if(t)return t;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function F(){let t=globalThis.AbortController;return t?new t:void 0}var At=t=>new Promise(e=>{setTimeout(e,t);});function T(t){return t.replace(/\/+$/,"")}var j=class{constructor(){d(this,"store",new Map);}getItem(e){return this.store.get(e)??null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}},Z=class{constructor(e,n=()=>false){this.real=e;this.passes=n;d(this,"held",new j);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 Pt(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch{return new j}return new j}var oe={now:()=>new Date};function ae(t){return t.toISOString()}function _t(){if(typeof window>"u"||typeof Intl>"u")return null;let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof t=="string"&&t!==""?t:null}function br(){return globalThis.crypto}function kr(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 je(){let t=br();if(t?.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t?.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return kr(e)}var Ft={uuid:je};var xr=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Sr=/^(?:\$|[a-z])[a-z0-9_.]*$/;function de(t){let e=0;for(let n of t)e+=1;return e}function Lt(t){return xr.test(t)}function Er(t){return Sr.test(t)}function $t(t){let e=de(t);if(e<1||e>200)throw new z("distinct_id","distinct_id must be between 1 and 200 characters")}function Nt(t){let e=de(t);if(e<1||e>200)throw new z("event_name","event_name must be between 1 and 200 characters");if(!Er(t))throw new z("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Rt="prodantix-js",Ot="0.7.0";var wr=t=>{};function Mt(t){if(!t.apiKey||!Lt(t.apiKey))throw new X("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!t.host)throw new X("host is required (the ingest base URL)");let e=T(t.host),n=t.defaultProperties,r=t.storage??new j;return {apiKey:t.apiKey,autocapture:t.autocapture??false,clock:t.clock??oe,consent:t.consent,consentMode:t.consentMode,defaultProperties:typeof n=="function"?n:()=>n??{},describeElement:t.describeElement,flagsHost:t.flagsHost?T(t.flagsHost):e,flushAt:t.flushAt??20,flushIntervalMs:t.flushIntervalMs??1e4,host:e,ids:t.ids??Ft,locale:t.locale,maxQueueSize:t.maxQueueSize??1e3,maxRetries:t.maxRetries??3,namespace:ee(t.apiKey),onError:t.onError??wr,os:t.os,requestTimeoutMs:t.requestTimeoutMs??1e4,sdkName:t.sdkName??Rt,sdkVersion:t.sdkVersion??Ot,sessionTracking:t.sessionTracking??false,sharedStorage:t.sharedStorage??r,socketFactory:t.socketFactory,storage:r,streamFlags:t.streamFlags??false,transport:t.transport}}function ee(t){return t.slice(0,16)}var Dt="$cta_viewed",qt="$cta_clicked",Ve="$cta_dismissed",Kt=(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},le=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async ctas(e){let n=this.fetch;if(!n)throw new g("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=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(o.status<200||o.status>=300)throw new g(`ctas request failed with status ${o.status}`,o.status);return JSON.parse(await o.text()).ctas}finally{s!==void 0&&clearTimeout(s);}}};function Bt(t,e,n){Nt(t.eventName),$t(t.distinctId);let r={distinct_id:t.distinctId,event_id:t.eventId??n.uuid(),event_name:t.eventName,properties:t.properties??{},schema_version:1,timestamp:ae(t.timestamp??e.now())};return t.context&&(r.context=t.context),t.sessionId&&(r.session_id=t.sessionId),r}var U=Symbol("absent");function Cr(t,e){if(t==="distinct_id")return e.distinctId;let n=e.properties??{};if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let r=e.attributes??{};return Object.prototype.hasOwnProperty.call(r,t)?r[t]:U}function V(t){return t===U?"undefined":String(t)}function Ht(t){return t===U?Number.NaN:Number(t)}function Gt(t){return t!==U&&t!==null&&t!==""}function jt(t,e){if(!Array.isArray(e))return false;let n=V(t);return e.map(r=>String(r)).includes(n)}function Vt(t,e){let n=Cr(t.attribute,e),r=t.value;switch(t.op){case "is_set":return Gt(n);case "is_not_set":return !Gt(n);case "eq":return V(n)===V(r===void 0?U:r);case "neq":return V(n)!==V(r===void 0?U:r);case "contains":return V(n).includes(V(r===void 0?U:r));case "in":return jt(n,r);case "not_in":return Array.isArray(r)?!jt(n,r):false;case "gt":return ce(n,r,(i,s)=>i>s);case "gte":return ce(n,r,(i,s)=>i>=s);case "lt":return ce(n,r,(i,s)=>i<s);case "lte":return ce(n,r,(i,s)=>i<=s);case "in_cohort":return typeof r=="string"&&r!==""&&(e.cohorts??[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!(e.cohorts??[]).includes(r);default:return false}}function ce(t,e,n){let r=Ht(t),i=e===void 0?Number.NaN:Ht(e);return Number.isNaN(r)||Number.isNaN(i)?false:n(r,i)}function Ut(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 Ue(t,e){return t.targeting.length===0||t.targeting.every(n=>Vt(n,e))}function zt(t,e){let n=Ut(t.key,e.distinctId),r=t.variations??[];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 ze(t,e,n,r){for(let i of t.prerequisites??[]){if(r.includes(i.flagKey))return false;let s=e.find(a=>a.key===i.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let o=ze(s,e,n,r)&&Ue(s,n)&&zt(s,n)===i.variationKey;if(r.pop(),!o)return false}return true}function ue(t,e,n){return t.enabled?ze(t,e,n,[t.key])?Ue(t,n)?t.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:Ut(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 Wt(t,e){let n={};for(let r of t)n[r.key]=ue(r,t,e).enabled;return n}function We(t,e,n){let r=t.variations??[],i=r[0];if(!i)return null;if(!t.enabled||!ze(t,e,n,[t.key])||!Ue(t,n))return i;let s=zt(t,n);return r.find(o=>o.key===s)??i}function Jt(t){return t.some(e=>e.targeting.some(n=>n.op==="in_cohort"||n.op==="not_in_cohort"))}function Yt(t){return `40${JSON.stringify(t)}`}function Qt(){return "3"}function Xt(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 o=Je(n);return {kind:"open",pingInterval:typeof o?.pingInterval=="number"?o.pingInterval:25e3,pingTimeout:typeof o?.pingTimeout=="number"?o.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 o=Je(i);return {kind:"connectError",message:typeof o?.message=="string"?o.message:"refused"}}if(r!=="2")return {kind:"other"};let s=Je(i);return !Array.isArray(s)||typeof s[0]!="string"?{kind:"other"}:{kind:"event",name:s[0],payload:s[1]}}function Je(t){try{return JSON.parse(t)}catch{return null}}var Tr="/socket.io/?EIO=4&transport=websocket",Ir=250,pe=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");this.factory=e.socketFactory??Ar,this.setTimer=e.setTimer??((n,r)=>setTimeout(n,r)),this.clearTimer=e.clearTimer??(n=>clearTimeout(n));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Tr}`,n;try{n=this.factory(e);}catch{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?.close();}receive(e){let n=Xt(e);if(n.kind==="open"){this.armHeartbeat(n.pingInterval+n.pingTimeout),this.socket?.send(Yt({projectKey:this.options.projectKey}));return}if(n.kind==="ping"){this.armHeartbeat(),this.socket?.send(Qt());return}if(n.kind==="connectError"||n.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(n.kind==="event"){if(n.name==="ready"){this.ready=true;return}if(n.name==="flagChange"){let r=n.payload?.key;this.lastKey=typeof r=="string"?r:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Ir));}}}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(()=>this.socket?.close(),this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Ar(t){let e=globalThis.WebSocket;if(!e)throw new g("no WebSocket");return new e(t)}var me=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){let n=this.fetch;if(!n)throw new g("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new g(`flags request failed with status ${o.status}`,o.status);let a=JSON.parse(await o.text());return {flags:a.flags??{},variants:a.variants??{}}}finally{s!==void 0&&clearTimeout(s);}}async snapshot(){let e=this.fetch;if(!e)throw new g("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/snapshot`,r=F(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!s.ok)throw new g(`flag snapshot request failed with status ${s.status}`,s.status);let o=JSON.parse(await s.text()),a={flags:o.flags??[],generatedAt:o.generatedAt};return typeof o.socketUrl=="string"&&o.socketUrl!==""&&(a.socketUrl=o.socketUrl),a}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){let n=this.fetch;if(!n)throw new g("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new g(`memberships request failed with status ${o.status}`,o.status);return JSON.parse(await o.text()).cohorts??[]}finally{s!==void 0&&clearTimeout(s);}}};var Zt="$form_viewed",en="$form_started",te=class extends Error{constructor(n,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=n,this.fields=r;}},ge=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async request(e,n){let r=this.fetch;if(!r)throw new g("no fetch implementation available in this runtime");let i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(o["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:o,method:n.method,signal:i?.signal});return {status:a.status,text:await a.text()}}finally{s!==void 0&&clearTimeout(s);}}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 g(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,n){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 s=[],o=`form submission failed with status ${r}`;try{let a=JSON.parse(i);s=a.error?.fields??[],o=a.error?.message??o;}catch{s=[];}throw new te(r,s,o)}};var tn="$survey_shown",nn="$survey_dismissed",rn="$survey_sent",fe=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async surveys(e,n){let r=this.fetch;if(!r)throw new g("no fetch implementation available in this runtime");let i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${n?`&lang=${encodeURIComponent(n)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new g(`surveys request failed with status ${o.status}`,o.status);return JSON.parse(await o.text()).surveys??[]}finally{s!==void 0&&clearTimeout(s);}}},Pr=864e5,he=t=>`${t.id}:${t.iteration}`;function Ye(t,e){return t.length===0?true:t.some(n=>{switch(n.matches){case "exact":return e===n.value;case "starts_with":return e.startsWith(n.value);default:return e.includes(n.value)}})}function sn(t,e,n,r,i){return t.kind!=="popover"||e.settled.includes(he(t))||t.showOnce&&e.settled.some(s=>s.startsWith(`${t.id}:`))||t.waitDays>0&&e.lastShownAt!==void 0&&r-e.lastShownAt<t.waitDays*Pr||t.event&&t.event!==i?false:Ye(t.urls,n)}function ye(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 Qe="$guide_shown",on="$guide_step_viewed",an="$guide_step_missed",Xe="$guide_completed",Ze="$guide_dismissed",dn="$checklist_task_done",ve=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async guides(e){let n=this.fetch;if(!n)throw new g("no fetch implementation available in this runtime");let r=F(),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?.signal});if(!s.ok)throw new g(`guides request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).guides??[]}finally{i!==void 0&&clearTimeout(i);}}},_r=864e5,W=t=>`${t.id}:${t.iteration}`,be=(t,e)=>`${W(t)}:${e}`;function ln(t,e,n,r,i){return e.settled.includes(W(t))||t.showOnce&&e.settled.some(s=>s.startsWith(`${t.id}:`))||t.kind!=="checklist"&&t.waitDays>0&&e.lastShownAt!==void 0&&r-e.lastShownAt<t.waitDays*_r||t.event&&t.event!==i?false:Ye(t.urls,n)}var et=(t,e)=>t.steps.filter(n=>e.done.includes(be(t,n.id))).map(n=>n.id),cn=(t,e)=>t.kind==="checklist"?t.steps.find(n=>n.event===e):void 0;function un(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 ne(t){if(typeof t!="string")return;let e=Array.from(t).length;return e>=1&&e<=200?t:void 0}function xe(t,e){return `pdx.${t}.${e}`}var nt="consent",Fr=["identityLink","analytics","marketing","functional"];function tt(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 Fr){let s=n[i];typeof s=="boolean"&&(r[i]=s);}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{return null}}var pn=t=>t.endsWith(`.${nt}`);function Se(t,e){return tt(t.getItem(xe(e,nt)))}function Lr(t,e,n){let r=xe(e,nt),i=tt(JSON.stringify(n)),s=i===null?null:tt(JSON.stringify({...Se(t,e)??{},...i}));if(s===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(s));}function mn(t,e,n,r){let i=xe(n,"anonymous_id"),s=ne(e.getItem(i))??ne(t.getItem(i));return e.setItem(i,r),t.setItem(i,r),s!==void 0&&s!==r?s:void 0}var ke=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=ne(this.shared.getItem(this.key("anonymous_id"))),n=ne(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=ne(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 Se(this.shared,this.namespace)}setConsent(e){Lr(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){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||this.consent()?.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 xe(this.namespace,e)}};var Ee=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async inbox(e){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 g(`inbox request failed with status ${i.status}`,i.status);return JSON.parse(await i.text()).messages??[]}async markRead(e,n){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,s=await this.request(r,i,{body:JSON.stringify({distinct_id:n,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!s.ok)throw new g(`mark-read request failed with status ${s.status}`,s.status)}requireFetch(){if(!this.fetch)throw new g("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,n,r){let i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n,{...r,signal:i?.signal})}finally{s!==void 0&&clearTimeout(s);}}};var we=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(){if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);this.onOverflow?.({dropped:e});}};var $r={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function gn(t){return `pdx.${t}.session`}function fn(t,e,n,r){let i={id:n.id,lastActivityAt:r,startedAt:n.startedAt};t.setItem(gn(e),JSON.stringify(i));}var Ce=class{constructor(e,n,r,i,s=$r){this.storage=e;this.ids=n;this.clock=r;this.namespace=i;this.options=s;}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{return}}key(){return gn(this.namespace)}};var w={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageview:"$pageview",set:"$set"};function hn(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");this.fetch=_(e.fetch),this.maxRetries=e.maxRetries??3,this.requestTimeoutMs=e.requestTimeoutMs??1e4,this.baseDelayMs=e.baseDelayMs??500,this.maxDelayMs=e.maxDelayMs??3e4,this.sleep=e.sleep??At,this.random=e.random??Math.random;}async send(e){let n=this.fetch;if(!n)throw new g("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let s=0;s<=this.maxRetries;s+=1){try{let o=await this.attempt(n,e,r);if(o.ok)return;if(hn(o.status))throw new g(`ingest rejected batch with status ${o.status}`,o.status);i=new g(`ingest transient status ${o.status}`,o.status);}catch(o){if(o instanceof g&&o.status!==void 0&&hn(o.status))throw o;i=o;}s<this.maxRetries&&await this.sleep(this.backoff(s));}throw new g("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,n,r){let i=F(),s=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?.signal})}finally{s!==void 0&&clearTimeout(s);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var Nr="queue",Rr=1e3,yn=3e4,rt=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},Te=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);let n=Mt(e),r=Se(n.sharedStorage,n.namespace)??n.consent??null;if(this.gates=[new Z(n.storage),new Z(n.sharedStorage,pn)],n.consentMode!=="banner"||r?.analytics===true)for(let o of this.gates)o.open();let[i,s]=this.gates;this.config={...n,sharedStorage:s,storage:i},this.identity=new ke(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 we(this.config.maxQueueSize,({dropped:o})=>{this.config.onError(new D("queue_overflow",`event queue overflow: dropped ${o.length} oldest event(s)`));}),this.transport=this.config.transport??new J({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new me({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new Ee({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new fe({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new ve({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new ge({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new le({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(){return this.session?.current()}get sessionStartedAt(){return this.session?.startedAt()}capture(e,n={}){try{this.identity.refresh();let r={...this.config.defaultProperties(),...n.element===void 0?{}:this.config.describeElement?.(n.element)??{},...n.properties??{}},i=Bt({context:this.context,distinctId:n.distinctId??this.identity.getDistinctId(),eventName:e,properties:r,sessionId:n.sessionId??this.session?.current(),timestamp:n.timestamp},this.config.clock,this.config.ids);this.enqueue(i);}catch(r){this.config.onError(r);}for(let r of this.captureListeners)try{r(e);}catch(i){this.config.onError(i);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,n={}){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 s=_t(),o={...s===null?{}:{$timezone:s},...rt(n.traits??{}),...n.set??{}};Object.keys(o).length>0&&(i.$set=o),this.capture(w.identify,{properties:i});}link(e,n,r){if(this.isCookieless())return;let i={$anon_distinct_id:n},s=rt(r??{});Object.keys(s).length>0&&(i.$set=s),this.capture(w.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(w.createAlias,{properties:{alias:e}});}group(e,n,r){let i={$group_key:n,$group_type:e};r&&(i.$set=r),this.capture(w.group,{properties:i});}setPersonProperties(e,n){if(this.isCookieless())return;let r={};e&&(r.$set=e),n&&(r.$set_once=n),this.capture(w.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let n=rt(e);Object.keys(n).length!==0&&this.capture(w.set,{properties:{$set:n}});}async getAllFlags(){let e=this.identity.getDistinctId(),n=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:n.flags,variants:n.variants??{}},n.flags}async isFeatureEnabled(e){let r=(await this.getAllFlags())[e]??false;return this.recordExposure(e,this.cachedFlags?.variants[e]?.key??String(r)),r}async getVariant(e){let n=await this.getAllFlags(),r=this.cachedFlags?.variants[e]??null;return this.recordExposure(e,r?.key??String(n[e]??false)),r}async getVariantLocal(e,n={}){let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),s=await this.localContext(n,r.flags),o=i?We(i,r.flags,s):null,a=i?ue(i,r.flags,s).enabled:false;return this.recordExposure(e,o?.key??String(a)),o?{key:o.key,value:o.value}:null}recordExposure(e,n){let r=`${this.identity.getDistinctId()} ${e} ${n}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(w.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 Wt(n.flags,await this.localContext(e,n.flags))}async isFeatureEnabledLocal(e,n={}){let r=await this.flagSnapshot(),i=r.flags.find(a=>a.key===e),s=await this.localContext(n,r.flags),o=i?ue(i,r.flags,s).enabled:false;return this.recordExposure(e,(i?We(i,r.flags,s)?.key:void 0)??String(o)),o}async localContext(e,n){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&Jt(n)){let s=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&s-this.membershipCache.fetchedAt<yn?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:s});}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<yn)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 pe({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??this.config.locale)}captureSurveyShown(e){this.capture(tn,{properties:ye(e,{})});}captureSurveyDismissed(e){this.capture(nn,{properties:ye(e,{})});}captureSurveySent(e,n){this.capture(rn,{properties:ye(e,n)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,n,r){this.capture(e,{properties:un(n,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,n,r,i){let{$page_id:s,$page_variant:o}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:n,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window>"u"?"":window.location.href,solution:i,...typeof s=="string"&&typeof o=="string"?{pageId:s,pageVariant:o}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,n,r){this.capture(e,{properties:Kt(n,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(Rr);try{await this.transport.send({body:{events:e,sent_at:ae(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(){this.session?.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){this.shutDown=true,this.stopTimer(),this.stream?.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}.${Nr}`}};var bn="data-prodantix",kn="data-prodantix-action",xn="data-prodantix-ignore",Y=300,it="data-pdx-no-capture",st="pdx-no-capture",Or=new Set(["a","button","input","label","option","select","summary","textarea"]),Mr=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]);function Dr(t){return Or.has(t.tagName.toLowerCase())||Mr.has((t.getAttribute("role")??"").trim().toLowerCase())}function ot(t){for(let e=t;e!==null;e=e.parentElement)if(Dr(e))return e;return t}function at(t){for(let e=t;e!==null;e=e.parentElement)if(e.getAttribute(xn)!==null)return true;return false}function dt(t){for(let e=t;e!==null;e=e.parentElement)if(e.getAttribute(it)!==null||typeof e.className=="string"&&e.className.split(/\s+/).includes(st))return true;return false}function Ie(t){let e=new Set;return n=>{e.has(n.message)||(e.add(n.message),t(n));}}function vn(t,e,n){let r=t.getAttribute(e);if(r===null)return;let i=r.trim();if(i!==""){if(i.length>Y){n(new D("validation",`${e} on a <${t.tagName.toLowerCase()}> is ${i.length} characters, over the ${Y}-character limit, so it was ignored: "${i.slice(0,40)}\u2026"`));return}return i}}function lt(t,e){let n={},r=vn(t,bn,e);r!==void 0&&(n.$el_description=r,n.$el_description_source="annotation");let i=vn(t,kn,e);return i!==void 0&&(n.$el_action=i),n}function Sn(t,e){return !qr(t)||at(t)||dt(t)?{}:lt(ot(t),e)}function qr(t){return typeof t=="object"&&t!==null&&typeof t.tagName=="string"&&typeof t.getAttribute=="function"}var Kr="$form_submitted",Br=new Set(["button","file","hidden","image","password","reset","submit"]),En=/(card|cc-?num|cvc|cvv|iban|security.?code)/i,Hr=t=>(t.getAttribute("autocomplete")??"").startsWith("cc-")||En.test(t.name)||En.test(t.id),Gr=t=>{let e=t.name.toLowerCase();return t instanceof HTMLInputElement&&t.type==="email"||e==="email"||t.getAttribute("autocomplete")==="email"?"$email":e==="name"||e==="full_name"||e==="fullname"||t.getAttribute("autocomplete")==="name"?"$name":null},jr=(t,e)=>{if(t.closest("[data-prodantix-ignore]")||t.hasAttribute("data-prodantix-form"))return null;let n={},r={};for(let i of Array.from(t.elements)){if(!(i instanceof HTMLInputElement||i instanceof HTMLSelectElement||i instanceof HTMLTextAreaElement)||!i.name||i.closest("[data-prodantix-ignore]")||Hr(i)||i instanceof HTMLInputElement&&(Br.has(i.type)||(i.type==="checkbox"||i.type==="radio")&&!i.checked))continue;let s=i.value.trim();if(s==="")continue;n[i.name]=s;let o=Gr(i);o&&(r[o]=s);}return {$answers:n,$form_id:t.id||`${e}#${Array.from(t.ownerDocument.forms).indexOf(t)}`,$page_url:t.ownerDocument.location?.href??"",$set:r,collected:true}},wn=(t,e=document)=>{let n=r=>{if(r.target instanceof HTMLFormElement){let i=jr(r.target,e.location?.pathname??"");i&&t.capture(Kr,{properties:i});}};return e.addEventListener("submit",n,true),()=>e.removeEventListener("submit",n,true)};var Vr=new Set(["input","select","textarea"]),Ur=new Set(["email","password","tel"]);function Pe(){return globalThis.location}function Cn(){return globalThis.document}function zr(){return globalThis.window??globalThis}function Wr(t){return typeof t=="object"&&t!==null&&typeof t.tagName=="string"}function Ae(t,e){let n;try{n=new URL(t,e);}catch{return}return n.protocol==="http:"||n.protocol==="https:"?`${n.origin}${n.pathname}`:n.protocol}function Tn(){let t=Pe(),e=Cn(),n={};if(t){let r=Ae(t.href);r&&(n.$current_url=r),n.$pathname=t.pathname,n.$host=t.host;}if(e){e.title&&(n.$title=e.title);let r=e.referrer?Ae(e.referrer):void 0;r&&(n.$referrer=r);}return n}function Jr(t){return typeof t.className=="string"?t.className:""}function Yr(t){return Vr.has(t.tagName.toLowerCase())||Ur.has((t.getAttribute("type")??"").toLowerCase())}function Qr(t,e,n){let r={$el_tag:t.tagName.toLowerCase(),$event_type:"click"};if(e)return r;let i=n?t.textContent?.trim():void 0;i&&(r.$el_text=i.slice(0,255)),t.id&&(r.$el_id=t.id);let s=Jr(t);s&&(r.$el_classes=s);let o=t.getAttribute("href"),a=o?Ae(o,Pe()?.href):void 0;return a&&(r.$el_href=a),r}function ct(t){return (t??"").replace(/\s+/g," ").trim()}function re(t,e){return {$el_description:t,$el_description_source:e}}function Xr(t,e,n){if(!e&&n){let o=ct(t.getAttribute("aria-label"));if(o!==""&&o.length<=Y)return re(o,"aria_label");let a=ct(t.textContent);if(a!==""&&a.length<=Y)return re(a,"text")}let r=e?null:t.getAttribute("href"),i=r?Ae(r,Pe()?.href):void 0;if(i)return re(i,"href");let s=ct(t.getAttribute("role")).toLowerCase();return s===""?re(t.tagName.toLowerCase(),"tag"):re(s,"role")}function Zr(t,e){let n=new Set,r=(l,c)=>{if(n.has(l))return false;try{return c()}catch(p){return n.add(l),e(new D("config",`autocapture maskSelectors entry "${l}" is not a valid selector`,{cause:p})),false}},i=(l,c)=>l.matches?r(c,()=>l.matches?.(c)===!0):false,s=l=>{let c=l.querySelector?.bind(l);return c?c(`[${it}], .${st}`)!==null||t.some(p=>r(p,()=>c(p)!==null)):false},o=l=>{for(let c=l;c;c=c.parentElement){let p=c;if(t.some(S=>i(p,S)))return true}return false},a=l=>{for(let c=l;c;c=c.parentElement)if(Yr(c))return true;return false},u=l=>dt(l)||o(l);return {holdsMasked:s,isMasked:l=>u(l)||a(l),isOptedOut:u}}function ei(t){let e=globalThis.history,n=zr(),r="",i=()=>{let a=Pe(),u=a?`${a.pathname}${a.search}`:"";u!==r&&(r=u,t.capture(w.pageview,{properties:Tn()}));};if(i(),!e||!n)return ()=>{};let s=e.pushState.bind(e),o=e.replaceState.bind(e);return e.pushState=(...a)=>{s(...a),i();},e.replaceState=(...a)=>{o(...a),i();},n.addEventListener("popstate",i),()=>{e.pushState=s,e.replaceState=o,n.removeEventListener("popstate",i);}}function ti(t,e){let n=Cn();if(!n)return ()=>{};let r=e.onError??(()=>{}),i=Zr(e.maskSelectors??[],r),s=Ie(r),o=e.captureElementText??false,a=u=>{let l=u.target;if(!Wr(l)||at(l))return;let c=ot(l),p=i.isMasked(l)||i.holdsMasked(c),S=i.isOptedOut(l)?{}:lt(c,s),L=S.$el_description===void 0?Xr(c,p,o):{};t.capture(w.autocapture,{properties:{...Tn(),...Qr(c,p,o),...L,...S}});};return n.addEventListener("click",a,true),()=>n.removeEventListener("click",a,true)}function In(t,e={}){let n=[];return (e.pageviews??true)&&n.push(ei(t)),(e.clicks??true)&&n.push(ti(t,e)),e.collectForms===true&&typeof document<"u"&&n.push(wn(t)),()=>{for(let r of n)r();}}function ni(){return globalThis.document?.visibilityState==="hidden"}function ri(t){let e=globalThis.navigator,n=globalThis.Blob;if(!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{return false}}var _e=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new J(e);}async send(e){ni()&&ri(e)||await this.fetchTransport.send(e);}};var ut="prodantix:consent-ready",pt="prodantix:consent",An="__prodantixConsent";var Pn=(t,e)=>{t.takeCookielessId(e.anonymousId),e.consent!==null?t.setConsent(e.consent):e.rule==="notice"&&t.allowStorage();},_n=(t,e)=>{let n=e[An];n&&Pn(t,n);let r=s=>{let o=s.detail;o&&Pn(t,o);},i=s=>{let o=s.detail;o&&t.setConsent(o);};return e.addEventListener(ut,r),e.addEventListener(pt,i),()=>{e.removeEventListener(ut,r),e.removeEventListener(pt,i);}};var ii=/^\d{1,3}(\.\d{1,3}){3}$/,si=/^[a-z0-9.-]+$/i;function Fn(){return Math.random().toString(36).slice(2,12)}function Fe(t,e){let n=`${e}=`,r=[];for(let i of t.cookie.split(";")){let s=i.trim();s.startsWith(n)&&r.push(s.slice(n.length));}return r}function ie(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function Ln(t,e,n,r){try{let i=`pdx_probe_${r()}`,s=r();t.cookie=`${i}=${s}; ${ie(e,60,n)}`;let o=Fe(t,i).includes(s);t.cookie=`${i}=; ${ie(e,0,n)}`;let a=Fe(t,i).includes(s);return o&&!a}catch{return false}}function gt(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||ii.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 $n(t,e,n,r=Fn){for(let i of gt(t))if(Ln(e,i,n,r))return i}function oi(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 mt=class{constructor(e,n,r,i){this.jar=e;this.name=n;this.domain=r;this.secure=i;}getItem(e){return this.read().get(e)??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=Fe(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${ie(void 0,0,this.secure)}`,e=Fe(this.jar,this.name));let n=e[0];return n?oi(n):new Map}catch{return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${ie(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${ie(this.domain,31536e3,this.secure)}`;}catch{return}}};function ai(){return globalThis.document}function di(){return globalThis.location?.hostname??""}function li(){return globalThis.location?.protocol==="https:"}function ci(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return si.test(e)?e.toLowerCase():void 0}function ft(t){let e="jar"in t?t.jar:ai();if(!e||globalThis.navigator?.cookieEnabled===false)return null;let r=t.random??Fn,i=t.secure??li(),s=t.hostname??di();try{let o=ci(t.domain)??$n(s,e,i,r);return Ln(e,o,i,r)?new mt(e,t.name,o,i):null}catch{return null}}var ui=["am","ar","bn","de","en","es","et","fil","fr","hi","id","ja","ko","pt","ru","sw","vi","zh"],Nn=t=>{let e=(t??"").toLowerCase().split("-")[0]??"";return ui.find(n=>n===e)??"en"};var pi=/^\$(survey|guide|checklist)_/,Rn=()=>({guides:{done:[],settled:[]},surveys:{settled:[]}});function mi(t,e){try{let n=t.getItem(e);if(n===null)return Rn();let r=JSON.parse(n);return {guides:{done:r.guides?.done??[],lastShownAt:r.guides?.lastShownAt,settled:r.guides?.settled??[]},surveys:{lastShownAt:r.surveys?.lastShownAt,settled:r.surveys?.settled??[]}}}catch{return Rn()}}function On(t,e,n){let r=n();return r?Promise.resolve(r):new Promise(i=>{let s=t.document.createElement("script");s.src=e,s.async=true,s.onload=()=>i(n()??null),s.onerror=()=>i(null),t.document.head.append(s);})}function Mn(t,e,n){let r=`pdx_engage_${n.namespace}`,i=mi(n.storage,r),s=()=>{try{n.storage.setItem(r,JSON.stringify(i));}catch(v){n.onError(v);}},o=Nn(e.document.documentElement.lang||e.navigator.language),a=[],u=[],l=false,c=false,p=new Map,S=()=>On(e,`${n.edgeHost}/surveys.js`,()=>e.prodantixSurveys),L=()=>On(e,`${n.edgeHost}/guides.js`,()=>e.prodantixGuides),A=async v=>{if(l)return;let h=a.find(P=>sn(P,i.surveys,e.location.href,Date.now(),v));if(!h)return;l=true;let C=await S();if(!C){l=false;return}let E=()=>{i.surveys.settled=[...i.surveys.settled.filter(P=>P!==he(h)),he(h)],s(),l=false;};C.showSurvey(e.document,h,o,{onDismissed:()=>{t.captureSurveyDismissed(h),E();},onSent:P=>{t.captureSurveySent(h,P),E();},onShown:()=>{i.surveys.lastShownAt=Date.now(),s(),t.captureSurveyShown(h);}});},R=v=>{i.guides.settled=[...i.guides.settled.filter(h=>h!==W(v)),W(v)],s();},M=async v=>{let h=u.filter(y=>!p.has(y.id)&&ln(y,i.guides,e.location.href,Date.now(),v)),C=h.filter(y=>y.kind==="checklist"),E=c?void 0:h.find(y=>y.kind!=="checklist");if(C.length===0&&!E)return;E&&(c=true);let P=await L();if(!P){c=false;return}for(let y of C)p.has(y.id)||p.set(y.id,P.showChecklist(e.document,y,o,et(y,i.guides),{onDismissed:()=>{t.captureGuide(Ze,y),R(y),p.delete(y.id);},onShown:()=>t.captureGuide(Qe,y)}));if(!E)return;(E.kind==="tooltip"?P.showTooltip:P.showTour)(e.document,E,o,{onCompleted:()=>{t.captureGuide(Xe,E),R(E),c=false;},onDismissed:()=>{t.captureGuide(Ze,E),R(E),c=false;},onMissed:y=>t.captureGuide(an,E,y),onShown:()=>{i.guides.lastShownAt=Date.now(),s(),t.captureGuide(Qe,E);},onStep:y=>t.captureGuide(on,E,y)});},N=v=>{for(let h of u){let C=cn(h,v);!C||i.guides.done.includes(be(h,C.id))||i.guides.settled.includes(W(h))||(i.guides.done=[...i.guides.done,be(h,C.id)],t.captureGuide(dn,h,C.id),p.get(h.id)?.markDone(C.id),et(h,i.guides).length===h.steps.length&&(t.captureGuide(Xe,h),R(h),p.get(h.id)?.close(),p.delete(h.id)),s());}},O=v=>{n.surveys&&A(v).catch(n.onError),n.guides&&M(v).catch(n.onError);},G=t.onCapture(v=>{pi.test(v)||(N(v),O(v));}),q=()=>O();e.addEventListener("popstate",q);let B=async()=>{let v=E=>(n.onError(E),[]),[h,C]=await Promise.all([n.surveys?t.getSurveys(e.document.documentElement.lang||e.navigator.language).catch(v):[],n.guides?t.getGuides().catch(v):[]]);a=h,u=C,O();};return e.document.readyState==="loading"?e.document.addEventListener("DOMContentLoaded",()=>void B(),{once:true}):B(),()=>{G(),e.removeEventListener("popstate",q);for(let v of p.values())v.close();p.clear();}}var Kn="_pdx",Bn="~",gi=200,fi=/^\d+$/;function Hn(t,e,n,r){let i=yi(t.href);if(i===void 0||yt(i.search).some(vt))return;let s=Dn(i.hostname,n);s===void 0||s===Dn(r,n)||(i.search=`${i.search}${i.search?"&":"?"}${Kn}=${hi(e)}`,t.href=i.href);}function hi(t){return [t.anonymousId,t.sessionId,String(t.sessionStartedAt)].map(bi).join(Bn)}function Gn(t){let e=yt(t).find(vt);if(e===void 0)return;let n=vi(e).split(Bn);if(n.length!==3)return;let r=Le(n[0]),i=Le(n[1]),s=Le(n[2]);if(!(!qn(r)||!qn(i)||!ki(s)))return {anonymousId:r,sessionId:i,sessionStartedAt:Number(s)}}function jn(t,e){let n=yt(e.search),r=n.filter(s=>!vt(s));if(r.length===n.length)return;let i=r.length>0?`?${r.join("&")}`:"";t.replaceState(t.state,"",`${e.pathname}${i}${e.hash}`);}function Vn(t){if(t.location===void 0||typeof t.location.search!="string")return;let e=Gn(t.location.search);if(e===void 0)return;let n=mn(t.storage,t.shared,t.namespace,e.anonymousId);return fn(t.shared,t.namespace,{id:e.sessionId,startedAt:e.sessionStartedAt},t.now),t.history!==void 0&&jn(t.history,t.location),n}function ht(t,e,n){if(n.length===0)return ()=>{};let r=i=>{let s=Ei(i.target);if(s===void 0)return;let o=xi(e);o!==void 0&&Hn(s,o,n,t.location?.hostname??"");};return t.addEventListener("click",r,true),t.addEventListener("auxclick",r,true),()=>{t.removeEventListener("click",r,true),t.removeEventListener("auxclick",r,true);}}function yi(t){try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"?e:void 0}catch{return}}function Dn(t,e){let n=e.map(r=>r.replace(/^\./,"").toLowerCase());return gt(t).find(r=>n.includes(r))}function yt(t){return t.replace(/^\?/,"").split("&").filter(e=>e!=="")}function vt(t){let e=t.indexOf("=");return Le(e===-1?t:t.slice(0,e))===Kn}function vi(t){let e=t.indexOf("=");return e===-1?"":t.slice(e+1)}function bi(t){return encodeURIComponent(t).replace(/~/g,"%7E")}function Le(t){try{return decodeURIComponent(t)}catch{return}}function qn(t){if(t===void 0)return false;let e=de(t);return e>=1&&e<=gi}function ki(t){return t!==void 0&&fi.test(t)&&Number.isSafeInteger(Number(t))}function xi(t){if(t.consent?.()?.identityLink===false)return;let e=t.sessionId,n=t.sessionStartedAt;if(!(e===void 0||n===void 0))return {anonymousId:t.anonymousId,sessionId:e,sessionStartedAt:n}}function Si(t){return typeof t.tagName=="string"&&t.tagName.toUpperCase()==="A"&&typeof t.href=="string"}function Ei(t){let e=typeof t=="object"?t:null;for(;e;){if(Si(e))return e;e=e.parentElement??null;}}var Un={maskAllInputs:true,maskAllText:false},wi=new Set(["email","password","tel"]);function zn(t){return t.replace(/\S/g,"*")}function $e(t,e,n){return Ci(e)||n.maskAllInputs?zn(t):t}function Ne(t,e){return e.maskAllText?zn(t):t}function Ci(t){return wi.has((t??"").toLowerCase())}var Ti=5e3,Re=class{constructor(e){this.options=e;d(this,"buffer",[]);d(this,"seq",0);d(this,"maxEvents");this.maxEvents=Math.min(Math.max(1,e.maxEvents),Ti);}add(e){return this.buffer.push(e),this.buffer.length>=this.maxEvents?this.flush():null}flush(){if(this.buffer.length===0)return null;let e=this.buffer;this.buffer=[];let n={distinct_id:this.options.distinctId(),events:e,masked:this.options.masked,schema_version:1,seq:this.seq,session_id:this.options.sessionId,timestamp:new Date(this.options.now()).toISOString()};return this.seq+=1,n}};var bt=1,kt=3,Ii=9,Oe=class{constructor(){d(this,"next",1);}allocate(){let e=this.next;return this.next+=1,e}},Ai=new Set(["NOSCRIPT","SCRIPT"]);function Me(t,e,n,r){if(t.nodeType===kt){let i=e.allocate();return r?.(t,i),{id:i,textContent:Ne(t.textValue??"",n),type:"text"}}if(t.nodeType===Ii){let i=e.allocate();return r?.(t,i),{childNodes:Wn(t,e,n,r),id:i,type:"document"}}if(t.nodeType===bt){let i=t.tagName??"";if(Ai.has(i))return null;let s=e.allocate();return r?.(t,s),{attributes:Pi(t,n),childNodes:Wn(t,e,n,r),id:s,tagName:i,type:"element"}}return null}function Wn(t,e,n,r){let i=[];for(let s of t.childNodes??[]){let o=Me(s,e,n,r);o&&i.push(o);}return i}function Pi(t,e){let n={};for(let r of t.attributes??[])n[r.name]=r.value;return t.inputValue!==void 0&&(n.value=$e(t.inputValue,t.inputType,e)),n}async function Jn(t,e){let n=`${T(e.replayHost)}/v1/replay`;return (await e.fetch(n,{body:JSON.stringify(t),headers:{authorization:`Bearer ${e.apiKey}`,"content-type":"application/json"},method:"POST"})).ok}var Yn=new Set(["INPUT","SELECT","TEXTAREA"]),De=class{constructor(e){this.options=e;d(this,"allocator",new Oe);d(this,"mirror",new Map);d(this,"chunker");d(this,"fetchImpl");d(this,"observer");d(this,"timer");d(this,"started",false);this.chunker=new Re({distinctId:e.distinctId,masked:e.mask.maskAllInputs,maxEvents:e.maxEvents,now:e.now,sessionId:e.sessionId}),this.fetchImpl=_(e.fetch);}start(){if(this.started)return;let e=_i(),n=e?.documentElement;!e||!n||!this.fetchImpl||(this.started=true,this.captureFullSnapshot(n),this.observeMutations(n),this.observeInteractions(e),this.timer=setInterval(()=>this.upload(this.chunker.flush()),this.options.flushIntervalMs));}stop(){this.started&&(this.started=false,this.observer?.disconnect(),this.timer&&clearInterval(this.timer),this.upload(this.chunker.flush()));}captureFullSnapshot(e){let n=Me(this.adapt(e),this.allocator,this.options.mask,(r,i)=>{let s=r.ref;s&&this.mirror.set(s,i);});n&&this.push(2,{node:n});}observeMutations(e){let n=globalThis.MutationObserver;n&&(this.observer=new n(r=>{for(let i of r)this.handleMutation(i);}),this.observer.observe(e,{attributes:true,characterData:true,childList:true,subtree:true}));}handleMutation(e){if(e.type==="characterData"){let n=this.mirror.get(e.target);n!==void 0&&this.push(3,{texts:[{id:n,value:Ne(e.target.textContent??"",this.options.mask)}]});return}if(e.type==="attributes"&&e.attributeName){let n=this.mirror.get(e.target),r=e.target;n!==void 0&&this.push(3,{attributes:[{attributes:{[e.attributeName]:r.getAttribute(e.attributeName)??""},id:n}]});return}if(e.type==="childList"){let n=this.mirror.get(e.target);if(n===void 0)return;for(let r of Array.from(e.addedNodes)){let i=Me(this.adapt(r),this.allocator,this.options.mask,(s,o)=>{let a=s.ref;a&&this.mirror.set(a,o);});i&&this.push(3,{adds:[{node:i,parentId:n}]});}for(let r of Array.from(e.removedNodes)){let i=this.mirror.get(r);i!==void 0&&(this.push(3,{removes:[{id:i,parentId:n}]}),this.mirror.delete(r));}}}observeInteractions(e){e.addEventListener("input",n=>{let r=n.target;if(!r||!Yn.has(r.tagName))return;let i=this.mirror.get(r);i!==void 0&&this.push(3,{input:{id:i,value:$e(r.value??"",r.type,this.options.mask)}});},true),e.addEventListener("scroll",n=>{let r=n.target,i=r?this.mirror.get(r):void 0;this.push(3,{scroll:{id:i??0,x:r?.scrollLeft??0,y:r?.scrollTop??0}});},true);}adapt(e){let n={childNodes:[],nodeType:e.nodeType,ref:e};if(e.nodeType===kt)return n.textValue=e.textContent??"",n;if(e.nodeType===bt){let r=e;if(n.tagName=r.tagName,n.attributes=Array.from(r.attributes).map(i=>({name:i.name,value:i.value})),Yn.has(r.tagName)){let i=r;n.inputType=i.type,n.inputValue=i.value??"";}}return n.childNodes=Array.from(e.childNodes).map(r=>this.adapt(r)),n}push(e,n){let r=this.chunker.add({data:n,timestamp:this.options.now(),type:e});r&&this.upload(r);}upload(e){!e||!this.fetchImpl||Jn(e,{apiKey:this.options.apiKey,fetch:this.fetchImpl,replayHost:this.options.replayHost}).catch(n=>this.options.onError?.(n));}};function _i(){return globalThis.document}function Qn(t){let e=new De({apiKey:t.apiKey,distinctId:t.distinctId,flushIntervalMs:t.flushIntervalMs??5e3,mask:{...Un,...t.mask},maxEvents:t.maxEvents??200,now:t.now??(()=>Date.now()),onError:t.onError,replayHost:t.replayHost,sessionId:t.sessionId??je()});return e.start(),e}var qe=t=>`prodantix-cta:${t}`,Xn=t=>{try{let e=window.localStorage.getItem(qe(t));return e===null?null:Number(e)}catch{return null}},Zn=t=>{try{return window.sessionStorage.getItem(qe(t))!==null}catch{return false}},er=(t,e)=>{try{window.localStorage.setItem(qe(t),String(e)),window.sessionStorage.setItem(qe(t),String(e));}catch{return}},tr=(t,e,n,r)=>e===null?true:t.kind==="once"?false:t.kind==="session"?!n:r-e>=t.value*864e5;var H={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"}},Ke=t=>{let e=(t??"").toLowerCase().split("-")[0]??"";return e in H?e:"en"};var b="prodantix-cta",nr="prodantix-cta-style",Fi=`.${b}{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}
1
+ 'use strict';var Cr=Object.defineProperty;var Ir=(t,e,n)=>e in t?Cr(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var d=(t,e,n)=>Ir(t,typeof e!="symbol"?e+"":e,n);var D=class extends Error{constructor(n,r,i){super(r,i);d(this,"code");this.code=n,this.name="ProdantixError";}},Z=class extends D{constructor(e){super("config",e),this.name="ConfigError";}},U=class extends D{constructor(n,r){super("validation",r);d(this,"field");this.field=n,this.name="ValidationError";}},f=class extends D{constructor(n,r,i){super("transport",n,i);d(this,"status");this.status=r,this.name="TransportError";}};function F(t){if(t)return t;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function L(){let t=globalThis.AbortController;return t?new t:void 0}var Ft=t=>new Promise(e=>{setTimeout(e,t);});function C(t){return t.replace(/\/+$/,"")}var G=class{constructor(){d(this,"store",new Map);}getItem(e){return this.store.get(e)??null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}},ee=class{constructor(e,n=()=>false){this.real=e;this.passes=n;d(this,"held",new G);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 Lt(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch{return new G}return new G}var oe={now:()=>new Date};function ae(t){return t.toISOString()}function $t(){if(typeof window>"u"||typeof Intl>"u")return null;let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof t=="string"&&t!==""?t:null}function _r(){return globalThis.crypto}function Pr(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 Ve(){let t=_r();if(t?.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t?.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return Pr(e)}var Nt={uuid:Ve};var Ar=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Fr=/^(?:\$|[a-z])[a-z0-9_.]*$/;function de(t){let e=0;for(let n of t)e+=1;return e}function Rt(t){return Ar.test(t)}function Lr(t){return Fr.test(t)}function Ot(t){let e=de(t);if(e<1||e>200)throw new U("distinct_id","distinct_id must be between 1 and 200 characters")}function Mt(t){let e=de(t);if(e<1||e>200)throw new U("event_name","event_name must be between 1 and 200 characters");if(!Lr(t))throw new U("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Dt="prodantix-js",qt="0.7.0";var $r=t=>{};function Kt(t){if(!t.apiKey||!Rt(t.apiKey))throw new Z("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!t.host)throw new Z("host is required (the ingest base URL)");let e=C(t.host),n=t.defaultProperties,r=t.storage??new G;return {apiKey:t.apiKey,autocapture:t.autocapture??false,clock:t.clock??oe,consent:t.consent,consentMode:t.consentMode,defaultProperties:typeof n=="function"?n:()=>n??{},describeElement:t.describeElement,flagsHost:t.flagsHost?C(t.flagsHost):e,flushAt:t.flushAt??20,flushIntervalMs:t.flushIntervalMs??1e4,host:e,ids:t.ids??Nt,locale:t.locale,maxQueueSize:t.maxQueueSize??1e3,maxRetries:t.maxRetries??3,namespace:W(t.apiKey),onError:t.onError??$r,os:t.os,requestTimeoutMs:t.requestTimeoutMs??1e4,sdkName:t.sdkName??Dt,sdkVersion:t.sdkVersion??qt,sessionTracking:t.sessionTracking??false,sharedStorage:t.sharedStorage??r,socketFactory:t.socketFactory,storage:r,streamFlags:t.streamFlags??false,transport:t.transport}}function W(t){return t.slice(0,16)}var Bt="$cta_viewed",Ht="$cta_clicked",je="$cta_dismissed",Gt=(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},ce=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=F(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async ctas(e){let n=this.fetch;if(!n)throw new f("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=L(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(o.status<200||o.status>=300)throw new f(`ctas request failed with status ${o.status}`,o.status);return JSON.parse(await o.text()).ctas}finally{s!==void 0&&clearTimeout(s);}}};function Vt(t,e,n){Mt(t.eventName),Ot(t.distinctId);let r={distinct_id:t.distinctId,event_id:t.eventId??n.uuid(),event_name:t.eventName,properties:t.properties??{},schema_version:1,timestamp:ae(t.timestamp??e.now())};return t.context&&(r.context=t.context),t.sessionId&&(r.session_id=t.sessionId),r}var j=Symbol("absent");function Nr(t,e){if(t==="distinct_id")return e.distinctId;let n=e.properties??{};if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let r=e.attributes??{};return Object.prototype.hasOwnProperty.call(r,t)?r[t]:j}function V(t){return t===j?"undefined":String(t)}function jt(t){return t===j?Number.NaN:Number(t)}function Ut(t){return t!==j&&t!==null&&t!==""}function Wt(t,e){if(!Array.isArray(e))return false;let n=V(t);return e.map(r=>String(r)).includes(n)}function zt(t,e){let n=Nr(t.attribute,e),r=t.value;switch(t.op){case "is_set":return Ut(n);case "is_not_set":return !Ut(n);case "eq":return V(n)===V(r===void 0?j:r);case "neq":return V(n)!==V(r===void 0?j:r);case "contains":return V(n).includes(V(r===void 0?j:r));case "in":return Wt(n,r);case "not_in":return Array.isArray(r)?!Wt(n,r):false;case "gt":return ue(n,r,(i,s)=>i>s);case "gte":return ue(n,r,(i,s)=>i>=s);case "lt":return ue(n,r,(i,s)=>i<s);case "lte":return ue(n,r,(i,s)=>i<=s);case "in_cohort":return typeof r=="string"&&r!==""&&(e.cohorts??[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!(e.cohorts??[]).includes(r);default:return false}}function ue(t,e,n){let r=jt(t),i=e===void 0?Number.NaN:jt(e);return Number.isNaN(r)||Number.isNaN(i)?false:n(r,i)}function Jt(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 Ue(t,e){return t.targeting.length===0||t.targeting.every(n=>zt(n,e))}function Yt(t,e){let n=Jt(t.key,e.distinctId),r=t.variations??[];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 We(t,e,n,r){for(let i of t.prerequisites??[]){if(r.includes(i.flagKey))return false;let s=e.find(a=>a.key===i.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let o=We(s,e,n,r)&&Ue(s,n)&&Yt(s,n)===i.variationKey;if(r.pop(),!o)return false}return true}function le(t,e,n){return t.enabled?We(t,e,n,[t.key])?Ue(t,n)?t.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:Jt(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 Qt(t,e){let n={};for(let r of t)n[r.key]=le(r,t,e).enabled;return n}function ze(t,e,n){let r=t.variations??[],i=r[0];if(!i)return null;if(!t.enabled||!We(t,e,n,[t.key])||!Ue(t,n))return i;let s=Yt(t,n);return r.find(o=>o.key===s)??i}function Xt(t){return t.some(e=>e.targeting.some(n=>n.op==="in_cohort"||n.op==="not_in_cohort"))}function Zt(t){return `40${JSON.stringify(t)}`}function en(){return "3"}function tn(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 o=Je(n);return {kind:"open",pingInterval:typeof o?.pingInterval=="number"?o.pingInterval:25e3,pingTimeout:typeof o?.pingTimeout=="number"?o.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 o=Je(i);return {kind:"connectError",message:typeof o?.message=="string"?o.message:"refused"}}if(r!=="2")return {kind:"other"};let s=Je(i);return !Array.isArray(s)||typeof s[0]!="string"?{kind:"other"}:{kind:"event",name:s[0],payload:s[1]}}function Je(t){try{return JSON.parse(t)}catch{return null}}var Rr="/socket.io/?EIO=4&transport=websocket",Or=250,pe=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");this.factory=e.socketFactory??Mr,this.setTimer=e.setTimer??((n,r)=>setTimeout(n,r)),this.clearTimer=e.clearTimer??(n=>clearTimeout(n));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Rr}`,n;try{n=this.factory(e);}catch{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?.close();}receive(e){let n=tn(e);if(n.kind==="open"){this.armHeartbeat(n.pingInterval+n.pingTimeout),this.socket?.send(Zt({projectKey:this.options.projectKey}));return}if(n.kind==="ping"){this.armHeartbeat(),this.socket?.send(en());return}if(n.kind==="connectError"||n.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(n.kind==="event"){if(n.name==="ready"){this.ready=true;return}if(n.name==="flagChange"){let r=n.payload?.key;this.lastKey=typeof r=="string"?r:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Or));}}}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(()=>this.socket?.close(),this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Mr(t){let e=globalThis.WebSocket;if(!e)throw new f("no WebSocket");return new e(t)}var me=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=F(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){let n=this.fetch;if(!n)throw new f("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=L(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new f(`flags request failed with status ${o.status}`,o.status);let a=JSON.parse(await o.text());return {flags:a.flags??{},variants:a.variants??{}}}finally{s!==void 0&&clearTimeout(s);}}async snapshot(){let e=this.fetch;if(!e)throw new f("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/snapshot`,r=L(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!s.ok)throw new f(`flag snapshot request failed with status ${s.status}`,s.status);let o=JSON.parse(await s.text()),a={flags:o.flags??[],generatedAt:o.generatedAt};return typeof o.socketUrl=="string"&&o.socketUrl!==""&&(a.socketUrl=o.socketUrl),a}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){let n=this.fetch;if(!n)throw new f("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=L(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new f(`memberships request failed with status ${o.status}`,o.status);return JSON.parse(await o.text()).cohorts??[]}finally{s!==void 0&&clearTimeout(s);}}};var nn="$form_viewed",rn="$form_started",te=class extends Error{constructor(n,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=n,this.fields=r;}},fe=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=F(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async request(e,n){let r=this.fetch;if(!r)throw new f("no fetch implementation available in this runtime");let i=L(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(o["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:o,method:n.method,signal:i?.signal});return {status:a.status,text:await a.text()}}finally{s!==void 0&&clearTimeout(s);}}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 f(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,n){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 s=[],o=`form submission failed with status ${r}`;try{let a=JSON.parse(i);s=a.error?.fields??[],o=a.error?.message??o;}catch{s=[];}throw new te(r,s,o)}};var sn="$survey_shown",on="$survey_dismissed",an="$survey_sent",ge=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=F(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async surveys(e,n){let r=this.fetch;if(!r)throw new f("no fetch implementation available in this runtime");let i=L(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${n?`&lang=${encodeURIComponent(n)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new f(`surveys request failed with status ${o.status}`,o.status);return JSON.parse(await o.text()).surveys??[]}finally{s!==void 0&&clearTimeout(s);}}},Dr=864e5,he=t=>`${t.id}:${t.iteration}`;function Ye(t,e){return t.length===0?true:t.some(n=>{switch(n.matches){case "exact":return e===n.value;case "starts_with":return e.startsWith(n.value);default:return e.includes(n.value)}})}function dn(t,e,n,r,i){return t.kind!=="popover"||e.settled.includes(he(t))||t.showOnce&&e.settled.some(s=>s.startsWith(`${t.id}:`))||t.waitDays>0&&e.lastShownAt!==void 0&&r-e.lastShownAt<t.waitDays*Dr||t.event&&t.event!==i?false:Ye(t.urls,n)}function ye(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 Qe="$guide_shown",cn="$guide_step_viewed",un="$guide_step_missed",Xe="$guide_completed",Ze="$guide_dismissed",ln="$checklist_task_done",ve=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=F(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async guides(e){let n=this.fetch;if(!n)throw new f("no fetch implementation available in this runtime");let r=L(),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?.signal});if(!s.ok)throw new f(`guides request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).guides??[]}finally{i!==void 0&&clearTimeout(i);}}},qr=864e5,z=t=>`${t.id}:${t.iteration}`,be=(t,e)=>`${z(t)}:${e}`;function pn(t,e,n,r,i){return e.settled.includes(z(t))||t.showOnce&&e.settled.some(s=>s.startsWith(`${t.id}:`))||t.kind!=="checklist"&&t.waitDays>0&&e.lastShownAt!==void 0&&r-e.lastShownAt<t.waitDays*qr||t.event&&t.event!==i?false:Ye(t.urls,n)}var et=(t,e)=>t.steps.filter(n=>e.done.includes(be(t,n.id))).map(n=>n.id),mn=(t,e)=>t.kind==="checklist"?t.steps.find(n=>n.event===e):void 0;function fn(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 ne(t){if(typeof t!="string")return;let e=Array.from(t).length;return e>=1&&e<=200?t:void 0}function ke(t,e){return `pdx.${t}.${e}`}var nt="consent",Kr=["identityLink","analytics","marketing","functional"];function tt(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 Kr){let s=n[i];typeof s=="boolean"&&(r[i]=s);}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{return null}}var gn=t=>t.endsWith(`.${nt}`);function Se(t,e){return tt(t.getItem(ke(e,nt)))}function Br(t,e,n){let r=ke(e,nt),i=tt(JSON.stringify(n)),s=i===null?null:tt(JSON.stringify({...Se(t,e)??{},...i}));if(s===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(s));}function hn(t,e,n,r){let i=ke(n,"anonymous_id"),s=ne(e.getItem(i))??ne(t.getItem(i));return e.setItem(i,r),t.setItem(i,r),s!==void 0&&s!==r?s:void 0}var xe=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=ne(this.shared.getItem(this.key("anonymous_id"))),n=ne(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=ne(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 Se(this.shared,this.namespace)}setConsent(e){Br(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){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||this.consent()?.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 ke(this.namespace,e)}};var we=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=F(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async inbox(e){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 f(`inbox request failed with status ${i.status}`,i.status);return JSON.parse(await i.text()).messages??[]}async markRead(e,n){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,s=await this.request(r,i,{body:JSON.stringify({distinct_id:n,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!s.ok)throw new f(`mark-read request failed with status ${s.status}`,s.status)}requireFetch(){if(!this.fetch)throw new f("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,n,r){let i=L(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n,{...r,signal:i?.signal})}finally{s!==void 0&&clearTimeout(s);}}};var Ee=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(){if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);this.onOverflow?.({dropped:e});}};var Hr={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function yn(t){return `pdx.${t}.session`}function vn(t,e,n,r){let i={id:n.id,lastActivityAt:r,startedAt:n.startedAt};t.setItem(yn(e),JSON.stringify(i));}var Te=class{constructor(e,n,r,i,s=Hr){this.storage=e;this.ids=n;this.clock=r;this.namespace=i;this.options=s;}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{return}}key(){return yn(this.namespace)}};var w={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageview:"$pageview",set:"$set",webVitals:"$web_vitals"};function bn(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");this.fetch=F(e.fetch),this.maxRetries=e.maxRetries??3,this.requestTimeoutMs=e.requestTimeoutMs??1e4,this.baseDelayMs=e.baseDelayMs??500,this.maxDelayMs=e.maxDelayMs??3e4,this.sleep=e.sleep??Ft,this.random=e.random??Math.random;}async send(e){let n=this.fetch;if(!n)throw new f("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let s=0;s<=this.maxRetries;s+=1){try{let o=await this.attempt(n,e,r);if(o.ok)return;if(bn(o.status))throw new f(`ingest rejected batch with status ${o.status}`,o.status);i=new f(`ingest transient status ${o.status}`,o.status);}catch(o){if(o instanceof f&&o.status!==void 0&&bn(o.status))throw o;i=o;}s<this.maxRetries&&await this.sleep(this.backoff(s));}throw new f("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,n,r){let i=L(),s=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?.signal})}finally{s!==void 0&&clearTimeout(s);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var Gr="queue",Vr=1e3,xn=3e4,rt=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},Ce=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);let n=Kt(e),r=Se(n.sharedStorage,n.namespace)??n.consent??null;if(this.gates=[new ee(n.storage),new ee(n.sharedStorage,gn)],n.consentMode!=="banner"||r?.analytics===true)for(let o of this.gates)o.open();let[i,s]=this.gates;this.config={...n,sharedStorage:s,storage:i},this.identity=new xe(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 Te(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new Ee(this.config.maxQueueSize,({dropped:o})=>{this.config.onError(new D("queue_overflow",`event queue overflow: dropped ${o.length} oldest event(s)`));}),this.transport=this.config.transport??new J({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new me({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new we({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new ge({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new ve({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new fe({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new ce({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(){return this.session?.current()}get sessionStartedAt(){return this.session?.startedAt()}capture(e,n={}){try{this.identity.refresh();let r={...this.config.defaultProperties(),...n.element===void 0?{}:this.config.describeElement?.(n.element)??{},...n.properties??{}},i=Vt({context:this.context,distinctId:n.distinctId??this.identity.getDistinctId(),eventName:e,properties:r,sessionId:n.sessionId??this.session?.current(),timestamp:n.timestamp},this.config.clock,this.config.ids);this.enqueue(i);}catch(r){this.config.onError(r);}for(let r of this.captureListeners)try{r(e);}catch(i){this.config.onError(i);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,n={}){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 s=$t(),o={...s===null?{}:{$timezone:s},...rt(n.traits??{}),...n.set??{}};Object.keys(o).length>0&&(i.$set=o),this.capture(w.identify,{properties:i});}link(e,n,r){if(this.isCookieless())return;let i={$anon_distinct_id:n},s=rt(r??{});Object.keys(s).length>0&&(i.$set=s),this.capture(w.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(w.createAlias,{properties:{alias:e}});}group(e,n,r){let i={$group_key:n,$group_type:e};r&&(i.$set=r),this.capture(w.group,{properties:i});}setPersonProperties(e,n){if(this.isCookieless())return;let r={};e&&(r.$set=e),n&&(r.$set_once=n),this.capture(w.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let n=rt(e);Object.keys(n).length!==0&&this.capture(w.set,{properties:{$set:n}});}async getAllFlags(){let e=this.identity.getDistinctId(),n=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:n.flags,variants:n.variants??{}},n.flags}async isFeatureEnabled(e){let r=(await this.getAllFlags())[e]??false;return this.recordExposure(e,this.cachedFlags?.variants[e]?.key??String(r)),r}async getVariant(e){let n=await this.getAllFlags(),r=this.cachedFlags?.variants[e]??null;return this.recordExposure(e,r?.key??String(n[e]??false)),r}async getVariantLocal(e,n={}){let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),s=await this.localContext(n,r.flags),o=i?ze(i,r.flags,s):null,a=i?le(i,r.flags,s).enabled:false;return this.recordExposure(e,o?.key??String(a)),o?{key:o.key,value:o.value}:null}recordExposure(e,n){let r=`${this.identity.getDistinctId()} ${e} ${n}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(w.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 Qt(n.flags,await this.localContext(e,n.flags))}async isFeatureEnabledLocal(e,n={}){let r=await this.flagSnapshot(),i=r.flags.find(a=>a.key===e),s=await this.localContext(n,r.flags),o=i?le(i,r.flags,s).enabled:false;return this.recordExposure(e,(i?ze(i,r.flags,s)?.key:void 0)??String(o)),o}async localContext(e,n){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&Xt(n)){let s=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&s-this.membershipCache.fetchedAt<xn?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:s});}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<xn)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 pe({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??this.config.locale)}captureSurveyShown(e){this.capture(sn,{properties:ye(e,{})});}captureSurveyDismissed(e){this.capture(on,{properties:ye(e,{})});}captureSurveySent(e,n){this.capture(an,{properties:ye(e,n)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,n,r){this.capture(e,{properties:fn(n,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,n,r,i){let{$page_id:s,$page_variant:o}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:n,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window>"u"?"":window.location.href,solution:i,...typeof s=="string"&&typeof o=="string"?{pageId:s,pageVariant:o}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,n,r){this.capture(e,{properties:Gt(n,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(Vr);try{await this.transport.send({body:{events:e,sent_at:ae(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(){this.session?.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){this.shutDown=true,this.stopTimer(),this.stream?.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}.${Gr}`}};var Sn="data-prodantix",wn="data-prodantix-action",En="data-prodantix-ignore",Y=300,it="data-pdx-no-capture",st="pdx-no-capture",jr=new Set(["a","button","input","label","option","select","summary","textarea"]),Ur=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]);function Wr(t){return jr.has(t.tagName.toLowerCase())||Ur.has((t.getAttribute("role")??"").trim().toLowerCase())}function ot(t){for(let e=t;e!==null;e=e.parentElement)if(Wr(e))return e;return t}function at(t){for(let e=t;e!==null;e=e.parentElement)if(e.getAttribute(En)!==null)return true;return false}function dt(t){for(let e=t;e!==null;e=e.parentElement)if(e.getAttribute(it)!==null||typeof e.className=="string"&&e.className.split(/\s+/).includes(st))return true;return false}function Ie(t){let e=new Set;return n=>{e.has(n.message)||(e.add(n.message),t(n));}}function kn(t,e,n){let r=t.getAttribute(e);if(r===null)return;let i=r.trim();if(i!==""){if(i.length>Y){n(new D("validation",`${e} on a <${t.tagName.toLowerCase()}> is ${i.length} characters, over the ${Y}-character limit, so it was ignored: "${i.slice(0,40)}\u2026"`));return}return i}}function ct(t,e){let n={},r=kn(t,Sn,e);r!==void 0&&(n.$el_description=r,n.$el_description_source="annotation");let i=kn(t,wn,e);return i!==void 0&&(n.$el_action=i),n}function Tn(t,e){return !zr(t)||at(t)||dt(t)?{}:ct(ot(t),e)}function zr(t){return typeof t=="object"&&t!==null&&typeof t.tagName=="string"&&typeof t.getAttribute=="function"}var Jr="$form_submitted",Yr=new Set(["button","file","hidden","image","password","reset","submit"]),Cn=/(card|cc-?num|cvc|cvv|iban|security.?code)/i,Qr=t=>(t.getAttribute("autocomplete")??"").startsWith("cc-")||Cn.test(t.name)||Cn.test(t.id),Xr=t=>{let e=t.name.toLowerCase();return t instanceof HTMLInputElement&&t.type==="email"||e==="email"||t.getAttribute("autocomplete")==="email"?"$email":e==="name"||e==="full_name"||e==="fullname"||t.getAttribute("autocomplete")==="name"?"$name":null},Zr=(t,e)=>{if(t.closest("[data-prodantix-ignore]")||t.hasAttribute("data-prodantix-form"))return null;let n={},r={};for(let i of Array.from(t.elements)){if(!(i instanceof HTMLInputElement||i instanceof HTMLSelectElement||i instanceof HTMLTextAreaElement)||!i.name||i.closest("[data-prodantix-ignore]")||Qr(i)||i instanceof HTMLInputElement&&(Yr.has(i.type)||(i.type==="checkbox"||i.type==="radio")&&!i.checked))continue;let s=i.value.trim();if(s==="")continue;n[i.name]=s;let o=Xr(i);o&&(r[o]=s);}return {$answers:n,$form_id:t.id||`${e}#${Array.from(t.ownerDocument.forms).indexOf(t)}`,$page_url:t.ownerDocument.location?.href??"",$set:r,collected:true}},In=(t,e=document)=>{let n=r=>{if(r.target instanceof HTMLFormElement){let i=Zr(r.target,e.location?.pathname??"");i&&t.capture(Jr,{properties:i});}};return e.addEventListener("submit",n,true),()=>e.removeEventListener("submit",n,true)};var ei=1e3,ti=5e3,ni=50,ut=class{constructor(){d(this,"fcp");d(this,"lcp");d(this,"cls");d(this,"window",{end:0,start:0,sum:0});d(this,"interactions",new Map);}add(e){if(e.entryType==="paint"&&e.name==="first-contentful-paint"&&(this.fcp=e.startTime),e.entryType==="largest-contentful-paint"&&(this.lcp=e.startTime),e.entryType==="layout-shift"&&!e.hadRecentInput&&e.value!==void 0){let n=this.window.sum>0&&e.startTime-this.window.end<ei&&e.startTime-this.window.start<ti;this.window=n?{end:e.startTime,start:this.window.start,sum:this.window.sum+e.value}:{end:e.startTime,start:e.startTime,sum:e.value},this.cls=Math.max(this.cls??0,this.window.sum);}e.entryType==="event"&&e.interactionId!==void 0&&e.interactionId>0&&this.interactions.set(e.interactionId,Math.max(this.interactions.get(e.interactionId)??0,e.duration));}properties(e){let n={};if(this.lcp!==void 0&&(n.$lcp_ms=Math.round(this.lcp)),this.fcp!==void 0&&(n.$fcp_ms=Math.round(this.fcp)),this.cls!==void 0&&(n.$cls=Math.round(this.cls*1e4)/1e4),this.interactions.size>0){let r=[...this.interactions.values()].sort((i,s)=>s-i);n.$inp_ms=Math.round(r[Math.min(r.length-1,Math.floor(r.length/ni))]??0);}return e!==void 0&&(n.$ttfb_ms=Math.round(e)),n}},ri=[{type:"paint"},{type:"largest-contentful-paint"},{type:"layout-shift"},{durationThreshold:40,type:"event"}];function _n(t,e){let n=new ut,r=[];for(let o of ri){let a=e.observer(u=>{for(let c of u)n.add(c);});if(a!==void 0)try{a.observe({...o,buffered:!0}),r.push(a);}catch{a.disconnect();}}let i=false,s=()=>{if(i)return;let o=n.properties(e.firstByte());if(Object.keys(o).length===0)return;i=true;let a=e.path();t.capture(w.webVitals,{properties:a===void 0?o:{...o,$pathname:a}});};return e.addEventListener("visibilitychange",()=>{e.isHidden()&&s();}),e.addEventListener("pagehide",s),()=>{for(let o of r)o.disconnect();}}function Pn(){if(!(typeof window>"u"||typeof document>"u"||typeof PerformanceObserver>"u"))return {addEventListener:(t,e)=>(t==="pagehide"?window:document).addEventListener(t,e),firstByte:()=>{let t=performance.getEntriesByType("navigation")[0];return t instanceof PerformanceNavigationTiming&&t.responseStart>0?t.responseStart:void 0},isHidden:()=>document.visibilityState==="hidden",observer:t=>{try{return new PerformanceObserver(e=>t(e.getEntries()))}catch{return}},path:()=>window.location?.pathname}}var ii=new Set(["input","select","textarea"]),si=new Set(["email","password","tel"]);function Pe(){return globalThis.location}function An(){return globalThis.document}function oi(){return globalThis.window??globalThis}function ai(t){return typeof t=="object"&&t!==null&&typeof t.tagName=="string"}function _e(t,e){let n;try{n=new URL(t,e);}catch{return}return n.protocol==="http:"||n.protocol==="https:"?`${n.origin}${n.pathname}`:n.protocol}function Fn(){let t=Pe(),e=An(),n={};if(t){let r=_e(t.href);r&&(n.$current_url=r),n.$pathname=t.pathname,n.$host=t.host;}if(e){e.title&&(n.$title=e.title);let r=e.referrer?_e(e.referrer):void 0;r&&(n.$referrer=r);}return n}function di(t){return typeof t.className=="string"?t.className:""}function ci(t){return ii.has(t.tagName.toLowerCase())||si.has((t.getAttribute("type")??"").toLowerCase())}function ui(t,e,n){let r={$el_tag:t.tagName.toLowerCase(),$event_type:"click"};if(e)return r;let i=n?t.textContent?.trim():void 0;i&&(r.$el_text=i.slice(0,255)),t.id&&(r.$el_id=t.id);let s=di(t);s&&(r.$el_classes=s);let o=t.getAttribute("href"),a=o?_e(o,Pe()?.href):void 0;return a&&(r.$el_href=a),r}function lt(t){return (t??"").replace(/\s+/g," ").trim()}function re(t,e){return {$el_description:t,$el_description_source:e}}function li(t,e,n){if(!e&&n){let o=lt(t.getAttribute("aria-label"));if(o!==""&&o.length<=Y)return re(o,"aria_label");let a=lt(t.textContent);if(a!==""&&a.length<=Y)return re(a,"text")}let r=e?null:t.getAttribute("href"),i=r?_e(r,Pe()?.href):void 0;if(i)return re(i,"href");let s=lt(t.getAttribute("role")).toLowerCase();return s===""?re(t.tagName.toLowerCase(),"tag"):re(s,"role")}function pi(t,e){let n=new Set,r=(c,l)=>{if(n.has(c))return false;try{return l()}catch(p){return n.add(c),e(new D("config",`autocapture maskSelectors entry "${c}" is not a valid selector`,{cause:p})),false}},i=(c,l)=>c.matches?r(l,()=>c.matches?.(l)===!0):false,s=c=>{let l=c.querySelector?.bind(c);return l?l(`[${it}], .${st}`)!==null||t.some(p=>r(p,()=>l(p)!==null)):false},o=c=>{for(let l=c;l;l=l.parentElement){let p=l;if(t.some(x=>i(p,x)))return true}return false},a=c=>{for(let l=c;l;l=l.parentElement)if(ci(l))return true;return false},u=c=>dt(c)||o(c);return {holdsMasked:s,isMasked:c=>u(c)||a(c),isOptedOut:u}}function mi(t){let e=globalThis.history,n=oi(),r="",i=()=>{let a=Pe(),u=a?`${a.pathname}${a.search}`:"";u!==r&&(r=u,t.capture(w.pageview,{properties:Fn()}));};if(i(),!e||!n)return ()=>{};let s=e.pushState.bind(e),o=e.replaceState.bind(e);return e.pushState=(...a)=>{s(...a),i();},e.replaceState=(...a)=>{o(...a),i();},n.addEventListener("popstate",i),()=>{e.pushState=s,e.replaceState=o,n.removeEventListener("popstate",i);}}function fi(t,e){let n=An();if(!n)return ()=>{};let r=e.onError??(()=>{}),i=pi(e.maskSelectors??[],r),s=Ie(r),o=e.captureElementText??false,a=u=>{let c=u.target;if(!ai(c)||at(c))return;let l=ot(c),p=i.isMasked(c)||i.holdsMasked(l),x=i.isOptedOut(c)?{}:ct(l,s),$=x.$el_description===void 0?li(l,p,o):{};t.capture(w.autocapture,{properties:{...Fn(),...ui(l,p,o),...$,...x}});};return n.addEventListener("click",a,true),()=>n.removeEventListener("click",a,true)}function Ln(t,e={}){let n=[];(e.pageviews??true)&&n.push(mi(t)),(e.clicks??true)&&n.push(fi(t,e)),e.collectForms===true&&typeof document<"u"&&n.push(In(t));let r=e.webVitals===false?void 0:Pn();return r!==void 0&&n.push(_n(t,r)),()=>{for(let i of n)i();}}function gi(){return globalThis.document?.visibilityState==="hidden"}function hi(t){let e=globalThis.navigator,n=globalThis.Blob;if(!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{return false}}var Ae=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new J(e);}async send(e){gi()&&hi(e)||await this.fetchTransport.send(e);}};var pt="prodantix:consent-ready",mt="prodantix:consent",$n="__prodantixConsent";var Nn=(t,e)=>{t.takeCookielessId(e.anonymousId),e.consent!==null?t.setConsent(e.consent):e.rule==="notice"&&t.allowStorage();},Rn=(t,e)=>{let n=e[$n];n&&Nn(t,n);let r=s=>{let o=s.detail;o&&Nn(t,o);},i=s=>{let o=s.detail;o&&t.setConsent(o);};return e.addEventListener(pt,r),e.addEventListener(mt,i),()=>{e.removeEventListener(pt,r),e.removeEventListener(mt,i);}};var yi=/^\d{1,3}(\.\d{1,3}){3}$/,vi=/^[a-z0-9.-]+$/i;function On(){return Math.random().toString(36).slice(2,12)}function Fe(t,e){let n=`${e}=`,r=[];for(let i of t.cookie.split(";")){let s=i.trim();s.startsWith(n)&&r.push(s.slice(n.length));}return r}function ie(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function Mn(t,e,n,r){try{let i=`pdx_probe_${r()}`,s=r();t.cookie=`${i}=${s}; ${ie(e,60,n)}`;let o=Fe(t,i).includes(s);t.cookie=`${i}=; ${ie(e,0,n)}`;let a=Fe(t,i).includes(s);return o&&!a}catch{return false}}function gt(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||yi.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 Dn(t,e,n,r=On){for(let i of gt(t))if(Mn(e,i,n,r))return i}function bi(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 ft=class{constructor(e,n,r,i){this.jar=e;this.name=n;this.domain=r;this.secure=i;}getItem(e){return this.read().get(e)??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=Fe(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${ie(void 0,0,this.secure)}`,e=Fe(this.jar,this.name));let n=e[0];return n?bi(n):new Map}catch{return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${ie(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${ie(this.domain,31536e3,this.secure)}`;}catch{return}}};function xi(){return globalThis.document}function ki(){return globalThis.location?.hostname??""}function Si(){return globalThis.location?.protocol==="https:"}function wi(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return vi.test(e)?e.toLowerCase():void 0}function ht(t){let e="jar"in t?t.jar:xi();if(!e||globalThis.navigator?.cookieEnabled===false)return null;let r=t.random??On,i=t.secure??Si(),s=t.hostname??ki();try{let o=wi(t.domain)??Dn(s,e,i,r);return Mn(e,o,i,r)?new ft(e,t.name,o,i):null}catch{return null}}var Ei=["am","ar","bn","de","en","es","et","fil","fr","hi","id","ja","ko","pt","ru","sw","vi","zh"],qn=t=>{let e=(t??"").toLowerCase().split("-")[0]??"";return Ei.find(n=>n===e)??"en"};var Ti=/^\$(survey|guide|checklist)_/,Kn=()=>({guides:{done:[],settled:[]},surveys:{settled:[]}});function Ci(t,e){try{let n=t.getItem(e);if(n===null)return Kn();let r=JSON.parse(n);return {guides:{done:r.guides?.done??[],lastShownAt:r.guides?.lastShownAt,settled:r.guides?.settled??[]},surveys:{lastShownAt:r.surveys?.lastShownAt,settled:r.surveys?.settled??[]}}}catch{return Kn()}}function Bn(t,e,n){let r=n();return r?Promise.resolve(r):new Promise(i=>{let s=t.document.createElement("script");s.src=e,s.async=true,s.onload=()=>i(n()??null),s.onerror=()=>i(null),t.document.head.append(s);})}function Hn(t,e,n){let r=`pdx_engage_${n.namespace}`,i=Ci(n.storage,r),s=()=>{try{n.storage.setItem(r,JSON.stringify(i));}catch(y){n.onError(y);}},o=qn(e.document.documentElement.lang||e.navigator.language),a=[],u=[],c=false,l=false,p=new Map,x=()=>Bn(e,`${n.edgeHost}/surveys.js`,()=>e.prodantixSurveys),$=()=>Bn(e,`${n.edgeHost}/guides.js`,()=>e.prodantixGuides),_=async y=>{if(c)return;let g=a.find(A=>dn(A,i.surveys,e.location.href,Date.now(),y));if(!g)return;c=true;let T=await x();if(!T){c=false;return}let E=()=>{i.surveys.settled=[...i.surveys.settled.filter(A=>A!==he(g)),he(g)],s(),c=false;};T.showSurvey(e.document,g,o,{onDismissed:()=>{t.captureSurveyDismissed(g),E();},onSent:A=>{t.captureSurveySent(g,A),E();},onShown:()=>{i.surveys.lastShownAt=Date.now(),s(),t.captureSurveyShown(g);}});},R=y=>{i.guides.settled=[...i.guides.settled.filter(g=>g!==z(y)),z(y)],s();},B=async y=>{let g=u.filter(v=>!p.has(v.id)&&pn(v,i.guides,e.location.href,Date.now(),y)),T=g.filter(v=>v.kind==="checklist"),E=l?void 0:g.find(v=>v.kind!=="checklist");if(T.length===0&&!E)return;E&&(l=true);let A=await $();if(!A){l=false;return}for(let v of T)p.has(v.id)||p.set(v.id,A.showChecklist(e.document,v,o,et(v,i.guides),{onDismissed:()=>{t.captureGuide(Ze,v),R(v),p.delete(v.id);},onShown:()=>t.captureGuide(Qe,v)}));if(!E)return;(E.kind==="tooltip"?A.showTooltip:A.showTour)(e.document,E,o,{onCompleted:()=>{t.captureGuide(Xe,E),R(E),l=false;},onDismissed:()=>{t.captureGuide(Ze,E),R(E),l=false;},onMissed:v=>t.captureGuide(un,E,v),onShown:()=>{i.guides.lastShownAt=Date.now(),s(),t.captureGuide(Qe,E);},onStep:v=>t.captureGuide(cn,E,v)});},X=y=>{for(let g of u){let T=mn(g,y);!T||i.guides.done.includes(be(g,T.id))||i.guides.settled.includes(z(g))||(i.guides.done=[...i.guides.done,be(g,T.id)],t.captureGuide(ln,g,T.id),p.get(g.id)?.markDone(T.id),et(g,i.guides).length===g.steps.length&&(t.captureGuide(Xe,g),R(g),p.get(g.id)?.close(),p.delete(g.id)),s());}},O=y=>{n.surveys&&_(y).catch(n.onError),n.guides&&B(y).catch(n.onError);},M=t.onCapture(y=>{Ti.test(y)||(X(y),O(y));}),P=()=>O();e.addEventListener("popstate",P);let K=async()=>{let y=E=>(n.onError(E),[]),[g,T]=await Promise.all([n.surveys?t.getSurveys(e.document.documentElement.lang||e.navigator.language).catch(y):[],n.guides?t.getGuides().catch(y):[]]);a=g,u=T,O();};return e.document.readyState==="loading"?e.document.addEventListener("DOMContentLoaded",()=>void K(),{once:true}):K(),()=>{M(),e.removeEventListener("popstate",P);for(let y of p.values())y.close();p.clear();}}var jn="_pdx",Un="~",Ii=200,_i=/^\d+$/;function Wn(t,e,n,r){let i=Ai(t.href);if(i===void 0||vt(i.search).some(bt))return;let s=Gn(i.hostname,n);s===void 0||s===Gn(r,n)||(i.search=`${i.search}${i.search?"&":"?"}${jn}=${Pi(e)}`,t.href=i.href);}function Pi(t){return [t.anonymousId,t.sessionId,String(t.sessionStartedAt)].map(Li).join(Un)}function zn(t){let e=vt(t).find(bt);if(e===void 0)return;let n=Fi(e).split(Un);if(n.length!==3)return;let r=Le(n[0]),i=Le(n[1]),s=Le(n[2]);if(!(!Vn(r)||!Vn(i)||!$i(s)))return {anonymousId:r,sessionId:i,sessionStartedAt:Number(s)}}function Jn(t,e){let n=vt(e.search),r=n.filter(s=>!bt(s));if(r.length===n.length)return;let i=r.length>0?`?${r.join("&")}`:"";t.replaceState(t.state,"",`${e.pathname}${i}${e.hash}`);}function Yn(t){if(t.location===void 0||typeof t.location.search!="string")return;let e=zn(t.location.search);if(e===void 0)return;let n=hn(t.storage,t.shared,t.namespace,e.anonymousId);return vn(t.shared,t.namespace,{id:e.sessionId,startedAt:e.sessionStartedAt},t.now),t.history!==void 0&&Jn(t.history,t.location),n}function yt(t,e,n){if(n.length===0)return ()=>{};let r=i=>{let s=Oi(i.target);if(s===void 0)return;let o=Ni(e);o!==void 0&&Wn(s,o,n,t.location?.hostname??"");};return t.addEventListener("click",r,true),t.addEventListener("auxclick",r,true),()=>{t.removeEventListener("click",r,true),t.removeEventListener("auxclick",r,true);}}function Ai(t){try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"?e:void 0}catch{return}}function Gn(t,e){let n=e.map(r=>r.replace(/^\./,"").toLowerCase());return gt(t).find(r=>n.includes(r))}function vt(t){return t.replace(/^\?/,"").split("&").filter(e=>e!=="")}function bt(t){let e=t.indexOf("=");return Le(e===-1?t:t.slice(0,e))===jn}function Fi(t){let e=t.indexOf("=");return e===-1?"":t.slice(e+1)}function Li(t){return encodeURIComponent(t).replace(/~/g,"%7E")}function Le(t){try{return decodeURIComponent(t)}catch{return}}function Vn(t){if(t===void 0)return false;let e=de(t);return e>=1&&e<=Ii}function $i(t){return t!==void 0&&_i.test(t)&&Number.isSafeInteger(Number(t))}function Ni(t){if(t.consent?.()?.identityLink===false)return;let e=t.sessionId,n=t.sessionStartedAt;if(!(e===void 0||n===void 0))return {anonymousId:t.anonymousId,sessionId:e,sessionStartedAt:n}}function Ri(t){return typeof t.tagName=="string"&&t.tagName.toUpperCase()==="A"&&typeof t.href=="string"}function Oi(t){let e=typeof t=="object"?t:null;for(;e;){if(Ri(e))return e;e=e.parentElement??null;}}var Qn={maskAllInputs:true,maskAllText:false},Mi=new Set(["email","password","tel"]);function Xn(t){return t.replace(/\S/g,"*")}function $e(t,e,n){return Di(e)||n.maskAllInputs?Xn(t):t}function Ne(t,e){return e.maskAllText?Xn(t):t}function Di(t){return Mi.has((t??"").toLowerCase())}var qi=5e3,Re=class{constructor(e){this.options=e;d(this,"buffer",[]);d(this,"seq",0);d(this,"maxEvents");this.maxEvents=Math.min(Math.max(1,e.maxEvents),qi);}add(e){return this.buffer.push(e),this.buffer.length>=this.maxEvents?this.flush():null}flush(){if(this.buffer.length===0)return null;let e=this.buffer;this.buffer=[];let n={distinct_id:this.options.distinctId(),events:e,masked:this.options.masked,schema_version:1,seq:this.seq,session_id:this.options.sessionId,timestamp:new Date(this.options.now()).toISOString()};return this.seq+=1,n}};var xt=1,kt=3,Ki=9,Oe=class{constructor(){d(this,"next",1);}allocate(){let e=this.next;return this.next+=1,e}},Bi=new Set(["NOSCRIPT","SCRIPT"]);function Me(t,e,n,r){if(t.nodeType===kt){let i=e.allocate();return r?.(t,i),{id:i,textContent:Ne(t.textValue??"",n),type:"text"}}if(t.nodeType===Ki){let i=e.allocate();return r?.(t,i),{childNodes:Zn(t,e,n,r),id:i,type:"document"}}if(t.nodeType===xt){let i=t.tagName??"";if(Bi.has(i))return null;let s=e.allocate();return r?.(t,s),{attributes:Hi(t,n),childNodes:Zn(t,e,n,r),id:s,tagName:i,type:"element"}}return null}function Zn(t,e,n,r){let i=[];for(let s of t.childNodes??[]){let o=Me(s,e,n,r);o&&i.push(o);}return i}function Hi(t,e){let n={};for(let r of t.attributes??[])n[r.name]=r.value;return t.inputValue!==void 0&&(n.value=$e(t.inputValue,t.inputType,e)),n}async function er(t,e){let n=`${C(e.replayHost)}/v1/replay`;return (await e.fetch(n,{body:JSON.stringify(t),headers:{authorization:`Bearer ${e.apiKey}`,"content-type":"application/json"},method:"POST"})).ok}var tr=new Set(["INPUT","SELECT","TEXTAREA"]),De=class{constructor(e){this.options=e;d(this,"allocator",new Oe);d(this,"mirror",new Map);d(this,"chunker");d(this,"fetchImpl");d(this,"observer");d(this,"timer");d(this,"started",false);this.chunker=new Re({distinctId:e.distinctId,masked:e.mask.maskAllInputs,maxEvents:e.maxEvents,now:e.now,sessionId:e.sessionId}),this.fetchImpl=F(e.fetch);}start(){if(this.started)return;let e=Gi(),n=e?.documentElement;!e||!n||!this.fetchImpl||(this.started=true,this.captureFullSnapshot(n),this.observeMutations(n),this.observeInteractions(e),this.timer=setInterval(()=>this.upload(this.chunker.flush()),this.options.flushIntervalMs));}stop(){this.started&&(this.started=false,this.observer?.disconnect(),this.timer&&clearInterval(this.timer),this.upload(this.chunker.flush()));}captureFullSnapshot(e){let n=Me(this.adapt(e),this.allocator,this.options.mask,(r,i)=>{let s=r.ref;s&&this.mirror.set(s,i);});n&&this.push(2,{node:n});}observeMutations(e){let n=globalThis.MutationObserver;n&&(this.observer=new n(r=>{for(let i of r)this.handleMutation(i);}),this.observer.observe(e,{attributes:true,characterData:true,childList:true,subtree:true}));}handleMutation(e){if(e.type==="characterData"){let n=this.mirror.get(e.target);n!==void 0&&this.push(3,{texts:[{id:n,value:Ne(e.target.textContent??"",this.options.mask)}]});return}if(e.type==="attributes"&&e.attributeName){let n=this.mirror.get(e.target),r=e.target;n!==void 0&&this.push(3,{attributes:[{attributes:{[e.attributeName]:r.getAttribute(e.attributeName)??""},id:n}]});return}if(e.type==="childList"){let n=this.mirror.get(e.target);if(n===void 0)return;for(let r of Array.from(e.addedNodes)){let i=Me(this.adapt(r),this.allocator,this.options.mask,(s,o)=>{let a=s.ref;a&&this.mirror.set(a,o);});i&&this.push(3,{adds:[{node:i,parentId:n}]});}for(let r of Array.from(e.removedNodes)){let i=this.mirror.get(r);i!==void 0&&(this.push(3,{removes:[{id:i,parentId:n}]}),this.mirror.delete(r));}}}observeInteractions(e){e.addEventListener("input",n=>{let r=n.target;if(!r||!tr.has(r.tagName))return;let i=this.mirror.get(r);i!==void 0&&this.push(3,{input:{id:i,value:$e(r.value??"",r.type,this.options.mask)}});},true),e.addEventListener("scroll",n=>{let r=n.target,i=r?this.mirror.get(r):void 0;this.push(3,{scroll:{id:i??0,x:r?.scrollLeft??0,y:r?.scrollTop??0}});},true);}adapt(e){let n={childNodes:[],nodeType:e.nodeType,ref:e};if(e.nodeType===kt)return n.textValue=e.textContent??"",n;if(e.nodeType===xt){let r=e;if(n.tagName=r.tagName,n.attributes=Array.from(r.attributes).map(i=>({name:i.name,value:i.value})),tr.has(r.tagName)){let i=r;n.inputType=i.type,n.inputValue=i.value??"";}}return n.childNodes=Array.from(e.childNodes).map(r=>this.adapt(r)),n}push(e,n){let r=this.chunker.add({data:n,timestamp:this.options.now(),type:e});r&&this.upload(r);}upload(e){!e||!this.fetchImpl||er(e,{apiKey:this.options.apiKey,fetch:this.fetchImpl,replayHost:this.options.replayHost}).catch(n=>this.options.onError?.(n));}};function Gi(){return globalThis.document}function nr(t){let e=new De({apiKey:t.apiKey,distinctId:t.distinctId,flushIntervalMs:t.flushIntervalMs??5e3,mask:{...Qn,...t.mask},maxEvents:t.maxEvents??200,now:t.now??(()=>Date.now()),onError:t.onError,replayHost:t.replayHost,sessionId:t.sessionId??Ve()});return e.start(),e}var rr=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],ir=["gclid","gbraid","wbraid","fbclid","msclkid","ttclid","li_fat_id","twclid"];var St=(t,e)=>{let n=new URLSearchParams(t),r={};for(let i of [...rr,...ir]){let s=n.get(i)?.trim();s&&(r[i]=s.slice(0,255));}return e&&(r.$session_referrer=e),r},Vi=t=>{let e={};for(let n of [...rr,...ir])t[n]!==void 0&&(e[`$initial_${n}`]=t[n]);return e.$initial_referrer=t.$session_referrer??"$direct",e},ji=(t,e)=>{let n=t.getItem(e);if(n)try{let r=JSON.parse(n);return typeof r.sessionId=="string"&&typeof r.properties=="object"&&r.properties!==null?{properties:r.properties,sessionId:r.sessionId}:void 0}catch{return}},sr=(t,e)=>{let n=`pdx_${e}_session_touch`,r=`pdx_${e}_first_touch`;return {forSession:(i,s,o)=>{if(i===void 0)return {};let a=ji(t,n);if(a!==void 0&&a.sessionId===i)return a.properties;let u=St(s,o);return t.setItem(n,JSON.stringify({properties:u,sessionId:i})),t.getItem(r)?u:(t.setItem(r,"1"),{...u,$set_once:Vi(u)})}}};var qe=t=>`prodantix-cta:${t}`,or=t=>{try{let e=window.localStorage.getItem(qe(t));return e===null?null:Number(e)}catch{return null}},ar=t=>{try{return window.sessionStorage.getItem(qe(t))!==null}catch{return false}},dr=(t,e)=>{try{window.localStorage.setItem(qe(t),String(e)),window.sessionStorage.setItem(qe(t),String(e));}catch{return}},cr=(t,e,n,r)=>e===null?true:t.kind==="once"?false:t.kind==="session"?!n:r-e>=t.value*864e5;var H={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"}},Ke=t=>{let e=(t??"").toLowerCase().split("-")[0]??"";return e in H?e:"en"};var b="prodantix-cta",ur="prodantix-cta-style",Ui=`.${b}{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
2
  .${b} *{box-sizing:border-box}
3
3
  .${b} h2{font-size:18px;line-height:1.3;margin:0;font-weight:700}
4
4
  .${b} p{margin:0;font-size:15px;line-height:1.5}
@@ -19,7 +19,7 @@
19
19
  dialog.${b}{border:0;max-width:min(480px,calc(100vw - 32px));box-shadow:0 16px 48px rgba(0,0,0,.24)}
20
20
  dialog.${b}::backdrop{background:rgba(0,0,0,.45)}
21
21
  @media (prefers-reduced-motion:no-preference){.${b}[data-kind=slide_in],.${b}[data-kind=banner],dialog.${b}{animation:pdx-cta-in .2s ease-out}}
22
- @keyframes pdx-cta-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}`,Li=()=>{if(document.getElementById(nr))return;let t=document.createElement("style");t.id=nr,t.textContent=Fi,document.head.append(t);},$i=(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);},xt=(t,e,n,r)=>{let i=e.variant.content,s=H[n.language];if(t.className=b,t.dataset.kind=e.kind,t.dataset.placement=e.placement,t.dataset.ctaId=e.id,$i(t,e),i.image){let a=document.createElement("img");a.src=i.image,a.alt=i.imageAlt,a.loading="lazy",t.append(a);}let o=document.createElement("div");if(o.className="pdx-text",i.heading){let a=document.createElement("h2");a.textContent=i.heading,o.append(a);}if(i.body){let a=document.createElement("p");a.textContent=i.body,o.append(a);}if(t.append(o),i.buttons.length>0){let a=document.createElement("div");a.className="pdx-actions",i.buttons.forEach((u,l)=>{let c=document.createElement("button");c.type="button",c.textContent=u.label,c.dataset.action=`button-${l}`,l>0&&(c.dataset.secondary=""),c.addEventListener("click",()=>n.onButton(l)),a.append(c);}),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",s.close),a.title=s.close,a.addEventListener("click",r),t.append(a);}if(e.poweredBy){let a=document.createElement("p");a.className="pdx-meta",a.textContent=s.poweredBy,t.append(a);}},Be=(t,e)=>{Li();let n=t.variant.content.heading||t.variant.content.body;if(t.kind==="embedded"){let o=[...document.querySelectorAll("[data-prodantix-cta]")].filter(a=>a.dataset.prodantixCta===t.id).map(a=>{let u=document.createElement("section");return u.setAttribute("aria-label",n),xt(u,t,e,null),a.replaceChildren(u),u});return {destroy:()=>o.forEach(a=>a.remove()),elements:o}}if(t.kind==="popup"){let s=document.activeElement instanceof HTMLElement?document.activeElement:null,o=document.createElement("dialog");o.setAttribute("aria-label",n);let a=false,u=()=>{a||(a=true,o.open&&o.close(),o.remove(),s?.focus());},l=()=>{u(),e.onDismiss();};return xt(o,t,e,l),o.addEventListener("cancel",c=>{c.preventDefault(),l();}),document.body.append(o),o.showModal(),{destroy:u,elements:[o]}}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 xt(r,t,e,()=>{i(),e.onDismiss();}),document.body.append(r),{destroy:i,elements:[r]}};var rr=(t,e)=>{let n=false,r=[],i=()=>{n=true;for(let o of r.splice(0))o();},s=()=>{n||(i(),e());};if(t.kind==="load")queueMicrotask(s);else if(t.kind==="delay"){let o=setTimeout(s,t.value*1e3);r.push(()=>clearTimeout(o));}else if(t.kind==="scroll"){let o=()=>{let a=document.documentElement.scrollHeight-window.innerHeight;(a<=0||window.scrollY/a*100>=t.value)&&s();};window.addEventListener("scroll",o,{passive:true}),r.push(()=>window.removeEventListener("scroll",o)),o();}else if(t.kind==="exit"){let o=a=>{a.relatedTarget===null&&a.clientY<=0&&s();};document.addEventListener("mouseout",o),r.push(()=>document.removeEventListener("mouseout",o));}else {let o=t.value,a=l=>{try{return l.closest(o)!==null}catch{return false}},u=l=>{let c=l.target;c instanceof Element&&a(c)&&s();};document.addEventListener("click",u,true),r.push(()=>document.removeEventListener("click",u,true));}return i};var ir=t=>`prodantix-form-popup:${t}`,Ni=t=>{try{let e=window.localStorage.getItem(ir(t));return e===null?null:Number(e)}catch{return null}},Ri=(t,e)=>{try{window.localStorage.setItem(ir(t),String(e));}catch{return}},sr=(t,e,n)=>n===null||e-n>=t.periodDays*864e5,or=(t,e,n=Date.now)=>{if(!sr(t,n(),Ni(t.formId)))return ()=>{};let r=false,i=[],s=()=>{if(!r){r=true;for(let a of i)a();Ri(t.formId,n()),e();}},o=t.trigger;if(o.kind==="delay"){let a=setTimeout(s,o.seconds*1e3);i.push(()=>clearTimeout(a));}else if(o.kind==="scroll"){let a=()=>{let u=document.documentElement.scrollHeight-window.innerHeight;(u<=0||window.scrollY/u*100>=o.percent)&&s();};window.addEventListener("scroll",a,{passive:true}),i.push(()=>window.removeEventListener("scroll",a));}else {let a=u=>{u.relatedTarget===null&&u.clientY<=0&&s();};document.addEventListener("mouseout",a),i.push(()=>document.removeEventListener("mouseout",a));}return ()=>{r=true;for(let a of i)a();}};var Oi=t=>{let e=0;for(let n of t){if(n!==0)return e+Math.clz32(n)-24;e+=8;}return e},Mi=async t=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))),ar=async t=>{for(let e=0;;e+=1){let n=e.toString(36);if(Oi(await Mi(`${t.nonce}:${n}`))>=t.difficulty)return n}};var I="prodantix-form",Di=`.${I}{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)}
22
+ @keyframes pdx-cta-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}`,Wi=()=>{if(document.getElementById(ur))return;let t=document.createElement("style");t.id=ur,t.textContent=Ui,document.head.append(t);},zi=(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);},wt=(t,e,n,r)=>{let i=e.variant.content,s=H[n.language];if(t.className=b,t.dataset.kind=e.kind,t.dataset.placement=e.placement,t.dataset.ctaId=e.id,zi(t,e),i.image){let a=document.createElement("img");a.src=i.image,a.alt=i.imageAlt,a.loading="lazy",t.append(a);}let o=document.createElement("div");if(o.className="pdx-text",i.heading){let a=document.createElement("h2");a.textContent=i.heading,o.append(a);}if(i.body){let a=document.createElement("p");a.textContent=i.body,o.append(a);}if(t.append(o),i.buttons.length>0){let a=document.createElement("div");a.className="pdx-actions",i.buttons.forEach((u,c)=>{let l=document.createElement("button");l.type="button",l.textContent=u.label,l.dataset.action=`button-${c}`,c>0&&(l.dataset.secondary=""),l.addEventListener("click",()=>n.onButton(c)),a.append(l);}),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",s.close),a.title=s.close,a.addEventListener("click",r),t.append(a);}if(e.poweredBy){let a=document.createElement("p");a.className="pdx-meta",a.textContent=s.poweredBy,t.append(a);}},Be=(t,e)=>{Wi();let n=t.variant.content.heading||t.variant.content.body;if(t.kind==="embedded"){let o=[...document.querySelectorAll("[data-prodantix-cta]")].filter(a=>a.dataset.prodantixCta===t.id).map(a=>{let u=document.createElement("section");return u.setAttribute("aria-label",n),wt(u,t,e,null),a.replaceChildren(u),u});return {destroy:()=>o.forEach(a=>a.remove()),elements:o}}if(t.kind==="popup"){let s=document.activeElement instanceof HTMLElement?document.activeElement:null,o=document.createElement("dialog");o.setAttribute("aria-label",n);let a=false,u=()=>{a||(a=true,o.open&&o.close(),o.remove(),s?.focus());},c=()=>{u(),e.onDismiss();};return wt(o,t,e,c),o.addEventListener("cancel",l=>{l.preventDefault(),c();}),document.body.append(o),o.showModal(),{destroy:u,elements:[o]}}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 wt(r,t,e,()=>{i(),e.onDismiss();}),document.body.append(r),{destroy:i,elements:[r]}};var lr=(t,e)=>{let n=false,r=[],i=()=>{n=true;for(let o of r.splice(0))o();},s=()=>{n||(i(),e());};if(t.kind==="load")queueMicrotask(s);else if(t.kind==="delay"){let o=setTimeout(s,t.value*1e3);r.push(()=>clearTimeout(o));}else if(t.kind==="scroll"){let o=()=>{let a=document.documentElement.scrollHeight-window.innerHeight;(a<=0||window.scrollY/a*100>=t.value)&&s();};window.addEventListener("scroll",o,{passive:true}),r.push(()=>window.removeEventListener("scroll",o)),o();}else if(t.kind==="exit"){let o=a=>{a.relatedTarget===null&&a.clientY<=0&&s();};document.addEventListener("mouseout",o),r.push(()=>document.removeEventListener("mouseout",o));}else {let o=t.value,a=c=>{try{return c.closest(o)!==null}catch{return false}},u=c=>{let l=c.target;l instanceof Element&&a(l)&&s();};document.addEventListener("click",u,true),r.push(()=>document.removeEventListener("click",u,true));}return i};var pr=t=>`prodantix-form-popup:${t}`,Ji=t=>{try{let e=window.localStorage.getItem(pr(t));return e===null?null:Number(e)}catch{return null}},Yi=(t,e)=>{try{window.localStorage.setItem(pr(t),String(e));}catch{return}},mr=(t,e,n)=>n===null||e-n>=t.periodDays*864e5,fr=(t,e,n=Date.now)=>{if(!mr(t,n(),Ji(t.formId)))return ()=>{};let r=false,i=[],s=()=>{if(!r){r=true;for(let a of i)a();Yi(t.formId,n()),e();}},o=t.trigger;if(o.kind==="delay"){let a=setTimeout(s,o.seconds*1e3);i.push(()=>clearTimeout(a));}else if(o.kind==="scroll"){let a=()=>{let u=document.documentElement.scrollHeight-window.innerHeight;(u<=0||window.scrollY/u*100>=o.percent)&&s();};window.addEventListener("scroll",a,{passive:true}),i.push(()=>window.removeEventListener("scroll",a));}else {let a=u=>{u.relatedTarget===null&&u.clientY<=0&&s();};document.addEventListener("mouseout",a),i.push(()=>document.removeEventListener("mouseout",a));}return ()=>{r=true;for(let a of i)a();}};var Qi=t=>{let e=0;for(let n of t){if(n!==0)return e+Math.clz32(n)-24;e+=8;}return e},Xi=async t=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))),gr=async t=>{for(let e=0;;e+=1){let n=e.toString(36);if(Qi(await Xi(`${t.nonce}:${n}`))>=t.difficulty)return n}};var I="prodantix-form",Zi=`.${I}{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
23
  .${I} *{box-sizing:border-box}
24
24
  .${I} .pdx-field{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
25
25
  .${I} .pdx-field[hidden]{display:none}
@@ -32,6 +32,6 @@ dialog.${b}::backdrop{background:rgba(0,0,0,.45)}
32
32
  .${I} button[data-variant=back]{background:transparent;color:inherit;border:1px solid currentColor}
33
33
  .${I} .pdx-actions{display:flex;gap:8px;justify-content:flex-end}
34
34
  .${I} .pdx-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
35
- .${I} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,dr=t=>t==null||t===false||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0,lr=(t,e)=>{let n=t.condition;if(!n)return true;let r=e[n.field];return dr(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(s=>typeof s=="string"&&n.values.includes(s))},qi=t=>{let e=`${encodeURIComponent(t)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(e));return n?decodeURIComponent(n.slice(e.length)):""},Ki=t=>{let e=t.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?new URLSearchParams(window.location.search).get(e.value)??"":qi(e.value):""},m=(t,e={},n=[])=>{let r=Object.assign(document.createElement(t),e);return r.append(...n),r},Bi=(t,e,n)=>{let r=m("p",{className:"pdx-error",id:`${e}-error`}),i=t.help?m("p",{className:"pdx-help",id:`${e}-help`},[t.help]):null,s=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),o=m("div",{className:"pdx-field"});if(o.dataset.field=t.key,t.kind==="rich_text")return o.append(m("p",{},[t.label])),{error:r,field:t,focus:()=>{},read:()=>{},root:o};if(t.kind==="hidden")return o.hidden=true,{error:r,field:t,focus:()=>{},read:()=>Ki(t),root:o};if(t.kind==="radio"||t.kind==="checkboxes"){let c=m("fieldset",{});c.setAttribute("aria-describedby",s),t.required&&c.setAttribute("aria-required","true"),c.append(m("legend",{},[t.label]));let p=t.options.filter(L=>!L.archived).map((L,A)=>{let R=m("input",{id:`${e}-${A}`,name:e,type:t.kind==="radio"?"radio":"checkbox",value:L.value});return R.addEventListener("change",n),c.append(m("div",{className:"pdx-choice"},[R,m("label",{htmlFor:`${e}-${A}`},[L.label])])),R});return o.append(c,...i?[i]:[],r),{error:r,field:t,focus:()=>p[0]?.focus(),read:()=>{let L=p.filter(A=>A.checked).map(A=>A.value);return t.kind==="radio"?L[0]??"":L},root:o}}let a=m("label",{htmlFor:e},[t.label]),u;if(t.kind==="textarea")u=m("textarea",{id:e,placeholder:t.placeholder,rows:4});else if(t.kind==="dropdown")u=m("select",{id:e},[m("option",{value:""},[""]),...t.options.filter(c=>!c.archived).map(c=>m("option",{value:c.value},[c.label]))]);else if(t.kind==="checkbox")u=m("input",{id:e,type:"checkbox"});else {let c={date:"date",email:"email",file:"file",number:"number",phone:"tel"};u=m("input",{id:e,placeholder:t.placeholder,type:c[t.kind]??"text"}),t.kind==="email"&&(u.autocomplete="email");}return u.setAttribute("aria-describedby",s),t.required&&u.setAttribute("aria-required","true"),u.addEventListener("input",n),u.addEventListener("change",n),t.kind==="checkbox"?o.append(m("div",{className:"pdx-choice"},[u,a]),...i?[i]:[],r):o.append(a,...i?[i]:[],u,r),{error:r,field:t,focus:()=>u.focus(),read:()=>u instanceof HTMLInputElement&&u.type==="checkbox"?u.checked:t.kind==="number"?u.value===""?"":Number(u.value):u.value,root:o}},Hi=(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,s]of Object.entries(r))t.style.setProperty(i,s);},Gi=()=>{document.getElementById("prodantix-form-style")||document.head.append(m("style",{id:"prodantix-form-style",textContent:Di}));},He=(t,e)=>{let{formId:n,host:r,language:i}=e,s=H[i],o=p=>s[p],a=m("form",{className:I,noValidate:true});a.dataset.prodantixForm=n;let u=m("p",{className:"pdx-meta"});u.setAttribute("aria-live","polite"),u.setAttribute("role","status");let l=false,c=r.form(n).then(p=>{if(l)return;if(!p.accepting){a.replaceChildren(m("p",{className:"pdx-meta"},[o("closed")]));return}Gi(),Hi(a,p);let S=p.challenge?ar(p.challenge):null,L=false,A=[],R=()=>{let f={};for(let k of A.flat())if(!k.root.hidden||k.field.kind==="hidden"){let $=k.read();$!==void 0&&(f[k.field.key]=$);}return f},M=()=>{let f=R();for(let k of A.flat())k.field.kind!=="hidden"&&(k.root.hidden=!lr(k.field,f));},N=()=>{L||(L=true,r.capture(en,{$form_id:p.id,$form_version:p.version})),M();},O=p.steps.map((f,k)=>{let $=m("div",{});$.dataset.step=String(k),f.title&&$.append(m("p",{className:"pdx-meta"},[f.title]));let x=f.fields.map(K=>Bi(K,`pdx-${n}-${K.key}`,N));return A.push(x),$.append(...x.map(K=>K.root)),$}),G=m("input",{autocomplete:"off",name:p.honeypot,tabIndex:-1,type:"text"}),q=m("div",{className:"pdx-hp"},[G]);q.setAttribute("aria-hidden","true");let B=[],v=m("div",{});if(p.consent.processing){let f=m("input",{id:`pdx-${n}-consent`,type:"checkbox"});f.setAttribute("aria-required","true"),B.push({input:f,key:"$consent_processing"}),v.append(m("div",{className:"pdx-choice"},[f,m("label",{htmlFor:f.id},[p.consent.processing])]));}for(let f of p.consent.purposes){let k=m("input",{id:`pdx-${n}-consent-${f.key}`,type:"checkbox"});B.push({input:k,key:`$consent_${f.key}`}),v.append(m("div",{className:"pdx-choice"},[k,m("label",{htmlFor:k.id},[f.label])])),f.notice&&v.append(m("p",{className:"pdx-help"},[f.notice]));}let h=m("p",{className:"pdx-meta"}),C=m("button",{type:"button"},[o("back")]);C.dataset.variant="back";let E=m("button",{type:"button"},[o("next")]),P=m("button",{type:"submit"},[o("submit")]);C.dataset.action="back",E.dataset.action="next",P.dataset.action="submit";let Et=m("div",{className:"pdx-actions"},[C,E,P]),y=0,Ge=()=>{O.forEach((k,$)=>{k.hidden=$!==y;});let f=y===O.length-1;C.hidden=y===0,E.hidden=f,P.hidden=!f,v.hidden=!f,h.hidden=O.length<2,h.textContent=o("step").replace("{step}",String(y+1)).replace("{total}",String(O.length));},fr=()=>{for(let f of A.flat())f.error.textContent="",f.root.querySelector("[aria-invalid]")?.removeAttribute("aria-invalid");},wt=(f,k)=>{f.error.textContent=k,f.root.querySelector("input,select,textarea,fieldset")?.setAttribute("aria-invalid","true");},Ct=f=>{fr();let k=R(),$=(A[f]??[]).filter(x=>!x.root.hidden&&x.field.required&&dr(k[x.field.key]));for(let x of $)wt(x,o("required"));return $.length>0?(u.textContent=o("required"),$[0]?.focus(),false):true};C.addEventListener("click",()=>{y=Math.max(0,y-1),Ge();}),E.addEventListener("click",()=>{Ct(y)&&(y+=1,Ge());}),a.addEventListener("submit",f=>{if(f.preventDefault(),!Ct(y))return;let k={...R(),[p.honeypot]:G.value};for(let x of B)k[x.key]=x.input.checked;P.disabled=true,P.textContent=o("sending");let $=p.challenge;if(!$||!S){u.textContent=o("closed");return}S.then(x=>r.submit(n,k,$,x)).then(x=>{if(x.kind==="redirect"&&x.value.startsWith("https://")){window.location.assign(x.value);return}let K=m("p",{},[x.kind==="message"&&x.value?x.value:o("thanks")]);K.setAttribute("role","status"),a.replaceChildren(K);}).catch(x=>{P.disabled=false,P.textContent=o("submit");let K=x instanceof te?x.fields:[];for(let Tt of K){let It=A.flat().find(hr=>hr.field.key===Tt.field);It&&wt(It,Tt.rule==="required"?o("required"):o("invalid"));}u.textContent=K.length>0?o("invalid"):o("failed");});}),a.append(h,...O,q,v,Et,u),p.poweredBy&&e.poweredBy!==false&&a.append(m("p",{className:"pdx-meta"},[o("poweredBy")])),Ge(),M(),r.capture(Zt,{$form_id:p.id,$form_version:p.version});}).catch(()=>{l||a.replaceChildren(m("p",{className:"pdx-meta"},[o("closed")]));});return t.append(a),{destroy:()=>{l=true,a.remove();},ready:c}};var St=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 cr=t=>({capture:(e,n,r)=>t.captureCta(e,n,r),ctas:e=>t.getCtas(e),forms:St(t),isEnabled:e=>t.isFeatureEnabled(e),variant:async e=>(await t.getVariant(e))?.key??null}),ur=t=>t<768?"mobile":t<1024?"tablet":"desktop",pr=async(t,e)=>{let n=e.flag;return n?n.variant?await t.variant(n.key)===n.variant:t.isEnabled(n.key):true},ji=(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",H[n].close),i.title=H[n].close,i.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(i),document.body.append(r),He(r,{formId:t,host:e,language:n}),r.showModal();},Vi=()=>{let t=window.prodantix;typeof t=="function"&&t("open");},mr=async(t,e)=>{let n=e.now??Date.now,r=e.open??(l=>window.location.assign(l)),i=[],s=[],o=false,a=()=>{o=true;for(let l of i.splice(0))l();for(let l of s.splice(0))l.destroy();},u=await t.ctas({device:ur(window.innerWidth),language:document.documentElement.lang||e.language,url:window.location.href});for(let l of u)o||!tr(l.frequency,Xn(l.id),Zn(l.id),n())||!await pr(t,l)||i.push(rr(l.trigger,()=>{if(o)return;let c=Be(l,{language:e.language,onButton:p=>{t.capture(qt,l,p);let S=l.variant.content.buttons[p]?.action;S&&((S.kind!=="url"||l.kind!=="embedded")&&c.destroy(),S.kind==="url"?r(S.value):S.kind==="form"?ji(S.value,t.forms,e.language):S.kind==="messenger"?Vi():t.capture(Ve,l));},onDismiss:()=>t.capture(Ve,l)});c.elements.length!==0&&(s.push(c),er(l.id,n()),t.capture(Dt,l));}));return a},Ui=()=>{},zi=(t,e)=>{let n=cr(t),r=Ke(e??document.documentElement.lang),i=()=>mr(n,{language:r}).catch(c=>(console.error("[prodantix] the CTAs for this page could not be read",c),Ui)),s=i(),o=window.location.href,a=()=>{if(window.location.href===o)return;o=window.location.href,s=s.then(p=>(p(),i()));},u=history.pushState.bind(history),l=history.replaceState.bind(history);return history.pushState=(...c)=>{u(...c),a();},history.replaceState=(...c)=>{l(...c),a();},window.addEventListener("popstate",a),()=>{history.pushState=u,history.replaceState=l,window.removeEventListener("popstate",a),s.then(c=>c());}};var Q=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async request(e,n){let r=this.fetch;if(!r)throw new g("no fetch implementation available in this runtime");let i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(o["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:o,method:n.method,signal:i?.signal});return {status:a.status,text:await a.text()}}finally{s!==void 0&&clearTimeout(s);}}async vapidKey(e){let{status:n,text:r}=await this.request(`/v1/push/vapid?appId=${encodeURIComponent(e)}`,{method:"GET"});if(n<200||n>=300)throw new g(`push key request failed with status ${n}`,n);return JSON.parse(r).publicKey}async register(e){let{status:n,text:r}=await this.request("/v1/push/devices",{body:JSON.stringify(e),method:"POST"});if(n<200||n>=300)throw new g(`push registration failed with status ${n}`,n);return JSON.parse(r).id}async opened(e){let{status:n}=await this.request("/v1/push/opens",{body:JSON.stringify({sendId:e}),method:"POST"});if(n<200||n>=300)throw new g(`push open report failed with status ${n}`,n)}};var gr="/prodantix-push-sw.js",Wi=()=>{let t=globalThis,e=t.navigator?.serviceWorker,n=t.Notification;return e===void 0||n===void 0||t.PushManager===void 0?null:{register:async r=>(await e.register(r),e.ready),requestPermission:()=>n.requestPermission()}},Ji=t=>{let e=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(t.length/4)*4,"="),n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))},Yi=(t,e,n)=>`${t}${t.includes("?")?"&":"?"}host=${encodeURIComponent(e)}&key=${encodeURIComponent(n)}`,Qi=async t=>{let e=t.browser??Wi();if(e===null)return {status:"unsupported"};if(await e.requestPermission()!=="granted")return {status:"denied"};let r=new Q({fetch:t.fetch,host:t.host,projectKey:t.apiKey}),i=await e.register(Yi(t.serviceWorker??gr,t.host,t.apiKey)),s=await i.pushManager.getSubscription()??await i.pushManager.subscribe({applicationServerKey:Ji(await r.vapidKey(t.appId)),userVisibleOnly:true});return {deviceId:await r.register({appId:t.appId,distinctId:t.distinctId,permission:"granted",platform:"web",token:JSON.stringify(s.toJSON())}),status:"registered"}};function Xi(){return globalThis.navigator}function Zi(){return globalThis.document}function es(){return globalThis.history}function ts(){return globalThis.location}function ns(t){let e=t?.userAgentData?.platform??t?.platform;return e?e.slice(0,50):void 0}function rs(t){let e=()=>{t.flush();};globalThis.document?.addEventListener?.("visibilitychange",e),globalThis.addEventListener?.("pagehide",e);}function is(t,e,n){try{return ft({domain:e,name:`pdx_${ee(t)}`})??n}catch{return n}}function kd(t){let{autocaptureOptions:e,cookieDomain:n,guides:r,linkedDomains:i,replayHost:s,sessionReplay:o,sessionReplayOptions:a,surveys:u,...l}=t,c=Xi(),p=Pt(),S=l.storage??p,L=l.sharedStorage??is(l.apiKey,n,p),A=Vn({history:es(),location:ts(),namespace:ee(l.apiKey),now:(l.clock??oe).now().getTime(),shared:L,storage:S}),R=Ie(l.onError??(()=>{})),M={...l,describeElement:l.describeElement??(q=>Sn(q,R)),locale:l.locale??(c?.language?c.language.slice(0,20):void 0),os:l.os??ns(c),sessionTracking:l.sessionTracking??true,sharedStorage:L,storage:S,transport:l.transport??new _e({maxRetries:l.maxRetries,requestTimeoutMs:l.requestTimeoutMs})},N=new Te(M);A!==void 0&&N.alias(A),rs(N),M.consentMode==="banner"&&typeof window<"u"&&_n(N,window),(t.autocapture??true)&&In(N,{onError:M.onError,...e});let O=Zi();O&&i&&ht(O,N,i);let G=typeof window>"u"?void 0:window;if(G&&(u!==false||r!==false)&&Mn(N,G,{edgeHost:(l.flagsHost??l.host).replace(/\/+$/,""),guides:r!==false,namespace:ee(l.apiKey),onError:M.onError??(()=>{}),storage:S,surveys:u!==false}),o&&s){let q=()=>{Qn({apiKey:M.apiKey,distinctId:()=>N.distinctId,onError:M.onError,replayHost:s,...a,sessionId:a?.sessionId??N.sessionId});};if(N.isCookieless()){let B=N.onStorageAllowed(()=>{B(),q();});}else q();}return N}
36
- exports.ACTION_ATTRIBUTE=kn;exports.ANNOTATION_ATTRIBUTE=bn;exports.ANNOTATION_MAX_LENGTH=Y;exports.DEFAULT_SERVICE_WORKER=gr;exports.IGNORE_ATTRIBUTE=xn;exports.PushClient=Q;exports.WebTransport=_e;exports.createCookieStorage=ft;exports.createWebClient=kd;exports.ctasHost=cr;exports.decorateLink=Hn;exports.deviceOf=ur;exports.flagAllows=pr;exports.formLanguage=Ke;exports.formsHost=St;exports.installAutocapture=In;exports.installLinkCarry=ht;exports.installSessionReplay=Qn;exports.readCarry=Gn;exports.registerPush=Qi;exports.renderCta=Be;exports.renderForm=He;exports.resolveCookieDomain=$n;exports.runCtas=mr;exports.startCtas=zi;exports.stripCarry=jn;exports.watchPopup=or;//# sourceMappingURL=web.cjs.map
35
+ .${I} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,hr=t=>t==null||t===false||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0,yr=(t,e)=>{let n=t.condition;if(!n)return true;let r=e[n.field];return hr(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(s=>typeof s=="string"&&n.values.includes(s))},es=t=>{let e=`${encodeURIComponent(t)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(e));return n?decodeURIComponent(n.slice(e.length)):""},ts=t=>{let e=t.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?new URLSearchParams(window.location.search).get(e.value)??"":es(e.value):""},m=(t,e={},n=[])=>{let r=Object.assign(document.createElement(t),e);return r.append(...n),r},ns=(t,e,n)=>{let r=m("p",{className:"pdx-error",id:`${e}-error`}),i=t.help?m("p",{className:"pdx-help",id:`${e}-help`},[t.help]):null,s=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),o=m("div",{className:"pdx-field"});if(o.dataset.field=t.key,t.kind==="rich_text")return o.append(m("p",{},[t.label])),{error:r,field:t,focus:()=>{},read:()=>{},root:o};if(t.kind==="hidden")return o.hidden=true,{error:r,field:t,focus:()=>{},read:()=>ts(t),root:o};if(t.kind==="radio"||t.kind==="checkboxes"){let l=m("fieldset",{});l.setAttribute("aria-describedby",s),t.required&&l.setAttribute("aria-required","true"),l.append(m("legend",{},[t.label]));let p=t.options.filter($=>!$.archived).map(($,_)=>{let R=m("input",{id:`${e}-${_}`,name:e,type:t.kind==="radio"?"radio":"checkbox",value:$.value});return R.addEventListener("change",n),l.append(m("div",{className:"pdx-choice"},[R,m("label",{htmlFor:`${e}-${_}`},[$.label])])),R});return o.append(l,...i?[i]:[],r),{error:r,field:t,focus:()=>p[0]?.focus(),read:()=>{let $=p.filter(_=>_.checked).map(_=>_.value);return t.kind==="radio"?$[0]??"":$},root:o}}let a=m("label",{htmlFor:e},[t.label]),u;if(t.kind==="textarea")u=m("textarea",{id:e,placeholder:t.placeholder,rows:4});else if(t.kind==="dropdown")u=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")u=m("input",{id:e,type:"checkbox"});else {let l={date:"date",email:"email",file:"file",number:"number",phone:"tel"};u=m("input",{id:e,placeholder:t.placeholder,type:l[t.kind]??"text"}),t.kind==="email"&&(u.autocomplete="email");}return u.setAttribute("aria-describedby",s),t.required&&u.setAttribute("aria-required","true"),u.addEventListener("input",n),u.addEventListener("change",n),t.kind==="checkbox"?o.append(m("div",{className:"pdx-choice"},[u,a]),...i?[i]:[],r):o.append(a,...i?[i]:[],u,r),{error:r,field:t,focus:()=>u.focus(),read:()=>u instanceof HTMLInputElement&&u.type==="checkbox"?u.checked:t.kind==="number"?u.value===""?"":Number(u.value):u.value,root:o}},rs=(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,s]of Object.entries(r))t.style.setProperty(i,s);},is=()=>{document.getElementById("prodantix-form-style")||document.head.append(m("style",{id:"prodantix-form-style",textContent:Zi}));},He=(t,e)=>{let{formId:n,host:r,language:i}=e,s=H[i],o=p=>s[p],a=m("form",{className:I,noValidate:true});a.dataset.prodantixForm=n;let u=m("p",{className:"pdx-meta"});u.setAttribute("aria-live","polite"),u.setAttribute("role","status");let c=false,l=r.form(n).then(p=>{if(c)return;if(!p.accepting){a.replaceChildren(m("p",{className:"pdx-meta"},[o("closed")]));return}is(),rs(a,p);let x=p.challenge?gr(p.challenge):null,$=false,_=[],R=()=>{let h={};for(let k of _.flat())if(!k.root.hidden||k.field.kind==="hidden"){let N=k.read();N!==void 0&&(h[k.field.key]=N);}return h},B=()=>{let h=R();for(let k of _.flat())k.field.kind!=="hidden"&&(k.root.hidden=!yr(k.field,h));},X=()=>{$||($=true,r.capture(rn,{$form_id:p.id,$form_version:p.version})),B();},O=p.steps.map((h,k)=>{let N=m("div",{});N.dataset.step=String(k),h.title&&N.append(m("p",{className:"pdx-meta"},[h.title]));let S=h.fields.map(q=>ns(q,`pdx-${n}-${q.key}`,X));return _.push(S),N.append(...S.map(q=>q.root)),N}),M=m("input",{autocomplete:"off",name:p.honeypot,tabIndex:-1,type:"text"}),P=m("div",{className:"pdx-hp"},[M]);P.setAttribute("aria-hidden","true");let K=[],y=m("div",{});if(p.consent.processing){let h=m("input",{id:`pdx-${n}-consent`,type:"checkbox"});h.setAttribute("aria-required","true"),K.push({input:h,key:"$consent_processing"}),y.append(m("div",{className:"pdx-choice"},[h,m("label",{htmlFor:h.id},[p.consent.processing])]));}for(let h of p.consent.purposes){let k=m("input",{id:`pdx-${n}-consent-${h.key}`,type:"checkbox"});K.push({input:k,key:`$consent_${h.key}`}),y.append(m("div",{className:"pdx-choice"},[k,m("label",{htmlFor:k.id},[h.label])])),h.notice&&y.append(m("p",{className:"pdx-help"},[h.notice]));}let g=m("p",{className:"pdx-meta"}),T=m("button",{type:"button"},[o("back")]);T.dataset.variant="back";let E=m("button",{type:"button"},[o("next")]),A=m("button",{type:"submit"},[o("submit")]);T.dataset.action="back",E.dataset.action="next",A.dataset.action="submit";let Ct=m("div",{className:"pdx-actions"},[T,E,A]),v=0,Ge=()=>{O.forEach((k,N)=>{k.hidden=N!==v;});let h=v===O.length-1;T.hidden=v===0,E.hidden=h,A.hidden=!h,y.hidden=!h,g.hidden=O.length<2,g.textContent=o("step").replace("{step}",String(v+1)).replace("{total}",String(O.length));},Er=()=>{for(let h of _.flat())h.error.textContent="",h.root.querySelector("[aria-invalid]")?.removeAttribute("aria-invalid");},It=(h,k)=>{h.error.textContent=k,h.root.querySelector("input,select,textarea,fieldset")?.setAttribute("aria-invalid","true");},_t=h=>{Er();let k=R(),N=(_[h]??[]).filter(S=>!S.root.hidden&&S.field.required&&hr(k[S.field.key]));for(let S of N)It(S,o("required"));return N.length>0?(u.textContent=o("required"),N[0]?.focus(),false):true};T.addEventListener("click",()=>{v=Math.max(0,v-1),Ge();}),E.addEventListener("click",()=>{_t(v)&&(v+=1,Ge());}),a.addEventListener("submit",h=>{if(h.preventDefault(),!_t(v))return;let k={...R(),[p.honeypot]:M.value};for(let S of K)k[S.key]=S.input.checked;A.disabled=true,A.textContent=o("sending");let N=p.challenge;if(!N||!x){u.textContent=o("closed");return}x.then(S=>r.submit(n,k,N,S)).then(S=>{if(S.kind==="redirect"&&S.value.startsWith("https://")){window.location.assign(S.value);return}let q=m("p",{},[S.kind==="message"&&S.value?S.value:o("thanks")]);q.setAttribute("role","status"),a.replaceChildren(q);}).catch(S=>{A.disabled=false,A.textContent=o("submit");let q=S instanceof te?S.fields:[];for(let Pt of q){let At=_.flat().find(Tr=>Tr.field.key===Pt.field);At&&It(At,Pt.rule==="required"?o("required"):o("invalid"));}u.textContent=q.length>0?o("invalid"):o("failed");});}),a.append(g,...O,P,y,Ct,u),p.poweredBy&&e.poweredBy!==false&&a.append(m("p",{className:"pdx-meta"},[o("poweredBy")])),Ge(),B(),r.capture(nn,{$form_id:p.id,$form_version:p.version});}).catch(()=>{c||a.replaceChildren(m("p",{className:"pdx-meta"},[o("closed")]));});return t.append(a),{destroy:()=>{c=true,a.remove();},ready:l}};var Et=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 vr=t=>({capture:(e,n,r)=>t.captureCta(e,n,r),ctas:e=>t.getCtas(e),forms:Et(t),isEnabled:e=>t.isFeatureEnabled(e),variant:async e=>(await t.getVariant(e))?.key??null}),br=t=>t<768?"mobile":t<1024?"tablet":"desktop",xr=async(t,e)=>{let n=e.flag;return n?n.variant?await t.variant(n.key)===n.variant:t.isEnabled(n.key):true},ss=(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",H[n].close),i.title=H[n].close,i.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(i),document.body.append(r),He(r,{formId:t,host:e,language:n}),r.showModal();},os=()=>{let t=window.prodantix;typeof t=="function"&&t("open");},kr=async(t,e)=>{let n=e.now??Date.now,r=e.open??(c=>window.location.assign(c)),i=[],s=[],o=false,a=()=>{o=true;for(let c of i.splice(0))c();for(let c of s.splice(0))c.destroy();},u=await t.ctas({device:br(window.innerWidth),language:document.documentElement.lang||e.language,url:window.location.href});for(let c of u)o||!cr(c.frequency,or(c.id),ar(c.id),n())||!await xr(t,c)||i.push(lr(c.trigger,()=>{if(o)return;let l=Be(c,{language:e.language,onButton:p=>{t.capture(Ht,c,p);let x=c.variant.content.buttons[p]?.action;x&&((x.kind!=="url"||c.kind!=="embedded")&&l.destroy(),x.kind==="url"?r(x.value):x.kind==="form"?ss(x.value,t.forms,e.language):x.kind==="messenger"?os():t.capture(je,c));},onDismiss:()=>t.capture(je,c)});l.elements.length!==0&&(s.push(l),dr(c.id,n()),t.capture(Bt,c));}));return a},as=()=>{},ds=(t,e)=>{let n=vr(t),r=Ke(e??document.documentElement.lang),i=()=>kr(n,{language:r}).catch(l=>(console.error("[prodantix] the CTAs for this page could not be read",l),as)),s=i(),o=window.location.href,a=()=>{if(window.location.href===o)return;o=window.location.href,s=s.then(p=>(p(),i()));},u=history.pushState.bind(history),c=history.replaceState.bind(history);return history.pushState=(...l)=>{u(...l),a();},history.replaceState=(...l)=>{c(...l),a();},window.addEventListener("popstate",a),()=>{history.pushState=u,history.replaceState=c,window.removeEventListener("popstate",a),s.then(l=>l());}};var Q=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=F(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async request(e,n){let r=this.fetch;if(!r)throw new f("no fetch implementation available in this runtime");let i=L(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(o["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:o,method:n.method,signal:i?.signal});return {status:a.status,text:await a.text()}}finally{s!==void 0&&clearTimeout(s);}}async vapidKey(e){let{status:n,text:r}=await this.request(`/v1/push/vapid?appId=${encodeURIComponent(e)}`,{method:"GET"});if(n<200||n>=300)throw new f(`push key request failed with status ${n}`,n);return JSON.parse(r).publicKey}async register(e){let{status:n,text:r}=await this.request("/v1/push/devices",{body:JSON.stringify(e),method:"POST"});if(n<200||n>=300)throw new f(`push registration failed with status ${n}`,n);return JSON.parse(r).id}async opened(e){let{status:n}=await this.request("/v1/push/opens",{body:JSON.stringify({sendId:e}),method:"POST"});if(n<200||n>=300)throw new f(`push open report failed with status ${n}`,n)}};var Sr="/prodantix-push-sw.js",cs=()=>{let t=globalThis,e=t.navigator?.serviceWorker,n=t.Notification;return e===void 0||n===void 0||t.PushManager===void 0?null:{register:async r=>(await e.register(r),e.ready),requestPermission:()=>n.requestPermission()}},us=t=>{let e=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(t.length/4)*4,"="),n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))},ls=(t,e,n)=>`${t}${t.includes("?")?"&":"?"}host=${encodeURIComponent(e)}&key=${encodeURIComponent(n)}`,ps=async t=>{let e=t.browser??cs();if(e===null)return {status:"unsupported"};if(await e.requestPermission()!=="granted")return {status:"denied"};let r=new Q({fetch:t.fetch,host:t.host,projectKey:t.apiKey}),i=await e.register(ls(t.serviceWorker??Sr,t.host,t.apiKey)),s=await i.pushManager.getSubscription()??await i.pushManager.subscribe({applicationServerKey:us(await r.vapidKey(t.appId)),userVisibleOnly:true});return {deviceId:await r.register({appId:t.appId,distinctId:t.distinctId,permission:"granted",platform:"web",token:JSON.stringify(s.toJSON())}),status:"registered"}};function ms(){return globalThis.navigator}function fs(){return globalThis.document}function gs(){return globalThis.history}function Tt(){return globalThis.location}function wr(){let t=globalThis.document?.referrer;if(t)try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"?`${e.origin}${e.pathname}`:void 0}catch{return}}function hs(t){let e=t?.userAgentData?.platform??t?.platform;return e?e.slice(0,50):void 0}function ys(t){let e=()=>{t.flush();};globalThis.document?.addEventListener?.("visibilitychange",e),globalThis.addEventListener?.("pagehide",e);}function vs(t,e,n){try{return ht({domain:e,name:`pdx_${W(t)}`})??n}catch{return n}}function Kd(t){let{autocaptureOptions:e,cookieDomain:n,guides:r,linkedDomains:i,replayHost:s,sessionReplay:o,sessionReplayOptions:a,surveys:u,...c}=t,l=ms(),p=Lt(),x=c.storage??p,$=c.sharedStorage??vs(c.apiKey,n,p),_=Yn({history:gs(),location:Tt(),namespace:W(c.apiKey),now:(c.clock??oe).now().getTime(),shared:$,storage:x}),R=Ie(c.onError??(()=>{})),B={},X=sr(x,W(c.apiKey)),O=c.defaultProperties,M={...c,defaultProperties:()=>({...typeof O=="function"?O():O??{},...B.client?.isCookieless()?St(Tt()?.search??"",wr()):X.forSession(B.client?.sessionId,Tt()?.search??"",wr())}),describeElement:c.describeElement??(g=>Tn(g,R)),locale:c.locale??(l?.language?l.language.slice(0,20):void 0),os:c.os??hs(l),sessionTracking:c.sessionTracking??true,sharedStorage:$,storage:x,transport:c.transport??new Ae({maxRetries:c.maxRetries,requestTimeoutMs:c.requestTimeoutMs})},P=new Ce(M);B.client=P,_!==void 0&&P.alias(_),ys(P),M.consentMode==="banner"&&typeof window<"u"&&Rn(P,window),(t.autocapture??true)&&Ln(P,{onError:M.onError,...e});let K=fs();K&&i&&yt(K,P,i);let y=typeof window>"u"?void 0:window;if(y&&(u!==false||r!==false)&&Hn(P,y,{edgeHost:(c.flagsHost??c.host).replace(/\/+$/,""),guides:r!==false,namespace:W(c.apiKey),onError:M.onError??(()=>{}),storage:x,surveys:u!==false}),o&&s){let g=()=>{nr({apiKey:M.apiKey,distinctId:()=>P.distinctId,onError:M.onError,replayHost:s,...a,sessionId:a?.sessionId??P.sessionId});};if(P.isCookieless()){let T=P.onStorageAllowed(()=>{T(),g();});}else g();}return P}
36
+ exports.ACTION_ATTRIBUTE=wn;exports.ANNOTATION_ATTRIBUTE=Sn;exports.ANNOTATION_MAX_LENGTH=Y;exports.DEFAULT_SERVICE_WORKER=Sr;exports.IGNORE_ATTRIBUTE=En;exports.PushClient=Q;exports.WebTransport=Ae;exports.createCookieStorage=ht;exports.createWebClient=Kd;exports.ctasHost=vr;exports.decorateLink=Wn;exports.deviceOf=br;exports.flagAllows=xr;exports.formLanguage=Ke;exports.formsHost=Et;exports.installAutocapture=Ln;exports.installLinkCarry=yt;exports.installSessionReplay=nr;exports.readCarry=zn;exports.registerPush=ps;exports.renderCta=Be;exports.renderForm=He;exports.resolveCookieDomain=Dn;exports.runCtas=kr;exports.startCtas=ds;exports.stripCarry=Jn;exports.watchPopup=fr;//# sourceMappingURL=web.cjs.map
37
37
  //# sourceMappingURL=web.cjs.map
package/dist/web.d.cts CHANGED
@@ -17,6 +17,8 @@ interface AutocaptureOptions {
17
17
  maskSelectors?: readonly string[];
18
18
  onError?: (error: unknown) => void;
19
19
  pageviews?: boolean;
20
+ /** Sends the page's Core Web Vitals as `$web_vitals`; on by default. */
21
+ webVitals?: boolean;
20
22
  }
21
23
  type Capturer = Pick<ProdantixClient, 'capture'>;
22
24
  declare function installAutocapture(client: Capturer, options?: AutocaptureOptions): () => void;
package/dist/web.d.ts CHANGED
@@ -17,6 +17,8 @@ interface AutocaptureOptions {
17
17
  maskSelectors?: readonly string[];
18
18
  onError?: (error: unknown) => void;
19
19
  pageviews?: boolean;
20
+ /** Sends the page's Core Web Vitals as `$web_vitals`; on by default. */
21
+ webVitals?: boolean;
20
22
  }
21
23
  type Capturer = Pick<ProdantixClient, 'capture'>;
22
24
  declare function installAutocapture(client: Capturer, options?: AutocaptureOptions): () => void;