@prodantix/sdk 0.7.0-beta.440 → 0.7.0-beta.443
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/README.md +14 -0
- package/dist/chat.cjs +3 -3
- package/dist/chat.d.cts +8 -4
- package/dist/chat.d.ts +8 -4
- package/dist/chat.js +4 -4
- package/dist/chunk-X2KBTZDG.js +2 -0
- package/dist/{config-Dmk59mPh.d.ts → config-Bhwwo-uC.d.ts} +13 -3
- package/dist/{config-Dxf1vAMu.d.cts → config-C8WD1Pge.d.cts} +13 -3
- package/dist/ctas.iife.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/messenger-files.iife.js +1 -1
- package/dist/messenger.cjs +1 -1
- package/dist/messenger.d.cts +1 -1
- package/dist/messenger.d.ts +1 -1
- package/dist/messenger.iife.js +2 -2
- package/dist/messenger.js +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.js +1 -1
- package/dist/pages.iife.js +1 -1
- package/dist/web.cjs +4 -4
- package/dist/web.d.cts +2 -0
- package/dist/web.d.ts +2 -0
- package/dist/web.js +24 -24
- package/package.json +1 -1
- package/dist/chunk-L4P6GMBC.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {c,a as a$2,b as b$2}from'./chunk-V77KYPOF.js';import {e,h,d,f as f$1,g as g$1,a as a$1,b as b$1,c as c$1}from'./chunk-ODN4ZELX.js';import {a}from'./chunk-5XGN7UAV.js';var m=class{constructor(){a(this,"store",new Map);}getItem(e){return this.store.get(e)??null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},y=class{constructor(e,t=()=>false){this.real=e;this.passes=t;a(this,"held",new m);a(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,t){this.target(e).setItem(e,t);}};function Ye(){try{let s=globalThis.localStorage;if(s){let e="__pdx_probe__";return s.setItem(e,"1"),s.removeItem(e),s}}catch{return new m}return new m}var X={now:()=>new Date};function x(s){return s.toISOString()}function Z(){if(typeof window>"u"||typeof Intl>"u")return null;let s=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof s=="string"&&s!==""?s:null}var Te=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Ee=/^(?:\$|[a-z])[a-z0-9_.]*$/;function ee(s){let e=0;for(let t of s)e+=1;return e}function te(s){return Te.test(s)}function $e(s){return Ee.test(s)}function se(s){let e=ee(s);if(e<1||e>200)throw new c$1("distinct_id","distinct_id must be between 1 and 200 characters")}function ne(s){let e=ee(s);if(e<1||e>200)throw new c$1("event_name","event_name must be between 1 and 200 characters");if(!$e(s))throw new c$1("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var ie="prodantix-js",re="0.7.0";function Ae(){return globalThis.crypto}function Pe(s){s[6]=s[6]&15|64,s[8]=s[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(s[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Re(){let s=Ae();if(s?.randomUUID)return s.randomUUID();let e=new Uint8Array(16);if(s?.getRandomValues)s.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return Pe(e)}var oe={uuid:Re};var Me=s=>{};function ae(s){if(!s.apiKey||!te(s.apiKey))throw new b$1("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!s.host)throw new b$1("host is required (the ingest base URL)");let e=h(s.host),t=s.defaultProperties,n=s.storage??new m;return {apiKey:s.apiKey,autocapture:s.autocapture??false,clock:s.clock??X,consent:s.consent,consentMode:s.consentMode,defaultProperties:typeof t=="function"?t:()=>t??{},describeElement:s.describeElement,flagsHost:s.flagsHost?h(s.flagsHost):e,flushAt:s.flushAt??20,flushIntervalMs:s.flushIntervalMs??1e4,host:e,ids:s.ids??oe,locale:s.locale,maxQueueSize:s.maxQueueSize??1e3,maxRetries:s.maxRetries??3,namespace:qe(s.apiKey),onError:s.onError??Me,os:s.os,requestTimeoutMs:s.requestTimeoutMs??1e4,sdkName:s.sdkName??ie,sdkVersion:s.sdkVersion??re,sessionTracking:s.sessionTracking??false,sharedStorage:s.sharedStorage??n,socketFactory:s.socketFactory,storage:n,streamFlags:s.streamFlags??false,transport:s.transport}}function qe(s){return s.slice(0,16)}var f=Symbol("absent");function Ke(s,e){if(s==="distinct_id")return e.distinctId;let t=e.properties??{};if(Object.prototype.hasOwnProperty.call(t,s))return t[s];let n=e.attributes??{};return Object.prototype.hasOwnProperty.call(n,s)?n[s]:f}function g(s){return s===f?"undefined":String(s)}function le(s){return s===f?Number.NaN:Number(s)}function ce(s){return s!==f&&s!==null&&s!==""}function ue(s,e){if(!Array.isArray(e))return false;let t=g(s);return e.map(n=>String(n)).includes(t)}function de(s,e){let t=Ke(s.attribute,e),n=s.value;switch(s.op){case "is_set":return ce(t);case "is_not_set":return !ce(t);case "eq":return g(t)===g(n===void 0?f:n);case "neq":return g(t)!==g(n===void 0?f:n);case "contains":return g(t).includes(g(n===void 0?f:n));case "in":return ue(t,n);case "not_in":return Array.isArray(n)?!ue(t,n):false;case "gt":return w(t,n,(i,r)=>i>r);case "gte":return w(t,n,(i,r)=>i>=r);case "lt":return w(t,n,(i,r)=>i<r);case "lte":return w(t,n,(i,r)=>i<=r);case "in_cohort":return typeof n=="string"&&n!==""&&(e.cohorts??[]).includes(n);case "not_in_cohort":return typeof n=="string"&&n!==""&&!(e.cohorts??[]).includes(n);default:return false}}function w(s,e,t){let n=le(s),i=e===void 0?Number.NaN:le(e);return Number.isNaN(n)||Number.isNaN(i)?false:t(n,i)}function pe(s,e){let t=`${s}:${e}`,n=2166136261;for(let i=0;i<t.length;i++)n^=t.charCodeAt(i),n=Math.imul(n,16777619);return (n>>>0)%100}function N(s,e){return s.targeting.length===0||s.targeting.every(t=>de(t,e))}function he(s,e){let t=pe(s.key,e.distinctId),n=s.variations??[];if(n.length===0)return s.rolloutPercentage>=100||t<s.rolloutPercentage?"true":"false";let i=0;for(let r=n.length-1;r>=0;r--)if(i+=n[r].weight,t<i)return n[r].key;return n[0].key}function L(s,e,t,n){for(let i of s.prerequisites??[]){if(n.includes(i.flagKey))return false;let r=e.find(c=>c.key===i.flagKey);if(!r||!r.enabled)return false;n.push(r.key);let a=L(r,e,t,n)&&N(r,t)&&he(r,t)===i.variationKey;if(n.pop(),!a)return false}return true}function v(s,e,t){return s.enabled?L(s,e,t,[s.key])?N(s,t)?s.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:pe(s.key,t.distinctId)<s.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function gt(s,e){return v(s,[],e)}function me(s,e){let t={};for(let n of s)t[n.key]=v(n,s,e).enabled;return t}function b(s,e,t){let n=s.variations??[],i=n[0];if(!i)return null;if(!s.enabled||!L(s,e,t,[s.key])||!N(s,t))return i;let r=he(s,t);return n.find(a=>a.key===r)??i}function ft(s,e){return b(s,[],e)}function yt(s,e,t){let n=s.find(i=>i.key===e);return n?b(n,s,t)?.value??null:null}function ge(s){return s.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}var _=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){let t=this.fetch;if(!t)throw new d("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!a.ok)throw new d(`flags request failed with status ${a.status}`,a.status);let c=JSON.parse(await a.text());return {flags:c.flags??{},variants:c.variants??{}}}finally{r!==void 0&&clearTimeout(r);}}async snapshot(){let e=this.fetch;if(!e)throw new d("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,n=f$1(),i=n?setTimeout(()=>n.abort(),this.requestTimeoutMs):void 0;try{let r=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:n?.signal});if(!r.ok)throw new d(`flag snapshot request failed with status ${r.status}`,r.status);let a=JSON.parse(await r.text()),c={flags:a.flags??[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(c.socketUrl=a.socketUrl),c}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){let t=this.fetch;if(!t)throw new d("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!a.ok)throw new d(`memberships request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).cohorts??[]}finally{r!==void 0&&clearTimeout(r);}}};var fe="$survey_shown",ye="$survey_dismissed",ve="$survey_sent",F=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async surveys(e,t){let n=this.fetch;if(!n)throw new d("no fetch implementation available in this runtime");let i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await n(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!a.ok)throw new d(`surveys request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).surveys??[]}finally{r!==void 0&&clearTimeout(r);}}},Oe=864e5,De=s=>`${s.id}:${s.iteration}`;function j(s,e){return s.length===0?true:s.some(t=>{switch(t.matches){case "exact":return e===t.value;case "starts_with":return e.startsWith(t.value);default:return e.includes(t.value)}})}function Ft(s,e,t,n,i){return s.kind!=="popover"||e.settled.includes(De(s))||s.showOnce&&e.settled.some(r=>r.startsWith(`${s.id}:`))||s.waitDays>0&&e.lastShownAt!==void 0&&n-e.lastShownAt<s.waitDays*Oe||s.event&&s.event!==i?false:j(s.urls,t)}function Ne(s,e,t){return s>=(e.minScore??0)&&s<=(e.maxScore??t)}function Ct(s,e,t){let n=e.kind==="nps"?10:e.scale??5,i=e.branches.find(a=>a.choice!=null?t===a.choice:typeof t=="number"&&Ne(t,a,n));if(i)return i.next??null;let r=s.questions.findIndex(a=>a.id===e.id);return s.questions[r+1]?.id??null}function C(s,e){let t={$survey_id:s.id,$survey_iteration:s.iteration,$survey_name:s.name};for(let[n,i]of Object.entries(e))t[`$survey_response_${n}`]=i;return t}var Pt="$guide_shown",Rt="$guide_step_viewed",Mt="$guide_step_missed",qt="$guide_completed",Kt="$guide_dismissed",Ot="$checklist_task_done",I=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async guides(e){let t=this.fetch;if(!t)throw new d("no fetch implementation available in this runtime");let n=f$1(),i=n?setTimeout(()=>n.abort(),this.requestTimeoutMs):void 0;try{let r=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:n?.signal});if(!r.ok)throw new d(`guides request failed with status ${r.status}`,r.status);return JSON.parse(await r.text()).guides??[]}finally{i!==void 0&&clearTimeout(i);}}},Le=864e5,be=s=>`${s.id}:${s.iteration}`,je=(s,e)=>`${be(s)}:${e}`;function Dt(s,e,t,n,i){return e.settled.includes(be(s))||s.showOnce&&e.settled.some(r=>r.startsWith(`${s.id}:`))||s.kind!=="checklist"&&s.waitDays>0&&e.lastShownAt!==void 0&&n-e.lastShownAt<s.waitDays*Le||s.event&&s.event!==i?false:j(s.urls,t)}var Nt=(s,e)=>s.steps.filter(t=>e.done.includes(je(s,t.id))).map(t=>t.id),Lt=(s,e)=>s.kind==="checklist"?s.steps.find(t=>t.event===e):void 0;function Se(s,e){let t={$guide_id:s.id,$guide_iteration:s.iteration,$guide_name:s.name};return e!==void 0&&(t.$guide_step_id=e),t}function S(s){if(typeof s!="string")return;let e=Array.from(s).length;return e>=1&&e<=200?s:void 0}function E(s,e){return `pdx.${s}.${e}`}var G="consent",Ve=["identityLink","analytics","marketing","functional"];function V(s){if(typeof s!="string")return null;try{let e=JSON.parse(s);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,n={};for(let i of Ve){let r=t[i];typeof r=="boolean"&&(n[i]=r);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(n.version=t.version),Array.isArray(t.categories)&&t.categories.every(i=>typeof i=="string")&&(n.categories=t.categories),Object.keys(n).length===0?null:n}catch{return null}}var ke=s=>s.endsWith(`.${G}`);function $(s,e){return V(s.getItem(E(e,G)))}function Ge(s,e,t){let n=E(e,G),i=V(JSON.stringify(t)),r=i===null?null:V(JSON.stringify({...$(s,e)??{},...i}));if(r===null){s.removeItem(n);return}s.setItem(n,JSON.stringify(r));}function Gt(s,e,t,n){let i=E(t,"anonymous_id"),r=S(e.getItem(i))??S(s.getItem(i));return e.setItem(i,n),s.setItem(i,n),r!==void 0&&r!==n?r:void 0}var T=class{constructor(e,t,n,i){this.storage=e;this.shared=t;this.ids=n;this.namespace=i;a(this,"anonymousId");a(this,"distinctId");a(this,"identified");this.refresh();}refresh(){let e=S(this.shared.getItem(this.key("anonymous_id"))),t=S(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let n=S(this.storage.getItem(this.key("distinct_id")));n?(this.distinctId=n,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 $(this.shared,this.namespace)}setConsent(e){Ge(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 t=!this.identified||this.distinctId!==e,n=this.storage.getItem(this.key("linked_anonymous_id")),i=t||n!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!i||this.consent()?.identityLink===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return E(this.namespace,e)}};var A=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async inbox(e){let t=this.requireFetch(),n=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(t,n,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new d(`inbox request failed with status ${i.status}`,i.status);return JSON.parse(await i.text()).messages??[]}async markRead(e,t){let n=this.requireFetch(),i=`${this.host}/v1/messages/read`,r=await this.request(n,i,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!r.ok)throw new d(`mark-read request failed with status ${r.status}`,r.status)}requireFetch(){if(!this.fetch)throw new d("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,n){let i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...n,signal:i?.signal})}finally{r!==void 0&&clearTimeout(r);}}};var u={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageleave:"$pageleave",pageview:"$pageview",screen:"$screen",set:"$set",webVitals:"$web_vitals"},Ue=[{emittedBy:"web_and_flutter",meaning:"A click anywhere on the page, with the element that was clicked. The web SDK sends it by default; autocapture: false or autocaptureOptions.clicks: false turns it off. A Flutter app sends each tap as this event too, under TelemetryTapCapture.",name:u.autocapture,properties:["$event_type","$el_description","$el_description_source","$el_action","$el_tag","$el_text","$el_id","$el_classes","$el_href","$current_url","$pathname","$host","$title","$referrer","$screen_name"]},{emittedBy:"web",meaning:"A page shown, including every client-side navigation the History API makes: one per distinct path and query.",name:u.pageview,properties:["$current_url","$pathname","$host","$title","$referrer"]},{emittedBy:"web",meaning:"A landing page left the visitor's sight, by a tab switch, a closed tab or a navigation away, with the seconds it was in front of them so far. A page returned to and left again sends it again with the larger total.",name:u.pageleave,properties:["$engaged_seconds","$page_id","$page_view_id","$page_variant"]},{emittedBy:"web",meaning:"A page's Core Web Vitals, sent once per page load the first time the page leaves the visitor's sight: largest contentful paint, first contentful paint, cumulative layout shift, interaction to next paint and time to first byte, each only when the browser measured it. autocaptureOptions.webVitals: false turns it off.",name:u.webVitals,properties:["$lcp_ms","$fcp_ms","$cls","$inp_ms","$ttfb_ms","$pathname"]},{emittedBy:"flutter",meaning:"A named route pushed or replaced in a Flutter app, the mobile counterpart of $pageview.",name:u.screen,properties:["screen"]},{emittedBy:"every",meaning:"A person becomes known by a distinct id. The anonymous trail before it is joined to them, and any traits ride along under $set.",name:u.identify,properties:["$anon_distinct_id","$set"]},{emittedBy:"every",meaning:"A second id for the same person, so events sent under either resolve to one profile.",name:u.createAlias,properties:["alias"]},{emittedBy:"every",meaning:"The person is placed in a group such as a company or a team; group properties ride along under $set.",name:u.group,properties:["$group_type","$group_key","$set"]},{emittedBy:"every",meaning:"Person properties written without an identify: $set overwrites, $set_once fills only what is still empty.",name:u.set,properties:["$set","$set_once"]},{emittedBy:"every",meaning:"A flag was evaluated for this person, sent once per distinct answer. Experiments attribute exposure from it.",name:u.featureFlagCalled,properties:["$feature_flag","$feature_flag_response"]}],Wt=s=>s.startsWith("$"),Yt=s=>Ue.find(e=>e.name===s);function xe(s){return s>=400&&s<500&&s!==429}var P=class{constructor(e$1={}){a(this,"fetch");a(this,"maxRetries");a(this,"requestTimeoutMs");a(this,"baseDelayMs");a(this,"maxDelayMs");a(this,"sleep");a(this,"random");this.fetch=e(e$1.fetch),this.maxRetries=e$1.maxRetries??3,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4,this.baseDelayMs=e$1.baseDelayMs??500,this.maxDelayMs=e$1.maxDelayMs??3e4,this.sleep=e$1.sleep??g$1,this.random=e$1.random??Math.random;}async send(e){let t=this.fetch;if(!t)throw new d("no fetch implementation available in this runtime");let n=JSON.stringify(e.body),i;for(let r=0;r<=this.maxRetries;r+=1){try{let a=await this.attempt(t,e,n);if(a.ok)return;if(xe(a.status))throw new d(`ingest rejected batch with status ${a.status}`,a.status);i=new d(`ingest transient status ${a.status}`,a.status);}catch(a){if(a instanceof d&&a.status!==void 0&&xe(a.status))throw a;i=a;}r<this.maxRetries&&await this.sleep(this.backoff(r));}throw new d("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,t,n){let i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:n,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:i?.signal})}finally{r!==void 0&&clearTimeout(r);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var rs="$cta_viewed",os="$cta_clicked",as="$cta_dismissed",we=(s,e)=>{let t={$cta_id:s.id,$cta_kind:s.kind,$cta_variant:s.variant.key,$cta_version:s.version},n=e===void 0?void 0:s.variant.content.buttons[e];return n&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=n.label,n.action.kind==="form"&&(t.$cta_form_id=n.action.value)),t},R=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async ctas(e){let t=this.fetch;if(!t)throw new d("no fetch implementation available in this runtime");let n=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(`${this.host}/v1/ctas?${n.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(a.status<200||a.status>=300)throw new d(`ctas request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).ctas}finally{r!==void 0&&clearTimeout(r);}}};function _e(s,e,t){ne(s.eventName),se(s.distinctId);let n={distinct_id:s.distinctId,event_id:s.eventId??t.uuid(),event_name:s.eventName,properties:s.properties??{},schema_version:1,timestamp:x(s.timestamp??e.now())};return s.context&&(n.context=s.context),s.sessionId&&(n.session_id=s.sessionId),n}var Be="/socket.io/?EIO=4&transport=websocket",He=250,M=class{constructor(e){this.options=e;a(this,"socket",null);a(this,"heartbeat",null);a(this,"pending",null);a(this,"lastKey","");a(this,"ready",false);a(this,"closed",false);a(this,"heartbeatWindow",45e3);a(this,"factory");a(this,"setTimer");a(this,"clearTimer");this.factory=e.socketFactory??Je,this.setTimer=e.setTimer??((t,n)=>setTimeout(t,n)),this.clearTimer=e.clearTimer??(t=>clearTimeout(t));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Be}`,t;try{t=this.factory(e);}catch{this.options.onClosed(false);return}this.socket=t,t.onmessage=n=>this.receive(String(n.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e?.close();}receive(e){let t=c(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),this.socket?.send(a$2({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),this.socket?.send(b$2());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let n=t.payload?.key;this.lastKey=typeof n=="string"?n:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},He));}}}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 Je(s){let e=globalThis.WebSocket;if(!e)throw new d("no WebSocket");return new e(s)}var bs="$form_viewed",Ss="$form_started",U=class extends Error{constructor(t,n,i){super(i);a(this,"fields");a(this,"status");this.name="FormRefusedError",this.status=t,this.fields=n;}},q=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async request(e,t){let n=this.fetch;if(!n)throw new d("no fetch implementation available in this runtime");let i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(a["content-type"]="application/json");let c=await n(`${this.host}${e}`,{body:t.body,headers:a,method:t.method,signal:i?.signal});return {status:c.status,text:await c.text()}}finally{r!==void 0&&clearTimeout(r);}}async form(e,t){let{status:n,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(n<200||n>=300)throw new d(`form request failed with status ${n}`,n);return JSON.parse(i)}async submit(e,t){let{status:n,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(n>=200&&n<300)return JSON.parse(i).afterSubmit;let r=[],a=`form submission failed with status ${n}`;try{let c=JSON.parse(i);r=c.error?.fields??[],a=c.error?.message??a;}catch{r=[];}throw new U(n,r,a)}};var K=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;a(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);this.onOverflow?.({dropped:e});}};var ze={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function Fe(s){return `pdx.${s}.session`}function Fs(s,e,t,n){let i={id:t.id,lastActivityAt:n,startedAt:t.startedAt};s.setItem(Fe(e),JSON.stringify(i));}var O=class{constructor(e,t,n,i,r=ze){this.storage=e;this.ids=t;this.clock=n;this.namespace=i;this.options=r;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let n=this.live(this.read(),e),i=n!==void 0&&n.id!==t.id?n:t;return this.write({...i,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch{return}}key(){return Fe(this.namespace)}};var Qe="queue",We=1e3,Ce=3e4,B=s=>{let e={};return s.avatar!==void 0&&(e.$avatar=s.avatar),s.email!==void 0&&(e.$email=s.email),s.name!==void 0&&(e.$name=s.name),s.phone!==void 0&&(e.$phone=s.phone),e},H=class{constructor(e){a(this,"config");a(this,"identity");a(this,"session");a(this,"queue");a(this,"transport");a(this,"flagsClient");a(this,"messagesClient");a(this,"surveysClient");a(this,"guidesClient");a(this,"captureListeners",new Set);a(this,"formsClient");a(this,"ctasClient");a(this,"context");a(this,"flushTimer");a(this,"flushing",false);a(this,"cachedFlags");a(this,"cachedSnapshot");a(this,"membershipCache");a(this,"stream");a(this,"shutDown",false);a(this,"exposures",new Set);a(this,"gates");a(this,"cookielessId");a(this,"storageListeners",new Set);let t=ae(e),n=$(t.sharedStorage,t.namespace)??t.consent??null;if(this.gates=[new y(t.storage),new y(t.sharedStorage,ke)],t.consentMode!=="banner"||n?.analytics===true)for(let a of this.gates)a.open();let[i,r]=this.gates;this.config={...t,sharedStorage:r,storage:i},this.identity=new T(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 O(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new K(this.config.maxQueueSize,({dropped:a})=>{this.config.onError(new a$1("queue_overflow",`event queue overflow: dropped ${a.length} oldest event(s)`));}),this.transport=this.config.transport??new P({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new _({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new A({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new F({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new I({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new q({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new R({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,t={}){try{this.identity.refresh();let n={...this.config.defaultProperties(),...t.element===void 0?{}:this.config.describeElement?.(t.element)??{},...t.properties??{}},i=_e({context:this.context,distinctId:t.distinctId??this.identity.getDistinctId(),eventName:e,properties:n,sessionId:t.sessionId??this.session?.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(i);}catch(n){this.config.onError(n);}for(let n of this.captureListeners)try{n(e);}catch(i){this.config.onError(i);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){if(this.isCookieless())return;this.identity.refresh();let n=this.identity.identify(e),i={};n.anonymousToLink!==void 0&&(i.$anon_distinct_id=n.anonymousToLink);let r=Z(),a={...r===null?{}:{$timezone:r},...B(t.traits??{}),...t.set??{}};Object.keys(a).length>0&&(i.$set=a),this.capture(u.identify,{properties:i});}link(e,t,n){if(this.isCookieless())return;let i={$anon_distinct_id:t},r=B(n??{});Object.keys(r).length>0&&(i.$set=r),this.capture(u.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(u.createAlias,{properties:{alias:e}});}group(e,t,n){let i={$group_key:t,$group_type:e};n&&(i.$set=n),this.capture(u.group,{properties:i});}setPersonProperties(e,t){if(this.isCookieless())return;let n={};e&&(n.$set=e),t&&(n.$set_once=t),this.capture(u.set,{properties:n});}setPersonTraits(e){if(this.isCookieless())return;let t=B(e);Object.keys(t).length!==0&&this.capture(u.set,{properties:{$set:t}});}async getAllFlags(){let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:t.variants??{}},t.flags}async isFeatureEnabled(e){let n=(await this.getAllFlags())[e]??false;return this.recordExposure(e,this.cachedFlags?.variants[e]?.key??String(n)),n}async getVariant(e){let t=await this.getAllFlags(),n=this.cachedFlags?.variants[e]??null;return this.recordExposure(e,n?.key??String(t[e]??false)),n}async getVariantLocal(e,t={}){let n=await this.flagSnapshot(),i=n.flags.find(Ie=>Ie.key===e),r=await this.localContext(t,n.flags),a=i?b(i,n.flags,r):null,c=i?v(i,n.flags,r).enabled:false;return this.recordExposure(e,a?.key??String(c)),a?{key:a.key,value:a.value}:null}recordExposure(e,t){let n=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(n)||(this.exposures.add(n),this.capture(u.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return me(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){let n=await this.flagSnapshot(),i=n.flags.find(c=>c.key===e),r=await this.localContext(t,n.flags),a=i?v(i,n.flags,r).enabled:false;return this.recordExposure(e,(i?b(i,n.flags,r)?.key:void 0)??String(a)),a}async localContext(e,t){let n=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&ge(t)){let r=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===n&&r-this.membershipCache.fetchedAt<Ce?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(n),this.membershipCache={cohorts:i,distinctId:n,fetchedAt:r});}return {attributes:e.attributes,cohorts:i,distinctId:n,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<Ce)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new M({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(n=>this.config.onError(n));},onClosed:n=>{this.stream=void 0,n&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e??this.config.locale)}captureSurveyShown(e){this.capture(fe,{properties:C(e,{})});}captureSurveyDismissed(e){this.capture(ye,{properties:C(e,{})});}captureSurveySent(e,t){this.capture(ve,{properties:C(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,n){this.capture(e,{properties:Se(t,n)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,n,i){let{$page_id:r,$page_variant:a}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:n,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window>"u"?"":window.location.href,solution:i,...typeof r=="string"&&typeof a=="string"?{pageId:r,pageVariant:a}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,n){this.capture(e,{properties:we(t,n)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(We);try{await this.transport.send({body:{events:e,sent_at:x(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){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 t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${Qe}`}};function Bs(s){return new H(s)}export{Bs as $,j as A,Ft as B,Ct as C,C as D,Pt as E,Rt as F,Mt as G,qt as H,Kt as I,Ot as J,I as K,be as L,je as M,Dt as N,Nt as O,Lt as P,Se as Q,V as R,Gt as S,A as T,Fs as U,u as V,Ue as W,Wt as X,Yt as Y,P as Z,H as _,m as a,Ye as b,X as c,Re as d,ee as e,ie as f,re as g,qe as h,rs as i,os as j,as as k,de as l,pe as m,gt as n,me as o,ft as p,yt as q,_ as r,bs as s,Ss as t,U as u,fe as v,ye as w,ve as x,F as y,De as z};//# sourceMappingURL=chunk-X2KBTZDG.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-X2KBTZDG.js.map
|
|
@@ -2,7 +2,7 @@ import { F as FetchLike } from './http-BCh716Vs.js';
|
|
|
2
2
|
|
|
3
3
|
interface ChatTurn {
|
|
4
4
|
id: string;
|
|
5
|
-
authorKind: 'end_user' | 'agent' | 'ai';
|
|
5
|
+
authorKind: 'end_user' | 'agent' | 'ai' | 'system';
|
|
6
6
|
authorId: string | null;
|
|
7
7
|
body: string;
|
|
8
8
|
createdAt: string;
|
|
@@ -16,6 +16,10 @@ interface ChatUpload {
|
|
|
16
16
|
contentType: string;
|
|
17
17
|
bytes: number;
|
|
18
18
|
}
|
|
19
|
+
type UploadRefusalCode = 'ATTACHMENT_REFUSED' | 'ATTACHMENT_UNCHECKED';
|
|
20
|
+
interface ChatUploadRefusal {
|
|
21
|
+
refusal: UploadRefusalCode;
|
|
22
|
+
}
|
|
19
23
|
interface ChatAttachment extends ChatUpload {
|
|
20
24
|
url: string;
|
|
21
25
|
}
|
|
@@ -98,7 +102,7 @@ declare class ChatClient {
|
|
|
98
102
|
ensureThread(subject?: string): Promise<boolean>;
|
|
99
103
|
cameFrom(article: ArticleRef): void;
|
|
100
104
|
send(body: string, pageContext?: PageContext, attachmentIds?: string[]): Promise<ChatTurn | null>;
|
|
101
|
-
upload(file: File): Promise<ChatUpload | null>;
|
|
105
|
+
upload(file: File, refusalOf?: (text: string) => ChatUploadRefusal | null): Promise<ChatUpload | ChatUploadRefusal | null>;
|
|
102
106
|
file(path: string): Promise<Blob | null>;
|
|
103
107
|
helpCentre<T>(suffix: string, params: Record<string, string>, body?: Record<string, string>): Promise<T | null>;
|
|
104
108
|
get visitor(): (ChatIdentity & {
|
|
@@ -225,6 +229,12 @@ interface MessengerAttachments {
|
|
|
225
229
|
enabled: boolean;
|
|
226
230
|
maxBytes: number;
|
|
227
231
|
accept: string[];
|
|
232
|
+
words?: AttachmentWords;
|
|
233
|
+
}
|
|
234
|
+
interface AttachmentWords {
|
|
235
|
+
refused: string;
|
|
236
|
+
unchecked: string;
|
|
237
|
+
tryAgain: string;
|
|
228
238
|
}
|
|
229
239
|
interface MessengerConfigOptions {
|
|
230
240
|
apiKey: string;
|
|
@@ -240,4 +250,4 @@ declare const cacheKeyFor: (apiKey: string, locale: string | undefined) => strin
|
|
|
240
250
|
declare function cachedMessengerConfig(storage: ChatStorage | undefined, apiKey: string, locale?: string): MessengerConfig | null;
|
|
241
251
|
declare function fetchMessengerConfig(options: MessengerConfigOptions): Promise<MessengerConfig | null>;
|
|
242
252
|
|
|
243
|
-
export { type ArticleRef as A, type BubbleFill as B, type
|
|
253
|
+
export { type ArticleRef as A, type BubbleFill as B, type ChatUploadRefusal as C, DEFAULT_APPEARANCE_SETTINGS as D, type MessengerTickets as E, type FileFetchLike as F, type StarterPrompt as G, type HelpWords as H, cacheKeyFor as I, cachedMessengerConfig as J, fetchMessengerConfig as K, type LauncherContent as L, type MessengerAttachments as M, type NamePlacement as N, localeCandidates as O, type PageContext as P, type StampContent as S, type TicketWords as T, type UploadRefusalCode as U, type ArticleReaction as a, type ArticleHit as b, type ArticleCollection as c, type AppearanceSettings as d, type ChatThread as e, type ChatTurn as f, type ChatUpload as g, type ChatIdentity as h, type MessengerConfig as i, type ChatClientOptions as j, type BubbleShape as k, type ChatAttachment as l, ChatClient as m, type ChatStorage as n, type ComposerShape as o, type FileResponseLike as p, type LauncherFill as q, type LauncherShape as r, type LauncherSize as s, type MessengerSkin as t, type StampPlacement as u, resolveAppearance as v, type AttachmentWords as w, MESSENGER_CACHE_KEY as x, type MessengerConfigOptions as y, type MessengerHelp as z };
|
|
@@ -2,7 +2,7 @@ import { F as FetchLike } from './http-BCh716Vs.cjs';
|
|
|
2
2
|
|
|
3
3
|
interface ChatTurn {
|
|
4
4
|
id: string;
|
|
5
|
-
authorKind: 'end_user' | 'agent' | 'ai';
|
|
5
|
+
authorKind: 'end_user' | 'agent' | 'ai' | 'system';
|
|
6
6
|
authorId: string | null;
|
|
7
7
|
body: string;
|
|
8
8
|
createdAt: string;
|
|
@@ -16,6 +16,10 @@ interface ChatUpload {
|
|
|
16
16
|
contentType: string;
|
|
17
17
|
bytes: number;
|
|
18
18
|
}
|
|
19
|
+
type UploadRefusalCode = 'ATTACHMENT_REFUSED' | 'ATTACHMENT_UNCHECKED';
|
|
20
|
+
interface ChatUploadRefusal {
|
|
21
|
+
refusal: UploadRefusalCode;
|
|
22
|
+
}
|
|
19
23
|
interface ChatAttachment extends ChatUpload {
|
|
20
24
|
url: string;
|
|
21
25
|
}
|
|
@@ -98,7 +102,7 @@ declare class ChatClient {
|
|
|
98
102
|
ensureThread(subject?: string): Promise<boolean>;
|
|
99
103
|
cameFrom(article: ArticleRef): void;
|
|
100
104
|
send(body: string, pageContext?: PageContext, attachmentIds?: string[]): Promise<ChatTurn | null>;
|
|
101
|
-
upload(file: File): Promise<ChatUpload | null>;
|
|
105
|
+
upload(file: File, refusalOf?: (text: string) => ChatUploadRefusal | null): Promise<ChatUpload | ChatUploadRefusal | null>;
|
|
102
106
|
file(path: string): Promise<Blob | null>;
|
|
103
107
|
helpCentre<T>(suffix: string, params: Record<string, string>, body?: Record<string, string>): Promise<T | null>;
|
|
104
108
|
get visitor(): (ChatIdentity & {
|
|
@@ -225,6 +229,12 @@ interface MessengerAttachments {
|
|
|
225
229
|
enabled: boolean;
|
|
226
230
|
maxBytes: number;
|
|
227
231
|
accept: string[];
|
|
232
|
+
words?: AttachmentWords;
|
|
233
|
+
}
|
|
234
|
+
interface AttachmentWords {
|
|
235
|
+
refused: string;
|
|
236
|
+
unchecked: string;
|
|
237
|
+
tryAgain: string;
|
|
228
238
|
}
|
|
229
239
|
interface MessengerConfigOptions {
|
|
230
240
|
apiKey: string;
|
|
@@ -240,4 +250,4 @@ declare const cacheKeyFor: (apiKey: string, locale: string | undefined) => strin
|
|
|
240
250
|
declare function cachedMessengerConfig(storage: ChatStorage | undefined, apiKey: string, locale?: string): MessengerConfig | null;
|
|
241
251
|
declare function fetchMessengerConfig(options: MessengerConfigOptions): Promise<MessengerConfig | null>;
|
|
242
252
|
|
|
243
|
-
export { type ArticleRef as A, type BubbleFill as B, type
|
|
253
|
+
export { type ArticleRef as A, type BubbleFill as B, type ChatUploadRefusal as C, DEFAULT_APPEARANCE_SETTINGS as D, type MessengerTickets as E, type FileFetchLike as F, type StarterPrompt as G, type HelpWords as H, cacheKeyFor as I, cachedMessengerConfig as J, fetchMessengerConfig as K, type LauncherContent as L, type MessengerAttachments as M, type NamePlacement as N, localeCandidates as O, type PageContext as P, type StampContent as S, type TicketWords as T, type UploadRefusalCode as U, type ArticleReaction as a, type ArticleHit as b, type ArticleCollection as c, type AppearanceSettings as d, type ChatThread as e, type ChatTurn as f, type ChatUpload as g, type ChatIdentity as h, type MessengerConfig as i, type ChatClientOptions as j, type BubbleShape as k, type ChatAttachment as l, ChatClient as m, type ChatStorage as n, type ComposerShape as o, type FileResponseLike as p, type LauncherFill as q, type LauncherShape as r, type LauncherSize as s, type MessengerSkin as t, type StampPlacement as u, resolveAppearance as v, type AttachmentWords as w, MESSENGER_CACHE_KEY as x, type MessengerConfigOptions as y, type MessengerHelp as z };
|
package/dist/ctas.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){'use strict';var zt=Object.defineProperty;var Jt=(t,e,n)=>e in t?zt(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var d=(t,e,n)=>Jt(t,typeof e!="symbol"?e+"":e,n);var O=class extends Error{constructor(n,r,i){super(r,i);d(this,"code");this.code=n,this.name="ProdantixError";}},V=class extends O{constructor(e){super("config",e),this.name="ConfigError";}},B=class extends O{constructor(n,r){super("validation",r);d(this,"field");this.field=n,this.name="ValidationError";}},h=class extends O{constructor(n,r,i){super("transport",n,i);d(this,"status");this.status=r,this.name="TransportError";}};function T(t){if(t)return t;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function w(){let t=globalThis.AbortController;return t?new t:void 0}var Ke=t=>new Promise(e=>{setTimeout(e,t);});function E(t){return t.replace(/\/+$/,"")}var q=class{constructor(){d(this,"store",new Map);}getItem(e){var n;return (n=this.store.get(e))!=null?n:null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}},U=class{constructor(e,n=()=>false){this.real=e;this.passes=n;d(this,"held",new q);d(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,n){this.target(e).setItem(e,n);}};function Be(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch(t){return new q}return new q}var je={now:()=>new Date};function Q(t){return t.toISOString()}function He(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof t=="string"&&t!==""?t:null}function Wt(){return globalThis.crypto}function Yt(t){t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e=[];for(let n=0;n<16;n+=1)e.push(t[n].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Qt(){let t=Wt();if(t!=null&&t.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t!=null&&t.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return Yt(e)}var Ge={uuid:Qt};var Xt=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Zt=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ve(t){let e=0;for(let n of t)e+=1;return e}function Ue(t){return Xt.test(t)}function en(t){return Zt.test(t)}function ze(t){let e=Ve(t);if(e<1||e>200)throw new B("distinct_id","distinct_id must be between 1 and 200 characters")}function Je(t){let e=Ve(t);if(e<1||e>200)throw new B("event_name","event_name must be between 1 and 200 characters");if(!en(t))throw new B("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var We="prodantix-js",Ye="0.7.0";var tn=t=>{};function Qe(t){var i,o,s,a,c,u,p,l,I,A,f,C,F,W,R;if(!t.apiKey||!Ue(t.apiKey))throw new V("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!t.host)throw new V("host is required (the ingest base URL)");let e=E(t.host),n=t.defaultProperties,r=(i=t.storage)!=null?i:new q;return {apiKey:t.apiKey,autocapture:(o=t.autocapture)!=null?o:false,clock:(s=t.clock)!=null?s:je,consent:t.consent,consentMode:t.consentMode,defaultProperties:typeof n=="function"?n:()=>n!=null?n:{},describeElement:t.describeElement,flagsHost:t.flagsHost?E(t.flagsHost):e,flushAt:(a=t.flushAt)!=null?a:20,flushIntervalMs:(c=t.flushIntervalMs)!=null?c:1e4,host:e,ids:(u=t.ids)!=null?u:Ge,locale:t.locale,maxQueueSize:(p=t.maxQueueSize)!=null?p:1e3,maxRetries:(l=t.maxRetries)!=null?l:3,namespace:be(t.apiKey),onError:(I=t.onError)!=null?I:tn,os:t.os,requestTimeoutMs:(A=t.requestTimeoutMs)!=null?A:1e4,sdkName:(f=t.sdkName)!=null?f:We,sdkVersion:(C=t.sdkVersion)!=null?C:Ye,sessionTracking:(F=t.sessionTracking)!=null?F:false,sharedStorage:(W=t.sharedStorage)!=null?W:r,socketFactory:t.socketFactory,storage:r,streamFlags:(R=t.streamFlags)!=null?R:false,transport:t.transport}}function be(t){return t.slice(0,16)}var Xe="$cta_viewed",Ze="$cta_clicked",xe="$cta_dismissed",et=(t,e)=>{let n={$cta_id:t.id,$cta_kind:t.kind,$cta_variant:t.variant.key,$cta_version:t.version},r=e===void 0?void 0:t.variant.content.buttons[e];return r&&e!==void 0&&(n.$cta_button=e,n.$cta_button_label=r.label,r.action.kind==="form"&&(n.$cta_form_id=r.action.value)),n},X=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async ctas(e){let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new h(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function tt(t,e,n){var i,o,s;Je(t.eventName),ze(t.distinctId);let r={distinct_id:t.distinctId,event_id:(i=t.eventId)!=null?i:n.uuid(),event_name:t.eventName,properties:(o=t.properties)!=null?o:{},schema_version:1,timestamp:Q((s=t.timestamp)!=null?s:e.now())};return t.context&&(r.context=t.context),t.sessionId&&(r.session_id=t.sessionId),r}var K=Symbol("absent");function nn(t,e){var i,o;if(t==="distinct_id")return e.distinctId;let n=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,t)?r[t]:K}function D(t){return t===K?"undefined":String(t)}function nt(t){return t===K?Number.NaN:Number(t)}function rt(t){return t!==K&&t!==null&&t!==""}function it(t,e){if(!Array.isArray(e))return false;let n=D(t);return e.map(r=>String(r)).includes(n)}function st(t,e){var i,o;let n=nn(t.attribute,e),r=t.value;switch(t.op){case "is_set":return rt(n);case "is_not_set":return !rt(n);case "eq":return D(n)===D(r===void 0?K:r);case "neq":return D(n)!==D(r===void 0?K:r);case "contains":return D(n).includes(D(r===void 0?K:r));case "in":return it(n,r);case "not_in":return Array.isArray(r)?!it(n,r):false;case "gt":return Z(n,r,(s,a)=>s>a);case "gte":return Z(n,r,(s,a)=>s>=a);case "lt":return Z(n,r,(s,a)=>s<a);case "lte":return Z(n,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function Z(t,e,n){let r=nt(t),i=e===void 0?Number.NaN:nt(e);return Number.isNaN(r)||Number.isNaN(i)?false:n(r,i)}function ot(t,e){let n=`${t}:${e}`,r=2166136261;for(let i=0;i<n.length;i++)r^=n.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function ke(t,e){return t.targeting.length===0||t.targeting.every(n=>st(n,e))}function at(t,e){var o;let n=ot(t.key,e.distinctId),r=(o=t.variations)!=null?o:[];if(r.length===0)return t.rolloutPercentage>=100||n<t.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,n<i)return r[s].key;return r[0].key}function Se(t,e,n,r){var i;for(let o of (i=t.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(c=>c.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=Se(s,e,n,r)&&ke(s,n)&&at(s,n)===o.variationKey;if(r.pop(),!a)return false}return true}function ee(t,e,n){return t.enabled?Se(t,e,n,[t.key])?ke(t,n)?t.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:ot(t.key,n.distinctId)<t.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function dt(t,e){let n={};for(let r of t)n[r.key]=ee(r,t,e).enabled;return n}function we(t,e,n){var s,a;let r=(s=t.variations)!=null?s:[],i=r[0];if(!i)return null;if(!t.enabled||!Se(t,e,n,[t.key])||!ke(t,n))return i;let o=at(t,n);return (a=r.find(c=>c.key===o))!=null?a:i}function ct(t){return t.some(e=>e.targeting.some(n=>n.op==="in_cohort"||n.op==="not_in_cohort"))}function lt(t){return `40${JSON.stringify(t)}`}function ut(){return "3"}function pt(t){let e=t.charAt(0),n=t.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=Ce(n);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=n.charAt(0),i=n.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=Ce(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=Ce(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function Ce(t){try{return JSON.parse(t)}catch(e){return null}}var rn="/socket.io/?EIO=4&transport=websocket",sn=250,te=class{constructor(e){this.options=e;d(this,"socket",null);d(this,"heartbeat",null);d(this,"pending",null);d(this,"lastKey","");d(this,"ready",false);d(this,"closed",false);d(this,"heartbeatWindow",45e3);d(this,"factory");d(this,"setTimer");d(this,"clearTimer");var n,r,i;this.factory=(n=e.socketFactory)!=null?n:on,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${rn}`,n;try{n=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=n,n.onmessage=r=>this.receive(String(r.data)),n.onerror=()=>n.close(),n.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let n=pt(e);if(n.kind==="open"){this.armHeartbeat(n.pingInterval+n.pingTimeout),(r=this.socket)==null||r.send(lt({projectKey:this.options.projectKey}));return}if(n.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(ut());return}if(n.kind==="connectError"||n.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(n.kind==="event"){if(n.name==="ready"){this.ready=true;return}if(n.name==="flagChange"){let a=(s=n.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},sn));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var n;return (n=this.socket)==null?void 0:n.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function on(t){let e=globalThis.WebSocket;if(!e)throw new h("no WebSocket");return new e(t)}var ne=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let c=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!c.ok)throw new h(`flags request failed with status ${c.status}`,c.status);let u=JSON.parse(await c.text());return {flags:(s=u.flags)!=null?s:{},variants:(a=u.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new h("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/snapshot`,r=w(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new h(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),c={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(c.socketUrl=a.socketUrl),c}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new h(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var mt="$form_viewed",gt="$form_started",z=class extends Error{constructor(n,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=n,this.fields=r;}},re=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async request(e,n){let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:s,method:n.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,n){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(n)}`,{method:"GET"});if(r<200||r>=300)throw new h(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,n){var a,c,u,p;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(n),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let l=JSON.parse(i);o=(c=(a=l.error)==null?void 0:a.fields)!=null?c:[],s=(p=(u=l.error)==null?void 0:u.message)!=null?p:s;}catch(l){o=[];}throw new z(r,o,s)}};var ht="$survey_shown",ft="$survey_dismissed",yt="$survey_sent",ie=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async surveys(e,n){var s;let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${n?`&lang=${encodeURIComponent(n)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new h(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function se(t,e){let n={$survey_id:t.id,$survey_iteration:t.iteration,$survey_name:t.name};for(let[r,i]of Object.entries(e))n[`$survey_response_${r}`]=i;return n}var oe=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async guides(e){var o;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=w(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new h(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function vt(t,e){let n={$guide_id:t.id,$guide_iteration:t.iteration,$guide_name:t.name};return e!==void 0&&(n.$guide_step_id=e),n}function Ee(t){if(typeof t!="string")return;let e=Array.from(t).length;return e>=1&&e<=200?t:void 0}function Fe(t,e){return `pdx.${t}.${e}`}var _e="consent",an=["identityLink","analytics","marketing","functional"];function Te(t){if(typeof t!="string")return null;try{let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,r={};for(let i of an){let o=n[i];typeof o=="boolean"&&(r[i]=o);}return typeof n.version=="number"&&Number.isInteger(n.version)&&(r.version=n.version),Array.isArray(n.categories)&&n.categories.every(i=>typeof i=="string")&&(r.categories=n.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var bt=t=>t.endsWith(`.${_e}`);function de(t,e){return Te(t.getItem(Fe(e,_e)))}function dn(t,e,n){var s;let r=Fe(e,_e),i=Te(JSON.stringify(n)),o=i===null?null:Te(JSON.stringify({...(s=de(t,e))!=null?s:{},...i}));if(o===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(o));}var ae=class{constructor(e,n,r,i){this.storage=e;this.shared=n;this.ids=r;this.namespace=i;d(this,"anonymousId");d(this,"distinctId");d(this,"identified");this.refresh();}refresh(){let e=Ee(this.shared.getItem(this.key("anonymous_id"))),n=Ee(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,n!==e&&this.storage.setItem(this.key("anonymous_id"),e)):n?(this.anonymousId=n,this.shared.setItem(this.key("anonymous_id"),n)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=Ee(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return de(this.shared,this.namespace)}setConsent(e){dn(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let n=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=n||r!==this.anonymousId;return this.distinctId=e,this.identified=true,n&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:n}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:n})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return Fe(this.namespace,e)}};var ce=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async inbox(e){var s;let n=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(n,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new h(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,n){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:n,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new h(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new h("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,n,r){let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var le=class{constructor(e,n){this.maxSize=e;this.onOverflow=n;d(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let n=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,n)}snapshot(){return [...this.events]}enforceCap(){var n;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(n=this.onOverflow)==null||n.call(this,{dropped:e});}};var cn={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function ln(t){return `pdx.${t}.session`}var ue=class{constructor(e,n,r,i,o=cn){this.storage=e;this.ids=n;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),n=this.live(this.read(),e);if(n===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-n.lastActivityAt<=this.options.throttleMs)return n;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==n.id?r:n;return this.write({...i,lastActivityAt:e})}live(e,n){if(e!==void 0&&!(n-e.lastActivityAt>this.options.idleMs||n-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let n=JSON.parse(e);return typeof n.id=="string"&&typeof n.startedAt=="number"&&typeof n.lastActivityAt=="number"?{id:n.id,lastActivityAt:n.lastActivityAt,startedAt:n.startedAt}:void 0}catch(n){return}}key(){return ln(this.namespace)}};var S={createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",set:"$set"};function xt(t){return t>=400&&t<500&&t!==429}var j=class{constructor(e={}){d(this,"fetch");d(this,"maxRetries");d(this,"requestTimeoutMs");d(this,"baseDelayMs");d(this,"maxDelayMs");d(this,"sleep");d(this,"random");var n,r,i,o,s,a;this.fetch=T(e.fetch),this.maxRetries=(n=e.maxRetries)!=null?n:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:Ke,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(n,e,r);if(s.ok)return;if(xt(s.status))throw new h(`ingest rejected batch with status ${s.status}`,s.status);i=new h(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof h&&s.status!==void 0&&xt(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new h("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,n,r){let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n.url,{body:r,headers:{authorization:`Bearer ${n.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var un="queue",pn=1e3,kt=3e4,Ie=t=>{let e={};return t.avatar!==void 0&&(e.$avatar=t.avatar),t.email!==void 0&&(e.$email=t.email),t.name!==void 0&&(e.$name=t.name),t.phone!==void 0&&(e.$phone=t.phone),e},pe=class{constructor(e){d(this,"config");d(this,"identity");d(this,"session");d(this,"queue");d(this,"transport");d(this,"flagsClient");d(this,"messagesClient");d(this,"surveysClient");d(this,"guidesClient");d(this,"captureListeners",new Set);d(this,"formsClient");d(this,"ctasClient");d(this,"context");d(this,"flushTimer");d(this,"flushing",false);d(this,"cachedFlags");d(this,"cachedSnapshot");d(this,"membershipCache");d(this,"stream");d(this,"shutDown",false);d(this,"exposures",new Set);d(this,"gates");d(this,"cookielessId");d(this,"storageListeners",new Set);var s,a,c;let n=Qe(e),r=(a=(s=de(n.sharedStorage,n.namespace))!=null?s:n.consent)!=null?a:null;if(this.gates=[new U(n.storage),new U(n.sharedStorage,bt)],n.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let u of this.gates)u.open();let[i,o]=this.gates;this.config={...n,sharedStorage:o,storage:i},this.identity=new ae(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new ue(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new le(this.config.maxQueueSize,({dropped:u})=>{this.config.onError(new O("queue_overflow",`event queue overflow: dropped ${u.length} oldest event(s)`));}),this.transport=(c=this.config.transport)!=null?c:new j({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new ne({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new ce({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new ie({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new oe({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new re({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new X({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,n={}){var r,i,o,s,a,c,u;try{this.identity.refresh();let p={...this.config.defaultProperties(),...n.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,n.element))!=null?o:{},...(s=n.properties)!=null?s:{}},l=tt({context:this.context,distinctId:(a=n.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:p,sessionId:(u=n.sessionId)!=null?u:(c=this.session)==null?void 0:c.current(),timestamp:n.timestamp},this.config.clock,this.config.ids);this.enqueue(l);}catch(p){this.config.onError(p);}for(let p of this.captureListeners)try{p(e);}catch(l){this.config.onError(l);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,n={}){var a,c;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=He(),s={...o===null?{}:{$timezone:o},...Ie((a=n.traits)!=null?a:{}),...(c=n.set)!=null?c:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(S.identify,{properties:i});}link(e,n,r){if(this.isCookieless())return;let i={$anon_distinct_id:n},o=Ie(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(S.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(S.createAlias,{properties:{alias:e}});}group(e,n,r){let i={$group_key:n,$group_type:e};r&&(i.$set=r),this.capture(S.group,{properties:i});}setPersonProperties(e,n){if(this.isCookieless())return;let r={};e&&(r.$set=e),n&&(r.$set_once=n),this.capture(S.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let n=Ie(e);Object.keys(n).length!==0&&this.capture(S.set,{properties:{$set:n}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),n=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:n.flags,variants:(r=n.variants)!=null?r:{}},n.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let n=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=n[e])!=null?s:false)),r}async getVariantLocal(e,n={}){var c;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(n,r.flags),s=i?we(i,r.flags,o):null,a=i?ee(i,r.flags,o).enabled:false;return this.recordExposure(e,(c=s==null?void 0:s.key)!=null?c:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,n){let r=`${this.identity.getDistinctId()} ${e} ${n}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(S.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:n}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let n=await this.flagSnapshot();return dt(n.flags,await this.localContext(e,n.flags))}async isFeatureEnabledLocal(e,n={}){var a,c;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(n,r.flags),s=i?ee(i,r.flags,o).enabled:false;return this.recordExposure(e,(c=i?(a=we(i,r.flags,o))==null?void 0:a.key:void 0)!=null?c:String(s)),s}async localContext(e,n){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&ct(n)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<kt?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<kt)return this.cachedSnapshot.snapshot;let n=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:n},this.maybeStream(n),n}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let n=new te({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=n,n.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(ht,{properties:se(e,{})});}captureSurveyDismissed(e){this.capture(ft,{properties:se(e,{})});}captureSurveySent(e,n){this.capture(yt,{properties:se(e,n)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,n,r){this.capture(e,{properties:vt(n,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,n,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:n,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,n,r){this.capture(e,{properties:et(n,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(pn);try{await this.transport.send({body:{events:e,sent_at:Q(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(n){this.queue.requeue(e),this.persistQueue(),this.config.onError(n);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let n=JSON.parse(e);Array.isArray(n)&&this.queue.restore(n);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),n=e;typeof n.unref=="function"&&n.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${un}`}};function mn(){let t=globalThis.document;return (t==null?void 0:t.visibilityState)==="hidden"}function gn(t){let e=globalThis.navigator,n=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!n)return false;let r=JSON.stringify({...t.body,api_key:t.projectKey});try{let i=new n([r],{type:"application/json"});return e.sendBeacon(t.url,i)}catch(i){return false}}var me=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new j(e);}async send(e){mn()&&gn(e)||await this.fetchTransport.send(e);}};var $e="prodantix:consent-ready",Ae="prodantix:consent",St="__prodantixConsent";var wt=(t,e)=>{t.takeCookielessId(e.anonymousId),e.consent!==null?t.setConsent(e.consent):e.rule==="notice"&&t.allowStorage();},Ct=(t,e)=>{let n=e[St];n&&wt(t,n);let r=o=>{let s=o.detail;s&&wt(t,s);},i=o=>{let s=o.detail;s&&t.setConsent(s);};return e.addEventListener($e,r),e.addEventListener(Ae,i),()=>{e.removeEventListener($e,r),e.removeEventListener(Ae,i);}};var hn=/^\d{1,3}(\.\d{1,3}){3}$/,fn=/^[a-z0-9.-]+$/i;function Et(){return Math.random().toString(36).slice(2,12)}function ge(t,e){let n=`${e}=`,r=[];for(let i of t.cookie.split(";")){let o=i.trim();o.startsWith(n)&&r.push(o.slice(n.length));}return r}function J(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function Tt(t,e,n,r){try{let i=`pdx_probe_${r()}`,o=r();t.cookie=`${i}=${o}; ${J(e,60,n)}`;let s=ge(t,i).includes(o);t.cookie=`${i}=; ${J(e,0,n)}`;let a=ge(t,i).includes(o);return s&&!a}catch(i){return false}}function yn(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||hn.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let i=n.length-2;i>=0;i-=1)r.push(n.slice(i).join("."));return r}function vn(t,e,n,r=Et){for(let i of yn(t))if(Tt(e,i,n,r))return i}function bn(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,i]of Object.entries(n))typeof i=="string"&&e.set(r,i);return e}var Pe=class{constructor(e,n,r,i){this.jar=e;this.name=n;this.domain=r;this.secure=i;}getItem(e){var n;return (n=this.read().get(e))!=null?n:null}setItem(e,n){let r=this.read();r.set(e,n),this.write(r);}removeItem(e){let n=this.read();n.delete(e)&&this.write(n);}read(){try{let e=ge(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${J(void 0,0,this.secure)}`,e=ge(this.jar,this.name));let n=e[0];return n?bn(n):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${J(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${J(this.domain,31536e3,this.secure)}`;}catch(n){return}}};function xn(){return globalThis.document}function kn(){var t,e;return (e=(t=globalThis.location)==null?void 0:t.hostname)!=null?e:""}function Sn(){var t;return ((t=globalThis.location)==null?void 0:t.protocol)==="https:"}function wn(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return fn.test(e)?e.toLowerCase():void 0}function Ft(t){var s,a,c,u,p;let e="jar"in t?t.jar:xn();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=t.random)!=null?a:Et,i=(c=t.secure)!=null?c:Sn(),o=(u=t.hostname)!=null?u:kn();try{let l=(p=wn(t.domain))!=null?p:vn(o,e,i,r);return Tt(e,l,i,r)?new Pe(e,t.name,l,i):null}catch(l){return null}}var he=t=>`prodantix-cta:${t}`,_t=t=>{try{let e=window.localStorage.getItem(he(t));return e===null?null:Number(e)}catch(e){return null}},It=t=>{try{return window.sessionStorage.getItem(he(t))!==null}catch(e){return false}},$t=(t,e)=>{try{window.localStorage.setItem(he(t),String(e)),window.sessionStorage.setItem(he(t),String(e));}catch(n){return}},At=(t,e,n,r)=>e===null?true:t.kind==="once"?false:t.kind==="session"?!n:r-e>=t.value*864e5;var N={am:{back:"\u1270\u1218\u1208\u1235",close:"\u12DD\u130B",closed:"\u12ED\u1205 \u1245\u133D \u12A0\u1201\u1295 \u121D\u120B\u123E\u127D\u1295 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",failed:"\u1218\u120B\u12AD \u12A0\u120D\u1270\u127B\u1208\u121D\u1362 \u12A5\u1295\u12F0\u1308\u1293 \u12ED\u121E\u12AD\u1229\u1362",invalid:"\u12ED\u1205 \u1218\u120D\u1235 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",next:"\u1240\u1323\u12ED",poweredBy:"\u1260Prodantix \u12E8\u1270\u1230\u122B",required:"\u12ED\u1205 \u12EB\u1235\u1348\u120D\u130B\u120D\u1362",sending:"\u1260\u1218\u120B\u12AD \u120B\u12ED\u2026",step:"\u12F0\u1228\u1303 {step} \u12A8{total}",submit:"\u120B\u12AD",thanks:"\u12A5\u1293\u1218\u1230\u130D\u1293\u1208\u1295\u1362"},ar:{back:"\u0631\u062C\u0648\u0639",close:"\u0625\u063A\u0644\u0627\u0642",closed:"\u0644\u0627 \u064A\u0642\u0628\u0644 \u0647\u0630\u0627 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0631\u062F\u0648\u062F\u064B\u0627 \u0627\u0644\u0622\u0646.",failed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",invalid:"\u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629.",next:"\u0627\u0644\u062A\u0627\u0644\u064A",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Prodantix",required:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628.",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",step:"\u0627\u0644\u062E\u0637\u0648\u0629 {step} \u0645\u0646 {total}",submit:"\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643."},bn:{back:"\u09AA\u09C7\u099B\u09A8\u09C7",close:"\u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8",closed:"\u098F\u0987 \u09AB\u09B0\u09CD\u09AE\u099F\u09BF \u098F\u0996\u09A8 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A8\u09BF\u099A\u09CD\u099B\u09C7 \u09A8\u09BE\u0964",failed:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09AF\u09BE\u09AF\u09BC\u09A8\u09BF\u0964 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09C1\u09A8\u0964",invalid:"\u098F\u0987 \u0989\u09A4\u09CD\u09A4\u09B0\u099F\u09BF \u0997\u09CD\u09B0\u09B9\u09A3\u09AF\u09CB\u0997\u09CD\u09AF \u09A8\u09AF\u09BC\u0964",next:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",poweredBy:"Prodantix \u09A6\u09CD\u09AC\u09BE\u09B0\u09BE \u099A\u09BE\u09B2\u09BF\u09A4",required:"\u098F\u099F\u09BF \u0986\u09AC\u09B6\u09CD\u09AF\u0995\u0964",sending:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09B9\u099A\u09CD\u099B\u09C7\u2026",step:"\u09A7\u09BE\u09AA {step} / {total}",submit:"\u099C\u09AE\u09BE \u09A6\u09BF\u09A8",thanks:"\u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6\u0964"},de:{back:"Zur\xFCck",close:"Schlie\xDFen",closed:"Dieses Formular nimmt gerade keine Antworten an.",failed:"Senden fehlgeschlagen. Bitte erneut versuchen.",invalid:"Diese Antwort wird nicht angenommen.",next:"Weiter",poweredBy:"Bereitgestellt von Prodantix",required:"Dieses Feld ist erforderlich.",sending:"Wird gesendet\u2026",step:"Schritt {step} von {total}",submit:"Absenden",thanks:"Vielen Dank."},en:{back:"Back",close:"Close",closed:"This form is not accepting responses right now.",failed:"This could not be sent. Try again.",invalid:"This answer is not accepted.",next:"Next",poweredBy:"Powered by Prodantix",required:"This is required.",sending:"Sending\u2026",step:"Step {step} of {total}",submit:"Submit",thanks:"Thank you."},es:{back:"Atr\xE1s",close:"Cerrar",closed:"Este formulario no acepta respuestas ahora.",failed:"No se pudo enviar. Int\xE9ntalo de nuevo.",invalid:"Esta respuesta no se acepta.",next:"Siguiente",poweredBy:"Con la tecnolog\xEDa de Prodantix",required:"Este campo es obligatorio.",sending:"Enviando\u2026",step:"Paso {step} de {total}",submit:"Enviar",thanks:"Gracias."},et:{back:"Tagasi",close:"Sulge",closed:"See vorm ei v\xF5ta praegu vastuseid vastu.",failed:"Saatmine eba\xF5nnestus. Proovi uuesti.",invalid:"Seda vastust ei v\xF5eta vastu.",next:"Edasi",poweredBy:"Toetab Prodantix",required:"See on kohustuslik.",sending:"Saatmine\u2026",step:"Samm {step}/{total}",submit:"Saada",thanks:"Ait\xE4h."},fil:{back:"Bumalik",close:"Isara",closed:"Hindi tumatanggap ng sagot ang form na ito ngayon.",failed:"Hindi naipadala. Subukan ulit.",invalid:"Hindi tinatanggap ang sagot na ito.",next:"Susunod",poweredBy:"Pinapagana ng Prodantix",required:"Kailangan ito.",sending:"Ipinapadala\u2026",step:"Hakbang {step} sa {total}",submit:"Ipadala",thanks:"Salamat."},fr:{back:"Retour",close:"Fermer",closed:"Ce formulaire n\u2019accepte plus de r\xE9ponses pour le moment.",failed:"L\u2019envoi a \xE9chou\xE9. R\xE9essayez.",invalid:"Cette r\xE9ponse n\u2019est pas accept\xE9e.",next:"Suivant",poweredBy:"Propuls\xE9 par Prodantix",required:"Ce champ est obligatoire.",sending:"Envoi\u2026",step:"\xC9tape {step} sur {total}",submit:"Envoyer",thanks:"Merci."},hi:{back:"\u092A\u0940\u091B\u0947",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",closed:"\u092F\u0939 \u092B\u093C\u0949\u0930\u094D\u092E \u0905\u092D\u0940 \u091C\u0935\u093E\u092C \u0928\u0939\u0940\u0902 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948\u0964",failed:"\u092D\u0947\u091C\u093E \u0928\u0939\u0940\u0902 \u091C\u093E \u0938\u0915\u093E\u0964 \u092B\u093F\u0930 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",invalid:"\u092F\u0939 \u091C\u0935\u093E\u092C \u0938\u094D\u0935\u0940\u0915\u093E\u0930 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",next:"\u0906\u0917\u0947",poweredBy:"Prodantix \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",required:"\u092F\u0939 \u091C\u093C\u0930\u0942\u0930\u0940 \u0939\u0948\u0964",sending:"\u092D\u0947\u091C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",step:"\u091A\u0930\u0923 {step} / {total}",submit:"\u092D\u0947\u091C\u0947\u0902",thanks:"\u0927\u0928\u094D\u092F\u0935\u093E\u0926\u0964"},id:{back:"Kembali",close:"Tutup",closed:"Formulir ini sedang tidak menerima tanggapan.",failed:"Gagal mengirim. Coba lagi.",invalid:"Jawaban ini tidak diterima.",next:"Berikutnya",poweredBy:"Didukung oleh Prodantix",required:"Wajib diisi.",sending:"Mengirim\u2026",step:"Langkah {step} dari {total}",submit:"Kirim",thanks:"Terima kasih."},ja:{back:"\u623B\u308B",close:"\u9589\u3058\u308B",closed:"\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306F\u73FE\u5728\u56DE\u7B54\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u305B\u3093\u3002",failed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",invalid:"\u3053\u306E\u56DE\u7B54\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3002",next:"\u6B21\u3078",poweredBy:"Powered by Prodantix",required:"\u5FC5\u9808\u9805\u76EE\u3067\u3059\u3002",sending:"\u9001\u4FE1\u4E2D\u2026",step:"\u30B9\u30C6\u30C3\u30D7 {step}/{total}",submit:"\u9001\u4FE1",thanks:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3057\u305F\u3002"},ko:{back:"\uC774\uC804",close:"\uB2EB\uAE30",closed:"\uC774 \uC591\uC2DD\uC740 \uC9C0\uAE08 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",failed:"\uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",invalid:"\uC774 \uB2F5\uBCC0\uC740 \uBC1B\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",next:"\uB2E4\uC74C",poweredBy:"Prodantix \uC81C\uACF5",required:"\uD544\uC218 \uD56D\uBAA9\uC785\uB2C8\uB2E4.",sending:"\uBCF4\uB0B4\uB294 \uC911\u2026",step:"{total}\uB2E8\uACC4 \uC911 {step}\uB2E8\uACC4",submit:"\uC81C\uCD9C",thanks:"\uAC10\uC0AC\uD569\uB2C8\uB2E4."},pt:{back:"Voltar",close:"Fechar",closed:"Este formul\xE1rio n\xE3o est\xE1 a aceitar respostas neste momento.",failed:"N\xE3o foi poss\xEDvel enviar. Tente novamente.",invalid:"Esta resposta n\xE3o \xE9 aceite.",next:"Seguinte",poweredBy:"Com tecnologia Prodantix",required:"Este campo \xE9 obrigat\xF3rio.",sending:"A enviar\u2026",step:"Passo {step} de {total}",submit:"Enviar",thanks:"Obrigado."},ru:{back:"\u041D\u0430\u0437\u0430\u0434",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",closed:"\u042D\u0442\u0430 \u0444\u043E\u0440\u043C\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u043E\u0442\u0432\u0435\u0442\u044B.",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",invalid:"\u042D\u0442\u043E\u0442 \u043E\u0442\u0432\u0435\u0442 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0441\u044F.",next:"\u0414\u0430\u043B\u0435\u0435",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Prodantix",required:"\u042D\u0442\u043E \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435.",sending:"\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430\u2026",step:"\u0428\u0430\u0433 {step} \u0438\u0437 {total}",submit:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",thanks:"\u0421\u043F\u0430\u0441\u0438\u0431\u043E."},sw:{back:"Rudi",close:"Funga",closed:"Fomu hii haipokei majibu kwa sasa.",failed:"Imeshindwa kutuma. Jaribu tena.",invalid:"Jibu hili halikubaliki.",next:"Endelea",poweredBy:"Inaendeshwa na Prodantix",required:"Hii inahitajika.",sending:"Inatuma\u2026",step:"Hatua {step} kati ya {total}",submit:"Tuma",thanks:"Asante."},vi:{back:"Quay l\u1EA1i",close:"\u0110\xF3ng",closed:"Bi\u1EC3u m\u1EABu n\xE0y hi\u1EC7n kh\xF4ng nh\u1EADn c\xE2u tr\u1EA3 l\u1EDDi.",failed:"Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c. H\xE3y th\u1EED l\u1EA1i.",invalid:"C\xE2u tr\u1EA3 l\u1EDDi n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn.",next:"Ti\u1EBFp",poweredBy:"\u0110\u01B0\u1EE3c h\u1ED7 tr\u1EE3 b\u1EDFi Prodantix",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c.",sending:"\u0110ang g\u1EEDi\u2026",step:"B\u01B0\u1EDBc {step}/{total}",submit:"G\u1EEDi",thanks:"C\u1EA3m \u01A1n b\u1EA1n."},zh:{back:"\u4E0A\u4E00\u6B65",close:"\u5173\u95ED",closed:"\u6B64\u8868\u5355\u76EE\u524D\u4E0D\u63A5\u53D7\u56DE\u590D\u3002",failed:"\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",invalid:"\u6B64\u56DE\u7B54\u65E0\u6548\u3002",next:"\u4E0B\u4E00\u6B65",poweredBy:"\u7531 Prodantix \u63D0\u4F9B\u652F\u6301",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879\u3002",sending:"\u6B63\u5728\u53D1\u9001\u2026",step:"\u7B2C {step} \u6B65\uFF0C\u5171 {total} \u6B65",submit:"\u63D0\u4EA4",thanks:"\u8C22\u8C22\u3002"}},Pt=t=>{var n;let e=(n=(t!=null?t:"").toLowerCase().split("-")[0])!=null?n:"";return e in N?e:"en"};var v="prodantix-cta",Rt="prodantix-cta-style",Cn=`.${v}{font-family:system-ui,sans-serif;color:var(--pdx-text);background:var(--pdx-background);border-radius:var(--pdx-radius);box-sizing:border-box;padding:16px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}
|
|
1
|
+
(function(){'use strict';var zt=Object.defineProperty;var Jt=(t,e,n)=>e in t?zt(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var d=(t,e,n)=>Jt(t,typeof e!="symbol"?e+"":e,n);var L=class extends Error{constructor(n,r,i){super(r,i);d(this,"code");this.code=n,this.name="ProdantixError";}},V=class extends L{constructor(e){super("config",e),this.name="ConfigError";}},B=class extends L{constructor(n,r){super("validation",r);d(this,"field");this.field=n,this.name="ValidationError";}},h=class extends L{constructor(n,r,i){super("transport",n,i);d(this,"status");this.status=r,this.name="TransportError";}};function T(t){if(t)return t;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function w(){let t=globalThis.AbortController;return t?new t:void 0}var Ke=t=>new Promise(e=>{setTimeout(e,t);});function E(t){return t.replace(/\/+$/,"")}var q=class{constructor(){d(this,"store",new Map);}getItem(e){var n;return (n=this.store.get(e))!=null?n:null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}},U=class{constructor(e,n=()=>false){this.real=e;this.passes=n;d(this,"held",new q);d(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,n){this.target(e).setItem(e,n);}};function Be(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch(t){return new q}return new q}var je={now:()=>new Date};function Q(t){return t.toISOString()}function He(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof t=="string"&&t!==""?t:null}function Wt(){return globalThis.crypto}function Yt(t){t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e=[];for(let n=0;n<16;n+=1)e.push(t[n].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Qt(){let t=Wt();if(t!=null&&t.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t!=null&&t.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return Yt(e)}var Ge={uuid:Qt};var Xt=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Zt=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ve(t){let e=0;for(let n of t)e+=1;return e}function Ue(t){return Xt.test(t)}function en(t){return Zt.test(t)}function ze(t){let e=Ve(t);if(e<1||e>200)throw new B("distinct_id","distinct_id must be between 1 and 200 characters")}function Je(t){let e=Ve(t);if(e<1||e>200)throw new B("event_name","event_name must be between 1 and 200 characters");if(!en(t))throw new B("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var We="prodantix-js",Ye="0.7.0";var tn=t=>{};function Qe(t){var i,o,s,a,c,u,p,l,I,A,f,C,F,W,R;if(!t.apiKey||!Ue(t.apiKey))throw new V("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!t.host)throw new V("host is required (the ingest base URL)");let e=E(t.host),n=t.defaultProperties,r=(i=t.storage)!=null?i:new q;return {apiKey:t.apiKey,autocapture:(o=t.autocapture)!=null?o:false,clock:(s=t.clock)!=null?s:je,consent:t.consent,consentMode:t.consentMode,defaultProperties:typeof n=="function"?n:()=>n!=null?n:{},describeElement:t.describeElement,flagsHost:t.flagsHost?E(t.flagsHost):e,flushAt:(a=t.flushAt)!=null?a:20,flushIntervalMs:(c=t.flushIntervalMs)!=null?c:1e4,host:e,ids:(u=t.ids)!=null?u:Ge,locale:t.locale,maxQueueSize:(p=t.maxQueueSize)!=null?p:1e3,maxRetries:(l=t.maxRetries)!=null?l:3,namespace:be(t.apiKey),onError:(I=t.onError)!=null?I:tn,os:t.os,requestTimeoutMs:(A=t.requestTimeoutMs)!=null?A:1e4,sdkName:(f=t.sdkName)!=null?f:We,sdkVersion:(C=t.sdkVersion)!=null?C:Ye,sessionTracking:(F=t.sessionTracking)!=null?F:false,sharedStorage:(W=t.sharedStorage)!=null?W:r,socketFactory:t.socketFactory,storage:r,streamFlags:(R=t.streamFlags)!=null?R:false,transport:t.transport}}function be(t){return t.slice(0,16)}var Xe="$cta_viewed",Ze="$cta_clicked",xe="$cta_dismissed",et=(t,e)=>{let n={$cta_id:t.id,$cta_kind:t.kind,$cta_variant:t.variant.key,$cta_version:t.version},r=e===void 0?void 0:t.variant.content.buttons[e];return r&&e!==void 0&&(n.$cta_button=e,n.$cta_button_label=r.label,r.action.kind==="form"&&(n.$cta_form_id=r.action.value)),n},X=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async ctas(e){let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new h(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function tt(t,e,n){var i,o,s;Je(t.eventName),ze(t.distinctId);let r={distinct_id:t.distinctId,event_id:(i=t.eventId)!=null?i:n.uuid(),event_name:t.eventName,properties:(o=t.properties)!=null?o:{},schema_version:1,timestamp:Q((s=t.timestamp)!=null?s:e.now())};return t.context&&(r.context=t.context),t.sessionId&&(r.session_id=t.sessionId),r}var K=Symbol("absent");function nn(t,e){var i,o;if(t==="distinct_id")return e.distinctId;let n=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,t)?r[t]:K}function D(t){return t===K?"undefined":String(t)}function nt(t){return t===K?Number.NaN:Number(t)}function rt(t){return t!==K&&t!==null&&t!==""}function it(t,e){if(!Array.isArray(e))return false;let n=D(t);return e.map(r=>String(r)).includes(n)}function st(t,e){var i,o;let n=nn(t.attribute,e),r=t.value;switch(t.op){case "is_set":return rt(n);case "is_not_set":return !rt(n);case "eq":return D(n)===D(r===void 0?K:r);case "neq":return D(n)!==D(r===void 0?K:r);case "contains":return D(n).includes(D(r===void 0?K:r));case "in":return it(n,r);case "not_in":return Array.isArray(r)?!it(n,r):false;case "gt":return Z(n,r,(s,a)=>s>a);case "gte":return Z(n,r,(s,a)=>s>=a);case "lt":return Z(n,r,(s,a)=>s<a);case "lte":return Z(n,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function Z(t,e,n){let r=nt(t),i=e===void 0?Number.NaN:nt(e);return Number.isNaN(r)||Number.isNaN(i)?false:n(r,i)}function ot(t,e){let n=`${t}:${e}`,r=2166136261;for(let i=0;i<n.length;i++)r^=n.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function ke(t,e){return t.targeting.length===0||t.targeting.every(n=>st(n,e))}function at(t,e){var o;let n=ot(t.key,e.distinctId),r=(o=t.variations)!=null?o:[];if(r.length===0)return t.rolloutPercentage>=100||n<t.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,n<i)return r[s].key;return r[0].key}function Se(t,e,n,r){var i;for(let o of (i=t.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(c=>c.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=Se(s,e,n,r)&&ke(s,n)&&at(s,n)===o.variationKey;if(r.pop(),!a)return false}return true}function ee(t,e,n){return t.enabled?Se(t,e,n,[t.key])?ke(t,n)?t.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:ot(t.key,n.distinctId)<t.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function dt(t,e){let n={};for(let r of t)n[r.key]=ee(r,t,e).enabled;return n}function we(t,e,n){var s,a;let r=(s=t.variations)!=null?s:[],i=r[0];if(!i)return null;if(!t.enabled||!Se(t,e,n,[t.key])||!ke(t,n))return i;let o=at(t,n);return (a=r.find(c=>c.key===o))!=null?a:i}function ct(t){return t.some(e=>e.targeting.some(n=>n.op==="in_cohort"||n.op==="not_in_cohort"))}function lt(t){return `40${JSON.stringify(t)}`}function ut(){return "3"}function pt(t){let e=t.charAt(0),n=t.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=Ce(n);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=n.charAt(0),i=n.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=Ce(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=Ce(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function Ce(t){try{return JSON.parse(t)}catch(e){return null}}var rn="/socket.io/?EIO=4&transport=websocket",sn=250,te=class{constructor(e){this.options=e;d(this,"socket",null);d(this,"heartbeat",null);d(this,"pending",null);d(this,"lastKey","");d(this,"ready",false);d(this,"closed",false);d(this,"heartbeatWindow",45e3);d(this,"factory");d(this,"setTimer");d(this,"clearTimer");var n,r,i;this.factory=(n=e.socketFactory)!=null?n:on,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${rn}`,n;try{n=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=n,n.onmessage=r=>this.receive(String(r.data)),n.onerror=()=>n.close(),n.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let n=pt(e);if(n.kind==="open"){this.armHeartbeat(n.pingInterval+n.pingTimeout),(r=this.socket)==null||r.send(lt({projectKey:this.options.projectKey}));return}if(n.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(ut());return}if(n.kind==="connectError"||n.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(n.kind==="event"){if(n.name==="ready"){this.ready=true;return}if(n.name==="flagChange"){let a=(s=n.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},sn));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var n;return (n=this.socket)==null?void 0:n.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function on(t){let e=globalThis.WebSocket;if(!e)throw new h("no WebSocket");return new e(t)}var ne=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let c=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!c.ok)throw new h(`flags request failed with status ${c.status}`,c.status);let u=JSON.parse(await c.text());return {flags:(s=u.flags)!=null?s:{},variants:(a=u.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new h("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/snapshot`,r=w(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new h(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),c={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(c.socketUrl=a.socketUrl),c}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new h(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var mt="$form_viewed",gt="$form_started",z=class extends Error{constructor(n,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=n,this.fields=r;}},re=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async request(e,n){let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:s,method:n.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,n){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(n)}`,{method:"GET"});if(r<200||r>=300)throw new h(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,n){var a,c,u,p;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(n),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let l=JSON.parse(i);o=(c=(a=l.error)==null?void 0:a.fields)!=null?c:[],s=(p=(u=l.error)==null?void 0:u.message)!=null?p:s;}catch(l){o=[];}throw new z(r,o,s)}};var ht="$survey_shown",ft="$survey_dismissed",yt="$survey_sent",ie=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async surveys(e,n){var s;let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${n?`&lang=${encodeURIComponent(n)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new h(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function se(t,e){let n={$survey_id:t.id,$survey_iteration:t.iteration,$survey_name:t.name};for(let[r,i]of Object.entries(e))n[`$survey_response_${r}`]=i;return n}var oe=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async guides(e){var o;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=w(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new h(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function vt(t,e){let n={$guide_id:t.id,$guide_iteration:t.iteration,$guide_name:t.name};return e!==void 0&&(n.$guide_step_id=e),n}function Ee(t){if(typeof t!="string")return;let e=Array.from(t).length;return e>=1&&e<=200?t:void 0}function Fe(t,e){return `pdx.${t}.${e}`}var _e="consent",an=["identityLink","analytics","marketing","functional"];function Te(t){if(typeof t!="string")return null;try{let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,r={};for(let i of an){let o=n[i];typeof o=="boolean"&&(r[i]=o);}return typeof n.version=="number"&&Number.isInteger(n.version)&&(r.version=n.version),Array.isArray(n.categories)&&n.categories.every(i=>typeof i=="string")&&(r.categories=n.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var bt=t=>t.endsWith(`.${_e}`);function de(t,e){return Te(t.getItem(Fe(e,_e)))}function dn(t,e,n){var s;let r=Fe(e,_e),i=Te(JSON.stringify(n)),o=i===null?null:Te(JSON.stringify({...(s=de(t,e))!=null?s:{},...i}));if(o===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(o));}var ae=class{constructor(e,n,r,i){this.storage=e;this.shared=n;this.ids=r;this.namespace=i;d(this,"anonymousId");d(this,"distinctId");d(this,"identified");this.refresh();}refresh(){let e=Ee(this.shared.getItem(this.key("anonymous_id"))),n=Ee(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,n!==e&&this.storage.setItem(this.key("anonymous_id"),e)):n?(this.anonymousId=n,this.shared.setItem(this.key("anonymous_id"),n)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=Ee(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return de(this.shared,this.namespace)}setConsent(e){dn(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let n=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=n||r!==this.anonymousId;return this.distinctId=e,this.identified=true,n&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:n}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:n})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return Fe(this.namespace,e)}};var ce=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async inbox(e){var s;let n=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(n,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new h(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,n){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:n,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new h(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new h("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,n,r){let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var le=class{constructor(e,n){this.maxSize=e;this.onOverflow=n;d(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let n=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,n)}snapshot(){return [...this.events]}enforceCap(){var n;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(n=this.onOverflow)==null||n.call(this,{dropped:e});}};var cn={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function ln(t){return `pdx.${t}.session`}var ue=class{constructor(e,n,r,i,o=cn){this.storage=e;this.ids=n;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),n=this.live(this.read(),e);if(n===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-n.lastActivityAt<=this.options.throttleMs)return n;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==n.id?r:n;return this.write({...i,lastActivityAt:e})}live(e,n){if(e!==void 0&&!(n-e.lastActivityAt>this.options.idleMs||n-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let n=JSON.parse(e);return typeof n.id=="string"&&typeof n.startedAt=="number"&&typeof n.lastActivityAt=="number"?{id:n.id,lastActivityAt:n.lastActivityAt,startedAt:n.startedAt}:void 0}catch(n){return}}key(){return ln(this.namespace)}};var S={createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",set:"$set"};function xt(t){return t>=400&&t<500&&t!==429}var j=class{constructor(e={}){d(this,"fetch");d(this,"maxRetries");d(this,"requestTimeoutMs");d(this,"baseDelayMs");d(this,"maxDelayMs");d(this,"sleep");d(this,"random");var n,r,i,o,s,a;this.fetch=T(e.fetch),this.maxRetries=(n=e.maxRetries)!=null?n:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:Ke,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(n,e,r);if(s.ok)return;if(xt(s.status))throw new h(`ingest rejected batch with status ${s.status}`,s.status);i=new h(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof h&&s.status!==void 0&&xt(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new h("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,n,r){let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n.url,{body:r,headers:{authorization:`Bearer ${n.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var un="queue",pn=1e3,kt=3e4,Ie=t=>{let e={};return t.avatar!==void 0&&(e.$avatar=t.avatar),t.email!==void 0&&(e.$email=t.email),t.name!==void 0&&(e.$name=t.name),t.phone!==void 0&&(e.$phone=t.phone),e},pe=class{constructor(e){d(this,"config");d(this,"identity");d(this,"session");d(this,"queue");d(this,"transport");d(this,"flagsClient");d(this,"messagesClient");d(this,"surveysClient");d(this,"guidesClient");d(this,"captureListeners",new Set);d(this,"formsClient");d(this,"ctasClient");d(this,"context");d(this,"flushTimer");d(this,"flushing",false);d(this,"cachedFlags");d(this,"cachedSnapshot");d(this,"membershipCache");d(this,"stream");d(this,"shutDown",false);d(this,"exposures",new Set);d(this,"gates");d(this,"cookielessId");d(this,"storageListeners",new Set);var s,a,c;let n=Qe(e),r=(a=(s=de(n.sharedStorage,n.namespace))!=null?s:n.consent)!=null?a:null;if(this.gates=[new U(n.storage),new U(n.sharedStorage,bt)],n.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let u of this.gates)u.open();let[i,o]=this.gates;this.config={...n,sharedStorage:o,storage:i},this.identity=new ae(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new ue(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new le(this.config.maxQueueSize,({dropped:u})=>{this.config.onError(new L("queue_overflow",`event queue overflow: dropped ${u.length} oldest event(s)`));}),this.transport=(c=this.config.transport)!=null?c:new j({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new ne({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new ce({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new ie({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new oe({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new re({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new X({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,n={}){var r,i,o,s,a,c,u;try{this.identity.refresh();let p={...this.config.defaultProperties(),...n.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,n.element))!=null?o:{},...(s=n.properties)!=null?s:{}},l=tt({context:this.context,distinctId:(a=n.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:p,sessionId:(u=n.sessionId)!=null?u:(c=this.session)==null?void 0:c.current(),timestamp:n.timestamp},this.config.clock,this.config.ids);this.enqueue(l);}catch(p){this.config.onError(p);}for(let p of this.captureListeners)try{p(e);}catch(l){this.config.onError(l);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,n={}){var a,c;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=He(),s={...o===null?{}:{$timezone:o},...Ie((a=n.traits)!=null?a:{}),...(c=n.set)!=null?c:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(S.identify,{properties:i});}link(e,n,r){if(this.isCookieless())return;let i={$anon_distinct_id:n},o=Ie(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(S.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(S.createAlias,{properties:{alias:e}});}group(e,n,r){let i={$group_key:n,$group_type:e};r&&(i.$set=r),this.capture(S.group,{properties:i});}setPersonProperties(e,n){if(this.isCookieless())return;let r={};e&&(r.$set=e),n&&(r.$set_once=n),this.capture(S.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let n=Ie(e);Object.keys(n).length!==0&&this.capture(S.set,{properties:{$set:n}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),n=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:n.flags,variants:(r=n.variants)!=null?r:{}},n.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let n=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=n[e])!=null?s:false)),r}async getVariantLocal(e,n={}){var c;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(n,r.flags),s=i?we(i,r.flags,o):null,a=i?ee(i,r.flags,o).enabled:false;return this.recordExposure(e,(c=s==null?void 0:s.key)!=null?c:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,n){let r=`${this.identity.getDistinctId()} ${e} ${n}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(S.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:n}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let n=await this.flagSnapshot();return dt(n.flags,await this.localContext(e,n.flags))}async isFeatureEnabledLocal(e,n={}){var a,c;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(n,r.flags),s=i?ee(i,r.flags,o).enabled:false;return this.recordExposure(e,(c=i?(a=we(i,r.flags,o))==null?void 0:a.key:void 0)!=null?c:String(s)),s}async localContext(e,n){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&ct(n)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<kt?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<kt)return this.cachedSnapshot.snapshot;let n=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:n},this.maybeStream(n),n}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let n=new te({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=n,n.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(ht,{properties:se(e,{})});}captureSurveyDismissed(e){this.capture(ft,{properties:se(e,{})});}captureSurveySent(e,n){this.capture(yt,{properties:se(e,n)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,n,r){this.capture(e,{properties:vt(n,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,n,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:n,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,n,r){this.capture(e,{properties:et(n,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(pn);try{await this.transport.send({body:{events:e,sent_at:Q(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(n){this.queue.requeue(e),this.persistQueue(),this.config.onError(n);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let n=JSON.parse(e);Array.isArray(n)&&this.queue.restore(n);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),n=e;typeof n.unref=="function"&&n.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${un}`}};function mn(){let t=globalThis.document;return (t==null?void 0:t.visibilityState)==="hidden"}function gn(t){let e=globalThis.navigator,n=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!n)return false;let r=JSON.stringify({...t.body,api_key:t.projectKey});try{let i=new n([r],{type:"application/json"});return e.sendBeacon(t.url,i)}catch(i){return false}}var me=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new j(e);}async send(e){mn()&&gn(e)||await this.fetchTransport.send(e);}};var $e="prodantix:consent-ready",Ae="prodantix:consent",St="__prodantixConsent";var wt=(t,e)=>{t.takeCookielessId(e.anonymousId),e.consent!==null?t.setConsent(e.consent):e.rule==="notice"&&t.allowStorage();},Ct=(t,e)=>{let n=e[St];n&&wt(t,n);let r=o=>{let s=o.detail;s&&wt(t,s);},i=o=>{let s=o.detail;s&&t.setConsent(s);};return e.addEventListener($e,r),e.addEventListener(Ae,i),()=>{e.removeEventListener($e,r),e.removeEventListener(Ae,i);}};var hn=/^\d{1,3}(\.\d{1,3}){3}$/,fn=/^[a-z0-9.-]+$/i;function Et(){return Math.random().toString(36).slice(2,12)}function ge(t,e){let n=`${e}=`,r=[];for(let i of t.cookie.split(";")){let o=i.trim();o.startsWith(n)&&r.push(o.slice(n.length));}return r}function J(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function Tt(t,e,n,r){try{let i=`pdx_probe_${r()}`,o=r();t.cookie=`${i}=${o}; ${J(e,60,n)}`;let s=ge(t,i).includes(o);t.cookie=`${i}=; ${J(e,0,n)}`;let a=ge(t,i).includes(o);return s&&!a}catch(i){return false}}function yn(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||hn.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let i=n.length-2;i>=0;i-=1)r.push(n.slice(i).join("."));return r}function vn(t,e,n,r=Et){for(let i of yn(t))if(Tt(e,i,n,r))return i}function bn(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,i]of Object.entries(n))typeof i=="string"&&e.set(r,i);return e}var Pe=class{constructor(e,n,r,i){this.jar=e;this.name=n;this.domain=r;this.secure=i;}getItem(e){var n;return (n=this.read().get(e))!=null?n:null}setItem(e,n){let r=this.read();r.set(e,n),this.write(r);}removeItem(e){let n=this.read();n.delete(e)&&this.write(n);}read(){try{let e=ge(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${J(void 0,0,this.secure)}`,e=ge(this.jar,this.name));let n=e[0];return n?bn(n):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${J(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${J(this.domain,31536e3,this.secure)}`;}catch(n){return}}};function xn(){return globalThis.document}function kn(){var t,e;return (e=(t=globalThis.location)==null?void 0:t.hostname)!=null?e:""}function Sn(){var t;return ((t=globalThis.location)==null?void 0:t.protocol)==="https:"}function wn(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return fn.test(e)?e.toLowerCase():void 0}function Ft(t){var s,a,c,u,p;let e="jar"in t?t.jar:xn();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=t.random)!=null?a:Et,i=(c=t.secure)!=null?c:Sn(),o=(u=t.hostname)!=null?u:kn();try{let l=(p=wn(t.domain))!=null?p:vn(o,e,i,r);return Tt(e,l,i,r)?new Pe(e,t.name,l,i):null}catch(l){return null}}var he=t=>`prodantix-cta:${t}`,_t=t=>{try{let e=window.localStorage.getItem(he(t));return e===null?null:Number(e)}catch(e){return null}},It=t=>{try{return window.sessionStorage.getItem(he(t))!==null}catch(e){return false}},$t=(t,e)=>{try{window.localStorage.setItem(he(t),String(e)),window.sessionStorage.setItem(he(t),String(e));}catch(n){return}},At=(t,e,n,r)=>e===null?true:t.kind==="once"?false:t.kind==="session"?!n:r-e>=t.value*864e5;var N={am:{back:"\u1270\u1218\u1208\u1235",close:"\u12DD\u130B",closed:"\u12ED\u1205 \u1245\u133D \u12A0\u1201\u1295 \u121D\u120B\u123E\u127D\u1295 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",failed:"\u1218\u120B\u12AD \u12A0\u120D\u1270\u127B\u1208\u121D\u1362 \u12A5\u1295\u12F0\u1308\u1293 \u12ED\u121E\u12AD\u1229\u1362",invalid:"\u12ED\u1205 \u1218\u120D\u1235 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",next:"\u1240\u1323\u12ED",poweredBy:"\u1260Prodantix \u12E8\u1270\u1230\u122B",required:"\u12ED\u1205 \u12EB\u1235\u1348\u120D\u130B\u120D\u1362",sending:"\u1260\u1218\u120B\u12AD \u120B\u12ED\u2026",step:"\u12F0\u1228\u1303 {step} \u12A8{total}",submit:"\u120B\u12AD",thanks:"\u12A5\u1293\u1218\u1230\u130D\u1293\u1208\u1295\u1362"},ar:{back:"\u0631\u062C\u0648\u0639",close:"\u0625\u063A\u0644\u0627\u0642",closed:"\u0644\u0627 \u064A\u0642\u0628\u0644 \u0647\u0630\u0627 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0631\u062F\u0648\u062F\u064B\u0627 \u0627\u0644\u0622\u0646.",failed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",invalid:"\u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629.",next:"\u0627\u0644\u062A\u0627\u0644\u064A",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Prodantix",required:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628.",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",step:"\u0627\u0644\u062E\u0637\u0648\u0629 {step} \u0645\u0646 {total}",submit:"\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643."},bn:{back:"\u09AA\u09C7\u099B\u09A8\u09C7",close:"\u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8",closed:"\u098F\u0987 \u09AB\u09B0\u09CD\u09AE\u099F\u09BF \u098F\u0996\u09A8 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A8\u09BF\u099A\u09CD\u099B\u09C7 \u09A8\u09BE\u0964",failed:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09AF\u09BE\u09AF\u09BC\u09A8\u09BF\u0964 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09C1\u09A8\u0964",invalid:"\u098F\u0987 \u0989\u09A4\u09CD\u09A4\u09B0\u099F\u09BF \u0997\u09CD\u09B0\u09B9\u09A3\u09AF\u09CB\u0997\u09CD\u09AF \u09A8\u09AF\u09BC\u0964",next:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",poweredBy:"Prodantix \u09A6\u09CD\u09AC\u09BE\u09B0\u09BE \u099A\u09BE\u09B2\u09BF\u09A4",required:"\u098F\u099F\u09BF \u0986\u09AC\u09B6\u09CD\u09AF\u0995\u0964",sending:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09B9\u099A\u09CD\u099B\u09C7\u2026",step:"\u09A7\u09BE\u09AA {step} / {total}",submit:"\u099C\u09AE\u09BE \u09A6\u09BF\u09A8",thanks:"\u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6\u0964"},de:{back:"Zur\xFCck",close:"Schlie\xDFen",closed:"Dieses Formular nimmt gerade keine Antworten an.",failed:"Senden fehlgeschlagen. Bitte erneut versuchen.",invalid:"Diese Antwort wird nicht angenommen.",next:"Weiter",poweredBy:"Bereitgestellt von Prodantix",required:"Dieses Feld ist erforderlich.",sending:"Wird gesendet\u2026",step:"Schritt {step} von {total}",submit:"Absenden",thanks:"Vielen Dank."},en:{back:"Back",close:"Close",closed:"This form is not accepting responses right now.",failed:"This could not be sent. Try again.",invalid:"This answer is not accepted.",next:"Next",poweredBy:"Powered by Prodantix",required:"This is required.",sending:"Sending\u2026",step:"Step {step} of {total}",submit:"Submit",thanks:"Thank you."},es:{back:"Atr\xE1s",close:"Cerrar",closed:"Este formulario no acepta respuestas ahora.",failed:"No se pudo enviar. Int\xE9ntalo de nuevo.",invalid:"Esta respuesta no se acepta.",next:"Siguiente",poweredBy:"Con la tecnolog\xEDa de Prodantix",required:"Este campo es obligatorio.",sending:"Enviando\u2026",step:"Paso {step} de {total}",submit:"Enviar",thanks:"Gracias."},et:{back:"Tagasi",close:"Sulge",closed:"See vorm ei v\xF5ta praegu vastuseid vastu.",failed:"Saatmine eba\xF5nnestus. Proovi uuesti.",invalid:"Seda vastust ei v\xF5eta vastu.",next:"Edasi",poweredBy:"Toetab Prodantix",required:"See on kohustuslik.",sending:"Saatmine\u2026",step:"Samm {step}/{total}",submit:"Saada",thanks:"Ait\xE4h."},fil:{back:"Bumalik",close:"Isara",closed:"Hindi tumatanggap ng sagot ang form na ito ngayon.",failed:"Hindi naipadala. Subukan ulit.",invalid:"Hindi tinatanggap ang sagot na ito.",next:"Susunod",poweredBy:"Pinapagana ng Prodantix",required:"Kailangan ito.",sending:"Ipinapadala\u2026",step:"Hakbang {step} sa {total}",submit:"Ipadala",thanks:"Salamat."},fr:{back:"Retour",close:"Fermer",closed:"Ce formulaire n\u2019accepte plus de r\xE9ponses pour le moment.",failed:"L\u2019envoi a \xE9chou\xE9. R\xE9essayez.",invalid:"Cette r\xE9ponse n\u2019est pas accept\xE9e.",next:"Suivant",poweredBy:"Propuls\xE9 par Prodantix",required:"Ce champ est obligatoire.",sending:"Envoi\u2026",step:"\xC9tape {step} sur {total}",submit:"Envoyer",thanks:"Merci."},hi:{back:"\u092A\u0940\u091B\u0947",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",closed:"\u092F\u0939 \u092B\u093C\u0949\u0930\u094D\u092E \u0905\u092D\u0940 \u091C\u0935\u093E\u092C \u0928\u0939\u0940\u0902 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948\u0964",failed:"\u092D\u0947\u091C\u093E \u0928\u0939\u0940\u0902 \u091C\u093E \u0938\u0915\u093E\u0964 \u092B\u093F\u0930 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",invalid:"\u092F\u0939 \u091C\u0935\u093E\u092C \u0938\u094D\u0935\u0940\u0915\u093E\u0930 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",next:"\u0906\u0917\u0947",poweredBy:"Prodantix \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",required:"\u092F\u0939 \u091C\u093C\u0930\u0942\u0930\u0940 \u0939\u0948\u0964",sending:"\u092D\u0947\u091C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",step:"\u091A\u0930\u0923 {step} / {total}",submit:"\u092D\u0947\u091C\u0947\u0902",thanks:"\u0927\u0928\u094D\u092F\u0935\u093E\u0926\u0964"},id:{back:"Kembali",close:"Tutup",closed:"Formulir ini sedang tidak menerima tanggapan.",failed:"Gagal mengirim. Coba lagi.",invalid:"Jawaban ini tidak diterima.",next:"Berikutnya",poweredBy:"Didukung oleh Prodantix",required:"Wajib diisi.",sending:"Mengirim\u2026",step:"Langkah {step} dari {total}",submit:"Kirim",thanks:"Terima kasih."},ja:{back:"\u623B\u308B",close:"\u9589\u3058\u308B",closed:"\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306F\u73FE\u5728\u56DE\u7B54\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u305B\u3093\u3002",failed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",invalid:"\u3053\u306E\u56DE\u7B54\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3002",next:"\u6B21\u3078",poweredBy:"Powered by Prodantix",required:"\u5FC5\u9808\u9805\u76EE\u3067\u3059\u3002",sending:"\u9001\u4FE1\u4E2D\u2026",step:"\u30B9\u30C6\u30C3\u30D7 {step}/{total}",submit:"\u9001\u4FE1",thanks:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3057\u305F\u3002"},ko:{back:"\uC774\uC804",close:"\uB2EB\uAE30",closed:"\uC774 \uC591\uC2DD\uC740 \uC9C0\uAE08 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",failed:"\uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",invalid:"\uC774 \uB2F5\uBCC0\uC740 \uBC1B\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",next:"\uB2E4\uC74C",poweredBy:"Prodantix \uC81C\uACF5",required:"\uD544\uC218 \uD56D\uBAA9\uC785\uB2C8\uB2E4.",sending:"\uBCF4\uB0B4\uB294 \uC911\u2026",step:"{total}\uB2E8\uACC4 \uC911 {step}\uB2E8\uACC4",submit:"\uC81C\uCD9C",thanks:"\uAC10\uC0AC\uD569\uB2C8\uB2E4."},pt:{back:"Voltar",close:"Fechar",closed:"Este formul\xE1rio n\xE3o est\xE1 a aceitar respostas neste momento.",failed:"N\xE3o foi poss\xEDvel enviar. Tente novamente.",invalid:"Esta resposta n\xE3o \xE9 aceite.",next:"Seguinte",poweredBy:"Com tecnologia Prodantix",required:"Este campo \xE9 obrigat\xF3rio.",sending:"A enviar\u2026",step:"Passo {step} de {total}",submit:"Enviar",thanks:"Obrigado."},ru:{back:"\u041D\u0430\u0437\u0430\u0434",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",closed:"\u042D\u0442\u0430 \u0444\u043E\u0440\u043C\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u043E\u0442\u0432\u0435\u0442\u044B.",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",invalid:"\u042D\u0442\u043E\u0442 \u043E\u0442\u0432\u0435\u0442 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0441\u044F.",next:"\u0414\u0430\u043B\u0435\u0435",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Prodantix",required:"\u042D\u0442\u043E \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435.",sending:"\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430\u2026",step:"\u0428\u0430\u0433 {step} \u0438\u0437 {total}",submit:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",thanks:"\u0421\u043F\u0430\u0441\u0438\u0431\u043E."},sw:{back:"Rudi",close:"Funga",closed:"Fomu hii haipokei majibu kwa sasa.",failed:"Imeshindwa kutuma. Jaribu tena.",invalid:"Jibu hili halikubaliki.",next:"Endelea",poweredBy:"Inaendeshwa na Prodantix",required:"Hii inahitajika.",sending:"Inatuma\u2026",step:"Hatua {step} kati ya {total}",submit:"Tuma",thanks:"Asante."},vi:{back:"Quay l\u1EA1i",close:"\u0110\xF3ng",closed:"Bi\u1EC3u m\u1EABu n\xE0y hi\u1EC7n kh\xF4ng nh\u1EADn c\xE2u tr\u1EA3 l\u1EDDi.",failed:"Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c. H\xE3y th\u1EED l\u1EA1i.",invalid:"C\xE2u tr\u1EA3 l\u1EDDi n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn.",next:"Ti\u1EBFp",poweredBy:"\u0110\u01B0\u1EE3c h\u1ED7 tr\u1EE3 b\u1EDFi Prodantix",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c.",sending:"\u0110ang g\u1EEDi\u2026",step:"B\u01B0\u1EDBc {step}/{total}",submit:"G\u1EEDi",thanks:"C\u1EA3m \u01A1n b\u1EA1n."},zh:{back:"\u4E0A\u4E00\u6B65",close:"\u5173\u95ED",closed:"\u6B64\u8868\u5355\u76EE\u524D\u4E0D\u63A5\u53D7\u56DE\u590D\u3002",failed:"\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",invalid:"\u6B64\u56DE\u7B54\u65E0\u6548\u3002",next:"\u4E0B\u4E00\u6B65",poweredBy:"\u7531 Prodantix \u63D0\u4F9B\u652F\u6301",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879\u3002",sending:"\u6B63\u5728\u53D1\u9001\u2026",step:"\u7B2C {step} \u6B65\uFF0C\u5171 {total} \u6B65",submit:"\u63D0\u4EA4",thanks:"\u8C22\u8C22\u3002"}},Pt=t=>{var n;let e=(n=(t!=null?t:"").toLowerCase().split("-")[0])!=null?n:"";return e in N?e:"en"};var v="prodantix-cta",Rt="prodantix-cta-style",Cn=`.${v}{font-family:system-ui,sans-serif;color:var(--pdx-text);background:var(--pdx-background);border-radius:var(--pdx-radius);box-sizing:border-box;padding:16px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}
|
|
2
2
|
.${v} *{box-sizing:border-box}
|
|
3
3
|
.${v} h2{font-size:18px;line-height:1.3;margin:0;font-weight:700}
|
|
4
4
|
.${v} p{margin:0;font-size:15px;line-height:1.5}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
dialog.${v}{border:0;max-width:min(480px,calc(100vw - 32px));box-shadow:0 16px 48px rgba(0,0,0,.24)}
|
|
20
20
|
dialog.${v}::backdrop{background:rgba(0,0,0,.45)}
|
|
21
21
|
@media (prefers-reduced-motion:no-preference){.${v}[data-kind=slide_in],.${v}[data-kind=banner],dialog.${v}{animation:pdx-cta-in .2s ease-out}}
|
|
22
|
-
@keyframes pdx-cta-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}`,En=()=>{if(document.getElementById(Rt))return;let t=document.createElement("style");t.id=Rt,t.textContent=Cn,document.head.append(t);},Tn=(t,e)=>{let n=e.variant.style;for(let[r,i]of [["--pdx-background",n.background],["--pdx-text",n.text],["--pdx-button",n.button],["--pdx-button-text",n.buttonText],["--pdx-radius",`${n.radius}px`]])t.style.setProperty(r,i);},Re=(t,e,n,r)=>{let i=e.variant.content,o=N[n.language];if(t.className=v,t.dataset.kind=e.kind,t.dataset.placement=e.placement,t.dataset.ctaId=e.id,Tn(t,e),i.image){let a=document.createElement("img");a.src=i.image,a.alt=i.imageAlt,a.loading="lazy",t.append(a);}let s=document.createElement("div");if(s.className="pdx-text",i.heading){let a=document.createElement("h2");a.textContent=i.heading,s.append(a);}if(i.body){let a=document.createElement("p");a.textContent=i.body,s.append(a);}if(t.append(s),i.buttons.length>0){let a=document.createElement("div");a.className="pdx-actions",i.buttons.forEach((c,u)=>{let p=document.createElement("button");p.type="button",p.textContent=c.label,p.dataset.action=`button-${u}`,u>0&&(p.dataset.secondary=""),p.addEventListener("click",()=>n.onButton(u)),a.append(p);}),t.append(a);}if(r){let a=document.createElement("button");a.type="button",a.className="pdx-close",a.dataset.action="close",a.textContent="\xD7",a.setAttribute("aria-label",o.close),a.title=o.close,a.addEventListener("click",r),t.append(a);}if(e.poweredBy){let a=document.createElement("p");a.className="pdx-meta",a.textContent=o.poweredBy,t.append(a);}},Mt=(t,e)=>{En();let n=t.variant.content.heading||t.variant.content.body;if(t.kind==="embedded"){let s=[...document.querySelectorAll("[data-prodantix-cta]")].filter(a=>a.dataset.prodantixCta===t.id).map(a=>{let c=document.createElement("section");return c.setAttribute("aria-label",n),Re(c,t,e,null),a.replaceChildren(c),c});return {destroy:()=>s.forEach(a=>a.remove()),elements:s}}if(t.kind==="popup"){let o=document.activeElement instanceof HTMLElement?document.activeElement:null,s=document.createElement("dialog");s.setAttribute("aria-label",n);let a=false,c=()=>{a||(a=true,s.open&&s.close(),s.remove(),o==null||o.focus());},u=()=>{c(),e.onDismiss();};return Re(s,t,e,u),s.addEventListener("cancel",p=>{p.preventDefault(),u();}),document.body.append(s),s.showModal(),{destroy:c,elements:[s]}}let r=document.createElement("section");r.setAttribute("aria-label",n),t.kind==="slide_in"&&(r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"));let i=()=>r.remove();return Re(r,t,e,()=>{i(),e.onDismiss();}),document.body.append(r),{destroy:i,elements:[r]}};var Nt=(t,e)=>{let n=false,r=[],i=()=>{n=true;for(let s of r.splice(0))s();},o=()=>{n||(i(),e());};if(t.kind==="load")queueMicrotask(o);else if(t.kind==="delay"){let s=setTimeout(o,t.value*1e3);r.push(()=>clearTimeout(s));}else if(t.kind==="scroll"){let s=()=>{let a=document.documentElement.scrollHeight-window.innerHeight;(a<=0||window.scrollY/a*100>=t.value)&&o();};window.addEventListener("scroll",s,{passive:true}),r.push(()=>window.removeEventListener("scroll",s)),s();}else if(t.kind==="exit"){let s=a=>{a.relatedTarget===null&&a.clientY<=0&&o();};document.addEventListener("mouseout",s),r.push(()=>document.removeEventListener("mouseout",s));}else {let s=t.value,a=u=>{try{return u.closest(s)!==null}catch(p){return false}},c=u=>{let p=u.target;p instanceof Element&&a(p)&&o();};document.addEventListener("click",c,true),r.push(()=>document.removeEventListener("click",c,true));}return i};var Fn=t=>{let e=0;for(let n of t){if(n!==0)return e+Math.clz32(n)-24;e+=8;}return e},_n=async t=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))),
|
|
22
|
+
@keyframes pdx-cta-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}`,En=()=>{if(document.getElementById(Rt))return;let t=document.createElement("style");t.id=Rt,t.textContent=Cn,document.head.append(t);},Tn=(t,e)=>{let n=e.variant.style;for(let[r,i]of [["--pdx-background",n.background],["--pdx-text",n.text],["--pdx-button",n.button],["--pdx-button-text",n.buttonText],["--pdx-radius",`${n.radius}px`]])t.style.setProperty(r,i);},Re=(t,e,n,r)=>{let i=e.variant.content,o=N[n.language];if(t.className=v,t.dataset.kind=e.kind,t.dataset.placement=e.placement,t.dataset.ctaId=e.id,Tn(t,e),i.image){let a=document.createElement("img");a.src=i.image,a.alt=i.imageAlt,a.loading="lazy",t.append(a);}let s=document.createElement("div");if(s.className="pdx-text",i.heading){let a=document.createElement("h2");a.textContent=i.heading,s.append(a);}if(i.body){let a=document.createElement("p");a.textContent=i.body,s.append(a);}if(t.append(s),i.buttons.length>0){let a=document.createElement("div");a.className="pdx-actions",i.buttons.forEach((c,u)=>{let p=document.createElement("button");p.type="button",p.textContent=c.label,p.dataset.action=`button-${u}`,u>0&&(p.dataset.secondary=""),p.addEventListener("click",()=>n.onButton(u)),a.append(p);}),t.append(a);}if(r){let a=document.createElement("button");a.type="button",a.className="pdx-close",a.dataset.action="close",a.textContent="\xD7",a.setAttribute("aria-label",o.close),a.title=o.close,a.addEventListener("click",r),t.append(a);}if(e.poweredBy){let a=document.createElement("p");a.className="pdx-meta",a.textContent=o.poweredBy,t.append(a);}},Mt=(t,e)=>{En();let n=t.variant.content.heading||t.variant.content.body;if(t.kind==="embedded"){let s=[...document.querySelectorAll("[data-prodantix-cta]")].filter(a=>a.dataset.prodantixCta===t.id).map(a=>{let c=document.createElement("section");return c.setAttribute("aria-label",n),Re(c,t,e,null),a.replaceChildren(c),c});return {destroy:()=>s.forEach(a=>a.remove()),elements:s}}if(t.kind==="popup"){let o=document.activeElement instanceof HTMLElement?document.activeElement:null,s=document.createElement("dialog");s.setAttribute("aria-label",n);let a=false,c=()=>{a||(a=true,s.open&&s.close(),s.remove(),o==null||o.focus());},u=()=>{c(),e.onDismiss();};return Re(s,t,e,u),s.addEventListener("cancel",p=>{p.preventDefault(),u();}),document.body.append(s),s.showModal(),{destroy:c,elements:[s]}}let r=document.createElement("section");r.setAttribute("aria-label",n),t.kind==="slide_in"&&(r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"));let i=()=>r.remove();return Re(r,t,e,()=>{i(),e.onDismiss();}),document.body.append(r),{destroy:i,elements:[r]}};var Nt=(t,e)=>{let n=false,r=[],i=()=>{n=true;for(let s of r.splice(0))s();},o=()=>{n||(i(),e());};if(t.kind==="load")queueMicrotask(o);else if(t.kind==="delay"){let s=setTimeout(o,t.value*1e3);r.push(()=>clearTimeout(s));}else if(t.kind==="scroll"){let s=()=>{let a=document.documentElement.scrollHeight-window.innerHeight;(a<=0||window.scrollY/a*100>=t.value)&&o();};window.addEventListener("scroll",s,{passive:true}),r.push(()=>window.removeEventListener("scroll",s)),s();}else if(t.kind==="exit"){let s=a=>{a.relatedTarget===null&&a.clientY<=0&&o();};document.addEventListener("mouseout",s),r.push(()=>document.removeEventListener("mouseout",s));}else {let s=t.value,a=u=>{try{return u.closest(s)!==null}catch(p){return false}},c=u=>{let p=u.target;p instanceof Element&&a(p)&&o();};document.addEventListener("click",c,true),r.push(()=>document.removeEventListener("click",c,true));}return i};var Fn=t=>{let e=0;for(let n of t){if(n!==0)return e+Math.clz32(n)-24;e+=8;}return e},_n=async t=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))),Ot=async t=>{for(let e=0;;e+=1){let n=e.toString(36);if(Fn(await _n(`${t.nonce}:${n}`))>=t.difficulty)return n}};var k="prodantix-form",In=`.${k}{font-family:var(--pdx-font);color:var(--pdx-text);background:var(--pdx-background);max-width:var(--pdx-width);box-sizing:border-box;padding:16px;border-radius:var(--pdx-radius)}
|
|
23
23
|
.${k} *{box-sizing:border-box}
|
|
24
24
|
.${k} .pdx-field{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
|
|
25
25
|
.${k} .pdx-field[hidden]{display:none}
|
|
@@ -32,6 +32,6 @@ dialog.${v}::backdrop{background:rgba(0,0,0,.45)}
|
|
|
32
32
|
.${k} button[data-variant=back]{background:transparent;color:inherit;border:1px solid currentColor}
|
|
33
33
|
.${k} .pdx-actions{display:flex;gap:8px;justify-content:flex-end}
|
|
34
34
|
.${k} .pdx-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
|
|
35
|
-
.${k} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,Ot=t=>t==null||t===false||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0,$n=(t,e)=>{let n=t.condition;if(!n)return true;let r=e[n.field];return Ot(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(o=>typeof o=="string"&&n.values.includes(o))},An=t=>{let e=`${encodeURIComponent(t)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(e));return n?decodeURIComponent(n.slice(e.length)):""},Pn=t=>{var n;let e=t.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?(n=new URLSearchParams(window.location.search).get(e.value))!=null?n:"":An(e.value):""},m=(t,e={},n=[])=>{let r=Object.assign(document.createElement(t),e);return r.append(...n),r},Rn=(t,e,n)=>{var p;let r=m("p",{className:"pdx-error",id:`${e}-error`}),i=t.help?m("p",{className:"pdx-help",id:`${e}-help`},[t.help]):null,o=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),s=m("div",{className:"pdx-field"});if(s.dataset.field=t.key,t.kind==="rich_text")return s.append(m("p",{},[t.label])),{error:r,field:t,focus:()=>{},read:()=>{},root:s};if(t.kind==="hidden")return s.hidden=true,{error:r,field:t,focus:()=>{},read:()=>Pn(t),root:s};if(t.kind==="radio"||t.kind==="checkboxes"){let l=m("fieldset",{});l.setAttribute("aria-describedby",o),t.required&&l.setAttribute("aria-required","true"),l.append(m("legend",{},[t.label]));let I=t.options.filter(f=>!f.archived).map((f,C)=>{let F=m("input",{id:`${e}-${C}`,name:e,type:t.kind==="radio"?"radio":"checkbox",value:f.value});return F.addEventListener("change",n),l.append(m("div",{className:"pdx-choice"},[F,m("label",{htmlFor:`${e}-${C}`},[f.label])])),F});return s.append(l,...i?[i]:[],r),{error:r,field:t,focus:()=>{var f;return (f=I[0])==null?void 0:f.focus()},read:()=>{var C;let f=I.filter(F=>F.checked).map(F=>F.value);return t.kind==="radio"?(C=f[0])!=null?C:"":f},root:s}}let a=m("label",{htmlFor:e},[t.label]),c;if(t.kind==="textarea")c=m("textarea",{id:e,placeholder:t.placeholder,rows:4});else if(t.kind==="dropdown")c=m("select",{id:e},[m("option",{value:""},[""]),...t.options.filter(l=>!l.archived).map(l=>m("option",{value:l.value},[l.label]))]);else if(t.kind==="checkbox")c=m("input",{id:e,type:"checkbox"});else {let l={date:"date",email:"email",file:"file",number:"number",phone:"tel"};c=m("input",{id:e,placeholder:t.placeholder,type:(p=l[t.kind])!=null?p:"text"}),t.kind==="email"&&(c.autocomplete="email");}return c.setAttribute("aria-describedby",o),t.required&&c.setAttribute("aria-required","true"),c.addEventListener("input",n),c.addEventListener("change",n),t.kind==="checkbox"?s.append(m("div",{className:"pdx-choice"},[c,a]),...i?[i]:[],r):s.append(a,...i?[i]:[],c,r),{error:r,field:t,focus:()=>c.focus(),read:()=>c instanceof HTMLInputElement&&c.type==="checkbox"?c.checked:t.kind==="number"?c.value===""?"":Number(c.value):c.value,root:s}},Mn=(t,e)=>{let n=e.style,r={"--pdx-background":n.background,"--pdx-button":n.button,"--pdx-button-text":n.buttonText,"--pdx-field-background":n.fieldBackground,"--pdx-field-text":n.fieldText,"--pdx-font":n.font,"--pdx-radius":`${n.radius}px`,"--pdx-text":n.text,"--pdx-width":`${n.width}px`};for(let[i,o]of Object.entries(r))t.style.setProperty(i,o);},Nn=()=>{document.getElementById("prodantix-form-style")||document.head.append(m("style",{id:"prodantix-form-style",textContent:In}));},qt=(t,e)=>{let{formId:n,host:r,language:i}=e,o=N[i],s=l=>o[l],a=m("form",{className:k,noValidate:true});a.dataset.prodantixForm=n;let c=m("p",{className:"pdx-meta"});c.setAttribute("aria-live","polite"),c.setAttribute("role","status");let u=false,p=r.form(n).then(l=>{if(u)return;if(!l.accepting){a.replaceChildren(m("p",{className:"pdx-meta"},[s("closed")]));return}Nn(),Mn(a,l);let I=l.challenge?Lt(l.challenge):null,A=false,f=[],C=()=>{let g={};for(let y of f.flat())if(!y.root.hidden||y.field.kind==="hidden"){let x=y.read();x!==void 0&&(g[y.field.key]=x);}return g},F=()=>{let g=C();for(let y of f.flat())y.field.kind!=="hidden"&&(y.root.hidden=!$n(y.field,g));},W=()=>{A||(A=true,r.capture(gt,{$form_id:l.id,$form_version:l.version})),F();},R=l.steps.map((g,y)=>{let x=m("div",{});x.dataset.step=String(y),g.title&&x.append(m("p",{className:"pdx-meta"},[g.title]));let b=g.fields.map(_=>Rn(_,`pdx-${n}-${_.key}`,W));return f.push(b),x.append(...b.map(_=>_.root)),x}),Ne=m("input",{autocomplete:"off",name:l.honeypot,tabIndex:-1,type:"text"}),Le=m("div",{className:"pdx-hp"},[Ne]);Le.setAttribute("aria-hidden","true");let fe=[],H=m("div",{});if(l.consent.processing){let g=m("input",{id:`pdx-${n}-consent`,type:"checkbox"});g.setAttribute("aria-required","true"),fe.push({input:g,key:"$consent_processing"}),H.append(m("div",{className:"pdx-choice"},[g,m("label",{htmlFor:g.id},[l.consent.processing])]));}for(let g of l.consent.purposes){let y=m("input",{id:`pdx-${n}-consent-${g.key}`,type:"checkbox"});fe.push({input:y,key:`$consent_${g.key}`}),H.append(m("div",{className:"pdx-choice"},[y,m("label",{htmlFor:y.id},[g.label])])),g.notice&&H.append(m("p",{className:"pdx-help"},[g.notice]));}let ye=m("p",{className:"pdx-meta"}),G=m("button",{type:"button"},[s("back")]);G.dataset.variant="back";let Y=m("button",{type:"button"},[s("next")]),L=m("button",{type:"submit"},[s("submit")]);G.dataset.action="back",Y.dataset.action="next",L.dataset.action="submit";let Gt=m("div",{className:"pdx-actions"},[G,Y,L]),P=0,ve=()=>{R.forEach((y,x)=>{y.hidden=x!==P;});let g=P===R.length-1;G.hidden=P===0,Y.hidden=g,L.hidden=!g,H.hidden=!g,ye.hidden=R.length<2,ye.textContent=s("step").replace("{step}",String(P+1)).replace("{total}",String(R.length));},Vt=()=>{var g;for(let y of f.flat())y.error.textContent="",(g=y.root.querySelector("[aria-invalid]"))==null||g.removeAttribute("aria-invalid");},Oe=(g,y)=>{var x;g.error.textContent=y,(x=g.root.querySelector("input,select,textarea,fieldset"))==null||x.setAttribute("aria-invalid","true");},qe=g=>{var b,_;Vt();let y=C(),x=((b=f[g])!=null?b:[]).filter(M=>!M.root.hidden&&M.field.required&&Ot(y[M.field.key]));for(let M of x)Oe(M,s("required"));return x.length>0?(c.textContent=s("required"),(_=x[0])==null||_.focus(),false):true};G.addEventListener("click",()=>{P=Math.max(0,P-1),ve();}),Y.addEventListener("click",()=>{qe(P)&&(P+=1,ve());}),a.addEventListener("submit",g=>{if(g.preventDefault(),!qe(P))return;let y={...C(),[l.honeypot]:Ne.value};for(let b of fe)y[b.key]=b.input.checked;L.disabled=true,L.textContent=s("sending");let x=l.challenge;if(!x||!I){c.textContent=s("closed");return}I.then(b=>r.submit(n,y,x,b)).then(b=>{if(b.kind==="redirect"&&b.value.startsWith("https://")){window.location.assign(b.value);return}let _=m("p",{},[b.kind==="message"&&b.value?b.value:s("thanks")]);_.setAttribute("role","status"),a.replaceChildren(_);}).catch(b=>{L.disabled=false,L.textContent=s("submit");let _=b instanceof z?b.fields:[];for(let M of _){let De=f.flat().find(Ut=>Ut.field.key===M.field);De&&Oe(De,M.rule==="required"?s("required"):s("invalid"));}c.textContent=_.length>0?s("invalid"):s("failed");});}),a.append(ye,...R,Le,H,Gt,c),l.poweredBy&&e.poweredBy!==false&&a.append(m("p",{className:"pdx-meta"},[s("poweredBy")])),ve(),F(),r.capture(mt,{$form_id:l.id,$form_version:l.version});}).catch(()=>{u||a.replaceChildren(m("p",{className:"pdx-meta"},[s("closed")]));});return t.append(a),{destroy:()=>{u=true,a.remove();},ready:p}};var Dt=t=>({capture:(e,n)=>t.capture(e,{properties:n}),form:e=>t.getForm(e),submit:(e,n,r,i)=>t.submitForm(e,n,r,i)});var Ln=t=>({capture:(e,n,r)=>t.captureCta(e,n,r),ctas:e=>t.getCtas(e),forms:Dt(t),isEnabled:e=>t.isFeatureEnabled(e),variant:async e=>{var n,r;return (r=(n=await t.getVariant(e))==null?void 0:n.key)!=null?r:null}}),On=t=>t<768?"mobile":t<1024?"tablet":"desktop",qn=async(t,e)=>{let n=e.flag;return n?n.variant?await t.variant(n.key)===n.variant:t.isEnabled(n.key):true},Dn=(t,e,n)=>{let r=document.createElement("dialog");r.className="prodantix-form-popup";let i=document.createElement("button");i.type="button",i.textContent="\xD7",i.setAttribute("aria-label",N[n].close),i.title=N[n].close,i.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(i),document.body.append(r),qt(r,{formId:t,host:e,language:n}),r.showModal();},Kn=()=>{let t=window.prodantix;typeof t=="function"&&t("open");},Bn=async(t,e)=>{var u,p;let n=(u=e.now)!=null?u:Date.now,r=(p=e.open)!=null?p:(l=>window.location.assign(l)),i=[],o=[],s=false,a=()=>{s=true;for(let l of i.splice(0))l();for(let l of o.splice(0))l.destroy();},c=await t.ctas({device:On(window.innerWidth),language:document.documentElement.lang||e.language,url:window.location.href});for(let l of c)s||!At(l.frequency,_t(l.id),It(l.id),n())||!await qn(t,l)||i.push(Nt(l.trigger,()=>{if(s)return;let I=Mt(l,{language:e.language,onButton:A=>{var C;t.capture(Ze,l,A);let f=(C=l.variant.content.buttons[A])==null?void 0:C.action;f&&((f.kind!=="url"||l.kind!=="embedded")&&I.destroy(),f.kind==="url"?r(f.value):f.kind==="form"?Dn(f.value,t.forms,e.language):f.kind==="messenger"?Kn():t.capture(xe,l));},onDismiss:()=>t.capture(xe,l)});I.elements.length!==0&&(o.push(I),$t(l.id,n()),t.capture(Xe,l));}));return a},jn=()=>{},Kt=(t,e)=>{let n=Ln(t),r=Pt(e!=null?e:document.documentElement.lang),i=()=>Bn(n,{language:r}).catch(p=>(console.error("[prodantix] the CTAs for this page could not be read",p),jn)),o=i(),s=window.location.href,a=()=>{if(window.location.href===s)return;s=window.location.href,o=o.then(l=>(l(),i()));},c=history.pushState.bind(history),u=history.replaceState.bind(history);return history.pushState=(...p)=>{c(...p),a();},history.replaceState=(...p)=>{u(...p),a();},window.addEventListener("popstate",a),()=>{history.pushState=c,history.replaceState=u,window.removeEventListener("popstate",a),o.then(p=>p());}};var Bt=(t,e)=>({...t.page?{$page_id:t.page}:{},...t.page&&e?{$page_view_id:e}:{},...t.variant?{$page_variant:t.variant}:{}});var Hn=(t,e)=>{var n;try{return (n=Ft({name:`pdx_${be(t)}`}))!=null?n:e}catch(r){return e}},$=document.currentScript,Me=$==null?void 0:$.dataset.key,jt,Ht;if($&&Me){let t=new URL($.src,window.location.href).origin,e=Be(),n=$.dataset.consent==="banner",r=new pe({apiKey:Me,...n?{consentMode:"banner"}:{},defaultProperties:Bt($.dataset),flagsHost:(jt=$.dataset.edge)!=null?jt:t,host:(Ht=$.dataset.host)!=null?Ht:t,sessionTracking:false,sharedStorage:Hn(Me,e),storage:e,transport:new me({})});n&&Ct(r,window),Kt(r,$.dataset.language);}
|
|
35
|
+
.${k} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,Lt=t=>t==null||t===false||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0,$n=(t,e)=>{let n=t.condition;if(!n)return true;let r=e[n.field];return Lt(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(o=>typeof o=="string"&&n.values.includes(o))},An=t=>{let e=`${encodeURIComponent(t)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(e));return n?decodeURIComponent(n.slice(e.length)):""},Pn=t=>{var n;let e=t.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?(n=new URLSearchParams(window.location.search).get(e.value))!=null?n:"":An(e.value):""},m=(t,e={},n=[])=>{let r=Object.assign(document.createElement(t),e);return r.append(...n),r},Rn=(t,e,n)=>{var p;let r=m("p",{className:"pdx-error",id:`${e}-error`}),i=t.help?m("p",{className:"pdx-help",id:`${e}-help`},[t.help]):null,o=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),s=m("div",{className:"pdx-field"});if(s.dataset.field=t.key,t.kind==="rich_text")return s.append(m("p",{},[t.label])),{error:r,field:t,focus:()=>{},read:()=>{},root:s};if(t.kind==="hidden")return s.hidden=true,{error:r,field:t,focus:()=>{},read:()=>Pn(t),root:s};if(t.kind==="radio"||t.kind==="checkboxes"){let l=m("fieldset",{});l.setAttribute("aria-describedby",o),t.required&&l.setAttribute("aria-required","true"),l.append(m("legend",{},[t.label]));let I=t.options.filter(f=>!f.archived).map((f,C)=>{let F=m("input",{id:`${e}-${C}`,name:e,type:t.kind==="radio"?"radio":"checkbox",value:f.value});return F.addEventListener("change",n),l.append(m("div",{className:"pdx-choice"},[F,m("label",{htmlFor:`${e}-${C}`},[f.label])])),F});return s.append(l,...i?[i]:[],r),{error:r,field:t,focus:()=>{var f;return (f=I[0])==null?void 0:f.focus()},read:()=>{var C;let f=I.filter(F=>F.checked).map(F=>F.value);return t.kind==="radio"?(C=f[0])!=null?C:"":f},root:s}}let a=m("label",{htmlFor:e},[t.label]),c;if(t.kind==="textarea")c=m("textarea",{id:e,placeholder:t.placeholder,rows:4});else if(t.kind==="dropdown")c=m("select",{id:e},[m("option",{value:""},[""]),...t.options.filter(l=>!l.archived).map(l=>m("option",{value:l.value},[l.label]))]);else if(t.kind==="checkbox")c=m("input",{id:e,type:"checkbox"});else {let l={date:"date",email:"email",file:"file",number:"number",phone:"tel"};c=m("input",{id:e,placeholder:t.placeholder,type:(p=l[t.kind])!=null?p:"text"}),t.kind==="email"&&(c.autocomplete="email");}return c.setAttribute("aria-describedby",o),t.required&&c.setAttribute("aria-required","true"),c.addEventListener("input",n),c.addEventListener("change",n),t.kind==="checkbox"?s.append(m("div",{className:"pdx-choice"},[c,a]),...i?[i]:[],r):s.append(a,...i?[i]:[],c,r),{error:r,field:t,focus:()=>c.focus(),read:()=>c instanceof HTMLInputElement&&c.type==="checkbox"?c.checked:t.kind==="number"?c.value===""?"":Number(c.value):c.value,root:s}},Mn=(t,e)=>{let n=e.style,r={"--pdx-background":n.background,"--pdx-button":n.button,"--pdx-button-text":n.buttonText,"--pdx-field-background":n.fieldBackground,"--pdx-field-text":n.fieldText,"--pdx-font":n.font,"--pdx-radius":`${n.radius}px`,"--pdx-text":n.text,"--pdx-width":`${n.width}px`};for(let[i,o]of Object.entries(r))t.style.setProperty(i,o);},Nn=()=>{document.getElementById("prodantix-form-style")||document.head.append(m("style",{id:"prodantix-form-style",textContent:In}));},qt=(t,e)=>{let{formId:n,host:r,language:i}=e,o=N[i],s=l=>o[l],a=m("form",{className:k,noValidate:true});a.dataset.prodantixForm=n;let c=m("p",{className:"pdx-meta"});c.setAttribute("aria-live","polite"),c.setAttribute("role","status");let u=false,p=r.form(n).then(l=>{if(u)return;if(!l.accepting){a.replaceChildren(m("p",{className:"pdx-meta"},[s("closed")]));return}Nn(),Mn(a,l);let I=l.challenge?Ot(l.challenge):null,A=false,f=[],C=()=>{let g={};for(let y of f.flat())if(!y.root.hidden||y.field.kind==="hidden"){let x=y.read();x!==void 0&&(g[y.field.key]=x);}return g},F=()=>{let g=C();for(let y of f.flat())y.field.kind!=="hidden"&&(y.root.hidden=!$n(y.field,g));},W=()=>{A||(A=true,r.capture(gt,{$form_id:l.id,$form_version:l.version})),F();},R=l.steps.map((g,y)=>{let x=m("div",{});x.dataset.step=String(y),g.title&&x.append(m("p",{className:"pdx-meta"},[g.title]));let b=g.fields.map(_=>Rn(_,`pdx-${n}-${_.key}`,W));return f.push(b),x.append(...b.map(_=>_.root)),x}),Ne=m("input",{autocomplete:"off",name:l.honeypot,tabIndex:-1,type:"text"}),Oe=m("div",{className:"pdx-hp"},[Ne]);Oe.setAttribute("aria-hidden","true");let fe=[],H=m("div",{});if(l.consent.processing){let g=m("input",{id:`pdx-${n}-consent`,type:"checkbox"});g.setAttribute("aria-required","true"),fe.push({input:g,key:"$consent_processing"}),H.append(m("div",{className:"pdx-choice"},[g,m("label",{htmlFor:g.id},[l.consent.processing])]));}for(let g of l.consent.purposes){let y=m("input",{id:`pdx-${n}-consent-${g.key}`,type:"checkbox"});fe.push({input:y,key:`$consent_${g.key}`}),H.append(m("div",{className:"pdx-choice"},[y,m("label",{htmlFor:y.id},[g.label])])),g.notice&&H.append(m("p",{className:"pdx-help"},[g.notice]));}let ye=m("p",{className:"pdx-meta"}),G=m("button",{type:"button"},[s("back")]);G.dataset.variant="back";let Y=m("button",{type:"button"},[s("next")]),O=m("button",{type:"submit"},[s("submit")]);G.dataset.action="back",Y.dataset.action="next",O.dataset.action="submit";let Gt=m("div",{className:"pdx-actions"},[G,Y,O]),P=0,ve=()=>{R.forEach((y,x)=>{y.hidden=x!==P;});let g=P===R.length-1;G.hidden=P===0,Y.hidden=g,O.hidden=!g,H.hidden=!g,ye.hidden=R.length<2,ye.textContent=s("step").replace("{step}",String(P+1)).replace("{total}",String(R.length));},Vt=()=>{var g;for(let y of f.flat())y.error.textContent="",(g=y.root.querySelector("[aria-invalid]"))==null||g.removeAttribute("aria-invalid");},Le=(g,y)=>{var x;g.error.textContent=y,(x=g.root.querySelector("input,select,textarea,fieldset"))==null||x.setAttribute("aria-invalid","true");},qe=g=>{var b,_;Vt();let y=C(),x=((b=f[g])!=null?b:[]).filter(M=>!M.root.hidden&&M.field.required&&Lt(y[M.field.key]));for(let M of x)Le(M,s("required"));return x.length>0?(c.textContent=s("required"),(_=x[0])==null||_.focus(),false):true};G.addEventListener("click",()=>{P=Math.max(0,P-1),ve();}),Y.addEventListener("click",()=>{qe(P)&&(P+=1,ve());}),a.addEventListener("submit",g=>{if(g.preventDefault(),!qe(P))return;let y={...C(),[l.honeypot]:Ne.value};for(let b of fe)y[b.key]=b.input.checked;O.disabled=true,O.textContent=s("sending");let x=l.challenge;if(!x||!I){c.textContent=s("closed");return}I.then(b=>r.submit(n,y,x,b)).then(b=>{if(b.kind==="redirect"&&b.value.startsWith("https://")){window.location.assign(b.value);return}let _=m("p",{},[b.kind==="message"&&b.value?b.value:s("thanks")]);_.setAttribute("role","status"),a.replaceChildren(_);}).catch(b=>{O.disabled=false,O.textContent=s("submit");let _=b instanceof z?b.fields:[];for(let M of _){let De=f.flat().find(Ut=>Ut.field.key===M.field);De&&Le(De,M.rule==="required"?s("required"):s("invalid"));}c.textContent=_.length>0?s("invalid"):s("failed");});}),a.append(ye,...R,Oe,H,Gt,c),l.poweredBy&&e.poweredBy!==false&&a.append(m("p",{className:"pdx-meta"},[s("poweredBy")])),ve(),F(),r.capture(mt,{$form_id:l.id,$form_version:l.version});}).catch(()=>{u||a.replaceChildren(m("p",{className:"pdx-meta"},[s("closed")]));});return t.append(a),{destroy:()=>{u=true,a.remove();},ready:p}};var Dt=t=>({capture:(e,n)=>t.capture(e,{properties:n}),form:e=>t.getForm(e),submit:(e,n,r,i)=>t.submitForm(e,n,r,i)});var On=t=>({capture:(e,n,r)=>t.captureCta(e,n,r),ctas:e=>t.getCtas(e),forms:Dt(t),isEnabled:e=>t.isFeatureEnabled(e),variant:async e=>{var n,r;return (r=(n=await t.getVariant(e))==null?void 0:n.key)!=null?r:null}}),Ln=t=>t<768?"mobile":t<1024?"tablet":"desktop",qn=async(t,e)=>{let n=e.flag;return n?n.variant?await t.variant(n.key)===n.variant:t.isEnabled(n.key):true},Dn=(t,e,n)=>{let r=document.createElement("dialog");r.className="prodantix-form-popup";let i=document.createElement("button");i.type="button",i.textContent="\xD7",i.setAttribute("aria-label",N[n].close),i.title=N[n].close,i.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(i),document.body.append(r),qt(r,{formId:t,host:e,language:n}),r.showModal();},Kn=()=>{let t=window.prodantix;typeof t=="function"&&t("open");},Bn=async(t,e)=>{var u,p;let n=(u=e.now)!=null?u:Date.now,r=(p=e.open)!=null?p:(l=>window.location.assign(l)),i=[],o=[],s=false,a=()=>{s=true;for(let l of i.splice(0))l();for(let l of o.splice(0))l.destroy();},c=await t.ctas({device:Ln(window.innerWidth),language:document.documentElement.lang||e.language,url:window.location.href});for(let l of c)s||!At(l.frequency,_t(l.id),It(l.id),n())||!await qn(t,l)||i.push(Nt(l.trigger,()=>{if(s)return;let I=Mt(l,{language:e.language,onButton:A=>{var C;t.capture(Ze,l,A);let f=(C=l.variant.content.buttons[A])==null?void 0:C.action;f&&((f.kind!=="url"||l.kind!=="embedded")&&I.destroy(),f.kind==="url"?r(f.value):f.kind==="form"?Dn(f.value,t.forms,e.language):f.kind==="messenger"?Kn():t.capture(xe,l));},onDismiss:()=>t.capture(xe,l)});I.elements.length!==0&&(o.push(I),$t(l.id,n()),t.capture(Xe,l));}));return a},jn=()=>{},Kt=(t,e)=>{let n=On(t),r=Pt(e!=null?e:document.documentElement.lang),i=()=>Bn(n,{language:r}).catch(p=>(console.error("[prodantix] the CTAs for this page could not be read",p),jn)),o=i(),s=window.location.href,a=()=>{if(window.location.href===s)return;s=window.location.href,o=o.then(l=>(l(),i()));},c=history.pushState.bind(history),u=history.replaceState.bind(history);return history.pushState=(...p)=>{c(...p),a();},history.replaceState=(...p)=>{u(...p),a();},window.addEventListener("popstate",a),()=>{history.pushState=c,history.replaceState=u,window.removeEventListener("popstate",a),o.then(p=>p());}};var Bt=(t,e)=>({...t.page?{$page_id:t.page}:{},...t.page&&e?{$page_view_id:e}:{},...t.variant?{$page_variant:t.variant}:{}});var Hn=(t,e)=>{var n;try{return (n=Ft({name:`pdx_${be(t)}`}))!=null?n:e}catch(r){return e}},$=document.currentScript,Me=$==null?void 0:$.dataset.key,jt,Ht;if($&&Me){let t=new URL($.src,window.location.href).origin,e=Be(),n=$.dataset.consent==="banner",r=new pe({apiKey:Me,...n?{consentMode:"banner"}:{},defaultProperties:Bt($.dataset),flagsHost:(jt=$.dataset.edge)!=null?jt:t,host:(Ht=$.dataset.host)!=null?Ht:t,sessionTracking:false,sharedStorage:Hn(Me,e),storage:e,transport:new me({})});n&&Ct(r,window),Kt(r,$.dataset.language);}
|
|
36
36
|
})();//# sourceMappingURL=ctas.iife.js.map
|
|
37
37
|
//# sourceMappingURL=ctas.iife.js.map
|