@sentientui/core 0.39.0 → 0.39.1

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.
@@ -1,2 +1,2 @@
1
- import{a as v}from"./chunk-WKXD7KI3.mjs";import{a as _,g as O}from"./chunk-Z6ILOYBD.mjs";import{A as ze,B as He,C as Ve,D as Ye,E as We,F as Je,G as Xe,H as Qe,I as Ze,J as et,K as tt,O as se,P as M,Q as P,R as ae,T as D,d as ne,e as oe,f as re,m as Oe,n as Me,o as Pe,p as De,q as Ge,r as ke,s as $e,t as Le,u as je,v as Ue,w as Ke,x as Fe,y as Be,z as qe}from"./chunk-VE2K45X4.mjs";import{a as B,b as q,c as z,d as H}from"./chunk-XZRKD2GS.mjs";import"./chunk-EVF5PQ4U.mjs";import{g as V,h as Y,i as W,l as J,m as X,o as Q,p as Z,q as ee,r as te}from"./chunk-MKM7TD3L.mjs";import{a as R,b as w,c as A}from"./chunk-J5EL7HKC.mjs";import{a as I,b}from"./chunk-TMCGHANO.mjs";var G="_snt_graph_edges",ie={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function ce(e){var t;return(t=ie[e])!=null?t:[]}function de(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function pe(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var ue=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function le(e){return ue.has(e)?e:"generic"}function k(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function me(e,t,n){let a=`${e}:${t}:${n.join(",")}`,s=5381;for(let o=0;o<a.length;o++)s=(s<<5)+s+a.charCodeAt(o)&4294967295;return(s>>>0).toString(16).padStart(8,"0")}function $(e){let t=new Map,n=new Map,a=`_snt_graph_nodes${R(e==null?void 0:e.apiKey)}`,s=()=>{typeof window!="undefined"&&pe(a,[...t.values()])};if(typeof window!="undefined"){let o=de(a,[]);for(let i of o)t.set(i.componentId,i);try{localStorage.removeItem(G)}catch(i){}}return{addPageNode(o){t.set(o.componentId,o),s()},addStructuralEdge(o){let i=`${o.fromComponentId}->${o.toComponentId}`;n.set(i,o)},syncOnce(){var i,c;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let o=[...t.values()];if(o.length!==0)try{let l=new Map;for(let r of o){let d=(i=l.get(r.semanticType))!=null?i:[];d.push(r),l.set(r.semanticType,d)}let u=[],m=new Set;for(let r of o)for(let d of ce(r.semanticType)){let p=(c=l.get(d))!=null?c:[];for(let S of p){if(S.componentId===r.componentId)continue;let f=`semantic:${r.componentId}->${S.componentId}`;m.has(f)||(m.add(f),u.push({fromComponentId:r.componentId,toComponentId:S.componentId,type:"semantic",weight:.4,confidence:.9}))}}let g=new Set(o.map(r=>r.componentId));for(let r of n.values()){if(!g.has(r.fromComponentId)||!g.has(r.toComponentId))continue;let d=`structural:${r.fromComponentId}->${r.toComponentId}`;m.has(d)||(m.add(d),u.push({fromComponentId:r.fromComponentId,toComponentId:r.toComponentId,type:"structural",weight:r.weight,confidence:1}))}let h=b(I(I({pageUrl:k(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:o.map(r=>{let d=le(r.semanticType);return{componentId:r.componentId,semanticType:d,answers:r.answers,contentHash:me(r.componentId,d,r.answers),prominenceScore:r.prominenceScore,depthInPage:r.depth}}),edges:u});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:I({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(h)}).catch(()=>{})}catch(l){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(a),localStorage.removeItem(G)}catch(o){}}}}var fe=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),ge=200,he="h1, h2, h3",Se="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",L=30,ye=1500,Ee={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function j(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function Ie(e){var t,n,a;try{let s=e;for(let o of Object.keys(s)){if(!o.startsWith("__reactFiber")&&!o.startsWith("__reactInternalInstance"))continue;let i=s[o],c=(a=(t=i==null?void 0:i.type)==null?void 0:t.displayName)!=null?a:(n=i==null?void 0:i.type)==null?void 0:n.name;if(c&&c.length>1)return c}}catch(s){}}function Ce(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var x=new Set(_);function be(e,t){let n=e.getAttribute("data-sentient-id"),a=n?t==null?void 0:t[n]:void 0;if(a&&x.has(a))return a;let s=e.getAttribute("data-sentient-type");if(s&&x.has(s))return s;let o=e.getAttribute("role");return o&&x.has(o)?o:O(e)}function Te(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)&4294967295;return(t>>>0).toString(16).padStart(8,"0")}function we(e){let t=[],n=e;for(;n;){let a=n.parentElement;if(!a){t.push(n.tagName.toLowerCase());break}let s=Array.prototype.indexOf.call(a.children,n);t.push(`${n.tagName.toLowerCase()}[${s}]`),n=a}return t.reverse().join("/")}function Ae(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${Te(we(e))}`}function ve(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function N(e,t,n){var s,o,i,c;let a=e.querySelector(he);return{componentId:Ae(e),semanticType:be(e,n),ariaLabel:(s=e.getAttribute("aria-label"))!=null?s:void 0,headingText:(i=(o=a==null?void 0:a.textContent)==null?void 0:o.trim())!=null?i:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:ve(e),reactComponentName:Ie(e),dataAttributes:Ce(e),locator:(c=v(e,e.ownerDocument))!=null?c:void 0}}function U(e){var o;let t=[],n=new Set,a="__root__",s=new Map;for(let[i,c]of e){let l=i.parentElement,u=a;for(;l;){if(e.has(l)){u=e.get(l);let g=e.get(i),h=`${u}->${g}`;!n.has(h)&&u!==g&&(n.add(h),t.push({fromComponentId:u,toComponentId:g,weight:.6}));break}l=l.parentElement}let m=(o=s.get(u))!=null?o:[];m.push(i),s.set(u,m)}for(let i of s.values()){if(i.length<2)continue;let c=i.length>L?i.slice(0,L):i;for(let l=0;l<c.length;l++)for(let u=l+1;u<c.length;u++){if(t.length>=ye)return t;let m=e.get(c[l]),g=e.get(c[u]);if(m===g)continue;let h=`${m}->${g}::sib`,r=`${g}->${m}::sib`;n.has(h)||(n.add(h),t.push({fromComponentId:m,toComponentId:g,weight:.3})),n.has(r)||(n.add(r),t.push({fromComponentId:g,toComponentId:m,weight:.3}))}}return t}function xe(e,t){let n=[],a=new Set,s=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(c=>{if(c instanceof Element&&!a.has(c)){a.add(c);let l=N(c,e,t);n.push(l),s.set(c,l.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(c=>{if(!(c instanceof Element)||a.has(c))return;let l=c.hasAttribute("aria-label"),u=c.hasAttribute("data-sentient-id");if(!l&&!u)return;a.add(c);let m=N(c,e,t);n.push(m),s.set(c,m.componentId)}),{nodes:n,edges:U(s),elementToId:s}}function K(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return Ee;let n=null,a=0,s=null,o=new Map,i=r=>{try{let d=window.getComputedStyle(r),p=parseFloat(d.fontSize)||12,S=parseFloat(d.zIndex)||0,f=r.getBoundingClientRect(),E=Math.max(f.top,0),y=window.innerHeight||1,C=1/(E/y+1),F=j(p,12,48)*.4+C*.4+j(S,0,100)*.2;return Math.max(0,Math.min(1,F))}catch(d){return .5}},c=()=>new Promise(r=>{let d=()=>{let{nodes:p,edges:S,elementToId:f}=xe(i,t);o.clear();for(let[E,y]of f)o.set(E,y);r({nodes:p,edges:S,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?a=requestIdleCallback(d,{timeout:100}):d()}catch(p){d()}}),l=new Set,u=null,m=()=>{u=null;let r=[...l];l.clear();let d=[],p=new Set;for(let f of r){if(!f.isConnected)continue;let E=[];fe.has(f.tagName)&&(f.hasAttribute("data-sentient-id")||f.hasAttribute("aria-label"))&&E.push(f);try{f.querySelectorAll(Se).forEach(y=>E.push(y))}catch(y){}for(let y of E){if(o.has(y))continue;let C=N(y,i,t);d.push(C),p.add(C.componentId),o.set(y,C.componentId)}}if(d.length===0||!s)return;for(let f of[...o.keys()])f.isConnected||o.delete(f);let S=U(o).filter(f=>p.has(f.fromComponentId)||p.has(f.toComponentId));s({nodes:d,edges:S,addedAt:Date.now()})};return{scan:c,observe:r=>{s=r;try{n=new MutationObserver(d=>{for(let p of d)p.type==="childList"&&p.addedNodes.forEach(S=>{S instanceof Element&&l.add(S)});l.size>0&&u===null&&(u=setTimeout(m,ge))}),n.observe(document.body,{childList:!0,subtree:!0})}catch(d){}},getProminenceScore:i,destroy:()=>{if(n&&(n.disconnect(),n=null),u!==null&&clearTimeout(u),u=null,l.clear(),a&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(a)}catch(r){}a=0,s=null,o.clear()}}}var Ne="https://api.sentient-ui.com/v1/events";function Re(e){var n;let t=a=>{try{let s=document.cookie.match(new RegExp(`(?:^|; )${a}=([^;]*)`));return s?decodeURIComponent(s[1]):void 0}catch(s){return}};return(n=e?t(A(e)):void 0)!=null?n:t(w)}var T=new Map;function _e(e){var r;let t=D(e),n=e.respectDoNotTrack!==!1&&P(),a=e.consent===!1||n,s=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),o=e.localMode===!0||!s;if(!e.graph||o||typeof window=="undefined")return t;if(a)return n||M(e.apiKey,d=>_e(d)),t;let i=T.get(e.apiKey);if(i)try{i()}catch(d){}let c=K({sectionTypes:e.sectionTypes}),l=(r=e.ingestUrl)!=null?r:Ne,u=$({syncUrl:l.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Re(e.apiKey)});c.scan().then(d=>{for(let p of d.nodes)u.addPageNode({id:p.componentId,componentId:p.componentId,semanticType:p.semanticType,answers:e.captureDomText&&p.headingText?[p.headingText]:[],prominenceScore:p.prominenceScore,depth:p.depth});for(let p of d.edges)u.addStructuralEdge(p);u.syncOnce()});let m=null,g=()=>{m!==null&&clearTimeout(m),m=setTimeout(()=>{m=null,u.syncOnce()},500)};c.observe(d=>{for(let p of d.nodes)u.addPageNode({id:p.componentId,componentId:p.componentId,semanticType:p.semanticType,answers:e.captureDomText&&p.headingText?[p.headingText]:[],prominenceScore:p.prominenceScore,depth:p.depth});for(let p of d.edges)u.addStructuralEdge(p);g()});let h=()=>{m!==null&&(clearTimeout(m),m=null),c.destroy(),u.destroy(),T.get(e.apiKey)===h&&T.delete(e.apiKey)};return T.set(e.apiKey,h),b(I({},t),{getGraph:()=>u.snapshot(),dispose:()=>{h(),t.dispose()},destroy:()=>{h(),t.destroy()}})}export{Me as BLOCK_ALIGNS,$e as BLOCK_EMPHASES,Ue as BLOCK_FITS,Oe as BLOCK_GAPS,Ke as BLOCK_GRID_COLUMNS,Fe as BLOCK_HEADING_LEVELS,Pe as BLOCK_JUSTIFIES,ze as BLOCK_MAX_WIDTHS,qe as BLOCK_PADS,je as BLOCK_RATIOS,De as BLOCK_SIZES,Be as BLOCK_SURFACES,Le as BLOCK_TEXT_ALIGNS,ke as BLOCK_TONES,Ge as BLOCK_WEIGHTS,He as FORM_FIELD_KINDS,Ve as FORM_INPUT_TYPES,w as LEGACY_SESSION_COOKIE_NAME,Ze as MAX_BLOCK_ARMS,Qe as MAX_BLOCK_CHILDREN,Xe as MAX_BLOCK_DEPTH,Je as MAX_BLOCK_NODES,et as MAX_BLOCK_TEXT_LEN,Ye as MAX_FORM_FIELDS,We as MAX_FORM_SELECT_OPTIONS,B as SNAPSHOT_STORAGE_KEY_PREFIX,ne as STAGE_ATTRIBUTE,te as armOfResult,se as attachMicroSignalDetectors,Z as baselineResultFor,ee as baselineSlots,tt as containsFormBlock,X as deriveSessionSegment,V as detectDeviceClass,J as detectTimeOfDay,Y as detectTrafficSource,oe as exposedStage,ae as grantConsent,_e as init,P as isDoNotTrackEnabled,v as locatorFromElement,q as readSnapshot,W as referrerDomainFromReferer,H as renderPrePaintScript,k as sanitizePageUrl,A as sessionCookieName,re as setStageAttribute,Q as toWireSlot,z as writeSnapshot};
1
+ import{a as v}from"./chunk-WKXD7KI3.mjs";import{a as _,g as O}from"./chunk-Z6ILOYBD.mjs";import{A as ze,B as He,C as Ve,D as Ye,E as We,F as Je,G as Xe,H as Qe,I as Ze,J as et,K as tt,O as se,P as M,Q as P,R as ae,T as D,d as ne,e as oe,f as re,m as Oe,n as Me,o as Pe,p as De,q as Ge,r as ke,s as $e,t as Le,u as je,v as Ue,w as Ke,x as Fe,y as Be,z as qe}from"./chunk-QEIHHO3T.mjs";import{a as B,b as q,c as z,d as H}from"./chunk-XZRKD2GS.mjs";import"./chunk-EVF5PQ4U.mjs";import{g as V,h as Y,i as W,l as J,m as X,o as Q,p as Z,q as ee,r as te}from"./chunk-MKM7TD3L.mjs";import{a as R,b as w,c as A}from"./chunk-J5EL7HKC.mjs";import{a as I,b}from"./chunk-TMCGHANO.mjs";var G="_snt_graph_edges",ie={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function ce(e){var t;return(t=ie[e])!=null?t:[]}function de(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function pe(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var ue=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function le(e){return ue.has(e)?e:"generic"}function k(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function me(e,t,n){let a=`${e}:${t}:${n.join(",")}`,s=5381;for(let o=0;o<a.length;o++)s=(s<<5)+s+a.charCodeAt(o)&4294967295;return(s>>>0).toString(16).padStart(8,"0")}function $(e){let t=new Map,n=new Map,a=`_snt_graph_nodes${R(e==null?void 0:e.apiKey)}`,s=()=>{typeof window!="undefined"&&pe(a,[...t.values()])};if(typeof window!="undefined"){let o=de(a,[]);for(let i of o)t.set(i.componentId,i);try{localStorage.removeItem(G)}catch(i){}}return{addPageNode(o){t.set(o.componentId,o),s()},addStructuralEdge(o){let i=`${o.fromComponentId}->${o.toComponentId}`;n.set(i,o)},syncOnce(){var i,c;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let o=[...t.values()];if(o.length!==0)try{let l=new Map;for(let r of o){let d=(i=l.get(r.semanticType))!=null?i:[];d.push(r),l.set(r.semanticType,d)}let u=[],m=new Set;for(let r of o)for(let d of ce(r.semanticType)){let p=(c=l.get(d))!=null?c:[];for(let S of p){if(S.componentId===r.componentId)continue;let f=`semantic:${r.componentId}->${S.componentId}`;m.has(f)||(m.add(f),u.push({fromComponentId:r.componentId,toComponentId:S.componentId,type:"semantic",weight:.4,confidence:.9}))}}let g=new Set(o.map(r=>r.componentId));for(let r of n.values()){if(!g.has(r.fromComponentId)||!g.has(r.toComponentId))continue;let d=`structural:${r.fromComponentId}->${r.toComponentId}`;m.has(d)||(m.add(d),u.push({fromComponentId:r.fromComponentId,toComponentId:r.toComponentId,type:"structural",weight:r.weight,confidence:1}))}let h=b(I(I({pageUrl:k(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:o.map(r=>{let d=le(r.semanticType);return{componentId:r.componentId,semanticType:d,answers:r.answers,contentHash:me(r.componentId,d,r.answers),prominenceScore:r.prominenceScore,depthInPage:r.depth}}),edges:u});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:I({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(h)}).catch(()=>{})}catch(l){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(a),localStorage.removeItem(G)}catch(o){}}}}var fe=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),ge=200,he="h1, h2, h3",Se="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",L=30,ye=1500,Ee={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function j(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function Ie(e){var t,n,a;try{let s=e;for(let o of Object.keys(s)){if(!o.startsWith("__reactFiber")&&!o.startsWith("__reactInternalInstance"))continue;let i=s[o],c=(a=(t=i==null?void 0:i.type)==null?void 0:t.displayName)!=null?a:(n=i==null?void 0:i.type)==null?void 0:n.name;if(c&&c.length>1)return c}}catch(s){}}function Ce(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var x=new Set(_);function be(e,t){let n=e.getAttribute("data-sentient-id"),a=n?t==null?void 0:t[n]:void 0;if(a&&x.has(a))return a;let s=e.getAttribute("data-sentient-type");if(s&&x.has(s))return s;let o=e.getAttribute("role");return o&&x.has(o)?o:O(e)}function Te(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)&4294967295;return(t>>>0).toString(16).padStart(8,"0")}function we(e){let t=[],n=e;for(;n;){let a=n.parentElement;if(!a){t.push(n.tagName.toLowerCase());break}let s=Array.prototype.indexOf.call(a.children,n);t.push(`${n.tagName.toLowerCase()}[${s}]`),n=a}return t.reverse().join("/")}function Ae(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${Te(we(e))}`}function ve(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function N(e,t,n){var s,o,i,c;let a=e.querySelector(he);return{componentId:Ae(e),semanticType:be(e,n),ariaLabel:(s=e.getAttribute("aria-label"))!=null?s:void 0,headingText:(i=(o=a==null?void 0:a.textContent)==null?void 0:o.trim())!=null?i:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:ve(e),reactComponentName:Ie(e),dataAttributes:Ce(e),locator:(c=v(e,e.ownerDocument))!=null?c:void 0}}function U(e){var o;let t=[],n=new Set,a="__root__",s=new Map;for(let[i,c]of e){let l=i.parentElement,u=a;for(;l;){if(e.has(l)){u=e.get(l);let g=e.get(i),h=`${u}->${g}`;!n.has(h)&&u!==g&&(n.add(h),t.push({fromComponentId:u,toComponentId:g,weight:.6}));break}l=l.parentElement}let m=(o=s.get(u))!=null?o:[];m.push(i),s.set(u,m)}for(let i of s.values()){if(i.length<2)continue;let c=i.length>L?i.slice(0,L):i;for(let l=0;l<c.length;l++)for(let u=l+1;u<c.length;u++){if(t.length>=ye)return t;let m=e.get(c[l]),g=e.get(c[u]);if(m===g)continue;let h=`${m}->${g}::sib`,r=`${g}->${m}::sib`;n.has(h)||(n.add(h),t.push({fromComponentId:m,toComponentId:g,weight:.3})),n.has(r)||(n.add(r),t.push({fromComponentId:g,toComponentId:m,weight:.3}))}}return t}function xe(e,t){let n=[],a=new Set,s=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(c=>{if(c instanceof Element&&!a.has(c)){a.add(c);let l=N(c,e,t);n.push(l),s.set(c,l.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(c=>{if(!(c instanceof Element)||a.has(c))return;let l=c.hasAttribute("aria-label"),u=c.hasAttribute("data-sentient-id");if(!l&&!u)return;a.add(c);let m=N(c,e,t);n.push(m),s.set(c,m.componentId)}),{nodes:n,edges:U(s),elementToId:s}}function K(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return Ee;let n=null,a=0,s=null,o=new Map,i=r=>{try{let d=window.getComputedStyle(r),p=parseFloat(d.fontSize)||12,S=parseFloat(d.zIndex)||0,f=r.getBoundingClientRect(),E=Math.max(f.top,0),y=window.innerHeight||1,C=1/(E/y+1),F=j(p,12,48)*.4+C*.4+j(S,0,100)*.2;return Math.max(0,Math.min(1,F))}catch(d){return .5}},c=()=>new Promise(r=>{let d=()=>{let{nodes:p,edges:S,elementToId:f}=xe(i,t);o.clear();for(let[E,y]of f)o.set(E,y);r({nodes:p,edges:S,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?a=requestIdleCallback(d,{timeout:100}):d()}catch(p){d()}}),l=new Set,u=null,m=()=>{u=null;let r=[...l];l.clear();let d=[],p=new Set;for(let f of r){if(!f.isConnected)continue;let E=[];fe.has(f.tagName)&&(f.hasAttribute("data-sentient-id")||f.hasAttribute("aria-label"))&&E.push(f);try{f.querySelectorAll(Se).forEach(y=>E.push(y))}catch(y){}for(let y of E){if(o.has(y))continue;let C=N(y,i,t);d.push(C),p.add(C.componentId),o.set(y,C.componentId)}}if(d.length===0||!s)return;for(let f of[...o.keys()])f.isConnected||o.delete(f);let S=U(o).filter(f=>p.has(f.fromComponentId)||p.has(f.toComponentId));s({nodes:d,edges:S,addedAt:Date.now()})};return{scan:c,observe:r=>{s=r;try{n=new MutationObserver(d=>{for(let p of d)p.type==="childList"&&p.addedNodes.forEach(S=>{S instanceof Element&&l.add(S)});l.size>0&&u===null&&(u=setTimeout(m,ge))}),n.observe(document.body,{childList:!0,subtree:!0})}catch(d){}},getProminenceScore:i,destroy:()=>{if(n&&(n.disconnect(),n=null),u!==null&&clearTimeout(u),u=null,l.clear(),a&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(a)}catch(r){}a=0,s=null,o.clear()}}}var Ne="https://api.sentient-ui.com/v1/events";function Re(e){var n;let t=a=>{try{let s=document.cookie.match(new RegExp(`(?:^|; )${a}=([^;]*)`));return s?decodeURIComponent(s[1]):void 0}catch(s){return}};return(n=e?t(A(e)):void 0)!=null?n:t(w)}var T=new Map;function _e(e){var r;let t=D(e),n=e.respectDoNotTrack!==!1&&P(),a=e.consent===!1||n,s=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),o=e.localMode===!0||!s;if(!e.graph||o||typeof window=="undefined")return t;if(a)return n||M(e.apiKey,d=>_e(d)),t;let i=T.get(e.apiKey);if(i)try{i()}catch(d){}let c=K({sectionTypes:e.sectionTypes}),l=(r=e.ingestUrl)!=null?r:Ne,u=$({syncUrl:l.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Re(e.apiKey)});c.scan().then(d=>{for(let p of d.nodes)u.addPageNode({id:p.componentId,componentId:p.componentId,semanticType:p.semanticType,answers:e.captureDomText&&p.headingText?[p.headingText]:[],prominenceScore:p.prominenceScore,depth:p.depth});for(let p of d.edges)u.addStructuralEdge(p);u.syncOnce()});let m=null,g=()=>{m!==null&&clearTimeout(m),m=setTimeout(()=>{m=null,u.syncOnce()},500)};c.observe(d=>{for(let p of d.nodes)u.addPageNode({id:p.componentId,componentId:p.componentId,semanticType:p.semanticType,answers:e.captureDomText&&p.headingText?[p.headingText]:[],prominenceScore:p.prominenceScore,depth:p.depth});for(let p of d.edges)u.addStructuralEdge(p);g()});let h=()=>{m!==null&&(clearTimeout(m),m=null),c.destroy(),u.destroy(),T.get(e.apiKey)===h&&T.delete(e.apiKey)};return T.set(e.apiKey,h),b(I({},t),{getGraph:()=>u.snapshot(),dispose:()=>{h(),t.dispose()},destroy:()=>{h(),t.destroy()}})}export{Me as BLOCK_ALIGNS,$e as BLOCK_EMPHASES,Ue as BLOCK_FITS,Oe as BLOCK_GAPS,Ke as BLOCK_GRID_COLUMNS,Fe as BLOCK_HEADING_LEVELS,Pe as BLOCK_JUSTIFIES,ze as BLOCK_MAX_WIDTHS,qe as BLOCK_PADS,je as BLOCK_RATIOS,De as BLOCK_SIZES,Be as BLOCK_SURFACES,Le as BLOCK_TEXT_ALIGNS,ke as BLOCK_TONES,Ge as BLOCK_WEIGHTS,He as FORM_FIELD_KINDS,Ve as FORM_INPUT_TYPES,w as LEGACY_SESSION_COOKIE_NAME,Ze as MAX_BLOCK_ARMS,Qe as MAX_BLOCK_CHILDREN,Xe as MAX_BLOCK_DEPTH,Je as MAX_BLOCK_NODES,et as MAX_BLOCK_TEXT_LEN,Ye as MAX_FORM_FIELDS,We as MAX_FORM_SELECT_OPTIONS,B as SNAPSHOT_STORAGE_KEY_PREFIX,ne as STAGE_ATTRIBUTE,te as armOfResult,se as attachMicroSignalDetectors,Z as baselineResultFor,ee as baselineSlots,tt as containsFormBlock,X as deriveSessionSegment,V as detectDeviceClass,J as detectTimeOfDay,Y as detectTrafficSource,oe as exposedStage,ae as grantConsent,_e as init,P as isDoNotTrackEnabled,v as locatorFromElement,q as readSnapshot,W as referrerDomainFromReferer,H as renderPrePaintScript,k as sanitizePageUrl,A as sessionCookieName,re as setStageAttribute,Q as toWireSlot,z as writeSnapshot};
2
2
  //# sourceMappingURL=index-graph.mjs.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Gn=Object.create;var Le=Object.defineProperty,Un=Object.defineProperties,$n=Object.getOwnPropertyDescriptor,Fn=Object.getOwnPropertyDescriptors,jn=Object.getOwnPropertyNames,rn=Object.getOwnPropertySymbols,Wn=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty,Vn=Object.prototype.propertyIsEnumerable;var sn=(e,t,n)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t)=>{for(var n in t||(t={}))an.call(t,n)&&sn(e,n,t[n]);if(rn)for(var n of rn(t))Vn.call(t,n)&&sn(e,n,t[n]);return e},Se=(e,t)=>Un(e,Fn(t));var Hn=(e,t)=>{for(var n in t)Le(e,n,{get:t[n],enumerable:!0})},ln=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of jn(t))!an.call(e,p)&&p!==n&&Le(e,p,{get:()=>t[p],enumerable:!(i=$n(t,p))||i.enumerable});return e};var zn=(e,t,n)=>(n=e!=null?Gn(Wn(e)):{},ln(t||!e||!e.__esModule?Le(n,"default",{value:e,enumerable:!0}):n,e)),Qn=e=>ln(Le({},"__esModule",{value:!0}),e);var Xo={};Hn(Xo,{AGENT_INTENTS:()=>it,BLOCK_ALIGNS:()=>yo,BLOCK_EMPHASES:()=>ko,BLOCK_FITS:()=>Eo,BLOCK_GAPS:()=>mo,BLOCK_GRID_COLUMNS:()=>_o,BLOCK_HEADING_LEVELS:()=>Io,BLOCK_JUSTIFIES:()=>So,BLOCK_MAX_WIDTHS:()=>Co,BLOCK_PADS:()=>Ro,BLOCK_RATIOS:()=>wo,BLOCK_SIZES:()=>ho,BLOCK_SURFACES:()=>Ao,BLOCK_TEXT_ALIGNS:()=>xo,BLOCK_TONES:()=>vo,BLOCK_WEIGHTS:()=>bo,CLICK_ID_KEYS:()=>Ct,FORM_FIELD_KINDS:()=>To,FORM_INPUT_TYPES:()=>Oo,LEGACY_SESSION_COOKIE_NAME:()=>he,LOCAL_MODE_BANNER:()=>Tt,MAX_BLOCK_ARMS:()=>No,MAX_BLOCK_CHILDREN:()=>Mo,MAX_BLOCK_DEPTH:()=>Lo,MAX_BLOCK_NODES:()=>Bo,MAX_BLOCK_TEXT_LEN:()=>Ko,MAX_FORM_FIELDS:()=>Po,MAX_FORM_SELECT_OPTIONS:()=>Do,MAX_SKELETON_LEAVES:()=>Br,MAX_SKELETON_NODES:()=>Dr,MAX_SKELETON_TEXT:()=>Lr,PAGE_SCOPE_RE:()=>Pt,PROD_KEYLESS_ERROR:()=>ft,REVEAL_MS:()=>Bt,SNAPSHOT_STORAGE_KEY_PREFIX:()=>fe,STAGE_ATTRIBUTE:()=>ct,_registerConsentUpgradeInit:()=>$o,agentIntent:()=>mn,agentUaList:()=>Ge,applyNonce:()=>Je,armOfResult:()=>lt,attachMicroSignalDetectors:()=>Rn,baselineResultFor:()=>Oe,baselineSlots:()=>hn,classifiedAgents:()=>yn,containsFormBlock:()=>_n,cspNonce:()=>wt,deriveSessionSegment:()=>Sn,detectDeviceClass:()=>$e,detectTimeOfDay:()=>We,detectTrafficSource:()=>Fe,exposedStage:()=>dt,extractTrackedParams:()=>at,forgetGeneration:()=>se,forgetVisitor:()=>tt,grantConsent:()=>zo,init:()=>Ln,isDoNotTrackEnabled:()=>Ut,matchedAgentToken:()=>Rt,normalizeUrlPattern:()=>En,pageScopeMatches:()=>xn,readSnapshot:()=>Ie,referrerDomainFromReferer:()=>je,renderPrePaintScript:()=>cn,resetRevealStyles:()=>In,reveal:()=>An,routeKey:()=>Kt,sessionCookieName:()=>_e,setCspNonce:()=>Xe,setStageAttribute:()=>ut,toWireSlot:()=>Ve,uaTokenMatch:()=>Ue,urlMatches:()=>wn,writeSnapshot:()=>Ae});module.exports=Qn(Xo);function ue(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function kt(e,t){return new Promise(n=>{let i=setTimeout(()=>n(!1),t),p=()=>{clearTimeout(i),n(!0)};e.then(p,p)})}var xt;function Xe(e){xt=typeof e=="string"&&e!==""?e:void 0}function wt(e=document){if(xt)return xt;try{let t=e.querySelector("script[nonce]");return(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"))||void 0}catch(t){return}}function Je(e,t=document){let n=wt(t);return n&&e.setAttribute("nonce",n),e}function pe(e){return e?`_${e.slice(0,12)}`:""}var he="_snt_uid";function _e(e){return`${he}${pe(e)}`}var qe="__sntForgetGen",Xn=()=>{try{return window[qe]}catch(e){return}};function Ye(e){var t,n;try{let i=window,p=(t=i[qe])!=null?t:i[qe]={};p[e]=((n=p[e])!=null?n:0)+1}catch(i){}}function se(e){var t,n;return(n=(t=Xn())==null?void 0:t[e])!=null?n:0}var fe="_snt_snap:";var Jn=["low","medium","high"];function Ie(e){try{let t=localStorage.getItem(fe+e);if(!t)return null;let n=JSON.parse(t);if(!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!Jn.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let i=n.vocabulary;return i!==void 0&&(typeof i!="object"||i===null||!Array.isArray(i.entries)||!Array.isArray(i.images))&&delete n.vocabulary,n.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function Ae(e,t){try{localStorage.setItem(fe+e,JSON.stringify(t))}catch(n){}}function cn(e,t){return'(function(){try{var N=navigator,W=window;if(N.doNotTrack=="1"||N.doNotTrack=="yes"||W.doNotTrack=="1"||N.msDoNotTrack=="1"||N.globalPrivacyControl)return;var r=localStorage.getItem('+JSON.stringify(fe+e).replace(/</g,"\\u003c")+');if(!r)return;var s=JSON.parse(r);if(!s||s.v!==1||typeof s.persona!=="string"||typeof s.band!=="string")return;if(!('+2592e6+">Date.now()-s.savedAt))return;var d=document.documentElement;"+(t!=null&&t.stage?'if(typeof s.stage=="string"&&!d.hasAttribute("data-sentient-stage"))d.setAttribute("data-sentient-stage",s.stage);':"")+'if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",s.persona);d.setAttribute("data-sentient-confidence",s.band);}catch(e){}})();'}function me(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Re(e){if(e.ok===!0)return"delivered";let{status:t}=e;return typeof t!="number"?"retry":t>=200&&t<300?"delivered":t>=400&&t<500&&t!==429?"dropped":"retry"}function Ze(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let i=JSON.parse(n);return Array.isArray(i)?(localStorage.removeItem(e),i.slice(-t)):[]}catch(n){return[]}}function Me(e,t,n){try{let i=(()=>{try{let u=localStorage.getItem(n);if(!u)return[];let y=JSON.parse(u);return Array.isArray(y)?y:[]}catch(u){return[]}})(),p=new Map;for(let u of i)p.set(u.id,u);for(let u of e)p.set(u.id,u);localStorage.setItem(n,JSON.stringify([...p.values()].slice(-t)))}catch(i){}}function et(e,t){try{let n=localStorage.getItem(t);if(!n)return;let i=JSON.parse(n);if(!Array.isArray(i))return;let p=new Set(e),u=i.filter(y=>!p.has(y.id));if(u.length===i.length)return;u.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(u))}catch(n){}}var qn=500,Yn=56*1024;function Ne(e){return`_snt_retry_${e.slice(0,12)}`}var Zn={push:()=>{},flush:()=>{},destroy:()=>{}};function dn(e){var O,ee,ie;if(typeof window=="undefined")return Zn;let t=(O=e.flushIntervalMs)!=null?O:5e3,n=(ee=e.maxBatchSize)!=null?ee:20,i=(ie=e.maxRetrySize)!=null?ie:100,p=e.ingestUrl,u=e.apiKey,y=Ne(u),o=!1,f=se(u),a=(...k)=>{!o&&se(u)===f&&Me(...k)},s=[],c=new Set,v=[],T=k=>{for(let B of k)C.delete(B),!c.has(B)&&(c.add(B),v.push(B));for(;v.length>qn;){let B=v.shift();B&&c.delete(B)}et(k,y)},C=new Set,D=()=>{for(;s.length>i;){let k=s.shift();k&&C.delete(k.id)}},M=k=>{c.has(k.id)||C.has(k.id)||(C.add(k.id),s.push(k),D())},V=k=>{for(let B of k)c.has(B.id)||(C.add(B.id),s.push(B));D()},H=Ze(y,i);for(let k of H)M(k);let z=0,X=0,Q=(k,B=!0)=>{if(k.length===0)return;let ge=JSON.stringify(k),be=k.map(oe=>oe.id),te,ke=ue(15e3);try{te=fetch(p,{method:"POST",keepalive:!0,signal:ke.signal,body:ge,headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`}})}catch(oe){a(k,i,y),V(k),X++,z=Date.now()+me(X);return}Promise.resolve(te).then(ke.clear,ke.clear);let xe=oe=>{if(Re(oe)!=="retry"){if(!oe.ok&&B){let we=k.filter(ae=>ae.eventType!=="pageview");if(we.length>0&&we.length<k.length){T(k.filter(ae=>ae.eventType==="pageview").map(ae=>ae.id)),Q(we,!1);return}}T(be),X=0,z=0;return}a(k,i,y),V(k),X++,z=Date.now()+me(X)};te&&typeof te.then=="function"?te.then(xe).catch(()=>{a(k,i,y),V(k),X++,z=Date.now()+me(X)}):xe(te)},$=typeof TextEncoder!="undefined"?new TextEncoder:null,d=k=>$?$.encode(k).length:k.length,m=k=>{let B=[],ge=2;for(let be of k){let te=d(JSON.stringify(be))+1;if(B.length>0&&ge+te>Yn||B.length>=n)break;B.push(be),ge+=te}return B},h=()=>{try{if(Date.now()<z)return;for(;s.length>0&&!(Date.now()<z);){let k=s.filter(ge=>!c.has(ge.id));if(s.length=0,k.length===0)break;let B=m(k);if(B.length===0)break;B.length<k.length&&s.push(...k.slice(B.length)),Q(B)}}catch(k){}},g=!0,_=null;_=setInterval(()=>{g&&h()},t);let N=()=>{document.visibilityState==="hidden"&&h()},F=()=>{h()};return document.addEventListener("visibilitychange",N),window.addEventListener("pagehide",F),{push(k){M(k),s.length>=n&&h()},flush:h,destroy(k){k!=null&&k.forget&&(o=!0),g=!1,_!==null&&(clearInterval(_),_=null),document.removeEventListener("visibilitychange",N),window.removeEventListener("pagehide",F),h()}}}var eo=200;function Ke(e){return`_snt_goal_retry_${e.slice(0,12)}`}var to={send:()=>{},flush:()=>{},destroy:()=>{}};function un(e){var d,m,h;if(typeof window=="undefined")return to;let t=(d=e.flushIntervalMs)!=null?d:5e3,n=(m=e.maxRetrySize)!=null?m:100,i=(h=e.maxPerFlush)!=null?h:5,p=Ke(e.apiKey),u=!1,y=se(e.apiKey),o=(...g)=>{!u&&se(e.apiKey)===y&&Me(...g)},f=[],a=new Set,s=new Set,c=[],v=0,T=0,C=!1,D=g=>{for(a.delete(g.id),s.has(g.id)||(s.add(g.id),c.push(g.id));c.length>eo;){let _=c.shift();_&&s.delete(_)}et([g.id],p)},M=g=>{o([g],n,p),!s.has(g.id)&&!a.has(g.id)&&(a.add(g.id),f.push(g)),Date.now()>=v&&(T++,v=Date.now()+me(T))},V=g=>{let _,N=ue(15e3);try{_=fetch(e.url,{method:"POST",keepalive:!0,signal:N.signal,body:g.body,headers:e.headers})}catch(O){M(g);return}let F=O=>{var ie;let ee=Re(O);if(ee==="retry"){M(g);return}ee==="dropped"&&((ie=e.onDrop)==null||ie.call(e,g,O.status)),D(g),T=0,v=0};Promise.resolve(_).then(N.clear,N.clear),_&&typeof _.then=="function"?_.then(F).catch(()=>M(g)):F(_)},H=()=>{try{if(C||Date.now()<v)return;let g=0;for(;f.length>0&&g<i&&!(Date.now()<v);){let _=f.shift();a.delete(_.id),!s.has(_.id)&&(g++,V(_))}}catch(g){}},z=Ze(p,n);for(let g of z)a.has(g.id)||(a.add(g.id),f.push(g));z.length>0&&Me(z,n,p);let X=setInterval(H,t),Q=()=>{document.visibilityState==="hidden"&&H()},$=()=>H();return document.addEventListener("visibilitychange",Q),window.addEventListener("pagehide",$),{send(g){if(C){s.has(g.id)||o([g],n,p);return}if(!(s.has(g.id)||a.has(g.id))){if(Date.now()<v){o([g],n,p),a.add(g.id),f.push(g);return}V(g)}},flush:H,destroy(g){g!=null&&g.forget&&(u=!0),clearInterval(X),document.removeEventListener("visibilitychange",Q),window.removeEventListener("pagehide",$),H(),C=!0}}}function tt(e){if(typeof window=="undefined"||!e)return!1;Ye(e);let t=!1,n=_e(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let y=location.protocol==="https:"?"; Secure":"";document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${y}`,t=!0}}catch(y){}let i=pe(e),p=[n,"_snt_graph_edges",fe+e,Ne(e),Ke(e),`_snt_graph_nodes${i}`],u=[`_snt_asgn${i}_`];for(let y of["localStorage","sessionStorage"])try{let o=window[y];for(let f of p)o.getItem(f)!==null&&(o.removeItem(f),t=!0);for(let f=o.length-1;f>=0;f--){let a=o.key(f);a&&u.some(s=>a.startsWith(s))&&(o.removeItem(a),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${he}=[^;]`).test(document.cookie)||localStorage.getItem(he)!==null||sessionStorage.getItem(he)!==null)&&localStorage.setItem(`${he}_tomb${i}`,"1")}catch(y){}return t}function nt(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var gn="_snt_uid",no=365,Ce="_snt_uid";function oo(){return nt()}function _t(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function At(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function ro(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${At()}`}catch(i){}}function ot(e){try{return localStorage.getItem(e)}catch(t){return null}}function pn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function It(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function so(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function io(e){try{sessionStorage.removeItem(e)}catch(t){}}function ao(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${At()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function lo(e){try{localStorage.removeItem(e)}catch(t){}}function co(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${At()}`}catch(t){}}var uo={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function rt(e){var C,D,M,V,H,z,X;if(typeof window=="undefined")return uo;let t=pe(e==null?void 0:e.apiKey),n=(C=e==null?void 0:e.cookieName)!=null?C:_e(e==null?void 0:e.apiKey),i=`${Ce}${t}`,p=`${Ce}_tomb${t}`,y=((D=e==null?void 0:e.cookieTTLDays)!=null?D:no)*24*60*60,o=Q=>Q&&Q.length>0?Q:null,f=()=>{var Q,$;return t&&!(e!=null&&e.cookieName)&&ot(p)===null?($=(Q=o(_t(gn)))!=null?Q:o(ot(Ce)))!=null?$:o(It(Ce)):null},a=(X=(z=(H=(V=(M=o(_t(n)))!=null?M:o(ot(i)))!=null?V:o(It(i)))!=null?H:f())!=null?z:o(e==null?void 0:e.ssrSessionId))!=null?X:oo();ro(n,a,y);let s=pn(i,a),c=ao(n),v=s?!1:so(i,a),T=!s&&!c&&!v;return{getSessionId:()=>a,isEphemeral:()=>T,destroy:()=>{a=null,co(n),lo(i),io(i),t&&!(e!=null&&e.cookieName)&&(_t(gn)!==null||ot(Ce)!==null||It(Ce)!==null)&&pn(p,"1")}}}var go=1800*1e3;function st(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function fn(e=go,t){let n=new Map,i=`_snt_asgn${pe(t)}_`,p=(a,s)=>`${i}${encodeURIComponent(a)}:${encodeURIComponent(s)}`,u=a=>{let s=a.slice(i.length),c=s.indexOf(":");if(c<0)return null;try{return{componentId:decodeURIComponent(s.slice(0,c)),segment:decodeURIComponent(s.slice(c+1))}}catch(v){return null}},y=()=>{try{let a=[];for(let s=0;s<localStorage.length;s++){let c=localStorage.key(s);c!=null&&c.startsWith(i)&&a.push(c)}return a}catch(a){return[]}},o=a=>a.assignedAt+(a.ttlMs&&a.ttlMs>0?a.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let a of y())try{let s=localStorage.getItem(a);if(!s)continue;let c=JSON.parse(s);if(o(c)){localStorage.removeItem(a);continue}let v=u(a);if(!v)continue;n.set(st(v.componentId,v.segment),c)}catch(s){}})(),{get(a,s){let c=n.get(st(a,s));return c?o(c)?(n.delete(st(a,s)),null):c:null},set(a,s,c){let v=st(a,s);n.set(v,c);try{localStorage.setItem(p(a,s),JSON.stringify(c))}catch(T){}},clear(){n.clear();for(let a of y())try{localStorage.removeItem(a)}catch(s){}}}}var Ge=["GPTBot","ChatGPT-User","OAI-SearchBot","ClaudeBot","Claude-User","Claude-SearchBot","PerplexityBot","Perplexity-User","Google-Extended","Applebot-Extended","Meta-ExternalAgent","Bytespider","CCBot","Amazonbot","cohere-ai","Diffbot"];function Ue(e){return Rt(e)!==null}function Rt(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=Ge.find(i=>t.includes(i.toLowerCase())))!=null?n:null}var it={GPTBot:"training","ChatGPT-User":"user","OAI-SearchBot":"search",ClaudeBot:"training","Claude-User":"user","Claude-SearchBot":"search",PerplexityBot:"search","Perplexity-User":"user","Google-Extended":"training","Applebot-Extended":"training","Meta-ExternalAgent":"training",Bytespider:"training",CCBot:"training",Amazonbot:"other","cohere-ai":"training",Diffbot:"other"};function mn(e){if(!e)return"other";let t=Ge.find(n=>n.toLowerCase()===e.toLowerCase());return t&&it[t]||"other"}function yn(){var t;let e={user:[],search:[],training:[],other:[]};for(let n of Ge)e[(t=it[n])!=null?t:"other"].push(n);return e}function $e(e){let t=e.toLowerCase();return/ipad|tablet|playbook|kindle|silk/.test(t)?"tablet":/mobi|iphone|ipod|android.*mobile|phone/.test(t)?"mobile":"desktop"}function Fe(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(p){}let i=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(i)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(i)?"social":"referral"}catch(n){return"direct"}}function je(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var Ct=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function at(e){let t={},n={};try{let i=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([p,u])=>{let y=Array.isArray(u)?u[0]:u;return y===void 0?[]:[[p,y]]});for(let[p,u]of i)p.startsWith("utm_")?p in t||(t[p]=u):Ct.includes(p)&&(p in n||(n[p]=u))}catch(i){}return{utmParams:t,clickIds:n}}function We(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function Sn(e){let t=po("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function po(e,t){var u,y,o,f,a,s,c,v;let n=(y=(u=t==null?void 0:t.userAgent)==null?void 0:u.trim())!=null?y:"",i=(f=(o=t==null?void 0:t.referer)==null?void 0:o.trim())!=null?f:"",p=(a=t==null?void 0:t.now)!=null?a:new Date;return A({sessionId:e,ephemeral:!1,utmParams:(s=t==null?void 0:t.utmParams)!=null?s:{},clickIds:(c=t==null?void 0:t.clickIds)!=null?c:{},deviceClass:n?$e(n):"desktop",trafficSource:i?Fe(i,t==null?void 0:t.appOrigin):"direct",referrerDomain:je(i),timeOfDay:We(p),dayOfWeek:(v=["sun","mon","tue","wed","thu","fri","sat"][p.getDay()])!=null?v:"sun",automation:(t==null?void 0:t.webdriver)===!0||Ue(n)},t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Te=require("@sentientui/policy");function Ve(e){return A(A(A({id:e.id},e.arms?{arms:[...e.arms]}:{}),e.dims?{dims:Object.fromEntries(Object.entries(e.dims).map(([t,n])=>[t,[...n]]))}:{}),e.baseline!==void 0?{baseline:e.baseline}:{})}function Oe(e){let t=Ve(e);return(0,Te.slotResultFor)(t,(0,Te.slotBaselineArm)(t))}function hn(e){let t={};for(let n of e)t[n.id]=Oe(n);return t}function lt(e){return typeof e=="string"?e:(0,Te.canonicalArm)(e)}var bn=require("@sentientui/policy"),ct="data-sentient-stage";function dt(e,t){return!t||typeof e!="string"||!(e==="returning"||bn.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function ut(e,t=document){try{e?t.documentElement.setAttribute(ct,e):t.documentElement.removeAttribute(ct)}catch(n){}}var Nt=require("@sentientui/policy");var pt=require("@sentientui/policy");var ft="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Tt="[sentient] Local mode \u2014 decisions are simulated on-device and nothing is sent over the network. Add an API key to learn from real traffic.",vn=!1,gt=!1;function fo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function kn(e){var a;let t=rt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(a=t.getSessionId())!=null?a:"local",i=fo(),p=import("@sentientui/core/local").then(s=>{let c=s;return c.LOCAL_ENGINE_AVAILABLE?(vn||(vn=!0,console.info(Tt)),c):(gt||(gt=!0,console.error(ft)),null)}).catch(()=>(gt||(gt=!0,console.error(ft)),null)),u=null,y={low:.15,medium:.5,high:.85},o=(()=>{var c;if(e.initialPersona)return A({},e.initialPersona);let s=Ie(e.apiKey||"local");return s?{persona:s.persona,confidence:(c=y[s.band])!=null?c:.15}:null})();function f(s){let c=document.documentElement;c.dataset.sentientPersona===void 0&&(c.dataset.sentientPersona=s.persona,c.dataset.sentientConfidence=(0,pt.confidenceBand)(s.confidence))}return{isLocal:!0,async decide(s){var T,C,D;let c=await p;if(!c)return null;let v=c.createLocalEngine({sessionId:n,forcedPersona:i}).decide(s);return u=Se(A({},v),{layoutOrder:(C=(T=v.layoutOrder)!=null?T:u==null?void 0:u.layoutOrder)!=null?C:null,slots:A(A({},(D=u==null?void 0:u.slots)!=null?D:{}),v.slots)}),Ae(e.apiKey||"local",{v:1,persona:u.persona,band:(0,pt.confidenceBand)(u.confidence),slots:u.slots,layoutOrder:u.layoutOrder,savedAt:Date.now()}),f(v),v},getSlotResult(s){var c,v,T;return(T=(v=u==null?void 0:u.slots[s])!=null?v:(c=e.initialSlots)==null?void 0:c[s])!=null?T:null},getSlotConfig(s){var c,v;return(v=(c=e.initialSlotConfig)==null?void 0:c[s])!=null?v:null},getSitePalette(){var s;return(s=e.initialPalette)!=null?s:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let s=u!=null?u:o;return s?{persona:s.persona,confidence:s.confidence,band:(0,pt.confidenceBand)(s.confidence)}:null},async assign(s,c){var C;let v=await p;return!v||!c||c.length===0?c!=null&&c[0]?{variantId:c[0],assignmentTtlMs:0}:null:{variantId:(C=v.createLocalEngine({sessionId:n,forcedPersona:i}).decide({components:[{id:s,variantIds:c}]}).assignments[s])!=null?C:c[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var Pt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Ot(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function xn(e,t){if(e===void 0||!Pt.test(e))return!1;if(e==="*")return!0;let n=Ot(t);if(e.endsWith("/*")){let i=Ot(e.slice(0,-2));return n.startsWith(i==="/"?"/":`${i}/`)&&n!==i}return n===Ot(e)}function wn(e,t){if(!e)return!1;if(e==="/")return t==="/";let n=e.endsWith("/")?e.slice(0,-1):e;return t===n||t.startsWith(`${n}/`)}function En(e){if(!/^https?:\/\//i.test(e))return e;try{return new URL(e).pathname||"/"}catch(t){return e}}var mo=["none","sm","md","lg"],yo=["start","center","end","stretch"],So=["start","center","end","between"],ho=["sm","md","lg"],bo=["normal","medium","bold"],vo=["default","muted","accent"],ko=["primary","secondary","ghost"],xo=["left","center","right"],wo=["auto","square","landscape","wide"],Eo=["cover","contain"],_o=[2,3,4],Io=[1,2,3,4],Ao=["default","raised"],Ro=["none","sm","md","lg"],Co=["measure"],To=["input","textarea","select"],Oo=["text","email","number","tel"],Po=5,Do=8,Bo=64,Lo=5,Mo=12,No=4,Ko=500;function _n(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="form"?!0:Array.isArray(t.children)?t.children.some(_n):!1}var Dr=40,Br=120,Lr=300;var Dt="sentient-reveal",Pe="sentient-revealed",Bt=240,mt=!1;function In(){var e;mt=!1,typeof document!="undefined"&&((e=document.getElementById(Dt))==null||e.remove())}function Go(e){if(mt||e.getElementById(Dt)){mt=!0;return}let t=Je(e.createElement("style"),e);t.id=Dt,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${Pe}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${Pe}{animation:${Pe} ${Bt}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),mt=!0}function An(e,t={}){var p;let n=(p=t.doc)!=null?p:typeof document!="undefined"?document:void 0;if(!n||!(e instanceof Element)||(t.arm!==void 0&&e.setAttribute("data-sentient-arm",t.arm),t.persona!==void 0&&e.setAttribute("data-sentient-persona",t.persona),t.previous!==void 0&&t.previous===e.textContent))return!1;Go(n),e.classList.remove(Pe),e.offsetWidth,e.classList.add(Pe);let i=()=>{e.classList.remove(Pe),e.removeEventListener("animationend",i)};return e.addEventListener("animationend",i),!0}function Rn(e,t,n,i){let p=[];{let o=!1,f=[],a=()=>{if(o)return;let s=Date.now();for(f.push(s);f.length>0&&s-f[0]>500;)f.shift();f.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",a),p.push(()=>t.removeEventListener("click",a))}{let u=!1,y=o=>{if(u||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;u=!0;let f=typeof window!="undefined"?window.getSelection():null,a=f?f.toString().length:0;e("text_copy",{selectionLength:a})};document.addEventListener("copy",y),p.push(()=>document.removeEventListener("copy",y))}{let u=!1,y=!1,o=null,f=()=>{o!==null&&(clearTimeout(o),o=null)},a=()=>{u||!y||(f(),o=setTimeout(()=>{!u&&y&&(u=!0,e("scroll_hesitation"))},3e3))},s=()=>{f(),a()},c=T=>{for(let C of T)y=C.intersectionRatio>.3,y?a():f()},v=new IntersectionObserver(c,{threshold:[.3]});v.observe(t),window.addEventListener("scroll",s,{passive:!0}),p.push(()=>{v.disconnect(),window.removeEventListener("scroll",s),f()})}if((i==null?void 0:i.tabLoss)!==!1){let u=!1,y=n!=null?n:Date.now(),o=()=>{if(u||document.visibilityState!=="hidden")return;let f=Date.now()-y;f<15e3&&(u=!0,e("tab_loss",{timeOnPage:f}))};document.addEventListener("visibilitychange",o),p.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let u of p)u()}}function Uo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var On="https://api.sentient-ui.com/v1/events",q=new Map,Pn=null;function $o(e,t){let n=q.get(e);n&&n.upgrade&&(n.reinit=t)}function Fo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var jo=3;function Lt(){return nt()}function yt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Wo(){let e=new WeakMap,t=new Map,n=!1,i=(o,f,a)=>{let s=o.get(f);return a===null?s?!0:(o.set(f,new Set),!1):s?s.has(a)?!0:(s.add(a),!1):(o.set(f,new Set([a])),!1)},p=typeof window!="undefined"&&"event"in window,u=()=>{if(!p)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},y=()=>{if(p){Promise.resolve().then(()=>{n=!1,t.clear()});return}let o=!1,f=()=>{o||(o=!0,n=!1,t.clear())};if(setTimeout(f,0),typeof MessageChannel=="function"){let a=new MessageChannel;a.port1.onmessage=()=>{a.port1.close(),a.port2.close(),f()},a.port2.postMessage(0)}};return{firedBefore(o,f){let a=u();if(a){let c=e.get(a);return c||(c=new Map,e.set(a,c)),i(c,o,f)}let s=i(t,o,f);return!s&&!n&&(n=!0,y()),s}}}var Dn=new Set;function Vo(e,t,n){let i=typeof window=="undefined"?null:window.history;if(!i)return()=>{};let p=!1,u,y=()=>{if(p)return;let a=yt();!a||a===u||(u=a,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${a}`))},o=[];for(let a of["pushState","replaceState"]){let s=i[a],c=function(...v){let T=s.apply(this,v);return y(),T};i[a]=c,o.push([a,s,c])}window.addEventListener("popstate",y);let f=yt();return f&&Dn.has(`${t}:${f}`)?u=f:y(),()=>{if(!p){p=!0,window.removeEventListener("popstate",y);for(let[a,s,c]of o)i[a]===c&&(i[a]=s)}}}var He={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Ho(){try{return at(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Bn(e){return e.replace(/\/events\/?$/,"")}function Ut(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(t=>t==="1"||t==="yes")}function zo(e){var f;if(typeof window=="undefined")return;let t=e!=null?e:Pn;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=q.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:i,upgrade:p,reinit:u}=n;if(!p){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(i.respectDoNotTrack!==!1&&Ut())return;let y=(u!=null?u:Ln)(Se(A({},i),{consent:!0}));p(y);let o=(f=q.get(t))==null?void 0:f.dispose;q.set(t,{config:Se(A({},i),{consent:!0}),upgrade:null,dispose:o})}function Qo(e,t){var $;let n=e.preConsentBehavior==="statistical_winner",i=Bn(($=e.ingestUrl)!=null?$:On),p={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},u=new Map,y=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(d,m,h){if(!n)return Promise.resolve(null);let g=u.get(d);return g?Promise.resolve(g):Gt(y,d,async()=>{try{let _=new URLSearchParams({componentId:d});for(let ee of m!=null?m:[])_.append("variantIds[]",ee);let N=ue(5e3),F;try{let ee=await fetch(`${i}/winner?${_.toString()}`,{headers:p,signal:N.signal});if(!ee.ok)return m!=null&&m[0]?{variantId:m[0],assignmentTtlMs:0}:null;F=await ee.json()}finally{N.clear()}let O={variantId:F.variantId,assignmentTtlMs:0};return u.set(d,O),O}catch(_){return m!=null&&m[0]?{variantId:m[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},f=!1,a=new Set,s=[],c=[],v=[],T=()=>{for(let[,,d]of v.splice(0))d(null);C.length=0},C=[],D=!1,M=()=>{if(f)return;D=!0;let d=q.get(e.apiKey);(d==null?void 0:d.upgrade)===Q&&q.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},V=[],H=()=>{setTimeout(()=>{var d;try{(d=V.shift())==null||d(o)}catch(m){}V.length&&H()})},z=d=>{f?V.length?V.push(d):d(o):!t&&!D&&C.length<100?C.push(d):D&&e.debug&&console.warn("[sentient] goal dropped: client released")},X={get gated(){return!f&&!t},get released(){return D&&!f},takeHeld:()=>C.splice(0),track:d=>o.track(d),goal:((d,m,h,g)=>z(_=>_.goal(d,m,h,g))),componentGoal:(d,m,h)=>o.componentGoal(d,m,h),identify:d=>o.identify(d),getAssignment:(d,m)=>o.getAssignment(d,m),isUnified:d=>{var m,h;return(h=(m=o.isUnified)==null?void 0:m.call(o,d))!=null?h:!1},assign:(d,m,h,g,_)=>o.assign(d,m,h,g,_),decide:d=>f?o.decide(d):D||t?Promise.resolve(null):new Promise(m=>v.push([d,Kt(),m])),getSlotResult:d=>o.getSlotResult(d),isSlotDecided:d=>{var m,h;return(h=(m=o.isSlotDecided)==null?void 0:m.call(o,d))!=null?h:!0},getSlotConfig:d=>o.getSlotConfig(d),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var d,m;return(m=(d=o.getStyleVocabulary)==null?void 0:d.call(o))!=null?m:null},reportSlots:(d,m,h,g)=>o.reportSlots(d,m,h,g),reportSkeleton:(d,m)=>{var h;return(h=o.reportSkeleton)==null?void 0:h.call(o,d,m)},reportAgentData:(d,m,h)=>{var g;return(g=o.reportAgentData)==null?void 0:g.call(o,d,m,h)},reportDrift:(d,m,h,g)=>{var _;return(_=o.reportDrift)==null?void 0:_.call(o,d,m,h,g)},requestSlots:(d,m,h)=>{var g;return f?(g=o.requestSlots)==null?void 0:g.call(o,d,m,h):s.push([d,m,h])},decideSlots:d=>{var m;return f?(m=o.decideSlots)==null?void 0:m.call(o,d):c.push(...d)},cancelSlots:d=>{var h;if(f)return(h=o.cancelSlots)==null?void 0:h.call(o,d);let m=new Set(d);for(let g of s)g[0]=g[0].filter(_=>!m.has(_));c=c.filter(g=>!m.has(g.id))},onSlotsChanged:d=>(a.add(d),()=>{a.delete(d)}),getPersona:()=>o.getPersona(),getVisitorId:()=>{var d,m;return(m=(d=o.getVisitorId)==null?void 0:d.call(o))!=null?m:null},fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(M(),T(),o.dispose()),destroy:()=>(M(),T(),f?o.destroy():tt(e.apiKey))};function Q(d){var h,g,_;o=d,f=!0,C.length&&(V.push(...C.splice(0)),H());let m=Kt();for(let[N,F,O]of v.splice(0))F!==m?O(null):d.decide(N).then(O,()=>O(null));(h=d.onSlotsChanged)==null||h.call(d,()=>a.forEach(N=>N()));for(let[N,F,O]of s.splice(0))N.length>0&&((g=d.requestSlots)==null||g.call(d,N,F,O));c.length>0&&((_=d.decideSlots)==null||_.call(d,c.splice(0)))}return{proxy:X,setInner:Q}}function Kt(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Gt(e,t,n){let i=e.get(t);if(i)return i;let p=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,p),p}function Ln(e){var Vt,Ht,zt,Qt,Xt,Jt,qt,Yt,Zt,en,tn;if(typeof window=="undefined")return He;e.nonce&&Xe(e.nonce),Pn=e.apiKey||"local";let t=q.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(r){}let n=e.respectDoNotTrack!==!1&&Ut(),i=e.consent===!1||n,p=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!p&&e.localMode!==!1)return q.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),i?He:kn(e);if(i){if(!e.apiKey||!e.apiKey.startsWith("pk_"))return e.preConsentBehavior==="statistical_winner"&&console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),q.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): the client was initialized with an invalid apiKey (expected a pk_ public key) \u2014 consent cannot enable tracking."}),He;let{proxy:r,setInner:l}=Qo(e,n);return q.set(e.apiKey,{config:e,upgrade:n?null:l}),r}if(!e.apiKey||!e.apiKey.startsWith("pk_"))return console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),He;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),He;let u=(Vt=e.ingestUrl)!=null?Vt:On,y=Date.now(),o=rt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),f=fn(void 0,e.apiKey),a=!1,s=se(e.apiKey),c=()=>!a&&se(e.apiKey)===s,v=new Set((Ht=e.initialUnified)!=null?Ht:[]),T=Se(A({},f),{get:(r,l)=>v.has(r)?null:f.get(r,l),set:(...r)=>{c()&&f.set(...r)}}),C=dn({ingestUrl:u,apiKey:e.apiKey}),D=Bn(u),M={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},V=new Set,H=un({url:`${D}/goals`,apiKey:e.apiKey,headers:M,onDrop:(r,l)=>{if(!e.debug){if(V.has(l))return;V.add(l)}console.warn(`[sentient] goal dropped (HTTP ${l}) \u2014 this will not be retried. `+(l===400?"The session was not found: call init() and let the session upsert complete before firing goals.":l===401||l===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),r)}}),z=$e((zt=navigator.userAgent)!=null?zt:""),X=window.location.origin,Q=Fe((Qt=document.referrer)!=null?Qt:"",X),$=(Xt=e.sessionSegment)!=null?Xt:`${z}:${Q}`,d=new Map,m=new Map,h=new Map,g=new Set,_=new Map,N=null,F=null,O=null,ee=new Set,ie=new Set,k=new Map,B=new Map,ge=new Set,be=new Set,te=new Set,ke=new Set,xe=null,oe=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,we=new Set,ae=new Set,ze=new Set,De=new Map,St=null,Qe=new Set,Be=new Map,ht=null,Mn=2,$t=new Map,re=!1,Ft=(r,l,S)=>{var b;let I=new Set,R=1;for(let x of r){l.delete(x);let w=((b=$t.get(x))!=null?b:0)+1;$t.set(x,w),w<=Mn&&(I.add(x),w>R&&(R=w))}I.size>0&&setTimeout(()=>{re||S(I)},me(R))},bt=r=>{for(let l of r)h.has(l.id)||h.set(l.id,Oe(l))};if(e.initialSlots)for(let[r,l]of Object.entries(e.initialSlots))h.set(r,l),g.add(r);if(e.initialSlotConfig)for(let[r,l]of Object.entries(e.initialSlotConfig))_.set(r,l);e.initialPalette&&(N=e.initialPalette),e.initialVocabulary&&(F=e.initialVocabulary);let le=Ie(e.apiKey);if(le){for(let[r,l]of Object.entries(le.slots))h.has(r)||h.set(r,l);for(let[r,l]of Object.entries((Jt=le.slotConfig)!=null?Jt:{}))_.has(r)||_.set(r,l);!N&&le.palette&&(N=le.palette),!F&&le.vocabulary&&(F=le.vocabulary)}let jt={low:.15,medium:.5,high:.85};if(e.initialPersona)O=A({},e.initialPersona);else{let r=document.documentElement.dataset;r.sentientPersona?O={persona:r.sentientPersona,confidence:(Yt=jt[(qt=r.sentientConfidence)!=null?qt:"low"])!=null?Yt:.15}:le&&(O={persona:le.persona,confidence:(Zt=jt[le.band])!=null?Zt:.15})}if(e.initialAssignments)for(let[r,l]of Object.entries(e.initialAssignments))T.set(r,$,{variantId:l,assignedAt:Date.now(),segment:$,confidence:1});let ye=Promise.resolve(),Wt=o.getSessionId();if(Wt){let r=je((en=document.referrer)!=null?en:""),{utmParams:l,clickIds:S}=Ho(),I=A(A(A(A({sessionId:Wt,deviceClass:z,trafficSource:Q,referrerDomain:r,utmParams:l,clickIds:S,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:We(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Ue((tn=navigator.userAgent)!=null?tn:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),R=async()=>{for(let b=0;;b++){if(re||!c())return;let x=ue(5e3);try{let w=await fetch(`${D}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(I),headers:M,signal:x.signal});if(w.status===402){console.warn("[SentientUI] Session limit exceeded for this project. The bandit will stop learning until the limit resets. Upgrade at sentient-ui.com/pricing");return}if(w.ok||Re(w)==="dropped")return}catch(w){}finally{x.clear()}if(b>=jo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(w=>setTimeout(w,me(b+1)))}};try{ye=R()}catch(b){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:C});let Nn=Wo(),ve=null,vt=!1,W={goal(r,l={},S=1,I=0){var j,L,Y,ne,Z,J,E;let R=o.getSessionId();if(!R||re||!c())return;let b=Fo(l)?l:{metadata:l},x=[r,(j=b.externalId)!=null?j:"",(L=b.stepIndex)!=null?L:I,(Y=b.weight)!=null?Y:S].join("\0"),w=b.value!==void 0?`${b.value}\0${(ne=b.currency)!=null?ne:""}`:null;if(Nn.firedBefore(x,w)){e.debug&&console.log(`[sentient] goal("${r}") already recorded for this action \u2014 not sent twice`);return}let K=Lt(),P={sessionId:R,name:r,metadata:(Z=b.metadata)!=null?Z:{},weight:(J=b.weight)!=null?J:S,stepIndex:(E=b.stepIndex)!=null?E:I,goalId:K,value:b.value,currency:b.currency,externalId:b.externalId};e.debug&&console.log("[sentient] goal",P);let G={id:K,body:JSON.stringify(P)};ye.then(()=>H.send(G))},componentGoal(r,l,S){var K,P,G;let I=o.getSessionId();if(!I||re||!c())return;let R=T.get(r,$),b=R?null:(K=h.get(r))!=null?K:null;if(!R&&b===null){e.debug&&console.warn(`[sentient] componentGoal("${r}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!R&&!g.has(r)){e.debug&&console.warn(`[sentient] componentGoal("${r}"): slot not decided this session \u2014 not attributed`);return}let x=R?R.variantId:lt(b),w={id:Lt(),sessionId:I,projectId:e.apiKey,componentId:r,variantId:x,eventType:"goal_achieved",goalType:l,payload:A({reward:(P=S==null?void 0:S.reward)!=null?P:1,goalValue:S==null?void 0:S.value,currency:S==null?void 0:S.currency},(G=S==null?void 0:S.metadata)!=null?G:{}),timestamp:Date.now(),timeInSession:Date.now()-y,path:yt()};e.debug&&console.log("[sentient] componentGoal",w),ye.then(()=>{!re&&c()&&C.push(w)})},identify(r){let l=o.getSessionId();!l||re||!c()||ye.then(()=>{fetch(`${D}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:l,userId:r,ephemeral:o.isEphemeral()}),headers:M}).catch(()=>{})})},track(r){let l=o.getSessionId();if(!l||re||!c()||r.eventType==="variant_assigned"&&h.get(r.componentId)!==void 0&&!g.has(r.componentId)&&!T.get(r.componentId,$))return;let S=Se(A({path:yt()},r),{id:Lt(),sessionId:l,timestamp:Date.now(),timeInSession:Date.now()-y});e.debug&&console.log("[sentient] track",S),ye.then(()=>C.push(S))},getAssignment(r,l){return T.get(r,l)},isUnified:r=>v.has(r),async assign(r,l,S,I,R){var K;let b=o.getSessionId();if(!b)return null;let x=(R==null?void 0:R.unified)===!0;if(x&&v.has(r))return{variantId:(K=l==null?void 0:l[0])!=null?K:"",assignmentTtlMs:0,unified:!0};let w=T.get(r,$);if(w&&(l!=null&&l.length||w.content!==void 0)){let P=w.ttlMs&&w.ttlMs>0?Math.max(0,w.assignedAt+w.ttlMs-Date.now()):0;return{variantId:w.variantId,assignmentTtlMs:P,content:w.content}}return Gt(d,x?`${r}\0unified`:r,async()=>{if(!await kt(ye,2500)||re||!c())return null;let P=ue(3e4);try{let G={sessionId:b,componentId:r,variantIds:l};I!==void 0?G.agentDataByVariant=I:S!==void 0&&(G.agentData=S),x&&(G.caps={unified:!0});let j=await fetch(`${D}/assign`,{method:"POST",body:JSON.stringify(G),headers:M,signal:P.signal});if(!j.ok)return null;let L=await j.json();return L.unified===!0?x?(v.add(r),{variantId:L.variantId,assignmentTtlMs:0,unified:!0}):null:(T.set(r,$,A({variantId:L.variantId,assignedAt:Date.now(),segment:$,confidence:1,content:L.content},L.assignmentTtlMs&&L.assignmentTtlMs>0?{ttlMs:L.assignmentTtlMs}:{})),L)}catch(G){return null}finally{P.clear()}})},async decide(r){var b,x;let l=o.getSessionId();if(!l)return null;let S=(b=r.slots)!=null?b:[],I={sessionId:l};r.sections&&r.sections.length>0&&(I.sections=r.sections.map(w=>({id:w}))),I.components=(x=r.components)!=null?x:[],S.length>0&&(I.slots=S.map(Ve)),r.slotsFrom==="registry"&&(I.slotsFrom="registry",r.registrySlotIds&&(I.registrySlotIds=r.registrySlotIds),r.bootstrap===!1&&(I.bootstrap=!1),r.render&&Object.keys(r.render).length>0&&(I.render=r.render)),r.v&&(I.v=r.v),typeof r.pp=="number"&&(I.pp=r.pp),e.persona&&(I.persona=e.persona);let R=JSON.stringify(I);return Gt(m,R,async()=>{var K,P,G,j,L,Y,ne,Z;if(!await kt(ye,2500)||re||!c())return bt(S),null;let w=ue(3e4);try{let J=await fetch(`${D}/decide`,{method:"POST",body:R,headers:M,signal:w.signal});if(!J.ok)return bt(S),null;let E=await J.json(),ce=dt(E.stage,e.stageAttributes);e.stageAttributes&&ut(ce);let Ee={};for(let U of S){let de=(K=E.slots)==null?void 0:K[U.id];if(de!==void 0){Ee[U.id]=de,h.set(U.id,de),g.add(U.id);continue}let nn=h.get(U.id);if(nn!==void 0)Ee[U.id]=nn;else{let on=Oe(U);Ee[U.id]=on,h.set(U.id,on)}}if(E.slots)for(let[U,de]of Object.entries(E.slots))U in Ee||(Ee[U]=de,h.set(U,de),g.add(U));let Kn=O!=null&&O.persona!=="unknown";E.persona&&!(E.persona==="unknown"&&Kn)?O={persona:E.persona,confidence:(P=E.confidence)!=null?P:0}:O||(O={persona:"unknown",confidence:0});for(let[U,de]of Object.entries((G=E.assignments)!=null?G:{}))T.set(U,$,{variantId:de,assignedAt:Date.now(),segment:$,confidence:1});if(E.slotConfig)for(let[U,de]of Object.entries(E.slotConfig))_.set(U,de);E.palette&&(N=E.palette),E.vocabulary&&(F=E.vocabulary);for(let U of(j=r.registrySlotIds)!=null?j:[])(L=E.slotConfig)!=null&&L[U]||(_.delete(U),h.delete(U),g.delete(U));return c()&&Ae(e.apiKey,A(A(A(A({v:1,persona:O.persona,band:(0,Nt.confidenceBand)(O.confidence),slots:Object.fromEntries(h),layoutOrder:(Y=E.layoutOrder)!=null?Y:null,savedAt:Date.now()},_.size>0?{slotConfig:Object.fromEntries(_)}:{}),N?{palette:N}:{}),F?{vocabulary:F}:{}),ce?{stage:ce}:{})),A(A(A(A(A(A(A({layoutOrder:(ne=E.layoutOrder)!=null?ne:null,assignments:(Z=E.assignments)!=null?Z:{},slots:Ee,persona:O.persona,confidence:O.confidence},E.slotConfig?{slotConfig:E.slotConfig}:{}),E.goals?{goals:E.goals}:{}),E.sectionMap?{sectionMap:E.sectionMap}:{}),E.palette?{palette:E.palette}:{}),E.vocabulary?{vocabulary:E.vocabulary}:{}),E.stage?{stage:E.stage}:{}),E.context?{context:E.context}:{})}catch(J){return bt(S),null}finally{w.clear()}})},getSlotResult(r){var l;return(l=h.get(r))!=null?l:null},isSlotDecided(r){return g.has(r)},getSlotConfig(r){var l;return(l=_.get(r))!=null?l:null},reportSlots(r,l,S,I){var b;let R={};for(let[x,w]of Object.entries(I!=null?I:{}))for(let K of w){let P=`${x}|${K.key}`;!oe.test(x)||te.has(P)||(te.add(P),((b=R[x])!=null?b:R[x]=[]).push(K))}Object.keys(R).length>0&&fetch(`${D}/slots/observed`,{method:"POST",headers:M,body:JSON.stringify({slotIds:Object.keys(R),authoredArms:R})}).catch(()=>{});for(let x of r)if(!(typeof x!="string"||x.length===0)){if(!oe.test(x)){Uo()&&!we.has(x)&&(we.add(x),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(x)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!ee.has(x)){ee.add(x),ie.add(x);let w=l==null?void 0:l[x];if(typeof w=="string"){let P=w.replace(/\s+/g," ").trim().slice(0,400);P!==""&&k.set(x,P)}let K=S==null?void 0:S[x];K!==void 0&&B.set(x,K)}}ie.size===0||xe!=null||(xe=setTimeout(()=>{xe=null;let x=[...ie];ie.clear();for(let w=0;w<x.length;w+=20){let K=x.slice(w,w+20),P={},G={};for(let j of K){let L=k.get(j);L!==void 0&&(P[j]=L,k.delete(j));let Y=B.get(j);Y!==void 0&&(G[j]=Y,B.delete(j))}fetch(`${D}/slots/observed`,{method:"POST",headers:M,body:JSON.stringify(A(Se(A(A({slotIds:K},Object.keys(P).length>0?{baselineTexts:P}:{}),Object.keys(G).length>0?{baselineSkeletons:G}:{}),{pagePaths:Object.fromEntries(K.map(j=>[j,location.pathname]))}),Object.keys(P).length>0&&o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(r,l){!oe.test(r)||ge.has(r)||(ge.add(r),fetch(`${D}/slots/observed`,{method:"POST",headers:M,body:JSON.stringify({slotIds:[r],baselineSkeletons:{[r]:l}})}).catch(()=>{}))},reportAgentData(r,l,S){let I=`${r}|${l}`;!oe.test(r)||ke.has(I)||(ke.add(I),fetch(`${D}/slots/observed`,{method:"POST",headers:M,body:JSON.stringify(A({slotIds:[r],agentData:{[r]:{[l]:S}}},l.startsWith("authored.")?{authoredArms:{[r]:[{key:l.slice(9)}]}}:{}))}).catch(()=>{}))},reportDrift(r,l,S,I){let R=`${r}|${l}`,b=o.getSessionId();!b||be.has(R)||(be.add(R),fetch(`${D}/slots/drift`,{method:"POST",headers:M,body:JSON.stringify({sessionId:b,reports:[{slotId:r,expectedFp:l,observedFp:S,reason:I}]})}).catch(()=>{}))},requestSlots(r,l,S){var I,R;for(let b of r)ze.has(b)||(ze.add(b),oe.test(b)?De.set(b,{text:l==null?void 0:l[b],render:(I=S==null?void 0:S.render)==null?void 0:I[b],skeleton:(R=S==null?void 0:S.skeletons)==null?void 0:R[b]}):W.reportSlots([b]));De.size===0||St!=null||(St=setTimeout(()=>{St=null;let b=[...De];De.clear();for(let x=0;x<b.length;x+=50){let w=b.slice(x,x+50),K={};for(let[P,G]of w)G.render&&(K[P]=G.render);W.decide({slotsFrom:"registry",registrySlotIds:w.map(([P])=>P),bootstrap:!1,render:K}).then(P=>{var G,j;if(P){let L={},Y={},ne=[];for(let[Z,J]of w){let E=(G=P.slotConfig)==null?void 0:G[Z];if(E){E.needsSkeleton&&J.skeleton&&((j=W.reportSkeleton)==null||j.call(W,Z,J.skeleton));continue}ne.push(Z),J.text&&(L[Z]=J.text),J.skeleton&&(Y[Z]=J.skeleton)}ne.length>0&&W.reportSlots(ne,L,Y)}else Ft(w.map(([L])=>L),ze,L=>{var J;let Y={},ne={},Z={};for(let[E,ce]of w)L.has(E)&&(ce.text&&(Y[E]=ce.text),ce.render&&(ne[E]=ce.render),ce.skeleton&&(Z[E]=ce.skeleton));(J=W.requestSlots)==null||J.call(W,[...L],Y,{render:ne,skeletons:Z})});ae.forEach(L=>L())})}},0))},decideSlots(r){for(let l of r)Qe.has(l.id)||(Qe.add(l.id),Be.set(l.id,l));Be.size===0||ht!=null||(ht=setTimeout(()=>{ht=null;let l=[...Be.values()];Be.clear();for(let S=0;S<l.length;S+=30){let I=l.slice(S,S+30);W.decide({slots:I}).then(R=>{R||Ft(I.map(b=>b.id),Qe,b=>{var x;return(x=W.decideSlots)==null?void 0:x.call(W,I.filter(w=>b.has(w.id)))}),ae.forEach(b=>b())})}},0))},cancelSlots(r){for(let l of r)De.delete(l)&&ze.delete(l),Be.delete(l)&&Qe.delete(l)},onSlotsChanged(r){return ae.add(r),()=>{ae.delete(r)}},getStyleVocabulary(){return F},getSitePalette(){return N},getVisitorId:()=>c()?o.getSessionId():null,getPersona(){return O?{persona:O.persona,confidence:O.confidence,band:(0,Nt.confidenceBand)(O.confidence)}:null},async fetchWeights(){var l;let r=ue(5e3);try{let S=await fetch(`${D}/weights`,{headers:M,signal:r.signal});return S.ok?(l=(await S.json()).components)!=null?l:[]:[]}catch(S){return[]}finally{r.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){C.flush(),H.flush()},dispose(){var r;ve==null||ve(),vt=!0,re=!0,C.destroy(),H.destroy(),((r=q.get(e.apiKey))==null?void 0:r.dispose)===W.dispose&&q.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var r;ve==null||ve(),vt=!0,re=!0,a=!0,Ye(e.apiKey),C.destroy({forget:!0}),H.destroy({forget:!0}),o.destroy(),T.clear(),((r=q.get(e.apiKey))==null?void 0:r.dispose)===W.dispose&&q.delete(e.apiKey);try{localStorage.removeItem(fe+e.apiKey),localStorage.removeItem(Ne(e.apiKey)),localStorage.removeItem(Ke(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${pe(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(l){}e.debug&&console.log("[sentient] destroyed")}};if(q.set(e.apiKey,{config:e,upgrade:null,dispose:W.dispose}),ve=Vo(W,e.apiKey,r=>{ye.then(()=>{vt||Dn.add(r)})}),e.debug){let r=window;r.__sentient&&(r.__sentient.client=W)}return W}0&&(module.exports={AGENT_INTENTS,BLOCK_ALIGNS,BLOCK_EMPHASES,BLOCK_FITS,BLOCK_GAPS,BLOCK_GRID_COLUMNS,BLOCK_HEADING_LEVELS,BLOCK_JUSTIFIES,BLOCK_MAX_WIDTHS,BLOCK_PADS,BLOCK_RATIOS,BLOCK_SIZES,BLOCK_SURFACES,BLOCK_TEXT_ALIGNS,BLOCK_TONES,BLOCK_WEIGHTS,CLICK_ID_KEYS,FORM_FIELD_KINDS,FORM_INPUT_TYPES,LEGACY_SESSION_COOKIE_NAME,LOCAL_MODE_BANNER,MAX_BLOCK_ARMS,MAX_BLOCK_CHILDREN,MAX_BLOCK_DEPTH,MAX_BLOCK_NODES,MAX_BLOCK_TEXT_LEN,MAX_FORM_FIELDS,MAX_FORM_SELECT_OPTIONS,MAX_SKELETON_LEAVES,MAX_SKELETON_NODES,MAX_SKELETON_TEXT,PAGE_SCOPE_RE,PROD_KEYLESS_ERROR,REVEAL_MS,SNAPSHOT_STORAGE_KEY_PREFIX,STAGE_ATTRIBUTE,_registerConsentUpgradeInit,agentIntent,agentUaList,applyNonce,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,classifiedAgents,containsFormBlock,cspNonce,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,exposedStage,extractTrackedParams,forgetGeneration,forgetVisitor,grantConsent,init,isDoNotTrackEnabled,matchedAgentToken,normalizeUrlPattern,pageScopeMatches,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,resetRevealStyles,reveal,routeKey,sessionCookieName,setCspNonce,setStageAttribute,toWireSlot,uaTokenMatch,urlMatches,writeSnapshot});
1
+ "use strict";var Gn=Object.create;var Le=Object.defineProperty,Un=Object.defineProperties,$n=Object.getOwnPropertyDescriptor,Fn=Object.getOwnPropertyDescriptors,jn=Object.getOwnPropertyNames,rn=Object.getOwnPropertySymbols,Wn=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty,Vn=Object.prototype.propertyIsEnumerable;var sn=(e,t,n)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t)=>{for(var n in t||(t={}))an.call(t,n)&&sn(e,n,t[n]);if(rn)for(var n of rn(t))Vn.call(t,n)&&sn(e,n,t[n]);return e},Se=(e,t)=>Un(e,Fn(t));var Hn=(e,t)=>{for(var n in t)Le(e,n,{get:t[n],enumerable:!0})},ln=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of jn(t))!an.call(e,p)&&p!==n&&Le(e,p,{get:()=>t[p],enumerable:!(i=$n(t,p))||i.enumerable});return e};var zn=(e,t,n)=>(n=e!=null?Gn(Wn(e)):{},ln(t||!e||!e.__esModule?Le(n,"default",{value:e,enumerable:!0}):n,e)),Qn=e=>ln(Le({},"__esModule",{value:!0}),e);var Xo={};Hn(Xo,{AGENT_INTENTS:()=>it,BLOCK_ALIGNS:()=>yo,BLOCK_EMPHASES:()=>ko,BLOCK_FITS:()=>Eo,BLOCK_GAPS:()=>mo,BLOCK_GRID_COLUMNS:()=>_o,BLOCK_HEADING_LEVELS:()=>Io,BLOCK_JUSTIFIES:()=>So,BLOCK_MAX_WIDTHS:()=>Co,BLOCK_PADS:()=>Ro,BLOCK_RATIOS:()=>wo,BLOCK_SIZES:()=>ho,BLOCK_SURFACES:()=>Ao,BLOCK_TEXT_ALIGNS:()=>xo,BLOCK_TONES:()=>vo,BLOCK_WEIGHTS:()=>bo,CLICK_ID_KEYS:()=>Ct,FORM_FIELD_KINDS:()=>To,FORM_INPUT_TYPES:()=>Oo,LEGACY_SESSION_COOKIE_NAME:()=>he,LOCAL_MODE_BANNER:()=>Tt,MAX_BLOCK_ARMS:()=>No,MAX_BLOCK_CHILDREN:()=>Mo,MAX_BLOCK_DEPTH:()=>Lo,MAX_BLOCK_NODES:()=>Bo,MAX_BLOCK_TEXT_LEN:()=>Ko,MAX_FORM_FIELDS:()=>Po,MAX_FORM_SELECT_OPTIONS:()=>Do,MAX_SKELETON_LEAVES:()=>Br,MAX_SKELETON_NODES:()=>Dr,MAX_SKELETON_TEXT:()=>Lr,PAGE_SCOPE_RE:()=>Pt,PROD_KEYLESS_ERROR:()=>ft,REVEAL_MS:()=>Bt,SNAPSHOT_STORAGE_KEY_PREFIX:()=>fe,STAGE_ATTRIBUTE:()=>ct,_registerConsentUpgradeInit:()=>$o,agentIntent:()=>mn,agentUaList:()=>Ge,applyNonce:()=>Je,armOfResult:()=>lt,attachMicroSignalDetectors:()=>Rn,baselineResultFor:()=>Oe,baselineSlots:()=>hn,classifiedAgents:()=>yn,containsFormBlock:()=>_n,cspNonce:()=>wt,deriveSessionSegment:()=>Sn,detectDeviceClass:()=>$e,detectTimeOfDay:()=>We,detectTrafficSource:()=>Fe,exposedStage:()=>dt,extractTrackedParams:()=>at,forgetGeneration:()=>se,forgetVisitor:()=>tt,grantConsent:()=>zo,init:()=>Ln,isDoNotTrackEnabled:()=>Ut,matchedAgentToken:()=>Rt,normalizeUrlPattern:()=>En,pageScopeMatches:()=>xn,readSnapshot:()=>Ie,referrerDomainFromReferer:()=>je,renderPrePaintScript:()=>cn,resetRevealStyles:()=>In,reveal:()=>An,routeKey:()=>Kt,sessionCookieName:()=>_e,setCspNonce:()=>Xe,setStageAttribute:()=>ut,toWireSlot:()=>Ve,uaTokenMatch:()=>Ue,urlMatches:()=>wn,writeSnapshot:()=>Ae});module.exports=Qn(Xo);function ue(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function kt(e,t){return new Promise(n=>{let i=setTimeout(()=>n(!1),t),p=()=>{clearTimeout(i),n(!0)};e.then(p,p)})}var xt;function Xe(e){xt=typeof e=="string"&&e!==""?e:void 0}function wt(e=document){if(xt)return xt;try{let t=e.querySelector("script[nonce]");return(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"))||void 0}catch(t){return}}function Je(e,t=document){let n=wt(t);return n&&e.setAttribute("nonce",n),e}function pe(e){return e?`_${e.slice(0,12)}`:""}var he="_snt_uid";function _e(e){return`${he}${pe(e)}`}var qe="__sntForgetGen",Xn=()=>{try{return window[qe]}catch(e){return}};function Ye(e){var t,n;try{let i=window,p=(t=i[qe])!=null?t:i[qe]={};p[e]=((n=p[e])!=null?n:0)+1}catch(i){}}function se(e){var t,n;return(n=(t=Xn())==null?void 0:t[e])!=null?n:0}var fe="_snt_snap:";var Jn=["low","medium","high"];function Ie(e){try{let t=localStorage.getItem(fe+e);if(!t)return null;let n=JSON.parse(t);if(!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!Jn.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let i=n.vocabulary;return i!==void 0&&(typeof i!="object"||i===null||!Array.isArray(i.entries)||!Array.isArray(i.images))&&delete n.vocabulary,n.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function Ae(e,t){try{localStorage.setItem(fe+e,JSON.stringify(t))}catch(n){}}function cn(e,t){return'(function(){try{var N=navigator,W=window;if(N.doNotTrack=="1"||N.doNotTrack=="yes"||W.doNotTrack=="1"||N.msDoNotTrack=="1"||N.globalPrivacyControl)return;var r=localStorage.getItem('+JSON.stringify(fe+e).replace(/</g,"\\u003c")+');if(!r)return;var s=JSON.parse(r);if(!s||s.v!==1||typeof s.persona!=="string"||typeof s.band!=="string")return;if(!('+2592e6+">Date.now()-s.savedAt))return;var d=document.documentElement;"+(t!=null&&t.stage?'if(typeof s.stage=="string"&&!d.hasAttribute("data-sentient-stage"))d.setAttribute("data-sentient-stage",s.stage);':"")+'if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",s.persona);d.setAttribute("data-sentient-confidence",s.band);}catch(e){}})();'}function me(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Re(e){if(e.ok===!0)return"delivered";let{status:t}=e;return typeof t!="number"?"retry":t>=200&&t<300?"delivered":t>=400&&t<500&&t!==429?"dropped":"retry"}function Ze(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let i=JSON.parse(n);return Array.isArray(i)?(localStorage.removeItem(e),i.slice(-t)):[]}catch(n){return[]}}function Me(e,t,n){try{let i=(()=>{try{let u=localStorage.getItem(n);if(!u)return[];let y=JSON.parse(u);return Array.isArray(y)?y:[]}catch(u){return[]}})(),p=new Map;for(let u of i)p.set(u.id,u);for(let u of e)p.set(u.id,u);localStorage.setItem(n,JSON.stringify([...p.values()].slice(-t)))}catch(i){}}function et(e,t){try{let n=localStorage.getItem(t);if(!n)return;let i=JSON.parse(n);if(!Array.isArray(i))return;let p=new Set(e),u=i.filter(y=>!p.has(y.id));if(u.length===i.length)return;u.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(u))}catch(n){}}var qn=500,Yn=56*1024;function Ne(e){return`_snt_retry_${e.slice(0,12)}`}var Zn={push:()=>{},flush:()=>{},destroy:()=>{}};function dn(e){var O,ee,ie;if(typeof window=="undefined")return Zn;let t=(O=e.flushIntervalMs)!=null?O:5e3,n=(ee=e.maxBatchSize)!=null?ee:20,i=(ie=e.maxRetrySize)!=null?ie:100,p=e.ingestUrl,u=e.apiKey,y=Ne(u),o=!1,f=se(u),a=(...k)=>{!o&&se(u)===f&&Me(...k)},s=[],c=new Set,v=[],T=k=>{for(let B of k)C.delete(B),!c.has(B)&&(c.add(B),v.push(B));for(;v.length>qn;){let B=v.shift();B&&c.delete(B)}et(k,y)},C=new Set,D=()=>{for(;s.length>i;){let k=s.shift();k&&C.delete(k.id)}},M=k=>{c.has(k.id)||C.has(k.id)||(C.add(k.id),s.push(k),D())},V=k=>{for(let B of k)c.has(B.id)||(C.add(B.id),s.push(B));D()},H=Ze(y,i);for(let k of H)M(k);let z=0,X=0,Q=(k,B=!0)=>{if(k.length===0)return;let ge=JSON.stringify(k),be=k.map(oe=>oe.id),te,ke=ue(15e3);try{te=fetch(p,{method:"POST",keepalive:!0,signal:ke.signal,body:ge,headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`}})}catch(oe){a(k,i,y),V(k),X++,z=Date.now()+me(X);return}Promise.resolve(te).then(ke.clear,ke.clear);let xe=oe=>{if(Re(oe)!=="retry"){if(!oe.ok&&B){let we=k.filter(ae=>ae.eventType!=="pageview");if(we.length>0&&we.length<k.length){T(k.filter(ae=>ae.eventType==="pageview").map(ae=>ae.id)),Q(we,!1);return}}T(be),X=0,z=0;return}a(k,i,y),V(k),X++,z=Date.now()+me(X)};te&&typeof te.then=="function"?te.then(xe).catch(()=>{a(k,i,y),V(k),X++,z=Date.now()+me(X)}):xe(te)},$=typeof TextEncoder!="undefined"?new TextEncoder:null,d=k=>$?$.encode(k).length:k.length,m=k=>{let B=[],ge=2;for(let be of k){let te=d(JSON.stringify(be))+1;if(B.length>0&&ge+te>Yn||B.length>=n)break;B.push(be),ge+=te}return B},h=()=>{try{if(Date.now()<z)return;for(;s.length>0&&!(Date.now()<z);){let k=s.filter(ge=>!c.has(ge.id));if(s.length=0,k.length===0)break;let B=m(k);if(B.length===0)break;B.length<k.length&&s.push(...k.slice(B.length)),Q(B)}}catch(k){}},g=!0,_=null;_=setInterval(()=>{g&&h()},t);let N=()=>{document.visibilityState==="hidden"&&h()},F=()=>{h()};return document.addEventListener("visibilitychange",N),window.addEventListener("pagehide",F),{push(k){M(k),s.length>=n&&h()},flush:h,destroy(k){k!=null&&k.forget&&(o=!0),g=!1,_!==null&&(clearInterval(_),_=null),document.removeEventListener("visibilitychange",N),window.removeEventListener("pagehide",F),h()}}}var eo=200;function Ke(e){return`_snt_goal_retry_${e.slice(0,12)}`}var to={send:()=>{},flush:()=>{},destroy:()=>{}};function un(e){var d,m,h;if(typeof window=="undefined")return to;let t=(d=e.flushIntervalMs)!=null?d:5e3,n=(m=e.maxRetrySize)!=null?m:100,i=(h=e.maxPerFlush)!=null?h:5,p=Ke(e.apiKey),u=!1,y=se(e.apiKey),o=(...g)=>{!u&&se(e.apiKey)===y&&Me(...g)},f=[],a=new Set,s=new Set,c=[],v=0,T=0,C=!1,D=g=>{for(a.delete(g.id),s.has(g.id)||(s.add(g.id),c.push(g.id));c.length>eo;){let _=c.shift();_&&s.delete(_)}et([g.id],p)},M=g=>{o([g],n,p),!s.has(g.id)&&!a.has(g.id)&&(a.add(g.id),f.push(g)),Date.now()>=v&&(T++,v=Date.now()+me(T))},V=g=>{let _,N=ue(15e3);try{_=fetch(e.url,{method:"POST",keepalive:!0,signal:N.signal,body:g.body,headers:e.headers})}catch(O){M(g);return}let F=O=>{var ie;let ee=Re(O);if(ee==="retry"){M(g);return}ee==="dropped"&&((ie=e.onDrop)==null||ie.call(e,g,O.status)),D(g),T=0,v=0};Promise.resolve(_).then(N.clear,N.clear),_&&typeof _.then=="function"?_.then(F).catch(()=>M(g)):F(_)},H=()=>{try{if(C||Date.now()<v)return;let g=0;for(;f.length>0&&g<i&&!(Date.now()<v);){let _=f.shift();a.delete(_.id),!s.has(_.id)&&(g++,V(_))}}catch(g){}},z=Ze(p,n);for(let g of z)a.has(g.id)||(a.add(g.id),f.push(g));z.length>0&&Me(z,n,p);let X=setInterval(H,t),Q=()=>{document.visibilityState==="hidden"&&H()},$=()=>H();return document.addEventListener("visibilitychange",Q),window.addEventListener("pagehide",$),{send(g){if(C){s.has(g.id)||o([g],n,p);return}if(!(s.has(g.id)||a.has(g.id))){if(Date.now()<v){o([g],n,p),a.add(g.id),f.push(g);return}V(g)}},flush:H,destroy(g){g!=null&&g.forget&&(u=!0),clearInterval(X),document.removeEventListener("visibilitychange",Q),window.removeEventListener("pagehide",$),H(),C=!0}}}function tt(e){if(typeof window=="undefined"||!e)return!1;Ye(e);let t=!1,n=_e(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let y=location.protocol==="https:"?"; Secure":"";document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${y}`,t=!0}}catch(y){}let i=pe(e),p=[n,"_snt_graph_edges",fe+e,Ne(e),Ke(e),`_snt_graph_nodes${i}`],u=[`_snt_asgn${i}_`];for(let y of["localStorage","sessionStorage"])try{let o=window[y];for(let f of p)o.getItem(f)!==null&&(o.removeItem(f),t=!0);for(let f=o.length-1;f>=0;f--){let a=o.key(f);a&&u.some(s=>a.startsWith(s))&&(o.removeItem(a),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${he}=[^;]`).test(document.cookie)||localStorage.getItem(he)!==null||sessionStorage.getItem(he)!==null)&&localStorage.setItem(`${he}_tomb${i}`,"1")}catch(y){}return t}function nt(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var gn="_snt_uid",no=365,Ce="_snt_uid";function oo(){return nt()}function _t(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function At(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function ro(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${At()}`}catch(i){}}function ot(e){try{return localStorage.getItem(e)}catch(t){return null}}function pn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function It(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function so(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function io(e){try{sessionStorage.removeItem(e)}catch(t){}}function ao(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${At()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function lo(e){try{localStorage.removeItem(e)}catch(t){}}function co(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${At()}`}catch(t){}}var uo={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function rt(e){var C,D,M,V,H,z,X;if(typeof window=="undefined")return uo;let t=pe(e==null?void 0:e.apiKey),n=(C=e==null?void 0:e.cookieName)!=null?C:_e(e==null?void 0:e.apiKey),i=`${Ce}${t}`,p=`${Ce}_tomb${t}`,y=((D=e==null?void 0:e.cookieTTLDays)!=null?D:no)*24*60*60,o=Q=>Q&&Q.length>0?Q:null,f=()=>{var Q,$;return t&&!(e!=null&&e.cookieName)&&ot(p)===null?($=(Q=o(_t(gn)))!=null?Q:o(ot(Ce)))!=null?$:o(It(Ce)):null},a=(X=(z=(H=(V=(M=o(_t(n)))!=null?M:o(ot(i)))!=null?V:o(It(i)))!=null?H:f())!=null?z:o(e==null?void 0:e.ssrSessionId))!=null?X:oo();ro(n,a,y);let s=pn(i,a),c=ao(n),v=s?!1:so(i,a),T=!s&&!c&&!v;return{getSessionId:()=>a,isEphemeral:()=>T,destroy:()=>{a=null,co(n),lo(i),io(i),t&&!(e!=null&&e.cookieName)&&(_t(gn)!==null||ot(Ce)!==null||It(Ce)!==null)&&pn(p,"1")}}}var go=1800*1e3;function st(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function fn(e=go,t){let n=new Map,i=`_snt_asgn${pe(t)}_`,p=(a,s)=>`${i}${encodeURIComponent(a)}:${encodeURIComponent(s)}`,u=a=>{let s=a.slice(i.length),c=s.indexOf(":");if(c<0)return null;try{return{componentId:decodeURIComponent(s.slice(0,c)),segment:decodeURIComponent(s.slice(c+1))}}catch(v){return null}},y=()=>{try{let a=[];for(let s=0;s<localStorage.length;s++){let c=localStorage.key(s);c!=null&&c.startsWith(i)&&a.push(c)}return a}catch(a){return[]}},o=a=>a.assignedAt+(a.ttlMs&&a.ttlMs>0?a.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let a of y())try{let s=localStorage.getItem(a);if(!s)continue;let c=JSON.parse(s);if(o(c)){localStorage.removeItem(a);continue}let v=u(a);if(!v)continue;n.set(st(v.componentId,v.segment),c)}catch(s){}})(),{get(a,s){let c=n.get(st(a,s));return c?o(c)?(n.delete(st(a,s)),null):c:null},set(a,s,c){let v=st(a,s);n.set(v,c);try{localStorage.setItem(p(a,s),JSON.stringify(c))}catch(T){}},clear(){n.clear();for(let a of y())try{localStorage.removeItem(a)}catch(s){}}}}var Ge=["GPTBot","ChatGPT-User","OAI-SearchBot","ClaudeBot","Claude-User","Claude-SearchBot","PerplexityBot","Perplexity-User","Google-Extended","Applebot-Extended","Meta-ExternalAgent","Bytespider","CCBot","Amazonbot","cohere-ai","Diffbot"];function Ue(e){return Rt(e)!==null}function Rt(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=Ge.find(i=>t.includes(i.toLowerCase())))!=null?n:null}var it={GPTBot:"training","ChatGPT-User":"user","OAI-SearchBot":"search",ClaudeBot:"training","Claude-User":"user","Claude-SearchBot":"search",PerplexityBot:"search","Perplexity-User":"user","Google-Extended":"training","Applebot-Extended":"training","Meta-ExternalAgent":"training",Bytespider:"training",CCBot:"training",Amazonbot:"other","cohere-ai":"training",Diffbot:"other"};function mn(e){if(!e)return"other";let t=Ge.find(n=>n.toLowerCase()===e.toLowerCase());return t&&it[t]||"other"}function yn(){var t;let e={user:[],search:[],training:[],other:[]};for(let n of Ge)e[(t=it[n])!=null?t:"other"].push(n);return e}function $e(e){let t=e.toLowerCase();return/ipad|tablet|playbook|kindle|silk/.test(t)?"tablet":/mobi|iphone|ipod|android.*mobile|phone/.test(t)?"mobile":"desktop"}function Fe(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(p){}let i=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(i)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(i)?"social":"referral"}catch(n){return"direct"}}function je(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var Ct=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function at(e){let t={},n={};try{let i=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([p,u])=>{let y=Array.isArray(u)?u[0]:u;return y===void 0?[]:[[p,y]]});for(let[p,u]of i)p.startsWith("utm_")?p in t||(t[p]=u):Ct.includes(p)&&(p in n||(n[p]=u))}catch(i){}return{utmParams:t,clickIds:n}}function We(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function Sn(e){let t=po("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function po(e,t){var u,y,o,f,a,s,c,v;let n=(y=(u=t==null?void 0:t.userAgent)==null?void 0:u.trim())!=null?y:"",i=(f=(o=t==null?void 0:t.referer)==null?void 0:o.trim())!=null?f:"",p=(a=t==null?void 0:t.now)!=null?a:new Date;return A({sessionId:e,ephemeral:!1,utmParams:(s=t==null?void 0:t.utmParams)!=null?s:{},clickIds:(c=t==null?void 0:t.clickIds)!=null?c:{},deviceClass:n?$e(n):"desktop",trafficSource:i?Fe(i,t==null?void 0:t.appOrigin):"direct",referrerDomain:je(i),timeOfDay:We(p),dayOfWeek:(v=["sun","mon","tue","wed","thu","fri","sat"][p.getDay()])!=null?v:"sun",automation:(t==null?void 0:t.webdriver)===!0||Ue(n)},t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Te=require("@sentientui/policy");function Ve(e){return A(A(A({id:e.id},e.arms?{arms:[...e.arms]}:{}),e.dims?{dims:Object.fromEntries(Object.entries(e.dims).map(([t,n])=>[t,[...n]]))}:{}),e.baseline!==void 0?{baseline:e.baseline}:{})}function Oe(e){let t=Ve(e);return(0,Te.slotResultFor)(t,(0,Te.slotBaselineArm)(t))}function hn(e){let t={};for(let n of e)t[n.id]=Oe(n);return t}function lt(e){return typeof e=="string"?e:(0,Te.canonicalArm)(e)}var bn=require("@sentientui/policy"),ct="data-sentient-stage";function dt(e,t){return!t||typeof e!="string"||!(e==="returning"||bn.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function ut(e,t=document){try{e?t.documentElement.setAttribute(ct,e):t.documentElement.removeAttribute(ct)}catch(n){}}var Nt=require("@sentientui/policy");var pt=require("@sentientui/policy");var ft="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Tt="[sentient] Local mode \u2014 decisions are simulated on-device and nothing is sent over the network. Add an API key to learn from real traffic.",vn=!1,gt=!1;function fo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function kn(e){var a;let t=rt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(a=t.getSessionId())!=null?a:"local",i=fo(),p=import("@sentientui/core/local").then(s=>{let c=s;return c.LOCAL_ENGINE_AVAILABLE?(vn||(vn=!0,console.info(Tt)),c):(gt||(gt=!0,console.error(ft)),null)}).catch(()=>(gt||(gt=!0,console.error(ft)),null)),u=null,y={low:.15,medium:.5,high:.85},o=(()=>{var c;if(e.initialPersona)return A({},e.initialPersona);let s=Ie(e.apiKey||"local");return s?{persona:s.persona,confidence:(c=y[s.band])!=null?c:.15}:null})();function f(s){let c=document.documentElement;c.dataset.sentientPersona===void 0&&(c.dataset.sentientPersona=s.persona,c.dataset.sentientConfidence=(0,pt.confidenceBand)(s.confidence))}return{isLocal:!0,async decide(s){var T,C,D;let c=await p;if(!c)return null;let v=c.createLocalEngine({sessionId:n,forcedPersona:i}).decide(s);return u=Se(A({},v),{layoutOrder:(C=(T=v.layoutOrder)!=null?T:u==null?void 0:u.layoutOrder)!=null?C:null,slots:A(A({},(D=u==null?void 0:u.slots)!=null?D:{}),v.slots)}),Ae(e.apiKey||"local",{v:1,persona:u.persona,band:(0,pt.confidenceBand)(u.confidence),slots:u.slots,layoutOrder:u.layoutOrder,savedAt:Date.now()}),f(v),v},getSlotResult(s){var c,v,T;return(T=(v=u==null?void 0:u.slots[s])!=null?v:(c=e.initialSlots)==null?void 0:c[s])!=null?T:null},getSlotConfig(s){var c,v;return(v=(c=e.initialSlotConfig)==null?void 0:c[s])!=null?v:null},getSitePalette(){var s;return(s=e.initialPalette)!=null?s:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let s=u!=null?u:o;return s?{persona:s.persona,confidence:s.confidence,band:(0,pt.confidenceBand)(s.confidence)}:null},async assign(s,c){var C;let v=await p;return!v||!c||c.length===0?c!=null&&c[0]?{variantId:c[0],assignmentTtlMs:0}:null:{variantId:(C=v.createLocalEngine({sessionId:n,forcedPersona:i}).decide({components:[{id:s,variantIds:c}]}).assignments[s])!=null?C:c[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var Pt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Ot(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function xn(e,t){if(e===void 0||!Pt.test(e))return!1;if(e==="*")return!0;let n=Ot(t);if(e.endsWith("/*")){let i=Ot(e.slice(0,-2));return n.startsWith(i==="/"?"/":`${i}/`)&&n!==i}return n===Ot(e)}function wn(e,t){if(!e)return!1;if(e==="/")return t==="/";let n=e.endsWith("/")?e.slice(0,-1):e;return t===n||t.startsWith(`${n}/`)}function En(e){if(!/^https?:\/\//i.test(e))return e;try{return new URL(e).pathname||"/"}catch(t){return e}}var mo=["none","sm","md","lg"],yo=["start","center","end","stretch"],So=["start","center","end","between"],ho=["sm","md","lg"],bo=["normal","medium","bold"],vo=["default","muted","accent"],ko=["primary","secondary","ghost"],xo=["left","center","right"],wo=["auto","square","landscape","wide"],Eo=["cover","contain"],_o=[2,3,4],Io=[1,2,3,4],Ao=["default","raised"],Ro=["none","sm","md","lg"],Co=["measure"],To=["input","textarea","select"],Oo=["text","email","number","tel"],Po=5,Do=8,Bo=64,Lo=5,Mo=12,No=4,Ko=500;function _n(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="form"?!0:Array.isArray(t.children)?t.children.some(_n):!1}var Dr=40,Br=120,Lr=300;var Dt="sentient-reveal",Pe="sentient-revealed",Bt=240,mt=!1;function In(){var e;mt=!1,typeof document!="undefined"&&((e=document.getElementById(Dt))==null||e.remove())}function Go(e){if(mt||e.getElementById(Dt)){mt=!0;return}let t=Je(e.createElement("style"),e);t.id=Dt,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${Pe}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${Pe}{animation:${Pe} ${Bt}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),mt=!0}function An(e,t={}){var p;let n=(p=t.doc)!=null?p:typeof document!="undefined"?document:void 0;if(!n||!(e instanceof Element)||(t.arm!==void 0&&e.setAttribute("data-sentient-arm",t.arm),t.persona!==void 0&&e.setAttribute("data-sentient-persona",t.persona),t.previous!==void 0&&t.previous===e.textContent))return!1;Go(n),e.classList.remove(Pe),e.offsetWidth,e.classList.add(Pe);let i=()=>{e.classList.remove(Pe),e.removeEventListener("animationend",i)};return e.addEventListener("animationend",i),!0}function Rn(e,t,n,i){let p=[];{let o=!1,f=[],a=()=>{if(o)return;let s=Date.now();for(f.push(s);f.length>0&&s-f[0]>500;)f.shift();f.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",a),p.push(()=>t.removeEventListener("click",a))}{let u=!1,y=o=>{if(u||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;u=!0;let f=typeof window!="undefined"?window.getSelection():null,a=f?f.toString().length:0;e("text_copy",{selectionLength:a})};document.addEventListener("copy",y),p.push(()=>document.removeEventListener("copy",y))}{let u=!1,y=!1,o=null,f=()=>{o!==null&&(clearTimeout(o),o=null)},a=()=>{u||!y||(f(),o=setTimeout(()=>{!u&&y&&(u=!0,e("scroll_hesitation"))},3e3))},s=()=>{f(),a()},c=T=>{for(let C of T)y=C.intersectionRatio>.3,y?a():f()},v=new IntersectionObserver(c,{threshold:[.3]});v.observe(t),window.addEventListener("scroll",s,{passive:!0}),p.push(()=>{v.disconnect(),window.removeEventListener("scroll",s),f()})}if((i==null?void 0:i.tabLoss)!==!1){let u=!1,y=n!=null?n:Date.now(),o=()=>{if(u||document.visibilityState!=="hidden")return;let f=Date.now()-y;f<15e3&&(u=!0,e("tab_loss",{timeOnPage:f}))};document.addEventListener("visibilitychange",o),p.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let u of p)u()}}function Uo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var On="https://api.sentient-ui.com/v1/events",q=new Map,Pn=null;function $o(e,t){let n=q.get(e);n&&n.upgrade&&(n.reinit=t)}function Fo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var jo=3;function Lt(){return nt()}function yt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Wo(){let e=new WeakMap,t=new Map,n=!1,i=(o,f,a)=>{let s=o.get(f);return a===null?s?!0:(o.set(f,new Set),!1):s?s.has(a)?!0:(s.add(a),!1):(o.set(f,new Set([a])),!1)},p=typeof window!="undefined"&&"event"in window,u=()=>{if(!p)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},y=()=>{if(p){Promise.resolve().then(()=>{n=!1,t.clear()});return}let o=!1,f=()=>{o||(o=!0,n=!1,t.clear())};if(setTimeout(f,0),typeof MessageChannel=="function"){let a=new MessageChannel;a.port1.onmessage=()=>{a.port1.close(),a.port2.close(),f()},a.port2.postMessage(0)}};return{firedBefore(o,f){let a=u();if(a){let c=e.get(a);return c||(c=new Map,e.set(a,c)),i(c,o,f)}let s=i(t,o,f);return!s&&!n&&(n=!0,y()),s}}}var Dn=new Set;function Vo(e,t,n){let i=typeof window=="undefined"?null:window.history;if(!i)return()=>{};let p=!1,u,y=()=>{if(p)return;let a=yt();!a||a===u||(u=a,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${a}`))},o=[];for(let a of["pushState","replaceState"]){let s=i[a],c=function(...v){let T=s.apply(this,v);return y(),T};i[a]=c,o.push([a,s,c])}window.addEventListener("popstate",y);let f=yt();return f&&Dn.has(`${t}:${f}`)?u=f:y(),()=>{if(!p){p=!0,window.removeEventListener("popstate",y);for(let[a,s,c]of o)i[a]===c&&(i[a]=s)}}}var He={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Ho(){try{return at(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Bn(e){return e.replace(/\/events\/?$/,"")}function Ut(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(t=>t==="1"||t==="yes")}function zo(e){var f;if(typeof window=="undefined")return;let t=e!=null?e:Pn;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=q.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:i,upgrade:p,reinit:u}=n;if(!p){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(i.respectDoNotTrack!==!1&&Ut())return;let y=(u!=null?u:Ln)(Se(A({},i),{consent:!0}));p(y);let o=(f=q.get(t))==null?void 0:f.dispose;q.set(t,{config:Se(A({},i),{consent:!0}),upgrade:null,dispose:o})}function Qo(e,t){var $;let n=e.preConsentBehavior==="statistical_winner",i=Bn(($=e.ingestUrl)!=null?$:On),p={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},u=new Map,y=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(d,m,h){if(!n)return Promise.resolve(null);let g=u.get(d);return g?Promise.resolve(g):Gt(y,d,async()=>{try{let _=new URLSearchParams({componentId:d});for(let ee of m!=null?m:[])_.append("variantIds[]",ee);let N=ue(5e3),F;try{let ee=await fetch(`${i}/winner?${_.toString()}`,{headers:p,signal:N.signal});if(!ee.ok)return m!=null&&m[0]?{variantId:m[0],assignmentTtlMs:0}:null;F=await ee.json()}finally{N.clear()}let O={variantId:F.variantId,assignmentTtlMs:0};return u.set(d,O),O}catch(_){return m!=null&&m[0]?{variantId:m[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},f=!1,a=new Set,s=[],c=[],v=[],T=()=>{for(let[,,d]of v.splice(0))d(null);C.length=0},C=[],D=!1,M=()=>{if(f)return;D=!0;let d=q.get(e.apiKey);(d==null?void 0:d.upgrade)===Q&&q.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},V=[],H=()=>{setTimeout(()=>{var d;try{(d=V.shift())==null||d(o)}catch(m){}V.length&&H()})},z=d=>{f?V.length?V.push(d):d(o):!t&&!D&&C.length<100?C.push(d):D&&e.debug&&console.warn("[sentient] goal dropped: client released")},X={get gated(){return!f&&!t},get released(){return D&&!f},takeHeld:()=>C.splice(0),track:d=>o.track(d),goal:((d,m,h,g)=>z(_=>_.goal(d,m,h,g))),componentGoal:(d,m,h)=>o.componentGoal(d,m,h),identify:d=>o.identify(d),getAssignment:(d,m)=>o.getAssignment(d,m),isUnified:d=>{var m,h;return(h=(m=o.isUnified)==null?void 0:m.call(o,d))!=null?h:!1},assign:(d,m,h,g,_)=>o.assign(d,m,h,g,_),decide:d=>f?o.decide(d):D||t?Promise.resolve(null):new Promise(m=>v.push([d,Kt(),m])),getSlotResult:d=>o.getSlotResult(d),isSlotDecided:d=>{var m,h;return(h=(m=o.isSlotDecided)==null?void 0:m.call(o,d))!=null?h:!0},getSlotConfig:d=>o.getSlotConfig(d),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var d,m;return(m=(d=o.getStyleVocabulary)==null?void 0:d.call(o))!=null?m:null},reportSlots:(d,m,h,g)=>o.reportSlots(d,m,h,g),reportSkeleton:(d,m)=>{var h;return(h=o.reportSkeleton)==null?void 0:h.call(o,d,m)},reportAgentData:(d,m,h)=>{var g;return(g=o.reportAgentData)==null?void 0:g.call(o,d,m,h)},reportDrift:(d,m,h,g)=>{var _;return(_=o.reportDrift)==null?void 0:_.call(o,d,m,h,g)},requestSlots:(d,m,h)=>{var g;return f?(g=o.requestSlots)==null?void 0:g.call(o,d,m,h):s.push([d,m,h])},decideSlots:d=>{var m;return f?(m=o.decideSlots)==null?void 0:m.call(o,d):c.push(...d)},cancelSlots:d=>{var h;if(f)return(h=o.cancelSlots)==null?void 0:h.call(o,d);let m=new Set(d);for(let g of s)g[0]=g[0].filter(_=>!m.has(_));c=c.filter(g=>!m.has(g.id))},onSlotsChanged:d=>(a.add(d),()=>{a.delete(d)}),getPersona:()=>o.getPersona(),getVisitorId:()=>{var d,m;return(m=(d=o.getVisitorId)==null?void 0:d.call(o))!=null?m:null},fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(M(),T(),o.dispose()),destroy:()=>(M(),T(),f?o.destroy():tt(e.apiKey))};function Q(d){var h,g,_;o=d,f=!0,C.length&&(V.push(...C.splice(0)),H());let m=Kt();for(let[N,F,O]of v.splice(0))F!==m?O(null):d.decide(N).then(O,()=>O(null));(h=d.onSlotsChanged)==null||h.call(d,()=>a.forEach(N=>N()));for(let[N,F,O]of s.splice(0))N.length>0&&((g=d.requestSlots)==null||g.call(d,N,F,O));c.length>0&&((_=d.decideSlots)==null||_.call(d,c.splice(0)))}return{proxy:X,setInner:Q}}function Kt(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Gt(e,t,n){let i=e.get(t);if(i)return i;let p=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,p),p}function Ln(e){var Vt,Ht,zt,Qt,Xt,Jt,qt,Yt,Zt,en,tn;if(typeof window=="undefined")return He;e.nonce&&Xe(e.nonce),Pn=e.apiKey||"local";let t=q.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(r){}let n=e.respectDoNotTrack!==!1&&Ut(),i=e.consent===!1||n,p=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!p&&e.localMode!==!1)return q.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),i?He:kn(e);if(i){if(!e.apiKey||!e.apiKey.startsWith("pk_"))return e.preConsentBehavior==="statistical_winner"&&console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),q.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): the client was initialized with an invalid apiKey (expected a pk_ public key) \u2014 consent cannot enable tracking."}),He;let{proxy:r,setInner:l}=Qo(e,n);return q.set(e.apiKey,{config:e,upgrade:n?null:l}),r}if(!e.apiKey||!e.apiKey.startsWith("pk_"))return console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),He;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),He;let u=(Vt=e.ingestUrl)!=null?Vt:On,y=Date.now(),o=rt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),f=fn(void 0,e.apiKey),a=!1,s=se(e.apiKey),c=()=>!a&&se(e.apiKey)===s,v=new Set((Ht=e.initialUnified)!=null?Ht:[]),T=Se(A({},f),{get:(r,l)=>v.has(r)?null:f.get(r,l),set:(...r)=>{c()&&f.set(...r)}}),C=dn({ingestUrl:u,apiKey:e.apiKey}),D=Bn(u),M={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},V=new Set,H=un({url:`${D}/goals`,apiKey:e.apiKey,headers:M,onDrop:(r,l)=>{if(!e.debug){if(V.has(l))return;V.add(l)}console.warn(`[sentient] goal dropped (HTTP ${l}) \u2014 this will not be retried. `+(l===400?"The session was not found: call init() and let the session upsert complete before firing goals.":l===401||l===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),r)}}),z=$e((zt=navigator.userAgent)!=null?zt:""),X=window.location.origin,Q=Fe((Qt=document.referrer)!=null?Qt:"",X),$=(Xt=e.sessionSegment)!=null?Xt:`${z}:${Q}`,d=new Map,m=new Map,h=new Map,g=new Set,_=new Map,N=null,F=null,O=null,ee=new Set,ie=new Set,k=new Map,B=new Map,ge=new Set,be=new Set,te=new Set,ke=new Set,xe=null,oe=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,we=new Set,ae=new Set,ze=new Set,De=new Map,St=null,Qe=new Set,Be=new Map,ht=null,Mn=2,$t=new Map,re=!1,Ft=(r,l,S)=>{var b;let I=new Set,R=1;for(let x of r){l.delete(x);let w=((b=$t.get(x))!=null?b:0)+1;$t.set(x,w),w<=Mn&&(I.add(x),w>R&&(R=w))}I.size>0&&setTimeout(()=>{re||S(I)},me(R))},bt=r=>{for(let l of r)h.has(l.id)||h.set(l.id,Oe(l))};if(e.initialSlots)for(let[r,l]of Object.entries(e.initialSlots))h.set(r,l),g.add(r);if(e.initialSlotConfig)for(let[r,l]of Object.entries(e.initialSlotConfig))_.set(r,l);e.initialPalette&&(N=e.initialPalette),e.initialVocabulary&&(F=e.initialVocabulary);let le=Ie(e.apiKey);if(le){for(let[r,l]of Object.entries(le.slots))h.has(r)||h.set(r,l);for(let[r,l]of Object.entries((Jt=le.slotConfig)!=null?Jt:{}))_.has(r)||_.set(r,l);!N&&le.palette&&(N=le.palette),!F&&le.vocabulary&&(F=le.vocabulary)}let jt={low:.15,medium:.5,high:.85};if(e.initialPersona)O=A({},e.initialPersona);else{let r=document.documentElement.dataset;r.sentientPersona?O={persona:r.sentientPersona,confidence:(Yt=jt[(qt=r.sentientConfidence)!=null?qt:"low"])!=null?Yt:.15}:le&&(O={persona:le.persona,confidence:(Zt=jt[le.band])!=null?Zt:.15})}if(e.initialAssignments)for(let[r,l]of Object.entries(e.initialAssignments))T.set(r,$,{variantId:l,assignedAt:Date.now(),segment:$,confidence:1});let ye=Promise.resolve(),Wt=o.getSessionId();if(Wt){let r=je((en=document.referrer)!=null?en:""),{utmParams:l,clickIds:S}=Ho(),I=A(A(A(A({sessionId:Wt,deviceClass:z,trafficSource:Q,referrerDomain:r,utmParams:l,clickIds:S,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:We(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Ue((tn=navigator.userAgent)!=null?tn:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),R=async()=>{for(let b=0;;b++){if(re||!c())return;let x=ue(5e3);try{let w=await fetch(`${D}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(I),headers:M,signal:x.signal});if(w.status===402){console.warn("[SentientUI] Session limit exceeded for this project. The bandit will stop learning until the limit resets. Upgrade at sentient-ui.com/pricing");return}if(w.ok||Re(w)==="dropped")return}catch(w){}finally{x.clear()}if(b>=jo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(w=>setTimeout(w,me(b+1)))}};try{ye=R()}catch(b){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:C});let Nn=Wo(),ve=null,vt=!1,W={goal(r,l={},S=1,I=0){var j,L,Y,ne,Z,J,E;let R=o.getSessionId();if(!R||re||!c())return;let b=Fo(l)?l:{metadata:l},x=[r,(j=b.externalId)!=null?j:"",(L=b.stepIndex)!=null?L:I,(Y=b.weight)!=null?Y:S].join("\0"),w=b.value!==void 0?`${b.value}\0${(ne=b.currency)!=null?ne:""}`:null;if(Nn.firedBefore(x,w)){e.debug&&console.log(`[sentient] goal("${r}") already recorded for this action \u2014 not sent twice`);return}let K=Lt(),P={sessionId:R,name:r,metadata:(Z=b.metadata)!=null?Z:{},weight:(J=b.weight)!=null?J:S,stepIndex:(E=b.stepIndex)!=null?E:I,goalId:K,value:b.value,currency:b.currency,externalId:b.externalId};e.debug&&console.log("[sentient] goal",P);let G={id:K,body:JSON.stringify(P)};ye.then(()=>H.send(G))},componentGoal(r,l,S){var K,P,G;let I=o.getSessionId();if(!I||re||!c())return;let R=T.get(r,$),b=R?null:(K=h.get(r))!=null?K:null;if(!R&&b===null){e.debug&&console.warn(`[sentient] componentGoal("${r}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!R&&!g.has(r)){e.debug&&console.warn(`[sentient] componentGoal("${r}"): slot not decided this session \u2014 not attributed`);return}let x=R?R.variantId:lt(b),w={id:Lt(),sessionId:I,projectId:e.apiKey,componentId:r,variantId:x,eventType:"goal_achieved",goalType:l,payload:A({reward:(P=S==null?void 0:S.reward)!=null?P:1,goalValue:S==null?void 0:S.value,currency:S==null?void 0:S.currency},(G=S==null?void 0:S.metadata)!=null?G:{}),timestamp:Date.now(),timeInSession:Date.now()-y,path:yt()};e.debug&&console.log("[sentient] componentGoal",w),ye.then(()=>{!re&&c()&&C.push(w)})},identify(r){let l=o.getSessionId();!l||re||!c()||ye.then(()=>{fetch(`${D}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:l,userId:r,ephemeral:o.isEphemeral()}),headers:M}).catch(()=>{})})},track(r){let l=o.getSessionId();if(!l||re||!c()||r.eventType==="variant_assigned"&&h.get(r.componentId)!==void 0&&!g.has(r.componentId)&&!T.get(r.componentId,$))return;let S=Se(A({path:yt()},r),{id:Lt(),sessionId:l,timestamp:Date.now(),timeInSession:Date.now()-y});e.debug&&console.log("[sentient] track",S),ye.then(()=>C.push(S))},getAssignment(r,l){return T.get(r,l)},isUnified:r=>v.has(r),async assign(r,l,S,I,R){var K;let b=o.getSessionId();if(!b)return null;let x=(R==null?void 0:R.unified)===!0;if(x&&v.has(r))return{variantId:(K=l==null?void 0:l[0])!=null?K:"",assignmentTtlMs:0,unified:!0};let w=T.get(r,$);if(w&&(l!=null&&l.length||w.content!==void 0)){let P=w.ttlMs&&w.ttlMs>0?Math.max(0,w.assignedAt+w.ttlMs-Date.now()):0;return{variantId:w.variantId,assignmentTtlMs:P,content:w.content}}return Gt(d,x?`${r}\0unified`:r,async()=>{if(!await kt(ye,2500)||re||!c())return null;let P=ue(3e4);try{let G={sessionId:b,componentId:r,variantIds:l};I!==void 0?G.agentDataByVariant=I:S!==void 0&&(G.agentData=S),x&&(G.caps={unified:!0});let j=await fetch(`${D}/assign`,{method:"POST",body:JSON.stringify(G),headers:M,signal:P.signal});if(!j.ok)return null;let L=await j.json();return L.unified===!0?x?(v.add(r),{variantId:L.variantId,assignmentTtlMs:0,unified:!0}):null:(T.set(r,$,A({variantId:L.variantId,assignedAt:Date.now(),segment:$,confidence:1,content:L.content},L.assignmentTtlMs&&L.assignmentTtlMs>0?{ttlMs:L.assignmentTtlMs}:{})),L)}catch(G){return null}finally{P.clear()}})},async decide(r){var b,x;let l=o.getSessionId();if(!l)return null;let S=(b=r.slots)!=null?b:[],I={sessionId:l};r.sections&&r.sections.length>0&&(I.sections=r.sections.map(w=>({id:w}))),I.components=(x=r.components)!=null?x:[],S.length>0&&(I.slots=S.map(Ve)),r.slotsFrom==="registry"&&(I.slotsFrom="registry",r.registrySlotIds&&(I.registrySlotIds=r.registrySlotIds),r.bootstrap===!1&&(I.bootstrap=!1),r.render&&Object.keys(r.render).length>0&&(I.render=r.render)),r.v&&(I.v=r.v),typeof r.pp=="number"&&(I.pp=r.pp),e.persona&&(I.persona=e.persona);let R=JSON.stringify(I);return Gt(m,R,async()=>{var K,P,G,j,L,Y,ne,Z;if(!await kt(ye,2500)||re||!c())return bt(S),null;let w=ue(3e4);try{let J=await fetch(`${D}/decide`,{method:"POST",body:R,headers:M,signal:w.signal});if(!J.ok)return bt(S),null;let E=await J.json(),ce=dt(E.stage,e.stageAttributes);e.stageAttributes&&ut(ce);let Ee={};for(let U of S){let de=(K=E.slots)==null?void 0:K[U.id];if(de!==void 0){Ee[U.id]=de,h.set(U.id,de),g.add(U.id);continue}let nn=h.get(U.id);if(nn!==void 0)Ee[U.id]=nn;else{let on=Oe(U);Ee[U.id]=on,h.set(U.id,on)}}if(E.slots)for(let[U,de]of Object.entries(E.slots))U in Ee||(Ee[U]=de,h.set(U,de),g.add(U));let Kn=O!=null&&O.persona!=="unknown";E.persona&&!(E.persona==="unknown"&&Kn)?O={persona:E.persona,confidence:(P=E.confidence)!=null?P:0}:O||(O={persona:"unknown",confidence:0});for(let[U,de]of Object.entries((G=E.assignments)!=null?G:{}))T.set(U,$,{variantId:de,assignedAt:Date.now(),segment:$,confidence:1});if(E.slotConfig)for(let[U,de]of Object.entries(E.slotConfig))_.set(U,de);E.palette&&(N=E.palette),E.vocabulary&&(F=E.vocabulary);for(let U of(j=r.registrySlotIds)!=null?j:[])(L=E.slotConfig)!=null&&L[U]||(_.delete(U),h.delete(U),g.delete(U));return c()&&Ae(e.apiKey,A(A(A(A({v:1,persona:O.persona,band:(0,Nt.confidenceBand)(O.confidence),slots:Object.fromEntries(h),layoutOrder:(Y=E.layoutOrder)!=null?Y:null,savedAt:Date.now()},_.size>0?{slotConfig:Object.fromEntries(_)}:{}),N?{palette:N}:{}),F?{vocabulary:F}:{}),ce?{stage:ce}:{})),A(A(A(A(A(A(A({layoutOrder:(ne=E.layoutOrder)!=null?ne:null,assignments:(Z=E.assignments)!=null?Z:{},slots:Ee,persona:O.persona,confidence:O.confidence},E.slotConfig?{slotConfig:E.slotConfig}:{}),E.goals?{goals:E.goals}:{}),E.sectionMap?{sectionMap:E.sectionMap}:{}),E.palette?{palette:E.palette}:{}),E.vocabulary?{vocabulary:E.vocabulary}:{}),E.stage?{stage:E.stage}:{}),E.context?{context:E.context}:{})}catch(J){return bt(S),null}finally{w.clear()}})},getSlotResult(r){var l;return(l=h.get(r))!=null?l:null},isSlotDecided(r){return g.has(r)},getSlotConfig(r){var l;return(l=_.get(r))!=null?l:null},reportSlots(r,l,S,I){var b;let R={};for(let[x,w]of Object.entries(I!=null?I:{}))for(let K of w){let P=`${x}|${K.key}`;!oe.test(x)||te.has(P)||(te.add(P),((b=R[x])!=null?b:R[x]=[]).push(K))}Object.keys(R).length>0&&fetch(`${D}/slots/observed`,{method:"POST",headers:M,body:JSON.stringify({slotIds:Object.keys(R),authoredArms:R})}).catch(()=>{});for(let x of r)if(!(typeof x!="string"||x.length===0)){if(!oe.test(x)){Uo()&&!we.has(x)&&(we.add(x),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(x)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!ee.has(x)){ee.add(x),ie.add(x);let w=l==null?void 0:l[x];if(typeof w=="string"){let P=w.replace(/\s+/g," ").trim().slice(0,400);P!==""&&k.set(x,P)}let K=S==null?void 0:S[x];K!==void 0&&B.set(x,K)}}ie.size===0||xe!=null||(xe=setTimeout(()=>{xe=null;let x=[...ie];ie.clear();for(let w=0;w<x.length;w+=20){let K=x.slice(w,w+20),P={},G={};for(let j of K){let L=k.get(j);L!==void 0&&(P[j]=L,k.delete(j));let Y=B.get(j);Y!==void 0&&(G[j]=Y,B.delete(j))}fetch(`${D}/slots/observed`,{method:"POST",headers:M,body:JSON.stringify(A(Se(A(A({slotIds:K},Object.keys(P).length>0?{baselineTexts:P}:{}),Object.keys(G).length>0?{baselineSkeletons:G}:{}),{pagePaths:Object.fromEntries(K.map(j=>[j,location.pathname]))}),Object.keys(P).length>0&&o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(r,l){!oe.test(r)||ge.has(r)||(ge.add(r),fetch(`${D}/slots/observed`,{method:"POST",headers:M,body:JSON.stringify({slotIds:[r],baselineSkeletons:{[r]:l}})}).catch(()=>{}))},reportAgentData(r,l,S){let I=`${r}|${l}`;!oe.test(r)||ke.has(I)||(ke.add(I),fetch(`${D}/slots/observed`,{method:"POST",headers:M,body:JSON.stringify(A(A({slotIds:[r],agentData:{[r]:{[l]:S}}},l.startsWith("authored.")?{authoredArms:{[r]:[{key:l.slice(9)}]}}:{}),o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(r,l,S,I){let R=`${r}|${l}`,b=o.getSessionId();!b||be.has(R)||(be.add(R),fetch(`${D}/slots/drift`,{method:"POST",headers:M,body:JSON.stringify({sessionId:b,reports:[{slotId:r,expectedFp:l,observedFp:S,reason:I}]})}).catch(()=>{}))},requestSlots(r,l,S){var I,R;for(let b of r)ze.has(b)||(ze.add(b),oe.test(b)?De.set(b,{text:l==null?void 0:l[b],render:(I=S==null?void 0:S.render)==null?void 0:I[b],skeleton:(R=S==null?void 0:S.skeletons)==null?void 0:R[b]}):W.reportSlots([b]));De.size===0||St!=null||(St=setTimeout(()=>{St=null;let b=[...De];De.clear();for(let x=0;x<b.length;x+=50){let w=b.slice(x,x+50),K={};for(let[P,G]of w)G.render&&(K[P]=G.render);W.decide({slotsFrom:"registry",registrySlotIds:w.map(([P])=>P),bootstrap:!1,render:K}).then(P=>{var G,j;if(P){let L={},Y={},ne=[];for(let[Z,J]of w){let E=(G=P.slotConfig)==null?void 0:G[Z];if(E){E.needsSkeleton&&J.skeleton&&((j=W.reportSkeleton)==null||j.call(W,Z,J.skeleton));continue}ne.push(Z),J.text&&(L[Z]=J.text),J.skeleton&&(Y[Z]=J.skeleton)}ne.length>0&&W.reportSlots(ne,L,Y)}else Ft(w.map(([L])=>L),ze,L=>{var J;let Y={},ne={},Z={};for(let[E,ce]of w)L.has(E)&&(ce.text&&(Y[E]=ce.text),ce.render&&(ne[E]=ce.render),ce.skeleton&&(Z[E]=ce.skeleton));(J=W.requestSlots)==null||J.call(W,[...L],Y,{render:ne,skeletons:Z})});ae.forEach(L=>L())})}},0))},decideSlots(r){for(let l of r)Qe.has(l.id)||(Qe.add(l.id),Be.set(l.id,l));Be.size===0||ht!=null||(ht=setTimeout(()=>{ht=null;let l=[...Be.values()];Be.clear();for(let S=0;S<l.length;S+=30){let I=l.slice(S,S+30);W.decide({slots:I}).then(R=>{R||Ft(I.map(b=>b.id),Qe,b=>{var x;return(x=W.decideSlots)==null?void 0:x.call(W,I.filter(w=>b.has(w.id)))}),ae.forEach(b=>b())})}},0))},cancelSlots(r){for(let l of r)De.delete(l)&&ze.delete(l),Be.delete(l)&&Qe.delete(l)},onSlotsChanged(r){return ae.add(r),()=>{ae.delete(r)}},getStyleVocabulary(){return F},getSitePalette(){return N},getVisitorId:()=>c()?o.getSessionId():null,getPersona(){return O?{persona:O.persona,confidence:O.confidence,band:(0,Nt.confidenceBand)(O.confidence)}:null},async fetchWeights(){var l;let r=ue(5e3);try{let S=await fetch(`${D}/weights`,{headers:M,signal:r.signal});return S.ok?(l=(await S.json()).components)!=null?l:[]:[]}catch(S){return[]}finally{r.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){C.flush(),H.flush()},dispose(){var r;ve==null||ve(),vt=!0,re=!0,C.destroy(),H.destroy(),((r=q.get(e.apiKey))==null?void 0:r.dispose)===W.dispose&&q.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var r;ve==null||ve(),vt=!0,re=!0,a=!0,Ye(e.apiKey),C.destroy({forget:!0}),H.destroy({forget:!0}),o.destroy(),T.clear(),((r=q.get(e.apiKey))==null?void 0:r.dispose)===W.dispose&&q.delete(e.apiKey);try{localStorage.removeItem(fe+e.apiKey),localStorage.removeItem(Ne(e.apiKey)),localStorage.removeItem(Ke(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${pe(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(l){}e.debug&&console.log("[sentient] destroyed")}};if(q.set(e.apiKey,{config:e,upgrade:null,dispose:W.dispose}),ve=Vo(W,e.apiKey,r=>{ye.then(()=>{vt||Dn.add(r)})}),e.debug){let r=window;r.__sentient&&(r.__sentient.client=W)}return W}0&&(module.exports={AGENT_INTENTS,BLOCK_ALIGNS,BLOCK_EMPHASES,BLOCK_FITS,BLOCK_GAPS,BLOCK_GRID_COLUMNS,BLOCK_HEADING_LEVELS,BLOCK_JUSTIFIES,BLOCK_MAX_WIDTHS,BLOCK_PADS,BLOCK_RATIOS,BLOCK_SIZES,BLOCK_SURFACES,BLOCK_TEXT_ALIGNS,BLOCK_TONES,BLOCK_WEIGHTS,CLICK_ID_KEYS,FORM_FIELD_KINDS,FORM_INPUT_TYPES,LEGACY_SESSION_COOKIE_NAME,LOCAL_MODE_BANNER,MAX_BLOCK_ARMS,MAX_BLOCK_CHILDREN,MAX_BLOCK_DEPTH,MAX_BLOCK_NODES,MAX_BLOCK_TEXT_LEN,MAX_FORM_FIELDS,MAX_FORM_SELECT_OPTIONS,MAX_SKELETON_LEAVES,MAX_SKELETON_NODES,MAX_SKELETON_TEXT,PAGE_SCOPE_RE,PROD_KEYLESS_ERROR,REVEAL_MS,SNAPSHOT_STORAGE_KEY_PREFIX,STAGE_ATTRIBUTE,_registerConsentUpgradeInit,agentIntent,agentUaList,applyNonce,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,classifiedAgents,containsFormBlock,cspNonce,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,exposedStage,extractTrackedParams,forgetGeneration,forgetVisitor,grantConsent,init,isDoNotTrackEnabled,matchedAgentToken,normalizeUrlPattern,pageScopeMatches,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,resetRevealStyles,reveal,routeKey,sessionCookieName,setCspNonce,setStageAttribute,toWireSlot,uaTokenMatch,urlMatches,writeSnapshot});
2
2
  //# sourceMappingURL=index.js.map